Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(586)

Side by Side Diff: Source/core/editing/FrameSelection.cpp

Issue 14098003: Change the caret color according to the lightness of the background color. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Patch for landing Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « LayoutTests/editing/caret/caret-color-expected.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1440 matching lines...) Expand 10 before | Expand all | Expand 10 after
1451 LayoutRect drawingRect = localCaretRectWithoutUpdate(); 1451 LayoutRect drawingRect = localCaretRectWithoutUpdate();
1452 RenderObject* renderer = caretRenderer(node); 1452 RenderObject* renderer = caretRenderer(node);
1453 if (renderer && renderer->isBox()) 1453 if (renderer && renderer->isBox())
1454 toRenderBox(renderer)->flipForWritingMode(drawingRect); 1454 toRenderBox(renderer)->flipForWritingMode(drawingRect);
1455 drawingRect.moveBy(roundedIntPoint(paintOffset)); 1455 drawingRect.moveBy(roundedIntPoint(paintOffset));
1456 LayoutRect caret = intersection(drawingRect, clipRect); 1456 LayoutRect caret = intersection(drawingRect, clipRect);
1457 if (caret.isEmpty()) 1457 if (caret.isEmpty())
1458 return; 1458 return;
1459 1459
1460 Color caretColor = Color::black; 1460 Color caretColor = Color::black;
1461 Element* element = node->rootEditableElement(); 1461
1462 Element* element;
1463 if (node->isElementNode())
1464 element = toElement(node);
1465 else
1466 element = node->parentElement();
1467
1462 if (element && element->renderer()) 1468 if (element && element->renderer())
1463 caretColor = element->renderer()->style()->visitedDependentColor(CSSProp ertyColor); 1469 caretColor = element->renderer()->style()->visitedDependentColor(CSSProp ertyColor);
1464 1470
1465 context->fillRect(caret, caretColor); 1471 context->fillRect(caret, caretColor);
1466 } 1472 }
1467 1473
1468 void FrameSelection::debugRenderer(RenderObject *r, bool selected) const 1474 void FrameSelection::debugRenderer(RenderObject *r, bool selected) const
1469 { 1475 {
1470 if (r->node()->isElementNode()) { 1476 if (r->node()->isElementNode()) {
1471 Element* element = static_cast<Element *>(r->node()); 1477 Element* element = static_cast<Element *>(r->node());
(...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after
2065 sel.showTreeForThis(); 2071 sel.showTreeForThis();
2066 } 2072 }
2067 2073
2068 void showTree(const WebCore::FrameSelection* sel) 2074 void showTree(const WebCore::FrameSelection* sel)
2069 { 2075 {
2070 if (sel) 2076 if (sel)
2071 sel->showTreeForThis(); 2077 sel->showTreeForThis();
2072 } 2078 }
2073 2079
2074 #endif 2080 #endif
OLDNEW
« no previous file with comments | « LayoutTests/editing/caret/caret-color-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698