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

Side by Side Diff: sky/engine/core/rendering/RenderBlockFlow.h

Issue 697713002: Remove line breaking to avoid window. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month 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
« no previous file with comments | « no previous file | sky/engine/core/rendering/RenderBlockFlow.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) 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 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 return adjustLogicalLeftOffsetForLine(logicalLeftFloatOffsetForLine(logi calTop, fixedOffset, logicalHeight), applyTextIndent); 149 return adjustLogicalLeftOffsetForLine(logicalLeftFloatOffsetForLine(logi calTop, fixedOffset, logicalHeight), applyTextIndent);
150 } 150 }
151 151
152 virtual bool updateLogicalWidthAndColumnWidth() override; 152 virtual bool updateLogicalWidthAndColumnWidth() override;
153 153
154 void setLogicalLeftForChild(RenderBox* child, LayoutUnit logicalLeft); 154 void setLogicalLeftForChild(RenderBox* child, LayoutUnit logicalLeft);
155 void setLogicalTopForChild(RenderBox* child, LayoutUnit logicalTop); 155 void setLogicalTopForChild(RenderBox* child, LayoutUnit logicalTop);
156 void determineLogicalLeftPositionForChild(RenderBox* child); 156 void determineLogicalLeftPositionForChild(RenderBox* child);
157 157
158 private: 158 private:
159 bool layoutBlockFlow(bool relayoutChildren, SubtreeLayoutScope&); 159 void layoutBlockFlow(bool relayoutChildren, SubtreeLayoutScope&);
160 void layoutBlockChildren(bool relayoutChildren, SubtreeLayoutScope&, LayoutU nit beforeEdge, LayoutUnit afterEdge); 160 void layoutBlockChildren(bool relayoutChildren, SubtreeLayoutScope&, LayoutU nit beforeEdge, LayoutUnit afterEdge);
161 161
162 void layoutBlockChild(RenderBox* child, MarginInfo&, LayoutUnit& previousFlo atLogicalBottom); 162 void layoutBlockChild(RenderBox* child, MarginInfo&, LayoutUnit& previousFlo atLogicalBottom);
163 void adjustPositionedBlock(RenderBox* child, const MarginInfo&); 163 void adjustPositionedBlock(RenderBox* child, const MarginInfo&);
164 void adjustFloatingBlock(const MarginInfo&); 164 void adjustFloatingBlock(const MarginInfo&);
165 165
166 LayoutPoint computeLogicalLocationForFloat(const FloatingObject*, LayoutUnit logicalTopOffset) const; 166 LayoutPoint computeLogicalLocationForFloat(const FloatingObject*, LayoutUnit logicalTopOffset) const;
167 167
168 // Called from lineWidth, to position the floats added in the last line. 168 // Called from lineWidth, to position the floats added in the last line.
169 // Returns true if and only if it has positioned any floats. 169 // Returns true if and only if it has positioned any floats.
(...skipping 22 matching lines...) Expand all
192 LayoutUnit logicalRightOffsetForPositioningFloat(LayoutUnit logicalTop, Layo utUnit fixedOffset, bool applyTextIndent, LayoutUnit* heightRemaining) const; 192 LayoutUnit logicalRightOffsetForPositioningFloat(LayoutUnit logicalTop, Layo utUnit fixedOffset, bool applyTextIndent, LayoutUnit* heightRemaining) const;
193 LayoutUnit logicalLeftOffsetForPositioningFloat(LayoutUnit logicalTop, Layou tUnit fixedOffset, bool applyTextIndent, LayoutUnit* heightRemaining) const; 193 LayoutUnit logicalLeftOffsetForPositioningFloat(LayoutUnit logicalTop, Layou tUnit fixedOffset, bool applyTextIndent, LayoutUnit* heightRemaining) const;
194 194
195 LayoutUnit adjustLogicalRightOffsetForLine(LayoutUnit offsetFromFloats, bool applyTextIndent) const; 195 LayoutUnit adjustLogicalRightOffsetForLine(LayoutUnit offsetFromFloats, bool applyTextIndent) const;
196 LayoutUnit adjustLogicalLeftOffsetForLine(LayoutUnit offsetFromFloats, bool applyTextIndent) const; 196 LayoutUnit adjustLogicalLeftOffsetForLine(LayoutUnit offsetFromFloats, bool applyTextIndent) const;
197 197
198 virtual RootInlineBox* createRootInlineBox(); // Subclassed by SVG 198 virtual RootInlineBox* createRootInlineBox(); // Subclassed by SVG
199 199
200 void updateLogicalWidthForAlignment(const ETextAlign&, const RootInlineBox*, BidiRun* trailingSpaceRun, float& logicalLeft, float& totalLogicalWidth, float& availableLogicalWidth, unsigned expansionOpportunityCount); 200 void updateLogicalWidthForAlignment(const ETextAlign&, const RootInlineBox*, BidiRun* trailingSpaceRun, float& logicalLeft, float& totalLogicalWidth, float& availableLogicalWidth, unsigned expansionOpportunityCount);
201 201
202 bool shouldBreakAtLineToAvoidWidow() const { return m_rareData && m_rareData ->m_lineBreakToAvoidWidow >= 0; }
203 void clearShouldBreakAtLineToAvoidWidow() const;
204 int lineBreakToAvoidWidow() const { return m_rareData ? m_rareData->m_lineBr eakToAvoidWidow : -1; }
205 void setBreakAtLineToAvoidWidow(int);
206 void clearDidBreakAtLineToAvoidWidow();
207 void setDidBreakAtLineToAvoidWidow();
208 bool didBreakAtLineToAvoidWidow() const { return m_rareData && m_rareData->m _didBreakAtLineToAvoidWidow; }
209
210 public: 202 public:
211 struct FloatWithRect { 203 struct FloatWithRect {
212 FloatWithRect(RenderBox* f) 204 FloatWithRect(RenderBox* f)
213 : object(f) 205 : object(f)
214 , rect(LayoutRect(f->x() - f->marginLeft(), f->y() - f->marginTop(), f->width() + f->marginWidth(), f->height() + f->marginHeight())) 206 , rect(LayoutRect(f->x() - f->marginLeft(), f->y() - f->marginTop(), f->width() + f->marginWidth(), f->height() + f->marginHeight()))
215 , everHadLayout(f->everHadLayout()) 207 , everHadLayout(f->everHadLayout())
216 { 208 {
217 } 209 }
218 210
219 RenderBox* object; 211 RenderBox* object;
(...skipping 27 matching lines...) Expand all
247 LayoutUnit m_negativeMarginAfter; 239 LayoutUnit m_negativeMarginAfter;
248 }; 240 };
249 MarginValues marginValuesForChild(RenderBox* child) const; 241 MarginValues marginValuesForChild(RenderBox* child) const;
250 242
251 // Allocated only when some of these fields have non-default values 243 // Allocated only when some of these fields have non-default values
252 struct RenderBlockFlowRareData : public DummyBase<RenderBlockFlowRareData> { 244 struct RenderBlockFlowRareData : public DummyBase<RenderBlockFlowRareData> {
253 WTF_MAKE_NONCOPYABLE(RenderBlockFlowRareData); WTF_MAKE_FAST_ALLOCATED_W ILL_BE_REMOVED; 245 WTF_MAKE_NONCOPYABLE(RenderBlockFlowRareData); WTF_MAKE_FAST_ALLOCATED_W ILL_BE_REMOVED;
254 public: 246 public:
255 RenderBlockFlowRareData(const RenderBlockFlow* block) 247 RenderBlockFlowRareData(const RenderBlockFlow* block)
256 : m_margins(positiveMarginBeforeDefault(block), negativeMarginBefore Default(block), positiveMarginAfterDefault(block), negativeMarginAfterDefault(bl ock)) 248 : m_margins(positiveMarginBeforeDefault(block), negativeMarginBefore Default(block), positiveMarginAfterDefault(block), negativeMarginAfterDefault(bl ock))
257 , m_lineBreakToAvoidWidow(-1)
258 , m_didBreakAtLineToAvoidWidow(false)
259 , m_discardMarginBefore(false) 249 , m_discardMarginBefore(false)
260 , m_discardMarginAfter(false) 250 , m_discardMarginAfter(false)
261 { 251 {
262 } 252 }
263 void trace(Visitor*); 253 void trace(Visitor*);
264 254
265 static LayoutUnit positiveMarginBeforeDefault(const RenderBlockFlow* blo ck) 255 static LayoutUnit positiveMarginBeforeDefault(const RenderBlockFlow* blo ck)
266 { 256 {
267 return std::max<LayoutUnit>(block->marginBefore(), 0); 257 return std::max<LayoutUnit>(block->marginBefore(), 0);
268 } 258 }
269 static LayoutUnit negativeMarginBeforeDefault(const RenderBlockFlow* blo ck) 259 static LayoutUnit negativeMarginBeforeDefault(const RenderBlockFlow* blo ck)
270 { 260 {
271 return std::max<LayoutUnit>(-block->marginBefore(), 0); 261 return std::max<LayoutUnit>(-block->marginBefore(), 0);
272 } 262 }
273 static LayoutUnit positiveMarginAfterDefault(const RenderBlockFlow* bloc k) 263 static LayoutUnit positiveMarginAfterDefault(const RenderBlockFlow* bloc k)
274 { 264 {
275 return std::max<LayoutUnit>(block->marginAfter(), 0); 265 return std::max<LayoutUnit>(block->marginAfter(), 0);
276 } 266 }
277 static LayoutUnit negativeMarginAfterDefault(const RenderBlockFlow* bloc k) 267 static LayoutUnit negativeMarginAfterDefault(const RenderBlockFlow* bloc k)
278 { 268 {
279 return std::max<LayoutUnit>(-block->marginAfter(), 0); 269 return std::max<LayoutUnit>(-block->marginAfter(), 0);
280 } 270 }
281 271
282 MarginValues m_margins; 272 MarginValues m_margins;
283
284 int m_lineBreakToAvoidWidow;
285 bool m_didBreakAtLineToAvoidWidow : 1;
286 bool m_discardMarginBefore : 1; 273 bool m_discardMarginBefore : 1;
287 bool m_discardMarginAfter : 1; 274 bool m_discardMarginAfter : 1;
288 }; 275 };
289 LayoutUnit marginOffsetForSelfCollapsingBlock(); 276 LayoutUnit marginOffsetForSelfCollapsingBlock();
290 277
291 protected: 278 protected:
292 LayoutUnit maxPositiveMarginBefore() const { return m_rareData ? m_rareData- >m_margins.positiveMarginBefore() : RenderBlockFlowRareData::positiveMarginBefor eDefault(this); } 279 LayoutUnit maxPositiveMarginBefore() const { return m_rareData ? m_rareData- >m_margins.positiveMarginBefore() : RenderBlockFlowRareData::positiveMarginBefor eDefault(this); }
293 LayoutUnit maxNegativeMarginBefore() const { return m_rareData ? m_rareData- >m_margins.negativeMarginBefore() : RenderBlockFlowRareData::negativeMarginBefor eDefault(this); } 280 LayoutUnit maxNegativeMarginBefore() const { return m_rareData ? m_rareData- >m_margins.negativeMarginBefore() : RenderBlockFlowRareData::negativeMarginBefor eDefault(this); }
294 LayoutUnit maxPositiveMarginAfter() const { return m_rareData ? m_rareData-> m_margins.positiveMarginAfter() : RenderBlockFlowRareData::positiveMarginAfterDe fault(this); } 281 LayoutUnit maxPositiveMarginAfter() const { return m_rareData ? m_rareData-> m_margins.positiveMarginAfter() : RenderBlockFlowRareData::positiveMarginAfterDe fault(this); }
295 LayoutUnit maxNegativeMarginAfter() const { return m_rareData ? m_rareData-> m_margins.negativeMarginAfter() : RenderBlockFlowRareData::negativeMarginAfterDe fault(this); } 282 LayoutUnit maxNegativeMarginAfter() const { return m_rareData ? m_rareData-> m_margins.negativeMarginAfter() : RenderBlockFlowRareData::negativeMarginAfterDe fault(this); }
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 367
381 // END METHODS DEFINED IN RenderBlockLineLayout 368 // END METHODS DEFINED IN RenderBlockLineLayout
382 369
383 }; 370 };
384 371
385 DEFINE_RENDER_OBJECT_TYPE_CASTS(RenderBlockFlow, isRenderBlockFlow()); 372 DEFINE_RENDER_OBJECT_TYPE_CASTS(RenderBlockFlow, isRenderBlockFlow());
386 373
387 } // namespace blink 374 } // namespace blink
388 375
389 #endif // RenderBlockFlow_h 376 #endif // RenderBlockFlow_h
OLDNEW
« no previous file with comments | « no previous file | sky/engine/core/rendering/RenderBlockFlow.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698