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

Side by Side Diff: Source/core/rendering/RenderBlock.h

Issue 399423006: Move widow-avoiding code from RenderBlock down to RenderBlockFlow. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 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 | « no previous file | Source/core/rendering/RenderBlock.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, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All r ights reserved. 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All r ights reserved.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 206
207 virtual RenderBox* createAnonymousBoxWithSameTypeAs(const RenderObject* pare nt) const OVERRIDE; 207 virtual RenderBox* createAnonymousBoxWithSameTypeAs(const RenderObject* pare nt) const OVERRIDE;
208 208
209 ColumnInfo* columnInfo() const; 209 ColumnInfo* columnInfo() const;
210 int columnGap() const; 210 int columnGap() const;
211 211
212 // These two functions take the ColumnInfo* to avoid repeated lookups of the info in the global HashMap. 212 // These two functions take the ColumnInfo* to avoid repeated lookups of the info in the global HashMap.
213 unsigned columnCount(ColumnInfo*) const; 213 unsigned columnCount(ColumnInfo*) const;
214 LayoutRect columnRectAt(ColumnInfo*, unsigned) const; 214 LayoutRect columnRectAt(ColumnInfo*, unsigned) const;
215 215
216 bool shouldBreakAtLineToAvoidWidow() const { return m_rareData && m_rareData ->m_lineBreakToAvoidWidow >= 0; }
217 void clearShouldBreakAtLineToAvoidWidow() const;
218 int lineBreakToAvoidWidow() const { return m_rareData ? m_rareData->m_lineBr eakToAvoidWidow : -1; }
219 void setBreakAtLineToAvoidWidow(int);
220 void clearDidBreakAtLineToAvoidWidow();
221 void setDidBreakAtLineToAvoidWidow();
222 bool didBreakAtLineToAvoidWidow() const { return m_rareData && m_rareData->m _didBreakAtLineToAvoidWidow; }
223
224 // The page logical offset is the object's offset from the top of the page i n the page progression 216 // The page logical offset is the object's offset from the top of the page i n the page progression
225 // direction (so an x-offset in vertical text and a y-offset for horizontal text). 217 // direction (so an x-offset in vertical text and a y-offset for horizontal text).
226 LayoutUnit pageLogicalOffset() const { return m_rareData ? m_rareData->m_pag eLogicalOffset : LayoutUnit(); } 218 LayoutUnit pageLogicalOffset() const { return m_rareData ? m_rareData->m_pag eLogicalOffset : LayoutUnit(); }
227 void setPageLogicalOffset(LayoutUnit); 219 void setPageLogicalOffset(LayoutUnit);
228 220
229 // Accessors for logical width/height and margins in the containing block's block-flow direction. 221 // Accessors for logical width/height and margins in the containing block's block-flow direction.
230 LayoutUnit logicalWidthForChild(const RenderBox* child) const { return isHor izontalWritingMode() ? child->width() : child->height(); } 222 LayoutUnit logicalWidthForChild(const RenderBox* child) const { return isHor izontalWritingMode() ? child->width() : child->height(); }
231 LayoutUnit logicalHeightForChild(const RenderBox* child) const { return isHo rizontalWritingMode() ? child->height() : child->width(); } 223 LayoutUnit logicalHeightForChild(const RenderBox* child) const { return isHo rizontalWritingMode() ? child->height() : child->width(); }
232 LayoutSize logicalSizeForChild(const RenderBox* child) const { return isHori zontalWritingMode() ? child->size() : child->size().transposedSize(); } 224 LayoutSize logicalSizeForChild(const RenderBox* child) const { return isHori zontalWritingMode() ? child->size() : child->size().transposedSize(); }
233 LayoutUnit logicalTopForChild(const RenderBox* child) const { return isHoriz ontalWritingMode() ? child->y() : child->x(); } 225 LayoutUnit logicalTopForChild(const RenderBox* child) const { return isHoriz ontalWritingMode() ? child->y() : child->x(); }
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
500 virtual LayoutUnit offsetFromLogicalTopOfFirstPage() const OVERRIDE FINAL; 492 virtual LayoutUnit offsetFromLogicalTopOfFirstPage() const OVERRIDE FINAL;
501 493
502 public: 494 public:
503 495
504 // Allocated only when some of these fields have non-default values 496 // Allocated only when some of these fields have non-default values
505 struct RenderBlockRareData { 497 struct RenderBlockRareData {
506 WTF_MAKE_NONCOPYABLE(RenderBlockRareData); WTF_MAKE_FAST_ALLOCATED; 498 WTF_MAKE_NONCOPYABLE(RenderBlockRareData); WTF_MAKE_FAST_ALLOCATED;
507 public: 499 public:
508 RenderBlockRareData() 500 RenderBlockRareData()
509 : m_pageLogicalOffset(0) 501 : m_pageLogicalOffset(0)
510 , m_lineBreakToAvoidWidow(-1)
511 , m_didBreakAtLineToAvoidWidow(false)
512 { 502 {
513 } 503 }
514 504
515 LayoutUnit m_pageLogicalOffset; 505 LayoutUnit m_pageLogicalOffset;
516
517 int m_lineBreakToAvoidWidow : 31;
518 unsigned m_didBreakAtLineToAvoidWidow : 1;
519 }; 506 };
520 507
521 protected: 508 protected:
522 OwnPtr<RenderBlockRareData> m_rareData; 509 OwnPtr<RenderBlockRareData> m_rareData;
523 510
524 RenderObjectChildList m_children; 511 RenderObjectChildList m_children;
525 RenderLineBoxList m_lineBoxes; // All of the root line boxes created for t his block flow. For example, <div>Hello<br>world.</div> will have two total lin es for the <div>. 512 RenderLineBoxList m_lineBoxes; // All of the root line boxes created for t his block flow. For example, <div>Hello<br>world.</div> will have two total lin es for the <div>.
526 513
527 unsigned m_hasMarginBeforeQuirk : 1; // Note these quirk values can't be put in RenderBlockRareData since they are set too frequently. 514 unsigned m_hasMarginBeforeQuirk : 1; // Note these quirk values can't be put in RenderBlockRareData since they are set too frequently.
528 unsigned m_hasMarginAfterQuirk : 1; 515 unsigned m_hasMarginAfterQuirk : 1;
(...skipping 12 matching lines...) Expand all
541 // FIXME: This is temporary as we move code that accesses block flow 528 // FIXME: This is temporary as we move code that accesses block flow
542 // member variables out of RenderBlock and into RenderBlockFlow. 529 // member variables out of RenderBlock and into RenderBlockFlow.
543 friend class RenderBlockFlow; 530 friend class RenderBlockFlow;
544 }; 531 };
545 532
546 DEFINE_RENDER_OBJECT_TYPE_CASTS(RenderBlock, isRenderBlock()); 533 DEFINE_RENDER_OBJECT_TYPE_CASTS(RenderBlock, isRenderBlock());
547 534
548 } // namespace WebCore 535 } // namespace WebCore
549 536
550 #endif // RenderBlock_h 537 #endif // RenderBlock_h
OLDNEW
« no previous file with comments | « no previous file | Source/core/rendering/RenderBlock.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698