Fix clientLeft value for RTL direction, while the element have vertical scrollbar in left side.

BUG=128500

Review URL: https://codereview.chromium.org/70163005

git-svn-id: svn://svn.chromium.org/blink/trunk@168625 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 85ae0cfa
......@@ -77,7 +77,9 @@
positions = sumPositions(content);
var inside = document.getElementById('inside-overflow');
var overflow = document.getElementById('overflow');
clientX = positions.offsetLeft + overflow.clientLeft + content.clientWidth - inside.clientWidth - window.scrollX + offsetX;
var borderWidth = 2;
var scrollbarWidth = overflow.offsetWidth - overflow.clientWidth - 2*borderWidth;
clientX = positions.offsetLeft + overflow.clientLeft + content.clientWidth - scrollbarWidth - inside.clientWidth - window.scrollX + offsetX;
dispatchEvent(clientX, clientY, 'inside-overflow', offsetX, offsetY);
offsetX = 11;
......
......@@ -13,6 +13,7 @@ PASS innerLTR.clientWidth == innerRTL.clientWidth is true
PASS innerLTR.scrollWidth == innerRTL.scrollWidth is true
Verify the width of the vertical scrollbar of the outer RTL element is the same as the one of the outer LTR element regardless of their scrollbar positions.
PASS scrollbarWidthLTR == scrollbarWidthRTL is true
PASS outerRTL.clientLeft == scrollbarWidthRTL is true
PASS successfullyParsed is true
TEST COMPLETE
......
......@@ -34,6 +34,7 @@ debug('Verify the width of the vertical scrollbar of the outer RTL element is th
var scrollbarWidthLTR = outerLTR.offsetWidth - outerLTR.clientWidth;
var scrollbarWidthRTL = outerRTL.offsetWidth - outerRTL.clientWidth;
shouldBeTrue('scrollbarWidthLTR == scrollbarWidthRTL');
shouldBeTrue('outerRTL.clientLeft == scrollbarWidthRTL');
</script>
</body>
</html>
......@@ -4281,8 +4281,12 @@ void RenderBox::addContentsVisualOverflow(const LayoutRect& rect)
return;
}
if (!m_overflow)
m_overflow = adoptPtr(new RenderOverflow(clientBoxRect(), borderBoxRect()));
if (!m_overflow) {
LayoutRect clientBox = clientBoxRect();
if (style()->shouldPlaceBlockDirectionScrollbarOnLogicalLeft())
clientBox.move(-verticalScrollbarWidth(), 0);
m_overflow = adoptPtr(new RenderOverflow(clientBox, borderBoxRect()));
}
m_overflow->addContentsVisualOverflow(rect);
}
......
......@@ -251,7 +251,7 @@ public:
// More IE extensions. clientWidth and clientHeight represent the interior of an object
// excluding border and scrollbar. clientLeft/Top are just the borderLeftWidth and borderTopWidth.
LayoutUnit clientLeft() const { return borderLeft(); }
LayoutUnit clientLeft() const { return borderLeft() + (style()->shouldPlaceBlockDirectionScrollbarOnLogicalLeft() ? verticalScrollbarWidth() : 0); }
LayoutUnit clientTop() const { return borderTop(); }
LayoutUnit clientWidth() const;
LayoutUnit clientHeight() const;
......
......@@ -802,9 +802,6 @@ GraphicsLayerUpdater::UpdateType CompositedLayerMapping::updateGraphicsLayerGeom
ASSERT(m_scrollingContentsLayer);
RenderBox* renderBox = toRenderBox(renderer());
IntRect clientBox = enclosingIntRect(renderBox->clientBoxRect());
// FIXME: We should make RenderBox::clientBoxRect consider scrollbar placement.
if (style->shouldPlaceBlockDirectionScrollbarOnLogicalLeft())
clientBox.move(renderBox->verticalScrollbarWidth(), 0);
IntSize adjustedScrollOffset = m_owningLayer->scrollableArea()->adjustedScrollOffset();
m_scrollingLayer->setPosition(FloatPoint(clientBox.location() - localCompositingBounds.location() + roundedIntSize(m_subpixelAccumulation)));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment