Get rid of custom bindings for HTMLLinkElement.sizes setter
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 20 Sep 2015 16:43:55 +0000 (16:43 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 20 Sep 2015 16:43:55 +0000 (16:43 +0000)
https://bugs.webkit.org/show_bug.cgi?id=149382

Reviewed by Sam Weinig.

LayoutTests/imported/w3c:

* web-platform-tests/html/dom/interfaces-expected.txt:
Rebaseline test. Our bindings generator does not move attributes that have
a custom setter from the instance to the prototype. Now that the 'sizes'
attribute no longer has a custom setter, it has moved to the prototype,
where it is expected to be.

Source/WebCore:

Get rid of custom bindings for HTMLLinkElement.sizes setter by leveraging
the new [PutForwards=xxx] Web IDL extended attribute, as per the HTML
specification:
- https://html.spec.whatwg.org/#htmllinkelement

Also add FIXME comments in our IDL for various attributes that should be
using [PutForwards=xxx] according to the HTML specification but are not
currently. Those were not updated in this patch because it will subtly
change their web-exposed behavior.

No new tests, no intended web-exposed behavior change. However, one side
effect of the change is that the attribtue has moved to the prototype.
Our bindings generator was keeping this attribute on the instance because
it has a custom setter.
Bindings tests coverage was extended.

* CMakeLists.txt:
* WebCore.vcxproj/WebCore.vcxproj:
* WebCore.vcxproj/WebCore.vcxproj.filters:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/JSBindingsAllInOne.cpp:
* bindings/js/JSHTMLLinkElementCustom.cpp: Removed.
Drop custom bindings for HTMLLinkElement.sizes setter.

* bindings/scripts/CodeGeneratorJS.pm:
(GenerateImplementation):
- Stop passing an extra isNull argument to getters of nullable attributes
  that have a wrapper type. These can return a null pointer so there is
  no need for an extra argument.
- When [PutForwards=xxx] is used, only do the null-check on the attribute
  getter if the attribute is marked as nullable. If the attribute is not
  marked as nullable, the implementation is expected to return a C++
  reference, otherwise a raw pointer. This was needed because
  HTMLLinkElement::sizes() returns a reference as it can never return
  null.

* bindings/scripts/test/GObject/WebKitDOMTestObj.cpp:
* bindings/scripts/test/GObject/WebKitDOMTestObj.h:
* bindings/scripts/test/JS/JSTestObj.cpp:
* bindings/scripts/test/ObjC/DOMTestObj.h:
* bindings/scripts/test/ObjC/DOMTestObj.mm:
* bindings/scripts/test/TestObj.idl:
Add bindings tests coverage for using [PutForwards=xxx] on a
nullable attribute.

* dom/Document.idl:
Mark Document.location as nullable as per the specification. The
implementation returns a raw pointer and can return null. The
bindings generator expects a raw pointer and will do a null check
on it.

* html/HTMLAnchorElement.idl:
* html/HTMLAreaElement.idl:
* html/HTMLElement.idl:
* html/HTMLIFrameElement.idl:
* html/HTMLOutputElement.idl:
* html/HTMLTableCellElement.idl:
Add FIXME comments for attributes that are supposed to use
[PutForwards=xxx] as per the HTML specification but currently don't.

* html/HTMLLinkElement.idl:
Use [PutForwards=value] for the 'sizes' attribute, as per the
specification and stop using a custom setter.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@190030 268f45cc-cd09-0410-ab3c-d52691b4dbfc

30 files changed:
LayoutTests/imported/w3c/ChangeLog
LayoutTests/imported/w3c/web-platform-tests/html/dom/interfaces-expected.txt
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/Modules/mediastream/HTMLMediaElementMediaStream.cpp
Source/WebCore/Modules/mediastream/HTMLMediaElementMediaStream.h
Source/WebCore/Modules/mediastream/MediaTrackConstraints.cpp
Source/WebCore/Modules/mediastream/MediaTrackConstraints.h
Source/WebCore/WebCore.vcxproj/WebCore.vcxproj
Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/bindings/js/JSBindingsAllInOne.cpp
Source/WebCore/bindings/js/JSHTMLLinkElementCustom.cpp [deleted file]
Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp
Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h
Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp
Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h
Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm
Source/WebCore/bindings/scripts/test/TestObj.idl
Source/WebCore/dom/Document.idl
Source/WebCore/html/HTMLAnchorElement.idl
Source/WebCore/html/HTMLAreaElement.idl
Source/WebCore/html/HTMLElement.idl
Source/WebCore/html/HTMLIFrameElement.idl
Source/WebCore/html/HTMLLinkElement.cpp
Source/WebCore/html/HTMLLinkElement.h
Source/WebCore/html/HTMLLinkElement.idl
Source/WebCore/html/HTMLOutputElement.idl
Source/WebCore/html/HTMLTableCellElement.idl

index 03b4e3a..a362927 100644 (file)
@@ -1,3 +1,16 @@
+2015-09-19  Chris Dumez  <cdumez@apple.com>
+
+        Get rid of custom bindings for HTMLLinkElement.sizes setter
+        https://bugs.webkit.org/show_bug.cgi?id=149382
+
+        Reviewed by Sam Weinig.
+
+        * web-platform-tests/html/dom/interfaces-expected.txt:
+        Rebaseline test. Our bindings generator does not move attributes that have
+        a custom setter from the instance to the prototype. Now that the 'sizes'
+        attribute no longer has a custom setter, it has moved to the prototype,
+        where it is expected to be.
+
 2015-09-18  Chris Dumez  <cdumez@apple.com>
 
         Drop support for Entity Node type
index 85f4a9b..ecd86e4 100644 (file)
@@ -164,6 +164,7 @@ CONSOLE MESSAGE: line 583: Deprecated attempt to access property 'relList' on a
 CONSOLE MESSAGE: line 583: Deprecated attempt to access property 'media' on a non-HTMLLinkElement object.
 CONSOLE MESSAGE: line 583: Deprecated attempt to access property 'hreflang' on a non-HTMLLinkElement object.
 CONSOLE MESSAGE: line 583: Deprecated attempt to access property 'type' on a non-HTMLLinkElement object.
+CONSOLE MESSAGE: line 583: Deprecated attempt to access property 'sizes' on a non-HTMLLinkElement object.
 CONSOLE MESSAGE: line 583: Deprecated attempt to access property 'charset' on a non-HTMLLinkElement object.
 CONSOLE MESSAGE: line 583: Deprecated attempt to access property 'rev' on a non-HTMLLinkElement object.
 CONSOLE MESSAGE: line 583: Deprecated attempt to access property 'target' on a non-HTMLLinkElement object.
@@ -2348,7 +2349,9 @@ FAIL HTMLLinkElement interface: attribute hreflang assert_throws: getting proper
 FAIL HTMLLinkElement interface: attribute type assert_throws: getting property on prototype object must throw TypeError function "function () {
     [native code]
 }" did not throw
-FAIL HTMLLinkElement interface: attribute sizes assert_true: The prototype object must have a property "sizes" expected true got false
+FAIL HTMLLinkElement interface: attribute sizes assert_throws: getting property on prototype object must throw TypeError function "function () {
+    [native code]
+}" did not throw
 FAIL HTMLLinkElement interface: attribute charset assert_throws: getting property on prototype object must throw TypeError function "function () {
     [native code]
 }" did not throw
@@ -2367,7 +2370,7 @@ PASS HTMLLinkElement interface: document.createElement("link") must inherit prop
 PASS HTMLLinkElement interface: document.createElement("link") must inherit property "media" with the proper type (4) 
 PASS HTMLLinkElement interface: document.createElement("link") must inherit property "hreflang" with the proper type (5) 
 PASS HTMLLinkElement interface: document.createElement("link") must inherit property "type" with the proper type (6) 
-FAIL HTMLLinkElement interface: document.createElement("link") must inherit property "sizes" with the proper type (7) assert_inherits: property "sizes" found on object expected in prototype chain
+PASS HTMLLinkElement interface: document.createElement("link") must inherit property "sizes" with the proper type (7) 
 PASS HTMLLinkElement interface: document.createElement("link") must inherit property "charset" with the proper type (8) 
 PASS HTMLLinkElement interface: document.createElement("link") must inherit property "rev" with the proper type (9) 
 PASS HTMLLinkElement interface: document.createElement("link") must inherit property "target" with the proper type (10) 
index ca1de4d..b5acb41 100644 (file)
@@ -1155,7 +1155,6 @@ set(WebCore_SOURCES
     bindings/js/JSHTMLFrameElementCustom.cpp
     bindings/js/JSHTMLFrameSetElementCustom.cpp
     bindings/js/JSHTMLInputElementCustom.cpp
-    bindings/js/JSHTMLLinkElementCustom.cpp
     bindings/js/JSHTMLMediaElementCustom.cpp
     bindings/js/JSHTMLObjectElementCustom.cpp
     bindings/js/JSHTMLOptionsCollectionCustom.cpp
index 59a2134..eb5e600 100644 (file)
@@ -1,3 +1,74 @@
+2015-09-19  Chris Dumez  <cdumez@apple.com>
+
+        Get rid of custom bindings for HTMLLinkElement.sizes setter
+        https://bugs.webkit.org/show_bug.cgi?id=149382
+
+        Reviewed by Sam Weinig.
+
+        Get rid of custom bindings for HTMLLinkElement.sizes setter by leveraging
+        the new [PutForwards=xxx] Web IDL extended attribute, as per the HTML
+        specification:
+        - https://html.spec.whatwg.org/#htmllinkelement
+
+        Also add FIXME comments in our IDL for various attributes that should be
+        using [PutForwards=xxx] according to the HTML specification but are not
+        currently. Those were not updated in this patch because it will subtly
+        change their web-exposed behavior.
+
+        No new tests, no intended web-exposed behavior change. However, one side
+        effect of the change is that the attribtue has moved to the prototype.
+        Our bindings generator was keeping this attribute on the instance because
+        it has a custom setter.
+        Bindings tests coverage was extended.
+
+        * CMakeLists.txt:
+        * WebCore.vcxproj/WebCore.vcxproj:
+        * WebCore.vcxproj/WebCore.vcxproj.filters:
+        * WebCore.xcodeproj/project.pbxproj:
+        * bindings/js/JSBindingsAllInOne.cpp:
+        * bindings/js/JSHTMLLinkElementCustom.cpp: Removed.
+        Drop custom bindings for HTMLLinkElement.sizes setter.
+
+        * bindings/scripts/CodeGeneratorJS.pm:
+        (GenerateImplementation):
+        - Stop passing an extra isNull argument to getters of nullable attributes
+          that have a wrapper type. These can return a null pointer so there is
+          no need for an extra argument.
+        - When [PutForwards=xxx] is used, only do the null-check on the attribute
+          getter if the attribute is marked as nullable. If the attribute is not
+          marked as nullable, the implementation is expected to return a C++
+          reference, otherwise a raw pointer. This was needed because
+          HTMLLinkElement::sizes() returns a reference as it can never return
+          null.
+
+        * bindings/scripts/test/GObject/WebKitDOMTestObj.cpp:
+        * bindings/scripts/test/GObject/WebKitDOMTestObj.h:
+        * bindings/scripts/test/JS/JSTestObj.cpp:
+        * bindings/scripts/test/ObjC/DOMTestObj.h:
+        * bindings/scripts/test/ObjC/DOMTestObj.mm:
+        * bindings/scripts/test/TestObj.idl:
+        Add bindings tests coverage for using [PutForwards=xxx] on a
+        nullable attribute.
+
+        * dom/Document.idl:
+        Mark Document.location as nullable as per the specification. The
+        implementation returns a raw pointer and can return null. The
+        bindings generator expects a raw pointer and will do a null check
+        on it.
+
+        * html/HTMLAnchorElement.idl:
+        * html/HTMLAreaElement.idl:
+        * html/HTMLElement.idl:
+        * html/HTMLIFrameElement.idl:
+        * html/HTMLOutputElement.idl:
+        * html/HTMLTableCellElement.idl:
+        Add FIXME comments for attributes that are supposed to use
+        [PutForwards=xxx] as per the HTML specification but currently don't.
+
+        * html/HTMLLinkElement.idl:
+        Use [PutForwards=value] for the 'sizes' attribute, as per the
+        specification and stop using a custom setter.
+
 2015-09-20  Chris Dumez  <cdumez@apple.com>
 
         [CallWith=ScriptState] should pass ExecState to the implementation by reference
index c5938d1..d2c9b93 100644 (file)
@@ -33,7 +33,7 @@
 
 namespace WebCore {
 
-MediaStream* HTMLMediaElementMediaStream::srcObject(HTMLMediaElement* mediaElement, bool& /* isNull */)
+MediaStream* HTMLMediaElementMediaStream::srcObject(HTMLMediaElement* mediaElement)
 {
     ASSERT(mediaElement);
     return mediaElement->srcObject();
index 41bf484..83c5212 100644 (file)
@@ -37,7 +37,7 @@ class MediaStream;
 
 class HTMLMediaElementMediaStream {
 public:
-    static MediaStream* srcObject(HTMLMediaElement*, bool& isNull);
+    static MediaStream* srcObject(HTMLMediaElement*);
     static void setSrcObject(HTMLMediaElement*, MediaStream*);
 };
 
index be7db86..0a37cc6 100644 (file)
@@ -55,7 +55,7 @@ Vector<PassRefPtr<MediaTrackConstraint>> MediaTrackConstraints::optional(bool) c
     return Vector<PassRefPtr<MediaTrackConstraint>>();
 }
 
-RefPtr<MediaTrackConstraintSet> MediaTrackConstraints::mandatory(bool) const
+MediaTrackConstraintSet* MediaTrackConstraints::mandatory() const
 {
     // https://bugs.webkit.org/show_bug.cgi?id=121954
     notImplemented();
index 0096241..d395e2f 100644 (file)
@@ -45,7 +45,7 @@ public:
     static Ref<MediaTrackConstraints> create(PassRefPtr<MediaConstraintsImpl>);
 
     Vector<PassRefPtr<MediaTrackConstraint>> optional(bool) const;
-    RefPtr<MediaTrackConstraintSet> mandatory(bool) const;
+    MediaTrackConstraintSet* mandatory() const;
 
 private:
     explicit MediaTrackConstraints(PassRefPtr<MediaConstraintsImpl>);
index 7f39245..774ca06 100644 (file)
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|Win32'">true</ExcludedFromBuild>
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|x64'">true</ExcludedFromBuild>
     </ClCompile>
-    <ClCompile Include="..\bindings\js\JSHTMLLinkElementCustom.cpp">
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug_WinCairo|Win32'">true</ExcludedFromBuild>
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug_WinCairo|x64'">true</ExcludedFromBuild>
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DebugSuffix|Win32'">true</ExcludedFromBuild>
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DebugSuffix|x64'">true</ExcludedFromBuild>
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release_WinCairo|Win32'">true</ExcludedFromBuild>
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release_WinCairo|x64'">true</ExcludedFromBuild>
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|Win32'">true</ExcludedFromBuild>
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|x64'">true</ExcludedFromBuild>
-    </ClCompile>
     <ClCompile Include="..\bindings\js\JSHTMLObjectElementCustom.cpp">
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
index 6e8c284..2633377 100644 (file)
     <ClCompile Include="..\bindings\js\JSHTMLInputElementCustom.cpp">
       <Filter>bindings\js</Filter>
     </ClCompile>
-    <ClCompile Include="..\bindings\js\JSHTMLLinkElementCustom.cpp">
-      <Filter>bindings\js</Filter>
-    </ClCompile>
     <ClCompile Include="..\bindings\js\JSHTMLObjectElementCustom.cpp">
       <Filter>bindings\js</Filter>
     </ClCompile>
index 74c7a7c..105ea0d 100644 (file)
                E1A8E56717552B2A007488E7 /* CFURLExtras.h in Headers */ = {isa = PBXBuildFile; fileRef = E1A8E56517552B2A007488E7 /* CFURLExtras.h */; settings = {ATTRIBUTES = (Private, ); }; };
                E1ACAF4C0E791AAF0087D12B /* DOMMessagePort.mm in Sources */ = {isa = PBXBuildFile; fileRef = E1ACAF4A0E791AAF0087D12B /* DOMMessagePort.mm */; };
                E1ACAF4D0E791AAF0087D12B /* DOMMessagePort.h in Headers */ = {isa = PBXBuildFile; fileRef = E1ACAF4B0E791AAF0087D12B /* DOMMessagePort.h */; };
-               E1AD139B1295D92600ACA989 /* JSHTMLLinkElementCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1AD139A1295D92600ACA989 /* JSHTMLLinkElementCustom.cpp */; };
                E1AD14231295EA7F00ACA989 /* JSHTMLInputElementCustom.h in Headers */ = {isa = PBXBuildFile; fileRef = E1AD14221295EA7F00ACA989 /* JSHTMLInputElementCustom.h */; };
                E1ADECBF0E76ACF1004A1A5E /* MessagePort.h in Headers */ = {isa = PBXBuildFile; fileRef = E1ADECBD0E76ACF1004A1A5E /* MessagePort.h */; settings = {ATTRIBUTES = (Private, ); }; };
                E1ADECC00E76ACF1004A1A5E /* MessagePort.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1ADECBE0E76ACF1004A1A5E /* MessagePort.cpp */; };
                E1AB1EBD14E9E3A800449E13 /* FileReaderSync.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = FileReaderSync.idl; sourceTree = "<group>"; };
                E1ACAF4A0E791AAF0087D12B /* DOMMessagePort.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DOMMessagePort.mm; sourceTree = "<group>"; };
                E1ACAF4B0E791AAF0087D12B /* DOMMessagePort.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMMessagePort.h; sourceTree = "<group>"; };
-               E1AD139A1295D92600ACA989 /* JSHTMLLinkElementCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSHTMLLinkElementCustom.cpp; sourceTree = "<group>"; };
                E1AD14221295EA7F00ACA989 /* JSHTMLInputElementCustom.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSHTMLInputElementCustom.h; sourceTree = "<group>"; };
                E1ADECBD0E76ACF1004A1A5E /* MessagePort.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; fileEncoding = 4; path = MessagePort.h; sourceTree = "<group>"; };
                E1ADECBE0E76ACF1004A1A5E /* MessagePort.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MessagePort.cpp; sourceTree = "<group>"; };
                                BCD41ABA0C060DE800C0E446 /* JSHTMLFrameSetElementCustom.cpp */,
                                BCC438770E886CC700533DD5 /* JSHTMLInputElementCustom.cpp */,
                                E1AD14221295EA7F00ACA989 /* JSHTMLInputElementCustom.h */,
-                               E1AD139A1295D92600ACA989 /* JSHTMLLinkElementCustom.cpp */,
                                CDF65CCC145B6AFE00C4C7AA /* JSHTMLMediaElementCustom.cpp */,
                                BC305CA30C0781BB00CD20F0 /* JSHTMLObjectElementCustom.cpp */,
                                448AD27A0A4813790023D179 /* JSHTMLOptionsCollectionCustom.cpp */,
                                1AE2AB230A1CE63B00B42B25 /* JSHTMLLegendElement.cpp in Sources */,
                                1AE2AB250A1CE63B00B42B25 /* JSHTMLLIElement.cpp in Sources */,
                                A80E7B100A19D606007FB8C5 /* JSHTMLLinkElement.cpp in Sources */,
-                               E1AD139B1295D92600ACA989 /* JSHTMLLinkElementCustom.cpp in Sources */,
                                1AE2AB270A1CE63B00B42B25 /* JSHTMLMapElement.cpp in Sources */,
                                BC491B780C023EFD009D6316 /* JSHTMLMarqueeElement.cpp in Sources */,
                                E44614390CD689C700FADA75 /* JSHTMLMediaElement.cpp in Sources */,
index ac10ec7..ff415ed 100644 (file)
@@ -94,7 +94,6 @@
 #include "JSHTMLFrameElementCustom.cpp"
 #include "JSHTMLFrameSetElementCustom.cpp"
 #include "JSHTMLInputElementCustom.cpp"
-#include "JSHTMLLinkElementCustom.cpp"
 #include "JSHTMLMediaElementCustom.cpp"
 #include "JSHTMLObjectElementCustom.cpp"
 #include "JSHTMLOptionsCollectionCustom.cpp"
diff --git a/Source/WebCore/bindings/js/JSHTMLLinkElementCustom.cpp b/Source/WebCore/bindings/js/JSHTMLLinkElementCustom.cpp
deleted file mode 100644 (file)
index 0467a82..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (C) 2010 Apple Inc. All rights reserved.
- * Copyright (C) 2011 Google 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.
- */
-
-#include "config.h"
-#include "JSHTMLLinkElement.h"
-
-#include "HTMLLinkElement.h"
-#include "JSDOMBinding.h"
-#include "JSDOMSettableTokenList.h"
-#include <wtf/GetPtr.h>
-
-using namespace JSC;
-
-namespace WebCore {
-
-void JSHTMLLinkElement::setSizes(ExecState* exec, JSValue value)
-{
-    impl().setSizes(valueToStringWithNullCheck(exec, value));
-}
-
-} // namespace WebCore
index 8469dec..b118d70 100644 (file)
@@ -2226,7 +2226,8 @@ sub GenerateImplementation
         foreach my $attribute (@{$interface->attributes}) {
             my $name = $attribute->signature->name;
             my $type = $attribute->signature->type;
-            my $isNullable = $attribute->signature->isNullable;
+            # Nullable wrapper types do not need any special handling as the implementation can return a null pointer.
+            my $isNullable = $attribute->signature->isNullable && !$codeGenerator->IsWrapperType($type);
             $codeGenerator->AssertNotSequenceType($type);
             my $getFunctionName = GetAttributeGetterName($interfaceName, $className, $attribute);
             my $implGetterFunctionName = $codeGenerator->WK_lcfirst($attribute->signature->extendedAttributes->{"ImplementedAs"} || $name);
@@ -2651,10 +2652,16 @@ sub GenerateImplementation
                     my $putForwards = $attribute->signature->extendedAttributes->{"PutForwards"};
                     if ($putForwards) {
                         my $implGetterFunctionName = $codeGenerator->WK_lcfirst($attribute->signature->extendedAttributes->{"ImplementedAs"} || $name);
-                        push(@implContent, "    auto* forwardedImpl = castedThis->impl().${implGetterFunctionName}();\n");
-                        push(@implContent, "    if (!forwardedImpl)\n");
-                        push(@implContent, "        return;\n");
-                        push(@implContent, "    auto& impl = *forwardedImpl;\n");
+                        if ($attribute->signature->isNullable) {
+                            push(@implContent, "    auto* forwardedImpl = castedThis->impl().${implGetterFunctionName}();\n");
+                            push(@implContent, "    if (!forwardedImpl)\n");
+                            push(@implContent, "        return;\n");
+                            push(@implContent, "    auto& impl = *forwardedImpl;\n");
+                        } else {
+                            # Attribute is not nullable, the implementation is expected to return a reference.
+                            my $attributeType = $attribute->signature->type;
+                            push(@implContent, "    ${attributeType}& impl = castedThis->impl().${implGetterFunctionName}();\n");
+                        }
                         $attribute = $codeGenerator->GetAttributeFromInterface($interface, $attribute->signature->type, $putForwards);
                     } else {
                         push(@implContent, "    auto& impl = castedThis->impl();\n");
index 001b1f4..cb091aa 100644 (file)
@@ -136,6 +136,7 @@ enum {
     PROP_NULLABLE_STRING_VALUE,
     PROP_ATTRIBUTE,
     PROP_PUT_FORWARDS_ATTRIBUTE,
+    PROP_PUT_FORWARDS_NULLABLE_ATTRIBUTE,
 };
 
 static void webkit_dom_test_obj_finalize(GObject* object)
@@ -434,6 +435,9 @@ static void webkit_dom_test_obj_get_property(GObject* object, guint propertyId,
     case PROP_PUT_FORWARDS_ATTRIBUTE:
         g_value_set_object(value, webkit_dom_test_obj_get_put_forwards_attribute(self));
         break;
+    case PROP_PUT_FORWARDS_NULLABLE_ATTRIBUTE:
+        g_value_set_object(value, webkit_dom_test_obj_get_put_forwards_nullable_attribute(self));
+        break;
     default:
         G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propertyId, pspec);
         break;
@@ -1040,6 +1044,16 @@ static void webkit_dom_test_obj_class_init(WebKitDOMTestObjClass* requestClass)
             WEBKIT_DOM_TYPE_TEST_NODE,
             WEBKIT_PARAM_READABLE));
 
+    g_object_class_install_property(
+        gobjectClass,
+        PROP_PUT_FORWARDS_NULLABLE_ATTRIBUTE,
+        g_param_spec_object(
+            "put-forwards-nullable-attribute",
+            "TestObj:put-forwards-nullable-attribute",
+            "read-only WebKitDOMTestNode* TestObj:put-forwards-nullable-attribute",
+            WEBKIT_DOM_TYPE_TEST_NODE,
+            WEBKIT_PARAM_READABLE));
+
 }
 
 static void webkit_dom_test_obj_init(WebKitDOMTestObj* request)
@@ -2578,3 +2592,13 @@ WebKitDOMTestNode* webkit_dom_test_obj_get_put_forwards_attribute(WebKitDOMTestO
     return WebKit::kit(gobjectResult.get());
 }
 
+WebKitDOMTestNode* webkit_dom_test_obj_get_put_forwards_nullable_attribute(WebKitDOMTestObj* self)
+{
+    WebCore::JSMainThreadNullState state;
+    g_return_val_if_fail(WEBKIT_DOM_IS_TEST_OBJ(self), 0);
+    WebCore::TestObj* item = WebKit::core(self);
+    bool isNull = false;
+    RefPtr<WebCore::TestNode> gobjectResult = WTF::getPtr(item->putForwardsNullableAttribute(isNull));
+    return WebKit::kit(gobjectResult.get());
+}
+
index 453fb8c..4d07f8e 100644 (file)
@@ -1714,6 +1714,17 @@ webkit_dom_test_obj_get_attribute(WebKitDOMTestObj* self);
 WEBKIT_API WebKitDOMTestNode*
 webkit_dom_test_obj_get_put_forwards_attribute(WebKitDOMTestObj* self);
 
+/**
+ * webkit_dom_test_obj_get_put_forwards_nullable_attribute:
+ * @self: A #WebKitDOMTestObj
+ *
+ * Returns: (transfer none): A #WebKitDOMTestNode
+ *
+ * Stability: Unstable
+**/
+WEBKIT_API WebKitDOMTestNode*
+webkit_dom_test_obj_get_put_forwards_nullable_attribute(WebKitDOMTestObj* self);
+
 G_END_DECLS
 
 #endif /* WEBKIT_DOM_USE_UNSTABLE_API */
index 79f953a..5e3f418 100644 (file)
@@ -312,6 +312,8 @@ JSC::EncodedJSValue jsTestObjAttributeWithReservedEnumType(JSC::ExecState*, JSC:
 void setJSTestObjAttributeWithReservedEnumType(JSC::ExecState*, JSC::JSObject*, JSC::EncodedJSValue, JSC::EncodedJSValue);
 JSC::EncodedJSValue jsTestObjPutForwardsAttribute(JSC::ExecState*, JSC::JSObject*, JSC::EncodedJSValue, JSC::PropertyName);
 void setJSTestObjPutForwardsAttribute(JSC::ExecState*, JSC::JSObject*, JSC::EncodedJSValue, JSC::EncodedJSValue);
+JSC::EncodedJSValue jsTestObjPutForwardsNullableAttribute(JSC::ExecState*, JSC::JSObject*, JSC::EncodedJSValue, JSC::PropertyName);
+void setJSTestObjPutForwardsNullableAttribute(JSC::ExecState*, JSC::JSObject*, JSC::EncodedJSValue, JSC::EncodedJSValue);
 JSC::EncodedJSValue jsTestObjConstructor(JSC::ExecState*, JSC::JSObject*, JSC::EncodedJSValue, JSC::PropertyName);
 
 class JSTestObjPrototype : public JSC::JSNonFinalObject {
@@ -580,6 +582,7 @@ static const HashTableValue JSTestObjPrototypeTableValues[] =
     { "attribute", DontDelete | ReadOnly | CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjAttribute), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
     { "attributeWithReservedEnumType", DontDelete | CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjAttributeWithReservedEnumType), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestObjAttributeWithReservedEnumType) } },
     { "putForwardsAttribute", DontDelete | CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjPutForwardsAttribute), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestObjPutForwardsAttribute) } },
+    { "putForwardsNullableAttribute", DontDelete | CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjPutForwardsNullableAttribute), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestObjPutForwardsNullableAttribute) } },
 #if ENABLE(Condition1)
     { "CONDITIONAL_CONST", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(0) } },
 #else
@@ -1963,6 +1966,23 @@ EncodedJSValue jsTestObjPutForwardsAttribute(ExecState* state, JSObject* slotBas
 }
 
 
+EncodedJSValue jsTestObjPutForwardsNullableAttribute(ExecState* state, JSObject* slotBase, EncodedJSValue thisValue, PropertyName)
+{
+    UNUSED_PARAM(state);
+    UNUSED_PARAM(slotBase);
+    UNUSED_PARAM(thisValue);
+    JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue));
+    if (UNLIKELY(!castedThis)) {
+        if (jsDynamicCast<JSTestObjPrototype*>(slotBase))
+            return reportDeprecatedGetterError(*state, "TestObj", "putForwardsNullableAttribute");
+        return throwGetterTypeError(*state, "TestObj", "putForwardsNullableAttribute");
+    }
+    auto& impl = castedThis->impl();
+    JSValue result = toJS(state, castedThis->globalObject(), WTF::getPtr(impl.putForwardsNullableAttribute()));
+    return JSValue::encode(result);
+}
+
+
 EncodedJSValue jsTestObjConstructor(ExecState* state, JSObject* baseValue, EncodedJSValue, PropertyName)
 {
     JSTestObjPrototype* domObject = jsDynamicCast<JSTestObjPrototype*>(baseValue);
@@ -3090,7 +3110,27 @@ void setJSTestObjPutForwardsAttribute(ExecState* state, JSObject* baseObject, En
             throwSetterTypeError(*state, "TestObj", "putForwardsAttribute");
         return;
     }
-    auto* forwardedImpl = castedThis->impl().putForwardsAttribute();
+    TestNode& impl = castedThis->impl().putForwardsAttribute();
+    String nativeValue = value.toString(state)->value(state);
+    if (UNLIKELY(state->hadException()))
+        return;
+    impl.setName(nativeValue);
+}
+
+
+void setJSTestObjPutForwardsNullableAttribute(ExecState* state, JSObject* baseObject, EncodedJSValue thisValue, EncodedJSValue encodedValue)
+{
+    JSValue value = JSValue::decode(encodedValue);
+    UNUSED_PARAM(baseObject);
+    JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue));
+    if (UNLIKELY(!castedThis)) {
+        if (jsDynamicCast<JSTestObjPrototype*>(JSValue::decode(thisValue)))
+            reportDeprecatedSetterError(*state, "TestObj", "putForwardsNullableAttribute");
+        else
+            throwSetterTypeError(*state, "TestObj", "putForwardsNullableAttribute");
+        return;
+    }
+    auto* forwardedImpl = castedThis->impl().putForwardsNullableAttribute();
     if (!forwardedImpl)
         return;
     auto& impl = *forwardedImpl;
index e3e5c16..8543e18 100644 (file)
@@ -123,6 +123,7 @@ WEBCORE_EXPORT @interface DOMTestObj : DOMObject
 @property int nullableStringValue;
 @property (readonly, copy) NSString *attribute;
 @property (readonly, strong) DOMTestNode *putForwardsAttribute;
+@property (readonly, strong) DOMTestNode *putForwardsNullableAttribute;
 
 - (void)voidMethod;
 - (void)voidMethodWithArgs:(int)longArg strArg:(NSString *)strArg objArg:(DOMTestObj *)objArg;
index 11e0643..03fde17 100644 (file)
     return kit(WTF::getPtr(IMPL->putForwardsAttribute()));
 }
 
+- (DOMTestNode *)putForwardsNullableAttribute
+{
+    WebCore::JSMainThreadNullState state;
+    return kit(WTF::getPtr(IMPL->putForwardsNullableAttribute(isNull)));
+}
+
 - (void)voidMethod
 {
     WebCore::JSMainThreadNullState state;
index 35c09cd..5bd09be 100644 (file)
@@ -302,6 +302,7 @@ enum _optional { "", "OptionalValue1", "OptionalValue2", "OptionalValue3" };
 
     // PutForwards
     [PutForwards=name] readonly attribute TestNode putForwardsAttribute;
+    [PutForwards=name] readonly attribute TestNode? putForwardsNullableAttribute;
 };
 
 // The following comment should not generate any code.
index 1ac9c03..1cc0007 100644 (file)
     NodeList getElementsByName([Default=Undefined,AtomicString] optional DOMString elementName);
 
 #if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT
-    [PutForwards=href, Unforgeable] readonly attribute Location location;
+    [PutForwards=href, Unforgeable] readonly attribute Location? location;
 #endif
 
     // IE extensions
index 8ed588b..0732d7b 100644 (file)
@@ -25,7 +25,11 @@ interface HTMLAnchorElement : HTMLElement {
     [Reflect, URL] attribute DOMString href;
     [Reflect] attribute DOMString hreflang;
     [Reflect] attribute DOMString name;
+
+    // FIXME: This is supposed to be:
+    // [PutForwards=value] readonly attribute DOMSettableTokenList ping;
     [Reflect] attribute DOMString ping;
+
     [Reflect] attribute DOMString rel;
     [Reflect] attribute DOMString rev;
     [Reflect] attribute DOMString shape;
index 8f3f330..955fed8 100644 (file)
@@ -23,7 +23,11 @@ interface HTMLAreaElement : HTMLElement {
     [Reflect] attribute DOMString coords;
     [Reflect, URL] attribute DOMString href;
     [Reflect] attribute boolean noHref;
+
+    // FIXME: This is supposed to be:
+    // [PutForwards=value] readonly attribute DOMSettableTokenList ping;
     [Reflect] attribute DOMString ping;
+
     [Reflect] attribute DOMString rel;
     [Reflect] attribute DOMString shape;
     [Reflect] attribute DOMString target;
index 2cdf72f..8eef6ff 100644 (file)
 
              attribute long              tabIndex;
              attribute boolean           draggable;
+
              [Reflect] attribute DOMString webkitdropzone;
+             // FIXME: Support the standard HTML equivalent.
+             // [PutForwards=value] readonly attribute DOMSettableTokenList dropzone;
+
              [Reflect] attribute boolean hidden;
              [Reflect] attribute DOMString accessKey;
 
index bc79194..beebdf6 100644 (file)
@@ -26,7 +26,11 @@ interface HTMLIFrameElement : HTMLElement {
     [Reflect] attribute DOMString marginHeight;
     [Reflect] attribute DOMString marginWidth;
     [Reflect] attribute DOMString name;
+
+    // FIXME: This is supposed to be:
+    // [PutForwards=value] readonly attribute DOMSettableTokenList sandbox;
     [Reflect] attribute DOMString sandbox;
+
     [Reflect] attribute DOMString scrolling;
     [Reflect, URL] attribute DOMString src;
     [Reflect] attribute DOMString srcdoc;
index 333432f..ac19fca 100644 (file)
@@ -159,7 +159,7 @@ void HTMLLinkElement::parseAttribute(const QualifiedName& name, const AtomicStri
         return;
     }
     if (name == sizesAttr) {
-        setSizes(value);
+        m_sizes->setValue(value);
         process();
         return;
     }
@@ -530,9 +530,4 @@ void HTMLLinkElement::removePendingSheet(RemovePendingSheetNotificationType noti
         : DocumentStyleSheetCollection::RemovePendingSheetNotifyLater);
 }
 
-void HTMLLinkElement::setSizes(const String& value)
-{
-    m_sizes->setValue(value);
-}
-
 } // namespace WebCore
index beb171e..091125e 100644 (file)
@@ -65,7 +65,6 @@ public:
 
     bool isDisabled() const { return m_disabledState == Disabled; }
     bool isEnabledViaScript() const { return m_disabledState == EnabledViaScript; }
-    void setSizes(const String&);
     DOMSettableTokenList& sizes() { return m_sizes.get(); }
 
     void dispatchPendingEvent(LinkEventSender*);
index 33e76cc..bd925c3 100644 (file)
@@ -28,7 +28,7 @@ interface HTMLLinkElement : HTMLElement {
     [Reflect] attribute DOMString rel;
     [Reflect] attribute DOMString rev;
 #if (defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT) || (defined(LANGUAGE_GOBJECT) || LANGUAGE_GOBJECT)
-    [CustomSetter] attribute DOMSettableTokenList sizes;
+    [PutForwards=value] readonly attribute DOMSettableTokenList sizes;
 #endif
     [Reflect] attribute DOMString target;
     [Reflect] attribute DOMString type;
index 7edaca2..4f1c6c3 100644 (file)
  */
 
 interface HTMLOutputElement : HTMLElement {
+    // FIXME: This is supposed to be:
+    // [PutForwards=value] readonly attribute DOMSettableTokenList htmlFor;
     readonly attribute DOMSettableTokenList htmlFor;
+
     readonly attribute HTMLFormElement form;
     [Reflect] attribute DOMString name;
 
index 3b949f3..ca04630 100644 (file)
@@ -27,7 +27,11 @@ interface HTMLTableCellElement : HTMLElement {
     [Reflect=char] attribute DOMString ch;
     [Reflect=charoff] attribute DOMString chOff;
     attribute long colSpan;
+
+    // FIXME: This is supposed to be:
+    // [PutForwards=value] readonly attribute DOMSettableTokenList headers;
     [Reflect] attribute DOMString headers;
+
     [Reflect] attribute DOMString height;
     [Reflect] attribute boolean noWrap;
     attribute long rowSpan;