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, 2009, 2010, 2011 Apple Inc. All rights reserv
ed. | 4 * Copyright (C) 2004, 2005, 2006, 2009, 2010, 2011 Apple Inc. All rights reserv
ed. |
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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 , m_nextTextBox(0) | 46 , m_nextTextBox(0) |
47 , m_start(start) | 47 , m_start(start) |
48 , m_len(length) | 48 , m_len(length) |
49 , m_truncation(cNoTruncation) | 49 , m_truncation(cNoTruncation) |
50 { | 50 { |
51 setIsText(true); | 51 setIsText(true); |
52 } | 52 } |
53 | 53 |
54 RenderText& renderer() const { return toRenderText(InlineBox::renderer()); } | 54 RenderText& renderer() const { return toRenderText(InlineBox::renderer()); } |
55 | 55 |
56 virtual void destroy() OVERRIDE FINAL; | 56 virtual void destroy() override final; |
57 | 57 |
58 InlineTextBox* prevTextBox() const { return m_prevTextBox; } | 58 InlineTextBox* prevTextBox() const { return m_prevTextBox; } |
59 InlineTextBox* nextTextBox() const { return m_nextTextBox; } | 59 InlineTextBox* nextTextBox() const { return m_nextTextBox; } |
60 void setNextTextBox(InlineTextBox* n) { m_nextTextBox = n; } | 60 void setNextTextBox(InlineTextBox* n) { m_nextTextBox = n; } |
61 void setPreviousTextBox(InlineTextBox* p) { m_prevTextBox = p; } | 61 void setPreviousTextBox(InlineTextBox* p) { m_prevTextBox = p; } |
62 | 62 |
63 // FIXME: These accessors should ASSERT(!isDirty()). See https://bugs.webkit
.org/show_bug.cgi?id=97264 | 63 // FIXME: These accessors should ASSERT(!isDirty()). See https://bugs.webkit
.org/show_bug.cgi?id=97264 |
64 unsigned start() const { return m_start; } | 64 unsigned start() const { return m_start; } |
65 unsigned end() const { return m_len ? m_start + m_len - 1 : m_start; } | 65 unsigned end() const { return m_len ? m_start + m_len - 1 : m_start; } |
66 unsigned len() const { return m_len; } | 66 unsigned len() const { return m_len; } |
67 | 67 |
68 void offsetRun(int delta); | 68 void offsetRun(int delta); |
69 | 69 |
70 unsigned short truncation() { return m_truncation; } | 70 unsigned short truncation() { return m_truncation; } |
71 | 71 |
72 virtual void markDirty() OVERRIDE FINAL; | 72 virtual void markDirty() override final; |
73 | 73 |
74 using InlineBox::hasHyphen; | 74 using InlineBox::hasHyphen; |
75 using InlineBox::setHasHyphen; | 75 using InlineBox::setHasHyphen; |
76 using InlineBox::canHaveLeadingExpansion; | 76 using InlineBox::canHaveLeadingExpansion; |
77 using InlineBox::setCanHaveLeadingExpansion; | 77 using InlineBox::setCanHaveLeadingExpansion; |
78 | 78 |
79 static inline bool compareByStart(const InlineTextBox* first, const InlineTe
xtBox* second) { return first->start() < second->start(); } | 79 static inline bool compareByStart(const InlineTextBox* first, const InlineTe
xtBox* second) { return first->start() < second->start(); } |
80 | 80 |
81 virtual int baselinePosition(FontBaseline) const OVERRIDE FINAL; | 81 virtual int baselinePosition(FontBaseline) const override final; |
82 virtual LayoutUnit lineHeight() const OVERRIDE FINAL; | 82 virtual LayoutUnit lineHeight() const override final; |
83 | 83 |
84 bool getEmphasisMarkPosition(RenderStyle*, TextEmphasisPosition&) const; | 84 bool getEmphasisMarkPosition(RenderStyle*, TextEmphasisPosition&) const; |
85 | 85 |
86 LayoutRect logicalOverflowRect() const; | 86 LayoutRect logicalOverflowRect() const; |
87 void setLogicalOverflowRect(const LayoutRect&); | 87 void setLogicalOverflowRect(const LayoutRect&); |
88 LayoutUnit logicalTopVisualOverflow() const { return logicalOverflowRect().y
(); } | 88 LayoutUnit logicalTopVisualOverflow() const { return logicalOverflowRect().y
(); } |
89 LayoutUnit logicalBottomVisualOverflow() const { return logicalOverflowRect(
).maxY(); } | 89 LayoutUnit logicalBottomVisualOverflow() const { return logicalOverflowRect(
).maxY(); } |
90 | 90 |
91 // charactersWithHyphen, if provided, must not be destroyed before the TextR
un. | 91 // charactersWithHyphen, if provided, must not be destroyed before the TextR
un. |
92 TextRun constructTextRun(RenderStyle*, const Font&, StringBuilder* character
sWithHyphen = 0) const; | 92 TextRun constructTextRun(RenderStyle*, const Font&, StringBuilder* character
sWithHyphen = 0) const; |
93 TextRun constructTextRun(RenderStyle*, const Font&, StringView, int maximumL
ength, StringBuilder* charactersWithHyphen = 0) const; | 93 TextRun constructTextRun(RenderStyle*, const Font&, StringView, int maximumL
ength, StringBuilder* charactersWithHyphen = 0) const; |
94 | 94 |
95 #ifndef NDEBUG | 95 #ifndef NDEBUG |
96 virtual void showBox(int = 0) const OVERRIDE; | 96 virtual void showBox(int = 0) const override; |
97 virtual const char* boxName() const OVERRIDE; | 97 virtual const char* boxName() const override; |
98 #endif | 98 #endif |
99 | 99 |
100 enum RotationDirection { Counterclockwise, Clockwise }; | 100 enum RotationDirection { Counterclockwise, Clockwise }; |
101 static AffineTransform rotation(const FloatRect& boxRect, RotationDirection)
; | 101 static AffineTransform rotation(const FloatRect& boxRect, RotationDirection)
; |
102 | 102 |
103 public: | 103 public: |
104 TextRun constructTextRunForInspector(RenderStyle*, const Font&) const; | 104 TextRun constructTextRunForInspector(RenderStyle*, const Font&) const; |
105 virtual FloatRect calculateBoundaries() const OVERRIDE { return FloatRect(x(
), y(), width(), height()); } | 105 virtual FloatRect calculateBoundaries() const override { return FloatRect(x(
), y(), width(), height()); } |
106 | 106 |
107 virtual LayoutRect localSelectionRect(int startPos, int endPos); | 107 virtual LayoutRect localSelectionRect(int startPos, int endPos); |
108 bool isSelected(int startPos, int endPos) const; | 108 bool isSelected(int startPos, int endPos) const; |
109 void selectionStartEnd(int& sPos, int& ePos) const; | 109 void selectionStartEnd(int& sPos, int& ePos) const; |
110 | 110 |
111 // These functions both paint markers and update the DocumentMarker's render
edRect. | 111 // These functions both paint markers and update the DocumentMarker's render
edRect. |
112 virtual void paintDocumentMarker(GraphicsContext*, const FloatPoint& boxOrig
in, DocumentMarker*, RenderStyle*, const Font&, bool grammar); | 112 virtual void paintDocumentMarker(GraphicsContext*, const FloatPoint& boxOrig
in, DocumentMarker*, RenderStyle*, const Font&, bool grammar); |
113 virtual void paintTextMatchMarker(GraphicsContext*, const FloatPoint& boxOri
gin, DocumentMarker*, RenderStyle*, const Font&); | 113 virtual void paintTextMatchMarker(GraphicsContext*, const FloatPoint& boxOri
gin, DocumentMarker*, RenderStyle*, const Font&); |
114 | 114 |
115 protected: | 115 protected: |
116 virtual void paint(PaintInfo&, const LayoutPoint&, LayoutUnit lineTop, Layou
tUnit lineBottom) OVERRIDE; | 116 virtual void paint(PaintInfo&, const LayoutPoint&, LayoutUnit lineTop, Layou
tUnit lineBottom) override; |
117 virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTes
tLocation& locationInContainer, const LayoutPoint& accumulatedOffset, LayoutUnit
lineTop, LayoutUnit lineBottom) OVERRIDE; | 117 virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTes
tLocation& locationInContainer, const LayoutPoint& accumulatedOffset, LayoutUnit
lineTop, LayoutUnit lineBottom) override; |
118 | 118 |
119 private: | 119 private: |
120 virtual void deleteLine() OVERRIDE FINAL; | 120 virtual void deleteLine() override final; |
121 virtual void extractLine() OVERRIDE FINAL; | 121 virtual void extractLine() override final; |
122 virtual void attachLine() OVERRIDE FINAL; | 122 virtual void attachLine() override final; |
123 | 123 |
124 public: | 124 public: |
125 virtual RenderObject::SelectionState selectionState() const OVERRIDE FINAL; | 125 virtual RenderObject::SelectionState selectionState() const override final; |
126 | 126 |
127 private: | 127 private: |
128 virtual void clearTruncation() OVERRIDE FINAL { m_truncation = cNoTruncation
; } | 128 virtual void clearTruncation() override final { m_truncation = cNoTruncation
; } |
129 virtual float placeEllipsisBox(bool flowIsLTR, float visibleLeftEdge, float
visibleRightEdge, float ellipsisWidth, float &truncatedWidth, bool& foundBox) OV
ERRIDE FINAL; | 129 virtual float placeEllipsisBox(bool flowIsLTR, float visibleLeftEdge, float
visibleRightEdge, float ellipsisWidth, float &truncatedWidth, bool& foundBox) ov
erride final; |
130 | 130 |
131 public: | 131 public: |
132 virtual bool isLineBreak() const OVERRIDE FINAL; | 132 virtual bool isLineBreak() const override final; |
133 | 133 |
134 void setExpansion(int newExpansion) | 134 void setExpansion(int newExpansion) |
135 { | 135 { |
136 m_logicalWidth -= expansion(); | 136 m_logicalWidth -= expansion(); |
137 InlineBox::setExpansion(newExpansion); | 137 InlineBox::setExpansion(newExpansion); |
138 m_logicalWidth += newExpansion; | 138 m_logicalWidth += newExpansion; |
139 } | 139 } |
140 | 140 |
141 private: | 141 private: |
142 virtual bool isInlineTextBox() const OVERRIDE FINAL { return true; } | 142 virtual bool isInlineTextBox() const override final { return true; } |
143 | 143 |
144 public: | 144 public: |
145 virtual int caretMinOffset() const OVERRIDE FINAL; | 145 virtual int caretMinOffset() const override final; |
146 virtual int caretMaxOffset() const OVERRIDE FINAL; | 146 virtual int caretMaxOffset() const override final; |
147 | 147 |
148 float textPos() const; // returns the x position relative to the left start
of the text line. | 148 float textPos() const; // returns the x position relative to the left start
of the text line. |
149 | 149 |
150 public: | 150 public: |
151 virtual int offsetForPosition(float x, bool includePartialGlyphs = true) con
st; | 151 virtual int offsetForPosition(float x, bool includePartialGlyphs = true) con
st; |
152 virtual float positionForOffset(int offset) const; | 152 virtual float positionForOffset(int offset) const; |
153 | 153 |
154 bool containsCaretOffset(int offset) const; // false for offset after line b
reak | 154 bool containsCaretOffset(int offset) const; // false for offset after line b
reak |
155 | 155 |
156 // Fills a vector with the pixel width of each character. | 156 // Fills a vector with the pixel width of each character. |
(...skipping 23 matching lines...) Expand all Loading... |
180 | 180 |
181 inline AffineTransform InlineTextBox::rotation(const FloatRect& boxRect, Rotatio
nDirection rotationDirection) | 181 inline AffineTransform InlineTextBox::rotation(const FloatRect& boxRect, Rotatio
nDirection rotationDirection) |
182 { | 182 { |
183 return rotationDirection == Clockwise ? AffineTransform(0, 1, -1, 0, boxRect
.x() + boxRect.maxY(), boxRect.maxY() - boxRect.x()) | 183 return rotationDirection == Clockwise ? AffineTransform(0, 1, -1, 0, boxRect
.x() + boxRect.maxY(), boxRect.maxY() - boxRect.x()) |
184 : AffineTransform(0, -1, 1, 0, boxRect.x() - boxRect.maxY(), boxRect.x()
+ boxRect.maxY()); | 184 : AffineTransform(0, -1, 1, 0, boxRect.x() - boxRect.maxY(), boxRect.x()
+ boxRect.maxY()); |
185 } | 185 } |
186 | 186 |
187 } // namespace blink | 187 } // namespace blink |
188 | 188 |
189 #endif // InlineTextBox_h | 189 #endif // InlineTextBox_h |
OLD | NEW |