Title: [290861] trunk/Source/WebCore
Revision
290861
Author
[email protected]
Date
2022-03-04 21:39:27 -0800 (Fri, 04 Mar 2022)

Log Message

Optimize the padding in StyleRareInheritedData
https://bugs.webkit.org/show_bug.cgi?id=237488

Reviewed by Cameron McCormack.

Shrink StyleRareInheritedData from 280 bytes to 264 bytes on macOS.

Also fix a missing comparison of wordSpacing in operator==.

* rendering/style/StyleRareInheritedData.cpp:
(WebCore::StyleRareInheritedData::StyleRareInheritedData):
(WebCore::StyleRareInheritedData::operator== const):
* rendering/style/StyleRareInheritedData.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (290860 => 290861)


--- trunk/Source/WebCore/ChangeLog	2022-03-05 02:38:44 UTC (rev 290860)
+++ trunk/Source/WebCore/ChangeLog	2022-03-05 05:39:27 UTC (rev 290861)
@@ -1,3 +1,19 @@
+2022-03-04  Simon Fraser  <[email protected]>
+
+        Optimize the padding in StyleRareInheritedData
+        https://bugs.webkit.org/show_bug.cgi?id=237488
+
+        Reviewed by Cameron McCormack.
+
+        Shrink StyleRareInheritedData from 280 bytes to 264 bytes on macOS.
+        
+        Also fix a missing comparison of wordSpacing in operator==.
+
+        * rendering/style/StyleRareInheritedData.cpp:
+        (WebCore::StyleRareInheritedData::StyleRareInheritedData):
+        (WebCore::StyleRareInheritedData::operator== const):
+        * rendering/style/StyleRareInheritedData.h:
+
 2022-03-04  Tyler Wilcock  <[email protected]>
 
         AX: Protect incoming object with Ref in AXObjectCache::textChanged

Modified: trunk/Source/WebCore/rendering/style/StyleRareInheritedData.cpp (290860 => 290861)


--- trunk/Source/WebCore/rendering/style/StyleRareInheritedData.cpp	2022-03-05 02:38:44 UTC (rev 290860)
+++ trunk/Source/WebCore/rendering/style/StyleRareInheritedData.cpp	2022-03-05 05:39:27 UTC (rev 290861)
@@ -37,9 +37,9 @@
 namespace WebCore {
 
 struct GreaterThanOrSameSizeAsStyleRareInheritedData : public RefCounted<GreaterThanOrSameSizeAsStyleRareInheritedData> {
+    float firstFloat;
     void* styleImage;
     Color firstColor;
-    float firstFloat;
     Color colors[10];
     void* ownPtrs[1];
     AtomString atomStrings[6];
@@ -76,13 +76,14 @@
 DEFINE_ALLOCATOR_WITH_HEAP_IDENTIFIER(StyleRareInheritedData);
 
 StyleRareInheritedData::StyleRareInheritedData()
-    : listStyleImage(RenderStyle::initialListStyleImage())
+    : textStrokeWidth(RenderStyle::initialTextStrokeWidth())
+    , listStyleImage(RenderStyle::initialListStyleImage())
     , listStyleStringValue(RenderStyle::initialListStyleStringValue())
-    , textStrokeWidth(RenderStyle::initialTextStrokeWidth())
     , indent(RenderStyle::initialTextIndent())
     , effectiveZoom(RenderStyle::initialZoom())
     , textUnderlineOffset(RenderStyle::initialTextUnderlineOffset())
     , textDecorationThickness(RenderStyle::initialTextDecorationThickness())
+    , miterLimit(RenderStyle::initialStrokeMiterLimit())
     , customProperties(StyleCustomPropertyData::create())
     , widows(RenderStyle::initialWidows())
     , orphans(RenderStyle::initialOrphans())
@@ -142,10 +143,9 @@
     , effectiveTouchActions(RenderStyle::initialTouchActions())
     , strokeWidth(RenderStyle::initialStrokeWidth())
     , strokeColor(RenderStyle::initialStrokeColor())
-    , miterLimit(RenderStyle::initialStrokeMiterLimit())
-    , hyphenationLimitBefore(-1)
-    , hyphenationLimitAfter(-1)
-    , hyphenationLimitLines(-1)
+#if ENABLE(DARK_MODE_CSS)
+    , colorScheme(RenderStyle::initialColorScheme())
+#endif
     , appleColorFilter(StyleFilterData::create())
     , lineGrid(RenderStyle::initialLineGrid())
     , tabSize(RenderStyle::initialTabSize())
@@ -158,18 +158,15 @@
 #if ENABLE(TOUCH_EVENTS)
     , tapHighlightColor(RenderStyle::initialTapHighlightColor())
 #endif
-#if ENABLE(DARK_MODE_CSS)
-    , colorScheme(RenderStyle::initialColorScheme())
-#endif
 {
 }
 
 inline StyleRareInheritedData::StyleRareInheritedData(const StyleRareInheritedData& o)
     : RefCounted<StyleRareInheritedData>()
+    , textStrokeWidth(o.textStrokeWidth)
     , listStyleImage(o.listStyleImage)
     , listStyleStringValue(o.listStyleStringValue)
     , textStrokeColor(o.textStrokeColor)
-    , textStrokeWidth(o.textStrokeWidth)
     , textFillColor(o.textFillColor)
     , textEmphasisColor(o.textEmphasisColor)
     , visitedLinkTextStrokeColor(o.visitedLinkTextStrokeColor)
@@ -184,6 +181,7 @@
     , effectiveZoom(o.effectiveZoom)
     , textUnderlineOffset(o.textUnderlineOffset)
     , textDecorationThickness(o.textDecorationThickness)
+    , miterLimit(o.miterLimit)
     , customProperties(o.customProperties)
     , widows(o.widows)
     , orphans(o.orphans)
@@ -245,11 +243,13 @@
     , strokeWidth(o.strokeWidth)
     , strokeColor(o.strokeColor)
     , visitedLinkStrokeColor(o.visitedLinkStrokeColor)
-    , miterLimit(o.miterLimit)
     , hyphenationString(o.hyphenationString)
     , hyphenationLimitBefore(o.hyphenationLimitBefore)
     , hyphenationLimitAfter(o.hyphenationLimitAfter)
     , hyphenationLimitLines(o.hyphenationLimitLines)
+#if ENABLE(DARK_MODE_CSS)
+    , colorScheme(o.colorScheme)
+#endif
     , textEmphasisCustomMark(o.textEmphasisCustomMark)
     , appleColorFilter(o.appleColorFilter)
     , lineGrid(o.lineGrid)
@@ -263,9 +263,6 @@
 #if ENABLE(TOUCH_EVENTS)
     , tapHighlightColor(o.tapHighlightColor)
 #endif
-#if ENABLE(DARK_MODE_CSS)
-    , colorScheme(o.colorScheme)
-#endif
 {
 }
 
@@ -297,6 +294,8 @@
         && effectiveZoom == o.effectiveZoom
         && textUnderlineOffset == o.textUnderlineOffset
         && textDecorationThickness == o.textDecorationThickness
+        && wordSpacing == o.wordSpacing
+        && miterLimit == o.miterLimit
         && widows == o.widows
         && orphans == o.orphans
         && hasAutoWidows == o.hasAutoWidows
@@ -313,9 +312,6 @@
 #if ENABLE(TEXT_AUTOSIZING)
         && textSizeAdjust == o.textSizeAdjust
 #endif
-#if ENABLE(DARK_MODE_CSS)
-        && colorScheme == o.colorScheme
-#endif
         && userSelect == o.userSelect
         && speakAs == o.speakAs
         && hyphens == o.hyphens
@@ -322,6 +318,9 @@
         && hyphenationLimitBefore == o.hyphenationLimitBefore
         && hyphenationLimitAfter == o.hyphenationLimitAfter
         && hyphenationLimitLines == o.hyphenationLimitLines
+#if ENABLE(DARK_MODE_CSS)
+        && colorScheme == o.colorScheme
+#endif
         && textCombine == o.textCombine
         && textEmphasisFill == o.textEmphasisFill
         && textEmphasisMark == o.textEmphasisMark
@@ -373,7 +372,6 @@
         && strokeWidth == o.strokeWidth
         && strokeColor == o.strokeColor
         && visitedLinkStrokeColor == o.visitedLinkStrokeColor
-        && miterLimit == o.miterLimit
         && customProperties == o.customProperties
         && arePointingToEqualData(listStyleImage, o.listStyleImage)
         && listStyleStringValue == o.listStyleStringValue;

Modified: trunk/Source/WebCore/rendering/style/StyleRareInheritedData.h (290860 => 290861)


--- trunk/Source/WebCore/rendering/style/StyleRareInheritedData.h	2022-03-05 02:38:44 UTC (rev 290860)
+++ trunk/Source/WebCore/rendering/style/StyleRareInheritedData.h	2022-03-05 05:39:27 UTC (rev 290861)
@@ -72,11 +72,12 @@
 
     bool hasColorFilters() const;
 
+    float textStrokeWidth;
+
     RefPtr<StyleImage> listStyleImage;
     AtomString listStyleStringValue;
 
     Color textStrokeColor;
-    float textStrokeWidth;
     Color textFillColor;
     Color textEmphasisColor;
     
@@ -89,7 +90,7 @@
 
     Color accentColor;
 
-    std::unique_ptr<ShadowData> textShadow; // Our text shadow information for shadowed text drawing.
+    std::unique_ptr<ShadowData> textShadow;
     
     RefPtr<CursorList> cursorData;
     Length indent;
@@ -99,6 +100,7 @@
     TextDecorationThickness textDecorationThickness;
     
     Length wordSpacing;
+    float miterLimit;
 
     DataRef<StyleCustomPropertyData> customProperties;
 
@@ -176,13 +178,16 @@
     Length strokeWidth;
     Color strokeColor;
     Color visitedLinkStrokeColor;
-    float miterLimit;
 
     AtomString hyphenationString;
-    short hyphenationLimitBefore;
-    short hyphenationLimitAfter;
-    short hyphenationLimitLines;
+    short hyphenationLimitBefore { -1 };
+    short hyphenationLimitAfter { -1 };
+    short hyphenationLimitLines { -1 };
 
+#if ENABLE(DARK_MODE_CSS)
+    StyleColorScheme colorScheme;
+#endif
+
     AtomString textEmphasisCustomMark;
     RefPtr<QuotesData> quotes;
     DataRef<StyleFilterData> appleColorFilter;
@@ -202,10 +207,6 @@
     Color tapHighlightColor;
 #endif
 
-#if ENABLE(DARK_MODE_CSS)
-    StyleColorScheme colorScheme;
-#endif
-
 private:
     StyleRareInheritedData();
     StyleRareInheritedData(const StyleRareInheritedData&);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to