Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 5903d8eb1065a84ca796d840d7b0597f4ada0214
      
https://github.com/WebKit/WebKit/commit/5903d8eb1065a84ca796d840d7b0597f4ada0214
  Author: Sammy Gill <[email protected]>
  Date:   2026-01-07 (Wed, 07 Jan 2026)

  Changed paths:
    M Source/WebCore/style/computed/StyleComputedStyleBase+ConstructionInlines.h
    M Source/WebCore/style/computed/StyleComputedStyleBase+GettersInlines.h
    M Source/WebCore/style/computed/StyleComputedStyleBase+SettersInlines.h
    M Source/WebCore/style/computed/StyleComputedStyleBase.h

  Log Message:
  -----------
  [CSS Zoom] Store InheritedFlag to indicate zooming
https://bugs.webkit.org/show_bug.cgi?id=305017
rdar://164052832

Reviewed by Sam Weinig.

It seems that attempting to access the zoom value ends up causing a
performance regression on benchmarks, such as Speedometer 3. Whenever we
attempt to get the zoom value, for example during layout, we end up
calling into the style's InheritedRareData since that is where the
usedZoom (and previously deviceScaleFactor before 305180@main) value
lives.

However, it turns out that the common case for the benchmarks is
content that is unzoomed and if we end up avoiding this access we
recover from the regression. This patch attempts to avoid the accesses
to InheritedRareData during these hot codepaths by storing an additional
bit on InheritedFlags to indicate whether the content is zoomed. If it
is not we can just return a ZoomFactor of 1.0f instead of looking up the
value.

(WebCore::Style::ComputedStyleBase::ComputedStyleBase):
* Source/WebCore/style/computed/StyleComputedStyleBase+GettersInlines.h:
Just return a ZoomFactor(1.0f) if we are not zoomed as indicated by our
new bit.

(WebCore::Style::ComputedStyleBase::usedZoomForLength const):
* Source/WebCore/style/computed/StyleComputedStyleBase+SettersInlines.h:
Set the bit if the new zoom level we are setting is not 1.0f.

(WebCore::Style::ComputedStyleBase::setUsedZoom):
* Source/WebCore/style/computed/StyleComputedStyleBase.h:
dump-class-layout indicates that InheritedFlags is now 63 bits as
opposed to the 57 that would have been the new value with reference to
the comment here.

+0 <  8> WebCore::Style::ComputedStyleBase::InheritedFlags
+0 <  1>     WebCore::WritingMode writingMode
+0 <  1>         WebCore::WritingMode::Data m_bits
+1 < :3>     WebCore::WhiteSpaceCollapse whiteSpaceCollapse : 3
+1 < :1>     WebCore::TextWrapMode textWrapMode : 1
+1 < :4>     WebCore::Style::TextAlign textAlign : 4
+2 < :2>     WebCore::TextWrapStyle textWrapStyle : 2
+2 < :6>     unsigned char textTransform : 6
+3 < :1>     int None : 1
+3 < :5>     unsigned char textDecorationLineInEffect : 5
+3 < :2>     int None : 2
+4 < :4>     WebCore::PointerEvents pointerEvents : 4
+4 < :2>     WebCore::Visibility visibility : 2
+4 < :2>     int None : 2
+5 < :6>     WebCore::CursorType cursorType : 6
+5 < :1>     WebCore::CursorVisibility cursorVisibility : 1
+5 < :1>     WebCore::ListStylePosition listStylePosition : 1
+6 < :1>     WebCore::EmptyCell emptyCells : 1
+6 < :1>     WebCore::BorderCollapse borderCollapse : 1
+6 < :2>     WebCore::CaptionSide captionSide : 2
+6 < :1>     WebCore::BoxDirection boxDirection : 1
+6 < :1>     WebCore::Order rtlOrdering : 1
+6 < :1>     bool hasExplicitlySetColor : 1
+6 < :1>     WebCore::PrintColorAdjust printColorAdjust : 1
+7 < :2>     WebCore::InsideLink insideLink : 2
+7 < :5>     unsigned int autosizeStatus : 5
+7 < :1>     <UNUSED BITS: 1 bit>

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



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

Reply via email to