Chromium Code Reviews| 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-2009, 2013 Apple Inc. All rights reserved. | 4 * Copyright (C) 2004-2009, 2013 Apple Inc. All rights 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 19 matching lines...) Expand all Loading... | |
| 30 #include "platform/LengthFunctions.h" | 30 #include "platform/LengthFunctions.h" |
| 31 #include "platform/text/TextPath.h" | 31 #include "platform/text/TextPath.h" |
| 32 #include "wtf/Forward.h" | 32 #include "wtf/Forward.h" |
| 33 #include "wtf/PassRefPtr.h" | 33 #include "wtf/PassRefPtr.h" |
| 34 | 34 |
| 35 namespace blink { | 35 namespace blink { |
| 36 | 36 |
| 37 class AbstractInlineTextBox; | 37 class AbstractInlineTextBox; |
| 38 class InlineTextBox; | 38 class InlineTextBox; |
| 39 | 39 |
| 40 // LayoutText is the root class for anything that represents | |
| 41 // a text node (see core/dom/Text.h). | |
| 42 // | |
| 43 // To limit memory overhead, this class inherits directly | |
| 44 // from LayoutObject. It also means that it's mostly a | |
| 45 // placeholder in the tree for the text node's content and | |
| 46 // the line boxes. | |
| 47 // | |
| 48 // The actual layout of text is handled by the containing inline | |
| 49 // or block flow, that will invoke the bidi algorithm to break the | |
| 50 // text into lines (m_firstTextBox and m_lastTextBox). | |
| 51 // See e.g. LayoutBlockFlow::layoutInlineChildren. | |
|
eae
2015/08/27 22:22:25
It is probably worth pointing out that this class
| |
| 52 // | |
| 53 // The previous comment applies also for painting. | |
| 40 class CORE_EXPORT LayoutText : public LayoutObject { | 54 class CORE_EXPORT LayoutText : public LayoutObject { |
| 41 public: | 55 public: |
| 42 // FIXME: If the node argument is not a Text node or the string argument is | 56 // FIXME: If the node argument is not a Text node or the string argument is |
| 43 // not the content of the Text node, updating text-transform property | 57 // not the content of the Text node, updating text-transform property |
| 44 // doesn't re-transform the string. | 58 // doesn't re-transform the string. |
| 45 LayoutText(Node*, PassRefPtr<StringImpl>); | 59 LayoutText(Node*, PassRefPtr<StringImpl>); |
| 46 #if ENABLE(ASSERT) | 60 #if ENABLE(ASSERT) |
| 47 ~LayoutText() override; | 61 ~LayoutText() override; |
| 48 #endif | 62 #endif |
| 49 | 63 |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 164 void computePreferredLogicalWidths(float leadWidth); | 178 void computePreferredLogicalWidths(float leadWidth); |
| 165 void computePreferredLogicalWidths(float leadWidth, HashSet<const SimpleFont Data*>& fallbackFonts, FloatRect& glyphBounds); | 179 void computePreferredLogicalWidths(float leadWidth, HashSet<const SimpleFont Data*>& fallbackFonts, FloatRect& glyphBounds); |
| 166 | 180 |
| 167 bool computeCanUseSimpleFontCodePath() const; | 181 bool computeCanUseSimpleFontCodePath() const; |
| 168 | 182 |
| 169 // Make length() private so that callers that have a LayoutText* | 183 // Make length() private so that callers that have a LayoutText* |
| 170 // will use the more efficient textLength() instead, while | 184 // will use the more efficient textLength() instead, while |
| 171 // callers with a LayoutObject* can continue to use length(). | 185 // callers with a LayoutObject* can continue to use length(). |
| 172 unsigned length() const final { return textLength(); } | 186 unsigned length() const final { return textLength(); } |
| 173 | 187 |
| 188 // See the class comment as to why we shouldn't call this function directly. | |
| 174 void paint(const PaintInfo&, const LayoutPoint&) final { ASSERT_NOT_REACHED( ); } | 189 void paint(const PaintInfo&, const LayoutPoint&) final { ASSERT_NOT_REACHED( ); } |
| 175 void layout() final { ASSERT_NOT_REACHED(); } | 190 void layout() final { ASSERT_NOT_REACHED(); } |
| 176 bool nodeAtPoint(HitTestResult&, const HitTestLocation&, const LayoutPoint&, HitTestAction) final { ASSERT_NOT_REACHED(); return false; } | 191 bool nodeAtPoint(HitTestResult&, const HitTestLocation&, const LayoutPoint&, HitTestAction) final { ASSERT_NOT_REACHED(); return false; } |
| 177 | 192 |
| 178 void deleteTextBoxes(); | 193 void deleteTextBoxes(); |
| 179 bool containsOnlyWhitespace(unsigned from, unsigned len) const; | 194 bool containsOnlyWhitespace(unsigned from, unsigned len) const; |
| 180 float widthFromFont(const Font&, int start, int len, float leadWidth, float textWidthSoFar, TextDirection, HashSet<const SimpleFontData*>* fallbackFonts, Fl oatRect* glyphBoundsAccumulation) const; | 195 float widthFromFont(const Font&, int start, int len, float leadWidth, float textWidthSoFar, TextDirection, HashSet<const SimpleFontData*>* fallbackFonts, Fl oatRect* glyphBoundsAccumulation) const; |
| 181 | 196 |
| 182 void secureText(UChar mask); | 197 void secureText(UChar mask); |
| 183 | 198 |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 245 inline LayoutText* Text::layoutObject() const | 260 inline LayoutText* Text::layoutObject() const |
| 246 { | 261 { |
| 247 return toLayoutText(CharacterData::layoutObject()); | 262 return toLayoutText(CharacterData::layoutObject()); |
| 248 } | 263 } |
| 249 | 264 |
| 250 void applyTextTransform(const ComputedStyle*, String&, UChar); | 265 void applyTextTransform(const ComputedStyle*, String&, UChar); |
| 251 | 266 |
| 252 } // namespace blink | 267 } // namespace blink |
| 253 | 268 |
| 254 #endif // LayoutText_h | 269 #endif // LayoutText_h |
| OLD | NEW |