Skip to content
Permalink
Browse files
Add AbstractRange
https://bugs.webkit.org/show_bug.cgi?id=217846

Reviewed by Ryosuke Niwa.

LayoutTests/imported/w3c:

* web-platform-tests/dom/idlharness.window-expected.txt:
Updated test result for progression.

Source/WebCore:

This makes us more accurately match the DOM specification, makes Range
and StaticRange objects slightly bigger since they now have a virtual
table pointer, and makes the AbstractRange methods a bit slower to call
from JavaScript since they are backed by C++ virtual functions.

* CMakeLists.txt: Added AbstractRange files.
* DerivedSources-input.xcfilelist: Ditto.
* DerivedSources-output.xcfilelist: Ditto.
* DerivedSources.make: Ditto.
* Headers.cmake: Ditto.
* Sources.txt: Ditto.
* WebCore.xcodeproj/project.pbxproj: Ditto.
Also removed reference to non-existent JSAudioNodeCustom.cpp and moved
JSStaticRange file from the Events group into the Ranges group.

* bindings/js/JSAbstractRangeCustom.cpp: Added.
(WebCore::toJS): Added. Just the default implementation. Would be
nice if we did not have to write this.
(WebCore::toJSNewlyCreated): Make either a StaticRange or Range
wrapper depending on whether this is a live range or not.

* bindings/js/JSEventCustom.cpp: Removed lots of unneeded includes.
(WebCore::toJS): Stopped using "using namespace JSC".

* bindings/js/WebCoreBuiltinNames.h: Added AbstractRange.

* dom/AbstractRange.cpp: Added.
(WebCore::makeSimpleRange): Added.
* dom/AbstractRange.h: Added.
* dom/AbstractRange.idl: Added.

* dom/Range.h: Changed to derive from AbstractRange instead of
from RefCounted. Also marked this final since it's now polymorphic.
Marked all the functions that override final as well, to check that
they correctly override the virtual functions in the base class.
Added private isLiveRange function override that returns true.
Added SPECIALIZE_TYPE_TRAITS_BEGIN/END so we can do is<Range>.

* dom/Range.idl: Removed ImplementationLacksVTable. Added
JSGenerateToNativeObject. Inherit from AbstractRange.
Removed the 5 attribute getters that are now inherited from AbstractRange.

* dom/StaticRange.h: Changed to derive from AbstractRange instead of
from RefCounted. Also marked this final since it's now polymorphic.
Added functions to override the ones from StaticRange, calling through
to the ones from SimpleRange (I thought there was a way to do this
with using, but I couldn't figure that out). Added private isLiveRange
function override that returns false. Added SPECIALIZE_TYPE_TRAITS_BEGIN/END
so we can do is<StaticRange>.

* dom/StaticRange.idl: Removed EnabledBySetting=InputEvents since
this should now always be included. I think we should probably remove the
InputEvents setting now entirely. Removed ImplementationLacksVTable.
Added JSGenerateToNativeObject. Inherit from AbstractRange.
Removed all 5 attribute getters, which are now inherited from AbstractRange.

Canonical link: https://commits.webkit.org/230606@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268648 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
darinadler committed Oct 17, 2020
1 parent 51957a0 commit 51af31d7045e010434a0387dae1cf17477a40a31
Showing 23 changed files with 363 additions and 64 deletions.
@@ -1,3 +1,13 @@
2020-10-16 Darin Adler <darin@apple.com>

Add AbstractRange
https://bugs.webkit.org/show_bug.cgi?id=217846

Reviewed by Ryosuke Niwa.

* web-platform-tests/dom/idlharness.window-expected.txt:
Updated test result for progression.

2020-10-16 Karl Rackler <rackler@apple.com>

Unreviewed, reverting r268178.
@@ -1494,27 +1494,27 @@ PASS EventTarget interface: document.createComment("abc") must inherit property
PASS EventTarget interface: calling removeEventListener(DOMString, EventListener?, optional (EventListenerOptions or boolean)) on document.createComment("abc") with too few arguments must throw TypeError
PASS EventTarget interface: document.createComment("abc") must inherit property "dispatchEvent(Event)" with the proper type
PASS EventTarget interface: calling dispatchEvent(Event) on document.createComment("abc") with too few arguments must throw TypeError
FAIL AbstractRange interface: existence and properties of interface object assert_own_property: self does not have own property "AbstractRange" expected property "AbstractRange" missing
FAIL AbstractRange interface object length assert_own_property: self does not have own property "AbstractRange" expected property "AbstractRange" missing
FAIL AbstractRange interface object name assert_own_property: self does not have own property "AbstractRange" expected property "AbstractRange" missing
FAIL AbstractRange interface: existence and properties of interface prototype object assert_own_property: self does not have own property "AbstractRange" expected property "AbstractRange" missing
FAIL AbstractRange interface: existence and properties of interface prototype object's "constructor" property assert_own_property: self does not have own property "AbstractRange" expected property "AbstractRange" missing
FAIL AbstractRange interface: existence and properties of interface prototype object's @@unscopables property assert_own_property: self does not have own property "AbstractRange" expected property "AbstractRange" missing
FAIL AbstractRange interface: attribute startContainer assert_own_property: self does not have own property "AbstractRange" expected property "AbstractRange" missing
FAIL AbstractRange interface: attribute startOffset assert_own_property: self does not have own property "AbstractRange" expected property "AbstractRange" missing
FAIL AbstractRange interface: attribute endContainer assert_own_property: self does not have own property "AbstractRange" expected property "AbstractRange" missing
FAIL AbstractRange interface: attribute endOffset assert_own_property: self does not have own property "AbstractRange" expected property "AbstractRange" missing
FAIL AbstractRange interface: attribute collapsed assert_own_property: self does not have own property "AbstractRange" expected property "AbstractRange" missing
FAIL StaticRange interface: existence and properties of interface object assert_own_property: self does not have own property "AbstractRange" expected property "AbstractRange" missing
PASS AbstractRange interface: existence and properties of interface object
PASS AbstractRange interface object length
PASS AbstractRange interface object name
PASS AbstractRange interface: existence and properties of interface prototype object
PASS AbstractRange interface: existence and properties of interface prototype object's "constructor" property
PASS AbstractRange interface: existence and properties of interface prototype object's @@unscopables property
PASS AbstractRange interface: attribute startContainer
PASS AbstractRange interface: attribute startOffset
PASS AbstractRange interface: attribute endContainer
PASS AbstractRange interface: attribute endOffset
PASS AbstractRange interface: attribute collapsed
PASS StaticRange interface: existence and properties of interface object
PASS StaticRange interface object length
PASS StaticRange interface object name
FAIL StaticRange interface: existence and properties of interface prototype object assert_own_property: self does not have own property "AbstractRange" expected property "AbstractRange" missing
PASS StaticRange interface: existence and properties of interface prototype object
PASS StaticRange interface: existence and properties of interface prototype object's "constructor" property
PASS StaticRange interface: existence and properties of interface prototype object's @@unscopables property
FAIL Range interface: existence and properties of interface object assert_own_property: self does not have own property "AbstractRange" expected property "AbstractRange" missing
PASS Range interface: existence and properties of interface object
PASS Range interface object length
PASS Range interface object name
FAIL Range interface: existence and properties of interface prototype object assert_own_property: self does not have own property "AbstractRange" expected property "AbstractRange" missing
PASS Range interface: existence and properties of interface prototype object
PASS Range interface: existence and properties of interface prototype object's "constructor" property
PASS Range interface: existence and properties of interface prototype object's @@unscopables property
PASS Range interface: attribute commonAncestorContainer
@@ -753,6 +753,7 @@ set(WebCore_NON_SVG_IDL_FILES
dom/AbortAlgorithm.idl
dom/AbortController.idl
dom/AbortSignal.idl
dom/AbstractRange.idl
dom/AnimationEvent.idl
dom/Attr.idl
dom/BeforeLoadEvent.idl
@@ -1,3 +1,66 @@
2020-10-16 Darin Adler <darin@apple.com>

Add AbstractRange
https://bugs.webkit.org/show_bug.cgi?id=217846

Reviewed by Ryosuke Niwa.

This makes us more accurately match the DOM specification, makes Range
and StaticRange objects slightly bigger since they now have a virtual
table pointer, and makes the AbstractRange methods a bit slower to call
from JavaScript since they are backed by C++ virtual functions.

* CMakeLists.txt: Added AbstractRange files.
* DerivedSources-input.xcfilelist: Ditto.
* DerivedSources-output.xcfilelist: Ditto.
* DerivedSources.make: Ditto.
* Headers.cmake: Ditto.
* Sources.txt: Ditto.
* WebCore.xcodeproj/project.pbxproj: Ditto.
Also removed reference to non-existent JSAudioNodeCustom.cpp and moved
JSStaticRange file from the Events group into the Ranges group.

* bindings/js/JSAbstractRangeCustom.cpp: Added.
(WebCore::toJS): Added. Just the default implementation. Would be
nice if we did not have to write this.
(WebCore::toJSNewlyCreated): Make either a StaticRange or Range
wrapper depending on whether this is a live range or not.

* bindings/js/JSEventCustom.cpp: Removed lots of unneeded includes.
(WebCore::toJS): Stopped using "using namespace JSC".

* bindings/js/WebCoreBuiltinNames.h: Added AbstractRange.

* dom/AbstractRange.cpp: Added.
(WebCore::makeSimpleRange): Added.
* dom/AbstractRange.h: Added.
* dom/AbstractRange.idl: Added.

* dom/Range.h: Changed to derive from AbstractRange instead of
from RefCounted. Also marked this final since it's now polymorphic.
Marked all the functions that override final as well, to check that
they correctly override the virtual functions in the base class.
Added private isLiveRange function override that returns true.
Added SPECIALIZE_TYPE_TRAITS_BEGIN/END so we can do is<Range>.

* dom/Range.idl: Removed ImplementationLacksVTable. Added
JSGenerateToNativeObject. Inherit from AbstractRange.
Removed the 5 attribute getters that are now inherited from AbstractRange.

* dom/StaticRange.h: Changed to derive from AbstractRange instead of
from RefCounted. Also marked this final since it's now polymorphic.
Added functions to override the ones from StaticRange, calling through
to the ones from SimpleRange (I thought there was a way to do this
with using, but I couldn't figure that out). Added private isLiveRange
function override that returns false. Added SPECIALIZE_TYPE_TRAITS_BEGIN/END
so we can do is<StaticRange>.

* dom/StaticRange.idl: Removed EnabledBySetting=InputEvents since
this should now always be included. I think we should probably remove the
InputEvents setting now entirely. Removed ImplementationLacksVTable.
Added JSGenerateToNativeObject. Inherit from AbstractRange.
Removed all 5 attribute getters, which are now inherited from AbstractRange.

2020-10-17 Zalan Bujtas <zalan@apple.com>

[LFC][IFC] Incorrect inline level box geometry
@@ -675,6 +675,7 @@ $(PROJECT_DIR)/css/typedom/TypedOMCSSUnparsedValue.idl
$(PROJECT_DIR)/dom/AbortAlgorithm.idl
$(PROJECT_DIR)/dom/AbortController.idl
$(PROJECT_DIR)/dom/AbortSignal.idl
$(PROJECT_DIR)/dom/AbstractRange.idl
$(PROJECT_DIR)/dom/AnimationEvent.idl
$(PROJECT_DIR)/dom/Attr.idl
$(PROJECT_DIR)/dom/BeforeLoadEvent.idl
@@ -47,6 +47,8 @@ $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSAbortController.cpp
$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSAbortController.h
$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSAbortSignal.cpp
$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSAbortSignal.h
$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSAbstractRange.cpp
$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSAbstractRange.h
$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSAbstractWorker.cpp
$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSAbstractWorker.h
$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSAccessibilityRole.cpp
@@ -636,6 +636,7 @@ JS_BINDING_IDLS = \
$(WebCore)/dom/AbortAlgorithm.idl \
$(WebCore)/dom/AbortController.idl \
$(WebCore)/dom/AbortSignal.idl \
$(WebCore)/dom/AbstractRange.idl \
$(WebCore)/dom/AnimationEvent.idl \
$(WebCore)/dom/Attr.idl \
$(WebCore)/dom/BeforeLoadEvent.idl \
@@ -371,6 +371,7 @@ set(WebCore_PRIVATE_FRAMEWORK_HEADERS
display/css/DisplayReplacedBox.h
display/css/DisplayStyle.h

dom/AbstractRange.h
dom/ActiveDOMCallback.h
dom/ActiveDOMObject.h
dom/Attr.h
@@ -1589,6 +1590,7 @@ set(WebCore_PRIVATE_FRAMEWORK_HEADERS
${WebCore_DERIVED_SOURCES_DIR}/HTMLElementTypeHelpers.h
${WebCore_DERIVED_SOURCES_DIR}/HTMLNames.h
${WebCore_DERIVED_SOURCES_DIR}/HTTPHeaderNames.h
${WebCore_DERIVED_SOURCES_DIR}/JSAbstractRange.h
${WebCore_DERIVED_SOURCES_DIR}/JSBlob.h
${WebCore_DERIVED_SOURCES_DIR}/JSCSSRule.h
${WebCore_DERIVED_SOURCES_DIR}/JSCSSRuleList.h
@@ -467,6 +467,7 @@ bindings/js/GCController.cpp
bindings/js/IDBBindingUtilities.cpp
bindings/js/JSAbortControllerCustom.cpp
bindings/js/JSAbortSignalCustom.cpp
bindings/js/JSAbstractRangeCustom.cpp
bindings/js/JSAnimationEffectCustom.cpp
bindings/js/JSAnimationTimelineCustom.cpp
bindings/js/JSAttrCustom.cpp
@@ -816,6 +817,7 @@ display/DisplayTreeBuilder.cpp
display/DisplayView.cpp
dom/AbortController.cpp
dom/AbortSignal.cpp
dom/AbstractRange.cpp
dom/ActiveDOMCallback.cpp
dom/ActiveDOMObject.cpp
dom/AllDescendantsCollection.cpp
@@ -2655,6 +2657,7 @@ JSANGLEInstancedArrays.cpp
JSAbortAlgorithm.cpp
JSAbortController.cpp
JSAbortSignal.cpp
JSAbstractRange.cpp
JSAbstractWorker.cpp
JSAddressErrors.cpp
JSAesCbcCfbParams.cpp

0 comments on commit 51af31d

Please sign in to comment.