Modified: trunk/Source/WebCore/ChangeLog (116259 => 116260)
--- trunk/Source/WebCore/ChangeLog 2012-05-07 02:10:27 UTC (rev 116259)
+++ trunk/Source/WebCore/ChangeLog 2012-05-07 02:19:15 UTC (rev 116260)
@@ -1,3 +1,23 @@
+2012-05-06 Rob Buis <[email protected]>
+
+ Shrink TextRun object size
+ https://bugs.webkit.org/show_bug.cgi?id=85751
+
+ Reviewed by Darin Adler.
+
+ Reorder the member variables in TextRun so it shrinks from 56 to 40 bytes on my 64-bit build. This is important
+ for SVG, since RenderSVGText shrinks because of this.
+
+ Also add a compile assert for the expected object size.
+
+ * platform/graphics/TextRun.cpp:
+ (ExpectedTextRunSize):
+ (WebCore):
+ * platform/graphics/TextRun.h:
+ (WebCore::TextRun::TextRun):
+ (WebCore::TextRun::direction):
+ (TextRun):
+
2012-05-06 Jonathan Dong <[email protected]>
[BlackBerry] Autofill backing store implementation upstream
Modified: trunk/Source/WebCore/platform/graphics/TextRun.cpp (116259 => 116260)
--- trunk/Source/WebCore/platform/graphics/TextRun.cpp 2012-05-07 02:10:27 UTC (rev 116259)
+++ trunk/Source/WebCore/platform/graphics/TextRun.cpp 2012-05-07 02:19:15 UTC (rev 116260)
@@ -28,6 +28,20 @@
namespace WebCore {
+class ExpectedTextRunSize {
+ const void* pointer;;
+ int integers[2];
+ float float1;
+#if ENABLE(SVG)
+ float float2;
+#endif
+ float float3;
+ uint32_t bitfields : 9;
+ RefPtr<TextRun::RenderingContext> renderingContext;
+};
+
+COMPILE_ASSERT(sizeof(TextRun) == sizeof(ExpectedTextRunSize), "TextRun is not of expected size");
+
bool TextRun::s_allowsRoundingHacks = false;
void TextRun::setAllowsRoundingHacks(bool allowsRoundingHacks)
Modified: trunk/Source/WebCore/platform/graphics/TextRun.h (116259 => 116260)
--- trunk/Source/WebCore/platform/graphics/TextRun.h 2012-05-07 02:10:27 UTC (rev 116259)
+++ trunk/Source/WebCore/platform/graphics/TextRun.h 2012-05-07 02:19:15 UTC (rev 116260)
@@ -63,11 +63,11 @@
, m_charactersLength(len)
, m_len(len)
, m_xpos(xpos)
- , m_expansion(expansion)
- , m_expansionBehavior(expansionBehavior)
#if ENABLE(SVG)
, m_horizontalGlyphStretch(1)
#endif
+ , m_expansion(expansion)
+ , m_expansionBehavior(expansionBehavior)
, m_allowTabs(allowTabs)
, m_direction(direction)
, m_directionalOverride(directionalOverride)
@@ -83,11 +83,11 @@
, m_charactersLength(s.length())
, m_len(s.length())
, m_xpos(xpos)
- , m_expansion(expansion)
- , m_expansionBehavior(expansionBehavior)
#if ENABLE(SVG)
, m_horizontalGlyphStretch(1)
#endif
+ , m_expansion(expansion)
+ , m_expansionBehavior(expansionBehavior)
, m_allowTabs(allowTabs)
, m_direction(direction)
, m_directionalOverride(directionalOverride)
@@ -120,7 +120,7 @@
float expansion() const { return m_expansion; }
bool allowsLeadingExpansion() const { return m_expansionBehavior & AllowLeadingExpansion; }
bool allowsTrailingExpansion() const { return m_expansionBehavior & AllowTrailingExpansion; }
- TextDirection direction() const { return m_direction; }
+ TextDirection direction() const { return static_cast<TextDirection>(m_direction); }
bool rtl() const { return m_direction == RTL; }
bool ltr() const { return m_direction == LTR; }
bool directionalOverride() const { return m_directionalOverride; }
@@ -163,18 +163,18 @@
// start of the containing block. In the case of right alignment or center alignment, left start of
// the text line is not the same as left start of the containing block.
float m_xpos;
- float m_expansion;
- ExpansionBehavior m_expansionBehavior;
#if ENABLE(SVG)
float m_horizontalGlyphStretch;
#endif
- bool m_allowTabs;
- TextDirection m_direction;
- bool m_directionalOverride; // Was this direction set by an override character.
- bool m_characterScanForCodePath;
- bool m_applyRunRounding;
- bool m_applyWordRounding;
- bool m_disableSpacing;
+ float m_expansion;
+ ExpansionBehavior m_expansionBehavior : 2;
+ unsigned m_allowTabs : 1;
+ unsigned m_direction : 1;
+ unsigned m_directionalOverride : 1; // Was this direction set by an override character.
+ unsigned m_characterScanForCodePath : 1;
+ unsigned m_applyRunRounding : 1;
+ unsigned m_applyWordRounding : 1;
+ unsigned m_disableSpacing : 1;
RefPtr<RenderingContext> m_renderingContext;
};