Closed Bug 1545239 Opened 4 months ago Closed 4 months ago

Update ResizeObserver API to match the up-to-date spec

Categories

(Core :: Layout, enhancement, P3)

enhancement

Tracking

()

RESOLVED FIXED
mozilla68
Tracking Status
firefox68 --- fixed

People

(Reporter: boris, Assigned: boris)

References

()

Details

(Keywords: dev-doc-needed)

Attachments

(6 files, 1 obsolete file)

We have the initial implementation of Resize Observer API in Bug 1272409. However, it implemented for the old spec.

In order to match the current spec, we still need to update it:

  1. Support ResizeObserverBoxOptions, ResizeObserverOptions, ResizeObserverSize
  2. ResizeObserverEntry should have borderBoxSize and contentBoxSize
  3. Support more boxes, e.g. border-box.
Summary: Update ResizeObserver API to match the updated spec → Update ResizeObserver API to match the update-to-date spec
Summary: Update ResizeObserver API to match the update-to-date spec → Update ResizeObserver API to match the up-to-date spec

GetNodeDepth() is a special version for ResizeObserver to get the depth
of node (across Shadow DOM). Based on the comment in D27614, it's better
to move it into ResizeObserver.cpp.

In this patch, we support

  1. content-box (default)
  2. border-box

And let ResizeObserverEntry expose these box sizes.

Besides, we store the mLastReportedSize as the logical size.

Throw the error in the step function and finish the current test to avoid
triggering timeout if any assert_equals failed.

Besides, guard is not clear to me, so using a promise_test to wrap the
window property test.

Attachment #9060553 - Attachment description: Bug 1545239 - Add tests for border-box and vertical writing mode. → Bug 1545239 - Add tests for border-box and different writing modes.

Note: I noticed that Chrome disagrees with the spec on what happens when the writing mode changes. (and when that causes the logical size to change, vs. when it causes the physical size to change)

Right now Chrome only seems to notify when the physical size (e.g. the width) changes, even though the logical size may have remained the same (if e.g. width and height were swapped simultaneously with the writing-mode change).

I filed https://github.com/w3c/csswg-drafts/issues/3887 to get the spec clarified, because it's not really clear how writing-mode changes are supposed to be handled right now. Here's a testcase: https://jsfiddle.net/dholbert/ce094nxj/

Attachment #9060552 - Attachment is obsolete: true

I think it's better to make sure each test is independent from others, so we
create elements inside each test function. (Only change observe.html
because I touch only this file in this bug.)

Attached file wpt PR 16676
Pushed by bchiou@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/2e3522f77b0f
Move GetNodeDepth into ResizeObserver.cpp r=dholbert
https://hg.mozilla.org/integration/autoland/rev/dc3570e93c41
Update ResizeObserver and ResizeObserverEntry. r=smaug,dholbert
https://hg.mozilla.org/integration/autoland/rev/01338a1e26b7
Make each test cases independent in resize-observer/observe.html. r=dholbert
https://hg.mozilla.org/integration/autoland/rev/b34ea6abce97
Add tests for border-box and different writing modes. r=dholbert
https://hg.mozilla.org/integration/autoland/rev/a0c91ab4d347
Unobserve the target if using a different observed box. r=dholbert
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/16877 for changes under testing/web-platform/tests
Can't merge web-platform-tests PR due to failing upstream checks:
Github PR https://github.com/web-platform-tests/wpt/pull/16877
* Taskcluster (pull_request) (https://tools.taskcluster.net/task-group-inspector/#/IneQkuGBQquD4e5WsvnK3w)
Upstream PR merged
You need to log in before you can comment on or make changes to this bug.