OLD | NEW |
---|---|
1 /* | 1 /* |
2 * (C) 1999 Lars Knoll (knoll@kde.org) | 2 * (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 2000 Dirk Mueller (mueller@kde.org) | 3 * (C) 2000 Dirk Mueller (mueller@kde.org) |
4 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved. | 4 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved. |
5 * | 5 * |
6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
10 * | 10 * |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
56 #include "wtf/text/CString.h" | 56 #include "wtf/text/CString.h" |
57 #include "wtf/text/StringBuilder.h" | 57 #include "wtf/text/StringBuilder.h" |
58 | 58 |
59 #include <algorithm> | 59 #include <algorithm> |
60 | 60 |
61 namespace blink { | 61 namespace blink { |
62 | 62 |
63 struct SameSizeAsInlineTextBox : public InlineBox { | 63 struct SameSizeAsInlineTextBox : public InlineBox { |
64 unsigned variables[1]; | 64 unsigned variables[1]; |
65 unsigned short variables2[2]; | 65 unsigned short variables2[2]; |
66 void* pointers[2]; | 66 void* pointers[3]; |
67 }; | 67 }; |
68 | 68 |
69 COMPILE_ASSERT(sizeof(InlineTextBox) == sizeof(SameSizeAsInlineTextBox), InlineT extBox_should_stay_small); | 69 COMPILE_ASSERT(sizeof(InlineTextBox) == sizeof(SameSizeAsInlineTextBox), InlineT extBox_should_stay_small); |
70 | 70 |
71 typedef WTF::HashMap<const InlineTextBox*, LayoutRect> InlineTextBoxOverflowMap; | 71 typedef WTF::HashMap<const InlineTextBox*, LayoutRect> InlineTextBoxOverflowMap; |
72 static InlineTextBoxOverflowMap* gTextBoxesWithOverflow; | 72 static InlineTextBoxOverflowMap* gTextBoxesWithOverflow; |
73 | 73 |
74 static const int misspellingLineThickness = 3; | 74 static const int misspellingLineThickness = 3; |
75 | 75 |
76 void InlineTextBox::destroy() | 76 void InlineTextBox::destroy() |
77 { | 77 { |
78 AbstractInlineTextBox::willDestroy(this); | 78 AbstractInlineTextBox::willDestroy(this); |
79 | 79 |
80 if (!knownToHaveNoOverflow() && gTextBoxesWithOverflow) | 80 if (!knownToHaveNoOverflow() && gTextBoxesWithOverflow) |
81 gTextBoxesWithOverflow->remove(this); | 81 gTextBoxesWithOverflow->remove(this); |
82 InlineBox::destroy(); | 82 InlineBox::destroy(); |
83 } | 83 } |
84 | 84 |
85 void InlineTextBox::markDirty() | 85 void InlineTextBox::markDirty() |
f(malita)
2014/09/16 00:18:29
Do we need to invalidate the cache on markDirty()?
jbroman
2014/09/17 22:25:37
I don't believe that we can actually paint a dirty
leviw_travelin_and_unemployed
2014/09/19 00:26:14
Just to be clear: we should *never* paint a dirty
| |
86 { | 86 { |
87 m_len = 0; | 87 m_len = 0; |
88 m_start = 0; | 88 m_start = 0; |
89 InlineBox::markDirty(); | 89 InlineBox::markDirty(); |
90 } | 90 } |
91 | 91 |
92 LayoutRect InlineTextBox::logicalOverflowRect() const | 92 LayoutRect InlineTextBox::logicalOverflowRect() const |
93 { | 93 { |
94 if (knownToHaveNoOverflow() || !gTextBoxesWithOverflow) | 94 if (knownToHaveNoOverflow() || !gTextBoxesWithOverflow) |
95 return enclosingIntRect(logicalFrameRect()); | 95 return enclosingIntRect(logicalFrameRect()); |
(...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
581 textPainter.setCombinedText(combinedText); | 581 textPainter.setCombinedText(combinedText); |
582 | 582 |
583 if (!paintSelectedTextOnly) { | 583 if (!paintSelectedTextOnly) { |
584 // FIXME: Truncate right-to-left text correctly. | 584 // FIXME: Truncate right-to-left text correctly. |
585 int startOffset = 0; | 585 int startOffset = 0; |
586 int endOffset = length; | 586 int endOffset = length; |
587 if (paintSelectedTextSeparately && selectionStart < selectionEnd) { | 587 if (paintSelectedTextSeparately && selectionStart < selectionEnd) { |
588 startOffset = selectionEnd; | 588 startOffset = selectionEnd; |
589 endOffset = selectionStart; | 589 endOffset = selectionStart; |
590 } | 590 } |
591 textPainter.paint(startOffset, endOffset, length, textStyle); | 591 bool textBlobIsCacheable = RuntimeEnabledFeatures::textBlobEnabled() && startOffset == 0 && endOffset == length; |
592 textPainter.paint(startOffset, endOffset, length, textStyle, textBlobIsC acheable ? &m_textBlobCache : 0); | |
592 } | 593 } |
593 | 594 |
594 if ((paintSelectedTextOnly || paintSelectedTextSeparately) && selectionStart < selectionEnd) { | 595 if ((paintSelectedTextOnly || paintSelectedTextSeparately) && selectionStart < selectionEnd) { |
595 // paint only the text that is selected | 596 // paint only the text that is selected |
596 textPainter.paint(selectionStart, selectionEnd, length, selectionStyle); | 597 textPainter.paint(selectionStart, selectionEnd, length, selectionStyle); |
597 } | 598 } |
598 | 599 |
599 // Paint decorations | 600 // Paint decorations |
600 TextDecoration textDecorations = styleToUse->textDecorationsInEffect(); | 601 TextDecoration textDecorations = styleToUse->textDecorationsInEffect(); |
601 if (textDecorations != TextDecorationNone && !paintSelectedTextOnly) { | 602 if (textDecorations != TextDecorationNone && !paintSelectedTextOnly) { |
(...skipping 767 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1369 printedCharacters = fprintf(stderr, "\t%s %p", obj.renderName(), &obj); | 1370 printedCharacters = fprintf(stderr, "\t%s %p", obj.renderName(), &obj); |
1370 const int rendererCharacterOffset = 24; | 1371 const int rendererCharacterOffset = 24; |
1371 for (; printedCharacters < rendererCharacterOffset; printedCharacters++) | 1372 for (; printedCharacters < rendererCharacterOffset; printedCharacters++) |
1372 fputc(' ', stderr); | 1373 fputc(' ', stderr); |
1373 fprintf(stderr, "(%d,%d) \"%s\"\n", start(), start() + len(), value.utf8().d ata()); | 1374 fprintf(stderr, "(%d,%d) \"%s\"\n", start(), start() + len(), value.utf8().d ata()); |
1374 } | 1375 } |
1375 | 1376 |
1376 #endif | 1377 #endif |
1377 | 1378 |
1378 } // namespace blink | 1379 } // namespace blink |
OLD | NEW |