Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1043)

Side by Side Diff: Source/core/layout/line/InlineTextBox.h

Issue 1231363003: Fix virtual/override/final usage in Source/core/layout/. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/layout/line/InlineFlowBox.h ('k') | Source/core/layout/line/RootInlineBox.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 , m_nextTextBox(nullptr) 44 , m_nextTextBox(nullptr)
45 , m_start(start) 45 , m_start(start)
46 , m_len(length) 46 , m_len(length)
47 , m_truncation(cNoTruncation) 47 , m_truncation(cNoTruncation)
48 { 48 {
49 setIsText(true); 49 setIsText(true);
50 } 50 }
51 51
52 LayoutText& layoutObject() const { return toLayoutText(InlineBox::layoutObje ct()); } 52 LayoutText& layoutObject() const { return toLayoutText(InlineBox::layoutObje ct()); }
53 53
54 virtual void destroy() override final; 54 void destroy() final;
55 55
56 InlineTextBox* prevTextBox() const { return m_prevTextBox; } 56 InlineTextBox* prevTextBox() const { return m_prevTextBox; }
57 InlineTextBox* nextTextBox() const { return m_nextTextBox; } 57 InlineTextBox* nextTextBox() const { return m_nextTextBox; }
58 void setNextTextBox(InlineTextBox* n) { m_nextTextBox = n; } 58 void setNextTextBox(InlineTextBox* n) { m_nextTextBox = n; }
59 void setPreviousTextBox(InlineTextBox* p) { m_prevTextBox = p; } 59 void setPreviousTextBox(InlineTextBox* p) { m_prevTextBox = p; }
60 60
61 // FIXME: These accessors should ASSERT(!isDirty()). See https://bugs.webkit .org/show_bug.cgi?id=97264 61 // FIXME: These accessors should ASSERT(!isDirty()). See https://bugs.webkit .org/show_bug.cgi?id=97264
62 unsigned start() const { return m_start; } 62 unsigned start() const { return m_start; }
63 unsigned end() const { return m_len ? m_start + m_len - 1 : m_start; } 63 unsigned end() const { return m_len ? m_start + m_len - 1 : m_start; }
64 unsigned len() const { return m_len; } 64 unsigned len() const { return m_len; }
65 65
66 void offsetRun(int delta); 66 void offsetRun(int delta);
67 67
68 unsigned short truncation() { return m_truncation; } 68 unsigned short truncation() { return m_truncation; }
69 69
70 virtual void markDirty() override final; 70 void markDirty() final;
71 71
72 using InlineBox::hasHyphen; 72 using InlineBox::hasHyphen;
73 using InlineBox::setHasHyphen; 73 using InlineBox::setHasHyphen;
74 using InlineBox::canHaveLeadingExpansion; 74 using InlineBox::canHaveLeadingExpansion;
75 using InlineBox::setCanHaveLeadingExpansion; 75 using InlineBox::setCanHaveLeadingExpansion;
76 76
77 static inline bool compareByStart(const InlineTextBox* first, const InlineTe xtBox* second) { return first->start() < second->start(); } 77 static inline bool compareByStart(const InlineTextBox* first, const InlineTe xtBox* second) { return first->start() < second->start(); }
78 78
79 virtual int baselinePosition(FontBaseline) const override final; 79 int baselinePosition(FontBaseline) const final;
80 virtual LayoutUnit lineHeight() const override final; 80 LayoutUnit lineHeight() const final;
81 81
82 bool getEmphasisMarkPosition(const ComputedStyle&, TextEmphasisPosition&) co nst; 82 bool getEmphasisMarkPosition(const ComputedStyle&, TextEmphasisPosition&) co nst;
83 83
84 LayoutRect logicalOverflowRect() const; 84 LayoutRect logicalOverflowRect() const;
85 void setLogicalOverflowRect(const LayoutRect&); 85 void setLogicalOverflowRect(const LayoutRect&);
86 LayoutUnit logicalTopVisualOverflow() const { return logicalOverflowRect().y (); } 86 LayoutUnit logicalTopVisualOverflow() const { return logicalOverflowRect().y (); }
87 LayoutUnit logicalBottomVisualOverflow() const { return logicalOverflowRect( ).maxY(); } 87 LayoutUnit logicalBottomVisualOverflow() const { return logicalOverflowRect( ).maxY(); }
88 88
89 // charactersWithHyphen, if provided, must not be destroyed before the TextR un. 89 // charactersWithHyphen, if provided, must not be destroyed before the TextR un.
90 TextRun constructTextRun(const ComputedStyle&, const Font&, StringBuilder* c haractersWithHyphen = nullptr) const; 90 TextRun constructTextRun(const ComputedStyle&, const Font&, StringBuilder* c haractersWithHyphen = nullptr) const;
91 TextRun constructTextRun(const ComputedStyle&, const Font&, StringView, int maximumLength, StringBuilder* charactersWithHyphen = nullptr) const; 91 TextRun constructTextRun(const ComputedStyle&, const Font&, StringView, int maximumLength, StringBuilder* charactersWithHyphen = nullptr) const;
92 92
93 #ifndef NDEBUG 93 #ifndef NDEBUG
94 virtual void showBox(int = 0) const override; 94 void showBox(int = 0) const override;
95 #endif 95 #endif
96 virtual const char* boxName() const override; 96 const char* boxName() const override;
97 virtual String debugName() const override; 97 String debugName() const override;
98 98
99 String text() const; 99 String text() const;
100 100
101 public: 101 public:
102 TextRun constructTextRunForInspector(const ComputedStyle&, const Font&) cons t; 102 TextRun constructTextRunForInspector(const ComputedStyle&, const Font&) cons t;
103 virtual LayoutRect calculateBoundaries() const override { return LayoutRect( x(), y(), width(), height()); } 103 LayoutRect calculateBoundaries() const override { return LayoutRect(x(), y() , width(), height()); }
104 104
105 virtual LayoutRect localSelectionRect(int startPos, int endPos); 105 virtual LayoutRect localSelectionRect(int startPos, int endPos);
106 bool isSelected(int startPos, int endPos) const; 106 bool isSelected(int startPos, int endPos) const;
107 void selectionStartEnd(int& sPos, int& ePos) const; 107 void selectionStartEnd(int& sPos, int& ePos) const;
108 108
109 // These functions both paint markers and update the DocumentMarker's render edRect. 109 // These functions both paint markers and update the DocumentMarker's render edRect.
110 virtual void paintDocumentMarker(GraphicsContext*, const LayoutPoint& boxOri gin, DocumentMarker*, const ComputedStyle&, const Font&, bool grammar); 110 virtual void paintDocumentMarker(GraphicsContext*, const LayoutPoint& boxOri gin, DocumentMarker*, const ComputedStyle&, const Font&, bool grammar);
111 virtual void paintTextMatchMarker(GraphicsContext*, const LayoutPoint& boxOr igin, DocumentMarker*, const ComputedStyle&, const Font&); 111 virtual void paintTextMatchMarker(GraphicsContext*, const LayoutPoint& boxOr igin, DocumentMarker*, const ComputedStyle&, const Font&);
112 112
113 virtual void move(const LayoutSize&) override final; 113 void move(const LayoutSize&) final;
114 114
115 protected: 115 protected:
116 virtual void paint(const PaintInfo&, const LayoutPoint&, LayoutUnit lineTop, LayoutUnit lineBottom) override; 116 void paint(const PaintInfo&, const LayoutPoint&, LayoutUnit lineTop, LayoutU nit lineBottom) override;
117 virtual bool nodeAtPoint(HitTestResult&, const HitTestLocation& locationInCo ntainer, const LayoutPoint& accumulatedOffset, LayoutUnit lineTop, LayoutUnit li neBottom) override; 117 bool nodeAtPoint(HitTestResult&, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, LayoutUnit lineTop, LayoutUnit lineBottom ) override;
118 118
119 private: 119 private:
120 virtual void deleteLine() override final; 120 void deleteLine() final;
121 virtual void extractLine() override final; 121 void extractLine() final;
122 virtual void attachLine() override final; 122 void attachLine() final;
123 123
124 public: 124 public:
125 virtual LayoutObject::SelectionState selectionState() const override final; 125 LayoutObject::SelectionState selectionState() const final;
126 126
127 private: 127 private:
128 virtual void clearTruncation() override final { m_truncation = cNoTruncation ; } 128 void clearTruncation() final { m_truncation = cNoTruncation; }
129 virtual LayoutUnit placeEllipsisBox(bool flowIsLTR, LayoutUnit visibleLeftEd ge, LayoutUnit visibleRightEdge, LayoutUnit ellipsisWidth, LayoutUnit &truncated Width, bool& foundBox) override final; 129 LayoutUnit placeEllipsisBox(bool flowIsLTR, LayoutUnit visibleLeftEdge, Layo utUnit visibleRightEdge, LayoutUnit ellipsisWidth, LayoutUnit &truncatedWidth, b ool& foundBox) final;
130 130
131 public: 131 public:
132 virtual bool isLineBreak() const override final; 132 bool isLineBreak() const 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 bool isInlineTextBox() const final { return true; }
143 143
144 public: 144 public:
145 virtual int caretMinOffset() const override final; 145 int caretMinOffset() const final;
146 virtual int caretMaxOffset() const override final; 146 int caretMaxOffset() const final;
147 147
148 LayoutUnit textPos() const; // returns the x position relative to the left s tart of the text line. 148 LayoutUnit textPos() const; // returns the x position relative to the left s tart of the text line.
149 149
150 public: 150 public:
151 virtual int offsetForPosition(LayoutUnit x, bool includePartialGlyphs = true ) const; 151 virtual int offsetForPosition(LayoutUnit x, bool includePartialGlyphs = true ) const;
152 virtual LayoutUnit positionForOffset(int offset) const; 152 virtual LayoutUnit 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 18 matching lines...) Expand all
175 } 175 }
176 }; 176 };
177 177
178 DEFINE_INLINE_BOX_TYPE_CASTS(InlineTextBox); 178 DEFINE_INLINE_BOX_TYPE_CASTS(InlineTextBox);
179 179
180 void alignSelectionRectToDevicePixels(LayoutRect&); 180 void alignSelectionRectToDevicePixels(LayoutRect&);
181 181
182 } // namespace blink 182 } // namespace blink
183 183
184 #endif // InlineTextBox_h 184 #endif // InlineTextBox_h
OLDNEW
« no previous file with comments | « Source/core/layout/line/InlineFlowBox.h ('k') | Source/core/layout/line/RootInlineBox.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698