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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutBlockFlow.h

Issue 1583783002: Use IndentTextOrNot instead of a bool (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@568851-2
Patch Set: Created 4 years, 11 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2007 David Smith (catfish.man@gmail.com) 4 * (C) 2007 David Smith (catfish.man@gmail.com)
5 * Copyright (C) 2003-2013 Apple Inc. All rights reserved. 5 * Copyright (C) 2003-2013 Apple Inc. All rights reserved.
6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 6 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
7 * Copyright (C) 2013 Google Inc. All rights reserved. 7 * Copyright (C) 2013 Google Inc. All rights reserved.
8 * 8 *
9 * Redistribution and use in source and binary forms, with or without 9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions are 10 * modification, are permitted provided that the following conditions are
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 class ClipScope; 47 class ClipScope;
48 class MarginInfo; 48 class MarginInfo;
49 class LineBreaker; 49 class LineBreaker;
50 class LineInfo; 50 class LineInfo;
51 class LineWidth; 51 class LineWidth;
52 class LayoutMultiColumnFlowThread; 52 class LayoutMultiColumnFlowThread;
53 class LayoutMultiColumnSpannerPlaceholder; 53 class LayoutMultiColumnSpannerPlaceholder;
54 class LayoutRubyRun; 54 class LayoutRubyRun;
55 template <class Run> class BidiRunList; 55 template <class Run> class BidiRunList;
56 56
57 enum IndentTextOrNot { DoNotIndentText, IndentText };
58
57 // LayoutBlockFlow is the class that implements a block container in CSS 2.1. 59 // LayoutBlockFlow is the class that implements a block container in CSS 2.1.
58 // http://www.w3.org/TR/CSS21/visuren.html#block-boxes 60 // http://www.w3.org/TR/CSS21/visuren.html#block-boxes
59 // 61 //
60 // LayoutBlockFlows are the only LayoutObject allowed to own floating objects 62 // LayoutBlockFlows are the only LayoutObject allowed to own floating objects
61 // (aka floats): http://www.w3.org/TR/CSS21/visuren.html#floats . 63 // (aka floats): http://www.w3.org/TR/CSS21/visuren.html#floats .
62 // 64 //
63 // Floats are inserted into |m_floatingObjects| (see FloatingObjects for more 65 // Floats are inserted into |m_floatingObjects| (see FloatingObjects for more
64 // information on how floats are modelled) during layout. This happens either as 66 // information on how floats are modelled) during layout. This happens either as
65 // part of laying out blocks (layoutBlockChildren) or line layout (LineBreaker 67 // part of laying out blocks (layoutBlockChildren) or line layout (LineBreaker
66 // class). This is because floats can be part of an inline or a block context. 68 // class). This is because floats can be part of an inline or a block context.
(...skipping 23 matching lines...) Expand all
90 static LayoutBlockFlow* createAnonymous(Document*); 92 static LayoutBlockFlow* createAnonymous(Document*);
91 93
92 bool isLayoutBlockFlow() const final { return true; } 94 bool isLayoutBlockFlow() const final { return true; }
93 95
94 void layoutBlock(bool relayoutChildren) override; 96 void layoutBlock(bool relayoutChildren) override;
95 97
96 void computeOverflow(LayoutUnit oldClientAfterEdge, bool recomputeFloats = f alse) override; 98 void computeOverflow(LayoutUnit oldClientAfterEdge, bool recomputeFloats = f alse) override;
97 99
98 void deleteLineBoxTree() final; 100 void deleteLineBoxTree() final;
99 101
100 LayoutUnit availableLogicalWidthForLine(LayoutUnit position, bool shouldInde ntText, LayoutUnit logicalHeight = 0) const 102 LayoutUnit availableLogicalWidthForLine(LayoutUnit position, IndentTextOrNot shouldIndentText, LayoutUnit logicalHeight = 0) const
101 { 103 {
102 return max<LayoutUnit>(0, logicalRightOffsetForLine(position, shouldInde ntText, logicalHeight) - logicalLeftOffsetForLine(position, shouldIndentText, lo gicalHeight)); 104 return max<LayoutUnit>(0, logicalRightOffsetForLine(position, shouldInde ntText, logicalHeight) - logicalLeftOffsetForLine(position, shouldIndentText, lo gicalHeight));
103 } 105 }
104 LayoutUnit logicalRightOffsetForLine(LayoutUnit position, bool shouldIndentT ext, LayoutUnit logicalHeight = 0) const 106 LayoutUnit logicalRightOffsetForLine(LayoutUnit position, IndentTextOrNot sh ouldIndentText, LayoutUnit logicalHeight = 0) const
105 { 107 {
106 return logicalRightOffsetForLine(position, logicalRightOffsetForContent( ), shouldIndentText, logicalHeight); 108 return logicalRightOffsetForLine(position, logicalRightOffsetForContent( ), shouldIndentText, logicalHeight);
107 } 109 }
108 LayoutUnit logicalLeftOffsetForLine(LayoutUnit position, bool shouldIndentTe xt, LayoutUnit logicalHeight = 0) const 110 LayoutUnit logicalLeftOffsetForLine(LayoutUnit position, IndentTextOrNot sho uldIndentText, LayoutUnit logicalHeight = 0) const
109 { 111 {
110 return logicalLeftOffsetForLine(position, logicalLeftOffsetForContent(), shouldIndentText, logicalHeight); 112 return logicalLeftOffsetForLine(position, logicalLeftOffsetForContent(), shouldIndentText, logicalHeight);
111 } 113 }
112 LayoutUnit startOffsetForLine(LayoutUnit position, bool shouldIndentText, La youtUnit logicalHeight = 0) const 114 LayoutUnit startOffsetForLine(LayoutUnit position, IndentTextOrNot shouldInd entText, LayoutUnit logicalHeight = 0) const
113 { 115 {
114 return style()->isLeftToRightDirection() ? logicalLeftOffsetForLine(posi tion, shouldIndentText, logicalHeight) 116 return style()->isLeftToRightDirection() ? logicalLeftOffsetForLine(posi tion, shouldIndentText, logicalHeight)
115 : logicalWidth() - logicalRightOffsetForLine(position, shouldIndentT ext, logicalHeight); 117 : logicalWidth() - logicalRightOffsetForLine(position, shouldIndentT ext, logicalHeight);
116 } 118 }
117 LayoutUnit endOffsetForLine(LayoutUnit position, bool shouldIndentText, Layo utUnit logicalHeight = 0) const 119 LayoutUnit endOffsetForLine(LayoutUnit position, IndentTextOrNot shouldInden tText, LayoutUnit logicalHeight = 0) const
118 { 120 {
119 return !style()->isLeftToRightDirection() ? logicalLeftOffsetForLine(pos ition, shouldIndentText, logicalHeight) 121 return !style()->isLeftToRightDirection() ? logicalLeftOffsetForLine(pos ition, shouldIndentText, logicalHeight)
120 : logicalWidth() - logicalRightOffsetForLine(position, shouldIndentT ext, logicalHeight); 122 : logicalWidth() - logicalRightOffsetForLine(position, shouldIndentT ext, logicalHeight);
121 } 123 }
122 124
123 // FIXME-BLOCKFLOW: Move this into LayoutBlockFlow once there are no calls 125 // FIXME-BLOCKFLOW: Move this into LayoutBlockFlow once there are no calls
124 // in LayoutBlock. http://crbug.com/393945, http://crbug.com/302024 126 // in LayoutBlock. http://crbug.com/393945, http://crbug.com/302024
125 using LayoutBlock::lineBoxes; 127 using LayoutBlock::lineBoxes;
126 using LayoutBlock::firstLineBox; 128 using LayoutBlock::firstLineBox;
127 using LayoutBlock::lastLineBox; 129 using LayoutBlock::lastLineBox;
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 floatingObject.setWidth(logicalHeight); 178 floatingObject.setWidth(logicalHeight);
177 } 179 }
178 void setLogicalWidthForFloat(FloatingObject& floatingObject, LayoutUnit logi calWidth) 180 void setLogicalWidthForFloat(FloatingObject& floatingObject, LayoutUnit logi calWidth)
179 { 181 {
180 if (isHorizontalWritingMode()) 182 if (isHorizontalWritingMode())
181 floatingObject.setWidth(logicalWidth); 183 floatingObject.setWidth(logicalWidth);
182 else 184 else
183 floatingObject.setHeight(logicalWidth); 185 floatingObject.setHeight(logicalWidth);
184 } 186 }
185 187
186 LayoutUnit startAlignedOffsetForLine(LayoutUnit position, bool shouldIndentT ext); 188 LayoutUnit startAlignedOffsetForLine(LayoutUnit position, IndentTextOrNot sh ouldIndentText);
187 189
188 void setStaticInlinePositionForChild(LayoutBox&, LayoutUnit inlinePosition); 190 void setStaticInlinePositionForChild(LayoutBox&, LayoutUnit inlinePosition);
189 void updateStaticInlinePositionForChild(LayoutBox&, LayoutUnit logicalTop, b ool shouldIndentText = false); 191 void updateStaticInlinePositionForChild(LayoutBox&, LayoutUnit logicalTop, I ndentTextOrNot shouldIndentText = DoNotIndentText);
190 192
191 static bool shouldSkipCreatingRunsForObject(LayoutObject* obj) 193 static bool shouldSkipCreatingRunsForObject(LayoutObject* obj)
192 { 194 {
193 return obj->isFloating() || (obj->isOutOfFlowPositioned() && !obj->style ()->isOriginalDisplayInlineType() && !obj->container()->isLayoutInline()); 195 return obj->isFloating() || (obj->isOutOfFlowPositioned() && !obj->style ()->isOriginalDisplayInlineType() && !obj->container()->isLayoutInline());
194 } 196 }
195 197
196 LayoutMultiColumnFlowThread* multiColumnFlowThread() const { return m_rareDa ta ? m_rareData->m_multiColumnFlowThread : 0; } 198 LayoutMultiColumnFlowThread* multiColumnFlowThread() const { return m_rareDa ta ? m_rareData->m_multiColumnFlowThread : 0; }
197 void resetMultiColumnFlowThread() 199 void resetMultiColumnFlowThread()
198 { 200 {
199 if (m_rareData) 201 if (m_rareData)
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 304
303 void createFloatingObjects(); 305 void createFloatingObjects();
304 306
305 void styleWillChange(StyleDifference, const ComputedStyle& newStyle) overrid e; 307 void styleWillChange(StyleDifference, const ComputedStyle& newStyle) overrid e;
306 void styleDidChange(StyleDifference, const ComputedStyle* oldStyle) override ; 308 void styleDidChange(StyleDifference, const ComputedStyle* oldStyle) override ;
307 309
308 void updateBlockChildDirtyBitsBeforeLayout(bool relayoutChildren, LayoutBox& ); 310 void updateBlockChildDirtyBitsBeforeLayout(bool relayoutChildren, LayoutBox& );
309 311
310 void addOverflowFromFloats(); 312 void addOverflowFromFloats();
311 313
312 LayoutUnit logicalRightOffsetForLine(LayoutUnit logicalTop, LayoutUnit fixed Offset, bool applyTextIndent, LayoutUnit logicalHeight = 0) const 314 LayoutUnit logicalRightOffsetForLine(LayoutUnit logicalTop, LayoutUnit fixed Offset, IndentTextOrNot applyTextIndent, LayoutUnit logicalHeight = 0) const
313 { 315 {
314 return adjustLogicalRightOffsetForLine(logicalRightFloatOffsetForLine(lo gicalTop, fixedOffset, logicalHeight), applyTextIndent); 316 return adjustLogicalRightOffsetForLine(logicalRightFloatOffsetForLine(lo gicalTop, fixedOffset, logicalHeight), applyTextIndent);
315 } 317 }
316 LayoutUnit logicalLeftOffsetForLine(LayoutUnit logicalTop, LayoutUnit fixedO ffset, bool applyTextIndent, LayoutUnit logicalHeight = 0) const 318 LayoutUnit logicalLeftOffsetForLine(LayoutUnit logicalTop, LayoutUnit fixedO ffset, IndentTextOrNot applyTextIndent, LayoutUnit logicalHeight = 0) const
317 { 319 {
318 return adjustLogicalLeftOffsetForLine(logicalLeftFloatOffsetForLine(logi calTop, fixedOffset, logicalHeight), applyTextIndent); 320 return adjustLogicalLeftOffsetForLine(logicalLeftFloatOffsetForLine(logi calTop, fixedOffset, logicalHeight), applyTextIndent);
319 } 321 }
320 322
321 virtual LayoutObject* layoutSpecialExcludedChild(bool /*relayoutChildren*/, SubtreeLayoutScope&); 323 virtual LayoutObject* layoutSpecialExcludedChild(bool /*relayoutChildren*/, SubtreeLayoutScope&);
322 bool updateLogicalWidthAndColumnWidth() override; 324 bool updateLogicalWidthAndColumnWidth() override;
323 325
324 void setLogicalLeftForChild(LayoutBox& child, LayoutUnit logicalLeft); 326 void setLogicalLeftForChild(LayoutBox& child, LayoutUnit logicalLeft);
325 void setLogicalTopForChild(LayoutBox& child, LayoutUnit logicalTop); 327 void setLogicalTopForChild(LayoutBox& child, LayoutUnit logicalTop);
326 void determineLogicalLeftPositionForChild(LayoutBox& child); 328 void determineLogicalLeftPositionForChild(LayoutBox& child);
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 void paintSelection(const PaintInfo&, const LayoutPoint&) const final; 361 void paintSelection(const PaintInfo&, const LayoutPoint&) const final;
360 virtual void clipOutFloatingObjects(const LayoutBlock*, ClipScope&, const La youtPoint&, const LayoutSize&) const; 362 virtual void clipOutFloatingObjects(const LayoutBlock*, ClipScope&, const La youtPoint&, const LayoutSize&) const;
361 void clearFloats(EClear); 363 void clearFloats(EClear);
362 364
363 LayoutUnit logicalRightFloatOffsetForLine(LayoutUnit logicalTop, LayoutUnit fixedOffset, LayoutUnit logicalHeight) const; 365 LayoutUnit logicalRightFloatOffsetForLine(LayoutUnit logicalTop, LayoutUnit fixedOffset, LayoutUnit logicalHeight) const;
364 LayoutUnit logicalLeftFloatOffsetForLine(LayoutUnit logicalTop, LayoutUnit f ixedOffset, LayoutUnit logicalHeight) const; 366 LayoutUnit logicalLeftFloatOffsetForLine(LayoutUnit logicalTop, LayoutUnit f ixedOffset, LayoutUnit logicalHeight) const;
365 367
366 LayoutUnit logicalRightOffsetForPositioningFloat(LayoutUnit logicalTop, Layo utUnit fixedOffset, LayoutUnit* heightRemaining) const; 368 LayoutUnit logicalRightOffsetForPositioningFloat(LayoutUnit logicalTop, Layo utUnit fixedOffset, LayoutUnit* heightRemaining) const;
367 LayoutUnit logicalLeftOffsetForPositioningFloat(LayoutUnit logicalTop, Layou tUnit fixedOffset, LayoutUnit* heightRemaining) const; 369 LayoutUnit logicalLeftOffsetForPositioningFloat(LayoutUnit logicalTop, Layou tUnit fixedOffset, LayoutUnit* heightRemaining) const;
368 370
369 LayoutUnit adjustLogicalRightOffsetForLine(LayoutUnit offsetFromFloats, bool applyTextIndent) const; 371 LayoutUnit adjustLogicalRightOffsetForLine(LayoutUnit offsetFromFloats, Inde ntTextOrNot applyTextIndent) const;
370 LayoutUnit adjustLogicalLeftOffsetForLine(LayoutUnit offsetFromFloats, bool applyTextIndent) const; 372 LayoutUnit adjustLogicalLeftOffsetForLine(LayoutUnit offsetFromFloats, Inden tTextOrNot applyTextIndent) const;
371 373
372 virtual RootInlineBox* createRootInlineBox(); // Subclassed by SVG 374 virtual RootInlineBox* createRootInlineBox(); // Subclassed by SVG
373 375
374 bool isPagedOverflow(const ComputedStyle&); 376 bool isPagedOverflow(const ComputedStyle&);
375 377
376 enum FlowThreadType { 378 enum FlowThreadType {
377 NoFlowThread, 379 NoFlowThread,
378 MultiColumnFlowThread, 380 MultiColumnFlowThread,
379 PagedFlowThread 381 PagedFlowThread
380 }; 382 };
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
594 596
595 // END METHODS DEFINED IN LayoutBlockFlowLine 597 // END METHODS DEFINED IN LayoutBlockFlowLine
596 598
597 }; 599 };
598 600
599 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutBlockFlow, isLayoutBlockFlow()); 601 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutBlockFlow, isLayoutBlockFlow());
600 602
601 } // namespace blink 603 } // namespace blink
602 604
603 #endif // LayoutBlockFlow_h 605 #endif // LayoutBlockFlow_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698