Skip to content

Commit

Permalink
[ResizeObserver] The initial value of the last reported size should b…
Browse files Browse the repository at this point in the history
…e -1x-1

https://bugs.webkit.org/show_bug.cgi?id=250836

Reviewed by NOBODY (OOPS!).

The conclusion of [1] indicates that when first observing an element with ResizeObserver,
lastReportedSize gets initialized with a -1 x -1 size.

[1] w3c/csswg-drafts#3664

* LayoutTests/imported/w3c/web-platform-tests/resize-observer/notify-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/resize-observer/observe-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/resize-observer/svg-expected.txt:
* LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/resize-observer/notify-expected.txt: Copied from LayoutTests/imported/w3c/web-platform-tests/resize-observer/notify-expected.txt.
* LayoutTests/platform/mac/imported/w3c/web-platform-tests/resize-observer/svg-expected.txt:
* Source/WebCore/page/ResizeObservation.cpp:
  • Loading branch information
cathiechen committed Jan 23, 2023
1 parent 6ecd79a commit 91f24ff
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,22 @@ ResizeObserver tests

t1
t2
t3 inline

Harness Error (TIMEOUT), message = null
t3
inline

PASS ResizeObserver implemented
NOTRUN guard
PASS guard
PASS test0: notification ordering
PASS test1: display:none triggers notification
PASS test2: remove/appendChild trigger notification
PASS test3: dimensions match
PASS test4: transform do not cause notifications
PASS test5: moving an element does not trigger notifications
FAIL test6: inline element notifies once with 0x0. assert_unreached: Timed out waiting for notification. (1000ms) Reached unreachable code
PASS test6: inline element notifies once with 0x0.
PASS test7: unobserve inside notify callback
PASS test8: observe inside notify callback
PASS test9: disconnect inside notify callback
PASS test10: element notifies when parent removed
PASS test11: display:none element should be notified
PASS test12: element sized 0x0 should be notified

Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ PASS test12: no observation is fired after the change of writing mode when box's
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
FAIL test16: observations fire once with 0x0 size for non-replaced inline elements assert_unreached: Timed out waiting for notification. (1000ms) Reached unreachable code
PASS test16: observations fire once with 0x0 size for non-replaced inline elements
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

Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,10 @@ 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
FAIL test11: observe svg non-displayable element assert_unreached: Timed out waiting for notification. (1000ms) Reached unreachable code
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
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

Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
ResizeObserver tests

t1
t2
t3
inline

PASS ResizeObserver implemented
PASS guard
PASS test0: notification ordering
PASS test1: display:none triggers notification
PASS test2: remove/appendChild trigger notification
PASS test3: dimensions match
PASS test4: transform do not cause notifications
PASS test5: moving an element does not trigger notifications
FAIL test6: inline element notifies once with 0x0. assert_unreached: Timed out waiting for notification. (1000ms) Reached unreachable code
PASS test7: unobserve inside notify callback
PASS test8: observe inside notify callback
PASS test9: disconnect inside notify callback
PASS test10: element notifies when parent removed
PASS test11: display:none element should be notified
PASS test12: element sized 0x0 should be notified

Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,10 @@ 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
FAIL test11: observe svg non-displayable element assert_unreached: Timed out waiting for notification. (1000ms) Reached unreachable code
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

1 change: 1 addition & 0 deletions Source/WebCore/page/ResizeObservation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ Ref<ResizeObservation> ResizeObservation::create(Element& target, ResizeObserver

ResizeObservation::ResizeObservation(Element& element, ResizeObserverBoxOptions observedBox)
: m_target { element }
, m_lastObservationSizes { LayoutSize(-1, -1), LayoutSize(-1, -1), LayoutSize(-1, -1) }
, m_observedBox { observedBox }
{
}
Expand Down

0 comments on commit 91f24ff

Please sign in to comment.