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 1422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1433 RenderObject* renderer = caretRenderer(node); | 1433 RenderObject* renderer = caretRenderer(node); |
1434 if (renderer && renderer->isBox()) | 1434 if (renderer && renderer->isBox()) |
1435 toRenderBox(renderer)->flipForWritingMode(drawingRect); | 1435 toRenderBox(renderer)->flipForWritingMode(drawingRect); |
1436 drawingRect.moveBy(roundedIntPoint(paintOffset)); | 1436 drawingRect.moveBy(roundedIntPoint(paintOffset)); |
1437 LayoutRect caret = intersection(drawingRect, clipRect); | 1437 LayoutRect caret = intersection(drawingRect, clipRect); |
1438 if (caret.isEmpty()) | 1438 if (caret.isEmpty()) |
1439 return; | 1439 return; |
1440 | 1440 |
1441 Color caretColor = Color::black; | 1441 Color caretColor = Color::black; |
1442 ColorSpace colorSpace = ColorSpaceDeviceRGB; | 1442 ColorSpace colorSpace = ColorSpaceDeviceRGB; |
1443 Element* element = node->rootEditableElement(); | 1443 Element* element = static_cast<Element *>(node); |
1444 if (element && element->renderer()) { | 1444 if (element && element->renderer()) { |
1445 caretColor = element->renderer()->style()->visitedDependentColor(CSSProp ertyColor); | 1445 bool isBackgroundWhite = true; |
eseidel
2013/04/27 05:10:42
This doesn't mean "isBackgroundWhite" either. :)
| |
1446 RenderObject* renderer = element->renderer(); | |
1447 while (renderer) { | |
eseidel
2013/04/27 05:10:42
I would re-write this as a helper function:
Rende
joone
2013/04/29 19:17:28
Okay, I will add this helper function.
| |
1448 if (renderer->style()->hasBackground()) { | |
1449 isBackgroundWhite = false; | |
1450 break; | |
1451 } | |
1452 if (!renderer->isRoot()) | |
1453 renderer = renderer->parent(); | |
1454 else | |
1455 break; | |
1456 } | |
1457 | |
1458 Color backgroundColor; | |
1459 if (!isBackgroundWhite) { | |
1460 backgroundColor = renderer->style()->visitedDependentColor(CSSProper tyBackgroundColor); | |
1461 if (backgroundColor.lightness() < 0.5) | |
1462 caretColor = Color::white; | |
1463 } else | |
1464 caretColor = Color::black; | |
1465 | |
1446 colorSpace = element->renderer()->style()->colorSpace(); | 1466 colorSpace = element->renderer()->style()->colorSpace(); |
1447 } | 1467 } |
1448 | 1468 |
1449 context->fillRect(caret, caretColor, colorSpace); | 1469 context->fillRect(caret, caretColor, colorSpace); |
1450 } | 1470 } |
1451 | 1471 |
1452 void FrameSelection::debugRenderer(RenderObject *r, bool selected) const | 1472 void FrameSelection::debugRenderer(RenderObject *r, bool selected) const |
1453 { | 1473 { |
1454 if (r->node()->isElementNode()) { | 1474 if (r->node()->isElementNode()) { |
1455 Element* element = static_cast<Element *>(r->node()); | 1475 Element* element = static_cast<Element *>(r->node()); |
(...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2049 sel.showTreeForThis(); | 2069 sel.showTreeForThis(); |
2050 } | 2070 } |
2051 | 2071 |
2052 void showTree(const WebCore::FrameSelection* sel) | 2072 void showTree(const WebCore::FrameSelection* sel) |
2053 { | 2073 { |
2054 if (sel) | 2074 if (sel) |
2055 sel->showTreeForThis(); | 2075 sel->showTreeForThis(); |
2056 } | 2076 } |
2057 | 2077 |
2058 #endif | 2078 #endif |
OLD | NEW |