Title: [205887] trunk/Source/WebCore
Revision
205887
Author
[email protected]
Date
2016-09-13 16:27:47 -0700 (Tue, 13 Sep 2016)

Log Message

Merge Element::ScrollToOptions and DOMWindow::ScrollToOptions
https://bugs.webkit.org/show_bug.cgi?id=161932

Reviewed by Simon Fraser.

Merge Element::ScrollToOptions and DOMWindow::ScrollToOptions.
Ideally we would merge them on IDL side as well but this is for
another patch.

* WebCore.xcodeproj/project.pbxproj:
* bindings/scripts/CodeGeneratorJS.pm:
(GenerateDictionaryImplementationContent):
* bindings/scripts/test/JS/JSTestObj.cpp:
(WebCore::convertDictionary<TestObj::Dictionary>):
(WebCore::convertDictionary<TestObj::DictionaryThatShouldNotTolerateNull>):
(WebCore::convertDictionary<TestObj::DictionaryThatShouldTolerateNull>):
(WebCore::convertDictionary<AlternateDictionaryName>):
* dom/Element.h:
* dom/Element.idl:
* dom/ScrollToOptions.h: Added.
* html/HTMLBodyElement.cpp:
(WebCore::HTMLBodyElement::scrollTo):
* page/DOMWindow.h:
* page/DOMWindow.idl:

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (205886 => 205887)


--- trunk/Source/WebCore/ChangeLog	2016-09-13 23:19:48 UTC (rev 205886)
+++ trunk/Source/WebCore/ChangeLog	2016-09-13 23:27:47 UTC (rev 205887)
@@ -1,3 +1,30 @@
+2016-09-13  Chris Dumez  <[email protected]>
+
+        Merge Element::ScrollToOptions and DOMWindow::ScrollToOptions
+        https://bugs.webkit.org/show_bug.cgi?id=161932
+
+        Reviewed by Simon Fraser.
+
+        Merge Element::ScrollToOptions and DOMWindow::ScrollToOptions.
+        Ideally we would merge them on IDL side as well but this is for
+        another patch.
+
+        * WebCore.xcodeproj/project.pbxproj:
+        * bindings/scripts/CodeGeneratorJS.pm:
+        (GenerateDictionaryImplementationContent):
+        * bindings/scripts/test/JS/JSTestObj.cpp:
+        (WebCore::convertDictionary<TestObj::Dictionary>):
+        (WebCore::convertDictionary<TestObj::DictionaryThatShouldNotTolerateNull>):
+        (WebCore::convertDictionary<TestObj::DictionaryThatShouldTolerateNull>):
+        (WebCore::convertDictionary<AlternateDictionaryName>):
+        * dom/Element.h:
+        * dom/Element.idl:
+        * dom/ScrollToOptions.h: Added.
+        * html/HTMLBodyElement.cpp:
+        (WebCore::HTMLBodyElement::scrollTo):
+        * page/DOMWindow.h:
+        * page/DOMWindow.idl:
+
 2016-09-13  Myles C. Maxfield  <[email protected]>
 
         [Cocoa] Unify font's ascent, descent, and x-height between macOS and iOS

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (205886 => 205887)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2016-09-13 23:19:48 UTC (rev 205886)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2016-09-13 23:27:47 UTC (rev 205887)
@@ -2873,6 +2873,7 @@
 		8348BFAC1B85729800912F36 /* ClassCollection.h in Headers */ = {isa = PBXBuildFile; fileRef = 8348BFAA1B85729500912F36 /* ClassCollection.h */; };
 		834DD4F41BE08989002C9C3E /* PageMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 834DD4F31BE08989002C9C3E /* PageMac.mm */; };
 		83520C7E1A71BFCC006BD2AA /* CSSFontFamily.h in Headers */ = {isa = PBXBuildFile; fileRef = 83520C7D1A71BFCC006BD2AA /* CSSFontFamily.h */; };
+		8354A70E1D88AD0F0089AA57 /* ScrollToOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 83F1D45F1D88AC7E006AE72B /* ScrollToOptions.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		8358CB6F1C53277200E0C2D8 /* JSXMLDocument.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83F570AE1C53268E007FD6CB /* JSXMLDocument.cpp */; };
 		8358CB701C53277500E0C2D8 /* JSXMLDocument.h in Headers */ = {isa = PBXBuildFile; fileRef = 83F570AD1C53268E007FD6CB /* JSXMLDocument.h */; };
 		835D363719FF6193004C93AB /* StyleBuilderCustom.h in Headers */ = {isa = PBXBuildFile; fileRef = 835D363619FF6193004C93AB /* StyleBuilderCustom.h */; };
@@ -10037,6 +10038,7 @@
 		83E359A11BB1031D002CEB98 /* JSHTMLTimeElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSHTMLTimeElement.cpp; sourceTree = "<group>"; };
 		83E959E11B8BC22B004D9385 /* NativeNodeFilter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NativeNodeFilter.h; sourceTree = "<group>"; };
 		83F1206A1B8C103600D75F63 /* JSNodeFilterCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSNodeFilterCustom.cpp; sourceTree = "<group>"; };
+		83F1D45F1D88AC7E006AE72B /* ScrollToOptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScrollToOptions.h; sourceTree = "<group>"; };
 		83F570AD1C53268E007FD6CB /* JSXMLDocument.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSXMLDocument.h; sourceTree = "<group>"; };
 		83F570AE1C53268E007FD6CB /* JSXMLDocument.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSXMLDocument.cpp; sourceTree = "<group>"; };
 		8419D2A4120D92D000141F8F /* SVGPathByteStream.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGPathByteStream.h; sourceTree = "<group>"; };
@@ -23238,6 +23240,7 @@
 				E11C9D9A0EB3681200E409DB /* ScriptExecutionContext.h */,
 				8A413ADF1207BBA50082016E /* ScriptRunner.cpp */,
 				8A413ADE1207BBA50082016E /* ScriptRunner.h */,
+				83F1D45F1D88AC7E006AE72B /* ScrollToOptions.h */,
 				976F36E814686225005E93B4 /* SecurityContext.cpp */,
 				976F36E914686225005E93B4 /* SecurityContext.h */,
 				1AF7AFC51A48A8BC00C8E4E7 /* SecurityOriginPolicy.cpp */,
@@ -26176,6 +26179,7 @@
 				0854B0191255E4E600B9CDD0 /* RenderSVGText.h in Headers */,
 				0854B01B1255E4E600B9CDD0 /* RenderSVGTextPath.h in Headers */,
 				436708E912D9CA4B00044234 /* RenderSVGTransformableContainer.h in Headers */,
+				8354A70E1D88AD0F0089AA57 /* ScrollToOptions.h in Headers */,
 				0854B01D1255E4E600B9CDD0 /* RenderSVGTSpan.h in Headers */,
 				436708EB12D9CA4B00044234 /* RenderSVGViewportContainer.h in Headers */,
 				A8DF4AEB0980C42C0052981B /* RenderTable.h in Headers */,

Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (205886 => 205887)


--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm	2016-09-13 23:19:48 UTC (rev 205886)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm	2016-09-13 23:27:47 UTC (rev 205887)
@@ -1009,7 +1009,7 @@
             $comma = ", ";
         }
 
-        $result .= "template<> Optional<$className> convertDictionary<$className>(ExecState& state, JSValue value)\n";
+        $result .= "template<> inline Optional<$className> convertDictionary<$className>(ExecState& state, JSValue value)\n";
         $result .= "{\n";
         $result .= "    VM& vm = state.vm();\n";
         $result .= "    auto throwScope = DECLARE_THROW_SCOPE(vm);\n";

Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp (205886 => 205887)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp	2016-09-13 23:19:48 UTC (rev 205886)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp	2016-09-13 23:27:47 UTC (rev 205887)
@@ -513,7 +513,7 @@
     return "\"high\", \"kinda-low\"";
 }
 
-template<> Optional<TestObj::Dictionary> convertDictionary<TestObj::Dictionary>(ExecState& state, JSValue value)
+template<> inline Optional<TestObj::Dictionary> convertDictionary<TestObj::Dictionary>(ExecState& state, JSValue value)
 {
     VM& vm = state.vm();
     auto throwScope = DECLARE_THROW_SCOPE(vm);
@@ -621,7 +621,7 @@
     return TestObj::Dictionary { WTFMove(enumerationValueWithoutDefault), WTFMove(enumerationValueWithDefault), WTFMove(enumerationValueWithEmptyStringDefault), WTFMove(stringWithDefault), WTFMove(stringWithoutDefault), WTFMove(booleanWithDefault), WTFMove(booleanWithoutDefault), WTFMove(sequenceOfStrings), WTFMove(restrictedDouble), WTFMove(unrestrictedDouble), WTFMove(restrictedDoubleWithDefault), WTFMove(unrestrictedDoubleWithDefault), WTFMove(restrictedFloat), WTFMove(unrestrictedFloat), WTFMove(restrictedFloatWithDefault), WTFMove(unrestrictedFloatWithDefault), WTFMove(smallIntegerClamped), WTFMove(smallIntegerWithDefault), WTFMove(smallUnsignedIntegerEnforcedRange), WTFMove(smallUnsignedIntegerWithDefault), WTFMove(integer), WTFMove(integerWithDefault), WTFMove(unsignedInteger), WTFMove(unsignedIntegerWithDefault), WTFMove(largeInteger), WTFMove(largeIntegerWithDefault), WTFMove(unsignedLargeInteger), WTFMove(unsignedLargeIntegerWithDefault), WT
 FMove(nullableNode), WTFMove(anyValue), WTFMove(anyTypedefValue), dictionaryMember.value() };
 }
 
-template<> Optional<TestObj::DictionaryThatShouldNotTolerateNull> convertDictionary<TestObj::DictionaryThatShouldNotTolerateNull>(ExecState& state, JSValue value)
+template<> inline Optional<TestObj::DictionaryThatShouldNotTolerateNull> convertDictionary<TestObj::DictionaryThatShouldNotTolerateNull>(ExecState& state, JSValue value)
 {
     VM& vm = state.vm();
     auto throwScope = DECLARE_THROW_SCOPE(vm);
@@ -643,7 +643,7 @@
     return TestObj::DictionaryThatShouldNotTolerateNull { WTFMove(requiredEnumerationValue), WTFMove(booleanWithoutDefault), *nonNullableNode, requiredDictionaryMember.value() };
 }
 
-template<> Optional<TestObj::DictionaryThatShouldTolerateNull> convertDictionary<TestObj::DictionaryThatShouldTolerateNull>(ExecState& state, JSValue value)
+template<> inline Optional<TestObj::DictionaryThatShouldTolerateNull> convertDictionary<TestObj::DictionaryThatShouldTolerateNull>(ExecState& state, JSValue value)
 {
     VM& vm = state.vm();
     auto throwScope = DECLARE_THROW_SCOPE(vm);
@@ -661,7 +661,7 @@
     return TestObj::DictionaryThatShouldTolerateNull { WTFMove(enumerationValue), WTFMove(booleanWithoutDefault) };
 }
 
-template<> Optional<AlternateDictionaryName> convertDictionary<AlternateDictionaryName>(ExecState& state, JSValue value)
+template<> inline Optional<AlternateDictionaryName> convertDictionary<AlternateDictionaryName>(ExecState& state, JSValue value)
 {
     VM& vm = state.vm();
     auto throwScope = DECLARE_THROW_SCOPE(vm);

Modified: trunk/Source/WebCore/dom/Element.h (205886 => 205887)


--- trunk/Source/WebCore/dom/Element.h	2016-09-13 23:19:48 UTC (rev 205886)
+++ trunk/Source/WebCore/dom/Element.h	2016-09-13 23:27:47 UTC (rev 205887)
@@ -30,6 +30,7 @@
 #include "ElementData.h"
 #include "HTMLNames.h"
 #include "RegionOversetState.h"
+#include "ScrollToOptions.h"
 #include "ScrollTypes.h"
 #include "SimulatedClickOptions.h"
 #include "StyleChange.h"
@@ -136,11 +137,6 @@
     WEBCORE_EXPORT void scrollIntoViewIfNeeded(bool centerIfNeeded = true);
     WEBCORE_EXPORT void scrollIntoViewIfNotVisible(bool centerIfNotVisible = true);
 
-    struct ScrollToOptions {
-        Optional<double> left;
-        Optional<double> top;
-    };
-
     void scrollBy(const ScrollToOptions&);
     void scrollBy(double x, double y);
     virtual void scrollTo(const ScrollToOptions&);

Modified: trunk/Source/WebCore/dom/Element.idl (205886 => 205887)


--- trunk/Source/WebCore/dom/Element.idl	2016-09-13 23:19:48 UTC (rev 205886)
+++ trunk/Source/WebCore/dom/Element.idl	2016-09-13 23:27:47 UTC (rev 205887)
@@ -189,7 +189,9 @@
 };
 
 // FIXME: Support ScrollBehavior.
-dictionary ScrollToOptions {
+[
+    ImplementedAs=ScrollToOptions
+]  dictionary ScrollToOptions {
     unrestricted double left;
     unrestricted double top;
 };

Added: trunk/Source/WebCore/dom/ScrollToOptions.h (0 => 205887)


--- trunk/Source/WebCore/dom/ScrollToOptions.h	                        (rev 0)
+++ trunk/Source/WebCore/dom/ScrollToOptions.h	2016-09-13 23:27:47 UTC (rev 205887)
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <wtf/Optional.h>
+
+namespace WebCore {
+
+struct ScrollToOptions {
+    Optional<double> left;
+    Optional<double> top;
+};
+
+}

Modified: trunk/Source/WebCore/html/HTMLBodyElement.cpp (205886 => 205887)


--- trunk/Source/WebCore/html/HTMLBodyElement.cpp	2016-09-13 23:19:48 UTC (rev 205886)
+++ trunk/Source/WebCore/html/HTMLBodyElement.cpp	2016-09-13 23:27:47 UTC (rev 205887)
@@ -306,7 +306,7 @@
         if (!window)
             return;
 
-        window->scrollTo({ options.left, options.top });
+        window->scrollTo(options);
         return;
     }
     return HTMLElement::scrollTo(options);

Modified: trunk/Source/WebCore/page/DOMWindow.h (205886 => 205887)


--- trunk/Source/WebCore/page/DOMWindow.h	2016-09-13 23:19:48 UTC (rev 205886)
+++ trunk/Source/WebCore/page/DOMWindow.h	2016-09-13 23:27:47 UTC (rev 205887)
@@ -30,8 +30,9 @@
 #include "ContextDestructionObserver.h"
 #include "EventTarget.h"
 #include "FrameDestructionObserver.h"
+#include "ScrollToOptions.h"
+#include "Supplementable.h"
 #include "URL.h"
-#include "Supplementable.h"
 #include <functional>
 #include <memory>
 #include <wtf/HashSet.h>
@@ -248,11 +249,6 @@
         void postMessageTimerFired(PostMessageTimer&);
         void dispatchMessageEventWithOriginCheck(SecurityOrigin* intendedTargetOrigin, Event&, PassRefPtr<Inspector::ScriptCallStack>);
 
-        struct ScrollToOptions {
-            Optional<double> left;
-            Optional<double> top;
-        };
-
         void scrollBy(const ScrollToOptions&) const;
         void scrollBy(double x, double y) const;
         void scrollTo(const ScrollToOptions&) const;

Modified: trunk/Source/WebCore/page/DOMWindow.idl (205886 => 205887)


--- trunk/Source/WebCore/page/DOMWindow.idl	2016-09-13 23:19:48 UTC (rev 205886)
+++ trunk/Source/WebCore/page/DOMWindow.idl	2016-09-13 23:27:47 UTC (rev 205887)
@@ -212,7 +212,9 @@
 };
 
 // FIXME: Support ScrollBehavior.
-dictionary ScrollToOptions {
+[
+    ImplementedAs=ScrollToOptions
+] dictionary ScrollToOptions {
     unrestricted double left;
     unrestricted double top;
 };
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to