OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2004, 2008, 2009, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2004, 2008, 2009, 2010 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 1426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1437 RenderObject* renderer = caretRenderer(node); | 1437 RenderObject* renderer = caretRenderer(node); |
1438 if (renderer && renderer->isBox()) | 1438 if (renderer && renderer->isBox()) |
1439 toRenderBox(renderer)->flipForWritingMode(drawingRect); | 1439 toRenderBox(renderer)->flipForWritingMode(drawingRect); |
1440 drawingRect.moveBy(roundedIntPoint(paintOffset)); | 1440 drawingRect.moveBy(roundedIntPoint(paintOffset)); |
1441 LayoutRect caret = intersection(drawingRect, clipRect); | 1441 LayoutRect caret = intersection(drawingRect, clipRect); |
1442 if (caret.isEmpty()) | 1442 if (caret.isEmpty()) |
1443 return; | 1443 return; |
1444 | 1444 |
1445 Color caretColor = Color::black; | 1445 Color caretColor = Color::black; |
1446 ColorSpace colorSpace = ColorSpaceDeviceRGB; | 1446 ColorSpace colorSpace = ColorSpaceDeviceRGB; |
1447 Element* element = node->rootEditableElement(); | 1447 Element* element = static_cast<Element *>(node); |
1448 if (element && element->renderer()) { | 1448 if (element && element->renderer()) { |
1449 caretColor = element->renderer()->style()->visitedDependentColor(CSSProp ertyColor); | 1449 bool isTransparentPage = true; |
eseidel
2013/04/18 16:03:16
I'm confused. This is clearly not always black, a
joone
2013/04/19 00:25:22
Yes, the caret color is not always black. I misund
| |
1450 RenderObject* renderer = element->renderer(); | |
1451 while (renderer) { | |
1452 if (renderer->style()->hasBackground()) { | |
eseidel
2013/04/18 16:03:16
I'm not sure what it means to be a transparent pag
joone
2013/04/19 00:25:22
Yes, RenderView paints the background with FrameVi
joone
2013/04/26 19:12:55
How about isBackgroundWhite instead of isTranspare
| |
1453 isTransparentPage = false; | |
1454 break; | |
1455 } | |
1456 if (!renderer->isRoot()) | |
1457 renderer = renderer->parent(); | |
1458 else | |
1459 break; | |
1460 } | |
1461 | |
1462 Color backgroundColor; | |
1463 if (!isTransparentPage) { | |
1464 backgroundColor = renderer->style()->visitedDependentColor(CSSProper tyBackgroundColor); | |
1465 if (backgroundColor.lightness() < 0.5) | |
1466 caretColor = Color::white; | |
1467 } else | |
1468 caretColor = Color::black; | |
1469 | |
1450 colorSpace = element->renderer()->style()->colorSpace(); | 1470 colorSpace = element->renderer()->style()->colorSpace(); |
1451 } | 1471 } |
1452 | 1472 |
1453 context->fillRect(caret, caretColor, colorSpace); | 1473 context->fillRect(caret, caretColor, colorSpace); |
1454 } | 1474 } |
1455 | 1475 |
1456 void FrameSelection::debugRenderer(RenderObject *r, bool selected) const | 1476 void FrameSelection::debugRenderer(RenderObject *r, bool selected) const |
1457 { | 1477 { |
1458 if (r->node()->isElementNode()) { | 1478 if (r->node()->isElementNode()) { |
1459 Element* element = static_cast<Element *>(r->node()); | 1479 Element* element = static_cast<Element *>(r->node()); |
(...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2053 sel.showTreeForThis(); | 2073 sel.showTreeForThis(); |
2054 } | 2074 } |
2055 | 2075 |
2056 void showTree(const WebCore::FrameSelection* sel) | 2076 void showTree(const WebCore::FrameSelection* sel) |
2057 { | 2077 { |
2058 if (sel) | 2078 if (sel) |
2059 sel->showTreeForThis(); | 2079 sel->showTreeForThis(); |
2060 } | 2080 } |
2061 | 2081 |
2062 #endif | 2082 #endif |
OLD | NEW |