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

Unified Diff: third_party/WebKit/Source/core/layout/LayoutText.cpp

Issue 2683233005: Set caret width based on device scale factor (Closed)
Patch Set: Created 3 years, 10 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
Index: third_party/WebKit/Source/core/layout/LayoutText.cpp
diff --git a/third_party/WebKit/Source/core/layout/LayoutText.cpp b/third_party/WebKit/Source/core/layout/LayoutText.cpp
index 3f4d6a8f309e0e4d0f095ced53f3f17713755d5c..6cecd18b82dc96a6cf1358b5cc0b545f75808c27 100644
--- a/third_party/WebKit/Source/core/layout/LayoutText.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutText.cpp
@@ -765,9 +765,11 @@ LayoutRect LayoutText::localCaretRect(InlineBox* inlineBox,
LayoutUnit left = box->positionForOffset(caretOffset);
// Distribute the caret's width to either side of the offset.
- LayoutUnit caretWidthLeftOfOffset = caretWidth() / 2;
+ LayoutUnit caretWidthLeftOfOffset =
+ caretWidth(frameView()->getHostWindow()) / 2;
oshima 2017/02/10 19:55:16 ditto
malaykeshav 2017/02/10 21:00:54 Done
left -= caretWidthLeftOfOffset;
- LayoutUnit caretWidthRightOfOffset = caretWidth() - caretWidthLeftOfOffset;
+ LayoutUnit caretWidthRightOfOffset =
+ caretWidth(frameView()->getHostWindow()) - caretWidthLeftOfOffset;
left = LayoutUnit(left.round());
@@ -817,7 +819,7 @@ LayoutRect LayoutText::localCaretRect(InlineBox* inlineBox,
if (rightAligned) {
left = std::max(left, leftEdge);
- left = std::min(left, rootRight - caretWidth());
+ left = std::min(left, rootRight - caretWidth(frameView()->getHostWindow()));
} else {
left = std::min(left, rightEdge - caretWidthRightOfOffset);
left = std::max(left, rootLeft);
@@ -825,8 +827,10 @@ LayoutRect LayoutText::localCaretRect(InlineBox* inlineBox,
return LayoutRect(
style()->isHorizontalWritingMode()
- ? IntRect(left.toInt(), top, caretWidth().toInt(), height)
- : IntRect(top, left.toInt(), height, caretWidth().toInt()));
+ ? IntRect(left.toInt(), top,
+ caretWidth(frameView()->getHostWindow()).toInt(), height)
+ : IntRect(top, left.toInt(), height,
+ caretWidth(frameView()->getHostWindow()).toInt()));
}
ALWAYS_INLINE float LayoutText::widthFromFont(

Powered by Google App Engine
This is Rietveld 408576698