Title: [233840] trunk/Source/WebCore
Revision
233840
Author
[email protected]
Date
2018-07-14 21:26:36 -0700 (Sat, 14 Jul 2018)

Log Message

Shrink StyleFillData, StyleStrokeData and StyleMiscData
https://bugs.webkit.org/show_bug.cgi?id=187681

Reviewed by Anders Carlsson.

Shrink these data structures by making more enum classes one byte in size, and
re-ordering. StyleFillData goes from 56 to 48, StyleStrokeData from 80 to 72,
StyleMiscData from 40 to 32 bytes.

* rendering/style/SVGRenderStyleDefs.cpp:
(WebCore::StyleFillData::StyleFillData):
(WebCore::StyleFillData::operator== const):
(WebCore::StyleStrokeData::StyleStrokeData):
(WebCore::StyleStrokeData::operator== const):
(WebCore::StyleStopData::operator== const):
(WebCore::StyleMiscData::StyleMiscData):
* rendering/style/SVGRenderStyleDefs.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (233839 => 233840)


--- trunk/Source/WebCore/ChangeLog	2018-07-15 02:13:40 UTC (rev 233839)
+++ trunk/Source/WebCore/ChangeLog	2018-07-15 04:26:36 UTC (rev 233840)
@@ -1,5 +1,25 @@
 2018-07-14  Simon Fraser  <[email protected]>
 
+        Shrink StyleFillData, StyleStrokeData and StyleMiscData
+        https://bugs.webkit.org/show_bug.cgi?id=187681
+
+        Reviewed by Anders Carlsson.
+
+        Shrink these data structures by making more enum classes one byte in size, and
+        re-ordering. StyleFillData goes from 56 to 48, StyleStrokeData from 80 to 72,
+        StyleMiscData from 40 to 32 bytes.
+
+        * rendering/style/SVGRenderStyleDefs.cpp:
+        (WebCore::StyleFillData::StyleFillData):
+        (WebCore::StyleFillData::operator== const):
+        (WebCore::StyleStrokeData::StyleStrokeData):
+        (WebCore::StyleStrokeData::operator== const):
+        (WebCore::StyleStopData::operator== const):
+        (WebCore::StyleMiscData::StyleMiscData):
+        * rendering/style/SVGRenderStyleDefs.h:
+
+2018-07-14  Simon Fraser  <[email protected]>
+
         Shrink CachedResource and subclasses
         https://bugs.webkit.org/show_bug.cgi?id=187546
 

Modified: trunk/Source/WebCore/rendering/style/SVGRenderStyleDefs.cpp (233839 => 233840)


--- trunk/Source/WebCore/rendering/style/SVGRenderStyleDefs.cpp	2018-07-15 02:13:40 UTC (rev 233839)
+++ trunk/Source/WebCore/rendering/style/SVGRenderStyleDefs.cpp	2018-07-15 04:26:36 UTC (rev 233840)
@@ -37,12 +37,12 @@
 
 StyleFillData::StyleFillData()
     : opacity(SVGRenderStyle::initialFillOpacity())
-    , paintType(SVGRenderStyle::initialFillPaintType())
     , paintColor(SVGRenderStyle::initialFillPaintColor())
+    , visitedLinkPaintColor(SVGRenderStyle::initialFillPaintColor())
     , paintUri(SVGRenderStyle::initialFillPaintUri())
+    , visitedLinkPaintUri(SVGRenderStyle::initialFillPaintUri())
+    , paintType(SVGRenderStyle::initialFillPaintType())
     , visitedLinkPaintType(SVGRenderStyle::initialStrokePaintType())
-    , visitedLinkPaintColor(SVGRenderStyle::initialFillPaintColor())
-    , visitedLinkPaintUri(SVGRenderStyle::initialFillPaintUri())
 {
 }
 
@@ -49,12 +49,12 @@
 inline StyleFillData::StyleFillData(const StyleFillData& other)
     : RefCounted<StyleFillData>()
     , opacity(other.opacity)
-    , paintType(other.paintType)
     , paintColor(other.paintColor)
+    , visitedLinkPaintColor(other.visitedLinkPaintColor)
     , paintUri(other.paintUri)
+    , visitedLinkPaintUri(other.visitedLinkPaintUri)
+    , paintType(other.paintType)
     , visitedLinkPaintType(other.visitedLinkPaintType)
-    , visitedLinkPaintColor(other.visitedLinkPaintColor)
-    , visitedLinkPaintUri(other.visitedLinkPaintUri)
 {
 }
 
@@ -65,25 +65,26 @@
 
 bool StyleFillData::operator==(const StyleFillData& other) const
 {
-    return opacity == other.opacity 
-        && paintType == other.paintType
+    return opacity == other.opacity
         && paintColor == other.paintColor
+        && visitedLinkPaintColor == other.visitedLinkPaintColor
         && paintUri == other.paintUri
-        && visitedLinkPaintType == other.visitedLinkPaintType
-        && visitedLinkPaintColor == other.visitedLinkPaintColor
-        && visitedLinkPaintUri == other.visitedLinkPaintUri;
+        && visitedLinkPaintUri == other.visitedLinkPaintUri
+        && paintType == other.paintType
+        && visitedLinkPaintType == other.visitedLinkPaintType;
+    
 }
 
 StyleStrokeData::StyleStrokeData()
     : opacity(SVGRenderStyle::initialStrokeOpacity())
+    , paintColor(SVGRenderStyle::initialStrokePaintColor())
+    , visitedLinkPaintColor(SVGRenderStyle::initialStrokePaintColor())
+    , paintUri(SVGRenderStyle::initialStrokePaintUri())
+    , visitedLinkPaintUri(SVGRenderStyle::initialStrokePaintUri())
     , dashOffset(RenderStyle::initialZeroLength())
     , dashArray(SVGRenderStyle::initialStrokeDashArray())
     , paintType(SVGRenderStyle::initialStrokePaintType())
-    , paintColor(SVGRenderStyle::initialStrokePaintColor())
-    , paintUri(SVGRenderStyle::initialStrokePaintUri())
     , visitedLinkPaintType(SVGRenderStyle::initialStrokePaintType())
-    , visitedLinkPaintColor(SVGRenderStyle::initialStrokePaintColor())
-    , visitedLinkPaintUri(SVGRenderStyle::initialStrokePaintUri())
 {
 }
 
@@ -90,14 +91,14 @@
 inline StyleStrokeData::StyleStrokeData(const StyleStrokeData& other)
     : RefCounted<StyleStrokeData>()
     , opacity(other.opacity)
+    , paintColor(other.paintColor)
+    , visitedLinkPaintColor(other.visitedLinkPaintColor)
+    , paintUri(other.paintUri)
+    , visitedLinkPaintUri(other.visitedLinkPaintUri)
     , dashOffset(other.dashOffset)
     , dashArray(other.dashArray)
     , paintType(other.paintType)
-    , paintColor(other.paintColor)
-    , paintUri(other.paintUri)
     , visitedLinkPaintType(other.visitedLinkPaintType)
-    , visitedLinkPaintColor(other.visitedLinkPaintColor)
-    , visitedLinkPaintUri(other.visitedLinkPaintUri)
 {
 }
 
@@ -109,14 +110,14 @@
 bool StyleStrokeData::operator==(const StyleStrokeData& other) const
 {
     return opacity == other.opacity
+        && paintColor == other.paintColor
+        && visitedLinkPaintColor == other.visitedLinkPaintColor
+        && paintUri == other.paintUri
+        && visitedLinkPaintUri == other.visitedLinkPaintUri
         && dashOffset == other.dashOffset
         && dashArray == other.dashArray
         && paintType == other.paintType
-        && paintColor == other.paintColor
-        && paintUri == other.paintUri
-        && visitedLinkPaintType == other.visitedLinkPaintType
-        && visitedLinkPaintColor == other.visitedLinkPaintColor
-        && visitedLinkPaintUri == other.visitedLinkPaintUri;
+        && visitedLinkPaintType == other.visitedLinkPaintType;
 }
 
 StyleStopData::StyleStopData()
@@ -139,8 +140,8 @@
 
 bool StyleStopData::operator==(const StyleStopData& other) const
 {
-    return color == other.color
-        && opacity == other.opacity;
+    return opacity == other.opacity
+        && color == other.color;
 }
 
 StyleTextData::StyleTextData()
@@ -165,8 +166,8 @@
 }
 
 StyleMiscData::StyleMiscData()
-    : floodColor(SVGRenderStyle::initialFloodColor())
-    , floodOpacity(SVGRenderStyle::initialFloodOpacity())
+    : floodOpacity(SVGRenderStyle::initialFloodOpacity())
+    , floodColor(SVGRenderStyle::initialFloodColor())
     , lightingColor(SVGRenderStyle::initialLightingColor())
     , baselineShiftValue(SVGRenderStyle::initialBaselineShiftValue())
 {
@@ -174,8 +175,8 @@
 
 inline StyleMiscData::StyleMiscData(const StyleMiscData& other)
     : RefCounted<StyleMiscData>()
+    , floodOpacity(other.floodOpacity)
     , floodColor(other.floodColor)
-    , floodOpacity(other.floodOpacity)
     , lightingColor(other.lightingColor)
     , baselineShiftValue(other.baselineShiftValue)
 {

Modified: trunk/Source/WebCore/rendering/style/SVGRenderStyleDefs.h (233839 => 233840)


--- trunk/Source/WebCore/rendering/style/SVGRenderStyleDefs.h	2018-07-15 02:13:40 UTC (rev 233839)
+++ trunk/Source/WebCore/rendering/style/SVGRenderStyleDefs.h	2018-07-15 04:26:36 UTC (rev 233840)
@@ -40,7 +40,7 @@
 class CSSValueList;
 class SVGPaint;
 
-enum class SVGPaintType {
+enum class SVGPaintType : uint8_t {
     RGBColor,
     None,
     CurrentColor,
@@ -50,7 +50,7 @@
     URI
 };
 
-enum class BaselineShift {
+enum class BaselineShift : uint8_t {
     Baseline,
     Sub,
     Super,
@@ -57,24 +57,25 @@
     Length
 };
 
-enum class TextAnchor {
+enum class TextAnchor : uint8_t {
     Start,
     Middle,
     End
 };
 
-enum class ColorInterpolation {
+enum class ColorInterpolation : uint8_t {
     Auto,
     SRGB,
     LinearRGB
 };
 
-enum class ColorRendering {
+enum class ColorRendering : uint8_t {
     Auto,
     OptimizeSpeed,
     OptimizeQuality
 };
-enum class ShapeRendering {
+
+enum class ShapeRendering : uint8_t {
     Auto,
     OptimizeSpeed,
     CrispEdges,
@@ -81,7 +82,7 @@
     GeometricPrecision
 };
 
-enum class GlyphOrientation {
+enum class GlyphOrientation : uint8_t {
     Degrees0,
     Degrees90,
     Degrees180,
@@ -89,7 +90,7 @@
     Auto
 };
 
-enum class AlignmentBaseline {
+enum class AlignmentBaseline : uint8_t {
     Auto,
     Baseline,
     BeforeEdge,
@@ -104,7 +105,7 @@
     Mathematical
 };
 
-enum class DominantBaseline {
+enum class DominantBaseline : uint8_t {
     Auto,
     UseScript,
     NoChange,
@@ -119,18 +120,18 @@
     TextBeforeEdge
 };
 
-enum class VectorEffect {
+enum class VectorEffect : uint8_t {
     None,
     NonScalingStroke
 };
 
-enum class BufferedRendering {
+enum class BufferedRendering : uint8_t {
     Auto,
     Dynamic,
     Static
 };
 
-enum class MaskType {
+enum class MaskType : uint8_t {
     Luminance,
     Alpha
 };
@@ -148,12 +149,12 @@
     }
 
     float opacity;
-    SVGPaintType paintType;
     Color paintColor;
+    Color visitedLinkPaintColor;
     String paintUri;
+    String visitedLinkPaintUri;
+    SVGPaintType paintType;
     SVGPaintType visitedLinkPaintType;
-    Color visitedLinkPaintColor;
-    String visitedLinkPaintUri;
 
 private:
     StyleFillData();
@@ -173,15 +174,17 @@
 
     float opacity;
 
+    Color paintColor;
+    Color visitedLinkPaintColor;
+
+    String paintUri;
+    String visitedLinkPaintUri;
+
     Length dashOffset;
     Vector<SVGLengthValue> dashArray;
 
     SVGPaintType paintType;
-    Color paintColor;
-    String paintUri;
     SVGPaintType visitedLinkPaintType;
-    Color visitedLinkPaintColor;
-    String visitedLinkPaintUri;
 
 private:
     StyleStrokeData();
@@ -237,8 +240,8 @@
         return !(*this == other);
     }
 
+    float floodOpacity;
     Color floodColor;
-    float floodOpacity;
     Color lightingColor;
 
     // non-inherited text stuff lives here not in StyleTextData.
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to