eseidel | 3a6d132 | 2006-01-09 03:14:50 +0000 | [diff] [blame] | 1 | /* |
eseidel | 3a6d132 | 2006-01-09 03:14:50 +0000 | [diff] [blame] | 2 | * (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 | * (C) 2000 Dirk Mueller (mueller@kde.org) |
antti@apple.com | 61c4cde | 2013-10-13 11:05:33 +0000 | [diff] [blame] | 4 | * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2013 Apple Inc. All rights reserved. |
eseidel | 3a6d132 | 2006-01-09 03:14:50 +0000 | [diff] [blame] | 5 | * |
| 6 | * This library is free software; you can redistribute it and/or |
| 7 | * modify it under the terms of the GNU Library General Public |
| 8 | * License as published by the Free Software Foundation; either |
| 9 | * version 2 of the License, or (at your option) any later version. |
| 10 | * |
| 11 | * This library is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 14 | * Library General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU Library General Public License |
| 17 | * along with this library; see the file COPYING.LIB. If not, write to |
ddkilzer | c8eccec | 2007-09-26 02:29:57 +0000 | [diff] [blame] | 18 | * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 19 | * Boston, MA 02110-1301, USA. |
eseidel | 3a6d132 | 2006-01-09 03:14:50 +0000 | [diff] [blame] | 20 | * |
| 21 | */ |
| 22 | |
darin | b53ebdc | 2006-07-09 15:10:21 +0000 | [diff] [blame] | 23 | #ifndef RenderText_h |
| 24 | #define RenderText_h |
eseidel | 3a6d132 | 2006-01-09 03:14:50 +0000 | [diff] [blame] | 25 | |
antti@apple.com | 1e9a318 | 2013-09-27 02:02:27 +0000 | [diff] [blame] | 26 | #include "RenderElement.h" |
antti@apple.com | b0b707f | 2013-10-12 17:41:13 +0000 | [diff] [blame] | 27 | #include "RenderTextLineBoxes.h" |
antti@apple.com | 940f587 | 2013-10-24 20:31:11 +0000 | [diff] [blame] | 28 | #include "SimpleLineLayout.h" |
antti@apple.com | e9c9016 | 2013-10-13 16:00:10 +0000 | [diff] [blame] | 29 | #include "Text.h" |
barraclough@apple.com | d218c2d | 2010-08-10 00:38:14 +0000 | [diff] [blame] | 30 | #include <wtf/Forward.h> |
eseidel | 3a6d132 | 2006-01-09 03:14:50 +0000 | [diff] [blame] | 31 | |
darin | 9d0a628 | 2006-03-01 07:49:33 +0000 | [diff] [blame] | 32 | namespace WebCore { |
eseidel | 3a6d132 | 2006-01-09 03:14:50 +0000 | [diff] [blame] | 33 | |
darin | fb4d937 | 2006-04-22 05:31:57 +0000 | [diff] [blame] | 34 | class InlineTextBox; |
eseidel | 3a6d132 | 2006-01-09 03:14:50 +0000 | [diff] [blame] | 35 | |
darin | 9d0a628 | 2006-03-01 07:49:33 +0000 | [diff] [blame] | 36 | class RenderText : public RenderObject { |
eseidel | 3a6d132 | 2006-01-09 03:14:50 +0000 | [diff] [blame] | 37 | public: |
akling@apple.com | 42e1063 | 2013-10-14 17:55:52 +0000 | [diff] [blame] | 38 | RenderText(Text&, const String&); |
| 39 | RenderText(Document&, const String&); |
antti@apple.com | 4973e7c | 2013-12-07 00:33:42 +0000 | [diff] [blame] | 40 | |
darin | 5ae6f47 | 2007-08-06 19:51:38 +0000 | [diff] [blame] | 41 | virtual ~RenderText(); |
eseidel | 3a6d132 | 2006-01-09 03:14:50 +0000 | [diff] [blame] | 42 | |
akling@apple.com | 8149707 | 2013-07-26 20:41:32 +0000 | [diff] [blame] | 43 | virtual const char* renderName() const OVERRIDE; |
eseidel | 3a6d132 | 2006-01-09 03:14:50 +0000 | [diff] [blame] | 44 | |
antti@apple.com | 1936a2b | 2013-09-19 10:37:49 +0000 | [diff] [blame] | 45 | Text* textNode() const; |
| 46 | |
mitz@apple.com | fb8da4e | 2008-02-19 21:13:19 +0000 | [diff] [blame] | 47 | virtual bool isTextFragment() const; |
weinig | 695d48b | 2006-12-16 23:36:48 +0000 | [diff] [blame] | 48 | |
akling@apple.com | 827be9c | 2013-10-29 02:58:43 +0000 | [diff] [blame] | 49 | RenderStyle& style() const; |
| 50 | RenderStyle& firstLineStyle() const; |
antti@apple.com | 7aae175 | 2013-09-24 12:22:10 +0000 | [diff] [blame] | 51 | |
antti@apple.com | 1936a2b | 2013-09-19 10:37:49 +0000 | [diff] [blame] | 52 | virtual String originalText() const; |
weinig | 695d48b | 2006-12-16 23:36:48 +0000 | [diff] [blame] | 53 | |
antti@apple.com | b0b707f | 2013-10-12 17:41:13 +0000 | [diff] [blame] | 54 | void extractTextBox(InlineTextBox& box) { m_lineBoxes.extract(box); } |
| 55 | void attachTextBox(InlineTextBox& box) { m_lineBoxes.attach(box); } |
| 56 | void removeTextBox(InlineTextBox& box) { m_lineBoxes.remove(box); } |
darin | 42563ac5 | 2007-01-22 17:28:57 +0000 | [diff] [blame] | 57 | |
hamaji@chromium.org | 5e3b1e2 | 2010-03-16 07:39:28 +0000 | [diff] [blame] | 58 | StringImpl* text() const { return m_text.impl(); } |
antti@apple.com | 7530ae1 | 2013-09-30 16:21:54 +0000 | [diff] [blame] | 59 | String textWithoutConvertingBackslashToYenSymbol() const; |
eseidel | 3a6d132 | 2006-01-09 03:14:50 +0000 | [diff] [blame] | 60 | |
antti@apple.com | b0b707f | 2013-10-12 17:41:13 +0000 | [diff] [blame] | 61 | InlineTextBox* createInlineTextBox() { return m_lineBoxes.createAndAppendLineBox(*this); } |
hyatt@apple.com | c92b735 | 2009-02-12 01:35:08 +0000 | [diff] [blame] | 62 | void dirtyLineBoxes(bool fullLayout); |
eseidel | 3a6d132 | 2006-01-09 03:14:50 +0000 | [diff] [blame] | 63 | |
akling@apple.com | 8149707 | 2013-07-26 20:41:32 +0000 | [diff] [blame] | 64 | virtual void absoluteRects(Vector<IntRect>&, const LayoutPoint& accumulatedOffset) const OVERRIDE FINAL; |
antti@apple.com | 61c4cde | 2013-10-13 11:05:33 +0000 | [diff] [blame] | 65 | Vector<IntRect> absoluteRectsForRange(unsigned startOffset = 0, unsigned endOffset = UINT_MAX, bool useSelectionHeight = false, bool* wasFixed = nullptr) const; |
dbates@webkit.org | 395fca7 | 2013-12-06 19:59:38 +0000 | [diff] [blame] | 66 | #if PLATFORM(IOS) |
| 67 | virtual void collectSelectionRects(Vector<SelectionRect>&, unsigned startOffset = 0, unsigned endOffset = std::numeric_limits<unsigned>::max()) OVERRIDE; |
| 68 | #endif |
eseidel | 3a6d132 | 2006-01-09 03:14:50 +0000 | [diff] [blame] | 69 | |
akling@apple.com | 8149707 | 2013-07-26 20:41:32 +0000 | [diff] [blame] | 70 | virtual void absoluteQuads(Vector<FloatQuad>&, bool* wasFixed) const OVERRIDE FINAL; |
antti@apple.com | 61c4cde | 2013-10-13 11:05:33 +0000 | [diff] [blame] | 71 | Vector<FloatQuad> absoluteQuadsForRange(unsigned startOffset = 0, unsigned endOffset = UINT_MAX, bool useSelectionHeight = false, bool* wasFixed = nullptr) const; |
simon.fraser@apple.com | aacf70e | 2008-11-12 23:43:52 +0000 | [diff] [blame] | 72 | |
antti@apple.com | 61c4cde | 2013-10-13 11:05:33 +0000 | [diff] [blame] | 73 | Vector<FloatQuad> absoluteQuadsClippedToEllipsis() const; |
cfleizach@apple.com | 59dc435 | 2010-09-15 17:07:46 +0000 | [diff] [blame] | 74 | |
antti@apple.com | 1936a2b | 2013-09-19 10:37:49 +0000 | [diff] [blame] | 75 | virtual VisiblePosition positionForPoint(const LayoutPoint&) OVERRIDE; |
eseidel | 3a6d132 | 2006-01-09 03:14:50 +0000 | [diff] [blame] | 76 | |
akling@apple.com | 2c97bdc8 | 2013-02-10 13:44:02 +0000 | [diff] [blame] | 77 | bool is8Bit() const { return m_text.is8Bit(); } |
| 78 | const LChar* characters8() const { return m_text.impl()->characters8(); } |
| 79 | const UChar* characters16() const { return m_text.impl()->characters16(); } |
darin@apple.com | da57a4d | 2014-01-13 02:29:47 +0000 | [diff] [blame] | 80 | const UChar* characters() const { return deprecatedCharacters(); } // FIXME: Delete this. |
| 81 | const UChar* deprecatedCharacters() const { return m_text.deprecatedCharacters(); } |
akling@apple.com | 2c97bdc8 | 2013-02-10 13:44:02 +0000 | [diff] [blame] | 82 | UChar characterAt(unsigned i) const { return is8Bit() ? characters8()[i] : characters16()[i]; } |
msaboff@apple.com | 776c286c7 | 2012-10-15 16:56:29 +0000 | [diff] [blame] | 83 | UChar operator[](unsigned i) const { return characterAt(i); } |
akling@apple.com | 61cebcb | 2013-10-15 18:17:56 +0000 | [diff] [blame] | 84 | unsigned textLength() const { return m_text.impl()->length(); } // non virtual implementation of length() |
akling@apple.com | 27e7d14 | 2013-11-07 12:04:02 +0000 | [diff] [blame] | 85 | void positionLineBox(InlineTextBox&); |
eseidel | 3a6d132 | 2006-01-09 03:14:50 +0000 | [diff] [blame] | 86 | |
hyatt@apple.com | 0acc935 | 2011-02-17 19:19:07 +0000 | [diff] [blame] | 87 | virtual float width(unsigned from, unsigned len, const Font&, float xPos, HashSet<const SimpleFontData*>* fallbackFonts = 0, GlyphOverflow* = 0) const; |
| 88 | virtual float width(unsigned from, unsigned len, float xPos, bool firstLine = false, HashSet<const SimpleFontData*>* fallbackFonts = 0, GlyphOverflow* = 0) const; |
eseidel | 3a6d132 | 2006-01-09 03:14:50 +0000 | [diff] [blame] | 89 | |
hyatt@apple.com | 0acc935 | 2011-02-17 19:19:07 +0000 | [diff] [blame] | 90 | float minLogicalWidth() const; |
| 91 | float maxLogicalWidth() const; |
eseidel | 3a6d132 | 2006-01-09 03:14:50 +0000 | [diff] [blame] | 92 | |
hyatt@apple.com | 0acc935 | 2011-02-17 19:19:07 +0000 | [diff] [blame] | 93 | void trimmedPrefWidths(float leadWidth, |
| 94 | float& beginMinW, bool& beginWS, |
| 95 | float& endMinW, bool& endWS, |
darin | 7e7c8e4 | 2007-04-25 01:14:03 +0000 | [diff] [blame] | 96 | bool& hasBreakableChar, bool& hasBreak, |
hyatt@apple.com | 0acc935 | 2011-02-17 19:19:07 +0000 | [diff] [blame] | 97 | float& beginMaxW, float& endMaxW, |
| 98 | float& minW, float& maxW, bool& stripFrontSpaces); |
weinig | 0a635f0 | 2006-11-01 21:49:13 +0000 | [diff] [blame] | 99 | |
leviw@chromium.org | 0e79135 | 2012-04-18 00:30:04 +0000 | [diff] [blame] | 100 | virtual IntRect linesBoundingBox() const; |
eae@chromium.org | d060637 | 2011-11-02 22:53:39 +0000 | [diff] [blame] | 101 | LayoutRect linesVisualOverflowBoundingBox() const; |
hyatt@apple.com | d885df7 | 2009-01-22 02:31:52 +0000 | [diff] [blame] | 102 | |
hyatt@apple.com | 0acc935 | 2011-02-17 19:19:07 +0000 | [diff] [blame] | 103 | FloatPoint firstRunOrigin() const; |
| 104 | float firstRunX() const; |
| 105 | float firstRunY() const; |
eseidel | 3a6d132 | 2006-01-09 03:14:50 +0000 | [diff] [blame] | 106 | |
antti@apple.com | 1936a2b | 2013-09-19 10:37:49 +0000 | [diff] [blame] | 107 | virtual void setText(const String&, bool force = false); |
| 108 | void setTextWithOffset(const String&, unsigned offset, unsigned len, bool force = false); |
eseidel | 3a6d132 | 2006-01-09 03:14:50 +0000 | [diff] [blame] | 109 | |
andersca@apple.com | 70c6058 | 2013-10-07 16:26:16 +0000 | [diff] [blame] | 110 | virtual bool canBeSelectionLeaf() const OVERRIDE { return true; } |
akling@apple.com | 8149707 | 2013-07-26 20:41:32 +0000 | [diff] [blame] | 111 | virtual void setSelectionState(SelectionState s) OVERRIDE FINAL; |
simon.fraser@apple.com | a482506 | 2012-11-08 05:15:10 +0000 | [diff] [blame] | 112 | virtual LayoutRect selectionRectForRepaint(const RenderLayerModelObject* repaintContainer, bool clipToVisibleContent = true) OVERRIDE; |
andersca@apple.com | 70c6058 | 2013-10-07 16:26:16 +0000 | [diff] [blame] | 113 | virtual LayoutRect localCaretRect(InlineBox*, int caretOffset, LayoutUnit* extraWidthToEndOfLine = 0) OVERRIDE; |
eseidel | 3a6d132 | 2006-01-09 03:14:50 +0000 | [diff] [blame] | 114 | |
akling@apple.com | 827be9c | 2013-10-29 02:58:43 +0000 | [diff] [blame] | 115 | LayoutUnit marginLeft() const { return minimumValueForLength(style().marginLeft(), 0); } |
| 116 | LayoutUnit marginRight() const { return minimumValueForLength(style().marginRight(), 0); } |
eseidel | 3a6d132 | 2006-01-09 03:14:50 +0000 | [diff] [blame] | 117 | |
akling@apple.com | 8149707 | 2013-07-26 20:41:32 +0000 | [diff] [blame] | 118 | virtual LayoutRect clippedOverflowRectForRepaint(const RenderLayerModelObject* repaintContainer) const OVERRIDE FINAL; |
eseidel | 3a6d132 | 2006-01-09 03:14:50 +0000 | [diff] [blame] | 119 | |
antti@apple.com | b0b707f | 2013-10-12 17:41:13 +0000 | [diff] [blame] | 120 | InlineTextBox* firstTextBox() const { return m_lineBoxes.first(); } |
| 121 | InlineTextBox* lastTextBox() const { return m_lineBoxes.last(); } |
weinig | 0a635f0 | 2006-11-01 21:49:13 +0000 | [diff] [blame] | 122 | |
andersca@apple.com | 70c6058 | 2013-10-07 16:26:16 +0000 | [diff] [blame] | 123 | virtual int caretMinOffset() const OVERRIDE; |
| 124 | virtual int caretMaxOffset() const OVERRIDE; |
antti@apple.com | c42b4b9 | 2013-10-16 14:33:31 +0000 | [diff] [blame] | 125 | unsigned countRenderedCharacterOffsetsUntil(unsigned) const; |
| 126 | bool containsRenderedCharacterOffset(unsigned) const; |
antti@apple.com | cbd6399 | 2013-10-16 12:24:57 +0000 | [diff] [blame] | 127 | bool containsCaretOffset(unsigned) const; |
antti@apple.com | 3218a1b | 2013-10-12 14:51:01 +0000 | [diff] [blame] | 128 | bool hasRenderedText() const; |
eseidel | 3a6d132 | 2006-01-09 03:14:50 +0000 | [diff] [blame] | 129 | |
akling@apple.com | 8149707 | 2013-07-26 20:41:32 +0000 | [diff] [blame] | 130 | virtual int previousOffset(int current) const OVERRIDE FINAL; |
| 131 | virtual int previousOffsetForBackwardDeletion(int current) const OVERRIDE FINAL; |
| 132 | virtual int nextOffset(int current) const OVERRIDE FINAL; |
weinig | 695d48b | 2006-12-16 23:36:48 +0000 | [diff] [blame] | 133 | |
darin | 38ae534 | 2006-07-25 04:39:25 +0000 | [diff] [blame] | 134 | bool containsReversedText() const { return m_containsReversedText; } |
weinig | 695d48b | 2006-12-16 23:36:48 +0000 | [diff] [blame] | 135 | |
akling@apple.com | 827be9c | 2013-10-29 02:58:43 +0000 | [diff] [blame] | 136 | bool isSecure() const { return style().textSecurity() != TSNONE; } |
commit-queue@webkit.org | dbd63aa | 2011-08-23 23:31:44 +0000 | [diff] [blame] | 137 | void momentarilyRevealLastTypedCharacter(unsigned lastTypedCharacterOffset); |
| 138 | |
antti@apple.com | b0b707f | 2013-10-12 17:41:13 +0000 | [diff] [blame] | 139 | InlineTextBox* findNextInlineTextBox(int offset, int& pos) const { return m_lineBoxes.findNext(offset, pos); } |
eseidel | 3a6d132 | 2006-01-09 03:14:50 +0000 | [diff] [blame] | 140 | |
akling@apple.com | 2c42276 | 2013-05-17 15:26:30 +0000 | [diff] [blame] | 141 | bool isAllCollapsibleWhitespace() const; |
hyatt@apple.com | c2fdbe1 | 2012-04-12 21:06:50 +0000 | [diff] [blame] | 142 | |
| 143 | bool canUseSimpleFontCodePath() const { return m_canUseSimpleFontCodePath; } |
hyatt@apple.com | 14e332d | 2011-03-25 21:57:07 +0000 | [diff] [blame] | 144 | |
hyatt@apple.com | a61b8a3 | 2011-04-06 18:20:52 +0000 | [diff] [blame] | 145 | void removeAndDestroyTextBoxes(); |
| 146 | |
antti@apple.com | 1e9a318 | 2013-09-27 02:02:27 +0000 | [diff] [blame] | 147 | virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle); |
| 148 | |
akling@apple.com | b5f2464 | 2013-11-06 04:47:12 +0000 | [diff] [blame] | 149 | virtual std::unique_ptr<InlineTextBox> createTextBox(); // Subclassed by RenderSVGInlineText. |
antti@apple.com | b0b707f | 2013-10-12 17:41:13 +0000 | [diff] [blame] | 150 | |
dbates@webkit.org | acb8f4f | 2013-09-11 02:39:05 +0000 | [diff] [blame] | 151 | #if ENABLE(IOS_TEXT_AUTOSIZING) |
| 152 | float candidateComputedTextSize() const { return m_candidateComputedTextSize; } |
| 153 | void setCandidateComputedTextSize(float s) { m_candidateComputedTextSize = s; } |
| 154 | #endif |
| 155 | |
antti@apple.com | 940f587 | 2013-10-24 20:31:11 +0000 | [diff] [blame] | 156 | void ensureLineBoxes(); |
| 157 | void deleteLineBoxesBeforeSimpleLineLayout(); |
antti@apple.com | fea5199 | 2013-10-28 13:39:23 +0000 | [diff] [blame] | 158 | const SimpleLineLayout::Layout* simpleLineLayout() const; |
antti@apple.com | 940f587 | 2013-10-24 20:31:11 +0000 | [diff] [blame] | 159 | |
weinig | 0a635f0 | 2006-11-01 21:49:13 +0000 | [diff] [blame] | 160 | protected: |
ojan@chromium.org | 082802b | 2013-01-15 20:44:25 +0000 | [diff] [blame] | 161 | virtual void computePreferredLogicalWidths(float leadWidth); |
antti@apple.com | 1936a2b | 2013-09-19 10:37:49 +0000 | [diff] [blame] | 162 | virtual void willBeDestroyed() OVERRIDE; |
simon.fraser@apple.com | 73cb0b3 | 2011-07-09 00:43:14 +0000 | [diff] [blame] | 163 | |
antti@apple.com | 1936a2b | 2013-09-19 10:37:49 +0000 | [diff] [blame] | 164 | virtual void setTextInternal(const String&); |
hamaji@chromium.org | 359e131 | 2010-04-20 23:51:45 +0000 | [diff] [blame] | 165 | virtual UChar previousCharacter() const; |
darin | ec37548 | 2007-01-06 01:36:24 +0000 | [diff] [blame] | 166 | |
| 167 | private: |
antti@apple.com | da4d316 | 2013-09-23 17:43:04 +0000 | [diff] [blame] | 168 | virtual bool canHaveChildren() const OVERRIDE FINAL { return false; } |
| 169 | |
hyatt@apple.com | 0acc935 | 2011-02-17 19:19:07 +0000 | [diff] [blame] | 170 | void computePreferredLogicalWidths(float leadWidth, HashSet<const SimpleFontData*>& fallbackFonts, GlyphOverflow&); |
mitz@apple.com | aa6ce3d | 2009-04-10 01:00:20 +0000 | [diff] [blame] | 171 | |
hyatt@apple.com | c2fdbe1 | 2012-04-12 21:06:50 +0000 | [diff] [blame] | 172 | bool computeCanUseSimpleFontCodePath() const; |
| 173 | |
darin | 42563ac5 | 2007-01-22 17:28:57 +0000 | [diff] [blame] | 174 | // Make length() private so that callers that have a RenderText* |
| 175 | // will use the more efficient textLength() instead, while |
| 176 | // callers with a RenderObject* can continue to use length(). |
akling@apple.com | 8149707 | 2013-07-26 20:41:32 +0000 | [diff] [blame] | 177 | virtual unsigned length() const OVERRIDE FINAL { return textLength(); } |
darin | ec37548 | 2007-01-06 01:36:24 +0000 | [diff] [blame] | 178 | |
akling@apple.com | 8149707 | 2013-07-26 20:41:32 +0000 | [diff] [blame] | 179 | virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTestLocation&, const LayoutPoint&, HitTestAction) OVERRIDE FINAL { ASSERT_NOT_REACHED(); return false; } |
darin@apple.com | 98a7ac6 | 2009-01-05 17:26:53 +0000 | [diff] [blame] | 180 | |
darin | 42563ac5 | 2007-01-22 17:28:57 +0000 | [diff] [blame] | 181 | bool containsOnlyWhitespace(unsigned from, unsigned len) const; |
akling@apple.com | 51b98e2 | 2013-10-15 11:45:03 +0000 | [diff] [blame] | 182 | float widthFromCache(const Font&, int start, int len, float xPos, HashSet<const SimpleFontData*>* fallbackFonts, GlyphOverflow*, const RenderStyle&) const; |
darin | 42563ac5 | 2007-01-22 17:28:57 +0000 | [diff] [blame] | 183 | bool isAllASCII() const { return m_isAllASCII; } |
antti@apple.com | 7530ae1 | 2013-09-30 16:21:54 +0000 | [diff] [blame] | 184 | bool computeUseBackslashAsYenSymbol() const; |
hamaji@chromium.org | 359e131 | 2010-04-20 23:51:45 +0000 | [diff] [blame] | 185 | |
commit-queue@webkit.org | dbd63aa | 2011-08-23 23:31:44 +0000 | [diff] [blame] | 186 | void secureText(UChar mask); |
darin | 42563ac5 | 2007-01-22 17:28:57 +0000 | [diff] [blame] | 187 | |
antti@apple.com | 1936a2b | 2013-09-19 10:37:49 +0000 | [diff] [blame] | 188 | void node() const WTF_DELETED_FUNCTION; |
| 189 | |
kling@webkit.org | dcf15f8 | 2012-04-25 08:18:52 +0000 | [diff] [blame] | 190 | // We put the bitfield first to minimize padding on 64-bit. |
eseidel | 3a6d132 | 2006-01-09 03:14:50 +0000 | [diff] [blame] | 191 | bool m_hasBreakableChar : 1; // Whether or not we can be broken into multiple lines. |
| 192 | bool m_hasBreak : 1; // Whether or not we have a hard break (e.g., <pre> with '\n'). |
| 193 | bool m_hasTab : 1; // Whether or not we have a variable width tab character (e.g., <pre> with '\t'). |
| 194 | bool m_hasBeginWS : 1; // Whether or not we begin with WS (only true if we aren't pre) |
| 195 | bool m_hasEndWS : 1; // Whether or not we end with WS (only true if we aren't pre) |
eseidel | 3a6d132 | 2006-01-09 03:14:50 +0000 | [diff] [blame] | 196 | bool m_linesDirty : 1; // This bit indicates that the text run has already dirtied specific |
| 197 | // line boxes, and this hint will enable layoutInlineChildren to avoid |
| 198 | // just dirtying everything when character data is modified (e.g., appended/inserted |
| 199 | // or removed). |
| 200 | bool m_containsReversedText : 1; |
darin | 42563ac5 | 2007-01-22 17:28:57 +0000 | [diff] [blame] | 201 | bool m_isAllASCII : 1; |
hyatt@apple.com | c2fdbe1 | 2012-04-12 21:06:50 +0000 | [diff] [blame] | 202 | bool m_canUseSimpleFontCodePath : 1; |
enrica@apple.com | b9050ed | 2010-04-07 17:01:52 +0000 | [diff] [blame] | 203 | mutable bool m_knownToHaveNoOverflowAndNoFallbackFonts : 1; |
antti@apple.com | 7530ae1 | 2013-09-30 16:21:54 +0000 | [diff] [blame] | 204 | bool m_useBackslashAsYenSymbol : 1; |
antti@apple.com | 4973e7c | 2013-12-07 00:33:42 +0000 | [diff] [blame] | 205 | bool m_originalTextDiffersFromRendered : 1; |
antti@apple.com | 940f587 | 2013-10-24 20:31:11 +0000 | [diff] [blame] | 206 | |
dbates@webkit.org | acb8f4f | 2013-09-11 02:39:05 +0000 | [diff] [blame] | 207 | #if ENABLE(IOS_TEXT_AUTOSIZING) |
| 208 | // FIXME: This should probably be part of the text sizing structures in Document instead. That would save some memory. |
| 209 | float m_candidateComputedTextSize; |
| 210 | #endif |
kling@webkit.org | dcf15f8 | 2012-04-25 08:18:52 +0000 | [diff] [blame] | 211 | float m_minWidth; |
| 212 | float m_maxWidth; |
| 213 | float m_beginMinWidth; |
| 214 | float m_endMinWidth; |
| 215 | |
| 216 | String m_text; |
| 217 | |
antti@apple.com | b0b707f | 2013-10-12 17:41:13 +0000 | [diff] [blame] | 218 | RenderTextLineBoxes m_lineBoxes; |
eseidel | 3a6d132 | 2006-01-09 03:14:50 +0000 | [diff] [blame] | 219 | }; |
| 220 | |
akling@apple.com | 4f406ee | 2013-11-02 19:51:51 +0000 | [diff] [blame] | 221 | template <> inline bool isRendererOfType<const RenderText>(const RenderObject& renderer) { return renderer.isText(); } |
gyuyoung.kim@samsung.com | b0b17cd | 2013-10-24 01:30:20 +0000 | [diff] [blame] | 222 | RENDER_OBJECT_TYPE_CASTS(RenderText, isText()) |
weinig@apple.com | 7c50a3b | 2009-01-30 19:55:45 +0000 | [diff] [blame] | 223 | |
akling@apple.com | 827be9c | 2013-10-29 02:58:43 +0000 | [diff] [blame] | 224 | inline RenderStyle& RenderText::style() const |
antti@apple.com | 1e9a318 | 2013-09-27 02:02:27 +0000 | [diff] [blame] | 225 | { |
| 226 | return parent()->style(); |
| 227 | } |
| 228 | |
akling@apple.com | 827be9c | 2013-10-29 02:58:43 +0000 | [diff] [blame] | 229 | inline RenderStyle& RenderText::firstLineStyle() const |
antti@apple.com | b0608f6 | 2013-09-28 18:30:16 +0000 | [diff] [blame] | 230 | { |
| 231 | return parent()->firstLineStyle(); |
| 232 | } |
| 233 | |
akling@apple.com | d102445 | 2013-10-29 05:18:24 +0000 | [diff] [blame] | 234 | void applyTextTransform(const RenderStyle&, String&, UChar); |
commit-queue@webkit.org | 83ab3ea | 2011-10-07 23:29:50 +0000 | [diff] [blame] | 235 | |
antti@apple.com | e9c9016 | 2013-10-13 16:00:10 +0000 | [diff] [blame] | 236 | inline RenderText* Text::renderer() const |
| 237 | { |
| 238 | return toRenderText(Node::renderer()); |
| 239 | } |
| 240 | |
weinig | 0a635f0 | 2006-11-01 21:49:13 +0000 | [diff] [blame] | 241 | } // namespace WebCore |
eseidel | 3a6d132 | 2006-01-09 03:14:50 +0000 | [diff] [blame] | 242 | |
weinig | 0a635f0 | 2006-11-01 21:49:13 +0000 | [diff] [blame] | 243 | #endif // RenderText_h |