- Revision
- 233648
- Author
- [email protected]
- Date
- 2018-07-09 11:41:31 -0700 (Mon, 09 Jul 2018)
Log Message
Shrink CSSFontFace
https://bugs.webkit.org/show_bug.cgi?id=187456
Reviewed by Anders Carlsson.
Shrink CSSFontFace by 56 bytes, from 288 to 256 bytes, mostly by defining enums as 8-bit,
but also re-ordering the member variables. There are over 400 of these objects on nytimes.com,
so this saves about 22KB.
* css/CSSFontFace.cpp:
(WebCore::CSSFontFace::CSSFontFace):
* css/CSSFontFace.h:
* platform/text/TextFlags.h:
* rendering/style/RenderStyleConstants.h:
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (233647 => 233648)
--- trunk/Source/WebCore/ChangeLog 2018-07-09 18:21:01 UTC (rev 233647)
+++ trunk/Source/WebCore/ChangeLog 2018-07-09 18:41:31 UTC (rev 233648)
@@ -1,3 +1,20 @@
+2018-07-09 Simon Fraser <[email protected]>
+
+ Shrink CSSFontFace
+ https://bugs.webkit.org/show_bug.cgi?id=187456
+
+ Reviewed by Anders Carlsson.
+
+ Shrink CSSFontFace by 56 bytes, from 288 to 256 bytes, mostly by defining enums as 8-bit,
+ but also re-ordering the member variables. There are over 400 of these objects on nytimes.com,
+ so this saves about 22KB.
+
+ * css/CSSFontFace.cpp:
+ (WebCore::CSSFontFace::CSSFontFace):
+ * css/CSSFontFace.h:
+ * platform/text/TextFlags.h:
+ * rendering/style/RenderStyleConstants.h:
+
2018-07-09 Commit Queue <[email protected]>
Unreviewed, rolling out r233612.
Modified: trunk/Source/WebCore/css/CSSFontFace.cpp (233647 => 233648)
--- trunk/Source/WebCore/css/CSSFontFace.cpp 2018-07-09 18:21:01 UTC (rev 233647)
+++ trunk/Source/WebCore/css/CSSFontFace.cpp 2018-07-09 18:41:31 UTC (rev 233648)
@@ -89,12 +89,12 @@
}
CSSFontFace::CSSFontFace(CSSFontSelector* fontSelector, StyleRuleFontFace* cssConnection, FontFace* wrapper, bool isLocalFallback)
- : m_timeoutTimer(*this, &CSSFontFace::timeoutFired)
- , m_fontSelector(fontSelector)
+ : m_fontSelector(fontSelector)
, m_cssConnection(cssConnection)
, m_wrapper(makeWeakPtr(wrapper))
, m_isLocalFallback(isLocalFallback)
, m_mayBePurged(!wrapper)
+ , m_timeoutTimer(*this, &CSSFontFace::timeoutFired)
{
}
Modified: trunk/Source/WebCore/css/CSSFontFace.h (233647 => 233648)
--- trunk/Source/WebCore/css/CSSFontFace.h 2018-07-09 18:21:01 UTC (rev 233647)
+++ trunk/Source/WebCore/css/CSSFontFace.h 2018-07-09 18:41:31 UTC (rev 233648)
@@ -78,7 +78,7 @@
void setFeatureSettings(CSSValue&);
void setLoadingBehavior(CSSValue&);
- enum class Status;
+ enum class Status : uint8_t;
struct UnicodeRange;
const CSSValueList* families() const { return m_families.get(); }
FontSelectionRange weight() const { return m_fontSelectionCapabilities.computeWeight(); }
@@ -136,7 +136,7 @@
// || // \\ ||
// \/ \/ \/ \/
// Success Failure
- enum class Status { Pending, Loading, TimedOut, Success, Failure };
+ enum class Status : uint8_t { Pending, Loading, TimedOut, Success, Failure };
struct UnicodeRange {
UChar32 from;
@@ -183,9 +183,11 @@
RefPtr<CSSValueList> m_families;
Vector<UnicodeRange> m_ranges;
+
FontFeatureSettings m_featureSettings;
FontVariantSettings m_variantSettings;
- Timer m_timeoutTimer;
+ FontLoadingBehavior m_loadingBehavior { FontLoadingBehavior::Auto };
+
Vector<std::unique_ptr<CSSFontFaceSource>, 0, CrashOnOverflow, 0> m_sources;
RefPtr<CSSFontSelector> m_fontSelector;
RefPtr<StyleRuleFontFace> m_cssConnection;
@@ -192,11 +194,13 @@
HashSet<Client*> m_clients;
WeakPtr<FontFace> m_wrapper;
FontSelectionSpecifiedCapabilities m_fontSelectionCapabilities;
- FontLoadingBehavior m_loadingBehavior { FontLoadingBehavior::Auto };
+
Status m_status { Status::Pending };
bool m_isLocalFallback { false };
bool m_sourcesPopulated { false };
bool m_mayBePurged { true };
+
+ Timer m_timeoutTimer;
};
}
Modified: trunk/Source/WebCore/platform/text/TextFlags.h (233647 => 233648)
--- trunk/Source/WebCore/platform/text/TextFlags.h 2018-07-09 18:21:01 UTC (rev 233647)
+++ trunk/Source/WebCore/platform/text/TextFlags.h 2018-07-09 18:41:31 UTC (rev 233648)
@@ -65,19 +65,19 @@
typedef unsigned FontSynthesis;
const unsigned FontSynthesisWidth = 3;
-enum class FontVariantLigatures {
+enum class FontVariantLigatures : uint8_t {
Normal,
Yes,
No
};
-enum class FontVariantPosition {
+enum class FontVariantPosition : uint8_t {
Normal,
Subscript,
Superscript
};
-enum class FontVariantCaps {
+enum class FontVariantCaps : uint8_t {
Normal,
Small,
AllSmall,
@@ -87,40 +87,40 @@
Titling
};
-enum class FontVariantNumericFigure {
+enum class FontVariantNumericFigure : uint8_t {
Normal,
LiningNumbers,
OldStyleNumbers
};
-enum class FontVariantNumericSpacing {
+enum class FontVariantNumericSpacing : uint8_t {
Normal,
ProportionalNumbers,
TabularNumbers
};
-enum class FontVariantNumericFraction {
+enum class FontVariantNumericFraction : uint8_t {
Normal,
DiagonalFractions,
StackedFractions
};
-enum class FontVariantNumericOrdinal {
+enum class FontVariantNumericOrdinal : uint8_t {
Normal,
Yes
};
-enum class FontVariantNumericSlashedZero {
+enum class FontVariantNumericSlashedZero : uint8_t {
Normal,
Yes
};
-enum class FontVariantAlternates {
+enum class FontVariantAlternates : uint8_t {
Normal,
HistoricalForms
};
-enum class FontVariantEastAsianVariant {
+enum class FontVariantEastAsianVariant : uint8_t {
Normal,
Jis78,
Jis83,
@@ -130,13 +130,13 @@
Traditional
};
-enum class FontVariantEastAsianWidth {
+enum class FontVariantEastAsianWidth : uint8_t {
Normal,
Full,
Proportional
};
-enum class FontVariantEastAsianRuby {
+enum class FontVariantEastAsianRuby : uint8_t {
Normal,
Yes
};
@@ -254,6 +254,7 @@
| static_cast<unsigned>(eastAsianRuby) << 0;
}
+ // FIXME: this would be much more compact with bitfields.
FontVariantLigatures commonLigatures;
FontVariantLigatures discretionaryLigatures;
FontVariantLigatures historicalLigatures;
@@ -345,24 +346,24 @@
FontSmallCapsOn = 1
};
-enum class Kerning {
+enum class Kerning : uint8_t {
Auto,
Normal,
NoShift
};
-enum class FontOpticalSizing {
+enum class FontOpticalSizing : uint8_t {
Enabled,
Disabled
};
// https://www.microsoft.com/typography/otspec/fvar.htm#VAT
-enum class FontStyleAxis {
+enum class FontStyleAxis : uint8_t {
slnt,
ital
};
-enum class AllowUserInstalledFonts {
+enum class AllowUserInstalledFonts : uint8_t {
No,
Yes
};
Modified: trunk/Source/WebCore/rendering/style/RenderStyleConstants.h (233647 => 233648)
--- trunk/Source/WebCore/rendering/style/RenderStyleConstants.h 2018-07-09 18:21:01 UTC (rev 233647)
+++ trunk/Source/WebCore/rendering/style/RenderStyleConstants.h 2018-07-09 18:41:31 UTC (rev 233648)
@@ -1154,7 +1154,7 @@
Markers
};
-enum class FontLoadingBehavior {
+enum class FontLoadingBehavior : uint8_t {
Auto,
Block,
Swap,