summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsanjoy.pal@samsung.com <sanjoy.pal@samsung.com@bbb929c8-8fbe-4397-9dbb-9b2b20218538>2013-11-05 13:56:52 +0000
committersanjoy.pal@samsung.com <sanjoy.pal@samsung.com@bbb929c8-8fbe-4397-9dbb-9b2b20218538>2013-11-05 13:56:52 +0000
commitad403a1633fdc6ca8fd0b1b7cca212f42bd84f49 (patch)
treee8cc2c1729d2bbe27d8e59a94be98a09ad2ee029
parent40b809b04af5f79d3585e83afe86b8b2b5134a5b (diff)
downloadchromium_src-ad403a1633fdc6ca8fd0b1b7cca212f42bd84f49.zip
chromium_src-ad403a1633fdc6ca8fd0b1b7cca212f42bd84f49.tar.gz
chromium_src-ad403a1633fdc6ca8fd0b1b7cca212f42bd84f49.tar.bz2
Correction to layoutOverflowRect calculation in case of direction:rtl
BUG=179332 Webkit bug https://bugs.webkit.org/show_bug.cgi?id=85856 Review URL: https://codereview.chromium.org/25373006 git-svn-id: svn://svn.chromium.org/blink/trunk@161333 bbb929c8-8fbe-4397-9dbb-9b2b20218538
-rw-r--r--third_party/WebKit/LayoutTests/TestExpectations7
-rw-r--r--third_party/WebKit/LayoutTests/compositing/rtl/rtl-overflow-scrolling-expected.pngbin0 -> 2904 bytes
-rw-r--r--third_party/WebKit/LayoutTests/compositing/rtl/rtl-overflow-scrolling-expected.txt2
-rw-r--r--third_party/WebKit/LayoutTests/platform/win/fast/block/float/026-expected.txt2
-rw-r--r--third_party/WebKit/LayoutTests/platform/win/fast/block/float/028-expected.txt2
-rw-r--r--third_party/WebKit/LayoutTests/scrollbars/rtl/div-horizontal-expected.txt2
-rw-r--r--third_party/WebKit/LayoutTests/scrollbars/rtl/div-horizontal-with-vertical-scrollbar-expected.txt20
-rw-r--r--third_party/WebKit/LayoutTests/scrollbars/rtl/div-horizontal-with-vertical-scrollbar.html39
-rw-r--r--third_party/WebKit/Source/core/rendering/RenderBlock.cpp8
-rw-r--r--third_party/WebKit/Source/core/rendering/RenderBox.cpp7
-rw-r--r--third_party/WebKit/Source/core/rendering/RenderLayerScrollableArea.cpp2
11 files changed, 78 insertions, 13 deletions
diff --git a/third_party/WebKit/LayoutTests/TestExpectations b/third_party/WebKit/LayoutTests/TestExpectations
index b663749..90372f0 100644
--- a/third_party/WebKit/LayoutTests/TestExpectations
+++ b/third_party/WebKit/LayoutTests/TestExpectations
@@ -1,5 +1,12 @@
# See http://www.chromium.org/developers/testing/webkit-layout-tests/testexpectations for more information on this file.
+crbug.com/179332 virtual/gpu/compositedscrolling/scrollbars/rtl/div-horizontal.html [ NeedsRebaseline ]
+crbug.com/179332 [ Win Mac ] scrollbars/rtl/div-horizontal-with-vertical-scrollbar.html [ NeedsRebaseline ]
+crbug.com/179332 [ Win Mac ] scrollbars/rtl/div-horizontal.html [ NeedsRebaseline ]
+crbug.com/179332 [ Win Mac ] compositing/rtl/rtl-overflow-scrolling.html [ NeedsRebaseline ]
+crbug.com/179332 [ Win Mac ] fast/block/float/026.html [ NeedsRebaseline ]
+crbug.com/179332 [ Win Mac ] fast/block/float/028.html [ NeedsRebaseline ]
+
# This test can't just be rebaselined because it has absolute file paths in the output.
crbug.com/257132 http/tests/inspector/network/network-xhr-replay.html [ Failure ]
diff --git a/third_party/WebKit/LayoutTests/compositing/rtl/rtl-overflow-scrolling-expected.png b/third_party/WebKit/LayoutTests/compositing/rtl/rtl-overflow-scrolling-expected.png
new file mode 100644
index 0000000..cf7d269
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/compositing/rtl/rtl-overflow-scrolling-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/compositing/rtl/rtl-overflow-scrolling-expected.txt b/third_party/WebKit/LayoutTests/compositing/rtl/rtl-overflow-scrolling-expected.txt
index 761e525..6b692b3 100644
--- a/third_party/WebKit/LayoutTests/compositing/rtl/rtl-overflow-scrolling-expected.txt
+++ b/third_party/WebKit/LayoutTests/compositing/rtl/rtl-overflow-scrolling-expected.txt
@@ -3,6 +3,6 @@ layer at (0,0) size 800x600
layer at (0,0) size 800x600
RenderBlock {HTML} at (0,0) size 800x600
RenderBody {BODY} at (8,8) size 784x584
-layer at (8,8) size 300x300 clip at (23,8) size 285x285 scrollWidth 985 scrollHeight 1000
+layer at (8,8) size 300x300 clip at (23,8) size 285x285 scrollWidth 1000 scrollHeight 1000
RenderBlock {DIV} at (0,0) size 300x300
RenderBlock {DIV} at (-700,0) size 1000x1000 [bgcolor=#008000]
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/block/float/026-expected.txt b/third_party/WebKit/LayoutTests/platform/win/fast/block/float/026-expected.txt
index 0f31561..9e56c72 100644
--- a/third_party/WebKit/LayoutTests/platform/win/fast/block/float/026-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win/fast/block/float/026-expected.txt
@@ -42,7 +42,7 @@ layer at (8,208) size 569x59 clip at (25,210) size 550x40
text run at (39,2) width 513: "This is an overflow:scroll region. It should sit on the same line as the float and wrap as"
text run at (290,22) width 4 RTL: "."
text run at (294,22) width 258: "needed to fit within the remaining line width"
-layer at (189,816) size 388x79 clip at (206,818) size 369x60
+layer at (189,816) size 388x79 clip at (206,818) size 369x60 scrollX 14 scrollWidth 383
RenderBlock {DIV} at (180.50,0) size 388.50x79 [border: (2px solid #0000FF)]
RenderText {#text} at (5,2) size 368x59
text run at (5,2) width 366: "This is an overflow:scroll region. It should sit on the same line"
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/block/float/028-expected.txt b/third_party/WebKit/LayoutTests/platform/win/fast/block/float/028-expected.txt
index 0f31561..9e56c72 100644
--- a/third_party/WebKit/LayoutTests/platform/win/fast/block/float/028-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win/fast/block/float/028-expected.txt
@@ -42,7 +42,7 @@ layer at (8,208) size 569x59 clip at (25,210) size 550x40
text run at (39,2) width 513: "This is an overflow:scroll region. It should sit on the same line as the float and wrap as"
text run at (290,22) width 4 RTL: "."
text run at (294,22) width 258: "needed to fit within the remaining line width"
-layer at (189,816) size 388x79 clip at (206,818) size 369x60
+layer at (189,816) size 388x79 clip at (206,818) size 369x60 scrollX 14 scrollWidth 383
RenderBlock {DIV} at (180.50,0) size 388.50x79 [border: (2px solid #0000FF)]
RenderText {#text} at (5,2) size 368x59
text run at (5,2) width 366: "This is an overflow:scroll region. It should sit on the same line"
diff --git a/third_party/WebKit/LayoutTests/scrollbars/rtl/div-horizontal-expected.txt b/third_party/WebKit/LayoutTests/scrollbars/rtl/div-horizontal-expected.txt
index c73c17f..61ad6a9 100644
--- a/third_party/WebKit/LayoutTests/scrollbars/rtl/div-horizontal-expected.txt
+++ b/third_party/WebKit/LayoutTests/scrollbars/rtl/div-horizontal-expected.txt
@@ -6,7 +6,7 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE
Verify the widths of the outer RTL elements are the same as the widths of the outer LTR elements.
PASS outerLTR.offsetWidth == outerRTL.offsetWidth is true
PASS outerLTR.clientWidth == outerRTL.clientWidth is true
-FAIL outerLTR.scrollWidth == outerRTL.scrollWidth should be true. Was false.
+PASS outerLTR.scrollWidth == outerRTL.scrollWidth is true
Verify the widths of the inner RTL elements are the same as the widths of the inner LTR elements.
PASS innerLTR.offsetWidth == innerRTL.offsetWidth is true
PASS innerLTR.clientWidth == innerRTL.clientWidth is true
diff --git a/third_party/WebKit/LayoutTests/scrollbars/rtl/div-horizontal-with-vertical-scrollbar-expected.txt b/third_party/WebKit/LayoutTests/scrollbars/rtl/div-horizontal-with-vertical-scrollbar-expected.txt
new file mode 100644
index 0000000..eda6b73
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/scrollbars/rtl/div-horizontal-with-vertical-scrollbar-expected.txt
@@ -0,0 +1,20 @@
+Test that horizontal scrollbar should appear as the content width encroaches upon the vertical scrollbar and also test if WebKit can show the left side of the inner elements regardless of the position of its scrollbars. To test manually, open this document and verify we can see "ABC" both in the LTR element and in the RTL element.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Verify the widths of the outer RTL elements are the same as the widths of the outer LTR elements.
+PASS outerLTR.offsetWidth == outerRTL.offsetWidth is true
+PASS outerLTR.clientWidth == outerRTL.clientWidth is true
+PASS outerLTR.scrollWidth == outerRTL.scrollWidth is true
+Verify the widths of the inner RTL elements are the same as the widths of the inner LTR elements.
+PASS innerLTR.offsetWidth == innerRTL.offsetWidth is true
+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 successfullyParsed is true
+
+TEST COMPLETE
+ABC
+ABC
diff --git a/third_party/WebKit/LayoutTests/scrollbars/rtl/div-horizontal-with-vertical-scrollbar.html b/third_party/WebKit/LayoutTests/scrollbars/rtl/div-horizontal-with-vertical-scrollbar.html
new file mode 100644
index 0000000..5c59fcb
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/scrollbars/rtl/div-horizontal-with-vertical-scrollbar.html
@@ -0,0 +1,39 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src="../../resources/js-test.js"></script>
+</head>
+<body dir="ltr">
+<div dir="ltr" id="outer-ltr" style="width: 200px; height: 200px; overflow: auto;">
+<div id="inner-ltr" style="text-align: left; width: 195px; height: 300px;">ABC</div>
+</div>
+<div dir="rtl" id="outer-rtl" style="width: 200px; height: 200px; overflow: auto;">
+<div id="inner-rtl" style="text-align: left; width: 195px; height: 300px;">ABC</div>
+</div>
+<script type="text/javascript">
+description('Test that horizontal scrollbar should appear as the content width encroaches upon the vertical scrollbar and also test if WebKit can show the left side of the inner elements regardless of the position of its scrollbars. To test manually, open this document and verify we can see "ABC" both in the LTR element and in the RTL element.');
+
+var outerLTR = document.getElementById('outer-ltr');
+var innerLTR = document.getElementById('inner-ltr');
+var outerRTL = document.getElementById('outer-rtl');
+var innerRTL = document.getElementById('inner-rtl');
+outerLTR.scrollLeft = 0;
+outerRTL.scrollLeft = 0;
+
+debug('Verify the widths of the outer RTL elements are the same as the widths of the outer LTR elements.');
+shouldBeTrue('outerLTR.offsetWidth == outerRTL.offsetWidth');
+shouldBeTrue('outerLTR.clientWidth == outerRTL.clientWidth');
+shouldBeTrue('outerLTR.scrollWidth == outerRTL.scrollWidth');
+
+debug('Verify the widths of the inner RTL elements are the same as the widths of the inner LTR elements.');
+shouldBeTrue('innerLTR.offsetWidth == innerRTL.offsetWidth');
+shouldBeTrue('innerLTR.clientWidth == innerRTL.clientWidth');
+shouldBeTrue('innerLTR.scrollWidth == innerRTL.scrollWidth');
+
+debug('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.');
+var scrollbarWidthLTR = outerLTR.offsetWidth - outerLTR.clientWidth;
+var scrollbarWidthRTL = outerRTL.offsetWidth - outerRTL.clientWidth;
+shouldBeTrue('scrollbarWidthLTR == scrollbarWidthRTL');
+</script>
+</body>
+</html>
diff --git a/third_party/WebKit/Source/core/rendering/RenderBlock.cpp b/third_party/WebKit/Source/core/rendering/RenderBlock.cpp
index addd983..fcd6a11 100644
--- a/third_party/WebKit/Source/core/rendering/RenderBlock.cpp
+++ b/third_party/WebKit/Source/core/rendering/RenderBlock.cpp
@@ -1546,12 +1546,8 @@ void RenderBlock::addOverflowFromPositionedObjects()
positionedObject = *it;
// Fixed positioned elements don't contribute to layout overflow, since they don't scroll with the content.
- if (positionedObject->style()->position() != FixedPosition) {
- LayoutUnit x = positionedObject->x();
- if (style()->shouldPlaceBlockDirectionScrollbarOnLogicalLeft())
- x -= verticalScrollbarWidth();
- addOverflowFromChild(positionedObject, LayoutSize(x, positionedObject->y()));
- }
+ if (positionedObject->style()->position() != FixedPosition)
+ addOverflowFromChild(positionedObject, LayoutSize(positionedObject->x(), positionedObject->y()));
}
}
diff --git a/third_party/WebKit/Source/core/rendering/RenderBox.cpp b/third_party/WebKit/Source/core/rendering/RenderBox.cpp
index 4b857a4..a7cd19f 100644
--- a/third_party/WebKit/Source/core/rendering/RenderBox.cpp
+++ b/third_party/WebKit/Source/core/rendering/RenderBox.cpp
@@ -4777,7 +4777,7 @@ LayoutRect RenderBox::noOverflowRect() const
// writing modes, x in vertical writing modes), which is always "logical top". Apart from the
// flipping, this method does the same as clientBoxRect().
- LayoutUnit left = borderLeft();
+ LayoutUnit left = borderLeft() + (style()->shouldPlaceBlockDirectionScrollbarOnLogicalLeft() ? verticalScrollbarWidth() : 0);
LayoutUnit top = borderTop();
LayoutUnit right = borderRight();
LayoutUnit bottom = borderBottom();
@@ -4792,7 +4792,10 @@ LayoutRect RenderBox::noOverflowRect() const
// FIXME: when the above mentioned bug is fixed, it should hopefully be possible to call
// clientBoxRect() or paddingBoxRect() in this method, rather than fiddling with the edges on
// our own.
- rect.contract(verticalScrollbarWidth(), horizontalScrollbarHeight());
+ if (style()->shouldPlaceBlockDirectionScrollbarOnLogicalLeft())
+ rect.contract(0, horizontalScrollbarHeight());
+ else
+ rect.contract(verticalScrollbarWidth(), horizontalScrollbarHeight());
return rect;
}
diff --git a/third_party/WebKit/Source/core/rendering/RenderLayerScrollableArea.cpp b/third_party/WebKit/Source/core/rendering/RenderLayerScrollableArea.cpp
index d2689a4..3a840ba 100644
--- a/third_party/WebKit/Source/core/rendering/RenderLayerScrollableArea.cpp
+++ b/third_party/WebKit/Source/core/rendering/RenderLayerScrollableArea.cpp
@@ -514,7 +514,7 @@ void RenderLayerScrollableArea::computeScrollDimensions()
m_overflowRect = m_box->layoutOverflowRect();
m_box->flipForWritingMode(m_overflowRect);
- int scrollableLeftOverflow = m_overflowRect.x() - m_box->borderLeft();
+ int scrollableLeftOverflow = m_overflowRect.x() - m_box->borderLeft() - (m_box->style()->shouldPlaceBlockDirectionScrollbarOnLogicalLeft() ? m_box->verticalScrollbarWidth() : 0);
int scrollableTopOverflow = m_overflowRect.y() - m_box->borderTop();
setScrollOrigin(IntPoint(-scrollableLeftOverflow, -scrollableTopOverflow));
}