Repository navigation
Implement ResizeObserver's devicePixelContentBox - #60534
Ahmad-S792 wants to merge 1 commit into
Conversation
|
EWS run on previous version of this PR (hash 680a62c) Details |
680a62c to
3c4881b
Compare
|
EWS run on previous version of this PR (hash 3c4881b) Details |
macOS Safer C++ Build #85795 (680a62c)❌ Found 1 failing file with 4 issues. Please address these issues before landing. See WebKit Guidelines for Safer C++ Programming. |
macOS Safer C++ Build #85813 (3c4881b)❌ Found 1 failing file with 4 issues. Please address these issues before landing. See WebKit Guidelines for Safer C++ Programming. |
iOS Safer C++ Build #4130 (3c4881b)❌ Found 1 failing file with 4 issues. Please address these issues before landing. See WebKit Guidelines for Safer C++ Programming. |
3c4881b to
0b23e33
Compare
|
EWS run on previous version of this PR (hash 0b23e33) Details
|
0b23e33 to
6088cb3
Compare
|
EWS run on previous version of this PR (hash 6088cb3) Details
|
6088cb3 to
ef07cca
Compare
|
EWS run on previous version of this PR (hash ef07cca) Details
|
| auto contentBoxLogicalSize = box->contentBoxLogicalSize(); | ||
| Ref document = box->document(); | ||
| auto deviceScaleFactor = document->deviceScaleFactor(); | ||
| auto absoluteContentBoxOrigin = box->localToAbsolute(FloatPoint(box->contentBoxLocation())); |
There was a problem hiding this comment.
This is expensive, and you're doing this even when ResizeObserverDevicePixelContentBoxEnabled is disabled.
There was a problem hiding this comment.
Yes - I wanted to get your input before doing further changes. Hence, I kept it in draft till now. Please share feedback, so I can address them one by one.
There was a problem hiding this comment.
@smfr - Changed approach, now it is gated with settings enablement and also in separate function and computed lazily (matching Blink).
ef07cca to
697a866
Compare
|
EWS run on previous version of this PR (hash 697a866) Details |
iOS Safer C++ Build #39154 (697a866)❌ Found 52 failing files with 1027 issues. Please address these issues before landing. See WebKit Guidelines for Safer C++ Programming. |
macOS Safer C++ Build #120218 (697a866)❌ Found 54 failing files with 1060 issues. Please address these issues before landing. See WebKit Guidelines for Safer C++ Programming. |
697a866 to
01aba5c
Compare
|
EWS run on previous version of this PR (hash 01aba5c) Details
|
https://bugs.webkit.org/show_bug.cgi?id=219005 rdar://71469186 Reviewed by NOBODY (OOPS!). This patch aligns WebKit with Web Specification [1]: [1] https://drafts.csswg.org/resize-observer/#dom-resizeobserverentry-devicepixelcontentboxsize This implements the device-pixel-content-box size reporting on ResizeObserverEntry, gated behind the ResizeObserverDevicePixelContentBoxEnabled testable feature flag. This adds the devicePixelContentBoxSize attribute to ResizeObserverEntry which reports the content box size in device pixel units (accounting for CSS zoom and device pixel ratio but not browser zoom). The "device-pixel-content-box" value is also added to ResizeObserverBoxOptions so observers can track changes at the device pixel level. Also fixes computeTargetLocation() to adjust padding values for CSS zoom so that contentRect.top/left report correct CSS pixel values for zoomed elements. For SVG elements, the bounding box is in user-space coordinates and does not include CSS zoom, so the device pixel size computation multiplies by the element's used zoom in addition to the device scale factor. Computing the device-pixel-content-box is comparatively expensive: for a RenderBox it needs the element's absolute position (localToAbsolute) to snap to the device pixel grid. So it is only computed when needed. The per-frame change detection in computeObservedSizes() only computes it when the observed box is the device-pixel-content-box. For other observed boxes it is computed once in ResizeObserver::gatherObservations(), for observations that are recorded for delivery (layout is clean there), and stored alongside the other sizes so that delivery just reads it, like borderBoxSize and contentBoxSize. It is skipped entirely for native observers (e.g. the contain-intrinsic-size observer) and when the setting is disabled, in which case ResizeObserverEntry also does not allocate the devicePixelContentBoxSize array. ResizeObservation::m_observedBox is moved before m_target so that it fits in the padding after the reference count, keeping ResizeObservation at 48 bytes on 64-bit platforms despite the larger BoxSizes. * Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml: * Source/WebCore/page/ResizeObservation.cpp: (WebCore::ResizeObservation::ResizeObservation): (WebCore::ResizeObservation::resetObservationSize): (WebCore::ResizeObservation::computeDevicePixelContentBoxLogicalSize const): (WebCore::ResizeObservation::computeObservedSizes const): (WebCore::ResizeObservation::computeTargetLocation const): (WebCore::ResizeObservation::devicePixelContentBoxSize const): (WebCore::ResizeObservation::elementSizeChanged const): (WebCore::operator<<): * Source/WebCore/page/ResizeObservation.h: * Source/WebCore/page/ResizeObserver.cpp: (WebCore::ResizeObserver::gatherObservations): (WebCore::ResizeObserver::deliverObservations): (WebCore::ResizeObserver::exposesDevicePixelContentBoxSize): * Source/WebCore/page/ResizeObserver.h: * Source/WebCore/page/ResizeObserverBoxOptions.h: * Source/WebCore/page/ResizeObserverBoxOptions.idl: * Source/WebCore/page/ResizeObserverEntry.h: (WebCore::ResizeObserverEntry::create): (WebCore::ResizeObserverEntry::ResizeObserverEntry): * Source/WebCore/page/ResizeObserverEntry.idl: > Progressions & Clean-up: * LayoutTests/TestExpectations: Unskipped tests * LayoutTests/imported/w3c/web-platform-tests/resize-observer/idlharness.window-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/resize-observer/observe-019-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/resize-observer/observe-020-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/resize-observer/zoom-expected.txt: * LayoutTests//imported/w3c/web-platform-tests/resize-observer/svg-expected.txt: * LayoutTests/platform/mac/imported/w3c/web-platform-tests/resize-observer/svg-expected.txt: Removed. > Adjustments: * LayoutTests/imported/w3c/web-platform-tests/resize-observer/devicepixel2.html: Updated to use `reftest-wait` to avoid flakiness / timing issue.
01aba5c to
6d0dfe8
Compare
|
EWS run on current version of this PR (hash 6d0dfe8) Details |
🛠 ios-apple
6d0dfe8
6d0dfe8