Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 49df8515af2f2669b932dafb26b26d7d2c5e5dfd
      
https://github.com/WebKit/WebKit/commit/49df8515af2f2669b932dafb26b26d7d2c5e5dfd
  Author: Sammy Gill <[email protected]>
  Date:   2025-10-28 (Tue, 28 Oct 2025)

  Changed paths:
    M LayoutTests/TestExpectations
    M LayoutTests/fast/css/viewport-units-zoom.html
    M 
LayoutTests/imported/w3c/web-platform-tests/css/css-values/animations/line-height-lh-transition-expected.txt
    M 
LayoutTests/imported/w3c/web-platform-tests/css/css-viewport/zoom/length-implicit-and-explicit-inheritance-expected.txt
    M 
LayoutTests/imported/w3c/web-platform-tests/css/css-viewport/zoom/relative-units-expected.txt
    M 
LayoutTests/imported/w3c/web-platform-tests/css/css-viewport/zoom/relative-units.html
    M 
LayoutTests/imported/w3c/web-platform-tests/css/css-viewport/zoom/svg-computed-style-expected.txt
    M 
LayoutTests/imported/w3c/web-platform-tests/css/css-viewport/zoom/svg-computed-style.html
    M Source/WebCore/html/NumberInputType.cpp
    M Source/WebCore/html/SearchInputType.cpp
    M Source/WebCore/layout/formattingContexts/FormattingGeometry.cpp
    M Source/WebCore/layout/formattingContexts/FormattingGeometry.h
    M Source/WebCore/layout/formattingContexts/block/BlockFormattingGeometry.cpp
    M Source/WebCore/layout/formattingContexts/block/BlockFormattingQuirks.cpp
    M Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp
    M Source/WebCore/layout/formattingContexts/grid/GridFormattingContext.cpp
    M Source/WebCore/layout/formattingContexts/grid/GridLayoutUtils.cpp
    M Source/WebCore/layout/formattingContexts/grid/PlacedGridItem.cpp
    M Source/WebCore/layout/formattingContexts/grid/PlacedGridItem.h
    M Source/WebCore/layout/formattingContexts/table/TableFormattingContext.cpp
    M Source/WebCore/layout/formattingContexts/table/TableFormattingQuirks.cpp
    M Source/WebCore/layout/integration/flex/LayoutIntegrationFlexLayout.cpp
    M Source/WebCore/layout/layouttree/LayoutElementBox.cpp
    M Source/WebCore/page/Quirks.cpp
    M Source/WebCore/page/ios/ContentChangeObserver.cpp
    M Source/WebCore/rendering/AutoTableLayout.cpp
    M Source/WebCore/rendering/AutoTableLayout.h
    M Source/WebCore/rendering/FixedTableLayout.cpp
    M Source/WebCore/rendering/GridTrackSizingAlgorithm.cpp
    M Source/WebCore/rendering/RenderBlock.cpp
    M Source/WebCore/rendering/RenderBlockFlow.cpp
    M Source/WebCore/rendering/RenderBox.cpp
    M Source/WebCore/rendering/RenderBox.h
    M Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp
    M Source/WebCore/rendering/RenderElement.cpp
    M Source/WebCore/rendering/RenderFileUploadControl.cpp
    M Source/WebCore/rendering/RenderFlexibleBox.cpp
    M Source/WebCore/rendering/RenderGrid.cpp
    M Source/WebCore/rendering/RenderLayer.cpp
    M Source/WebCore/rendering/RenderListBox.cpp
    M Source/WebCore/rendering/RenderMenuList.cpp
    M Source/WebCore/rendering/RenderReplaced.cpp
    M Source/WebCore/rendering/RenderScrollbarPart.cpp
    M Source/WebCore/rendering/RenderSlider.cpp
    M Source/WebCore/rendering/RenderTable.cpp
    M Source/WebCore/rendering/RenderTableCell.cpp
    M Source/WebCore/rendering/RenderTableCell.h
    M Source/WebCore/rendering/RenderTableCellInlines.h
    M Source/WebCore/rendering/RenderTableSection.cpp
    M Source/WebCore/rendering/RenderTextControl.cpp
    M Source/WebCore/rendering/RenderTheme.cpp
    M Source/WebCore/rendering/RenderTheme.h
    M Source/WebCore/rendering/cocoa/RenderThemeCocoa.mm
    M Source/WebCore/rendering/ios/RenderThemeIOS.mm
    M Source/WebCore/rendering/mac/RenderThemeMac.mm
    M Source/WebCore/rendering/mathml/RenderMathMLBlock.cpp
    M Source/WebCore/rendering/style/AutosizeStatus.cpp
    M Source/WebCore/rendering/style/RenderStyle.cpp
    M Source/WebCore/rendering/svg/RenderSVGEllipse.cpp
    M Source/WebCore/rendering/svg/RenderSVGImage.cpp
    M Source/WebCore/rendering/svg/RenderSVGRect.cpp
    M Source/WebCore/rendering/svg/RenderSVGShape.cpp
    M Source/WebCore/rendering/svg/RenderSVGText.cpp
    M Source/WebCore/rendering/svg/SVGPathData.cpp
    M Source/WebCore/rendering/svg/SVGRenderSupport.cpp
    M Source/WebCore/rendering/svg/SVGRenderTreeAsText.cpp
    M Source/WebCore/rendering/svg/legacy/LegacyRenderSVGEllipse.cpp
    M Source/WebCore/rendering/svg/legacy/LegacyRenderSVGImage.cpp
    M Source/WebCore/rendering/svg/legacy/LegacyRenderSVGRect.cpp
    M Source/WebCore/rendering/svg/legacy/LegacyRenderSVGShape.cpp
    M Source/WebCore/rendering/updating/RenderTreeBuilder.cpp
    M Source/WebCore/style/values/flexbox/StyleFlexBasis.h
    M Source/WebCore/style/values/primitives/StyleLengthResolution.cpp
    M Source/WebCore/style/values/sizing/StyleMaximumSize.h
    M Source/WebCore/style/values/sizing/StyleMinimumSize.h
    M Source/WebCore/style/values/sizing/StylePreferredSize.h
    M Source/WebCore/svg/SVGLengthContext.cpp
    M Source/WebCore/svg/SVGLengthContext.h

  Log Message:
  -----------
  [CSS Zoom] Apply zoom to Preferred, Minimum, and Maximum sizes when evaluating
https://bugs.webkit.org/show_bug.cgi?id=300052
rdar://161848512

Reviewed by Tim Nguyen.

This patch marks the Preferred, Minimum, Maximum sizes as Unzoomed and
starts applying zoom at use time throughout the code. Since FlexBasis is
a superset of PreferredSize, that is also marked as unzoomed here.

Much of this patch is going through the various places, which is usually
layout code, and applying the used zoom value of the box we are
evaluating the property of. For example, if we need to evaluate the
width property of a box, we will need to supply its used zoom value. I
will not call out every single time this is done in the commit message
below, since that would mean I would be saying that we are just applying
the box's zoom value when evaluating its size, but I will call out some
interesting and notable cases where it is not completely as
straightforward as that.

* LayoutTests/TestExpectations:
* LayoutTests/fast/css/viewport-units-zoom.html:
I am disabling this test for now with this feature flag on since it is
incorrect with regards to CSS Zoom. I am currently working on rewriting
this test as part of https://bugs.webkit.org/show_bug.cgi?id=301404

* Source/WebCore/layout/formattingContexts/FormattingGeometry.cpp:
(WebCore::Layout::FormattingGeometry::computedHeightValue const):
Since this lambda walks up the containing block chain and potentially
returns the logical height of some ancestor it needs to be modified to
also return the zoom value associated with that ancestor too.

* Source/WebCore/rendering/AutoTableLayout.cpp:
It seems like the AutoTableLayout code will either evaluate sizes that
come from dedicated renderers (e.g. table cells) or from LayoutStruct,
which is a helper struct used to hold data for a column to be used
during layout. The former is fairly straightforward and we just grab
the zoom from the renderer just like much of the other rendering code.
For the latter we choose to store the used zoom associated with the
column in the struct so that it is easily accessible whenever we
evaluate the other sizes stored in it.

(WebCore::AutoTableLayout::recalcColumn):
When we evaluate a size from a cell we can use its zoom value since it
has its own dedicated renderer and style. At other times the code looks
at the data populated in the associated LayoutStruct for the column, so
we can use the usedZoom value that we stored in when this struct was
populated.

(WebCore::AutoTableLayout::fullRecalc):
Populate the LayoutStruct with the used zoom value that will be used
later whenever we evaluate the sizes stored here.

(WebCore::AutoTableLayout::applyPreferredLogicalWidthQuirks const):
(WebCore::AutoTableLayout::calcEffectiveLogicalWidth):
(WebCore::AutoTableLayout::layout):
* Source/WebCore/rendering/AutoTableLayout.h:
Add the used zoom value as part of the struct so that we can use it
whenever we evaluate the logicalWidth or effectiveLogicalWidth that also
lives in it. This struct gets populated with the column's data as part
of AutoTableLayout::fullRecalc.

* Source/WebCore/rendering/FixedTableLayout.cpp:
FixedTableLayout is basically separated into two distinct pieces with
regards to applying zoom. FixedTableLayout seems to use a list of sizes
which are computed from calcWidthArray and then ultimately ued inside
of layout(). Since it is computed by iterating over the
RenderTableCols, which are not trivially accessible during the code
that uses the widths inside of layout(), we choose to zoom the width
values here. Afterwards, we just use the values that were stored
without applying zoom to them.

* Source/WebCore/rendering/RenderTableCellInlines.h:
(WebCore::RenderTableCell::styleOrColLogicalWidth const):
We needed to refactor this function to return the zoom that needed to
be used by the caller. In the case where we return
logicalWidthFromColumns, we return a scale factor of 1.0f since those
values should already be zoomed.

(WebCore::RenderTextControl::computeIntrinsicLogicalWidths const):
* Source/WebCore/rendering/RenderTheme.cpp:
Much of the theme code worked by computing the size it wanted for the
form control, multiplying it by the used zoom, and then settings that
value on the form control's RenderStyle. Since we now apply the zoom
value at use time we can no longer do this and must remove the zoom from
the logic that determined the form control size. However, to make sure
this logic does not break when the feature flag is disabled we may need
to multiply the zoom factor in when it is disabled. In other words, any
call sites that directly used style.usedZoom() must first determine
whether evaluationTimeZoomed is enabled or not.

(WebCore::updateSliderTrackPartForRenderer):
(WebCore::RenderTheme::adjustButtonOrCheckboxOrColorWellOrInnerSpinButtonOrRadioStyle
 const):
(WebCore::RenderTheme::paintSliderTicks):
(WebCore::RenderTheme::adjustSwitchStyle const):
* Source/WebCore/rendering/RenderTheme.h:
(WebCore::RenderTheme::usedZoomForComputedStyle const):
* Source/WebCore/rendering/cocoa/RenderThemeCocoa.mm:
(WebCore::conversionDataForStyle):
Small helper to use the right conversion data when we are computing the
em size that is used to determine other dimensions.

(WebCore::RenderThemeCocoa::adjustInnerSpinButtonStyleForVectorBasedControls 
const):
(WebCore::RenderThemeCocoa::adjustButtonStyleForVectorBasedControls const):
We should not add in the zoom when evaluating fixedValue here since that
result may end up getting placed on the RenderStyle which would result
in a double zoom.

(WebCore::Style::computeNonCalcLengthDouble):
Since conversionData.computedLineHeightForFontUnits will eventually call
into RenderStyle::computeLineHeight, we cannot use it if the line-height
value is fixed since computeLineHeight will use the zoom factor. Instead
we need to manually convert it here since our conversionData should have
the right zoom factor to use.

* Source/WebCore/style/values/sizing/StyleMaximumSize.h:
* Source/WebCore/style/values/sizing/StyleMinimumSize.h:
* Source/WebCore/style/values/sizing/StylePreferredSize.h:
* Source/WebCore/svg/SVGLengthContext.cpp:
(WebCore::requires):
(WebCore::SVGLengthContext::valueForSizeType):
(WebCore::SVGLengthContext::valueForLength):
* Source/WebCore/svg/SVGLengthContext.h:

Canonical link: https://commits.webkit.org/302241@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to