diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog index facd87c5a4e423e2761f89938f0a8ffe04446ca2..1e0f052af44388192df66e6aab0140fb3d6f4fab 100644 --- a/LayoutTests/ChangeLog +++ b/LayoutTests/ChangeLog @@ -1,3 +1,21 @@ +2012-07-18 Hironori Bono + + Move contents right when a vertical scrollbar is shown at the left side of an RTL element. + https://bugs.webkit.org/show_bug.cgi?id=85856 + + Reviewed by Hajime Morita. + + This changes adds a couple of tests that verify CSSOM properties of RTL elements + are compliant with regardless of their + scrollbar positions. + + * platform/chromium/TestExpectations: + * scrollbars/rtl: Added. + * scrollbars/rtl/div-horizontal-expected.txt: Added. + * scrollbars/rtl/div-horizontal.html: Added. + * scrollbars/rtl/div-vertical-expected.txt: Added. + * scrollbars/rtl/div-vertical.html: Added. + 2012-07-18 Kent Tamura Form state restore: Classify form control sates by owners in internal and serialized representations diff --git a/LayoutTests/platform/chromium/TestExpectations b/LayoutTests/platform/chromium/TestExpectations index 2216ab00fcf1b095f0d5868c0ec97a94996e7718..99b27c8684964348b3e82a45f5d241930c5e1883 100644 --- a/LayoutTests/platform/chromium/TestExpectations +++ b/LayoutTests/platform/chromium/TestExpectations @@ -3645,6 +3645,11 @@ BUGWK90517 WIN : svg/W3C-I18N/tspan-dirRTL-ubNone-in-default-context.svg = PASS BUGWK91421 WIN7 : svg/W3C-SVG-1.1/animate-elem-39-t.svg = PASS CRASH BUGWK90469 WIN : storage/websql/multiple-databases-garbage-collection.html = PASS CRASH +// Require rebaselines when Bug 85856 is fixed. (The left side of their RTL elements are cropped due to this bug.) +BUGWK85856 : fast/block/float/028.html = IMAGE +BUGWK85856 : fast/overflow/unreachable-overflow-rtl-bug.html = IMAGE +BUGWK85856 : fast/block/float/026.html = IMAGE + // Require rebaseline after bug 88171 BUGWK88171 WIN : css1/formatting_model/floating_elements.html = IMAGE diff --git a/LayoutTests/scrollbars/rtl/div-horizontal-expected.txt b/LayoutTests/scrollbars/rtl/div-horizontal-expected.txt new file mode 100644 index 0000000000000000000000000000000000000000..61ad6a9adb52679078a7805a338cd206aec0dd87 --- /dev/null +++ b/LayoutTests/scrollbars/rtl/div-horizontal-expected.txt @@ -0,0 +1,20 @@ +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/LayoutTests/scrollbars/rtl/div-horizontal.html b/LayoutTests/scrollbars/rtl/div-horizontal.html new file mode 100644 index 0000000000000000000000000000000000000000..a5e44300c7dbf251b911dca488aa00780a0ac624 --- /dev/null +++ b/LayoutTests/scrollbars/rtl/div-horizontal.html @@ -0,0 +1,41 @@ + + + +Bug 85856 + + + +
+
ABC
+
+
+
ABC
+
+ + + + diff --git a/LayoutTests/scrollbars/rtl/div-vertical-expected.txt b/LayoutTests/scrollbars/rtl/div-vertical-expected.txt new file mode 100644 index 0000000000000000000000000000000000000000..61ad6a9adb52679078a7805a338cd206aec0dd87 --- /dev/null +++ b/LayoutTests/scrollbars/rtl/div-vertical-expected.txt @@ -0,0 +1,20 @@ +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/LayoutTests/scrollbars/rtl/div-vertical.html b/LayoutTests/scrollbars/rtl/div-vertical.html new file mode 100644 index 0000000000000000000000000000000000000000..253f9cd24f21a9273cfbc040f941595fe8bced2f --- /dev/null +++ b/LayoutTests/scrollbars/rtl/div-vertical.html @@ -0,0 +1,41 @@ + + + +Bug 85856 + + + +
+
ABC
+
+
+
ABC
+
+ + + + diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog index 2bde9d7322a657759913c224e144e66d4e4cc105..2575f6adb01eb1d80d9147bbd6512fa5cc6e422d 100644 --- a/Source/WebCore/ChangeLog +++ b/Source/WebCore/ChangeLog @@ -1,3 +1,25 @@ +2012-07-18 Hironori Bono + + Move contents right when a vertical scrollbar is shown at the left side of an RTL element. + https://bugs.webkit.org/show_bug.cgi?id=85856 + + Reviewed by Hajime Morita. + + This change prevents the scrollWidth value from being cropped by the width of a + scrollbar when a vertical scrollbar is shown at the left side of an RTL element. + This change also increases the clientLeft value by this scrollbar width and move + contents right to improve compliance with CSSOM . + + Tests: scrollbars/rtl/div-horizontal.html + scrollbars/rtl/div-vertical.html + + * rendering/RenderBlock.cpp: + (WebCore::RenderBlock::paintObject): Move contents to the right. + * rendering/RenderBox.cpp: + (WebCore::RenderBox::topLeftLocationOffset): Move the top-left corner to the right to prevent WebKit from cropping scrollWidth. + * rendering/RenderBox.h: + (WebCore::RenderBox::clientLeft): Increase clientLeft by the width of a scrollbar. + 2012-07-18 Kent Tamura Form state restore: Classify form control sates by owners in internal and serialized representations diff --git a/Source/WebCore/rendering/RenderBlock.cpp b/Source/WebCore/rendering/RenderBlock.cpp index 256bd1a8cd1b541511522c32f9ba83e3fcceac07..07f94ba9b00e07852dccac8c5028a88eefa1da18 100755 --- a/Source/WebCore/rendering/RenderBlock.cpp +++ b/Source/WebCore/rendering/RenderBlock.cpp @@ -2967,8 +2967,11 @@ void RenderBlock::paintObject(PaintInfo& paintInfo, const LayoutPoint& paintOffs // Adjust our painting position if we're inside a scrolled layer (e.g., an overflow:auto div). LayoutPoint scrolledOffset = paintOffset; - if (hasOverflowClip()) + if (hasOverflowClip()) { scrolledOffset.move(-scrolledContentOffset()); + if (style()->shouldPlaceBlockDirectionScrollbarOnLogicalLeft()) + scrolledOffset.move(verticalScrollbarWidth(), 0); + } // 2. paint contents if (paintPhase != PaintPhaseSelfOutline) { diff --git a/Source/WebCore/rendering/RenderBox.cpp b/Source/WebCore/rendering/RenderBox.cpp index 1a2c36160efa232c6db206f541497823d1fd41bd..eca1e08bf82291fb19a292edd6e1549396b28e31 100644 --- a/Source/WebCore/rendering/RenderBox.cpp +++ b/Source/WebCore/rendering/RenderBox.cpp @@ -3938,6 +3938,8 @@ LayoutSize RenderBox::topLeftLocationOffset() const return locationOffset(); LayoutRect rect(frameRect()); + if (containerBlock->style()->shouldPlaceBlockDirectionScrollbarOnLogicalLeft()) + rect.move(containerBlock->verticalScrollbarWidth(), 0); containerBlock->flipForWritingMode(rect); // FIXME: This is wrong if we are an absolutely positioned object enclosed by a relative-positioned inline. return LayoutSize(rect.x(), rect.y()); } diff --git a/Source/WebCore/rendering/RenderBox.h b/Source/WebCore/rendering/RenderBox.h index 488c584057d00c8b0e6659802ae9b86ad19305fb..43a8ebc50a3e2977d294a5c6e65c327f5b2920dc 100644 --- a/Source/WebCore/rendering/RenderBox.h +++ b/Source/WebCore/rendering/RenderBox.h @@ -197,7 +197,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;