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

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

Issue 899163003: Move rendering/RenderObject to layout/LayoutObject. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 10 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/InlineBox.cpp ('k') | Source/core/layout/line/InlineFlowBox.cpp » ('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 * Copyright (C) 2003, 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. 2 * Copyright (C) 2003, 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
3 * 3 *
4 * This library is free software; you can redistribute it and/or 4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public 5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either 6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version. 7 * version 2 of the License, or (at your option) any later version.
8 * 8 *
9 * This library is distributed in the hope that it will be useful, 9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details. 12 * Library General Public License for more details.
13 * 13 *
14 * You should have received a copy of the GNU Library General Public License 14 * You should have received a copy of the GNU Library General Public License
15 * along with this library; see the file COPYING.LIB. If not, write to 15 * along with this library; see the file COPYING.LIB. If not, write to
16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA. 17 * Boston, MA 02110-1301, USA.
18 * 18 *
19 */ 19 */
20 20
21 #ifndef InlineFlowBox_h 21 #ifndef InlineFlowBox_h
22 #define InlineFlowBox_h 22 #define InlineFlowBox_h
23 23
24 #include "core/layout/LayoutObjectInlines.h"
24 #include "core/layout/line/FloatToLayoutUnit.h" 25 #include "core/layout/line/FloatToLayoutUnit.h"
25 #include "core/layout/line/InlineBox.h" 26 #include "core/layout/line/InlineBox.h"
26 #include "core/rendering/RenderObjectInlines.h"
27 #include "core/rendering/RenderOverflow.h" 27 #include "core/rendering/RenderOverflow.h"
28 #include "core/rendering/style/ShadowData.h" 28 #include "core/rendering/style/ShadowData.h"
29 29
30 namespace blink { 30 namespace blink {
31 31
32 class HitTestRequest; 32 class HitTestRequest;
33 class HitTestResult; 33 class HitTestResult;
34 class InlineTextBox; 34 class InlineTextBox;
35 class RenderLineBoxList; 35 class RenderLineBoxList;
36 class SimpleFontData; 36 class SimpleFontData;
37 class VerticalPositionCache; 37 class VerticalPositionCache;
38 38
39 struct GlyphOverflow; 39 struct GlyphOverflow;
40 40
41 typedef HashMap<const InlineTextBox*, pair<Vector<const SimpleFontData*>, GlyphO verflow>> GlyphOverflowAndFallbackFontsMap; 41 typedef HashMap<const InlineTextBox*, pair<Vector<const SimpleFontData*>, GlyphO verflow>> GlyphOverflowAndFallbackFontsMap;
42 42
43 class InlineFlowBox : public InlineBox { 43 class InlineFlowBox : public InlineBox {
44 public: 44 public:
45 InlineFlowBox(RenderObject& obj) 45 InlineFlowBox(LayoutObject& obj)
46 : InlineBox(obj) 46 : InlineBox(obj)
47 , m_firstChild(0) 47 , m_firstChild(0)
48 , m_lastChild(0) 48 , m_lastChild(0)
49 , m_prevLineBox(0) 49 , m_prevLineBox(0)
50 , m_nextLineBox(0) 50 , m_nextLineBox(0)
51 , m_includeLogicalLeftEdge(false) 51 , m_includeLogicalLeftEdge(false)
52 , m_includeLogicalRightEdge(false) 52 , m_includeLogicalRightEdge(false)
53 , m_descendantsHaveSameLineHeightAndBaseline(true) 53 , m_descendantsHaveSameLineHeightAndBaseline(true)
54 , m_baselineType(AlphabeticBaseline) 54 , m_baselineType(AlphabeticBaseline)
55 , m_hasAnnotationsBefore(false) 55 , m_hasAnnotationsBefore(false)
(...skipping 13 matching lines...) Expand all
69 // is an image, the line is still considered to be immune from the quirk . 69 // is an image, the line is still considered to be immune from the quirk .
70 m_hasTextChildren = obj.style()->display() == LIST_ITEM; 70 m_hasTextChildren = obj.style()->display() == LIST_ITEM;
71 m_hasTextDescendants = m_hasTextChildren; 71 m_hasTextDescendants = m_hasTextChildren;
72 } 72 }
73 73
74 #if ENABLE(ASSERT) 74 #if ENABLE(ASSERT)
75 virtual ~InlineFlowBox(); 75 virtual ~InlineFlowBox();
76 #endif 76 #endif
77 77
78 #ifndef NDEBUG 78 #ifndef NDEBUG
79 virtual void showLineTreeAndMark(const InlineBox* = 0, const char* = 0, cons t InlineBox* = 0, const char* = 0, const RenderObject* = 0, int = 0) const overr ide; 79 virtual void showLineTreeAndMark(const InlineBox* = 0, const char* = 0, cons t InlineBox* = 0, const char* = 0, const LayoutObject* = 0, int = 0) const overr ide;
80 virtual const char* boxName() const override; 80 virtual const char* boxName() const override;
81 #endif 81 #endif
82 82
83 InlineFlowBox* prevLineBox() const { return m_prevLineBox; } 83 InlineFlowBox* prevLineBox() const { return m_prevLineBox; }
84 InlineFlowBox* nextLineBox() const { return m_nextLineBox; } 84 InlineFlowBox* nextLineBox() const { return m_nextLineBox; }
85 void setNextLineBox(InlineFlowBox* n) { m_nextLineBox = n; } 85 void setNextLineBox(InlineFlowBox* n) { m_nextLineBox = n; }
86 void setPreviousLineBox(InlineFlowBox* p) { m_prevLineBox = p; } 86 void setPreviousLineBox(InlineFlowBox* p) { m_prevLineBox = p; }
87 87
88 InlineBox* firstChild() const { checkConsistency(); return m_firstChild; } 88 InlineBox* firstChild() const { checkConsistency(); return m_firstChild; }
89 InlineBox* lastChild() const { checkConsistency(); return m_lastChild; } 89 InlineBox* lastChild() const { checkConsistency(); return m_lastChild; }
(...skipping 12 matching lines...) Expand all
102 for (InlineBox* child = firstChild(); child; child = child->nextOnLine() ) 102 for (InlineBox* child = firstChild(); child; child = child->nextOnLine() )
103 child->setConstructed(); 103 child->setConstructed();
104 } 104 }
105 105
106 void addToLine(InlineBox* child); 106 void addToLine(InlineBox* child);
107 virtual void deleteLine() override final; 107 virtual void deleteLine() override final;
108 virtual void extractLine() override final; 108 virtual void extractLine() override final;
109 virtual void attachLine() override final; 109 virtual void attachLine() override final;
110 virtual void adjustPosition(FloatWillBeLayoutUnit dx, FloatWillBeLayoutUnit dy) override; 110 virtual void adjustPosition(FloatWillBeLayoutUnit dx, FloatWillBeLayoutUnit dy) override;
111 111
112 virtual void extractLineBoxFromRenderObject(); 112 virtual void extractLineBoxFromLayoutObject();
113 virtual void attachLineBoxToRenderObject(); 113 virtual void attachLineBoxToLayoutObject();
114 virtual void removeLineBoxFromRenderObject(); 114 virtual void removeLineBoxFromLayoutObject();
115 115
116 virtual void clearTruncation() override; 116 virtual void clearTruncation() override;
117 117
118 IntRect roundedFrameRect() const; 118 IntRect roundedFrameRect() const;
119 119
120 virtual void paint(const PaintInfo&, const LayoutPoint&, LayoutUnit lineTop, LayoutUnit lineBottom) override; 120 virtual void paint(const PaintInfo&, const LayoutPoint&, LayoutUnit lineTop, LayoutUnit lineBottom) override;
121 virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTes tLocation& locationInContainer, const LayoutPoint& accumulatedOffset, LayoutUnit lineTop, LayoutUnit lineBottom) override; 121 virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTes tLocation& locationInContainer, const LayoutPoint& accumulatedOffset, LayoutUnit lineTop, LayoutUnit lineBottom) override;
122 122
123 bool boxShadowCanBeAppliedToBackground(const FillLayer&) const; 123 bool boxShadowCanBeAppliedToBackground(const FillLayer&) const;
124 124
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 166
167 bool includeLogicalLeftEdge() const { return m_includeLogicalLeftEdge; } 167 bool includeLogicalLeftEdge() const { return m_includeLogicalLeftEdge; }
168 bool includeLogicalRightEdge() const { return m_includeLogicalRightEdge; } 168 bool includeLogicalRightEdge() const { return m_includeLogicalRightEdge; }
169 void setEdges(bool includeLeft, bool includeRight) 169 void setEdges(bool includeLeft, bool includeRight)
170 { 170 {
171 m_includeLogicalLeftEdge = includeLeft; 171 m_includeLogicalLeftEdge = includeLeft;
172 m_includeLogicalRightEdge = includeRight; 172 m_includeLogicalRightEdge = includeRight;
173 } 173 }
174 174
175 // Helper functions used during line construction and placement. 175 // Helper functions used during line construction and placement.
176 void determineSpacingForFlowBoxes(bool lastLine, bool isLogicallyLastRunWrap ped, RenderObject* logicallyLastRunRenderer); 176 void determineSpacingForFlowBoxes(bool lastLine, bool isLogicallyLastRunWrap ped, LayoutObject* logicallyLastRunRenderer);
177 LayoutUnit getFlowSpacingLogicalWidth(); 177 LayoutUnit getFlowSpacingLogicalWidth();
178 FloatWillBeLayoutUnit placeBoxesInInlineDirection(FloatWillBeLayoutUnit logi calLeft, bool& needsWordSpacing); 178 FloatWillBeLayoutUnit placeBoxesInInlineDirection(FloatWillBeLayoutUnit logi calLeft, bool& needsWordSpacing);
179 FloatWillBeLayoutUnit placeBoxRangeInInlineDirection(InlineBox* firstChild, InlineBox* lastChild, 179 FloatWillBeLayoutUnit placeBoxRangeInInlineDirection(InlineBox* firstChild, InlineBox* lastChild,
180 FloatWillBeLayoutUnit& logicalLeft, FloatWillBeLayoutUnit& minLogicalLef t, FloatWillBeLayoutUnit& maxLogicalRight, bool& needsWordSpacing); 180 FloatWillBeLayoutUnit& logicalLeft, FloatWillBeLayoutUnit& minLogicalLef t, FloatWillBeLayoutUnit& maxLogicalRight, bool& needsWordSpacing);
181 void beginPlacingBoxRangesInInlineDirection(FloatWillBeLayoutUnit logicalLef t) { setLogicalLeft(logicalLeft); } 181 void beginPlacingBoxRangesInInlineDirection(FloatWillBeLayoutUnit logicalLef t) { setLogicalLeft(logicalLeft); }
182 void endPlacingBoxRangesInInlineDirection(FloatWillBeLayoutUnit logicalLeft, FloatWillBeLayoutUnit logicalRight, FloatWillBeLayoutUnit minLogicalLeft, Float WillBeLayoutUnit maxLogicalRight) 182 void endPlacingBoxRangesInInlineDirection(FloatWillBeLayoutUnit logicalLeft, FloatWillBeLayoutUnit logicalRight, FloatWillBeLayoutUnit minLogicalLeft, Float WillBeLayoutUnit maxLogicalRight)
183 { 183 {
184 setLogicalWidth(logicalRight - logicalLeft); 184 setLogicalWidth(logicalRight - logicalLeft);
185 if (knownToHaveNoOverflow() && (minLogicalLeft < logicalLeft || maxLogic alRight > logicalRight)) 185 if (knownToHaveNoOverflow() && (minLogicalLeft < logicalLeft || maxLogic alRight > logicalRight))
186 clearKnownToHaveNoOverflow(); 186 clearKnownToHaveNoOverflow();
187 } 187 }
188 188
189 void computeLogicalBoxHeights(RootInlineBox*, LayoutUnit& maxPositionTop, La youtUnit& maxPositionBottom, int& maxAscent, int& maxDescent, bool& setMaxAscent , bool& setMaxDescent, bool strictMode, GlyphOverflowAndFallbackFontsMap&, FontB aseline, VerticalPositionCache&); 189 void computeLogicalBoxHeights(RootInlineBox*, LayoutUnit& maxPositionTop, La youtUnit& maxPositionBottom, int& maxAscent, int& maxDescent, bool& setMaxAscent , bool& setMaxDescent, bool strictMode, GlyphOverflowAndFallbackFontsMap&, FontB aseline, VerticalPositionCache&);
190 void adjustMaxAscentAndDescent(int& maxAscent, int& maxDescent, int maxPosit ionTop, int maxPositionBottom); 190 void adjustMaxAscentAndDescent(int& maxAscent, int& maxDescent, int maxPosit ionTop, int maxPositionBottom);
191 void placeBoxesInBlockDirection(LayoutUnit logicalTop, LayoutUnit maxHeight, int maxAscent, bool strictMode, LayoutUnit& lineTop, LayoutUnit& lineBottom, La youtUnit& selectionBottom, bool& setLineTop, LayoutUnit& lineTopIncludingMargins , LayoutUnit& lineBottomIncludingMargins, bool& hasAnnotationsBefore, bool& hasA nnotationsAfter, FontBaseline); 191 void placeBoxesInBlockDirection(LayoutUnit logicalTop, LayoutUnit maxHeight, int maxAscent, bool strictMode, LayoutUnit& lineTop, LayoutUnit& lineBottom, La youtUnit& selectionBottom, bool& setLineTop, LayoutUnit& lineTopIncludingMargins , LayoutUnit& lineBottomIncludingMargins, bool& hasAnnotationsBefore, bool& hasA nnotationsAfter, FontBaseline);
192 void flipLinesInBlockDirection(LayoutUnit lineTop, LayoutUnit lineBottom); 192 void flipLinesInBlockDirection(LayoutUnit lineTop, LayoutUnit lineBottom);
193 bool requiresIdeographicBaseline(const GlyphOverflowAndFallbackFontsMap&) co nst; 193 bool requiresIdeographicBaseline(const GlyphOverflowAndFallbackFontsMap&) co nst;
194 194
195 LayoutUnit computeOverAnnotationAdjustment(LayoutUnit allowedPosition) const ; 195 LayoutUnit computeOverAnnotationAdjustment(LayoutUnit allowedPosition) const ;
196 LayoutUnit computeUnderAnnotationAdjustment(LayoutUnit allowedPosition) cons t; 196 LayoutUnit computeUnderAnnotationAdjustment(LayoutUnit allowedPosition) cons t;
197 197
198 void computeOverflow(LayoutUnit lineTop, LayoutUnit lineBottom, GlyphOverflo wAndFallbackFontsMap&); 198 void computeOverflow(LayoutUnit lineTop, LayoutUnit lineBottom, GlyphOverflo wAndFallbackFontsMap&);
199 199
200 void removeChild(InlineBox* child, MarkLineBoxes); 200 void removeChild(InlineBox* child, MarkLineBoxes);
201 201
202 virtual RenderObject::SelectionState selectionState() const override; 202 virtual LayoutObject::SelectionState selectionState() const override;
203 203
204 virtual bool canAccommodateEllipsis(bool ltr, int blockEdge, int ellipsisWid th) const override final; 204 virtual bool canAccommodateEllipsis(bool ltr, int blockEdge, int ellipsisWid th) const override final;
205 virtual FloatWillBeLayoutUnit placeEllipsisBox(bool ltr, FloatWillBeLayoutUn it blockLeftEdge, FloatWillBeLayoutUnit blockRightEdge, FloatWillBeLayoutUnit el lipsisWidth, FloatWillBeLayoutUnit &truncatedWidth, bool&) override; 205 virtual FloatWillBeLayoutUnit placeEllipsisBox(bool ltr, FloatWillBeLayoutUn it blockLeftEdge, FloatWillBeLayoutUnit blockRightEdge, FloatWillBeLayoutUnit el lipsisWidth, FloatWillBeLayoutUnit &truncatedWidth, bool&) override;
206 206
207 bool hasTextChildren() const { return m_hasTextChildren; } 207 bool hasTextChildren() const { return m_hasTextChildren; }
208 bool hasTextDescendants() const { return m_hasTextDescendants; } 208 bool hasTextDescendants() const { return m_hasTextDescendants; }
209 void setHasTextDescendants() { m_hasTextDescendants = true; } 209 void setHasTextDescendants() { m_hasTextDescendants = true; }
210 210
211 void checkConsistency() const; 211 void checkConsistency() const;
212 void setHasBadChildList(); 212 void setHasBadChildList();
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 void setVisualOverflow(const LayoutRect&, const LayoutRect&); 304 void setVisualOverflow(const LayoutRect&, const LayoutRect&);
305 305
306 protected: 306 protected:
307 OwnPtr<RenderOverflow> m_overflow; 307 OwnPtr<RenderOverflow> m_overflow;
308 308
309 virtual bool isInlineFlowBox() const override final { return true; } 309 virtual bool isInlineFlowBox() const override final { return true; }
310 310
311 InlineBox* m_firstChild; 311 InlineBox* m_firstChild;
312 InlineBox* m_lastChild; 312 InlineBox* m_lastChild;
313 313
314 InlineFlowBox* m_prevLineBox; // The previous box that also uses our RenderO bject 314 InlineFlowBox* m_prevLineBox; // The previous box that also uses our LayoutO bject
315 InlineFlowBox* m_nextLineBox; // The next box that also uses our RenderObjec t 315 InlineFlowBox* m_nextLineBox; // The next box that also uses our LayoutObjec t
316 316
317 // Maximum logicalTop among all children of an InlineFlowBox. Used to 317 // Maximum logicalTop among all children of an InlineFlowBox. Used to
318 // calculate the offset for TextUnderlinePositionUnder. 318 // calculate the offset for TextUnderlinePositionUnder.
319 void computeMaxLogicalTop(FloatWillBeLayoutUnit& maxLogicalTop) const; 319 void computeMaxLogicalTop(FloatWillBeLayoutUnit& maxLogicalTop) const;
320 320
321 private: 321 private:
322 unsigned m_includeLogicalLeftEdge : 1; 322 unsigned m_includeLogicalLeftEdge : 1;
323 unsigned m_includeLogicalRightEdge : 1; 323 unsigned m_includeLogicalRightEdge : 1;
324 unsigned m_hasTextChildren : 1; 324 unsigned m_hasTextChildren : 1;
325 unsigned m_hasTextDescendants : 1; 325 unsigned m_hasTextDescendants : 1;
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 } 365 }
366 366
367 } // namespace blink 367 } // namespace blink
368 368
369 #ifndef NDEBUG 369 #ifndef NDEBUG
370 // Outside the WebCore namespace for ease of invocation from gdb. 370 // Outside the WebCore namespace for ease of invocation from gdb.
371 void showTree(const blink::InlineFlowBox*); 371 void showTree(const blink::InlineFlowBox*);
372 #endif 372 #endif
373 373
374 #endif // InlineFlowBox_h 374 #endif // InlineFlowBox_h
OLDNEW
« no previous file with comments | « Source/core/layout/line/InlineBox.cpp ('k') | Source/core/layout/line/InlineFlowBox.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698