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

Unified Diff: Source/core/rendering/RenderBoxModelObject.cpp

Issue 447243002: Cursor to be centrally aligned instead of top aligned (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Test fix for Win-XP platform Created 6 years, 4 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 | « LayoutTests/platform/win/editing/selection/mixed-editability-10-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/RenderBoxModelObject.cpp
diff --git a/Source/core/rendering/RenderBoxModelObject.cpp b/Source/core/rendering/RenderBoxModelObject.cpp
index d8e6b964a86ff8542c214b0063fbfc997faca326..0f19eef4aff7c5bc08d05f9997643a974c4e2bf3 100644
--- a/Source/core/rendering/RenderBoxModelObject.cpp
+++ b/Source/core/rendering/RenderBoxModelObject.cpp
@@ -2561,7 +2561,6 @@ LayoutRect RenderBoxModelObject::localCaretRectForEmptyElement(LayoutUnit width,
// constructed and this kludge is not called any more. So only the caret size
// of an empty :first-line'd block is wrong. I think we can live with that.
RenderStyle* currentStyle = firstLineStyle();
- LayoutUnit height = style()->fontMetrics().height();
enum CaretAlignment { alignLeft, alignRight, alignCenter };
@@ -2613,8 +2612,9 @@ LayoutRect RenderBoxModelObject::localCaretRectForEmptyElement(LayoutUnit width,
}
x = std::min(x, std::max<LayoutUnit>(maxX - caretWidth, 0));
- LayoutUnit y = paddingTop() + borderTop();
-
+ LayoutUnit height = style()->fontMetrics().height();
+ LayoutUnit verticalSpace = lineHeight(true, currentStyle->isHorizontalWritingMode() ? HorizontalLine : VerticalLine, PositionOfInteriorLineBoxes) - height;
+ LayoutUnit y = paddingTop() + borderTop() + (verticalSpace / 2);
return currentStyle->isHorizontalWritingMode() ? LayoutRect(x, y, caretWidth, height) : LayoutRect(y, x, height, caretWidth);
}
« no previous file with comments | « LayoutTests/platform/win/editing/selection/mixed-editability-10-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698