Changeset 20127 in webkit
- Timestamp:
- Mar 12, 2007 4:57:56 PM (17 years ago)
- Location:
- trunk
- Files:
-
- 4 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r20122 r20127 1 2007-03-12 Antti Koivisto <antti@apple.com> 2 3 Reviewed by Alexey 4 5 Test that this works correctly with composed characters 6 http://bugs.webkit.org/show_bug.cgi?id=12833 7 REGRESSION: Selecting text in 6.6MB txt file is sluggish as of the Feb 19th nightly 8 <rdar://problem/5028159> 9 10 * fast/text/large-text-composed-char-expected.checksum: Added. 11 * fast/text/large-text-composed-char-expected.png: Added. 12 * fast/text/large-text-composed-char-expected.txt: Added. 13 * fast/text/large-text-composed-char.html: Added. 14 1 15 2007-03-09 Rob Buis <buis@kde.org> 2 16 -
trunk/WebCore/ChangeLog
r20126 r20127 1 2007-03-12 Antti Koivisto <antti@apple.com> 2 3 Reviewed by Alexey. 4 5 Fix http://bugs.webkit.org/show_bug.cgi?id=12833 6 REGRESSION: Selecting text in 6.6MB txt file is sluggish as of the Feb 19th nightly 7 <rdar://problem/5028159> 8 9 Divide large text blocks (>64kB) over multiple text nodes. This limits linebox searches to 10 a manageable subset. 11 12 * dom/Text.cpp: 13 (WebCore::Text::createWithLengthLimit): 14 * dom/Text.h: 15 * html/HTMLParser.cpp: 16 (WebCore::HTMLParser::parseToken): 17 * loader/TextDocument.cpp: 18 (WebCore::TextTokenizer::write): 19 1 20 2007-03-12 David Hyatt <hyatt@apple.com> 2 21 -
trunk/WebCore/dom/Text.cpp
r19855 r20127 28 28 #include "ExceptionCode.h" 29 29 #include "RenderText.h" 30 #include "TextBreakIterator.h" 30 31 31 32 #if ENABLE(SVG) … … 197 198 } 198 199 200 PassRefPtr<Text> Text::createWithLengthLimit(Document* doc, const String& text, unsigned& charsLeft, unsigned maxChars) 201 { 202 if (charsLeft == text.length() && charsLeft <= maxChars) { 203 charsLeft = 0; 204 return new Text(doc, text); 205 } 206 207 unsigned start = text.length() - charsLeft; 208 unsigned end = start + std::min(charsLeft, maxChars); 209 210 // check we are not on an unbreakable boundary 211 TextBreakIterator* it = characterBreakIterator(text.characters(), text.length()); 212 if (end < text.length() && !isTextBreak(it, end)) 213 end = textBreakPreceding(it, end); 214 215 String nodeText = text.substring(start, end - start); 216 charsLeft = text.length() - end; 217 218 return new Text(doc, nodeText); 219 } 220 199 221 #ifndef NDEBUG 200 222 void Text::formatForDebugger(char *buffer, unsigned length) const -
trunk/WebCore/dom/Text.h
r18874 r20127 29 29 30 30 namespace WebCore { 31 32 const unsigned cTextNodeLengthLimit = 1 << 16; 31 33 32 34 class Text : public CharacterData … … 57 59 58 60 virtual String toString() const; 61 62 static PassRefPtr<Text> createWithLengthLimit(Document*, const String&, unsigned& charsLeft, unsigned maxChars = cTextNodeLengthLimit); 59 63 60 64 #ifndef NDEBUG -
trunk/WebCore/html/HTMLParser.cpp
r18848 r20127 196 196 current->localName() != scriptTag && !t->text->containsOnlyWhitespace()) 197 197 haveContent = true; 198 199 RefPtr<Node> n; 200 String text = t->text.get(); 201 unsigned charsLeft = text.length(); 202 while (charsLeft) { 203 // split large blocks of text to nodes of manageable size 204 n = Text::createWithLengthLimit(document, text, charsLeft); 205 if (!insertNode(n.get(), t->flat)) 206 return 0; 207 } 208 return n; 198 209 } 199 210 -
trunk/WebCore/loader/TextDocument.cpp
r19868 r20127 128 128 129 129 String string = String(m_buffer, m_dest - m_buffer); 130 131 RefPtr<Text> text = m_doc->createTextNode(string); 132 m_preElement->appendChild(text, ec); 130 unsigned charsLeft = string.length(); 131 while (charsLeft) { 132 // split large text to nodes of manageable size 133 RefPtr<Text> text = Text::createWithLengthLimit(m_doc, string, charsLeft); 134 m_preElement->appendChild(text, ec); 135 } 133 136 134 137 return false;
Note: See TracChangeset
for help on using the changeset viewer.