Diff
Modified: trunk/LayoutTests/ChangeLog (235658 => 235659)
--- trunk/LayoutTests/ChangeLog 2018-09-05 05:02:53 UTC (rev 235658)
+++ trunk/LayoutTests/ChangeLog 2018-09-05 05:19:58 UTC (rev 235659)
@@ -1,3 +1,14 @@
+2018-09-04 Frederic Wang <[email protected]>
+
+ Add basic support for ScrollIntoViewOptions
+ https://bugs.webkit.org/show_bug.cgi?id=189258
+
+ Reviewed by Simon Fraser.
+
+ Update test expectations for WPT scrollIntoView tests.
+
+ * platform/ios-wk2/imported/w3c/web-platform-tests/css/cssom-view/scrollIntoView-smooth-expected.txt: Removed.
+
2018-09-04 Michael Saboff <[email protected]>
YARR: Add new RegExp back reference tests to specifically test back reference JIT code
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (235658 => 235659)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2018-09-05 05:02:53 UTC (rev 235658)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2018-09-05 05:19:58 UTC (rev 235659)
@@ -1,3 +1,20 @@
+2018-09-04 Frederic Wang <[email protected]>
+
+ Add basic support for ScrollIntoViewOptions
+ https://bugs.webkit.org/show_bug.cgi?id=189258
+
+ Reviewed by Simon Fraser.
+
+ Update test expectations for WPT scrollIntoView tests.
+
+ * web-platform-tests/css/cssom-view/scrollIntoView-scrollMargin-expected.txt: This is not
+ supported yet but update the error message.
+ * web-platform-tests/css/cssom-view/scrollIntoView-scrollPadding-expected.txt: Ditto.
+ * web-platform-tests/css/cssom-view/scrollIntoView-shadow-expected.txt: Update expectation
+ now that this test passes.
+ * web-platform-tests/css/cssom-view/scrollIntoView-smooth-expected.txt: Ditto.
+ * web-platform-tests/css/cssom-view/scrollintoview-expected.txt: Ditto.
+
2018-09-04 Oriol Brufau <[email protected]>
Check important flags when serializing shorthand with "initial" values
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scrollIntoView-scrollMargin-expected.txt (235658 => 235659)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scrollIntoView-scrollMargin-expected.txt 2018-09-05 05:02:53 UTC (rev 235658)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scrollIntoView-scrollMargin-expected.txt 2018-09-05 05:19:58 UTC (rev 235659)
@@ -1,5 +1,5 @@
-FAIL scrollIntoView({block: "center", inline: "center"}) assert_approx_equals: scrollX expected 153.5 +/- 0.5 but got 115
-FAIL scrollIntoView({block: "start", inline: "start"}) assert_approx_equals: scrollX expected 184 +/- 0.5 but got 115
+FAIL scrollIntoView({block: "center", inline: "center"}) assert_approx_equals: scrollX expected 153.5 +/- 0.5 but got 158
+FAIL scrollIntoView({block: "start", inline: "start"}) assert_approx_equals: scrollX expected 184 +/- 0.5 but got 200
FAIL scrollIntoView({block: "end", inline: "end"}) assert_approx_equals: scrollX expected 123 +/- 0.5 but got 115
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scrollIntoView-scrollPadding-expected.txt (235658 => 235659)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scrollIntoView-scrollPadding-expected.txt 2018-09-05 05:02:53 UTC (rev 235658)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scrollIntoView-scrollPadding-expected.txt 2018-09-05 05:19:58 UTC (rev 235659)
@@ -1,5 +1,5 @@
-FAIL scrollIntoView({block: "center", inline: "center"}) assert_approx_equals: scrollX expected 153.5 +/- 0.5 but got 115
-FAIL scrollIntoView({block: "start", inline: "start"}) assert_approx_equals: scrollX expected 184 +/- 0.5 but got 115
+FAIL scrollIntoView({block: "center", inline: "center"}) assert_approx_equals: scrollX expected 153.5 +/- 0.5 but got 158
+FAIL scrollIntoView({block: "start", inline: "start"}) assert_approx_equals: scrollX expected 184 +/- 0.5 but got 200
FAIL scrollIntoView({block: "end", inline: "end"}) assert_approx_equals: scrollX expected 123 +/- 0.5 but got 115
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scrollIntoView-shadow-expected.txt (235658 => 235659)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scrollIntoView-shadow-expected.txt 2018-09-05 05:02:53 UTC (rev 235658)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scrollIntoView-shadow-expected.txt 2018-09-05 05:19:58 UTC (rev 235659)
@@ -1,3 +1,3 @@
-FAIL scrollIntoView should behave correctly if applies to shadow dom elements assert_approx_equals: expected 8 +/- 1 but got 0
+PASS scrollIntoView should behave correctly if applies to shadow dom elements
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scrollIntoView-smooth-expected.txt (235658 => 235659)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scrollIntoView-smooth-expected.txt 2018-09-05 05:02:53 UTC (rev 235658)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scrollIntoView-smooth-expected.txt 2018-09-05 05:19:58 UTC (rev 235659)
@@ -1,6 +1,6 @@
-FAIL Smooth scrollIntoView should scroll the element to the 'nearest' position assert_approx_equals: scrollY expected 915 +/- 1 but got 1000
-FAIL Smooth scrollIntoView should scroll the element to the 'start' position assert_approx_equals: scrollX expected 1008 +/- 1 but got 723
-FAIL Smooth scrollIntoView should scroll the element to the 'center' position assert_approx_equals: scrollX expected 865.5 +/- 1 but got 723
-FAIL Smooth scrollIntoView should scroll the element to the 'end' position assert_approx_equals: scrollY expected 915 +/- 1 but got 1000
+PASS Smooth scrollIntoView should scroll the element to the 'nearest' position
+PASS Smooth scrollIntoView should scroll the element to the 'start' position
+PASS Smooth scrollIntoView should scroll the element to the 'center' position
+PASS Smooth scrollIntoView should scroll the element to the 'end' position
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scrollintoview-expected.txt (235658 => 235659)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scrollintoview-expected.txt 2018-09-05 05:02:53 UTC (rev 235658)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scrollintoview-expected.txt 2018-09-05 05:19:58 UTC (rev 235659)
@@ -15,28 +15,28 @@
PASS scrollIntoView(undefined) starting at left,bottom
PASS scrollIntoView(undefined) starting at right,top
PASS scrollIntoView(undefined) starting at right,bottom
-FAIL scrollIntoView(null) starting at left,top assert_approx_equals: scrollY expected 4000 +/- 0.5 but got 3600
-FAIL scrollIntoView(null) starting at left,bottom assert_approx_equals: scrollY expected 4000 +/- 0.5 but got 3600
-FAIL scrollIntoView(null) starting at right,top assert_approx_equals: scrollY expected 4000 +/- 0.5 but got 3600
-FAIL scrollIntoView(null) starting at right,bottom assert_approx_equals: scrollY expected 4000 +/- 0.5 but got 3600
+PASS scrollIntoView(null) starting at left,top
+PASS scrollIntoView(null) starting at left,bottom
+PASS scrollIntoView(null) starting at right,top
+PASS scrollIntoView(null) starting at right,bottom
PASS scrollIntoView({}) starting at left,top
PASS scrollIntoView({}) starting at left,bottom
PASS scrollIntoView({}) starting at right,top
PASS scrollIntoView({}) starting at right,bottom
-FAIL scrollIntoView({block: "center", inline: "center"}) starting at left,top assert_approx_equals: scrollX expected 3700 +/- 0.5 but got 3400
-FAIL scrollIntoView({block: "center", inline: "center"}) starting at left,bottom assert_approx_equals: scrollX expected 3700 +/- 0.5 but got 3400
-FAIL scrollIntoView({block: "center", inline: "center"}) starting at right,top assert_approx_equals: scrollX expected 3700 +/- 0.5 but got 4000
-FAIL scrollIntoView({block: "center", inline: "center"}) starting at right,bottom assert_approx_equals: scrollX expected 3700 +/- 0.5 but got 4000
-FAIL scrollIntoView({block: "start", inline: "start"}) starting at left,top assert_approx_equals: scrollX expected 4000 +/- 0.5 but got 3400
-FAIL scrollIntoView({block: "start", inline: "start"}) starting at left,bottom assert_approx_equals: scrollX expected 4000 +/- 0.5 but got 3400
+PASS scrollIntoView({block: "center", inline: "center"}) starting at left,top
+PASS scrollIntoView({block: "center", inline: "center"}) starting at left,bottom
+PASS scrollIntoView({block: "center", inline: "center"}) starting at right,top
+PASS scrollIntoView({block: "center", inline: "center"}) starting at right,bottom
+PASS scrollIntoView({block: "start", inline: "start"}) starting at left,top
+PASS scrollIntoView({block: "start", inline: "start"}) starting at left,bottom
PASS scrollIntoView({block: "start", inline: "start"}) starting at right,top
PASS scrollIntoView({block: "start", inline: "start"}) starting at right,bottom
-FAIL scrollIntoView({block: "end", inline: "end"}) starting at left,top assert_approx_equals: scrollY expected 3600 +/- 0.5 but got 4000
-FAIL scrollIntoView({block: "end", inline: "end"}) starting at left,bottom assert_approx_equals: scrollY expected 3600 +/- 0.5 but got 4000
-FAIL scrollIntoView({block: "end", inline: "end"}) starting at right,top assert_approx_equals: scrollX expected 3400 +/- 0.5 but got 4000
-FAIL scrollIntoView({block: "end", inline: "end"}) starting at right,bottom assert_approx_equals: scrollX expected 3400 +/- 0.5 but got 4000
-FAIL scrollIntoView({block: "nearest", inline: "nearest"}) starting at left,top assert_approx_equals: scrollY expected 3600 +/- 0.5 but got 4000
+PASS scrollIntoView({block: "end", inline: "end"}) starting at left,top
+PASS scrollIntoView({block: "end", inline: "end"}) starting at left,bottom
+PASS scrollIntoView({block: "end", inline: "end"}) starting at right,top
+PASS scrollIntoView({block: "end", inline: "end"}) starting at right,bottom
+PASS scrollIntoView({block: "nearest", inline: "nearest"}) starting at left,top
PASS scrollIntoView({block: "nearest", inline: "nearest"}) starting at left,bottom
-FAIL scrollIntoView({block: "nearest", inline: "nearest"}) starting at right,top assert_approx_equals: scrollY expected 3600 +/- 0.5 but got 4000
+PASS scrollIntoView({block: "nearest", inline: "nearest"}) starting at right,top
PASS scrollIntoView({block: "nearest", inline: "nearest"}) starting at right,bottom
Deleted: trunk/LayoutTests/platform/ios-wk2/imported/w3c/web-platform-tests/css/cssom-view/scrollIntoView-smooth-expected.txt (235658 => 235659)
--- trunk/LayoutTests/platform/ios-wk2/imported/w3c/web-platform-tests/css/cssom-view/scrollIntoView-smooth-expected.txt 2018-09-05 05:02:53 UTC (rev 235658)
+++ trunk/LayoutTests/platform/ios-wk2/imported/w3c/web-platform-tests/css/cssom-view/scrollIntoView-smooth-expected.txt 2018-09-05 05:19:58 UTC (rev 235659)
@@ -1,6 +0,0 @@
-
-FAIL Smooth scrollIntoView should scroll the element to the 'nearest' position assert_approx_equals: scrollY expected 900 +/- 1 but got 1000
-FAIL Smooth scrollIntoView should scroll the element to the 'start' position assert_approx_equals: scrollX expected 1008 +/- 1 but got 708
-FAIL Smooth scrollIntoView should scroll the element to the 'center' position assert_approx_equals: scrollX expected 858 +/- 1 but got 708
-FAIL Smooth scrollIntoView should scroll the element to the 'end' position assert_approx_equals: scrollY expected 900 +/- 1 but got 1000
-
Modified: trunk/Source/WebCore/CMakeLists.txt (235658 => 235659)
--- trunk/Source/WebCore/CMakeLists.txt 2018-09-05 05:02:53 UTC (rev 235658)
+++ trunk/Source/WebCore/CMakeLists.txt 2018-09-05 05:19:58 UTC (rev 235659)
@@ -831,6 +831,8 @@
page/PerformanceTiming.idl
page/RemoteDOMWindow.idl
page/Screen.idl
+ page/ScrollIntoViewOptions.idl
+ page/ScrollLogicalPosition.idl
page/ScrollToOptions.idl
page/ShareData.idl
page/VisualViewport.idl
Modified: trunk/Source/WebCore/ChangeLog (235658 => 235659)
--- trunk/Source/WebCore/ChangeLog 2018-09-05 05:02:53 UTC (rev 235658)
+++ trunk/Source/WebCore/ChangeLog 2018-09-05 05:19:58 UTC (rev 235659)
@@ -1,3 +1,36 @@
+2018-09-04 Frederic Wang <[email protected]>
+
+ Add basic support for ScrollIntoViewOptions
+ https://bugs.webkit.org/show_bug.cgi?id=189258
+
+ Reviewed by Simon Fraser.
+
+ This patch introduces a new ScrollIntoViewOptions parameter that can be passed into
+ Element.scrollIntoView instead of a boolean. A basic support for scroll alignments is
+ implemented, so that it is closer to the behavior of the CSSOMView spec while still remaining
+ compatible with the current boolean-parameter implementation. Full implementation that
+ takes into account orientation/direction will be handled in bug 161611. This patch is also a
+ preliminary step to support the ScrollBehavior (bug 188043) for ScrollIntoView.
+
+ Tests: web-platform-tests/css/cssom-view/scrollintoview-html
+ web-platform-tests/css/cssom-view/scrollIntoView-smooth.html
+
+ * CMakeLists.txt: Add new IDL files.
+ * DerivedSources.make: Ditto.
+ * Sources.txt: Add new generated cpp JS bindings.
+ * WebCore.xcodeproj/project.pbxproj: Add files to build to XCode.
+ * dom/Element.cpp:
+ (WebCore::toScrollAlignment): Convert ScrollLogicalPosition to scroll alignment. Orientation
+ and direction are not implemented yet.
+ (WebCore::Element::scrollIntoView): Implement new scrollIntoView version accepting
+ ScrollIntoViewOptions parameter.
+ * dom/Element.h: Declare new scrollIntoView.
+ * dom/Element.idl: Make scrollIntoView accept a ScrollIntoViewOptions parameter.
+ * page/ScrollIntoViewOptions.h: Added.
+ * page/ScrollIntoViewOptions.idl: Added.
+ * page/ScrollLogicalPosition.h: Added.
+ * page/ScrollLogicalPosition.idl: Added.
+
2018-09-04 Oriol Brufau <[email protected]>
Check important flags when serializing shorthand with "initial" values
Modified: trunk/Source/WebCore/DerivedSources.make (235658 => 235659)
--- trunk/Source/WebCore/DerivedSources.make 2018-09-05 05:02:53 UTC (rev 235658)
+++ trunk/Source/WebCore/DerivedSources.make 2018-09-05 05:19:58 UTC (rev 235659)
@@ -796,6 +796,8 @@
$(WebCore)/page/PerformanceTiming.idl \
$(WebCore)/page/RemoteDOMWindow.idl \
$(WebCore)/page/Screen.idl \
+ $(WebCore)/page/ScrollIntoViewOptions.idl \
+ $(WebCore)/page/ScrollLogicalPosition.idl \
$(WebCore)/page/ScrollToOptions.idl \
$(WebCore)/page/UserMessageHandler.idl \
$(WebCore)/page/UserMessageHandlersNamespace.idl \
Modified: trunk/Source/WebCore/Sources.txt (235658 => 235659)
--- trunk/Source/WebCore/Sources.txt 2018-09-05 05:02:53 UTC (rev 235658)
+++ trunk/Source/WebCore/Sources.txt 2018-09-05 05:19:58 UTC (rev 235659)
@@ -3058,6 +3058,8 @@
JSScreen.cpp
JSScreenLuminance.cpp
JSScriptProcessorNode.cpp
+JSScrollIntoViewOptions.cpp
+JSScrollLogicalPosition.cpp
JSScrollToOptions.cpp
JSSecurityPolicyViolationEvent.cpp
JSServiceWorker.cpp
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (235658 => 235659)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2018-09-05 05:02:53 UTC (rev 235658)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2018-09-05 05:19:58 UTC (rev 235659)
@@ -2337,6 +2337,8 @@
833B9E341F508D8500E0E428 /* JSFileSystemEntry.h in Headers */ = {isa = PBXBuildFile; fileRef = 833B9E2A1F508D8000E0E428 /* JSFileSystemEntry.h */; };
833B9E361F508D8500E0E428 /* JSFileSystemFileEntry.h in Headers */ = {isa = PBXBuildFile; fileRef = 833B9E2C1F508D8000E0E428 /* JSFileSystemFileEntry.h */; };
83407FC11E8D9C1700E048D3 /* VisibilityChangeClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 83407FC01E8D9C1200E048D3 /* VisibilityChangeClient.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 834476EF1DA5BC5E002B5EB0 /* JSScrollLogicalPosition.h in Headers */ = {isa = PBXBuildFile; fileRef = 83E9B3011DA5A51E00FFD8D4 /* JSScrollLogicalPosition.h */; };
+ 834476EF1DA5BC5E002B5EC1 /* JSScrollIntoViewOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 83E9B3011DA5A51E00FFD8E5 /* JSScrollIntoViewOptions.h */; };
834476EF1DA5BC5E002B6ED2 /* JSScrollToOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 83E9B3011DA5A51E00FFE8F6 /* JSScrollToOptions.h */; };
8348BFAC1B85729800912F36 /* ClassCollection.h in Headers */ = {isa = PBXBuildFile; fileRef = 8348BFAA1B85729500912F36 /* ClassCollection.h */; };
834DFAD01F7DAE5D00C2725B /* SharedStringHash.h in Headers */ = {isa = PBXBuildFile; fileRef = 834DFACC1F7DAE5600C2725B /* SharedStringHash.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -2409,6 +2411,8 @@
83C1D436178D5AB500141E68 /* SVGPathSegMovetoRel.h in Headers */ = {isa = PBXBuildFile; fileRef = 83C1D424178D5AB400141E68 /* SVGPathSegMovetoRel.h */; };
83C1F5941EDF69D300410D27 /* QualifiedNameCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 83C1F5921EDF69D300410D27 /* QualifiedNameCache.h */; };
83C45B8E1DC2B68A008871BA /* ValidationBubble.h in Headers */ = {isa = PBXBuildFile; fileRef = 83C45B8D1DC2B67C008871BA /* ValidationBubble.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 83C5795D1DA5C301006F9C86 /* ScrollLogicalPosition.h in Headers */ = {isa = PBXBuildFile; fileRef = 8350C3E71DA59B6200355424 /* ScrollLogicalPosition.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 83C5795D1DA5C301006F9C97 /* ScrollIntoViewOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 8350C3E71DA59B6200355435 /* ScrollIntoViewOptions.h */; settings = {ATTRIBUTES = (Private, ); }; };
83C5795D1DA5C301006FACA8 /* ScrollToOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 8350C3E71DA59B6200356446 /* ScrollToOptions.h */; settings = {ATTRIBUTES = (Private, ); }; };
83D35AEC1C7187FA00F70D5A /* XMLHttpRequestEventTarget.h in Headers */ = {isa = PBXBuildFile; fileRef = 83D35AEA1C7187ED00F70D5A /* XMLHttpRequestEventTarget.h */; };
83D35AF21C718D9000F70D5A /* JSXMLHttpRequestEventTarget.h in Headers */ = {isa = PBXBuildFile; fileRef = 83D35AF01C718D8400F70D5A /* JSXMLHttpRequestEventTarget.h */; };
@@ -9796,6 +9800,10 @@
834DD4F31BE08989002C9C3E /* PageMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PageMac.mm; sourceTree = "<group>"; };
834DFACC1F7DAE5600C2725B /* SharedStringHash.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SharedStringHash.h; sourceTree = "<group>"; };
834DFACE1F7DAE5700C2725B /* SharedStringHash.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SharedStringHash.cpp; sourceTree = "<group>"; };
+ 8350C3E71DA59B6200355424 /* ScrollLogicalPosition.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScrollLogicalPosition.h; sourceTree = "<group>"; };
+ 8350C3E81DA59B6200355424 /* ScrollLogicalPosition.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ScrollLogicalPosition.idl; sourceTree = "<group>"; };
+ 8350C3E71DA59B6200355435 /* ScrollIntoViewOptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScrollIntoViewOptions.h; sourceTree = "<group>"; };
+ 8350C3E81DA59B6200355435 /* ScrollIntoViewOptions.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ScrollIntoViewOptions.idl; sourceTree = "<group>"; };
8350C3E71DA59B6200356446 /* ScrollToOptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScrollToOptions.h; sourceTree = "<group>"; };
8350C3E81DA59B6200356446 /* ScrollToOptions.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ScrollToOptions.idl; sourceTree = "<group>"; };
83520C7D1A71BFCC006BD2AA /* CSSFontFamily.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSSFontFamily.h; sourceTree = "<group>"; };
@@ -9933,6 +9941,10 @@
83E8667D1FBA563F008855C5 /* ServiceWorkerData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ServiceWorkerData.h; sourceTree = "<group>"; };
83E8667F1FBA5640008855C5 /* ServiceWorkerData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ServiceWorkerData.cpp; sourceTree = "<group>"; };
83E959E11B8BC22B004D9385 /* NativeNodeFilter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NativeNodeFilter.h; sourceTree = "<group>"; };
+ 83E9B3001DA5A51E00FFD8D4 /* JSScrollLogicalPosition.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSScrollLogicalPosition.cpp; sourceTree = "<group>"; };
+ 83E9B3011DA5A51E00FFD8D4 /* JSScrollLogicalPosition.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSScrollLogicalPosition.h; sourceTree = "<group>"; };
+ 83E9B3001DA5A51E00FFD8E5 /* JSScrollIntoViewOptions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSScrollIntoViewOptions.cpp; sourceTree = "<group>"; };
+ 83E9B3011DA5A51E00FFD8E5 /* JSScrollIntoViewOptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSScrollIntoViewOptions.h; sourceTree = "<group>"; };
83E9B3001DA5A51E00FFE8F6 /* JSScrollToOptions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSScrollToOptions.cpp; sourceTree = "<group>"; };
83E9B3011DA5A51E00FFE8F6 /* JSScrollToOptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSScrollToOptions.h; sourceTree = "<group>"; };
83EE598B1F50958B003E8B30 /* JSErrorCallback.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSErrorCallback.h; sourceTree = "<group>"; };
@@ -19416,6 +19428,10 @@
BCEC01BA0C274DAC009F4EC9 /* Screen.cpp */,
BCEC01BB0C274DAC009F4EC9 /* Screen.h */,
BCEC01BC0C274DAC009F4EC9 /* Screen.idl */,
+ 8350C3E71DA59B6200355435 /* ScrollIntoViewOptions.h */,
+ 8350C3E81DA59B6200355435 /* ScrollIntoViewOptions.idl */,
+ 8350C3E71DA59B6200355424 /* ScrollLogicalPosition.h */,
+ 8350C3E81DA59B6200355424 /* ScrollLogicalPosition.idl */,
8350C3E71DA59B6200356446 /* ScrollToOptions.h */,
8350C3E81DA59B6200356446 /* ScrollToOptions.idl */,
BCD0E0F70E972C3500265DEA /* SecurityOrigin.cpp */,
@@ -24154,6 +24170,10 @@
46C376612085176D00C73829 /* JSRemoteDOMWindow.h */,
BCEC01C00C274DDD009F4EC9 /* JSScreen.cpp */,
BCEC01C10C274DDD009F4EC9 /* JSScreen.h */,
+ 83E9B3001DA5A51E00FFD8E5 /* JSScrollIntoViewOptions.cpp */,
+ 83E9B3011DA5A51E00FFD8E5 /* JSScrollIntoViewOptions.h */,
+ 83E9B3001DA5A51E00FFD8D4 /* JSScrollLogicalPosition.cpp */,
+ 83E9B3011DA5A51E00FFD8D4 /* JSScrollLogicalPosition.h */,
83E9B3001DA5A51E00FFE8F6 /* JSScrollToOptions.cpp */,
83E9B3011DA5A51E00FFE8F6 /* JSScrollToOptions.h */,
7C73FB0F191EF6F4007DE061 /* JSUserMessageHandler.cpp */,
@@ -28935,6 +28955,8 @@
5E2C436C1BCF071E0001E2BC /* JSRTCTrackEvent.h in Headers */,
BCEC01C30C274DDD009F4EC9 /* JSScreen.h in Headers */,
FDA15ECE12B03F61003A583A /* JSScriptProcessorNode.h in Headers */,
+ 834476EF1DA5BC5E002B5EC1 /* JSScrollIntoViewOptions.h in Headers */,
+ 834476EF1DA5BC5E002B5EB0 /* JSScrollLogicalPosition.h in Headers */,
834476EF1DA5BC5E002B6ED2 /* JSScrollToOptions.h in Headers */,
CED06AD11C77754800FDFAF1 /* JSSecurityPolicyViolationEvent.h in Headers */,
5182C2561F3143CD0059BA7C /* JSServiceWorker.h in Headers */,
@@ -30120,7 +30142,9 @@
9391A99D1629D70000297330 /* ScrollingTreeScrollingNode.h in Headers */,
A6D5A99D1629D70000297330 /* ScrollingTreeScrollingNodeDelegate.h in Headers */,
0FB8890A167D2FA10010CDA5 /* ScrollingTreeStickyNode.h in Headers */,
+ 83C5795D1DA5C301006F9C97 /* ScrollIntoViewOptions.h in Headers */,
7AAFE8D019CB8672000F56D8 /* ScrollLatchingState.h in Headers */,
+ 83C5795D1DA5C301006F9C86 /* ScrollLogicalPosition.h in Headers */,
F478755419983AFF0024A287 /* ScrollSnapAnimatorState.h in Headers */,
F46729281E0DE68500ACC3D8 /* ScrollSnapOffsetsInfo.h in Headers */,
83C5795D1DA5C301006FACA8 /* ScrollToOptions.h in Headers */,
Modified: trunk/Source/WebCore/dom/Element.cpp (235658 => 235659)
--- trunk/Source/WebCore/dom/Element.cpp 2018-09-05 05:02:53 UTC (rev 235658)
+++ trunk/Source/WebCore/dom/Element.cpp 2018-09-05 05:19:58 UTC (rev 235659)
@@ -91,6 +91,7 @@
#include "SVGNames.h"
#include "SVGSVGElement.h"
#include "ScriptDisallowedScope.h"
+#include "ScrollIntoViewOptions.h"
#include "ScrollLatchingState.h"
#include "SelectorQuery.h"
#include "Settings.h"
@@ -651,6 +652,49 @@
renderer()->theme().stateChanged(*renderer(), ControlStates::HoverState);
}
+// FIXME(webkit.org/b/161611): Take into account orientation/direction.
+inline ScrollAlignment toScrollAlignment(std::optional<ScrollLogicalPosition> position, bool isVertical)
+{
+ switch (position.value_or(isVertical ? ScrollLogicalPosition::Start : ScrollLogicalPosition::Nearest)) {
+ case ScrollLogicalPosition::Start:
+ return isVertical ? ScrollAlignment::alignTopAlways : ScrollAlignment::alignLeftAlways;
+ case ScrollLogicalPosition::Center:
+ return ScrollAlignment::alignCenterAlways;
+ case ScrollLogicalPosition::End:
+ return isVertical ? ScrollAlignment::alignBottomAlways : ScrollAlignment::alignRightAlways;
+ case ScrollLogicalPosition::Nearest:
+ return ScrollAlignment::alignToEdgeIfNeeded;
+ default:
+ ASSERT_NOT_REACHED();
+ return ScrollAlignment::alignToEdgeIfNeeded;
+ }
+}
+
+void Element::scrollIntoView(std::optional<Variant<bool, ScrollIntoViewOptions>>&& arg)
+{
+ document().updateLayoutIgnorePendingStylesheets();
+
+ if (!renderer())
+ return;
+
+ bool insideFixed;
+ LayoutRect absoluteBounds = renderer()->absoluteAnchorRect(&insideFixed);
+
+ // FIXME(webkit.org/b/188043): Support ScrollBehavior.
+ ScrollIntoViewOptions options;
+ if (arg) {
+ auto value = arg.value();
+ if (WTF::holds_alternative<ScrollIntoViewOptions>(value))
+ options = WTF::get<ScrollIntoViewOptions>(value);
+ else if (!WTF::get<bool>(value))
+ options.blockPosition = ScrollLogicalPosition::End;
+ }
+
+ ScrollAlignment alignX = toScrollAlignment(options.inlinePosition, false);
+ ScrollAlignment alignY = toScrollAlignment(options.blockPosition, true);
+ renderer()->scrollRectToVisible(SelectionRevealMode::Reveal, absoluteBounds, insideFixed, alignX, alignY, ShouldAllowCrossOriginScrolling::No);
+}
+
void Element::scrollIntoView(bool alignToTop)
{
document().updateLayoutIgnorePendingStylesheets();
Modified: trunk/Source/WebCore/dom/Element.h (235658 => 235659)
--- trunk/Source/WebCore/dom/Element.h 2018-09-05 05:02:53 UTC (rev 235658)
+++ trunk/Source/WebCore/dom/Element.h 2018-09-05 05:19:58 UTC (rev 235659)
@@ -55,6 +55,7 @@
class RenderTreePosition;
class WebAnimation;
struct ElementStyle;
+struct ScrollIntoViewOptions;
#if ENABLE(INTERSECTION_OBSERVER)
struct IntersectionObserverData;
@@ -141,6 +142,7 @@
unsigned findAttributeIndexByName(const QualifiedName& name) const { return elementData()->findAttributeIndexByName(name); }
unsigned findAttributeIndexByName(const AtomicString& name, bool shouldIgnoreAttributeCase) const { return elementData()->findAttributeIndexByName(name, shouldIgnoreAttributeCase); }
+ WEBCORE_EXPORT void scrollIntoView(std::optional<Variant<bool, ScrollIntoViewOptions>>&& arg);
WEBCORE_EXPORT void scrollIntoView(bool alignToTop = true);
WEBCORE_EXPORT void scrollIntoViewIfNeeded(bool centerIfNeeded = true);
WEBCORE_EXPORT void scrollIntoViewIfNotVisible(bool centerIfNotVisible = true);
Modified: trunk/Source/WebCore/dom/Element.idl (235658 => 235659)
--- trunk/Source/WebCore/dom/Element.idl 2018-09-05 05:02:53 UTC (rev 235658)
+++ trunk/Source/WebCore/dom/Element.idl 2018-09-05 05:19:58 UTC (rev 235659)
@@ -71,7 +71,7 @@
// CSSOM-view extensions (https://drafts.csswg.org/cssom-view/#extension-to-the-element-interface).
DOMRectList getClientRects();
[NewObject] DOMRect getBoundingClientRect();
- void scrollIntoView(optional boolean alignWithTop = true); // FIXME(webkit.org/b/161611): Parameter type should be (boolean or object).
+ void scrollIntoView(optional (boolean or ScrollIntoViewOptions) arg);
[ImplementedAs=scrollTo] void scroll(optional ScrollToOptions options);
[ImplementedAs=scrollTo] void scroll(unrestricted double x, unrestricted double y);
void scrollTo(optional ScrollToOptions options);
Added: trunk/Source/WebCore/page/ScrollIntoViewOptions.h (0 => 235659)
--- trunk/Source/WebCore/page/ScrollIntoViewOptions.h (rev 0)
+++ trunk/Source/WebCore/page/ScrollIntoViewOptions.h 2018-09-05 05:19:58 UTC (rev 235659)
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2018 Igalia S.L.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#pragma once
+
+#include "ScrollLogicalPosition.h"
+
+namespace WebCore {
+
+class Element;
+
+struct ScrollIntoViewOptions {
+ std::optional<ScrollLogicalPosition> blockPosition { ScrollLogicalPosition::Start };
+ std::optional<ScrollLogicalPosition> inlinePosition { ScrollLogicalPosition::Nearest };
+};
+
+} // namespace WebCore
Added: trunk/Source/WebCore/page/ScrollIntoViewOptions.idl (0 => 235659)
--- trunk/Source/WebCore/page/ScrollIntoViewOptions.idl (rev 0)
+++ trunk/Source/WebCore/page/ScrollIntoViewOptions.idl 2018-09-05 05:19:58 UTC (rev 235659)
@@ -0,0 +1,24 @@
+/*
+ * Copyright (C) 2018 Igalia S.L.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+// FIXME(webkit.org/b/188043): Support ScrollBehavior.
+dictionary ScrollIntoViewOptions {
+ [ImplementedAs=blockPosition] ScrollLogicalPosition block = "start";
+ [ImplementedAs=inlinePosition] ScrollLogicalPosition inline = "nearest";
+};
Added: trunk/Source/WebCore/page/ScrollLogicalPosition.h (0 => 235659)
--- trunk/Source/WebCore/page/ScrollLogicalPosition.h (rev 0)
+++ trunk/Source/WebCore/page/ScrollLogicalPosition.h 2018-09-05 05:19:58 UTC (rev 235659)
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 2018 Igalia S.L.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#pragma once
+
+namespace WebCore {
+
+enum class ScrollLogicalPosition : uint8_t {
+ Start = 0,
+ Center,
+ End,
+ Nearest
+};
+
+}
Added: trunk/Source/WebCore/page/ScrollLogicalPosition.idl (0 => 235659)
--- trunk/Source/WebCore/page/ScrollLogicalPosition.idl (rev 0)
+++ trunk/Source/WebCore/page/ScrollLogicalPosition.idl 2018-09-05 05:19:58 UTC (rev 235659)
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2018 Igalia S.L.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+enum ScrollLogicalPosition { "start", "center", "end", "nearest" };
Modified: trunk/Source/WebKit/ChangeLog (235658 => 235659)
--- trunk/Source/WebKit/ChangeLog 2018-09-05 05:02:53 UTC (rev 235658)
+++ trunk/Source/WebKit/ChangeLog 2018-09-05 05:19:58 UTC (rev 235659)
@@ -1,3 +1,13 @@
+2018-09-04 Frederic Wang <[email protected]>
+
+ Add basic support for ScrollIntoViewOptions
+ https://bugs.webkit.org/show_bug.cgi?id=189258
+
+ Reviewed by Simon Fraser.
+
+ * DOM/DOMElement.mm: Add ScrollIntoViewOptions
+ header so that this file can build despite the new scrollIntoView function.
+
2018-09-04 Chris Dumez <[email protected]>
Rename experimental feature for process swap on navigation
Modified: trunk/Source/WebKit/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMElementGtk.cpp (235658 => 235659)
--- trunk/Source/WebKit/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMElementGtk.cpp 2018-09-05 05:02:53 UTC (rev 235658)
+++ trunk/Source/WebKit/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMElementGtk.cpp 2018-09-05 05:19:58 UTC (rev 235659)
@@ -27,6 +27,7 @@
#include "GObjectEventListener.h"
#include <WebCore/HTMLNames.h>
#include <WebCore/JSExecState.h>
+#include <WebCore/ScrollIntoViewOptions.h>
#include <WebCore/StyledElement.h>
#include "WebKitDOMAttrPrivate.h"
#include "WebKitDOMCSSStyleDeclarationPrivate.h"
Modified: trunk/Source/WebKitLegacy/mac/ChangeLog (235658 => 235659)
--- trunk/Source/WebKitLegacy/mac/ChangeLog 2018-09-05 05:02:53 UTC (rev 235658)
+++ trunk/Source/WebKitLegacy/mac/ChangeLog 2018-09-05 05:19:58 UTC (rev 235659)
@@ -1,3 +1,13 @@
+2018-09-04 Frederic Wang <[email protected]>
+
+ Add basic support for ScrollIntoViewOptions
+ https://bugs.webkit.org/show_bug.cgi?id=189258
+
+ Reviewed by Simon Fraser.
+
+ * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMElementGtk.cpp: Add ScrollIntoViewOptions
+ header so that this file can build despite the new scrollIntoView function.
+
2018-09-04 Wenson Hsieh <[email protected]>
Populate "text/uri-list" with multiple URLs when the pasteboard contains multiple URLs
Modified: trunk/Source/WebKitLegacy/mac/DOM/DOMElement.mm (235658 => 235659)
--- trunk/Source/WebKitLegacy/mac/DOM/DOMElement.mm 2018-09-05 05:02:53 UTC (rev 235658)
+++ trunk/Source/WebKitLegacy/mac/DOM/DOMElement.mm 2018-09-05 05:19:58 UTC (rev 235659)
@@ -40,6 +40,7 @@
#import <WebCore/JSExecState.h>
#import <WebCore/NameNodeList.h>
#import <WebCore/NodeList.h>
+#import <WebCore/ScrollIntoViewOptions.h>
#import <WebCore/StyleProperties.h>
#import <WebCore/StyledElement.h>
#import <WebCore/ThreadCheck.h>
Modified: trunk/Source/WebKitLegacy/win/ChangeLog (235658 => 235659)
--- trunk/Source/WebKitLegacy/win/ChangeLog 2018-09-05 05:02:53 UTC (rev 235658)
+++ trunk/Source/WebKitLegacy/win/ChangeLog 2018-09-05 05:19:58 UTC (rev 235659)
@@ -1,3 +1,13 @@
+2018-09-04 Frederic Wang <[email protected]>
+
+ Add basic support for ScrollIntoViewOptions
+ https://bugs.webkit.org/show_bug.cgi?id=189258
+
+ Reviewed by Simon Fraser.
+
+ * DOMCoreClasses.cpp: Add ScrollIntoViewOptions header so that this file
+ can build despite the new scrollIntoView function.
+
2018-08-31 Chris Dumez <[email protected]>
Unreviewed Windows build fix after r235562.
Modified: trunk/Source/WebKitLegacy/win/DOMCoreClasses.cpp (235658 => 235659)
--- trunk/Source/WebKitLegacy/win/DOMCoreClasses.cpp 2018-09-05 05:02:53 UTC (rev 235658)
+++ trunk/Source/WebKitLegacy/win/DOMCoreClasses.cpp 2018-09-05 05:19:58 UTC (rev 235659)
@@ -54,6 +54,7 @@
#include <WebCore/Range.h>
#include <WebCore/RenderElement.h>
#include <WebCore/RenderTreeAsText.h>
+#include <WebCore/ScrollIntoViewOptions.h>
#include <WebCore/StyledElement.h>
#include <initguid.h>