Changeset 142398 in webkit
- Timestamp:
- Feb 10, 2013 5:44:02 AM (11 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r142395 r142398 1 2013-02-10 Andreas Kling <akling@apple.com> 2 3 RenderText: Access characters through m_text instead of caching data pointers separately. 4 <http://webkit.org/b/109357> 5 6 Reviewed by Antti Koivisto. 7 8 Go through RenderText::m_text.impl() instead of caching the character data pointer. 9 RenderText should never have a null String in m_text so it's safe to access impl() directly. 10 We have assertions for this since before. 11 12 Removing this pointer shrinks RenderText by 8 bytes, allowing it to fit into a snugger size class. 13 749 KB progression on Membuster3. 14 15 * rendering/RenderText.cpp: 16 (SameSizeAsRenderText): 17 (WebCore::RenderText::RenderText): 18 (WebCore::RenderText::setTextInternal): 19 * rendering/RenderText.h: 20 (WebCore::RenderText::is8Bit): 21 (WebCore::RenderText::characters8): 22 (WebCore::RenderText::characters16): 23 (WebCore::RenderText::characterAt): 24 (WebCore::RenderText::operator[]): 25 (RenderText): 26 1 27 2013-02-10 Jae Hyun Park <jae.park08@gmail.com> 2 28 -
trunk/Source/WebCore/rendering/RenderText.cpp
r141570 r142398 60 60 float widths[4]; 61 61 String text; 62 void* pointers[ 3];62 void* pointers[2]; 63 63 }; 64 64 … … 157 157 setDocumentForAnonymous(static_cast<Document*>(node)); 158 158 159 m_is8Bit = m_text.is8Bit();160 if (is8Bit())161 m_data.characters8 = m_text.characters8();162 else163 m_data.characters16 = m_text.characters16();164 159 m_isAllASCII = m_text.containsOnlyASCII(); 165 160 m_canUseSimpleFontCodePath = computeCanUseSimpleFontCodePath(); … … 1428 1423 ASSERT(!isBR() || (textLength() == 1 && m_text[0] == '\n')); 1429 1424 1430 m_is8Bit = m_text.is8Bit();1431 if (is8Bit())1432 m_data.characters8 = m_text.characters8();1433 else1434 m_data.characters16 = m_text.characters16();1435 1425 m_isAllASCII = m_text.containsOnlyASCII(); 1436 1426 m_canUseSimpleFontCodePath = computeCanUseSimpleFontCodePath(); -
trunk/Source/WebCore/rendering/RenderText.h
r140693 r142398 73 73 virtual VisiblePosition positionForPoint(const LayoutPoint&); 74 74 75 bool is8Bit() const { return m_ is8Bit; }76 const LChar* characters8() const { ASSERT(m_is8Bit); return m_data.characters8; }77 const UChar* characters16() const { ASSERT(!m_is8Bit); return m_data.characters16; }75 bool is8Bit() const { return m_text.is8Bit(); } 76 const LChar* characters8() const { return m_text.impl()->characters8(); } 77 const UChar* characters16() const { return m_text.impl()->characters16(); } 78 78 const UChar* characters() const { return m_text.characters(); } 79 UChar characterAt(unsigned i) const { return m_is8Bit? characters8()[i] : characters16()[i]; }79 UChar characterAt(unsigned i) const { return is8Bit() ? characters8()[i] : characters16()[i]; } 80 80 UChar operator[](unsigned i) const { return characterAt(i); } 81 81 unsigned textLength() const { return m_text.length(); } // non virtual implementation of length() … … 192 192 // or removed). 193 193 bool m_containsReversedText : 1; 194 bool m_is8Bit : 1;195 194 bool m_isAllASCII : 1; 196 195 bool m_canUseSimpleFontCodePath : 1; … … 204 203 205 204 String m_text; 206 union {207 const LChar* characters8;208 const UChar* characters16;209 } m_data;210 205 211 206 InlineTextBox* m_firstTextBox;
Note: See TracChangeset
for help on using the changeset viewer.