REGRESSION(r215946): Can't reference a table cell in Google spreadsheet
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 30 May 2017 21:19:01 +0000 (21:19 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 30 May 2017 21:19:01 +0000 (21:19 +0000)
https://bugs.webkit.org/show_bug.cgi?id=172703
<rdar://problem/32458086>

Reviewed by Ryosuke Niwa.

Source/WebCore:

We updated getClientRects() to return an array of DOMRect objects instead of
a ClientRectList type, to match the latest specification. As it turns out, this
is not Web-compatible as some content (as Google Spreadsheet) relies on the
return type having an item() operation.

This patch re-introduces a DOMRectList type, with an item() operation. The
DOMRectList name is currently not exposed to the Web as we do not know what's
going to get specified yet (https://github.com/w3c/csswg-drafts/issues/1479).

No new tests, updated existing tests.

* CMakeLists.txt:
* DerivedSources.make:
* WebCore.xcodeproj/project.pbxproj:
* dom/DOMRect.h:
* dom/DOMRectList.cpp: Copied from Source/WebCore/dom/DOMRect.cpp.
(WebCore::DOMRectList::DOMRectList):
(WebCore::DOMRectList::~DOMRectList):
* dom/DOMRectList.h: Copied from Source/WebCore/dom/DOMRect.cpp.
(WebCore::DOMRectList::create):
(WebCore::DOMRectList::length):
(WebCore::DOMRectList::item):
* dom/DOMRectList.idl: Renamed from Source/WebCore/dom/DOMRect.cpp.
* dom/Element.cpp:
(WebCore::Element::getClientRects):
* dom/Element.h:
* dom/Element.idl:
* dom/Range.cpp:
(WebCore::Range::getClientRects):
* dom/Range.h:
* dom/Range.idl:
* page/Page.cpp:
(WebCore::Page::nonFastScrollableRects):
(WebCore::Page::touchEventRectsForEvent):
(WebCore::Page::passiveTouchEventListenerRects):
* page/Page.h:
* testing/Internals.cpp:
(WebCore::Internals::inspectorHighlightRects):
(WebCore::Internals::touchEventRectsForEvent):
(WebCore::Internals::passiveTouchEventListenerRects):
(WebCore::Internals::nonFastScrollableRects):
* testing/Internals.h:
* testing/Internals.idl:

Source/WebKit2:

Fix GObject bindings accordingly.

* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMClientRectList.cpp:
(WebKit::kit):
(WebKit::core):
(WebKit::wrapDOMRectList):
(webkit_dom_client_rect_list_constructed):
(webkit_dom_client_rect_list_item):
(webkit_dom_client_rect_list_get_length):
* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMClientRectListPrivate.h:
* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMElement.cpp:
(webkit_dom_element_get_client_rects):

LayoutTests:

Update existing tests to reflect behavior change.

* fast/dom/Element/getClientRects-return-type-expected.txt:
* fast/dom/Element/getClientRects-return-type.html:
* fast/dom/Range/getBoundingClientRect-getClientRects-return-type-expected.txt:
* fast/dom/Range/getBoundingClientRect-getClientRects-return-type.html:

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

28 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/dom/Element/getClientRects-return-type-expected.txt
LayoutTests/fast/dom/Element/getClientRects-return-type.html
LayoutTests/fast/dom/Range/getBoundingClientRect-getClientRects-return-type-expected.txt
LayoutTests/fast/dom/Range/getBoundingClientRect-getClientRects-return-type.html
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/DerivedSources.make
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/dom/DOMRect.h
Source/WebCore/dom/DOMRectList.cpp [moved from Source/WebCore/dom/DOMRect.cpp with 84% similarity]
Source/WebCore/dom/DOMRectList.h [new file with mode: 0644]
Source/WebCore/dom/DOMRectList.idl [new file with mode: 0644]
Source/WebCore/dom/Element.cpp
Source/WebCore/dom/Element.h
Source/WebCore/dom/Element.idl
Source/WebCore/dom/Range.cpp
Source/WebCore/dom/Range.h
Source/WebCore/dom/Range.idl
Source/WebCore/page/Page.cpp
Source/WebCore/page/Page.h
Source/WebCore/testing/Internals.cpp
Source/WebCore/testing/Internals.h
Source/WebCore/testing/Internals.idl
Source/WebKit2/ChangeLog
Source/WebKit2/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMClientRectList.cpp
Source/WebKit2/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMClientRectListPrivate.h
Source/WebKit2/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMElement.cpp

index bb6c2e6..bd7d741 100644 (file)
@@ -1,3 +1,18 @@
+2017-05-30  Chris Dumez  <cdumez@apple.com>
+
+        REGRESSION(r215946): Can't reference a table cell in Google spreadsheet
+        https://bugs.webkit.org/show_bug.cgi?id=172703
+        <rdar://problem/32458086>
+
+        Reviewed by Ryosuke Niwa.
+
+        Update existing tests to reflect behavior change.
+
+        * fast/dom/Element/getClientRects-return-type-expected.txt:
+        * fast/dom/Element/getClientRects-return-type.html:
+        * fast/dom/Range/getBoundingClientRect-getClientRects-return-type-expected.txt:
+        * fast/dom/Range/getBoundingClientRect-getClientRects-return-type.html:
+
 2017-05-30  Javier Fernandez  <jfernandez@igalia.com>
 
         [css-align] Import W3C web platform tests for the CSS Box Alignment feature
index eef210c..dab3383 100644 (file)
@@ -1,11 +1,11 @@
-Tests that Element.getClientRects() returns an array of DOMRect objects.
+Tests that Element.getClientRects() returns a list of DOMRect objects.
 
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
-PASS rects.__proto__ is Array.prototype
 PASS rects.length is 1
 PASS rects[0].__proto__ is DOMRect.prototype
+PASS rects[0] is rects.item(0)
 PASS successfullyParsed is true
 
 TEST COMPLETE
index 599e53d..6a01958 100644 (file)
@@ -3,12 +3,12 @@
 <body>
 <script src="../../../resources/js-test-pre.js"></script>
 <script>
-description("Tests that Element.getClientRects() returns an array of DOMRect objects.");
+description("Tests that Element.getClientRects() returns a list of DOMRect objects.");
 
 const rects = document.body.getClientRects();
-shouldBe("rects.__proto__", "Array.prototype");
 shouldBe("rects.length", "1");
 shouldBe("rects[0].__proto__", "DOMRect.prototype");
+shouldBe("rects[0]", "rects.item(0)");
 </script>
 <script src="../../../resources/js-test-post.js"></script>>
 </body>
index 0321f3a..ff1aec3 100644 (file)
@@ -4,8 +4,8 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE
 
 
 PASS rect.__proto__ is DOMRect.prototype
-PASS rects.__proto__ is Array.prototype
 PASS rects.length > 0 is true
+PASS rects[0] is rects.item(0)
 PASS rects[0].__proto__ is DOMRect.prototype
 PASS successfullyParsed is true
 
index c1720a6..ebb9716 100644 (file)
@@ -14,8 +14,8 @@ onload = function() {
     shouldBe("rect.__proto__", "DOMRect.prototype");
 
     rects = range.getClientRects();
-    shouldBe("rects.__proto__", "Array.prototype");
     shouldBeTrue("rects.length > 0");
+    shouldBe("rects[0]", "rects.item(0)");
     shouldBe("rects[0].__proto__", "DOMRect.prototype");
 
     finishJSTest();
index 2a0e8cf..acd26ea 100644 (file)
@@ -426,6 +426,7 @@ set(WebCore_NON_SVG_IDL_FILES
     dom/DOMPointReadOnly.idl
     dom/DOMRect.idl
     dom/DOMRectInit.idl
+    dom/DOMRectList.idl
     dom/DOMRectReadOnly.idl
     dom/DOMStringList.idl
     dom/DOMStringMap.idl
@@ -1457,7 +1458,7 @@ set(WebCore_SOURCES
     dom/DOMError.cpp
     dom/DOMImplementation.cpp
     dom/DOMNamedFlowCollection.cpp
-    dom/DOMRect.cpp
+    dom/DOMRectList.cpp
     dom/DOMStringList.cpp
     dom/DataTransfer.cpp
     dom/DataTransferItem.cpp
index 2f324e8..88b7a52 100644 (file)
@@ -1,3 +1,55 @@
+2017-05-30  Chris Dumez  <cdumez@apple.com>
+
+        REGRESSION(r215946): Can't reference a table cell in Google spreadsheet
+        https://bugs.webkit.org/show_bug.cgi?id=172703
+        <rdar://problem/32458086>
+
+        Reviewed by Ryosuke Niwa.
+
+        We updated getClientRects() to return an array of DOMRect objects instead of
+        a ClientRectList type, to match the latest specification. As it turns out, this
+        is not Web-compatible as some content (as Google Spreadsheet) relies on the
+        return type having an item() operation.
+
+        This patch re-introduces a DOMRectList type, with an item() operation. The
+        DOMRectList name is currently not exposed to the Web as we do not know what's
+        going to get specified yet (https://github.com/w3c/csswg-drafts/issues/1479).
+
+        No new tests, updated existing tests.
+
+        * CMakeLists.txt:
+        * DerivedSources.make:
+        * WebCore.xcodeproj/project.pbxproj:
+        * dom/DOMRect.h:
+        * dom/DOMRectList.cpp: Copied from Source/WebCore/dom/DOMRect.cpp.
+        (WebCore::DOMRectList::DOMRectList):
+        (WebCore::DOMRectList::~DOMRectList):
+        * dom/DOMRectList.h: Copied from Source/WebCore/dom/DOMRect.cpp.
+        (WebCore::DOMRectList::create):
+        (WebCore::DOMRectList::length):
+        (WebCore::DOMRectList::item):
+        * dom/DOMRectList.idl: Renamed from Source/WebCore/dom/DOMRect.cpp.
+        * dom/Element.cpp:
+        (WebCore::Element::getClientRects):
+        * dom/Element.h:
+        * dom/Element.idl:
+        * dom/Range.cpp:
+        (WebCore::Range::getClientRects):
+        * dom/Range.h:
+        * dom/Range.idl:
+        * page/Page.cpp:
+        (WebCore::Page::nonFastScrollableRects):
+        (WebCore::Page::touchEventRectsForEvent):
+        (WebCore::Page::passiveTouchEventListenerRects):
+        * page/Page.h:
+        * testing/Internals.cpp:
+        (WebCore::Internals::inspectorHighlightRects):
+        (WebCore::Internals::touchEventRectsForEvent):
+        (WebCore::Internals::passiveTouchEventListenerRects):
+        (WebCore::Internals::nonFastScrollableRects):
+        * testing/Internals.h:
+        * testing/Internals.idl:
+
 2017-05-30  Ali Juma  <ajuma@chromium.org>
 
         [CredentialManagement] Incorporate IDL updates from latest spec
index 423ca2b..ecb5f7c 100644 (file)
@@ -366,6 +366,7 @@ JS_BINDING_IDLS = \
     $(WebCore)/dom/DOMPointReadOnly.idl \
     $(WebCore)/dom/DOMRect.idl \
     $(WebCore)/dom/DOMRectInit.idl \
+    $(WebCore)/dom/DOMRectList.idl \
     $(WebCore)/dom/DOMRectReadOnly.idl \
     $(WebCore)/dom/DOMStringList.idl \
     $(WebCore)/dom/DOMStringMap.idl \
index cb5a44a..e364065 100644 (file)
                465307D01DB6EE4800E4137C /* JSUIEventInit.h in Headers */ = {isa = PBXBuildFile; fileRef = 83E045EF1DAA104F00B0D8B9 /* JSUIEventInit.h */; };
                465307D11DB6EE4A00E4137C /* JSUIEventInit.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83E045EE1DAA104F00B0D8B9 /* JSUIEventInit.cpp */; };
                465A8E791C8A24CE00E7D3E4 /* RuntimeApplicationChecksCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = 465A8E781C8A24CE00E7D3E4 /* RuntimeApplicationChecksCocoa.mm */; };
+               466DC6AC1EDE021D00746224 /* JSDOMRectList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 466DC6AB1EDE021D00746224 /* JSDOMRectList.cpp */; };
+               466ED8D31EDE0144005E43F6 /* JSDOMRectList.h in Headers */ = {isa = PBXBuildFile; fileRef = 466ED8D21EDE0135005E43F6 /* JSDOMRectList.h */; };
                4671E0651D67A59600C6B497 /* CanvasPath.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4671E0631D67A57B00C6B497 /* CanvasPath.cpp */; };
                4671E0661D67A59600C6B497 /* CanvasPath.h in Headers */ = {isa = PBXBuildFile; fileRef = 4671E0641D67A57B00C6B497 /* CanvasPath.h */; };
                467302021C4EFE7800BCB357 /* IgnoreOpensDuringUnloadCountIncrementer.h in Headers */ = {isa = PBXBuildFile; fileRef = 467302011C4EFE6600BCB357 /* IgnoreOpensDuringUnloadCountIncrementer.h */; };
+               468344DF1EDDFAAA00B7795B /* DOMRectList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 468344DD1EDDFA5F00B7795B /* DOMRectList.cpp */; };
+               468344E01EDDFAAA00B7795B /* DOMRectList.h in Headers */ = {isa = PBXBuildFile; fileRef = 468344DE1EDDFA5F00B7795B /* DOMRectList.h */; };
                4689F1AF1267BAE100E8D380 /* FileMetadata.h in Headers */ = {isa = PBXBuildFile; fileRef = 4689F1AE1267BAE100E8D380 /* FileMetadata.h */; };
                46B63F6C1C6E8D19002E914B /* JSEventTargetCustom.h in Headers */ = {isa = PBXBuildFile; fileRef = 46B63F6B1C6E8CDF002E914B /* JSEventTargetCustom.h */; settings = {ATTRIBUTES = (Private, ); }; };
                46C696CB1E7205F700597937 /* CPUMonitor.h in Headers */ = {isa = PBXBuildFile; fileRef = 46C696C91E7205E400597937 /* CPUMonitor.h */; settings = {ATTRIBUTES = (Private, ); }; };
                830A36BD1DAC5FAD006D7D09 /* JSMouseEventInit.h in Headers */ = {isa = PBXBuildFile; fileRef = 830A36BB1DAC5FA7006D7D09 /* JSMouseEventInit.h */; };
                83120C701C56F3F6001CB112 /* HTMLDataElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 831D1F291C56ECA000F5F6C0 /* HTMLDataElement.cpp */; };
                83120C711C56F3FB001CB112 /* HTMLDataElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 834B86A71C56E83A00F3F0E3 /* HTMLDataElement.h */; };
-               83149FF61EB38B3700089665 /* DOMRect.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83149FF51EB38B1200089665 /* DOMRect.cpp */; };
                832B843419D8E55100B26055 /* SVGAnimateElementBase.h in Headers */ = {isa = PBXBuildFile; fileRef = 832B843319D8E55100B26055 /* SVGAnimateElementBase.h */; };
                832B843619D8E57400B26055 /* SVGAnimateElementBase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 832B843519D8E57400B26055 /* SVGAnimateElementBase.cpp */; };
                83407FC11E8D9C1700E048D3 /* VisibilityChangeClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 83407FC01E8D9C1200E048D3 /* VisibilityChangeClient.h */; settings = {ATTRIBUTES = (Private, ); }; };
                463EB6201B8789CB0096ED51 /* TagCollection.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TagCollection.cpp; sourceTree = "<group>"; };
                463EB6211B8789CB0096ED51 /* TagCollection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TagCollection.h; sourceTree = "<group>"; };
                465A8E781C8A24CE00E7D3E4 /* RuntimeApplicationChecksCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RuntimeApplicationChecksCocoa.mm; sourceTree = "<group>"; };
+               466DC6AB1EDE021D00746224 /* JSDOMRectList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDOMRectList.cpp; sourceTree = "<group>"; };
+               466ED8D21EDE0135005E43F6 /* JSDOMRectList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSDOMRectList.h; sourceTree = "<group>"; };
                4671E0631D67A57B00C6B497 /* CanvasPath.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CanvasPath.cpp; sourceTree = "<group>"; };
                4671E0641D67A57B00C6B497 /* CanvasPath.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CanvasPath.h; sourceTree = "<group>"; };
                467302011C4EFE6600BCB357 /* IgnoreOpensDuringUnloadCountIncrementer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IgnoreOpensDuringUnloadCountIncrementer.h; sourceTree = "<group>"; };
+               468344DC1EDDFA5F00B7795B /* DOMRectList.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = DOMRectList.idl; sourceTree = "<group>"; };
+               468344DD1EDDFA5F00B7795B /* DOMRectList.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = DOMRectList.cpp; sourceTree = "<group>"; };
+               468344DE1EDDFA5F00B7795B /* DOMRectList.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DOMRectList.h; sourceTree = "<group>"; };
                4689F1AE1267BAE100E8D380 /* FileMetadata.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileMetadata.h; sourceTree = "<group>"; };
                46B63F6B1C6E8CDF002E914B /* JSEventTargetCustom.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSEventTargetCustom.h; sourceTree = "<group>"; };
                46C696C91E7205E400597937 /* CPUMonitor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPUMonitor.h; sourceTree = "<group>"; };
                830784B11C52EE1900104D1D /* XMLDocument.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XMLDocument.h; sourceTree = "<group>"; };
                830A36BA1DAC5FA7006D7D09 /* JSMouseEventInit.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSMouseEventInit.cpp; sourceTree = "<group>"; };
                830A36BB1DAC5FA7006D7D09 /* JSMouseEventInit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSMouseEventInit.h; sourceTree = "<group>"; };
-               83149FF51EB38B1200089665 /* DOMRect.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DOMRect.cpp; sourceTree = "<group>"; };
                831D1F291C56ECA000F5F6C0 /* HTMLDataElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLDataElement.cpp; sourceTree = "<group>"; };
                8329A4171EC25B2B008ED4BE /* DocumentAndElementEventHandlers.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = DocumentAndElementEventHandlers.idl; sourceTree = "<group>"; };
                8329DCC21C7A6AE300730B33 /* HTMLHyperlinkElementUtils.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = HTMLHyperlinkElementUtils.idl; sourceTree = "<group>"; };
                                0F4710B61DB56BE8002DCEC3 /* JSDOMRect.h */,
                                0F4710B71DB56BE8002DCEC3 /* JSDOMRectInit.cpp */,
                                0F4710B81DB56BE8002DCEC3 /* JSDOMRectInit.h */,
+                               466DC6AB1EDE021D00746224 /* JSDOMRectList.cpp */,
+                               466ED8D21EDE0135005E43F6 /* JSDOMRectList.h */,
                                0F4710B91DB56BE8002DCEC3 /* JSDOMRectReadOnly.cpp */,
                                0F4710BA1DB56BE8002DCEC3 /* JSDOMRectReadOnly.h */,
                                C5137CF011A58378004ADB99 /* JSDOMStringList.cpp */,
                                0F4966A11DB4090100A274BB /* DOMPointInit.idl */,
                                0F49669B1DB408C100A274BB /* DOMPointReadOnly.h */,
                                0F49669C1DB408C100A274BB /* DOMPointReadOnly.idl */,
-                               83149FF51EB38B1200089665 /* DOMRect.cpp */,
                                0F4710A91DB56AFC002DCEC3 /* DOMRect.h */,
                                0F4710AA1DB56AFC002DCEC3 /* DOMRect.idl */,
+                               468344DD1EDDFA5F00B7795B /* DOMRectList.cpp */,
+                               468344DE1EDDFA5F00B7795B /* DOMRectList.h */,
+                               468344DC1EDDFA5F00B7795B /* DOMRectList.idl */,
                                0F4710AB1DB56AFC002DCEC3 /* DOMRectInit.h */,
                                0F4710AC1DB56AFC002DCEC3 /* DOMRectInit.idl */,
                                0F4710AD1DB56AFC002DCEC3 /* DOMRectReadOnly.h */,
                                BC5A86850C33676000EEA649 /* DOMSelection.h in Headers */,
                                C544274B11A57E7A0063A749 /* DOMStringList.h in Headers */,
                                BC64640A11D7F304006455B0 /* DOMStringMap.h in Headers */,
+                               468344E01EDDFAAA00B7795B /* DOMRectList.h in Headers */,
                                188604B40F2E654A000B6443 /* DOMTimer.h in Headers */,
                                05FD69E012845D4300B2BEB3 /* DOMTimeStamp.h in Headers */,
                                76FC2B0C12370DA0006A991A /* DOMTokenList.h in Headers */,
                                BE8EF043171C8FF9009B48C3 /* JSAudioTrack.h in Headers */,
                                BE8EF045171C8FF9009B48C3 /* JSAudioTrackList.h in Headers */,
                                76FB9FF919A73E3A00420562 /* JSAutocompleteErrorEvent.h in Headers */,
+                               466ED8D31EDE0144005E43F6 /* JSDOMRectList.h in Headers */,
                                BC124F000C26447A009E2349 /* JSBarProp.h in Headers */,
                                57C7A69F1E57917800C67D71 /* JSBasicCredential.h in Headers */,
                                BC946348107A936600857193 /* JSBeforeLoadEvent.h in Headers */,
                                5101846A0B08602A004A825F /* CachedPage.cpp in Sources */,
                                D0EDA774143E303C0028E383 /* CachedRawResource.cpp in Sources */,
                                BCB16C1F0979C3BD00467741 /* CachedResource.cpp in Sources */,
+                               468344DF1EDDFAAA00B7795B /* DOMRectList.cpp in Sources */,
                                E47B4BE90E71241600038854 /* CachedResourceHandle.cpp in Sources */,
                                BCB16C290979C3BD00467741 /* CachedResourceLoader.cpp in Sources */,
                                5081E3C33CE580C16EF8B48B /* CachedResourceRequest.cpp in Sources */,
                                2D5002F81B56D7810020AAF7 /* DOMPath.cpp in Sources */,
                                A9C6E4EB0D745E2B006442E9 /* DOMPlugin.cpp in Sources */,
                                A9C6E4EF0D745E38006442E9 /* DOMPluginArray.cpp in Sources */,
-                               83149FF61EB38B3700089665 /* DOMRect.cpp in Sources */,
                                BC5A86840C33676000EEA649 /* DOMSelection.cpp in Sources */,
                                C55610F111A704EB00B82D27 /* DOMStringList.cpp in Sources */,
                                188604B30F2E654A000B6443 /* DOMTimer.cpp in Sources */,
                                B10B6981140C174000BC1C26 /* WebVTTTokenizer.cpp in Sources */,
                                CD8203111395ACE700F956C6 /* WebWindowAnimation.mm in Sources */,
                                F55B3DDF1251F12D003EF269 /* WeekInputType.cpp in Sources */,
+                               466DC6AC1EDE021D00746224 /* JSDOMRectList.cpp in Sources */,
                                85031B500A44EFC700F992E0 /* WheelEvent.cpp in Sources */,
                                2E19516B1B6598D200DF6EEF /* WheelEventDeltaFilter.cpp in Sources */,
                                2EEEE55C1B66A047008E2CBC /* WheelEventDeltaFilterMac.mm in Sources */,
index 1453381..8af4f0c 100644 (file)
@@ -58,6 +58,4 @@ private:
     DOMRect() = default;
 };
 
-WEBCORE_EXPORT Vector<Ref<DOMRect>> createDOMRectVector(const Vector<FloatQuad>&);
-
 }
similarity index 84%
rename from Source/WebCore/dom/DOMRect.cpp
rename to Source/WebCore/dom/DOMRectList.cpp
index c396e62..2d33d29 100644 (file)
  */
 
 #include "config.h"
-#include "DOMRect.h"
+#include "DOMRectList.h"
 
-#include "FloatQuad.h"
+#include "DOMRect.h"
 
 namespace WebCore {
 
-Vector<Ref<DOMRect>> createDOMRectVector(const Vector<FloatQuad>& quads)
+DOMRectList::DOMRectList(const Vector<FloatQuad>& quads)
 {
-    Vector<Ref<DOMRect>> result;
-    result.reserveInitialCapacity(quads.size());
+    m_items.reserveInitialCapacity(quads.size());
     for (auto& quad : quads)
-        result.uncheckedAppend(DOMRect::create(quad.boundingBox()));
-    return result;
+        m_items.uncheckedAppend(DOMRect::create(quad.boundingBox()));
 }
 
+DOMRectList::~DOMRectList()
+{
 }
+
+} // namespace WebCore
diff --git a/Source/WebCore/dom/DOMRectList.h b/Source/WebCore/dom/DOMRectList.h
new file mode 100644 (file)
index 0000000..4e46ab3
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2017 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 "FloatQuad.h"
+#include <wtf/RefCounted.h>
+#include <wtf/Vector.h>
+
+namespace WebCore {
+
+class DOMRect;
+
+class DOMRectList : public RefCounted<DOMRectList> {
+public:
+    static Ref<DOMRectList> create(const Vector<FloatQuad>& quads) { return adoptRef(*new DOMRectList(quads)); }
+    static Ref<DOMRectList> create() { return adoptRef(*new DOMRectList()); }
+    WEBCORE_EXPORT ~DOMRectList();
+
+    unsigned length() const { return m_items.size(); }
+    DOMRect* item(unsigned index) { return index < m_items.size() ? m_items[index].ptr() : nullptr; }
+
+private:
+    WEBCORE_EXPORT explicit DOMRectList(const Vector<FloatQuad>& quads);
+    DOMRectList() = default;
+
+    Vector<Ref<DOMRect>> m_items;
+};
+
+}
diff --git a/Source/WebCore/dom/DOMRectList.idl b/Source/WebCore/dom/DOMRectList.idl
new file mode 100644 (file)
index 0000000..e611283
--- /dev/null
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2017 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.
+ */
+
+[
+     ExportMacro=WEBCORE_EXPORT,
+     ImplementationLacksVTable,
+     NoInterfaceObject
+] interface DOMRectList {
+    readonly attribute unsigned long length;
+    getter DOMRect item(unsigned long index);
+};
index c87a6d6..2bd17c6 100644 (file)
@@ -38,6 +38,7 @@
 #include "CustomElementReactionQueue.h"
 #include "CustomElementRegistry.h"
 #include "DOMRect.h"
+#include "DOMRectList.h"
 #include "DOMTokenList.h"
 #include "DocumentAnimation.h"
 #include "DocumentSharedObjectPool.h"
@@ -1144,13 +1145,13 @@ LayoutRect Element::absoluteEventHandlerBounds(bool& includesFixedPositionElemen
     return absoluteEventBoundsOfElementAndDescendants(includesFixedPositionElements);
 }
 
-Vector<Ref<DOMRect>> Element::getClientRects()
+Ref<DOMRectList> Element::getClientRects()
 {
     document().updateLayoutIgnorePendingStylesheets();
 
     RenderBoxModelObject* renderBoxModelObject = this->renderBoxModelObject();
     if (!renderBoxModelObject)
-        return { };
+        return DOMRectList::create();
 
     // FIXME: Handle SVG elements.
     // FIXME: Handle table/inline-table with a caption.
@@ -1158,7 +1159,7 @@ Vector<Ref<DOMRect>> Element::getClientRects()
     Vector<FloatQuad> quads;
     renderBoxModelObject->absoluteQuads(quads);
     document().convertAbsoluteToClientQuads(quads, renderBoxModelObject->style());
-    return createDOMRectVector(quads);
+    return DOMRectList::create(quads);
 }
 
 Ref<DOMRect> Element::getBoundingClientRect()
index 941469b..c3b731d 100644 (file)
@@ -40,6 +40,7 @@ namespace WebCore {
 class CustomElementReactionQueue;
 class DatasetDOMStringMap;
 class DOMRect;
+class DOMRectList;
 class DOMTokenList;
 class ElementRareData;
 class HTMLDocument;
@@ -172,7 +173,7 @@ public:
 
     WEBCORE_EXPORT IntRect boundsInRootViewSpace();
 
-    Vector<Ref<DOMRect>> getClientRects();
+    Ref<DOMRectList> getClientRects();
     Ref<DOMRect> getBoundingClientRect();
 
     // Returns the absolute bounding box translated into client coordinates.
index 79eabb6..4a23ffb 100644 (file)
@@ -68,7 +68,7 @@
     [MayThrowException] void insertAdjacentText(DOMString where, DOMString data); // Historical.
 
     // CSSOM-view extensions (https://drafts.csswg.org/cssom-view/#extension-to-the-element-interface).
-    sequence<DOMRect> getClientRects();
+    DOMRectList getClientRects();
     [NewObject] DOMRect getBoundingClientRect();
     void scrollIntoView(optional boolean alignWithTop = true); // FIXME: Parameter type should be (boolean or object).
     [ImplementedAs=scrollTo] void scroll(optional ScrollToOptions options);
index 82f589e..8e95565 100644 (file)
@@ -27,6 +27,7 @@
 
 #include "Comment.h"
 #include "DOMRect.h"
+#include "DOMRectList.h"
 #include "DocumentFragment.h"
 #include "Editing.h"
 #include "Event.h"
@@ -1762,9 +1763,9 @@ ExceptionOr<void> Range::expand(const String& unit)
     return setEnd(*endContainer, end.deepEquivalent().computeOffsetInContainerNode());
 }
 
-Vector<Ref<DOMRect>> Range::getClientRects() const
+Ref<DOMRectList> Range::getClientRects() const
 {
-    return createDOMRectVector(borderAndTextQuads(CoordinateSpace::Client));
+    return DOMRectList::create(borderAndTextQuads(CoordinateSpace::Client));
 }
 
 Ref<DOMRect> Range::getBoundingClientRect() const
index ea7c945..3c54f94 100644 (file)
@@ -34,8 +34,9 @@
 
 namespace WebCore {
 
-class DOMRect;
 class ContainerNode;
+class DOMRect;
+class DOMRectList;
 class Document;
 class DocumentFragment;
 class FloatQuad;
@@ -141,7 +142,7 @@ public:
     // for details.
     WEBCORE_EXPORT ExceptionOr<void> expand(const String&);
 
-    Vector<Ref<DOMRect>> getClientRects() const;
+    Ref<DOMRectList> getClientRects() const;
     Ref<DOMRect> getBoundingClientRect() const;
 
 #if ENABLE(TREE_DEBUGGING)
index 4c4db4e..88fc805 100644 (file)
@@ -64,7 +64,7 @@
     DOMString toString(); // FIXME: Should be stringifier once we support it.
 
     // Extensions from CSSOM-view (https://drafts.csswg.org/cssom-view/#extensions-to-the-range-interface).
-    sequence<DOMRect> getClientRects();
+    DOMRectList getClientRects();
     [NewObject] DOMRect getBoundingClientRect();
 
     // Extensions from DOMParsing and Serialization specification (https://w3c.github.io/DOM-Parsing/#extensions-to-the-range-interface).
index adc9e17..0f785ed 100644 (file)
@@ -32,6 +32,7 @@
 #include "ContextMenuClient.h"
 #include "ContextMenuController.h"
 #include "DOMRect.h"
+#include "DOMRectList.h"
 #include "DatabaseProvider.h"
 #include "DiagnosticLoggingClient.h"
 #include "DiagnosticLoggingKeys.h"
@@ -405,7 +406,7 @@ String Page::synchronousScrollingReasonsAsText()
     return String();
 }
 
-Vector<Ref<DOMRect>> Page::nonFastScrollableRects()
+Ref<DOMRectList> Page::nonFastScrollableRects()
 {
     if (Document* document = m_mainFrame->document())
         document->updateLayout();
@@ -421,10 +422,10 @@ Vector<Ref<DOMRect>> Page::nonFastScrollableRects()
     for (size_t i = 0; i < rects.size(); ++i)
         quads[i] = FloatRect(rects[i]);
 
-    return createDOMRectVector(quads);
+    return DOMRectList::create(quads);
 }
 
-Vector<Ref<DOMRect>> Page::touchEventRectsForEvent(const String& eventName)
+Ref<DOMRectList> Page::touchEventRectsForEvent(const String& eventName)
 {
     if (Document* document = m_mainFrame->document()) {
         document->updateLayout();
@@ -444,10 +445,10 @@ Vector<Ref<DOMRect>> Page::touchEventRectsForEvent(const String& eventName)
     for (size_t i = 0; i < rects.size(); ++i)
         quads[i] = FloatRect(rects[i]);
 
-    return createDOMRectVector(quads);
+    return DOMRectList::create(quads);
 }
 
-Vector<Ref<DOMRect>> Page::passiveTouchEventListenerRects()
+Ref<DOMRectList> Page::passiveTouchEventListenerRects()
 {
     if (Document* document = m_mainFrame->document()) {
         document->updateLayout();
@@ -464,7 +465,7 @@ Vector<Ref<DOMRect>> Page::passiveTouchEventListenerRects()
     for (size_t i = 0; i < rects.size(); ++i)
         quads[i] = FloatRect(rects[i]);
 
-    return createDOMRectVector(quads);
+    return DOMRectList::create(quads);
 }
 
 #if ENABLE(VIEW_MODE_CSS_MEDIA)
index 7bef50c..b22a429 100644 (file)
@@ -85,6 +85,7 @@ class Color;
 class ContextMenuClient;
 class ContextMenuController;
 class DOMRect;
+class DOMRectList;
 class DatabaseProvider;
 class DiagnosticLoggingClient;
 class DragCaretController;
@@ -238,10 +239,10 @@ public:
 
     WEBCORE_EXPORT String scrollingStateTreeAsText();
     WEBCORE_EXPORT String synchronousScrollingReasonsAsText();
-    WEBCORE_EXPORT Vector<Ref<DOMRect>> nonFastScrollableRects();
+    WEBCORE_EXPORT Ref<DOMRectList> nonFastScrollableRects();
 
-    WEBCORE_EXPORT Vector<Ref<DOMRect>> touchEventRectsForEvent(const String& eventName);
-    WEBCORE_EXPORT Vector<Ref<DOMRect>> passiveTouchEventListenerRects();
+    WEBCORE_EXPORT Ref<DOMRectList> touchEventRectsForEvent(const String& eventName);
+    WEBCORE_EXPORT Ref<DOMRectList> passiveTouchEventListenerRects();
 
     Settings& settings() const { return *m_settings; }
     ProgressTracker& progress() const { return *m_progress; }
index 101ec0c..3bbbb33 100644 (file)
@@ -44,6 +44,7 @@
 #include "Cursor.h"
 #include "DOMPath.h"
 #include "DOMRect.h"
+#include "DOMRectList.h"
 #include "DOMStringList.h"
 #include "DOMWindow.h"
 #include "DisplayList.h"
@@ -1362,7 +1363,7 @@ Ref<DOMRect> Internals::boundingBox(Element& element)
     return DOMRect::create(renderer->absoluteBoundingBoxRectIgnoringTransforms());
 }
 
-ExceptionOr<Vector<Ref<DOMRect>>> Internals::inspectorHighlightRects()
+ExceptionOr<Ref<DOMRectList>> Internals::inspectorHighlightRects()
 {
     Document* document = contextDocument();
     if (!document || !document->page())
@@ -1370,7 +1371,7 @@ ExceptionOr<Vector<Ref<DOMRect>>> Internals::inspectorHighlightRects()
 
     Highlight highlight;
     document->page()->inspectorController().getHighlight(highlight, InspectorOverlay::CoordinateSystem::View);
-    return createDOMRectVector(highlight.quads);
+    return DOMRectList::create(highlight.quads);
 }
 
 ExceptionOr<String> Internals::inspectorHighlightObject()
@@ -1806,7 +1807,7 @@ ExceptionOr<unsigned> Internals::touchEventHandlerCount()
     return document->touchEventHandlerCount();
 }
 
-ExceptionOr<Vector<Ref<DOMRect>>> Internals::touchEventRectsForEvent(const String& eventName)
+ExceptionOr<Ref<DOMRectList>> Internals::touchEventRectsForEvent(const String& eventName)
 {
     Document* document = contextDocument();
     if (!document || !document->page())
@@ -1815,7 +1816,7 @@ ExceptionOr<Vector<Ref<DOMRect>>> Internals::touchEventRectsForEvent(const Strin
     return document->page()->touchEventRectsForEvent(eventName);
 }
 
-ExceptionOr<Vector<Ref<DOMRect>>> Internals::passiveTouchEventListenerRects()
+ExceptionOr<Ref<DOMRectList>> Internals::passiveTouchEventListenerRects()
 {
     Document* document = contextDocument();
     if (!document || !document->page())
@@ -2337,7 +2338,7 @@ ExceptionOr<String> Internals::mainThreadScrollingReasons() const
     return page->synchronousScrollingReasonsAsText();
 }
 
-ExceptionOr<Vector<Ref<DOMRect>>> Internals::nonFastScrollableRects() const
+ExceptionOr<Ref<DOMRectList>> Internals::nonFastScrollableRects() const
 {
     Document* document = contextDocument();
     if (!document || !document->frame())
@@ -2345,7 +2346,7 @@ ExceptionOr<Vector<Ref<DOMRect>>> Internals::nonFastScrollableRects() const
 
     Page* page = document->page();
     if (!page)
-        return Vector<Ref<DOMRect>> { };
+        return DOMRectList::create();
 
     return page->nonFastScrollableRects();
 }
index 1160d3e..d1b4f34 100644 (file)
@@ -44,6 +44,7 @@ namespace WebCore {
 
 class AudioContext;
 class DOMRect;
+class DOMRectList;
 class DOMURL;
 class DOMWindow;
 class Document;
@@ -184,7 +185,7 @@ public:
 
     Ref<DOMRect> boundingBox(Element&);
 
-    ExceptionOr<Vector<Ref<DOMRect>>> inspectorHighlightRects();
+    ExceptionOr<Ref<DOMRectList>> inspectorHighlightRects();
     ExceptionOr<String> inspectorHighlightObject();
 
     ExceptionOr<unsigned> markerCountForNode(Node&, const String&);
@@ -244,8 +245,8 @@ public:
     ExceptionOr<unsigned> wheelEventHandlerCount();
     ExceptionOr<unsigned> touchEventHandlerCount();
 
-    ExceptionOr<Vector<Ref<DOMRect>>> touchEventRectsForEvent(const String&);
-    ExceptionOr<Vector<Ref<DOMRect>>> passiveTouchEventListenerRects();
+    ExceptionOr<Ref<DOMRectList>> touchEventRectsForEvent(const String&);
+    ExceptionOr<Ref<DOMRectList>> passiveTouchEventListenerRects();
 
     ExceptionOr<RefPtr<NodeList>> nodesFromRect(Document&, int x, int y, unsigned topPadding, unsigned rightPadding, unsigned bottomPadding, unsigned leftPadding, bool ignoreClipping, bool allowShadowContent, bool allowChildFrameContent) const;
 
@@ -299,7 +300,7 @@ public:
     ExceptionOr<String> repaintRectsAsText() const;
     ExceptionOr<String> scrollingStateTreeAsText() const;
     ExceptionOr<String> mainThreadScrollingReasons() const;
-    ExceptionOr<Vector<Ref<DOMRect>>> nonFastScrollableRects() const;
+    ExceptionOr<Ref<DOMRectList>> nonFastScrollableRects() const;
 
     ExceptionOr<void> setElementUsesDisplayListDrawing(Element&, bool usesDisplayListDrawing);
     ExceptionOr<void> setElementTracksDisplayListReplay(Element&, bool isTrackingReplay);
index 5aa4ab3..99eeb1e 100644 (file)
@@ -153,7 +153,7 @@ enum EventThrottlingBehavior {
 
     DOMRect boundingBox(Element element);
 
-    [MayThrowException] sequence<DOMRect> inspectorHighlightRects();
+    [MayThrowException] DOMRectList inspectorHighlightRects();
     [MayThrowException] DOMString inspectorHighlightObject();
 
     [MayThrowException] unsigned long markerCountForNode(Node node, DOMString markerType);
@@ -216,8 +216,8 @@ enum EventThrottlingBehavior {
     [MayThrowException] unsigned long wheelEventHandlerCount();
     [MayThrowException] unsigned long touchEventHandlerCount();
 
-    [MayThrowException] sequence<DOMRect> touchEventRectsForEvent(DOMString eventName);
-    [MayThrowException] sequence<DOMRect> passiveTouchEventListenerRects();
+    [MayThrowException] DOMRectList touchEventRectsForEvent(DOMString eventName);
+    [MayThrowException] DOMRectList passiveTouchEventListenerRects();
 
     [MayThrowException] NodeList? nodesFromRect(Document document, long x, long y,
         unsigned long topPadding, unsigned long rightPadding, unsigned long bottomPadding, unsigned long leftPadding,
@@ -274,7 +274,7 @@ enum EventThrottlingBehavior {
 
     [MayThrowException] DOMString scrollingStateTreeAsText();
     [MayThrowException] DOMString mainThreadScrollingReasons(); // FIXME: rename to synchronousScrollingReasons().
-    [MayThrowException] sequence<DOMRect> nonFastScrollableRects();
+    [MayThrowException] DOMRectList nonFastScrollableRects();
 
     [MayThrowException] DOMString repaintRectsAsText();
 
index c35a0a2..fca969d 100644 (file)
@@ -1,3 +1,24 @@
+2017-05-30  Chris Dumez  <cdumez@apple.com>
+
+        REGRESSION(r215946): Can't reference a table cell in Google spreadsheet
+        https://bugs.webkit.org/show_bug.cgi?id=172703
+        <rdar://problem/32458086>
+
+        Reviewed by Ryosuke Niwa.
+
+        Fix GObject bindings accordingly.
+
+        * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMClientRectList.cpp:
+        (WebKit::kit):
+        (WebKit::core):
+        (WebKit::wrapDOMRectList):
+        (webkit_dom_client_rect_list_constructed):
+        (webkit_dom_client_rect_list_item):
+        (webkit_dom_client_rect_list_get_length):
+        * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMClientRectListPrivate.h:
+        * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMElement.cpp:
+        (webkit_dom_element_get_client_rects):
+
 2017-05-30  Daniel Bates  <dabates@apple.com>
 
         [WK2] Add runBeforeUnloadConfirmPanel WKUIDelegate SPI; support onbeforeunload confirm panel in MiniBrowser
index 7352681..33709fd 100644 (file)
 
 #define WEBKIT_DOM_CLIENT_RECT_LIST_GET_PRIVATE(obj) G_TYPE_INSTANCE_GET_PRIVATE(obj, WEBKIT_DOM_TYPE_CLIENT_RECT_LIST, WebKitDOMClientRectListPrivate)
 
-class ClientRectList : public RefCounted<ClientRectList> {
-public:
-    static Ref<ClientRectList> create(WTF::Vector<Ref<WebCore::DOMRect>>&& items)
-    {
-        return adoptRef(*new ClientRectList(WTFMove(items)));
-    }
-
-    const WTF::Vector<Ref<WebCore::DOMRect>>& items() const { return m_items; }
-
-private:
-    ClientRectList(WTF::Vector<Ref<WebCore::DOMRect>>&& items)
-        : m_items(WTFMove(items))
-    { }
-
-    WTF::Vector<Ref<WebCore::DOMRect>> m_items;
-};
-
 typedef struct _WebKitDOMClientRectListPrivate {
-    RefPtr<ClientRectList> coreObject;
+    RefPtr<WebCore::DOMRectList> coreObject;
 } WebKitDOMClientRectListPrivate;
 
 namespace WebKit {
 
-WebKitDOMClientRectList* kit(WTF::Vector<Ref<WebCore::DOMRect>>&& obj)
+WebKitDOMClientRectList* kit(WebCore::DOMRectList* obj)
 {
-    return wrapClientRectList(WTFMove(obj));
+    if (!obj)
+        return nullptr;
+
+    if (gpointer ret = DOMObjectCache::get(obj))
+        return WEBKIT_DOM_CLIENT_RECT_LIST(ret);
+
+    return wrapDOMRectList(obj);
 }
 
-static ClientRectList* core(WebKitDOMClientRectList* request)
+WebCore::DOMRectList* core(WebKitDOMClientRectList* request)
 {
-    return request ? static_cast<ClientRectList*>(WEBKIT_DOM_OBJECT(request)->coreObject) : nullptr;
+    return request ? static_cast<WebCore::DOMRectList*>(WEBKIT_DOM_OBJECT(request)->coreObject) : nullptr;
 }
 
-WebKitDOMClientRectList* wrapClientRectList(WTF::Vector<Ref<WebCore::DOMRect>>&& coreObject)
+WebKitDOMClientRectList* wrapDOMRectList(WebCore::DOMRectList* coreObject)
 {
-    auto list = ClientRectList::create(WTFMove(coreObject));
-    return WEBKIT_DOM_CLIENT_RECT_LIST(g_object_new(WEBKIT_DOM_TYPE_CLIENT_RECT_LIST, "core-object", list.ptr(), nullptr));
+    return WEBKIT_DOM_CLIENT_RECT_LIST(g_object_new(WEBKIT_DOM_TYPE_CLIENT_RECT_LIST, "core-object", coreObject, nullptr));
 }
 
 } // namespace WebKit
@@ -112,7 +100,8 @@ static void webkit_dom_client_rect_list_constructed(GObject* object)
     G_OBJECT_CLASS(webkit_dom_client_rect_list_parent_class)->constructed(object);
 
     WebKitDOMClientRectListPrivate* priv = WEBKIT_DOM_CLIENT_RECT_LIST_GET_PRIVATE(object);
-    priv->coreObject = static_cast<ClientRectList*>(WEBKIT_DOM_OBJECT(object)->coreObject);
+    priv->coreObject = static_cast<WebCore::DOMRectList*>(WEBKIT_DOM_OBJECT(object)->coreObject);
+    WebKit::DOMObjectCache::put(priv->coreObject.get(), object);
 }
 
 static void webkit_dom_client_rect_list_class_init(WebKitDOMClientRectListClass* requestClass)
@@ -145,8 +134,8 @@ WebKitDOMClientRect* webkit_dom_client_rect_list_item(WebKitDOMClientRectList* s
 {
     WebCore::JSMainThreadNullState state;
     g_return_val_if_fail(WEBKIT_DOM_IS_CLIENT_RECT_LIST(self), nullptr);
-    auto& list = WebKit::core(self)->items();
-    RefPtr<WebCore::DOMRect> gobjectResult = index >= list.size() ? nullptr : list[index].ptr();
+    auto* list = WebKit::core(self);
+    RefPtr<WebCore::DOMRect> gobjectResult = WTF::getPtr(list->item(index));
     return WebKit::kit(gobjectResult.get());
 }
 
@@ -154,5 +143,5 @@ gulong webkit_dom_client_rect_list_get_length(WebKitDOMClientRectList* self)
 {
     WebCore::JSMainThreadNullState state;
     g_return_val_if_fail(WEBKIT_DOM_IS_CLIENT_RECT_LIST(self), 0);
-    return WebKit::core(self)->items().size();
+    return WebKit::core(self)->length();
 }
index d2122ba..1392d45 100644 (file)
 
 #pragma once
 
-#include <WebCore/DOMRect.h>
+#include <WebCore/DOMRectList.h>
 #include <webkitdom/WebKitDOMClientRectList.h>
-#include <wtf/Vector.h>
 
 namespace WebKit {
-WebKitDOMClientRectList* wrapClientRectList(WTF::Vector<Ref<WebCore::DOMRect>>&&);
-WebKitDOMClientRectList* kit(WTF::Vector<Ref<WebCore::DOMRect>>&&);
+WebKitDOMClientRectList* wrapDOMRectList(WebCore::DOMRectList*);
+WebKitDOMClientRectList* kit(WebCore::DOMRectList*);
+WebCore::DOMRectList* core(WebKitDOMClientRectList*);
 } // namespace WebKit
index b5675a0..15f62d0 100644 (file)
@@ -1239,7 +1239,7 @@ WebKitDOMClientRectList* webkit_dom_element_get_client_rects(WebKitDOMElement* s
     WebCore::JSMainThreadNullState state;
     g_return_val_if_fail(WEBKIT_DOM_IS_ELEMENT(self), nullptr);
     WebCore::Element* item = WebKit::core(self);
-    return WebKit::kit(item->getClientRects());
+    return WebKit::kit(item->getClientRects().ptr());
 }
 
 WebKitDOMElement* webkit_dom_element_get_offset_parent(WebKitDOMElement* self)