Changeset 217576 in webkit


Ignore:
Timestamp:
May 30, 2017 2:19:01 PM (7 years ago)
Author:
Chris Dumez
Message:

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.

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:
Location:
trunk
Files:
25 edited
2 copied
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r217575 r217576  
     12017-05-30  Chris Dumez  <cdumez@apple.com>
     2
     3        REGRESSION(r215946): Can't reference a table cell in Google spreadsheet
     4        https://bugs.webkit.org/show_bug.cgi?id=172703
     5        <rdar://problem/32458086>
     6
     7        Reviewed by Ryosuke Niwa.
     8
     9        Update existing tests to reflect behavior change.
     10
     11        * fast/dom/Element/getClientRects-return-type-expected.txt:
     12        * fast/dom/Element/getClientRects-return-type.html:
     13        * fast/dom/Range/getBoundingClientRect-getClientRects-return-type-expected.txt:
     14        * fast/dom/Range/getBoundingClientRect-getClientRects-return-type.html:
     15
    1162017-05-30  Javier Fernandez  <jfernandez@igalia.com>
    217
  • trunk/LayoutTests/fast/dom/Element/getClientRects-return-type-expected.txt

    r215892 r217576  
    1 Tests that Element.getClientRects() returns an array of DOMRect objects.
     1Tests that Element.getClientRects() returns a list of DOMRect objects.
    22
    33On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
    44
    55
    6 PASS rects.__proto__ is Array.prototype
    76PASS rects.length is 1
    87PASS rects[0].__proto__ is DOMRect.prototype
     8PASS rects[0] is rects.item(0)
    99PASS successfullyParsed is true
    1010
  • trunk/LayoutTests/fast/dom/Element/getClientRects-return-type.html

    r215892 r217576  
    44<script src="../../../resources/js-test-pre.js"></script>
    55<script>
    6 description("Tests that Element.getClientRects() returns an array of DOMRect objects.");
     6description("Tests that Element.getClientRects() returns a list of DOMRect objects.");
    77
    88const rects = document.body.getClientRects();
    9 shouldBe("rects.__proto__", "Array.prototype");
    109shouldBe("rects.length", "1");
    1110shouldBe("rects[0].__proto__", "DOMRect.prototype");
     11shouldBe("rects[0]", "rects.item(0)");
    1212</script>
    1313<script src="../../../resources/js-test-post.js"></script>>
  • trunk/LayoutTests/fast/dom/Range/getBoundingClientRect-getClientRects-return-type-expected.txt

    r215946 r217576  
    55
    66PASS rect.__proto__ is DOMRect.prototype
    7 PASS rects.__proto__ is Array.prototype
    87PASS rects.length > 0 is true
     8PASS rects[0] is rects.item(0)
    99PASS rects[0].__proto__ is DOMRect.prototype
    1010PASS successfullyParsed is true
  • trunk/LayoutTests/fast/dom/Range/getBoundingClientRect-getClientRects-return-type.html

    r215946 r217576  
    1515
    1616    rects = range.getClientRects();
    17     shouldBe("rects.__proto__", "Array.prototype");
    1817    shouldBeTrue("rects.length > 0");
     18    shouldBe("rects[0]", "rects.item(0)");
    1919    shouldBe("rects[0].__proto__", "DOMRect.prototype");
    2020
  • trunk/Source/WebCore/CMakeLists.txt

    r217573 r217576  
    427427    dom/DOMRect.idl
    428428    dom/DOMRectInit.idl
     429    dom/DOMRectList.idl
    429430    dom/DOMRectReadOnly.idl
    430431    dom/DOMStringList.idl
     
    14581459    dom/DOMImplementation.cpp
    14591460    dom/DOMNamedFlowCollection.cpp
    1460     dom/DOMRect.cpp
     1461    dom/DOMRectList.cpp
    14611462    dom/DOMStringList.cpp
    14621463    dom/DataTransfer.cpp
  • trunk/Source/WebCore/ChangeLog

    r217573 r217576  
     12017-05-30  Chris Dumez  <cdumez@apple.com>
     2
     3        REGRESSION(r215946): Can't reference a table cell in Google spreadsheet
     4        https://bugs.webkit.org/show_bug.cgi?id=172703
     5        <rdar://problem/32458086>
     6
     7        Reviewed by Ryosuke Niwa.
     8
     9        We updated getClientRects() to return an array of DOMRect objects instead of
     10        a ClientRectList type, to match the latest specification. As it turns out, this
     11        is not Web-compatible as some content (as Google Spreadsheet) relies on the
     12        return type having an item() operation.
     13
     14        This patch re-introduces a DOMRectList type, with an item() operation. The
     15        DOMRectList name is currently not exposed to the Web as we do not know what's
     16        going to get specified yet (https://github.com/w3c/csswg-drafts/issues/1479).
     17
     18        No new tests, updated existing tests.
     19
     20        * CMakeLists.txt:
     21        * DerivedSources.make:
     22        * WebCore.xcodeproj/project.pbxproj:
     23        * dom/DOMRect.h:
     24        * dom/DOMRectList.cpp: Copied from Source/WebCore/dom/DOMRect.cpp.
     25        (WebCore::DOMRectList::DOMRectList):
     26        (WebCore::DOMRectList::~DOMRectList):
     27        * dom/DOMRectList.h: Copied from Source/WebCore/dom/DOMRect.cpp.
     28        (WebCore::DOMRectList::create):
     29        (WebCore::DOMRectList::length):
     30        (WebCore::DOMRectList::item):
     31        * dom/DOMRectList.idl: Renamed from Source/WebCore/dom/DOMRect.cpp.
     32        * dom/Element.cpp:
     33        (WebCore::Element::getClientRects):
     34        * dom/Element.h:
     35        * dom/Element.idl:
     36        * dom/Range.cpp:
     37        (WebCore::Range::getClientRects):
     38        * dom/Range.h:
     39        * dom/Range.idl:
     40        * page/Page.cpp:
     41        (WebCore::Page::nonFastScrollableRects):
     42        (WebCore::Page::touchEventRectsForEvent):
     43        (WebCore::Page::passiveTouchEventListenerRects):
     44        * page/Page.h:
     45        * testing/Internals.cpp:
     46        (WebCore::Internals::inspectorHighlightRects):
     47        (WebCore::Internals::touchEventRectsForEvent):
     48        (WebCore::Internals::passiveTouchEventListenerRects):
     49        (WebCore::Internals::nonFastScrollableRects):
     50        * testing/Internals.h:
     51        * testing/Internals.idl:
     52
    1532017-05-30  Ali Juma  <ajuma@chromium.org>
    254
  • trunk/Source/WebCore/DerivedSources.make

    r217573 r217576  
    367367    $(WebCore)/dom/DOMRect.idl \
    368368    $(WebCore)/dom/DOMRectInit.idl \
     369    $(WebCore)/dom/DOMRectList.idl \
    369370    $(WebCore)/dom/DOMRectReadOnly.idl \
    370371    $(WebCore)/dom/DOMStringList.idl \
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r217573 r217576  
    19371937                465307D11DB6EE4A00E4137C /* JSUIEventInit.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83E045EE1DAA104F00B0D8B9 /* JSUIEventInit.cpp */; };
    19381938                465A8E791C8A24CE00E7D3E4 /* RuntimeApplicationChecksCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = 465A8E781C8A24CE00E7D3E4 /* RuntimeApplicationChecksCocoa.mm */; };
     1939                466DC6AC1EDE021D00746224 /* JSDOMRectList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 466DC6AB1EDE021D00746224 /* JSDOMRectList.cpp */; };
     1940                466ED8D31EDE0144005E43F6 /* JSDOMRectList.h in Headers */ = {isa = PBXBuildFile; fileRef = 466ED8D21EDE0135005E43F6 /* JSDOMRectList.h */; };
    19391941                4671E0651D67A59600C6B497 /* CanvasPath.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4671E0631D67A57B00C6B497 /* CanvasPath.cpp */; };
    19401942                4671E0661D67A59600C6B497 /* CanvasPath.h in Headers */ = {isa = PBXBuildFile; fileRef = 4671E0641D67A57B00C6B497 /* CanvasPath.h */; };
    19411943                467302021C4EFE7800BCB357 /* IgnoreOpensDuringUnloadCountIncrementer.h in Headers */ = {isa = PBXBuildFile; fileRef = 467302011C4EFE6600BCB357 /* IgnoreOpensDuringUnloadCountIncrementer.h */; };
     1944                468344DF1EDDFAAA00B7795B /* DOMRectList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 468344DD1EDDFA5F00B7795B /* DOMRectList.cpp */; };
     1945                468344E01EDDFAAA00B7795B /* DOMRectList.h in Headers */ = {isa = PBXBuildFile; fileRef = 468344DE1EDDFA5F00B7795B /* DOMRectList.h */; };
    19421946                4689F1AF1267BAE100E8D380 /* FileMetadata.h in Headers */ = {isa = PBXBuildFile; fileRef = 4689F1AE1267BAE100E8D380 /* FileMetadata.h */; };
    19431947                46B63F6C1C6E8D19002E914B /* JSEventTargetCustom.h in Headers */ = {isa = PBXBuildFile; fileRef = 46B63F6B1C6E8CDF002E914B /* JSEventTargetCustom.h */; settings = {ATTRIBUTES = (Private, ); }; };
     
    33543358                83120C701C56F3F6001CB112 /* HTMLDataElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 831D1F291C56ECA000F5F6C0 /* HTMLDataElement.cpp */; };
    33553359                83120C711C56F3FB001CB112 /* HTMLDataElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 834B86A71C56E83A00F3F0E3 /* HTMLDataElement.h */; };
    3356                 83149FF61EB38B3700089665 /* DOMRect.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83149FF51EB38B1200089665 /* DOMRect.cpp */; };
    33573360                832B843419D8E55100B26055 /* SVGAnimateElementBase.h in Headers */ = {isa = PBXBuildFile; fileRef = 832B843319D8E55100B26055 /* SVGAnimateElementBase.h */; };
    33583361                832B843619D8E57400B26055 /* SVGAnimateElementBase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 832B843519D8E57400B26055 /* SVGAnimateElementBase.cpp */; };
     
    96559658                463EB6211B8789CB0096ED51 /* TagCollection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TagCollection.h; sourceTree = "<group>"; };
    96569659                465A8E781C8A24CE00E7D3E4 /* RuntimeApplicationChecksCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RuntimeApplicationChecksCocoa.mm; sourceTree = "<group>"; };
     9660                466DC6AB1EDE021D00746224 /* JSDOMRectList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDOMRectList.cpp; sourceTree = "<group>"; };
     9661                466ED8D21EDE0135005E43F6 /* JSDOMRectList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSDOMRectList.h; sourceTree = "<group>"; };
    96579662                4671E0631D67A57B00C6B497 /* CanvasPath.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CanvasPath.cpp; sourceTree = "<group>"; };
    96589663                4671E0641D67A57B00C6B497 /* CanvasPath.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CanvasPath.h; sourceTree = "<group>"; };
    96599664                467302011C4EFE6600BCB357 /* IgnoreOpensDuringUnloadCountIncrementer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IgnoreOpensDuringUnloadCountIncrementer.h; sourceTree = "<group>"; };
     9665                468344DC1EDDFA5F00B7795B /* DOMRectList.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = DOMRectList.idl; sourceTree = "<group>"; };
     9666                468344DD1EDDFA5F00B7795B /* DOMRectList.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = DOMRectList.cpp; sourceTree = "<group>"; };
     9667                468344DE1EDDFA5F00B7795B /* DOMRectList.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DOMRectList.h; sourceTree = "<group>"; };
    96609668                4689F1AE1267BAE100E8D380 /* FileMetadata.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileMetadata.h; sourceTree = "<group>"; };
    96619669                46B63F6B1C6E8CDF002E914B /* JSEventTargetCustom.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSEventTargetCustom.h; sourceTree = "<group>"; };
     
    1144111449                830A36BA1DAC5FA7006D7D09 /* JSMouseEventInit.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSMouseEventInit.cpp; sourceTree = "<group>"; };
    1144211450                830A36BB1DAC5FA7006D7D09 /* JSMouseEventInit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSMouseEventInit.h; sourceTree = "<group>"; };
    11443                 83149FF51EB38B1200089665 /* DOMRect.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DOMRect.cpp; sourceTree = "<group>"; };
    1144411451                831D1F291C56ECA000F5F6C0 /* HTMLDataElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLDataElement.cpp; sourceTree = "<group>"; };
    1144511452                8329A4171EC25B2B008ED4BE /* DocumentAndElementEventHandlers.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = DocumentAndElementEventHandlers.idl; sourceTree = "<group>"; };
     
    2206722074                                0F4710B71DB56BE8002DCEC3 /* JSDOMRectInit.cpp */,
    2206822075                                0F4710B81DB56BE8002DCEC3 /* JSDOMRectInit.h */,
     22076                                466DC6AB1EDE021D00746224 /* JSDOMRectList.cpp */,
     22077                                466ED8D21EDE0135005E43F6 /* JSDOMRectList.h */,
    2206922078                                0F4710B91DB56BE8002DCEC3 /* JSDOMRectReadOnly.cpp */,
    2207022079                                0F4710BA1DB56BE8002DCEC3 /* JSDOMRectReadOnly.h */,
     
    2569725706                                0F49669B1DB408C100A274BB /* DOMPointReadOnly.h */,
    2569825707                                0F49669C1DB408C100A274BB /* DOMPointReadOnly.idl */,
    25699                                 83149FF51EB38B1200089665 /* DOMRect.cpp */,
    2570025708                                0F4710A91DB56AFC002DCEC3 /* DOMRect.h */,
    2570125709                                0F4710AA1DB56AFC002DCEC3 /* DOMRect.idl */,
     25710                                468344DD1EDDFA5F00B7795B /* DOMRectList.cpp */,
     25711                                468344DE1EDDFA5F00B7795B /* DOMRectList.h */,
     25712                                468344DC1EDDFA5F00B7795B /* DOMRectList.idl */,
    2570225713                                0F4710AB1DB56AFC002DCEC3 /* DOMRectInit.h */,
    2570325714                                0F4710AC1DB56AFC002DCEC3 /* DOMRectInit.idl */,
     
    2716727178                                C544274B11A57E7A0063A749 /* DOMStringList.h in Headers */,
    2716827179                                BC64640A11D7F304006455B0 /* DOMStringMap.h in Headers */,
     27180                                468344E01EDDFAAA00B7795B /* DOMRectList.h in Headers */,
    2716927181                                188604B40F2E654A000B6443 /* DOMTimer.h in Headers */,
    2717027182                                05FD69E012845D4300B2BEB3 /* DOMTimeStamp.h in Headers */,
     
    2778927801                                BE8EF045171C8FF9009B48C3 /* JSAudioTrackList.h in Headers */,
    2779027802                                76FB9FF919A73E3A00420562 /* JSAutocompleteErrorEvent.h in Headers */,
     27803                                466ED8D31EDE0144005E43F6 /* JSDOMRectList.h in Headers */,
    2779127804                                BC124F000C26447A009E2349 /* JSBarProp.h in Headers */,
    2779227805                                57C7A69F1E57917800C67D71 /* JSBasicCredential.h in Headers */,
     
    3079830811                                D0EDA774143E303C0028E383 /* CachedRawResource.cpp in Sources */,
    3079930812                                BCB16C1F0979C3BD00467741 /* CachedResource.cpp in Sources */,
     30813                                468344DF1EDDFAAA00B7795B /* DOMRectList.cpp in Sources */,
    3080030814                                E47B4BE90E71241600038854 /* CachedResourceHandle.cpp in Sources */,
    3080130815                                BCB16C290979C3BD00467741 /* CachedResourceLoader.cpp in Sources */,
     
    3117931193                                A9C6E4EB0D745E2B006442E9 /* DOMPlugin.cpp in Sources */,
    3118031194                                A9C6E4EF0D745E38006442E9 /* DOMPluginArray.cpp in Sources */,
    31181                                 83149FF61EB38B3700089665 /* DOMRect.cpp in Sources */,
    3118231195                                BC5A86840C33676000EEA649 /* DOMSelection.cpp in Sources */,
    3118331196                                C55610F111A704EB00B82D27 /* DOMStringList.cpp in Sources */,
     
    3388833901                                CD8203111395ACE700F956C6 /* WebWindowAnimation.mm in Sources */,
    3388933902                                F55B3DDF1251F12D003EF269 /* WeekInputType.cpp in Sources */,
     33903                                466DC6AC1EDE021D00746224 /* JSDOMRectList.cpp in Sources */,
    3389033904                                85031B500A44EFC700F992E0 /* WheelEvent.cpp in Sources */,
    3389133905                                2E19516B1B6598D200DF6EEF /* WheelEventDeltaFilter.cpp in Sources */,
  • trunk/Source/WebCore/dom/DOMRect.h

    r215956 r217576  
    5959};
    6060
    61 WEBCORE_EXPORT Vector<Ref<DOMRect>> createDOMRectVector(const Vector<FloatQuad>&);
    62 
    6361}
  • trunk/Source/WebCore/dom/DOMRectList.cpp

    r217575 r217576  
    2525
    2626#include "config.h"
     27#include "DOMRectList.h"
     28
    2729#include "DOMRect.h"
    28 
    29 #include "FloatQuad.h"
    3030
    3131namespace WebCore {
    3232
    33 Vector<Ref<DOMRect>> createDOMRectVector(const Vector<FloatQuad>& quads)
     33DOMRectList::DOMRectList(const Vector<FloatQuad>& quads)
    3434{
    35     Vector<Ref<DOMRect>> result;
    36     result.reserveInitialCapacity(quads.size());
     35    m_items.reserveInitialCapacity(quads.size());
    3736    for (auto& quad : quads)
    38         result.uncheckedAppend(DOMRect::create(quad.boundingBox()));
    39     return result;
     37        m_items.uncheckedAppend(DOMRect::create(quad.boundingBox()));
    4038}
    4139
     40DOMRectList::~DOMRectList()
     41{
    4242}
     43
     44} // namespace WebCore
  • trunk/Source/WebCore/dom/DOMRectList.h

    r217575 r217576  
    2424 */
    2525
    26 #include "config.h"
    27 #include "DOMRect.h"
     26#pragma once
    2827
    2928#include "FloatQuad.h"
     29#include <wtf/RefCounted.h>
     30#include <wtf/Vector.h>
    3031
    3132namespace WebCore {
    3233
    33 Vector<Ref<DOMRect>> createDOMRectVector(const Vector<FloatQuad>& quads)
    34 {
    35     Vector<Ref<DOMRect>> result;
    36     result.reserveInitialCapacity(quads.size());
    37     for (auto& quad : quads)
    38         result.uncheckedAppend(DOMRect::create(quad.boundingBox()));
    39     return result;
    40 }
     34class DOMRect;
     35
     36class DOMRectList : public RefCounted<DOMRectList> {
     37public:
     38    static Ref<DOMRectList> create(const Vector<FloatQuad>& quads) { return adoptRef(*new DOMRectList(quads)); }
     39    static Ref<DOMRectList> create() { return adoptRef(*new DOMRectList()); }
     40    WEBCORE_EXPORT ~DOMRectList();
     41
     42    unsigned length() const { return m_items.size(); }
     43    DOMRect* item(unsigned index) { return index < m_items.size() ? m_items[index].ptr() : nullptr; }
     44
     45private:
     46    WEBCORE_EXPORT explicit DOMRectList(const Vector<FloatQuad>& quads);
     47    DOMRectList() = default;
     48
     49    Vector<Ref<DOMRect>> m_items;
     50};
    4151
    4252}
  • trunk/Source/WebCore/dom/DOMRectList.idl

    r217575 r217576  
    2424 */
    2525
    26 #include "config.h"
    27 #include "DOMRect.h"
    28 
    29 #include "FloatQuad.h"
    30 
    31 namespace WebCore {
    32 
    33 Vector<Ref<DOMRect>> createDOMRectVector(const Vector<FloatQuad>& quads)
    34 {
    35     Vector<Ref<DOMRect>> result;
    36     result.reserveInitialCapacity(quads.size());
    37     for (auto& quad : quads)
    38         result.uncheckedAppend(DOMRect::create(quad.boundingBox()));
    39     return result;
    40 }
    41 
    42 }
     26[
     27     ExportMacro=WEBCORE_EXPORT,
     28     ImplementationLacksVTable,
     29     NoInterfaceObject
     30] interface DOMRectList {
     31    readonly attribute unsigned long length;
     32    getter DOMRect item(unsigned long index);
     33};
  • trunk/Source/WebCore/dom/Element.cpp

    r216803 r217576  
    3939#include "CustomElementRegistry.h"
    4040#include "DOMRect.h"
     41#include "DOMRectList.h"
    4142#include "DOMTokenList.h"
    4243#include "DocumentAnimation.h"
     
    11451146}
    11461147
    1147 Vector<Ref<DOMRect>> Element::getClientRects()
     1148Ref<DOMRectList> Element::getClientRects()
    11481149{
    11491150    document().updateLayoutIgnorePendingStylesheets();
     
    11511152    RenderBoxModelObject* renderBoxModelObject = this->renderBoxModelObject();
    11521153    if (!renderBoxModelObject)
    1153         return { };
     1154        return DOMRectList::create();
    11541155
    11551156    // FIXME: Handle SVG elements.
     
    11591160    renderBoxModelObject->absoluteQuads(quads);
    11601161    document().convertAbsoluteToClientQuads(quads, renderBoxModelObject->style());
    1161     return createDOMRectVector(quads);
     1162    return DOMRectList::create(quads);
    11621163}
    11631164
  • trunk/Source/WebCore/dom/Element.h

    r216426 r217576  
    4141class DatasetDOMStringMap;
    4242class DOMRect;
     43class DOMRectList;
    4344class DOMTokenList;
    4445class ElementRareData;
     
    173174    WEBCORE_EXPORT IntRect boundsInRootViewSpace();
    174175
    175     Vector<Ref<DOMRect>> getClientRects();
     176    Ref<DOMRectList> getClientRects();
    176177    Ref<DOMRect> getBoundingClientRect();
    177178
  • trunk/Source/WebCore/dom/Element.idl

    r217108 r217576  
    6969
    7070    // CSSOM-view extensions (https://drafts.csswg.org/cssom-view/#extension-to-the-element-interface).
    71     sequence<DOMRect> getClientRects();
     71    DOMRectList getClientRects();
    7272    [NewObject] DOMRect getBoundingClientRect();
    7373    void scrollIntoView(optional boolean alignWithTop = true); // FIXME: Parameter type should be (boolean or object).
  • trunk/Source/WebCore/dom/Range.cpp

    r216803 r217576  
    2828#include "Comment.h"
    2929#include "DOMRect.h"
     30#include "DOMRectList.h"
    3031#include "DocumentFragment.h"
    3132#include "Editing.h"
     
    17631764}
    17641765
    1765 Vector<Ref<DOMRect>> Range::getClientRects() const
    1766 {
    1767     return createDOMRectVector(borderAndTextQuads(CoordinateSpace::Client));
     1766Ref<DOMRectList> Range::getClientRects() const
     1767{
     1768    return DOMRectList::create(borderAndTextQuads(CoordinateSpace::Client));
    17681769}
    17691770
  • trunk/Source/WebCore/dom/Range.h

    r215946 r217576  
    3535namespace WebCore {
    3636
     37class ContainerNode;
    3738class DOMRect;
    38 class ContainerNode;
     39class DOMRectList;
    3940class Document;
    4041class DocumentFragment;
     
    142143    WEBCORE_EXPORT ExceptionOr<void> expand(const String&);
    143144
    144     Vector<Ref<DOMRect>> getClientRects() const;
     145    Ref<DOMRectList> getClientRects() const;
    145146    Ref<DOMRect> getBoundingClientRect() const;
    146147
  • trunk/Source/WebCore/dom/Range.idl

    r216339 r217576  
    6565
    6666    // Extensions from CSSOM-view (https://drafts.csswg.org/cssom-view/#extensions-to-the-range-interface).
    67     sequence<DOMRect> getClientRects();
     67    DOMRectList getClientRects();
    6868    [NewObject] DOMRect getBoundingClientRect();
    6969
  • trunk/Source/WebCore/page/Page.cpp

    r217348 r217576  
    3333#include "ContextMenuController.h"
    3434#include "DOMRect.h"
     35#include "DOMRectList.h"
    3536#include "DatabaseProvider.h"
    3637#include "DiagnosticLoggingClient.h"
     
    406407}
    407408
    408 Vector<Ref<DOMRect>> Page::nonFastScrollableRects()
     409Ref<DOMRectList> Page::nonFastScrollableRects()
    409410{
    410411    if (Document* document = m_mainFrame->document())
     
    422423        quads[i] = FloatRect(rects[i]);
    423424
    424     return createDOMRectVector(quads);
    425 }
    426 
    427 Vector<Ref<DOMRect>> Page::touchEventRectsForEvent(const String& eventName)
     425    return DOMRectList::create(quads);
     426}
     427
     428Ref<DOMRectList> Page::touchEventRectsForEvent(const String& eventName)
    428429{
    429430    if (Document* document = m_mainFrame->document()) {
     
    445446        quads[i] = FloatRect(rects[i]);
    446447
    447     return createDOMRectVector(quads);
    448 }
    449 
    450 Vector<Ref<DOMRect>> Page::passiveTouchEventListenerRects()
     448    return DOMRectList::create(quads);
     449}
     450
     451Ref<DOMRectList> Page::passiveTouchEventListenerRects()
    451452{
    452453    if (Document* document = m_mainFrame->document()) {
     
    465466        quads[i] = FloatRect(rects[i]);
    466467
    467     return createDOMRectVector(quads);
     468    return DOMRectList::create(quads);
    468469}
    469470
  • trunk/Source/WebCore/page/Page.h

    r216902 r217576  
    8686class ContextMenuController;
    8787class DOMRect;
     88class DOMRectList;
    8889class DatabaseProvider;
    8990class DiagnosticLoggingClient;
     
    239240    WEBCORE_EXPORT String scrollingStateTreeAsText();
    240241    WEBCORE_EXPORT String synchronousScrollingReasonsAsText();
    241     WEBCORE_EXPORT Vector<Ref<DOMRect>> nonFastScrollableRects();
    242 
    243     WEBCORE_EXPORT Vector<Ref<DOMRect>> touchEventRectsForEvent(const String& eventName);
    244     WEBCORE_EXPORT Vector<Ref<DOMRect>> passiveTouchEventListenerRects();
     242    WEBCORE_EXPORT Ref<DOMRectList> nonFastScrollableRects();
     243
     244    WEBCORE_EXPORT Ref<DOMRectList> touchEventRectsForEvent(const String& eventName);
     245    WEBCORE_EXPORT Ref<DOMRectList> passiveTouchEventListenerRects();
    245246
    246247    Settings& settings() const { return *m_settings; }
  • trunk/Source/WebCore/testing/Internals.cpp

    r217562 r217576  
    4545#include "DOMPath.h"
    4646#include "DOMRect.h"
     47#include "DOMRectList.h"
    4748#include "DOMStringList.h"
    4849#include "DOMWindow.h"
     
    13631364}
    13641365
    1365 ExceptionOr<Vector<Ref<DOMRect>>> Internals::inspectorHighlightRects()
     1366ExceptionOr<Ref<DOMRectList>> Internals::inspectorHighlightRects()
    13661367{
    13671368    Document* document = contextDocument();
     
    13711372    Highlight highlight;
    13721373    document->page()->inspectorController().getHighlight(highlight, InspectorOverlay::CoordinateSystem::View);
    1373     return createDOMRectVector(highlight.quads);
     1374    return DOMRectList::create(highlight.quads);
    13741375}
    13751376
     
    18071808}
    18081809
    1809 ExceptionOr<Vector<Ref<DOMRect>>> Internals::touchEventRectsForEvent(const String& eventName)
     1810ExceptionOr<Ref<DOMRectList>> Internals::touchEventRectsForEvent(const String& eventName)
    18101811{
    18111812    Document* document = contextDocument();
     
    18161817}
    18171818
    1818 ExceptionOr<Vector<Ref<DOMRect>>> Internals::passiveTouchEventListenerRects()
     1819ExceptionOr<Ref<DOMRectList>> Internals::passiveTouchEventListenerRects()
    18191820{
    18201821    Document* document = contextDocument();
     
    23382339}
    23392340
    2340 ExceptionOr<Vector<Ref<DOMRect>>> Internals::nonFastScrollableRects() const
     2341ExceptionOr<Ref<DOMRectList>> Internals::nonFastScrollableRects() const
    23412342{
    23422343    Document* document = contextDocument();
     
    23462347    Page* page = document->page();
    23472348    if (!page)
    2348         return Vector<Ref<DOMRect>> { };
     2349        return DOMRectList::create();
    23492350
    23502351    return page->nonFastScrollableRects();
  • trunk/Source/WebCore/testing/Internals.h

    r217562 r217576  
    4545class AudioContext;
    4646class DOMRect;
     47class DOMRectList;
    4748class DOMURL;
    4849class DOMWindow;
     
    185186    Ref<DOMRect> boundingBox(Element&);
    186187
    187     ExceptionOr<Vector<Ref<DOMRect>>> inspectorHighlightRects();
     188    ExceptionOr<Ref<DOMRectList>> inspectorHighlightRects();
    188189    ExceptionOr<String> inspectorHighlightObject();
    189190
     
    245246    ExceptionOr<unsigned> touchEventHandlerCount();
    246247
    247     ExceptionOr<Vector<Ref<DOMRect>>> touchEventRectsForEvent(const String&);
    248     ExceptionOr<Vector<Ref<DOMRect>>> passiveTouchEventListenerRects();
     248    ExceptionOr<Ref<DOMRectList>> touchEventRectsForEvent(const String&);
     249    ExceptionOr<Ref<DOMRectList>> passiveTouchEventListenerRects();
    249250
    250251    ExceptionOr<RefPtr<NodeList>> nodesFromRect(Document&, int x, int y, unsigned topPadding, unsigned rightPadding, unsigned bottomPadding, unsigned leftPadding, bool ignoreClipping, bool allowShadowContent, bool allowChildFrameContent) const;
     
    300301    ExceptionOr<String> scrollingStateTreeAsText() const;
    301302    ExceptionOr<String> mainThreadScrollingReasons() const;
    302     ExceptionOr<Vector<Ref<DOMRect>>> nonFastScrollableRects() const;
     303    ExceptionOr<Ref<DOMRectList>> nonFastScrollableRects() const;
    303304
    304305    ExceptionOr<void> setElementUsesDisplayListDrawing(Element&, bool usesDisplayListDrawing);
  • trunk/Source/WebCore/testing/Internals.idl

    r217562 r217576  
    154154    DOMRect boundingBox(Element element);
    155155
    156     [MayThrowException] sequence<DOMRect> inspectorHighlightRects();
     156    [MayThrowException] DOMRectList inspectorHighlightRects();
    157157    [MayThrowException] DOMString inspectorHighlightObject();
    158158
     
    217217    [MayThrowException] unsigned long touchEventHandlerCount();
    218218
    219     [MayThrowException] sequence<DOMRect> touchEventRectsForEvent(DOMString eventName);
    220     [MayThrowException] sequence<DOMRect> passiveTouchEventListenerRects();
     219    [MayThrowException] DOMRectList touchEventRectsForEvent(DOMString eventName);
     220    [MayThrowException] DOMRectList passiveTouchEventListenerRects();
    221221
    222222    [MayThrowException] NodeList? nodesFromRect(Document document, long x, long y,
     
    275275    [MayThrowException] DOMString scrollingStateTreeAsText();
    276276    [MayThrowException] DOMString mainThreadScrollingReasons(); // FIXME: rename to synchronousScrollingReasons().
    277     [MayThrowException] sequence<DOMRect> nonFastScrollableRects();
     277    [MayThrowException] DOMRectList nonFastScrollableRects();
    278278
    279279    [MayThrowException] DOMString repaintRectsAsText();
  • trunk/Source/WebKit2/ChangeLog

    r217571 r217576  
     12017-05-30  Chris Dumez  <cdumez@apple.com>
     2
     3        REGRESSION(r215946): Can't reference a table cell in Google spreadsheet
     4        https://bugs.webkit.org/show_bug.cgi?id=172703
     5        <rdar://problem/32458086>
     6
     7        Reviewed by Ryosuke Niwa.
     8
     9        Fix GObject bindings accordingly.
     10
     11        * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMClientRectList.cpp:
     12        (WebKit::kit):
     13        (WebKit::core):
     14        (WebKit::wrapDOMRectList):
     15        (webkit_dom_client_rect_list_constructed):
     16        (webkit_dom_client_rect_list_item):
     17        (webkit_dom_client_rect_list_get_length):
     18        * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMClientRectListPrivate.h:
     19        * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMElement.cpp:
     20        (webkit_dom_element_get_client_rects):
     21
    1222017-05-30  Daniel Bates  <dabates@apple.com>
    223
  • trunk/Source/WebKit2/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMClientRectList.cpp

    r216005 r217576  
    3636#define WEBKIT_DOM_CLIENT_RECT_LIST_GET_PRIVATE(obj) G_TYPE_INSTANCE_GET_PRIVATE(obj, WEBKIT_DOM_TYPE_CLIENT_RECT_LIST, WebKitDOMClientRectListPrivate)
    3737
    38 class ClientRectList : public RefCounted<ClientRectList> {
    39 public:
    40     static Ref<ClientRectList> create(WTF::Vector<Ref<WebCore::DOMRect>>&& items)
    41     {
    42         return adoptRef(*new ClientRectList(WTFMove(items)));
    43     }
    44 
    45     const WTF::Vector<Ref<WebCore::DOMRect>>& items() const { return m_items; }
    46 
    47 private:
    48     ClientRectList(WTF::Vector<Ref<WebCore::DOMRect>>&& items)
    49         : m_items(WTFMove(items))
    50     { }
    51 
    52     WTF::Vector<Ref<WebCore::DOMRect>> m_items;
    53 };
    54 
    5538typedef struct _WebKitDOMClientRectListPrivate {
    56     RefPtr<ClientRectList> coreObject;
     39    RefPtr<WebCore::DOMRectList> coreObject;
    5740} WebKitDOMClientRectListPrivate;
    5841
    5942namespace WebKit {
    6043
    61 WebKitDOMClientRectList* kit(WTF::Vector<Ref<WebCore::DOMRect>>&& obj)
     44WebKitDOMClientRectList* kit(WebCore::DOMRectList* obj)
    6245{
    63     return wrapClientRectList(WTFMove(obj));
     46    if (!obj)
     47        return nullptr;
     48
     49    if (gpointer ret = DOMObjectCache::get(obj))
     50        return WEBKIT_DOM_CLIENT_RECT_LIST(ret);
     51
     52    return wrapDOMRectList(obj);
    6453}
    6554
    66 static ClientRectList* core(WebKitDOMClientRectList* request)
     55WebCore::DOMRectList* core(WebKitDOMClientRectList* request)
    6756{
    68     return request ? static_cast<ClientRectList*>(WEBKIT_DOM_OBJECT(request)->coreObject) : nullptr;
     57    return request ? static_cast<WebCore::DOMRectList*>(WEBKIT_DOM_OBJECT(request)->coreObject) : nullptr;
    6958}
    7059
    71 WebKitDOMClientRectList* wrapClientRectList(WTF::Vector<Ref<WebCore::DOMRect>>&& coreObject)
     60WebKitDOMClientRectList* wrapDOMRectList(WebCore::DOMRectList* coreObject)
    7261{
    73     auto list = ClientRectList::create(WTFMove(coreObject));
    74     return WEBKIT_DOM_CLIENT_RECT_LIST(g_object_new(WEBKIT_DOM_TYPE_CLIENT_RECT_LIST, "core-object", list.ptr(), nullptr));
     62    return WEBKIT_DOM_CLIENT_RECT_LIST(g_object_new(WEBKIT_DOM_TYPE_CLIENT_RECT_LIST, "core-object", coreObject, nullptr));
    7563}
    7664
     
    113101
    114102    WebKitDOMClientRectListPrivate* priv = WEBKIT_DOM_CLIENT_RECT_LIST_GET_PRIVATE(object);
    115     priv->coreObject = static_cast<ClientRectList*>(WEBKIT_DOM_OBJECT(object)->coreObject);
     103    priv->coreObject = static_cast<WebCore::DOMRectList*>(WEBKIT_DOM_OBJECT(object)->coreObject);
     104    WebKit::DOMObjectCache::put(priv->coreObject.get(), object);
    116105}
    117106
     
    146135    WebCore::JSMainThreadNullState state;
    147136    g_return_val_if_fail(WEBKIT_DOM_IS_CLIENT_RECT_LIST(self), nullptr);
    148     auto& list = WebKit::core(self)->items();
    149     RefPtr<WebCore::DOMRect> gobjectResult = index >= list.size() ? nullptr : list[index].ptr();
     137    auto* list = WebKit::core(self);
     138    RefPtr<WebCore::DOMRect> gobjectResult = WTF::getPtr(list->item(index));
    150139    return WebKit::kit(gobjectResult.get());
    151140}
     
    155144    WebCore::JSMainThreadNullState state;
    156145    g_return_val_if_fail(WEBKIT_DOM_IS_CLIENT_RECT_LIST(self), 0);
    157     return WebKit::core(self)->items().size();
     146    return WebKit::core(self)->length();
    158147}
  • trunk/Source/WebKit2/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMClientRectListPrivate.h

    r216002 r217576  
    2020#pragma once
    2121
    22 #include <WebCore/DOMRect.h>
     22#include <WebCore/DOMRectList.h>
    2323#include <webkitdom/WebKitDOMClientRectList.h>
    24 #include <wtf/Vector.h>
    2524
    2625namespace WebKit {
    27 WebKitDOMClientRectList* wrapClientRectList(WTF::Vector<Ref<WebCore::DOMRect>>&&);
    28 WebKitDOMClientRectList* kit(WTF::Vector<Ref<WebCore::DOMRect>>&&);
     26WebKitDOMClientRectList* wrapDOMRectList(WebCore::DOMRectList*);
     27WebKitDOMClientRectList* kit(WebCore::DOMRectList*);
     28WebCore::DOMRectList* core(WebKitDOMClientRectList*);
    2929} // namespace WebKit
  • trunk/Source/WebKit2/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMElement.cpp

    r216426 r217576  
    12401240    g_return_val_if_fail(WEBKIT_DOM_IS_ELEMENT(self), nullptr);
    12411241    WebCore::Element* item = WebKit::core(self);
    1242     return WebKit::kit(item->getClientRects());
     1242    return WebKit::kit(item->getClientRects().ptr());
    12431243}
    12441244
Note: See TracChangeset for help on using the changeset viewer.