Skip to content

Implement Element.currentCSSZoom #46925

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Ahmad-S792
Copy link
Contributor

@Ahmad-S792 Ahmad-S792 commented Jun 18, 2025

d7d1c83

Implement `Element.currentCSSZoom`
https://bugs.webkit.org/show_bug.cgi?id=279881
rdar://136662584

Reviewed by NOBODY (OOPS!).

This patch implements `currentCSSZoom` as per web specification [1] and
aligns with Gecko / Firefox and Blink / Chrome.

[1] https://drafts.csswg.org/cssom-view/#dom-element-currentcsszoom

This is implemented behind flag while being enabled on 'Safari Technology Preview'.

* Source/WebCore/dom/Element+CSSOMView.idl:
* Source/WebCore/dom/Element.cpp:
(WebCore::Element::currentCSSZoom):
* Source/WebCore/dom/Element.h:
* Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml: Enabled in `preview`
* LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/Element-currentCSSZoom-expected.txt: Progression
* LayoutTests/fast/zooming/currentCSSZoom-body-fixed-regression-test.html:
* LayoutTests/fast/zooming/currentCSSZoom-body-fixed-regression-test-expected.txt:

d7d1c83

Misc iOS, visionOS, tvOS & watchOS macOS Linux Windows
✅ 🧪 style ✅ 🛠 ios ✅ 🛠 mac loading 🛠 wpe loading 🛠 win
✅ 🧪 bindings ✅ 🛠 ios-sim ✅ 🛠 mac-AS-debug loading 🧪 wpe-wk2 loading 🧪 win-tests
✅ 🧪 webkitperl loading 🧪 ios-wk2 loading 🧪 api-mac loading 🧪 api-wpe
loading 🧪 ios-wk2-wpt ⏳ 🧪 mac-wk1 ✅ 🛠 wpe-cairo
loading 🛠 🧪 jsc loading 🧪 api-ios loading 🧪 mac-wk2 loading 🛠 gtk
✅ 🛠 🧪 jsc-arm64 ✅ 🛠 vision loading 🧪 mac-AS-debug-wk2 loading 🧪 gtk-wk2
✅ 🛠 vision-sim ✅ 🧪 mac-wk2-stress loading 🧪 api-gtk
✅ 🧪 vision-wk2 loading 🧪 mac-intel-wk2 loading 🛠 playstation
✅ 🛠 tv loading 🛠 mac-safer-cpp ✅ 🛠 jsc-armv7
✅ 🛠 tv-sim ✅ 🧪 jsc-armv7-tests
loading 🛠 watch
✅ 🛠 watch-sim

@Ahmad-S792 Ahmad-S792 requested review from rniwa and cdumez as code owners June 18, 2025 20:25
@Ahmad-S792 Ahmad-S792 self-assigned this Jun 18, 2025
@Ahmad-S792 Ahmad-S792 added the DOM For bugs specific to XML/HTML DOM elements (including parsing). label Jun 18, 2025
@webkit-early-warning-system

This comment was marked as outdated.

@Ahmad-S792 Ahmad-S792 force-pushed the eng/Implement-Element-currentCSSZoom branch from 6f5929a to f77668a Compare June 18, 2025 21:54
@webkit-early-warning-system

This comment was marked as outdated.

@Ahmad-S792 Ahmad-S792 requested review from smfr and nt1m June 19, 2025 01:18
Copy link
Contributor

@annevk annevk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this is adding a new feature, could you please add it behind a preference, enabled for preview for now?

@Ahmad-S792 Ahmad-S792 force-pushed the eng/Implement-Element-currentCSSZoom branch from f77668a to e69f85e Compare June 25, 2025 01:38
@Ahmad-S792 Ahmad-S792 force-pushed the eng/Implement-Element-currentCSSZoom branch from e69f85e to 1338bae Compare June 25, 2025 21:04
@Ahmad-S792
Copy link
Contributor Author

@annevk - Can you review this now?

@@ -1583,6 +1583,23 @@ int Element::clientHeight()
return 0;
}

double Element::currentCSSZoom()
{
protectedDocument()->updateStyleIfNeeded();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You want

Ref document = this->document() here as you also use document below to get the resolver. But then from that resolver you get a document again? Is that going to be a different document? Seems unlikely.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My interpretation is -> that whenever we come across this 'currentCSSZoom' function, if there is any pending document or anything then just go ahead and update Style and then later apply whatever is below.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That doesn't really answer the question. I don't think obtaining a resolver has any side effects. Updating style obviously does, but that's already done at that point.

https://bugs.webkit.org/show_bug.cgi?id=279881
rdar://136662584

Reviewed by NOBODY (OOPS!).

This patch implements `currentCSSZoom` as per web specification [1] and
aligns with Gecko / Firefox and Blink / Chrome.

[1] https://drafts.csswg.org/cssom-view/#dom-element-currentcsszoom

This is implemented behind flag while being enabled on 'Safari Technology Preview'.

* Source/WebCore/dom/Element+CSSOMView.idl:
* Source/WebCore/dom/Element.cpp:
(WebCore::Element::currentCSSZoom):
* Source/WebCore/dom/Element.h:
* Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml: Enabled in `preview`
* LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/Element-currentCSSZoom-expected.txt: Progression
* LayoutTests/fast/zooming/currentCSSZoom-body-fixed-regression-test.html:
* LayoutTests/fast/zooming/currentCSSZoom-body-fixed-regression-test-expected.txt:
@Ahmad-S792 Ahmad-S792 force-pushed the eng/Implement-Element-currentCSSZoom branch from 1338bae to d7d1c83 Compare July 1, 2025 03:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DOM For bugs specific to XML/HTML DOM elements (including parsing).
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants