| Index: third_party/WebKit/Source/core/editing/RenderedPosition.cpp
|
| diff --git a/third_party/WebKit/Source/core/editing/RenderedPosition.cpp b/third_party/WebKit/Source/core/editing/RenderedPosition.cpp
|
| index 96e85c1bb18ee59afaeaafe8a885b277bac0e17d..6069b69706d99996d3ebdc98d12cb18f6d866f48 100644
|
| --- a/third_party/WebKit/Source/core/editing/RenderedPosition.cpp
|
| +++ b/third_party/WebKit/Source/core/editing/RenderedPosition.cpp
|
| @@ -235,7 +235,7 @@ IntRect RenderedPosition::absoluteRect(LayoutUnit* extraWidthToEndOfLine) const
|
| return localRect == IntRect() ? IntRect() : m_layoutObject->localToAbsoluteQuad(FloatRect(localRect)).enclosingBoundingBox();
|
| }
|
|
|
| -void RenderedPosition::positionInGraphicsLayerBacking(CompositedSelectionBound& bound) const
|
| +void RenderedPosition::positionInGraphicsLayerBacking(CompositedSelectionBound& bound, bool selectionStart) const
|
| {
|
| bound.layer = nullptr;
|
| bound.edgeTopInLayer = bound.edgeBottomInLayer = FloatPoint();
|
| @@ -245,8 +245,26 @@ void RenderedPosition::positionInGraphicsLayerBacking(CompositedSelectionBound&
|
|
|
| LayoutRect rect = m_layoutObject->localCaretRect(m_inlineBox, m_offset);
|
| PaintLayer* layer = nullptr;
|
| - bound.edgeTopInLayer = m_layoutObject->localToInvalidationBackingPoint(rect.minXMinYCorner(), &layer);
|
| - bound.edgeBottomInLayer = m_layoutObject->localToInvalidationBackingPoint(rect.minXMaxYCorner(), nullptr);
|
| + if (m_layoutObject->style()->isHorizontalWritingMode()) {
|
| + bound.edgeTopInLayer = m_layoutObject->localToInvalidationBackingPoint(rect.minXMinYCorner(), &layer);
|
| + bound.edgeBottomInLayer = m_layoutObject->localToInvalidationBackingPoint(rect.minXMaxYCorner(), nullptr);
|
| + } else {
|
| + bound.edgeTopInLayer = m_layoutObject->localToInvalidationBackingPoint(rect.minXMinYCorner(), &layer);
|
| + bound.edgeBottomInLayer = m_layoutObject->localToInvalidationBackingPoint(rect.maxXMinYCorner(), nullptr);
|
| +
|
| + // When text is vertical, it looks better for the start handle baseline to
|
| + // be at the starting edge, to enclose the selection fully between the
|
| + // handles.
|
| + if (selectionStart) {
|
| + float xSwap = bound.edgeBottomInLayer.x();
|
| + bound.edgeBottomInLayer.setX(bound.edgeTopInLayer.x());
|
| + bound.edgeTopInLayer.setX(xSwap);
|
| + }
|
| +
|
| + // Flipped blocks writing mode is not only vertical but also right to left.
|
| + bound.isTextDirectionRTL = m_layoutObject->hasFlippedBlocksWritingMode();
|
| + }
|
| +
|
| bound.layer = layer ? layer->graphicsLayerBacking() : nullptr;
|
| }
|
|
|
|
|