Changeset 247255 in webkit
- Timestamp:
- Jul 9, 2019 3:03:19 AM (5 years ago)
- Location:
- trunk
- Files:
-
- 1 deleted
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r247254 r247255 1 2019-07-09 Cathie Chen <cathiechen@igalia.com> 2 3 Support writing-mode and direction for scrollIntoViewOptions. 4 https://bugs.webkit.org/show_bug.cgi?id=161611 5 6 Reviewed by Frédéric Wang and Simon Fraser. 7 8 * platform/ios-simulator-wk2/imported/w3c/web-platform-tests/css/cssom-view/scrollIntoView-horizontal-tb-writing-mode-and-rtl-direction-expected.txt: Removed. 9 1 10 2019-07-08 Saam Barati <sbarati@apple.com> 2 11 -
trunk/LayoutTests/imported/w3c/ChangeLog
r247193 r247255 1 2019-07-09 Cathie Chen <cathiechen@igalia.com> 2 3 Support writing-mode and direction for scrollIntoViewOptions. 4 https://bugs.webkit.org/show_bug.cgi?id=161611 5 6 Reviewed by Frédéric Wang and Simon Fraser. 7 8 * web-platform-tests/css/cssom-view/scrollIntoView-horizontal-tb-writing-mode-and-rtl-direction-expected.txt: 9 * web-platform-tests/css/cssom-view/scrollIntoView-vertical-lr-writing-mode-and-rtl-direction-expected.txt: 10 * web-platform-tests/css/cssom-view/scrollIntoView-vertical-lr-writing-mode-expected.txt: 11 * web-platform-tests/css/cssom-view/scrollIntoView-vertical-rl-writing-mode-expected.txt: 12 1 13 2019-07-06 Cathie Chen <cathiechen@igalia.com> 2 14 -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scrollIntoView-horizontal-tb-writing-mode-and-rtl-direction-expected.txt
r247193 r247255 1 1 2 FAIL scrollIntoView({"block":"start","inline":"start"}) assert_approx_equals: scrollX expected -200 +/- 0.5 but got -100 3 FAIL scrollIntoView({"block":"start","inline":"center"}) assert_approx_equals: scrollX expected -157.5 +/- 0.5 but got -143 4 FAIL scrollIntoView({"block":"start","inline":"end"}) assert_approx_equals: scrollX expected -115 +/- 0.5 but got -185 5 FAIL scrollIntoView({"block":"center","inline":"start"}) assert_approx_equals: scrollX expected -200 +/- 0.5 but got -100 6 FAIL scrollIntoView({"block":"center","inline":"center"}) assert_approx_equals: scrollX expected -157.5 +/- 0.5 but got -143 7 FAIL scrollIntoView({"block":"center","inline":"end"}) assert_approx_equals: scrollX expected -115 +/- 0.5 but got -185 8 FAIL scrollIntoView({"block":"end","inline":"start"}) assert_approx_equals: scrollX expected -200 +/- 0.5 but got -100 9 FAIL scrollIntoView({"block":"end","inline":"center"}) assert_approx_equals: scrollX expected -157.5 +/- 0.5 but got -143 10 FAIL scrollIntoView({"block":"end","inline":"end"}) assert_approx_equals: scrollX expected -115 +/- 0.5 but got -185 2 PASS scrollIntoView({"block":"start","inline":"start"}) 3 PASS scrollIntoView({"block":"start","inline":"center"}) 4 PASS scrollIntoView({"block":"start","inline":"end"}) 5 PASS scrollIntoView({"block":"center","inline":"start"}) 6 PASS scrollIntoView({"block":"center","inline":"center"}) 7 PASS scrollIntoView({"block":"center","inline":"end"}) 8 PASS scrollIntoView({"block":"end","inline":"start"}) 9 PASS scrollIntoView({"block":"end","inline":"center"}) 10 PASS scrollIntoView({"block":"end","inline":"end"}) 11 11 -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scrollIntoView-vertical-lr-writing-mode-and-rtl-direction-expected.txt
r247193 r247255 1 1 2 FAIL scrollIntoView({"block":"start","inline":"start"}) assert_approx_equals: scrollY expected -200 +/- 0.5 but got -115 3 FAIL scrollIntoView({"block":"start","inline":"center"}) assert_approx_equals: scrollX expected 200 +/- 0.5 but got 158 4 FAIL scrollIntoView({"block":"start","inline":"end"}) assert_approx_equals: scrollX expected 200 +/- 0.5 but got 115 5 FAIL scrollIntoView({"block":"center","inline":"start"}) assert_approx_equals: scrollX expected 157.5 +/- 0.5 but got 200 2 PASS scrollIntoView({"block":"start","inline":"start"}) 3 PASS scrollIntoView({"block":"start","inline":"center"}) 4 PASS scrollIntoView({"block":"start","inline":"end"}) 5 PASS scrollIntoView({"block":"center","inline":"start"}) 6 6 PASS scrollIntoView({"block":"center","inline":"center"}) 7 FAIL scrollIntoView({"block":"center","inline":"end"}) assert_approx_equals: scrollX expected 157.5 +/- 0.5 but got 115 8 FAIL scrollIntoView({"block":"end","inline":"start"}) assert_approx_equals: scrollX expected 115 +/- 0.5 but got 200 9 FAIL scrollIntoView({"block":"end","inline":"center"}) assert_approx_equals: scrollX expected 115 +/- 0.5 but got 158 10 FAIL scrollIntoView({"block":"end","inline":"end"}) assert_approx_equals: scrollY expected -115 +/- 0.5 but got -200 7 PASS scrollIntoView({"block":"center","inline":"end"}) 8 PASS scrollIntoView({"block":"end","inline":"start"}) 9 PASS scrollIntoView({"block":"end","inline":"center"}) 10 PASS scrollIntoView({"block":"end","inline":"end"}) 11 11 -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scrollIntoView-vertical-lr-writing-mode-expected.txt
r247193 r247255 1 1 2 2 PASS scrollIntoView({"block":"start","inline":"start"}) 3 FAIL scrollIntoView({"block":"start","inline":"center"}) assert_approx_equals: scrollX expected 200 +/- 0.5 but got 158 4 FAIL scrollIntoView({"block":"start","inline":"end"}) assert_approx_equals: scrollX expected 200 +/- 0.5 but got 115 5 FAIL scrollIntoView({"block":"center","inline":"start"}) assert_approx_equals: scrollX expected 157.5 +/- 0.5 but got 200 3 PASS scrollIntoView({"block":"start","inline":"center"}) 4 PASS scrollIntoView({"block":"start","inline":"end"}) 5 PASS scrollIntoView({"block":"center","inline":"start"}) 6 6 PASS scrollIntoView({"block":"center","inline":"center"}) 7 FAIL scrollIntoView({"block":"center","inline":"end"}) assert_approx_equals: scrollX expected 157.5 +/- 0.5 but got 115 8 FAIL scrollIntoView({"block":"end","inline":"start"}) assert_approx_equals: scrollX expected 115 +/- 0.5 but got 200 9 FAIL scrollIntoView({"block":"end","inline":"center"}) assert_approx_equals: scrollX expected 115 +/- 0.5 but got 158 7 PASS scrollIntoView({"block":"center","inline":"end"}) 8 PASS scrollIntoView({"block":"end","inline":"start"}) 9 PASS scrollIntoView({"block":"end","inline":"center"}) 10 10 PASS scrollIntoView({"block":"end","inline":"end"}) 11 11 -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scrollIntoView-vertical-rl-writing-mode-expected.txt
r247193 r247255 1 1 2 FAIL scrollIntoView({"block":"start","inline":"start"}) assert_approx_equals: scrollX expected -185 +/- 0.5 but got -100 3 FAIL scrollIntoView({"block":"start","inline":"center"}) assert_approx_equals: scrollX expected -185 +/- 0.5 but got -143 4 FAIL scrollIntoView({"block":"start","inline":"end"}) assert_approx_equals: scrollY expected 115 +/- 0.5 but got 200 5 FAIL scrollIntoView({"block":"center","inline":"start"}) assert_approx_equals: scrollX expected -142.5 +/- 0.5 but got -100 2 PASS scrollIntoView({"block":"start","inline":"start"}) 3 PASS scrollIntoView({"block":"start","inline":"center"}) 4 PASS scrollIntoView({"block":"start","inline":"end"}) 5 PASS scrollIntoView({"block":"center","inline":"start"}) 6 6 PASS scrollIntoView({"block":"center","inline":"center"}) 7 FAIL scrollIntoView({"block":"center","inline":"end"}) assert_approx_equals: scrollX expected -142.5 +/- 0.5 but got -185 8 FAIL scrollIntoView({"block":"end","inline":"start"}) assert_approx_equals: scrollY expected 200 +/- 0.5 but got 115 9 FAIL scrollIntoView({"block":"end","inline":"center"}) assert_approx_equals: scrollX expected -100 +/- 0.5 but got -143 10 FAIL scrollIntoView({"block":"end","inline":"end"}) assert_approx_equals: scrollX expected -100 +/- 0.5 but got -185 7 PASS scrollIntoView({"block":"center","inline":"end"}) 8 PASS scrollIntoView({"block":"end","inline":"start"}) 9 PASS scrollIntoView({"block":"end","inline":"center"}) 10 PASS scrollIntoView({"block":"end","inline":"end"}) 11 11 -
trunk/Source/WebCore/ChangeLog
r247254 r247255 1 2019-07-09 Cathie Chen <cathiechen@igalia.com> 2 3 Support writing-mode and direction for scrollIntoViewOptions. 4 https://bugs.webkit.org/show_bug.cgi?id=161611 5 6 Reviewed by Frédéric Wang and Simon Fraser. 7 8 To determine which physical side to align we need to transform ScrollIntoViewOptions to scrollAlignment. 9 We'll translate the inline and block direction separately. The writing-mode will affect the block scrollAlignment. 10 While both writing-mode and CSS direction will affect the inline scrollAlignment. The argument for scrollRectToVisible 11 should be physical, so if !isHorizontalWritingMode(), we need to switch alignX and alignY. 12 13 For direction: rtl and writing-mode: horizontal-tb box, WebKit puts the scrollbar on the left side. The visible rect 14 starts from the right side of the scroll bar, so localExposeRect should also start from the right side of 15 scroll bar. 16 17 * dom/Element.cpp: 18 (WebCore::toScrollAlignmentForInlineDirection): 19 (WebCore::toScrollAlignmentForBlockDirection): 20 (WebCore::Element::scrollIntoView): 21 (WebCore::toScrollAlignment): Deleted. 22 * rendering/RenderLayer.cpp: 23 (WebCore::RenderLayer::scrollRectToVisible): 24 1 25 2019-07-08 Saam Barati <sbarati@apple.com> 2 26 -
trunk/Source/WebCore/dom/Element.cpp
r246490 r247255 702 702 } 703 703 704 // FIXME(webkit.org/b/161611): Take into account orientation/direction. 705 inline ScrollAlignment toScrollAlignment(Optional<ScrollLogicalPosition> position, bool isVertical) 706 { 707 switch (position.valueOr(isVertical ? ScrollLogicalPosition::Start : ScrollLogicalPosition::Nearest)) { 708 case ScrollLogicalPosition::Start: 709 return isVertical ? ScrollAlignment::alignTopAlways : ScrollAlignment::alignLeftAlways; 704 inline ScrollAlignment toScrollAlignmentForInlineDirection(Optional<ScrollLogicalPosition> position, WritingMode writingMode, bool isLTR) 705 { 706 switch (position.valueOr(ScrollLogicalPosition::Nearest)) { 707 case ScrollLogicalPosition::Start: { 708 switch (writingMode) { 709 case TopToBottomWritingMode: 710 case BottomToTopWritingMode: { 711 return isLTR ? ScrollAlignment::alignLeftAlways : ScrollAlignment::alignRightAlways; 712 } 713 case LeftToRightWritingMode: 714 case RightToLeftWritingMode: { 715 return isLTR ? ScrollAlignment::alignTopAlways : ScrollAlignment::alignBottomAlways; 716 } 717 default: 718 ASSERT_NOT_REACHED(); 719 return ScrollAlignment::alignLeftAlways; 720 } 721 } 710 722 case ScrollLogicalPosition::Center: 711 723 return ScrollAlignment::alignCenterAlways; 712 case ScrollLogicalPosition::End: 713 return isVertical ? ScrollAlignment::alignBottomAlways : ScrollAlignment::alignRightAlways; 724 case ScrollLogicalPosition::End: { 725 switch (writingMode) { 726 case TopToBottomWritingMode: 727 case BottomToTopWritingMode: { 728 return isLTR ? ScrollAlignment::alignRightAlways : ScrollAlignment::alignLeftAlways; 729 } 730 case LeftToRightWritingMode: 731 case RightToLeftWritingMode: { 732 return isLTR ? ScrollAlignment::alignBottomAlways : ScrollAlignment::alignTopAlways; 733 } 734 default: 735 ASSERT_NOT_REACHED(); 736 return ScrollAlignment::alignRightAlways; 737 } 738 } 739 case ScrollLogicalPosition::Nearest: 740 return ScrollAlignment::alignToEdgeIfNeeded; 741 default: 742 ASSERT_NOT_REACHED(); 743 return ScrollAlignment::alignToEdgeIfNeeded; 744 } 745 } 746 747 inline ScrollAlignment toScrollAlignmentForBlockDirection(Optional<ScrollLogicalPosition> position, WritingMode writingMode) 748 { 749 switch (position.valueOr(ScrollLogicalPosition::Start)) { 750 case ScrollLogicalPosition::Start: { 751 switch (writingMode) { 752 case TopToBottomWritingMode: 753 return ScrollAlignment::alignTopAlways; 754 case BottomToTopWritingMode: 755 return ScrollAlignment::alignBottomAlways; 756 case LeftToRightWritingMode: 757 return ScrollAlignment::alignLeftAlways; 758 case RightToLeftWritingMode: 759 return ScrollAlignment::alignRightAlways; 760 default: 761 ASSERT_NOT_REACHED(); 762 return ScrollAlignment::alignTopAlways; 763 } 764 } 765 case ScrollLogicalPosition::Center: 766 return ScrollAlignment::alignCenterAlways; 767 case ScrollLogicalPosition::End: { 768 switch (writingMode) { 769 case TopToBottomWritingMode: 770 return ScrollAlignment::alignBottomAlways; 771 case BottomToTopWritingMode: 772 return ScrollAlignment::alignTopAlways; 773 case LeftToRightWritingMode: 774 return ScrollAlignment::alignRightAlways; 775 case RightToLeftWritingMode: 776 return ScrollAlignment::alignLeftAlways; 777 default: 778 ASSERT_NOT_REACHED(); 779 return ScrollAlignment::alignBottomAlways; 780 } 781 } 714 782 case ScrollLogicalPosition::Nearest: 715 783 return ScrollAlignment::alignToEdgeIfNeeded; … … 740 808 } 741 809 742 ScrollAlignment alignX = toScrollAlignment(options.inlinePosition, false); 743 ScrollAlignment alignY = toScrollAlignment(options.blockPosition, true); 744 renderer()->scrollRectToVisible(absoluteBounds, insideFixed, { SelectionRevealMode::Reveal, alignX, alignY, ShouldAllowCrossOriginScrolling::No }); 810 auto writingMode = renderer()->style().writingMode(); 811 ScrollAlignment alignX = toScrollAlignmentForInlineDirection(options.inlinePosition, writingMode, renderer()->style().isLeftToRightDirection()); 812 ScrollAlignment alignY = toScrollAlignmentForBlockDirection(options.blockPosition, writingMode); 813 814 bool isHorizontal = renderer()->style().isHorizontalWritingMode(); 815 ScrollRectToVisibleOptions visibleOptions { 816 SelectionRevealMode::Reveal, 817 isHorizontal ? alignX : alignY, 818 isHorizontal ? alignY : alignX, 819 ShouldAllowCrossOriginScrolling::No 820 }; 821 renderer()->scrollRectToVisible(absoluteBounds, insideFixed, visibleOptions); 745 822 } 746 823 -
trunk/Source/WebCore/rendering/RenderLayer.cpp
r246899 r247255 2624 2624 ASSERT(box); 2625 2625 LayoutRect localExposeRect(box->absoluteToLocalQuad(FloatQuad(FloatRect(absoluteRect))).boundingBox()); 2626 if (shouldPlaceBlockDirectionScrollbarOnLeft()) { 2627 // For direction: rtl; writing-mode: horizontal-tb box, the scroll bar is on the left side. The visible rect 2628 // starts from the right side of scroll bar. So the x of localExposeRect should start from the same position too. 2629 localExposeRect.moveBy(LayoutPoint(-verticalScrollbarWidth(), 0)); 2630 } 2626 2631 LayoutRect layerBounds(0_lu, 0_lu, box->clientWidth(), box->clientHeight()); 2627 2632 LayoutRect revealRect = getRectToExpose(layerBounds, localExposeRect, insideFixed, options.alignX, options.alignY);
Note: See TracChangeset
for help on using the changeset viewer.