Title: [282441] trunk
Revision
282441
Author
[email protected]
Date
2021-09-14 23:16:57 -0700 (Tue, 14 Sep 2021)

Log Message

Implement the borderBoxSize/contentBoxSize parts of ResizeObserver
https://bugs.webkit.org/show_bug.cgi?id=230242

Reviewed by Sam Weinig.

LayoutTests/imported/w3c:

New results. WebKit seems to fire the "resize loop error" more than
other browsers, which seems to be an issue with the spec[1].

[1] https://github.com/w3c/csswg-drafts/issues/6610

* web-platform-tests/resize-observer/idlharness.window-expected.txt:
* web-platform-tests/resize-observer/observe-expected.txt:
* web-platform-tests/resize-observer/svg-expected.txt:

Source/WebCore:

The Resize Observer spec has been updated to allow authors to observe
"content-box", "border-box" and "device-pixel-content-box". Add support
for the first two, adding ResizeObserverSize, ResizeObserverBoxOptions and
ResizeObserverOptions per spec.

ResizeObserverEntry also contains borderBoxSize and contentBoxSize now,
so support that.

Add some helpers to make it easier to get box logical sizes.

"device-pixel-content-box" is not yet supported because it's expensive to compute[2].

[1] https://drafts.csswg.org/resize-observer
[2] https://github.com/w3c/csswg-drafts/issues/6608

Tested by WPT.

* DerivedSources-input.xcfilelist:
* DerivedSources-output.xcfilelist:
* DerivedSources.make:
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* page/ResizeObservation.cpp:
(WebCore::ResizeObservation::create):
(WebCore::ResizeObservation::ResizeObservation):
(WebCore::ResizeObservation::updateObservationSize):
(WebCore::ResizeObservation::computeObservedSizes const):
(WebCore::ResizeObservation::computeContentRect const):
(WebCore::ResizeObservation::borderBoxSize const):
(WebCore::ResizeObservation::contentBoxSize const):
(WebCore::ResizeObservation::snappedContentBoxSize const):
(WebCore::ResizeObservation::elementSizeChanged const):
(WebCore::ResizeObservation::~ResizeObservation): Deleted.
(WebCore::ResizeObservation::computeObservedSize const): Deleted.
* page/ResizeObservation.h:
(WebCore::ResizeObservation::observedBox const):
* page/ResizeObserver.cpp:
(WebCore::ResizeObserver::observe):
(WebCore::ResizeObserver::gatherObservations):
(WebCore::ResizeObserver::deliverObservations):
* page/ResizeObserver.h:
* page/ResizeObserver.idl:
* page/ResizeObserverBoxOptions.h: Added.
* page/ResizeObserverBoxOptions.idl: Copied from Source/WebCore/page/ResizeObserverEntry.idl.
* page/ResizeObserverEntry.h:
(WebCore::ResizeObserverEntry::create):
(WebCore::ResizeObserverEntry::contentRect const):
(WebCore::ResizeObserverEntry::borderBoxSize const):
(WebCore::ResizeObserverEntry::contentBoxSize const):
(WebCore::ResizeObserverEntry::ResizeObserverEntry):
(WebCore::ResizeObserverEntry::m_contentBoxSizes):
* page/ResizeObserverEntry.idl:
* page/ResizeObserverOptions.h: Added.
* page/ResizeObserverOptions.idl: Copied from Source/WebCore/page/ResizeObserverEntry.idl.
* page/ResizeObserverSize.h: Added.
(WebCore::ResizeObserverSize::create):
(WebCore::ResizeObserverSize::inlineSize const):
(WebCore::ResizeObserverSize::blockSize const):
(WebCore::ResizeObserverSize::ResizeObserverSize):
* page/ResizeObserverSize.idl: Copied from Source/WebCore/page/ResizeObserverEntry.idl.
* rendering/RenderBox.h:
(WebCore::RenderBox::logicalSize const):
(WebCore::RenderBox::borderBoxLogicalSize const):
(WebCore::RenderBox::contentLogicalSize const):
* rendering/RenderElement.h:
(WebCore::adjustLayoutSizeForAbsoluteZoom):
* rendering/style/RenderStyle.h:
(WebCore::adjustLayoutSizeForAbsoluteZoom):

LayoutTests:

Give macOS a platform expectation for this test since its results seem to be the odd one out.

* platform/ios/imported/w3c/web-platform-tests/resize-observer/svg-expected.txt: Removed.
* platform/mac/imported/w3c/web-platform-tests/resize-observer/svg-expected.txt: Copied from LayoutTests/imported/w3c/web-platform-tests/resize-observer/svg-expected.txt.

Modified Paths

Added Paths

Removed Paths

  • trunk/LayoutTests/platform/ios/imported/w3c/web-platform-tests/resize-observer/

Diff

Modified: trunk/LayoutTests/ChangeLog (282440 => 282441)


--- trunk/LayoutTests/ChangeLog	2021-09-15 06:14:11 UTC (rev 282440)
+++ trunk/LayoutTests/ChangeLog	2021-09-15 06:16:57 UTC (rev 282441)
@@ -1,3 +1,15 @@
+2021-09-14  Simon Fraser  <[email protected]>
+
+        Implement the borderBoxSize/contentBoxSize parts of ResizeObserver
+        https://bugs.webkit.org/show_bug.cgi?id=230242
+
+        Reviewed by Sam Weinig.
+
+        Give macOS a platform expectation for this test since its results seem to be the odd one out.
+
+        * platform/ios/imported/w3c/web-platform-tests/resize-observer/svg-expected.txt: Removed.
+        * platform/mac/imported/w3c/web-platform-tests/resize-observer/svg-expected.txt: Copied from LayoutTests/imported/w3c/web-platform-tests/resize-observer/svg-expected.txt.
+
 2021-09-14  Rob Buis  <[email protected]>
 
         imported/w3c/web-platform-tests/css/css-sizing/image-min-max-content-intrinsic-size-change* tests fail

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (282440 => 282441)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2021-09-15 06:14:11 UTC (rev 282440)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2021-09-15 06:16:57 UTC (rev 282441)
@@ -1,3 +1,19 @@
+2021-09-14  Simon Fraser  <[email protected]>
+
+        Implement the borderBoxSize/contentBoxSize parts of ResizeObserver
+        https://bugs.webkit.org/show_bug.cgi?id=230242
+
+        Reviewed by Sam Weinig.
+
+        New results. WebKit seems to fire the "resize loop error" more than
+        other browsers, which seems to be an issue with the spec[1].
+
+        [1] https://github.com/w3c/csswg-drafts/issues/6610
+
+        * web-platform-tests/resize-observer/idlharness.window-expected.txt:
+        * web-platform-tests/resize-observer/observe-expected.txt:
+        * web-platform-tests/resize-observer/svg-expected.txt:
+
 2021-09-14  Rob Buis  <[email protected]>
 
         Fix button-min-width.html

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/resize-observer/idlharness.window-expected.txt (282440 => 282441)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/resize-observer/idlharness.window-expected.txt	2021-09-15 06:14:11 UTC (rev 282440)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/resize-observer/idlharness.window-expected.txt	2021-09-15 06:16:57 UTC (rev 282441)
@@ -30,22 +30,22 @@
 PASS ResizeObserverEntry interface: existence and properties of interface prototype object's @@unscopables property
 PASS ResizeObserverEntry interface: attribute target
 PASS ResizeObserverEntry interface: attribute contentRect
-FAIL ResizeObserverEntry interface: attribute borderBoxSize assert_true: The prototype object must have a property "borderBoxSize" expected true got false
-FAIL ResizeObserverEntry interface: attribute contentBoxSize assert_true: The prototype object must have a property "contentBoxSize" expected true got false
+PASS ResizeObserverEntry interface: attribute borderBoxSize
+PASS ResizeObserverEntry interface: attribute contentBoxSize
 FAIL ResizeObserverEntry interface: attribute devicePixelContentBoxSize assert_true: The prototype object must have a property "devicePixelContentBoxSize" expected true got false
 PASS ResizeObserverEntry must be primary interface of entry
 PASS Stringification of entry
 PASS ResizeObserverEntry interface: entry must inherit property "target" with the proper type
 PASS ResizeObserverEntry interface: entry must inherit property "contentRect" with the proper type
-FAIL ResizeObserverEntry interface: entry must inherit property "borderBoxSize" with the proper type assert_inherits: property "borderBoxSize" not found in prototype chain
-FAIL ResizeObserverEntry interface: entry must inherit property "contentBoxSize" with the proper type assert_inherits: property "contentBoxSize" not found in prototype chain
+PASS ResizeObserverEntry interface: entry must inherit property "borderBoxSize" with the proper type
+PASS ResizeObserverEntry interface: entry must inherit property "contentBoxSize" with the proper type
 FAIL ResizeObserverEntry interface: entry must inherit property "devicePixelContentBoxSize" with the proper type assert_inherits: property "devicePixelContentBoxSize" not found in prototype chain
-FAIL ResizeObserverSize interface: existence and properties of interface object assert_own_property: self does not have own property "ResizeObserverSize" expected property "ResizeObserverSize" missing
-FAIL ResizeObserverSize interface object length assert_own_property: self does not have own property "ResizeObserverSize" expected property "ResizeObserverSize" missing
-FAIL ResizeObserverSize interface object name assert_own_property: self does not have own property "ResizeObserverSize" expected property "ResizeObserverSize" missing
-FAIL ResizeObserverSize interface: existence and properties of interface prototype object assert_own_property: self does not have own property "ResizeObserverSize" expected property "ResizeObserverSize" missing
-FAIL ResizeObserverSize interface: existence and properties of interface prototype object's "constructor" property assert_own_property: self does not have own property "ResizeObserverSize" expected property "ResizeObserverSize" missing
-FAIL ResizeObserverSize interface: existence and properties of interface prototype object's @@unscopables property assert_own_property: self does not have own property "ResizeObserverSize" expected property "ResizeObserverSize" missing
-FAIL ResizeObserverSize interface: attribute inlineSize assert_own_property: self does not have own property "ResizeObserverSize" expected property "ResizeObserverSize" missing
-FAIL ResizeObserverSize interface: attribute blockSize assert_own_property: self does not have own property "ResizeObserverSize" expected property "ResizeObserverSize" missing
+PASS ResizeObserverSize interface: existence and properties of interface object
+PASS ResizeObserverSize interface object length
+PASS ResizeObserverSize interface object name
+PASS ResizeObserverSize interface: existence and properties of interface prototype object
+PASS ResizeObserverSize interface: existence and properties of interface prototype object's "constructor" property
+PASS ResizeObserverSize interface: existence and properties of interface prototype object's @@unscopables property
+PASS ResizeObserverSize interface: attribute inlineSize
+PASS ResizeObserverSize interface: attribute blockSize
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/resize-observer/observe-expected.txt (282440 => 282441)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/resize-observer/observe-expected.txt	2021-09-15 06:14:11 UTC (rev 282440)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/resize-observer/observe-expected.txt	2021-09-15 06:16:57 UTC (rev 282441)
@@ -1,8 +1,20 @@
 CONSOLE MESSAGE: ResizeObserver loop completed with undelivered notifications.
 CONSOLE MESSAGE: ResizeObserver loop completed with undelivered notifications.
+CONSOLE MESSAGE: ResizeObserver loop completed with undelivered notifications.
+CONSOLE MESSAGE: ResizeObserver loop completed with undelivered notifications.
+CONSOLE MESSAGE: ResizeObserver loop completed with undelivered notifications.
+CONSOLE MESSAGE: ResizeObserver loop completed with undelivered notifications.
+CONSOLE MESSAGE: ResizeObserver loop completed with undelivered notifications.
+CONSOLE MESSAGE: ResizeObserver loop completed with undelivered notifications.
+CONSOLE MESSAGE: ResizeObserver loop completed with undelivered notifications.
+CONSOLE MESSAGE: ResizeObserver loop completed with undelivered notifications.
+CONSOLE MESSAGE: ResizeObserver loop completed with undelivered notifications.
+CONSOLE MESSAGE: ResizeObserver loop completed with undelivered notifications.
 
+Harness Error (TIMEOUT), message = null
+
 PASS ResizeObserver implemented
-PASS guard
+NOTRUN guard
 PASS test0: simple observation
 PASS test1: multiple observation on same element trigger only one
 PASS test2: throw exception when observing non-element
@@ -11,15 +23,15 @@
 PASS test5: observe img
 PASS test6: iframe notifications
 PASS test7: callback.this
-FAIL test8: simple content-box observation undefined is not an object (evaluating 'entries[0].contentBoxSize[0]')
-FAIL test9: simple content-box observation but keep border-box size unchanged undefined is not an object (evaluating 'entries[0].contentBoxSize[0]')
-FAIL test10: simple border-box observation undefined is not an object (evaluating 'entries[0].contentBoxSize[0]')
-FAIL test11: simple observation with vertical writing mode undefined is not an object (evaluating 'entries[0].contentBoxSize[0]')
-FAIL test12: no observation is fired after the change of writing mode when box's specified size comes from logical size properties. undefined is not an object (evaluating 'entries[0].contentBoxSize[0]')
-FAIL test13: an observation is fired after the change of writing mode when box's specified size comes from physical size properties. undefined is not an object (evaluating 'entries[0].contentBoxSize[0]')
-FAIL test14: observe the same target but using a different box should override the previous one undefined is not an object (evaluating 'entries[0].contentBoxSize[0]')
-FAIL test15: an observation is fired with box dimensions 0 when element's display property is set to inline undefined is not an object (evaluating 'entries[0].contentBoxSize[0]')
+PASS test8: simple content-box observation
+PASS test9: simple content-box observation but keep border-box size unchanged
+PASS test10: simple border-box observation
+PASS test11: simple observation with vertical writing mode
+PASS test12: no observation is fired after the change of writing mode when box's specified size comes from logical size properties.
+PASS test13: an observation is fired after the change of writing mode when box's specified size comes from physical size properties.
+PASS test14: observe the same target but using a different box should override the previous one
+PASS test15: an observation is fired with box dimensions 0 when element's display property is set to inline
 PASS test16: observations do not fire for non-replaced inline elements
-FAIL test17: Box sizing snd Resize Observer notifications undefined is not an object (evaluating 'entries[0].contentBoxSize[0]')
-FAIL test18: an observation is fired when device-pixel-content-box is being observed undefined is not an object (evaluating 'entries[0].contentBoxSize[0]')
+PASS test17: Box sizing snd Resize Observer notifications
+FAIL test18: an observation is fired when device-pixel-content-box is being observed assert_unreached: Caught a throw, possible syntax error Reached unreachable code
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/resize-observer/svg-expected.txt (282440 => 282441)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/resize-observer/svg-expected.txt	2021-09-15 06:14:11 UTC (rev 282440)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/resize-observer/svg-expected.txt	2021-09-15 06:16:57 UTC (rev 282441)
@@ -4,8 +4,10 @@
 
 svg text tag
 
+Harness Error (TIMEOUT), message = null
+
 PASS ResizeObserver implemented
-PASS guard
+NOTRUN guard
 PASS test0: observe svg:circle
 PASS test1: observe svg:ellipse
 PASS test2: observe svg:foreignObject
@@ -18,9 +20,9 @@
 PASS test9: observe svg:text
 PASS test10: observe svg:svg, top/left is 0 even with padding
 PASS test11: observe svg non-displayable element
-FAIL test12: observe svg:rect content box undefined is not an object (evaluating 'entries[0].contentBoxSize[0]')
-FAIL test13: observe svg:rect border box undefined is not an object (evaluating 'entries[0].contentBoxSize[0]')
-FAIL test14: observe g:rect content and border box undefined is not an object (evaluating 'entries[0].contentBoxSize[0]')
-FAIL test15: observe svg:text content and border box assert_equals: expected 30 but got 30.015625
-FAIL test16: observe g:rect content, border and device-pixel-content boxes undefined is not an object (evaluating 'entries[0].contentBoxSize[0]')
+PASS test12: observe svg:rect content box
+PASS test13: observe svg:rect border box
+PASS test14: observe g:rect content and border box
+PASS test15: observe svg:text content and border box
+FAIL test16: observe g:rect content, border and device-pixel-content boxes assert_unreached: Caught a throw, possible syntax error Reached unreachable code
 

Copied: trunk/LayoutTests/platform/mac/imported/w3c/web-platform-tests/resize-observer/svg-expected.txt (from rev 282440, trunk/LayoutTests/platform/ios/imported/w3c/web-platform-tests/resize-observer/svg-expected.txt) (0 => 282441)


--- trunk/LayoutTests/platform/mac/imported/w3c/web-platform-tests/resize-observer/svg-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/mac/imported/w3c/web-platform-tests/resize-observer/svg-expected.txt	2021-09-15 06:16:57 UTC (rev 282441)
@@ -0,0 +1,28 @@
+ResizeObserver svg tests
+
+Here is a paragraph that requires word wrap
+
+svg text tag
+
+Harness Error (TIMEOUT), message = null
+
+PASS ResizeObserver implemented
+NOTRUN guard
+PASS test0: observe svg:circle
+PASS test1: observe svg:ellipse
+PASS test2: observe svg:foreignObject
+PASS test3: observe svg:image
+PASS test4: observe svg:line
+PASS test5: observe svg:path
+PASS test6: observe svg:polygon
+PASS test7: observe svg:polyline
+PASS test8: observe svg:rect
+PASS test9: observe svg:text
+PASS test10: observe svg:svg, top/left is 0 even with padding
+PASS test11: observe svg non-displayable element
+PASS test12: observe svg:rect content box
+PASS test13: observe svg:rect border box
+PASS test14: observe g:rect content and border box
+FAIL test15: observe svg:text content and border box assert_equals: expected 30 but got 30.015625
+FAIL test16: observe g:rect content, border and device-pixel-content boxes assert_unreached: Caught a throw, possible syntax error Reached unreachable code
+

Modified: trunk/Source/WebCore/CMakeLists.txt (282440 => 282441)


--- trunk/Source/WebCore/CMakeLists.txt	2021-09-15 06:14:11 UTC (rev 282440)
+++ trunk/Source/WebCore/CMakeLists.txt	2021-09-15 06:16:57 UTC (rev 282441)
@@ -1125,8 +1125,11 @@
     page/PerformanceTiming.idl
     page/RemoteDOMWindow.idl
     page/ResizeObserver.idl
+    page/ResizeObserverBoxOptions.idl
     page/ResizeObserverCallback.idl
     page/ResizeObserverEntry.idl
+    page/ResizeObserverOptions.idl
+    page/ResizeObserverSize.idl
     page/Screen.idl
     page/ScrollBehavior.idl
     page/ScrollIntoViewOptions.idl

Modified: trunk/Source/WebCore/ChangeLog (282440 => 282441)


--- trunk/Source/WebCore/ChangeLog	2021-09-15 06:14:11 UTC (rev 282440)
+++ trunk/Source/WebCore/ChangeLog	2021-09-15 06:16:57 UTC (rev 282441)
@@ -1,3 +1,79 @@
+2021-09-14  Simon Fraser  <[email protected]>
+
+        Implement the borderBoxSize/contentBoxSize parts of ResizeObserver
+        https://bugs.webkit.org/show_bug.cgi?id=230242
+
+        Reviewed by Sam Weinig.
+
+        The Resize Observer spec has been updated to allow authors to observe
+        "content-box", "border-box" and "device-pixel-content-box". Add support
+        for the first two, adding ResizeObserverSize, ResizeObserverBoxOptions and
+        ResizeObserverOptions per spec.
+
+        ResizeObserverEntry also contains borderBoxSize and contentBoxSize now,
+        so support that.
+
+        Add some helpers to make it easier to get box logical sizes.
+
+        "device-pixel-content-box" is not yet supported because it's expensive to compute[2].
+
+        [1] https://drafts.csswg.org/resize-observer
+        [2] https://github.com/w3c/csswg-drafts/issues/6608
+
+        Tested by WPT.
+
+        * DerivedSources-input.xcfilelist:
+        * DerivedSources-output.xcfilelist:
+        * DerivedSources.make:
+        * Sources.txt:
+        * WebCore.xcodeproj/project.pbxproj:
+        * page/ResizeObservation.cpp:
+        (WebCore::ResizeObservation::create):
+        (WebCore::ResizeObservation::ResizeObservation):
+        (WebCore::ResizeObservation::updateObservationSize):
+        (WebCore::ResizeObservation::computeObservedSizes const):
+        (WebCore::ResizeObservation::computeContentRect const):
+        (WebCore::ResizeObservation::borderBoxSize const):
+        (WebCore::ResizeObservation::contentBoxSize const):
+        (WebCore::ResizeObservation::snappedContentBoxSize const):
+        (WebCore::ResizeObservation::elementSizeChanged const):
+        (WebCore::ResizeObservation::~ResizeObservation): Deleted.
+        (WebCore::ResizeObservation::computeObservedSize const): Deleted.
+        * page/ResizeObservation.h:
+        (WebCore::ResizeObservation::observedBox const):
+        * page/ResizeObserver.cpp:
+        (WebCore::ResizeObserver::observe):
+        (WebCore::ResizeObserver::gatherObservations):
+        (WebCore::ResizeObserver::deliverObservations):
+        * page/ResizeObserver.h:
+        * page/ResizeObserver.idl:
+        * page/ResizeObserverBoxOptions.h: Added.
+        * page/ResizeObserverBoxOptions.idl: Copied from Source/WebCore/page/ResizeObserverEntry.idl.
+        * page/ResizeObserverEntry.h:
+        (WebCore::ResizeObserverEntry::create):
+        (WebCore::ResizeObserverEntry::contentRect const):
+        (WebCore::ResizeObserverEntry::borderBoxSize const):
+        (WebCore::ResizeObserverEntry::contentBoxSize const):
+        (WebCore::ResizeObserverEntry::ResizeObserverEntry):
+        (WebCore::ResizeObserverEntry::m_contentBoxSizes):
+        * page/ResizeObserverEntry.idl:
+        * page/ResizeObserverOptions.h: Added.
+        * page/ResizeObserverOptions.idl: Copied from Source/WebCore/page/ResizeObserverEntry.idl.
+        * page/ResizeObserverSize.h: Added.
+        (WebCore::ResizeObserverSize::create):
+        (WebCore::ResizeObserverSize::inlineSize const):
+        (WebCore::ResizeObserverSize::blockSize const):
+        (WebCore::ResizeObserverSize::ResizeObserverSize):
+        * page/ResizeObserverSize.idl: Copied from Source/WebCore/page/ResizeObserverEntry.idl.
+        * rendering/RenderBox.h:
+        (WebCore::RenderBox::logicalSize const):
+        (WebCore::RenderBox::borderBoxLogicalSize const):
+        (WebCore::RenderBox::contentLogicalSize const):
+        * rendering/RenderElement.h:
+        (WebCore::adjustLayoutSizeForAbsoluteZoom):
+        * rendering/style/RenderStyle.h:
+        (WebCore::adjustLayoutSizeForAbsoluteZoom):
+
 2021-09-14  Rob Buis  <[email protected]>
 
         Fix button-min-width.html

Modified: trunk/Source/WebCore/DerivedSources-input.xcfilelist (282440 => 282441)


--- trunk/Source/WebCore/DerivedSources-input.xcfilelist	2021-09-15 06:14:11 UTC (rev 282440)
+++ trunk/Source/WebCore/DerivedSources-input.xcfilelist	2021-09-15 06:16:57 UTC (rev 282441)
@@ -1191,8 +1191,11 @@
 $(PROJECT_DIR)/page/PostMessageOptions.idl
 $(PROJECT_DIR)/page/RemoteDOMWindow.idl
 $(PROJECT_DIR)/page/ResizeObserver.idl
+$(PROJECT_DIR)/page/ResizeObserverBoxOptions.idl
 $(PROJECT_DIR)/page/ResizeObserverCallback.idl
 $(PROJECT_DIR)/page/ResizeObserverEntry.idl
+$(PROJECT_DIR)/page/ResizeObserverOptions.idl
+$(PROJECT_DIR)/page/ResizeObserverSize.idl
 $(PROJECT_DIR)/page/Screen.idl
 $(PROJECT_DIR)/page/ScrollBehavior.idl
 $(PROJECT_DIR)/page/ScrollIntoViewOptions.idl

Modified: trunk/Source/WebCore/DerivedSources-output.xcfilelist (282440 => 282441)


--- trunk/Source/WebCore/DerivedSources-output.xcfilelist	2021-09-15 06:14:11 UTC (rev 282440)
+++ trunk/Source/WebCore/DerivedSources-output.xcfilelist	2021-09-15 06:16:57 UTC (rev 282441)
@@ -1841,10 +1841,16 @@
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSRequestAnimationFrameCallback.h
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSResizeObserver.cpp
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSResizeObserver.h
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSResizeObserverBoxOptions.cpp
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSResizeObserverBoxOptions.h
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSResizeObserverCallback.cpp
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSResizeObserverCallback.h
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSResizeObserverEntry.cpp
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSResizeObserverEntry.h
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSResizeObserverOptions.cpp
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSResizeObserverOptions.h
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSResizeObserverSize.cpp
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSResizeObserverSize.h
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSRsaHashedImportParams.cpp
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSRsaHashedImportParams.h
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSRsaHashedKeyGenParams.cpp

Modified: trunk/Source/WebCore/DerivedSources.make (282440 => 282441)


--- trunk/Source/WebCore/DerivedSources.make	2021-09-15 06:14:11 UTC (rev 282440)
+++ trunk/Source/WebCore/DerivedSources.make	2021-09-15 06:16:57 UTC (rev 282441)
@@ -1038,8 +1038,11 @@
     $(WebCore)/page/PerformanceTiming.idl \
     $(WebCore)/page/RemoteDOMWindow.idl \
     $(WebCore)/page/ResizeObserver.idl \
+    $(WebCore)/page/ResizeObserverBoxOptions.idl \
     $(WebCore)/page/ResizeObserverCallback.idl \
     $(WebCore)/page/ResizeObserverEntry.idl \
+    $(WebCore)/page/ResizeObserverOptions.idl \
+    $(WebCore)/page/ResizeObserverSize.idl \
     $(WebCore)/page/Screen.idl \
     $(WebCore)/page/ScrollBehavior.idl \
     $(WebCore)/page/ScrollIntoViewOptions.idl \

Modified: trunk/Source/WebCore/Sources.txt (282440 => 282441)


--- trunk/Source/WebCore/Sources.txt	2021-09-15 06:14:11 UTC (rev 282440)
+++ trunk/Source/WebCore/Sources.txt	2021-09-15 06:16:57 UTC (rev 282441)
@@ -3403,8 +3403,11 @@
 JSRemotePlaybackAvailabilityCallback.cpp
 JSRequestAnimationFrameCallback.cpp
 JSResizeObserver.cpp
+JSResizeObserverBoxOptions.cpp
 JSResizeObserverCallback.cpp
 JSResizeObserverEntry.cpp
+JSResizeObserverOptions.cpp
+JSResizeObserverSize.cpp
 JSRsaHashedImportParams.cpp
 JSRsaHashedKeyGenParams.cpp
 JSRsaKeyGenParams.cpp

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (282440 => 282441)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2021-09-15 06:14:11 UTC (rev 282440)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2021-09-15 06:16:57 UTC (rev 282441)
@@ -362,6 +362,12 @@
 		0FD308D6117D168500A791F7 /* RenderIFrame.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FD308D4117D168400A791F7 /* RenderIFrame.h */; };
 		0FD41E6821F80C0E000C006D /* ScrollingTreeFrameHostingNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FD41E6621F80282000C006D /* ScrollingTreeFrameHostingNode.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		0FD41E6921F80D14000C006D /* ScrollingStateFrameHostingNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FD41E6521F80261000C006D /* ScrollingStateFrameHostingNode.h */; settings = {ATTRIBUTES = (Private, ); }; };
+		0FD6A68526EEC221007B2231 /* JSResizeObserverOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FD6A68226EEC1D9007B2231 /* JSResizeObserverOptions.h */; };
+		0FD6A68726EEC226007B2231 /* JSResizeObserverSize.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FD6A67D26EEC076007B2231 /* JSResizeObserverSize.h */; };
+		0FD6A68826EEC22B007B2231 /* JSResizeObserverBoxOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FD6A67C26EEC076007B2231 /* JSResizeObserverBoxOptions.h */; };
+		0FD6A68A26EEC32B007B2231 /* ResizeObserverOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FD6A68926EEC32A007B2231 /* ResizeObserverOptions.h */; };
+		0FD6A68C26EEC37F007B2231 /* ResizeObserverBoxOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FD6A68B26EEC37F007B2231 /* ResizeObserverBoxOptions.h */; };
+		0FD6A68E26EEC5E9007B2231 /* ResizeObserverSize.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FD6A68D26EEC5E8007B2231 /* ResizeObserverSize.h */; };
 		0FD723820EC8BD9300CA5DD7 /* FloatQuad.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FD723800EC8BD9300CA5DD7 /* FloatQuad.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		0FD975D5245CCB4700C42299 /* ScrollingTreeGestureState.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FD975D2245CBDAF00C42299 /* ScrollingTreeGestureState.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		0FDA7C17188322EB00C954B5 /* JSTouch.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FDA7C11188322EB00C954B5 /* JSTouch.h */; };
@@ -6356,6 +6362,18 @@
 		0FD41E6521F80261000C006D /* ScrollingStateFrameHostingNode.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ScrollingStateFrameHostingNode.h; sourceTree = "<group>"; };
 		0FD41E6621F80282000C006D /* ScrollingTreeFrameHostingNode.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ScrollingTreeFrameHostingNode.h; sourceTree = "<group>"; };
 		0FD41E6721F80282000C006D /* ScrollingTreeFrameHostingNode.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = ScrollingTreeFrameHostingNode.cpp; sourceTree = "<group>"; };
+		0FD6A67226EEBA05007B2231 /* ResizeObserverOptions.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = ResizeObserverOptions.idl; sourceTree = "<group>"; };
+		0FD6A67426EEBAB9007B2231 /* ResizeObserverBoxOptions.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = ResizeObserverBoxOptions.idl; sourceTree = "<group>"; };
+		0FD6A67626EEBC7B007B2231 /* ResizeObserverSize.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = ResizeObserverSize.idl; sourceTree = "<group>"; };
+		0FD6A67926EEC075007B2231 /* JSResizeObserverBoxOptions.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = JSResizeObserverBoxOptions.cpp; sourceTree = "<group>"; };
+		0FD6A67B26EEC075007B2231 /* JSResizeObserverSize.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = JSResizeObserverSize.cpp; sourceTree = "<group>"; };
+		0FD6A67C26EEC076007B2231 /* JSResizeObserverBoxOptions.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = JSResizeObserverBoxOptions.h; sourceTree = "<group>"; };
+		0FD6A67D26EEC076007B2231 /* JSResizeObserverSize.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = JSResizeObserverSize.h; sourceTree = "<group>"; };
+		0FD6A68026EEC1D9007B2231 /* JSResizeObserverOptions.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = JSResizeObserverOptions.cpp; sourceTree = "<group>"; };
+		0FD6A68226EEC1D9007B2231 /* JSResizeObserverOptions.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = JSResizeObserverOptions.h; sourceTree = "<group>"; };
+		0FD6A68926EEC32A007B2231 /* ResizeObserverOptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ResizeObserverOptions.h; sourceTree = "<group>"; };
+		0FD6A68B26EEC37F007B2231 /* ResizeObserverBoxOptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ResizeObserverBoxOptions.h; sourceTree = "<group>"; };
+		0FD6A68D26EEC5E8007B2231 /* ResizeObserverSize.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ResizeObserverSize.h; sourceTree = "<group>"; };
 		0FD723800EC8BD9300CA5DD7 /* FloatQuad.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FloatQuad.h; sourceTree = "<group>"; };
 		0FD723810EC8BD9300CA5DD7 /* FloatQuad.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FloatQuad.cpp; sourceTree = "<group>"; };
 		0FD7C21D23CE41E30096D102 /* PlatformWheelEvent.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = PlatformWheelEvent.cpp; sourceTree = "<group>"; };
@@ -22357,10 +22375,16 @@
 				58B2F9EF2232D43D00938D63 /* ResizeObserver.cpp */,
 				58B2F9EC2232D43B00938D63 /* ResizeObserver.h */,
 				58B2F9F12232D43E00938D63 /* ResizeObserver.idl */,
+				0FD6A68B26EEC37F007B2231 /* ResizeObserverBoxOptions.h */,
+				0FD6A67426EEBAB9007B2231 /* ResizeObserverBoxOptions.idl */,
 				58B2F9F02232D43E00938D63 /* ResizeObserverCallback.h */,
 				58B2F9ED2232D43C00938D63 /* ResizeObserverCallback.idl */,
 				58B2F9EE2232D43D00938D63 /* ResizeObserverEntry.h */,
 				58B2F9EA2232D43B00938D63 /* ResizeObserverEntry.idl */,
+				0FD6A68926EEC32A007B2231 /* ResizeObserverOptions.h */,
+				0FD6A67226EEBA05007B2231 /* ResizeObserverOptions.idl */,
+				0FD6A68D26EEC5E8007B2231 /* ResizeObserverSize.h */,
+				0FD6A67626EEBC7B007B2231 /* ResizeObserverSize.idl */,
 				A5071E821C56D079009951BE /* ResourceUsageData.h */,
 				ADBAD6EC1BCDD95000381325 /* ResourceUsageOverlay.cpp */,
 				ADBAD6ED1BCDD95000381325 /* ResourceUsageOverlay.h */,
@@ -27526,10 +27550,16 @@
 				46C376612085176D00C73829 /* JSRemoteDOMWindow.h */,
 				58B2FA032232D60B00938D63 /* JSResizeObserver.cpp */,
 				58B2FA012232D60A00938D63 /* JSResizeObserver.h */,
+				0FD6A67926EEC075007B2231 /* JSResizeObserverBoxOptions.cpp */,
+				0FD6A67C26EEC076007B2231 /* JSResizeObserverBoxOptions.h */,
 				58B2F9FE2232D60700938D63 /* JSResizeObserverCallback.cpp */,
 				58B2F9FF2232D60800938D63 /* JSResizeObserverCallback.h */,
 				58B2FA002232D60900938D63 /* JSResizeObserverEntry.cpp */,
 				58B2FA022232D60A00938D63 /* JSResizeObserverEntry.h */,
+				0FD6A68026EEC1D9007B2231 /* JSResizeObserverOptions.cpp */,
+				0FD6A68226EEC1D9007B2231 /* JSResizeObserverOptions.h */,
+				0FD6A67B26EEC075007B2231 /* JSResizeObserverSize.cpp */,
+				0FD6A67D26EEC076007B2231 /* JSResizeObserverSize.h */,
 				BCEC01C00C274DDD009F4EC9 /* JSScreen.cpp */,
 				BCEC01C10C274DDD009F4EC9 /* JSScreen.h */,
 				83E9B3001DA5A51E00FFE8D4 /* JSScrollBehavior.cpp */,
@@ -33390,8 +33420,11 @@
 				46BCBBC22085008F00710638 /* JSRemoteDOMWindowBase.h in Headers */,
 				4998AECE13F9D6C90090B1AA /* JSRequestAnimationFrameCallback.h in Headers */,
 				58B2FA042232D9BE00938D63 /* JSResizeObserver.h in Headers */,
+				0FD6A68826EEC22B007B2231 /* JSResizeObserverBoxOptions.h in Headers */,
 				58B2FA062232DC5500938D63 /* JSResizeObserverCallback.h in Headers */,
 				58B2FA052232DC4F00938D63 /* JSResizeObserverEntry.h in Headers */,
+				0FD6A68526EEC221007B2231 /* JSResizeObserverOptions.h in Headers */,
+				0FD6A68726EEC226007B2231 /* JSResizeObserverSize.h in Headers */,
 				57E233711DCD468F00F28D01 /* JSRsaHashedImportParams.h in Headers */,
 				5768E4341DB7524500D0A4F7 /* JSRsaHashedKeyGenParams.h in Headers */,
 				57FEDD411DB6D73A00EB96F5 /* JSRsaKeyGenParams.h in Headers */,
@@ -34622,8 +34655,11 @@
 				F55B3DD01251F12D003EF269 /* ResetInputType.h in Headers */,
 				58B2F9F42232D45300938D63 /* ResizeObservation.h in Headers */,
 				58B2F9F52232D45800938D63 /* ResizeObserver.h in Headers */,
+				0FD6A68C26EEC37F007B2231 /* ResizeObserverBoxOptions.h in Headers */,
 				58B2F9F62232D45C00938D63 /* ResizeObserverCallback.h in Headers */,
 				58B2F9F72232D46100938D63 /* ResizeObserverEntry.h in Headers */,
+				0FD6A68A26EEC32B007B2231 /* ResizeObserverOptions.h in Headers */,
+				0FD6A68E26EEC5E9007B2231 /* ResizeObserverSize.h in Headers */,
 				7C2FA6121EA95A3C00A03108 /* ResourceCryptographicDigest.h in Headers */,
 				7EE6846A12D26E3800E79415 /* ResourceError.h in Headers */,
 				934F713C0D5A6F1900018D69 /* ResourceErrorBase.h in Headers */,

Modified: trunk/Source/WebCore/page/ResizeObservation.cpp (282440 => 282441)


--- trunk/Source/WebCore/page/ResizeObservation.cpp	2021-09-15 06:14:11 UTC (rev 282440)
+++ trunk/Source/WebCore/page/ResizeObservation.cpp	2021-09-15 06:16:57 UTC (rev 282441)
@@ -26,6 +26,7 @@
 #include "config.h"
 
 #if ENABLE(RESIZE_OBSERVER)
+
 #include "ResizeObservation.h"
 
 #include "HTMLFrameOwnerElement.h"
@@ -34,38 +35,42 @@
 
 namespace WebCore {
 
-Ref<ResizeObservation> ResizeObservation::create(Element& target)
+Ref<ResizeObservation> ResizeObservation::create(Element& target, ResizeObserverBoxOptions observedBox)
 {
-    return adoptRef(*new ResizeObservation(target));
+    return adoptRef(*new ResizeObservation(target, observedBox));
 }
 
-ResizeObservation::ResizeObservation(Element& element)
+ResizeObservation::ResizeObservation(Element& element, ResizeObserverBoxOptions observedBox)
     : m_target { makeWeakPtr(element) }
+    , m_observedBox { observedBox }
 {
 }
 
-ResizeObservation::~ResizeObservation()
-{
-}
+ResizeObservation::~ResizeObservation() = default;
 
-void ResizeObservation::updateObservationSize(const LayoutSize& size)
+void ResizeObservation::updateObservationSize(const BoxSizes& boxSizes)
 {
-    m_lastObservationSize = size;
+    m_lastObservationSizes = boxSizes;
 }
 
-LayoutSize ResizeObservation::computeObservedSize() const
+auto ResizeObservation::computeObservedSizes() const -> BoxSizes
 {
     if (m_target->isSVGElement()) {
-        if (auto svgRect = downcast<SVGElement>(*m_target).getBoundingBox())
-            return LayoutSize(svgRect->width(), svgRect->height());
+        if (auto svgRect = downcast<SVGElement>(*m_target).getBoundingBox()) {
+            auto size = LayoutSize(svgRect->width(), svgRect->height());
+            return { size, size, size };
+        }
     }
     auto* box = m_target->renderBox();
     if (box) {
-        auto contentSize = box->contentSize();
-        return LayoutSize(adjustLayoutUnitForAbsoluteZoom(contentSize.width(), *box), adjustLayoutUnitForAbsoluteZoom(contentSize.height(), *box));
+        return {
+            adjustLayoutSizeForAbsoluteZoom(box->contentSize(), *box),
+            adjustLayoutSizeForAbsoluteZoom(box->contentLogicalSize(), *box),
+            adjustLayoutSizeForAbsoluteZoom(box->borderBoxLogicalSize(), *box)
+        };
     }
 
-    return LayoutSize();
+    return { };
 }
 
 LayoutPoint ResizeObservation::computeTargetLocation() const
@@ -80,15 +85,42 @@
 
 FloatRect ResizeObservation::computeContentRect() const
 {
-    return FloatRect(FloatPoint(computeTargetLocation()), FloatSize(m_lastObservationSize));
+    return FloatRect(FloatPoint(computeTargetLocation()), FloatSize(m_lastObservationSizes.contentBoxSize));
 }
 
-bool ResizeObservation::elementSizeChanged(LayoutSize& currentSize) const
+FloatSize ResizeObservation::borderBoxSize() const
 {
-    currentSize = computeObservedSize();
-    return m_lastObservationSize != currentSize;
+    return m_lastObservationSizes.borderBoxLogicalSize;
 }
 
+FloatSize ResizeObservation::contentBoxSize() const
+{
+    return m_lastObservationSizes.contentBoxLogicalSize;
+}
+
+FloatSize ResizeObservation::snappedContentBoxSize() const
+{
+    return m_lastObservationSizes.contentBoxLogicalSize; // FIXME: Need to pixel snap.
+}
+
+std::optional<ResizeObservation::BoxSizes> ResizeObservation::elementSizeChanged() const
+{
+    auto currentSizes = computeObservedSizes();
+
+    switch (m_observedBox) {
+    case ResizeObserverBoxOptions::BorderBox:
+        if (m_lastObservationSizes.borderBoxLogicalSize != currentSizes.borderBoxLogicalSize)
+            return currentSizes;
+        break;
+    case ResizeObserverBoxOptions::ContentBox:
+        if (m_lastObservationSizes.contentBoxLogicalSize != currentSizes.contentBoxLogicalSize)
+            return currentSizes;
+        break;
+    }
+
+    return { };
+}
+
 size_t ResizeObservation::targetElementDepth() const
 {
     unsigned depth = 0;

Modified: trunk/Source/WebCore/page/ResizeObservation.h (282440 => 282441)


--- trunk/Source/WebCore/page/ResizeObservation.h	2021-09-15 06:14:11 UTC (rev 282440)
+++ trunk/Source/WebCore/page/ResizeObservation.h	2021-09-15 06:16:57 UTC (rev 282441)
@@ -26,8 +26,10 @@
 #pragma once
 
 #if ENABLE(RESIZE_OBSERVER)
+
 #include "FloatRect.h"
 #include "LayoutSize.h"
+#include "ResizeObserverBoxOptions.h"
 
 #include <wtf/RefCounted.h>
 #include <wtf/WeakPtr.h>
@@ -39,24 +41,37 @@
 class ResizeObservation : public RefCounted<ResizeObservation> {
     WTF_MAKE_FAST_ALLOCATED;
 public:
-    static Ref<ResizeObservation> create(Element& target);
+    static Ref<ResizeObservation> create(Element& target, ResizeObserverBoxOptions);
 
     ~ResizeObservation();
+    
+    struct BoxSizes {
+        LayoutSize contentBoxSize;
+        LayoutSize contentBoxLogicalSize;
+        LayoutSize borderBoxLogicalSize;
+    };
 
-    void updateObservationSize(const LayoutSize&);
-    LayoutSize computeObservedSize() const;
-    LayoutPoint computeTargetLocation() const;
+    std::optional<BoxSizes> elementSizeChanged() const;
+    void updateObservationSize(const BoxSizes&);
+
     FloatRect computeContentRect() const;
+    FloatSize borderBoxSize() const;
+    FloatSize contentBoxSize() const;
+    FloatSize snappedContentBoxSize() const;
 
-    bool elementSizeChanged(LayoutSize&) const;
     Element* target() const { return m_target.get(); }
+    ResizeObserverBoxOptions observedBox() const { return m_observedBox; }
     size_t targetElementDepth() const;
 
 private:
-    ResizeObservation(Element& target);
+    ResizeObservation(Element&, ResizeObserverBoxOptions);
 
+    BoxSizes computeObservedSizes() const;
+    LayoutPoint computeTargetLocation() const;
+
     WeakPtr<Element> m_target;
-    LayoutSize m_lastObservationSize;
+    BoxSizes m_lastObservationSizes;
+    ResizeObserverBoxOptions m_observedBox;
 };
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/page/ResizeObserver.cpp (282440 => 282441)


--- trunk/Source/WebCore/page/ResizeObserver.cpp	2021-09-15 06:14:11 UTC (rev 282440)
+++ trunk/Source/WebCore/page/ResizeObserver.cpp	2021-09-15 06:16:57 UTC (rev 282441)
@@ -31,6 +31,7 @@
 #include "Element.h"
 #include "InspectorInstrumentation.h"
 #include "ResizeObserverEntry.h"
+#include "ResizeObserverOptions.h"
 #include <_javascript_Core/AbstractSlotVisitorInlines.h>
 
 namespace WebCore {
@@ -53,7 +54,8 @@
         m_document->removeResizeObserver(*this);
 }
 
-void ResizeObserver::observe(Element& target)
+// https://drafts.csswg.org/resize-observer/#dom-resizeobserver-observe
+void ResizeObserver::observe(Element& target, const ResizeObserverOptions& options)
 {
     if (!m_callback)
         return;
@@ -62,13 +64,19 @@
         return observation->target() == &target;
     });
 
-    if (position != notFound)
-        return;
+    if (position != notFound) {
+        // The spec suggests unconditionally unobserving here, but that causes a test failure:
+        // https://github.com/web-platform-tests/wpt/issues/30708
+        if (m_observations[position]->observedBox() == options.box)
+            return;
 
+        unobserve(target);
+    }
+
     auto& observerData = target.ensureResizeObserverData();
     observerData.observers.append(makeWeakPtr(this));
 
-    m_observations.append(ResizeObservation::create(target));
+    m_observations.append(ResizeObservation::create(target, options.box));
 
     if (m_document) {
         m_document->addResizeObserver(*this);
@@ -76,6 +84,7 @@
     }
 }
 
+// https://drafts.csswg.org/resize-observer/#dom-resizeobserver-unobserve
 void ResizeObserver::unobserve(Element& target)
 {
     if (!removeTarget(target))
@@ -84,6 +93,7 @@
     removeObservation(target);
 }
 
+// https://drafts.csswg.org/resize-observer/#dom-resizeobserver-disconnect
 void ResizeObserver::disconnect()
 {
     removeAllTargets();
@@ -99,11 +109,10 @@
     m_hasSkippedObservations = false;
     size_t minObservedDepth = maxElementDepth();
     for (const auto& observation : m_observations) {
-        LayoutSize currentSize;
-        if (observation->elementSizeChanged(currentSize)) {
+        if (auto currentSizes = observation->elementSizeChanged()) {
             size_t depth = observation->targetElementDepth();
             if (depth > deeperThan) {
-                observation->updateObservationSize(currentSize);
+                observation->updateObservationSize(*currentSizes);
                 m_activeObservations.append(observation.get());
                 m_activeObservationTargets.append(*observation->target());
                 minObservedDepth = std::min(depth, minObservedDepth);
@@ -119,7 +128,7 @@
     Vector<Ref<ResizeObserverEntry>> entries;
     for (const auto& observation : m_activeObservations) {
         ASSERT(observation->target());
-        entries.append(ResizeObserverEntry::create(observation->target(), observation->computeContentRect()));
+        entries.append(ResizeObserverEntry::create(observation->target(), observation->computeContentRect(), observation->borderBoxSize(), observation->contentBoxSize()));
     }
     m_activeObservations.clear();
     auto activeObservationTargets = std::exchange(m_activeObservationTargets, { });

Modified: trunk/Source/WebCore/page/ResizeObserver.h (282440 => 282441)


--- trunk/Source/WebCore/page/ResizeObserver.h	2021-09-15 06:14:11 UTC (rev 282440)
+++ trunk/Source/WebCore/page/ResizeObserver.h	2021-09-15 06:16:57 UTC (rev 282441)
@@ -44,6 +44,7 @@
 
 class Document;
 class Element;
+struct ResizeObserverOptions;
 
 struct ResizeObserverData {
     WTF_MAKE_STRUCT_FAST_ALLOCATED;
@@ -58,7 +59,7 @@
     bool hasObservations() const { return m_observations.size(); }
     bool hasActiveObservations() const { return m_activeObservations.size(); }
 
-    void observe(Element&);
+    void observe(Element&, const ResizeObserverOptions&);
     void unobserve(Element&);
     void disconnect();
     void targetDestroyed(Element&);

Modified: trunk/Source/WebCore/page/ResizeObserver.idl (282440 => 282441)


--- trunk/Source/WebCore/page/ResizeObserver.idl	2021-09-15 06:14:11 UTC (rev 282440)
+++ trunk/Source/WebCore/page/ResizeObserver.idl	2021-09-15 06:16:57 UTC (rev 282441)
@@ -35,7 +35,7 @@
 ] interface ResizeObserver {
     [CallWith=Document] constructor(ResizeObserverCallback callback);
 
-    undefined observe(Element target);
+    undefined observe(Element target, optional ResizeObserverOptions options);
     undefined unobserve(Element target);
     undefined disconnect();
 };

Added: trunk/Source/WebCore/page/ResizeObserverBoxOptions.h (0 => 282441)


--- trunk/Source/WebCore/page/ResizeObserverBoxOptions.h	                        (rev 0)
+++ trunk/Source/WebCore/page/ResizeObserverBoxOptions.h	2021-09-15 06:16:57 UTC (rev 282441)
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2021 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.
+ * 3.  Neither the name of Apple Inc. ("Apple") nor the names of
+ *     its contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE 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 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
+
+#if ENABLE(RESIZE_OBSERVER)
+
+namespace WebCore {
+
+enum class ResizeObserverBoxOptions : uint8_t {
+    BorderBox,
+    ContentBox,
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(RESIZE_OBSERVER)

Copied: trunk/Source/WebCore/page/ResizeObserverBoxOptions.idl (from rev 282440, trunk/Source/WebCore/page/ResizeObserverCallback.idl) (0 => 282441)


--- trunk/Source/WebCore/page/ResizeObserverBoxOptions.idl	                        (rev 0)
+++ trunk/Source/WebCore/page/ResizeObserverBoxOptions.idl	2021-09-15 06:16:57 UTC (rev 282441)
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 2021 Apple Inc.
+ *
+ * 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.
+ */
+
+// https://drafts.csswg.org/resize-observer/#enumdef-resizeobserverboxoptions
+enum ResizeObserverBoxOptions {
+    "border-box",
+    "content-box"
+    // "device-pixel-content-box" webkit.org/b/219005
+};

Modified: trunk/Source/WebCore/page/ResizeObserverCallback.idl (282440 => 282441)


--- trunk/Source/WebCore/page/ResizeObserverCallback.idl	2021-09-15 06:14:11 UTC (rev 282440)
+++ trunk/Source/WebCore/page/ResizeObserverCallback.idl	2021-09-15 06:16:57 UTC (rev 282441)
@@ -23,8 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// https://wicg.github.io/ResizeObserver/
-
+// https://drafts.csswg.org/resize-observer/#resize-observer-callback
 [
     Conditional=RESIZE_OBSERVER,
     CallbackThisObject=ResizeObserver,

Modified: trunk/Source/WebCore/page/ResizeObserverEntry.h (282440 => 282441)


--- trunk/Source/WebCore/page/ResizeObserverEntry.h	2021-09-15 06:14:11 UTC (rev 282440)
+++ trunk/Source/WebCore/page/ResizeObserverEntry.h	2021-09-15 06:16:57 UTC (rev 282441)
@@ -30,32 +30,42 @@
 #include "DOMRectReadOnly.h"
 #include "Element.h"
 #include "FloatRect.h"
+#include "ResizeObserverSize.h"
 #include <wtf/RefCounted.h>
 
 namespace WebCore {
 
 class Element;
+class ResizeObserverSize;
 
 class ResizeObserverEntry : public RefCounted<ResizeObserverEntry> {
     WTF_MAKE_FAST_ALLOCATED;
 public:
-    static Ref<ResizeObserverEntry> create(Element* target, const FloatRect& contentRect)
+    static Ref<ResizeObserverEntry> create(Element* target, const FloatRect& contentRect, FloatSize borderBoxSize, FloatSize contentBoxSize)
     {
-        return adoptRef(*new ResizeObserverEntry(target, contentRect));
+        return adoptRef(*new ResizeObserverEntry(target, contentRect, borderBoxSize, contentBoxSize));
     }
 
     Element* target() const { return m_target.get(); }
-    DOMRectReadOnly* contentRect() const { return m_contentRect.get(); }
+    DOMRectReadOnly* contentRect() const { return m_contentRect.ptr(); }
+    
+    const Vector<Ref<ResizeObserverSize>>& borderBoxSize() const { return m_borderBoxSizes; }
+    const Vector<Ref<ResizeObserverSize>>& contentBoxSize() const { return m_contentBoxSizes; }
 
 private:
-    ResizeObserverEntry(Element* target, const FloatRect& contentRect)
+    ResizeObserverEntry(Element* target, const FloatRect& contentRect, FloatSize borderBoxSize, FloatSize contentBoxSize)
         : m_target(target)
         , m_contentRect(DOMRectReadOnly::create(contentRect.x(), contentRect.y(), contentRect.width(), contentRect.height()))
+        , m_borderBoxSizes({ ResizeObserverSize::create(borderBoxSize.width(), borderBoxSize.height()) })
+        , m_contentBoxSizes({ ResizeObserverSize::create(contentBoxSize.width(), contentBoxSize.height()) })
     {
     }
 
     RefPtr<Element> m_target;
-    RefPtr<DOMRectReadOnly> m_contentRect;
+    Ref<DOMRectReadOnly> m_contentRect;
+    // The spec is designed to allow mulitple boxes for multicol scenarios, but for now these vectors only ever contain one entry.
+    Vector<Ref<ResizeObserverSize>> m_borderBoxSizes;
+    Vector<Ref<ResizeObserverSize>> m_contentBoxSizes;
 };
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/page/ResizeObserverEntry.idl (282440 => 282441)


--- trunk/Source/WebCore/page/ResizeObserverEntry.idl	2021-09-15 06:14:11 UTC (rev 282440)
+++ trunk/Source/WebCore/page/ResizeObserverEntry.idl	2021-09-15 06:16:57 UTC (rev 282441)
@@ -23,8 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// https://wicg.github.io/ResizeObserver/
-
+// https://drafts.csswg.org/resize-observer/#resize-observer-entry-interface
 [
     Conditional=RESIZE_OBSERVER,
     ImplementationLacksVTable,
@@ -34,4 +33,6 @@
 ] interface ResizeObserverEntry {
     readonly attribute Element target;
     readonly attribute DOMRectReadOnly contentRect;
+    readonly attribute FrozenArray<ResizeObserverSize> borderBoxSize;
+    readonly attribute FrozenArray<ResizeObserverSize> contentBoxSize;
 };

Added: trunk/Source/WebCore/page/ResizeObserverOptions.h (0 => 282441)


--- trunk/Source/WebCore/page/ResizeObserverOptions.h	                        (rev 0)
+++ trunk/Source/WebCore/page/ResizeObserverOptions.h	2021-09-15 06:16:57 UTC (rev 282441)
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2021 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.
+ * 3.  Neither the name of Apple Inc. ("Apple") nor the names of
+ *     its contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE 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 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
+
+#if ENABLE(RESIZE_OBSERVER)
+
+#include "ResizeObserverBoxOptions.h"
+
+namespace WebCore {
+
+struct ResizeObserverOptions {
+    ResizeObserverBoxOptions box;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(RESIZE_OBSERVER)

Copied: trunk/Source/WebCore/page/ResizeObserverOptions.idl (from rev 282440, trunk/Source/WebCore/page/ResizeObserverCallback.idl) (0 => 282441)


--- trunk/Source/WebCore/page/ResizeObserverOptions.idl	                        (rev 0)
+++ trunk/Source/WebCore/page/ResizeObserverOptions.idl	2021-09-15 06:16:57 UTC (rev 282441)
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 2021 Apple Inc.
+ *
+ * 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.
+ */
+
+// https://drafts.csswg.org/resize-observer/#dictdef-resizeobserveroptions
+[
+    Conditional=RESIZE_OBSERVER,
+] dictionary ResizeObserverOptions {
+    ResizeObserverBoxOptions box = "content-box";
+};

Added: trunk/Source/WebCore/page/ResizeObserverSize.h (0 => 282441)


--- trunk/Source/WebCore/page/ResizeObserverSize.h	                        (rev 0)
+++ trunk/Source/WebCore/page/ResizeObserverSize.h	2021-09-15 06:16:57 UTC (rev 282441)
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2021 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.
+ * 3.  Neither the name of Apple Inc. ("Apple") nor the names of
+ *     its contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE 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 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
+
+#if ENABLE(RESIZE_OBSERVER)
+
+#include <wtf/RefCounted.h>
+
+namespace WebCore {
+
+class ResizeObserverSize : public RefCounted<ResizeObserverSize> {
+public:
+    static Ref<ResizeObserverSize> create(double inlineSize, double blockSize)
+    {
+        return adoptRef(*new ResizeObserverSize(inlineSize, blockSize));
+    }
+    
+    virtual ~ResizeObserverSize() = default;
+
+    double inlineSize() const { return m_inlineSize; }
+    double blockSize() const { return m_blockSize; }
+
+private:
+    ResizeObserverSize(double inlineSize, double blockSize)
+        : m_inlineSize(inlineSize)
+        , m_blockSize(blockSize)
+    {
+    }
+        
+    double m_inlineSize { 0 };
+    double m_blockSize { 0 };
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(RESIZE_OBSERVER)

Copied: trunk/Source/WebCore/page/ResizeObserverSize.idl (from rev 282440, trunk/Source/WebCore/page/ResizeObserverCallback.idl) (0 => 282441)


--- trunk/Source/WebCore/page/ResizeObserverSize.idl	                        (rev 0)
+++ trunk/Source/WebCore/page/ResizeObserverSize.idl	2021-09-15 06:16:57 UTC (rev 282441)
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2021 Apple Inc.
+ *
+ * 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.
+ */
+
+// https://drafts.csswg.org/resize-observer/#resizeobserversize
+[
+    Exposed=Window,
+    Conditional=RESIZE_OBSERVER
+] interface ResizeObserverSize {
+    readonly attribute unrestricted double inlineSize;
+    readonly attribute unrestricted double blockSize;
+};

Modified: trunk/Source/WebCore/rendering/RenderBox.h (282440 => 282441)


--- trunk/Source/WebCore/rendering/RenderBox.h	2021-09-15 06:14:11 UTC (rev 282440)
+++ trunk/Source/WebCore/rendering/RenderBox.h	2021-09-15 06:16:57 UTC (rev 282441)
@@ -138,6 +138,7 @@
     LayoutPoint location() const { return m_frameRect.location(); }
     LayoutSize locationOffset() const { return LayoutSize(x(), y()); }
     LayoutSize size() const { return m_frameRect.size(); }
+    LayoutSize logicalSize() const { return style().isHorizontalWritingMode() ? m_frameRect.size() : m_frameRect.size().transposedSize(); }
 
     void setLocation(const LayoutPoint& location) { m_frameRect.setLocation(location); }
     
@@ -157,6 +158,7 @@
     }
     LayoutRect borderBoxRect() const { return LayoutRect(LayoutPoint(), size()); }
     LayoutRect borderBoundingBox() const final { return borderBoxRect(); }
+    LayoutSize borderBoxLogicalSize() const { return logicalSize(); }
 
     WEBCORE_EXPORT RoundedRect::Radii borderRadii() const;
     RoundedRect roundedBorderBoxRect() const;
@@ -221,6 +223,7 @@
     LayoutSize contentSize() const { return { contentWidth(), contentHeight() }; }
     LayoutUnit contentWidth() const { return std::max(0_lu, paddingBoxWidth() - paddingLeft() - paddingRight()); }
     LayoutUnit contentHeight() const { return std::max(0_lu, paddingBoxHeight() - paddingTop() - paddingBottom()); }
+    LayoutSize contentLogicalSize() const { return style().isHorizontalWritingMode() ? contentSize() : contentSize().transposedSize(); }
     LayoutUnit contentLogicalWidth() const { return style().isHorizontalWritingMode() ? contentWidth() : contentHeight(); }
     LayoutUnit contentLogicalHeight() const { return style().isHorizontalWritingMode() ? contentHeight() : contentWidth(); }
 

Modified: trunk/Source/WebCore/rendering/RenderElement.h (282440 => 282441)


--- trunk/Source/WebCore/rendering/RenderElement.h	2021-09-15 06:14:11 UTC (rev 282440)
+++ trunk/Source/WebCore/rendering/RenderElement.h	2021-09-15 06:16:57 UTC (rev 282441)
@@ -531,6 +531,11 @@
     return adjustLayoutUnitForAbsoluteZoom(value, renderer.style());
 }
 
+inline LayoutSize adjustLayoutSizeForAbsoluteZoom(LayoutSize size, const RenderElement& renderer)
+{
+    return adjustLayoutSizeForAbsoluteZoom(size, renderer.style());
+}
+
 inline RenderObject* RenderElement::firstInFlowChild() const
 {
     if (auto* firstChild = this->firstChild()) {

Modified: trunk/Source/WebCore/rendering/style/RenderStyle.h (282440 => 282441)


--- trunk/Source/WebCore/rendering/style/RenderStyle.h	2021-09-15 06:14:11 UTC (rev 282440)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.h	2021-09-15 06:16:57 UTC (rev 282441)
@@ -2005,6 +2005,7 @@
 int adjustForAbsoluteZoom(int, const RenderStyle&);
 float adjustFloatForAbsoluteZoom(float, const RenderStyle&);
 LayoutUnit adjustLayoutUnitForAbsoluteZoom(LayoutUnit, const RenderStyle&);
+LayoutSize adjustLayoutSizeForAbsoluteZoom(LayoutSize, const RenderStyle&);
 
 BorderStyle collapsedBorderStyle(BorderStyle);
 
@@ -2127,6 +2128,15 @@
     return LayoutUnit(value / style.effectiveZoom());
 }
 
+inline LayoutSize adjustLayoutSizeForAbsoluteZoom(LayoutSize size, const RenderStyle& style)
+{
+    auto zoom = style.effectiveZoom();
+    return {
+        size.width() / zoom,
+        size.height() / zoom
+    };
+}
+
 inline BorderStyle collapsedBorderStyle(BorderStyle style)
 {
     if (style == BorderStyle::Outset)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to