Changeset 235659 in webkit
- Timestamp:
- Sep 4, 2018 10:19:58 PM (6 years ago)
- Location:
- trunk
- Files:
-
- 4 added
- 1 deleted
- 21 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r235655 r235659 1 2018-09-04 Frederic Wang <fwang@igalia.com> 2 3 Add basic support for ScrollIntoViewOptions 4 https://bugs.webkit.org/show_bug.cgi?id=189258 5 6 Reviewed by Simon Fraser. 7 8 Update test expectations for WPT scrollIntoView tests. 9 10 * platform/ios-wk2/imported/w3c/web-platform-tests/css/cssom-view/scrollIntoView-smooth-expected.txt: Removed. 11 1 12 2018-09-04 Michael Saboff <msaboff@apple.com> 2 13 -
trunk/LayoutTests/imported/w3c/ChangeLog
r235658 r235659 1 2018-09-04 Frederic Wang <fwang@igalia.com> 2 3 Add basic support for ScrollIntoViewOptions 4 https://bugs.webkit.org/show_bug.cgi?id=189258 5 6 Reviewed by Simon Fraser. 7 8 Update test expectations for WPT scrollIntoView tests. 9 10 * web-platform-tests/css/cssom-view/scrollIntoView-scrollMargin-expected.txt: This is not 11 supported yet but update the error message. 12 * web-platform-tests/css/cssom-view/scrollIntoView-scrollPadding-expected.txt: Ditto. 13 * web-platform-tests/css/cssom-view/scrollIntoView-shadow-expected.txt: Update expectation 14 now that this test passes. 15 * web-platform-tests/css/cssom-view/scrollIntoView-smooth-expected.txt: Ditto. 16 * web-platform-tests/css/cssom-view/scrollintoview-expected.txt: Ditto. 17 1 18 2018-09-04 Oriol Brufau <obrufau@igalia.com> 2 19 -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scrollIntoView-scrollMargin-expected.txt
r232903 r235659 1 1 2 FAIL scrollIntoView({block: "center", inline: "center"}) assert_approx_equals: scrollX expected 153.5 +/- 0.5 but got 1 153 FAIL scrollIntoView({block: "start", inline: "start"}) assert_approx_equals: scrollX expected 184 +/- 0.5 but got 1152 FAIL scrollIntoView({block: "center", inline: "center"}) assert_approx_equals: scrollX expected 153.5 +/- 0.5 but got 158 3 FAIL scrollIntoView({block: "start", inline: "start"}) assert_approx_equals: scrollX expected 184 +/- 0.5 but got 200 4 4 FAIL scrollIntoView({block: "end", inline: "end"}) assert_approx_equals: scrollX expected 123 +/- 0.5 but got 115 5 5 -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scrollIntoView-scrollPadding-expected.txt
r232903 r235659 1 1 2 FAIL scrollIntoView({block: "center", inline: "center"}) assert_approx_equals: scrollX expected 153.5 +/- 0.5 but got 1 153 FAIL scrollIntoView({block: "start", inline: "start"}) assert_approx_equals: scrollX expected 184 +/- 0.5 but got 1152 FAIL scrollIntoView({block: "center", inline: "center"}) assert_approx_equals: scrollX expected 153.5 +/- 0.5 but got 158 3 FAIL scrollIntoView({block: "start", inline: "start"}) assert_approx_equals: scrollX expected 184 +/- 0.5 but got 200 4 4 FAIL scrollIntoView({block: "end", inline: "end"}) assert_approx_equals: scrollX expected 123 +/- 0.5 but got 115 5 5 -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scrollIntoView-shadow-expected.txt
r232903 r235659 1 1 2 FAIL scrollIntoView should behave correctly if applies to shadow dom elements assert_approx_equals: expected 8 +/- 1 but got 0 2 PASS scrollIntoView should behave correctly if applies to shadow dom elements 3 3 -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scrollIntoView-smooth-expected.txt
r232903 r235659 1 1 2 FAIL Smooth scrollIntoView should scroll the element to the 'nearest' position assert_approx_equals: scrollY expected 915 +/- 1 but got 1000 3 FAIL Smooth scrollIntoView should scroll the element to the 'start' position assert_approx_equals: scrollX expected 1008 +/- 1 but got 723 4 FAIL Smooth scrollIntoView should scroll the element to the 'center' position assert_approx_equals: scrollX expected 865.5 +/- 1 but got 723 5 FAIL Smooth scrollIntoView should scroll the element to the 'end' position assert_approx_equals: scrollY expected 915 +/- 1 but got 1000 2 PASS Smooth scrollIntoView should scroll the element to the 'nearest' position 3 PASS Smooth scrollIntoView should scroll the element to the 'start' position 4 PASS Smooth scrollIntoView should scroll the element to the 'center' position 5 PASS Smooth scrollIntoView should scroll the element to the 'end' position 6 6 -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scrollintoview-expected.txt
r232903 r235659 16 16 PASS scrollIntoView(undefined) starting at right,top 17 17 PASS scrollIntoView(undefined) starting at right,bottom 18 FAIL scrollIntoView(null) starting at left,top assert_approx_equals: scrollY expected 4000 +/- 0.5 but got 3600 19 FAIL scrollIntoView(null) starting at left,bottom assert_approx_equals: scrollY expected 4000 +/- 0.5 but got 3600 20 FAIL scrollIntoView(null) starting at right,top assert_approx_equals: scrollY expected 4000 +/- 0.5 but got 3600 21 FAIL scrollIntoView(null) starting at right,bottom assert_approx_equals: scrollY expected 4000 +/- 0.5 but got 3600 18 PASS scrollIntoView(null) starting at left,top 19 PASS scrollIntoView(null) starting at left,bottom 20 PASS scrollIntoView(null) starting at right,top 21 PASS scrollIntoView(null) starting at right,bottom 22 22 PASS scrollIntoView({}) starting at left,top 23 23 PASS scrollIntoView({}) starting at left,bottom 24 24 PASS scrollIntoView({}) starting at right,top 25 25 PASS scrollIntoView({}) starting at right,bottom 26 FAIL scrollIntoView({block: "center", inline: "center"}) starting at left,top assert_approx_equals: scrollX expected 3700 +/- 0.5 but got 3400 27 FAIL scrollIntoView({block: "center", inline: "center"}) starting at left,bottom assert_approx_equals: scrollX expected 3700 +/- 0.5 but got 3400 28 FAIL scrollIntoView({block: "center", inline: "center"}) starting at right,top assert_approx_equals: scrollX expected 3700 +/- 0.5 but got 4000 29 FAIL scrollIntoView({block: "center", inline: "center"}) starting at right,bottom assert_approx_equals: scrollX expected 3700 +/- 0.5 but got 4000 30 FAIL scrollIntoView({block: "start", inline: "start"}) starting at left,top assert_approx_equals: scrollX expected 4000 +/- 0.5 but got 3400 31 FAIL scrollIntoView({block: "start", inline: "start"}) starting at left,bottom assert_approx_equals: scrollX expected 4000 +/- 0.5 but got 3400 26 PASS scrollIntoView({block: "center", inline: "center"}) starting at left,top 27 PASS scrollIntoView({block: "center", inline: "center"}) starting at left,bottom 28 PASS scrollIntoView({block: "center", inline: "center"}) starting at right,top 29 PASS scrollIntoView({block: "center", inline: "center"}) starting at right,bottom 30 PASS scrollIntoView({block: "start", inline: "start"}) starting at left,top 31 PASS scrollIntoView({block: "start", inline: "start"}) starting at left,bottom 32 32 PASS scrollIntoView({block: "start", inline: "start"}) starting at right,top 33 33 PASS scrollIntoView({block: "start", inline: "start"}) starting at right,bottom 34 FAIL scrollIntoView({block: "end", inline: "end"}) starting at left,top assert_approx_equals: scrollY expected 3600 +/- 0.5 but got 4000 35 FAIL scrollIntoView({block: "end", inline: "end"}) starting at left,bottom assert_approx_equals: scrollY expected 3600 +/- 0.5 but got 4000 36 FAIL scrollIntoView({block: "end", inline: "end"}) starting at right,top assert_approx_equals: scrollX expected 3400 +/- 0.5 but got 4000 37 FAIL scrollIntoView({block: "end", inline: "end"}) starting at right,bottom assert_approx_equals: scrollX expected 3400 +/- 0.5 but got 4000 38 FAIL scrollIntoView({block: "nearest", inline: "nearest"}) starting at left,top assert_approx_equals: scrollY expected 3600 +/- 0.5 but got 4000 34 PASS scrollIntoView({block: "end", inline: "end"}) starting at left,top 35 PASS scrollIntoView({block: "end", inline: "end"}) starting at left,bottom 36 PASS scrollIntoView({block: "end", inline: "end"}) starting at right,top 37 PASS scrollIntoView({block: "end", inline: "end"}) starting at right,bottom 38 PASS scrollIntoView({block: "nearest", inline: "nearest"}) starting at left,top 39 39 PASS scrollIntoView({block: "nearest", inline: "nearest"}) starting at left,bottom 40 FAIL scrollIntoView({block: "nearest", inline: "nearest"}) starting at right,top assert_approx_equals: scrollY expected 3600 +/- 0.5 but got 4000 40 PASS scrollIntoView({block: "nearest", inline: "nearest"}) starting at right,top 41 41 PASS scrollIntoView({block: "nearest", inline: "nearest"}) starting at right,bottom 42 42 -
trunk/Source/WebCore/CMakeLists.txt
r235623 r235659 832 832 page/RemoteDOMWindow.idl 833 833 page/Screen.idl 834 page/ScrollIntoViewOptions.idl 835 page/ScrollLogicalPosition.idl 834 836 page/ScrollToOptions.idl 835 837 page/ShareData.idl -
trunk/Source/WebCore/ChangeLog
r235658 r235659 1 2018-09-04 Frederic Wang <fwang@igalia.com> 2 3 Add basic support for ScrollIntoViewOptions 4 https://bugs.webkit.org/show_bug.cgi?id=189258 5 6 Reviewed by Simon Fraser. 7 8 This patch introduces a new ScrollIntoViewOptions parameter that can be passed into 9 Element.scrollIntoView instead of a boolean. A basic support for scroll alignments is 10 implemented, so that it is closer to the behavior of the CSSOMView spec while still remaining 11 compatible with the current boolean-parameter implementation. Full implementation that 12 takes into account orientation/direction will be handled in bug 161611. This patch is also a 13 preliminary step to support the ScrollBehavior (bug 188043) for ScrollIntoView. 14 15 Tests: web-platform-tests/css/cssom-view/scrollintoview-html 16 web-platform-tests/css/cssom-view/scrollIntoView-smooth.html 17 18 * CMakeLists.txt: Add new IDL files. 19 * DerivedSources.make: Ditto. 20 * Sources.txt: Add new generated cpp JS bindings. 21 * WebCore.xcodeproj/project.pbxproj: Add files to build to XCode. 22 * dom/Element.cpp: 23 (WebCore::toScrollAlignment): Convert ScrollLogicalPosition to scroll alignment. Orientation 24 and direction are not implemented yet. 25 (WebCore::Element::scrollIntoView): Implement new scrollIntoView version accepting 26 ScrollIntoViewOptions parameter. 27 * dom/Element.h: Declare new scrollIntoView. 28 * dom/Element.idl: Make scrollIntoView accept a ScrollIntoViewOptions parameter. 29 * page/ScrollIntoViewOptions.h: Added. 30 * page/ScrollIntoViewOptions.idl: Added. 31 * page/ScrollLogicalPosition.h: Added. 32 * page/ScrollLogicalPosition.idl: Added. 33 1 34 2018-09-04 Oriol Brufau <obrufau@igalia.com> 2 35 -
trunk/Source/WebCore/DerivedSources.make
r235606 r235659 797 797 $(WebCore)/page/RemoteDOMWindow.idl \ 798 798 $(WebCore)/page/Screen.idl \ 799 $(WebCore)/page/ScrollIntoViewOptions.idl \ 800 $(WebCore)/page/ScrollLogicalPosition.idl \ 799 801 $(WebCore)/page/ScrollToOptions.idl \ 800 802 $(WebCore)/page/UserMessageHandler.idl \ -
trunk/Source/WebCore/Sources.txt
r235630 r235659 3059 3059 JSScreenLuminance.cpp 3060 3060 JSScriptProcessorNode.cpp 3061 JSScrollIntoViewOptions.cpp 3062 JSScrollLogicalPosition.cpp 3061 3063 JSScrollToOptions.cpp 3062 3064 JSSecurityPolicyViolationEvent.cpp -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r235630 r235659 2338 2338 833B9E361F508D8500E0E428 /* JSFileSystemFileEntry.h in Headers */ = {isa = PBXBuildFile; fileRef = 833B9E2C1F508D8000E0E428 /* JSFileSystemFileEntry.h */; }; 2339 2339 83407FC11E8D9C1700E048D3 /* VisibilityChangeClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 83407FC01E8D9C1200E048D3 /* VisibilityChangeClient.h */; settings = {ATTRIBUTES = (Private, ); }; }; 2340 834476EF1DA5BC5E002B5EB0 /* JSScrollLogicalPosition.h in Headers */ = {isa = PBXBuildFile; fileRef = 83E9B3011DA5A51E00FFD8D4 /* JSScrollLogicalPosition.h */; }; 2341 834476EF1DA5BC5E002B5EC1 /* JSScrollIntoViewOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 83E9B3011DA5A51E00FFD8E5 /* JSScrollIntoViewOptions.h */; }; 2340 2342 834476EF1DA5BC5E002B6ED2 /* JSScrollToOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 83E9B3011DA5A51E00FFE8F6 /* JSScrollToOptions.h */; }; 2341 2343 8348BFAC1B85729800912F36 /* ClassCollection.h in Headers */ = {isa = PBXBuildFile; fileRef = 8348BFAA1B85729500912F36 /* ClassCollection.h */; }; … … 2410 2412 83C1F5941EDF69D300410D27 /* QualifiedNameCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 83C1F5921EDF69D300410D27 /* QualifiedNameCache.h */; }; 2411 2413 83C45B8E1DC2B68A008871BA /* ValidationBubble.h in Headers */ = {isa = PBXBuildFile; fileRef = 83C45B8D1DC2B67C008871BA /* ValidationBubble.h */; settings = {ATTRIBUTES = (Private, ); }; }; 2414 83C5795D1DA5C301006F9C86 /* ScrollLogicalPosition.h in Headers */ = {isa = PBXBuildFile; fileRef = 8350C3E71DA59B6200355424 /* ScrollLogicalPosition.h */; settings = {ATTRIBUTES = (Private, ); }; }; 2415 83C5795D1DA5C301006F9C97 /* ScrollIntoViewOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 8350C3E71DA59B6200355435 /* ScrollIntoViewOptions.h */; settings = {ATTRIBUTES = (Private, ); }; }; 2412 2416 83C5795D1DA5C301006FACA8 /* ScrollToOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 8350C3E71DA59B6200356446 /* ScrollToOptions.h */; settings = {ATTRIBUTES = (Private, ); }; }; 2413 2417 83D35AEC1C7187FA00F70D5A /* XMLHttpRequestEventTarget.h in Headers */ = {isa = PBXBuildFile; fileRef = 83D35AEA1C7187ED00F70D5A /* XMLHttpRequestEventTarget.h */; }; … … 9797 9801 834DFACC1F7DAE5600C2725B /* SharedStringHash.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SharedStringHash.h; sourceTree = "<group>"; }; 9798 9802 834DFACE1F7DAE5700C2725B /* SharedStringHash.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SharedStringHash.cpp; sourceTree = "<group>"; }; 9803 8350C3E71DA59B6200355424 /* ScrollLogicalPosition.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScrollLogicalPosition.h; sourceTree = "<group>"; }; 9804 8350C3E81DA59B6200355424 /* ScrollLogicalPosition.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ScrollLogicalPosition.idl; sourceTree = "<group>"; }; 9805 8350C3E71DA59B6200355435 /* ScrollIntoViewOptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScrollIntoViewOptions.h; sourceTree = "<group>"; }; 9806 8350C3E81DA59B6200355435 /* ScrollIntoViewOptions.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ScrollIntoViewOptions.idl; sourceTree = "<group>"; }; 9799 9807 8350C3E71DA59B6200356446 /* ScrollToOptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScrollToOptions.h; sourceTree = "<group>"; }; 9800 9808 8350C3E81DA59B6200356446 /* ScrollToOptions.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ScrollToOptions.idl; sourceTree = "<group>"; }; … … 9934 9942 83E8667F1FBA5640008855C5 /* ServiceWorkerData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ServiceWorkerData.cpp; sourceTree = "<group>"; }; 9935 9943 83E959E11B8BC22B004D9385 /* NativeNodeFilter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NativeNodeFilter.h; sourceTree = "<group>"; }; 9944 83E9B3001DA5A51E00FFD8D4 /* JSScrollLogicalPosition.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSScrollLogicalPosition.cpp; sourceTree = "<group>"; }; 9945 83E9B3011DA5A51E00FFD8D4 /* JSScrollLogicalPosition.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSScrollLogicalPosition.h; sourceTree = "<group>"; }; 9946 83E9B3001DA5A51E00FFD8E5 /* JSScrollIntoViewOptions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSScrollIntoViewOptions.cpp; sourceTree = "<group>"; }; 9947 83E9B3011DA5A51E00FFD8E5 /* JSScrollIntoViewOptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSScrollIntoViewOptions.h; sourceTree = "<group>"; }; 9936 9948 83E9B3001DA5A51E00FFE8F6 /* JSScrollToOptions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSScrollToOptions.cpp; sourceTree = "<group>"; }; 9937 9949 83E9B3011DA5A51E00FFE8F6 /* JSScrollToOptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSScrollToOptions.h; sourceTree = "<group>"; }; … … 19417 19429 BCEC01BB0C274DAC009F4EC9 /* Screen.h */, 19418 19430 BCEC01BC0C274DAC009F4EC9 /* Screen.idl */, 19431 8350C3E71DA59B6200355435 /* ScrollIntoViewOptions.h */, 19432 8350C3E81DA59B6200355435 /* ScrollIntoViewOptions.idl */, 19433 8350C3E71DA59B6200355424 /* ScrollLogicalPosition.h */, 19434 8350C3E81DA59B6200355424 /* ScrollLogicalPosition.idl */, 19419 19435 8350C3E71DA59B6200356446 /* ScrollToOptions.h */, 19420 19436 8350C3E81DA59B6200356446 /* ScrollToOptions.idl */, … … 24155 24171 BCEC01C00C274DDD009F4EC9 /* JSScreen.cpp */, 24156 24172 BCEC01C10C274DDD009F4EC9 /* JSScreen.h */, 24173 83E9B3001DA5A51E00FFD8E5 /* JSScrollIntoViewOptions.cpp */, 24174 83E9B3011DA5A51E00FFD8E5 /* JSScrollIntoViewOptions.h */, 24175 83E9B3001DA5A51E00FFD8D4 /* JSScrollLogicalPosition.cpp */, 24176 83E9B3011DA5A51E00FFD8D4 /* JSScrollLogicalPosition.h */, 24157 24177 83E9B3001DA5A51E00FFE8F6 /* JSScrollToOptions.cpp */, 24158 24178 83E9B3011DA5A51E00FFE8F6 /* JSScrollToOptions.h */, … … 28936 28956 BCEC01C30C274DDD009F4EC9 /* JSScreen.h in Headers */, 28937 28957 FDA15ECE12B03F61003A583A /* JSScriptProcessorNode.h in Headers */, 28958 834476EF1DA5BC5E002B5EC1 /* JSScrollIntoViewOptions.h in Headers */, 28959 834476EF1DA5BC5E002B5EB0 /* JSScrollLogicalPosition.h in Headers */, 28938 28960 834476EF1DA5BC5E002B6ED2 /* JSScrollToOptions.h in Headers */, 28939 28961 CED06AD11C77754800FDFAF1 /* JSSecurityPolicyViolationEvent.h in Headers */, … … 30121 30143 A6D5A99D1629D70000297330 /* ScrollingTreeScrollingNodeDelegate.h in Headers */, 30122 30144 0FB8890A167D2FA10010CDA5 /* ScrollingTreeStickyNode.h in Headers */, 30145 83C5795D1DA5C301006F9C97 /* ScrollIntoViewOptions.h in Headers */, 30123 30146 7AAFE8D019CB8672000F56D8 /* ScrollLatchingState.h in Headers */, 30147 83C5795D1DA5C301006F9C86 /* ScrollLogicalPosition.h in Headers */, 30124 30148 F478755419983AFF0024A287 /* ScrollSnapAnimatorState.h in Headers */, 30125 30149 F46729281E0DE68500ACC3D8 /* ScrollSnapOffsetsInfo.h in Headers */, -
trunk/Source/WebCore/dom/Element.cpp
r235458 r235659 92 92 #include "SVGSVGElement.h" 93 93 #include "ScriptDisallowedScope.h" 94 #include "ScrollIntoViewOptions.h" 94 95 #include "ScrollLatchingState.h" 95 96 #include "SelectorQuery.h" … … 650 651 if (renderer()->style().hasAppearance()) 651 652 renderer()->theme().stateChanged(*renderer(), ControlStates::HoverState); 653 } 654 655 // FIXME(webkit.org/b/161611): Take into account orientation/direction. 656 inline ScrollAlignment toScrollAlignment(std::optional<ScrollLogicalPosition> position, bool isVertical) 657 { 658 switch (position.value_or(isVertical ? ScrollLogicalPosition::Start : ScrollLogicalPosition::Nearest)) { 659 case ScrollLogicalPosition::Start: 660 return isVertical ? ScrollAlignment::alignTopAlways : ScrollAlignment::alignLeftAlways; 661 case ScrollLogicalPosition::Center: 662 return ScrollAlignment::alignCenterAlways; 663 case ScrollLogicalPosition::End: 664 return isVertical ? ScrollAlignment::alignBottomAlways : ScrollAlignment::alignRightAlways; 665 case ScrollLogicalPosition::Nearest: 666 return ScrollAlignment::alignToEdgeIfNeeded; 667 default: 668 ASSERT_NOT_REACHED(); 669 return ScrollAlignment::alignToEdgeIfNeeded; 670 } 671 } 672 673 void Element::scrollIntoView(std::optional<Variant<bool, ScrollIntoViewOptions>>&& arg) 674 { 675 document().updateLayoutIgnorePendingStylesheets(); 676 677 if (!renderer()) 678 return; 679 680 bool insideFixed; 681 LayoutRect absoluteBounds = renderer()->absoluteAnchorRect(&insideFixed); 682 683 // FIXME(webkit.org/b/188043): Support ScrollBehavior. 684 ScrollIntoViewOptions options; 685 if (arg) { 686 auto value = arg.value(); 687 if (WTF::holds_alternative<ScrollIntoViewOptions>(value)) 688 options = WTF::get<ScrollIntoViewOptions>(value); 689 else if (!WTF::get<bool>(value)) 690 options.blockPosition = ScrollLogicalPosition::End; 691 } 692 693 ScrollAlignment alignX = toScrollAlignment(options.inlinePosition, false); 694 ScrollAlignment alignY = toScrollAlignment(options.blockPosition, true); 695 renderer()->scrollRectToVisible(SelectionRevealMode::Reveal, absoluteBounds, insideFixed, alignX, alignY, ShouldAllowCrossOriginScrolling::No); 652 696 } 653 697 -
trunk/Source/WebCore/dom/Element.h
r234884 r235659 56 56 class WebAnimation; 57 57 struct ElementStyle; 58 struct ScrollIntoViewOptions; 58 59 59 60 #if ENABLE(INTERSECTION_OBSERVER) … … 142 143 unsigned findAttributeIndexByName(const AtomicString& name, bool shouldIgnoreAttributeCase) const { return elementData()->findAttributeIndexByName(name, shouldIgnoreAttributeCase); } 143 144 145 WEBCORE_EXPORT void scrollIntoView(std::optional<Variant<bool, ScrollIntoViewOptions>>&& arg); 144 146 WEBCORE_EXPORT void scrollIntoView(bool alignToTop = true); 145 147 WEBCORE_EXPORT void scrollIntoViewIfNeeded(bool centerIfNeeded = true); -
trunk/Source/WebCore/dom/Element.idl
r234482 r235659 72 72 DOMRectList getClientRects(); 73 73 [NewObject] DOMRect getBoundingClientRect(); 74 void scrollIntoView(optional boolean alignWithTop = true); // FIXME(webkit.org/b/161611): Parameter type should be (boolean or object).74 void scrollIntoView(optional (boolean or ScrollIntoViewOptions) arg); 75 75 [ImplementedAs=scrollTo] void scroll(optional ScrollToOptions options); 76 76 [ImplementedAs=scrollTo] void scroll(unrestricted double x, unrestricted double y); -
trunk/Source/WebKit/ChangeLog
r235656 r235659 1 2018-09-04 Frederic Wang <fwang@igalia.com> 2 3 Add basic support for ScrollIntoViewOptions 4 https://bugs.webkit.org/show_bug.cgi?id=189258 5 6 Reviewed by Simon Fraser. 7 8 * DOM/DOMElement.mm: Add ScrollIntoViewOptions 9 header so that this file can build despite the new scrollIntoView function. 10 1 11 2018-09-04 Chris Dumez <cdumez@apple.com> 2 12 -
trunk/Source/WebKit/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMElementGtk.cpp
r234586 r235659 28 28 #include <WebCore/HTMLNames.h> 29 29 #include <WebCore/JSExecState.h> 30 #include <WebCore/ScrollIntoViewOptions.h> 30 31 #include <WebCore/StyledElement.h> 31 32 #include "WebKitDOMAttrPrivate.h" -
trunk/Source/WebKitLegacy/mac/ChangeLog
r235647 r235659 1 2018-09-04 Frederic Wang <fwang@igalia.com> 2 3 Add basic support for ScrollIntoViewOptions 4 https://bugs.webkit.org/show_bug.cgi?id=189258 5 6 Reviewed by Simon Fraser. 7 8 * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMElementGtk.cpp: Add ScrollIntoViewOptions 9 header so that this file can build despite the new scrollIntoView function. 10 1 11 2018-09-04 Wenson Hsieh <wenson_hsieh@apple.com> 2 12 -
trunk/Source/WebKitLegacy/mac/DOM/DOMElement.mm
r234586 r235659 41 41 #import <WebCore/NameNodeList.h> 42 42 #import <WebCore/NodeList.h> 43 #import <WebCore/ScrollIntoViewOptions.h> 43 44 #import <WebCore/StyleProperties.h> 44 45 #import <WebCore/StyledElement.h> -
trunk/Source/WebKitLegacy/win/ChangeLog
r235566 r235659 1 2018-09-04 Frederic Wang <fwang@igalia.com> 2 3 Add basic support for ScrollIntoViewOptions 4 https://bugs.webkit.org/show_bug.cgi?id=189258 5 6 Reviewed by Simon Fraser. 7 8 * DOMCoreClasses.cpp: Add ScrollIntoViewOptions header so that this file 9 can build despite the new scrollIntoView function. 10 1 11 2018-08-31 Chris Dumez <cdumez@apple.com> 2 12 -
trunk/Source/WebKitLegacy/win/DOMCoreClasses.cpp
r233935 r235659 55 55 #include <WebCore/RenderElement.h> 56 56 #include <WebCore/RenderTreeAsText.h> 57 #include <WebCore/ScrollIntoViewOptions.h> 57 58 #include <WebCore/StyledElement.h> 58 59
Note: See TracChangeset
for help on using the changeset viewer.