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

Unified Diff: third_party/WebKit/Source/core/editing/CaretBase.cpp

Issue 2322193002: Simplify caret color calculation in CaretBase::paintCaret() (Closed)
Patch Set: 2016-09-09T15:00:21 Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/editing/CaretBase.cpp
diff --git a/third_party/WebKit/Source/core/editing/CaretBase.cpp b/third_party/WebKit/Source/core/editing/CaretBase.cpp
index 0188054436a7db1bf507c3295b26105fc1349757..ba7b5d0d089d621f1b619f15d016ff0296a85725 100644
--- a/third_party/WebKit/Source/core/editing/CaretBase.cpp
+++ b/third_party/WebKit/Source/core/editing/CaretBase.cpp
@@ -204,17 +204,7 @@ void CaretBase::paintCaret(Node* node, GraphicsContext& context, const LayoutPoi
layoutObject->flipForWritingMode(drawingRect);
drawingRect.moveBy(roundedIntPoint(paintOffset));
- Color caretColor = Color::black;
-
- Element* element;
- if (node->isElementNode())
- element = toElement(node);
- else
- element = node->parentElement();
-
- if (element && element->layoutObject())
- caretColor = element->layoutObject()->resolveColor(CSSPropertyColor);
-
+ const Color caretColor = node->layoutObject()->resolveColor(CSSPropertyColor);
Xiaocheng 2016/09/09 07:40:43 Do you mean |node| is always a |Text|? If so, coul
yoichio 2016/09/09 07:53:54 node->layoutObject() exists always?
yosin_UTC9 2016/09/09 08:27:21 |node| comes from anchor node of VisiblePosition.
IntRect paintRect = pixelSnappedIntRect(drawingRect);
DrawingRecorder drawingRecorder(context, *this, DisplayItem::kCaret, paintRect);
context.fillRect(paintRect, caretColor);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698