[webkit-reviews] review denied: [Bug 217529] Define image intrinsic aspect ratio by mapping to the `aspect-ratio` property. : [Attachment 429180] Patch
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Thu May 20 09:55:57 PDT 2021
Antti Koivisto <koivisto at iki.fi> has denied cathiechen
<cathiechen at igalia.com>'s request for review:
Bug 217529: Define image intrinsic aspect ratio by mapping to the
`aspect-ratio` property.
https://bugs.webkit.org/show_bug.cgi?id=217529
Attachment 429180: Patch
https://bugs.webkit.org/attachment.cgi?id=429180&action=review
--- Comment #14 from Antti Koivisto <koivisto at iki.fi> ---
Comment on attachment 429180
--> https://bugs.webkit.org/attachment.cgi?id=429180
Patch
View in context: https://bugs.webkit.org/attachment.cgi?id=429180&action=review
> Source/WebCore/style/StyleAdjuster.cpp:508
> + if (m_element &&
m_document.settings().aspectRatioOfImgFromWidthAndHeightEnabled() &&
style.aspectRatioType() == AspectRatioType::Auto) {
> + double attributeWidth = -1;
> + double attributeHeight = -1;
> + if (m_element->useWidthHeightAsAspectRatioHint(attributeWidth,
attributeHeight)) {
> + style.setAspectRatioType(AspectRatioType::AutoAndRatio);
> + style.setAspectRatio(attributeWidth, attributeHeight);
> + }
> + }
"When the text below says that a pair of attributes w and h on an element
element map to the aspect-ratio property (using dimension rules), it means that
if element has both attributes w and h, and parsing those attributes' values
using the rules for parsing dimension values doesn't generate an error or
return a percentage for either, then the user agent is expected to use the
parsed dimensions as a presentational hint for the 'aspect-ratio' property of
the form auto w / h."
So the concept used in the spec here is "presentational hint",
https://html.spec.whatwg.org/#the-css-user-agent-style-sheet-and-presentational
-hints
It is the same concept as used for stuff like <body bgcolor="blue">
In WebKit this is implemented as Element::presentationAttributeStyle(). To
generate it correctly see for example
HTMLBodyElement::collectStyleForPresentationAttribute.
You shouldn't need anything in style adjuster for this feature.
More information about the webkit-reviews
mailing list