| OLD | NEW |
| 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 11 matching lines...) Expand all Loading... |
| 22 | 22 |
| 23 #ifndef RenderBlock_h | 23 #ifndef RenderBlock_h |
| 24 #define RenderBlock_h | 24 #define RenderBlock_h |
| 25 | 25 |
| 26 #include "core/rendering/ColumnInfo.h" | 26 #include "core/rendering/ColumnInfo.h" |
| 27 #include "core/rendering/FloatingObjects.h" | 27 #include "core/rendering/FloatingObjects.h" |
| 28 #include "core/rendering/GapRects.h" | 28 #include "core/rendering/GapRects.h" |
| 29 #include "core/rendering/RenderBox.h" | 29 #include "core/rendering/RenderBox.h" |
| 30 #include "core/rendering/RenderLineBoxList.h" | 30 #include "core/rendering/RenderLineBoxList.h" |
| 31 #include "core/rendering/RootInlineBox.h" | 31 #include "core/rendering/RootInlineBox.h" |
| 32 #include "core/rendering/shapes/ShapeInsideInfo.h" | |
| 33 #include "core/rendering/style/ShapeValue.h" | 32 #include "core/rendering/style/ShapeValue.h" |
| 34 #include "platform/text/TextBreakIterator.h" | 33 #include "platform/text/TextBreakIterator.h" |
| 35 #include "platform/text/TextRun.h" | 34 #include "platform/text/TextRun.h" |
| 36 #include "wtf/ListHashSet.h" | 35 #include "wtf/ListHashSet.h" |
| 37 #include "wtf/OwnPtr.h" | 36 #include "wtf/OwnPtr.h" |
| 38 | 37 |
| 39 namespace WebCore { | 38 namespace WebCore { |
| 40 | 39 |
| 41 class BasicShape; | 40 class BasicShape; |
| 42 class BidiContext; | 41 class BidiContext; |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 | 136 |
| 138 void setHasMarginBeforeQuirk(bool b) { m_hasMarginBeforeQuirk = b; } | 137 void setHasMarginBeforeQuirk(bool b) { m_hasMarginBeforeQuirk = b; } |
| 139 void setHasMarginAfterQuirk(bool b) { m_hasMarginAfterQuirk = b; } | 138 void setHasMarginAfterQuirk(bool b) { m_hasMarginAfterQuirk = b; } |
| 140 | 139 |
| 141 bool hasMarginBeforeQuirk() const { return m_hasMarginBeforeQuirk; } | 140 bool hasMarginBeforeQuirk() const { return m_hasMarginBeforeQuirk; } |
| 142 bool hasMarginAfterQuirk() const { return m_hasMarginAfterQuirk; } | 141 bool hasMarginAfterQuirk() const { return m_hasMarginAfterQuirk; } |
| 143 | 142 |
| 144 bool hasMarginBeforeQuirk(const RenderBox* child) const; | 143 bool hasMarginBeforeQuirk(const RenderBox* child) const; |
| 145 bool hasMarginAfterQuirk(const RenderBox* child) const; | 144 bool hasMarginAfterQuirk(const RenderBox* child) const; |
| 146 | 145 |
| 147 void markShapeInsideDescendantsForLayout(); | |
| 148 void markPositionedObjectsForLayout(); | 146 void markPositionedObjectsForLayout(); |
| 149 // FIXME: Do we really need this to be virtual? It's just so we can call thi
s on | 147 // FIXME: Do we really need this to be virtual? It's just so we can call thi
s on |
| 150 // RenderBoxes without needed to check whether they're RenderBlocks first. | 148 // RenderBoxes without needed to check whether they're RenderBlocks first. |
| 151 virtual void markForPaginationRelayoutIfNeeded(SubtreeLayoutScope&) OVERRIDE
FINAL; | 149 virtual void markForPaginationRelayoutIfNeeded(SubtreeLayoutScope&) OVERRIDE
FINAL; |
| 152 | 150 |
| 153 // FIXME-BLOCKFLOW: Remove virtualizaion when all of the line layout code ha
s been moved out of RenderBlock | 151 // FIXME-BLOCKFLOW: Remove virtualizaion when all of the line layout code ha
s been moved out of RenderBlock |
| 154 virtual bool containsFloats() const { return false; } | 152 virtual bool containsFloats() const { return false; } |
| 155 | 153 |
| 156 LayoutUnit textIndentOffset() const; | 154 LayoutUnit textIndentOffset() const; |
| 157 | 155 |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 LayoutUnit logicalLeftOffsetForContent() const { return isHorizontalWritingM
ode() ? borderLeft() + paddingLeft() : borderTop() + paddingTop(); } | 254 LayoutUnit logicalLeftOffsetForContent() const { return isHorizontalWritingM
ode() ? borderLeft() + paddingLeft() : borderTop() + paddingTop(); } |
| 257 LayoutUnit logicalRightOffsetForContent() const { return logicalLeftOffsetFo
rContent() + availableLogicalWidth(); } | 255 LayoutUnit logicalRightOffsetForContent() const { return logicalLeftOffsetFo
rContent() + availableLogicalWidth(); } |
| 258 LayoutUnit startOffsetForContent() const { return style()->isLeftToRightDire
ction() ? logicalLeftOffsetForContent() : logicalWidth() - logicalRightOffsetFor
Content(); } | 256 LayoutUnit startOffsetForContent() const { return style()->isLeftToRightDire
ction() ? logicalLeftOffsetForContent() : logicalWidth() - logicalRightOffsetFor
Content(); } |
| 259 LayoutUnit endOffsetForContent() const { return !style()->isLeftToRightDirec
tion() ? logicalLeftOffsetForContent() : logicalWidth() - logicalRightOffsetForC
ontent(); } | 257 LayoutUnit endOffsetForContent() const { return !style()->isLeftToRightDirec
tion() ? logicalLeftOffsetForContent() : logicalWidth() - logicalRightOffsetForC
ontent(); } |
| 260 | 258 |
| 261 #ifndef NDEBUG | 259 #ifndef NDEBUG |
| 262 void checkPositionedObjectsNeedLayout(); | 260 void checkPositionedObjectsNeedLayout(); |
| 263 void showLineTreeAndMark(const InlineBox* = 0, const char* = 0, const Inline
Box* = 0, const char* = 0, const RenderObject* = 0) const; | 261 void showLineTreeAndMark(const InlineBox* = 0, const char* = 0, const Inline
Box* = 0, const char* = 0, const RenderObject* = 0) const; |
| 264 #endif | 262 #endif |
| 265 | 263 |
| 266 ShapeInsideInfo& ensureShapeInsideInfo() | |
| 267 { | |
| 268 if (!m_rareData || !m_rareData->m_shapeInsideInfo) | |
| 269 setShapeInsideInfo(ShapeInsideInfo::createInfo(*this)); | |
| 270 return *m_rareData->m_shapeInsideInfo; | |
| 271 } | |
| 272 ShapeInsideInfo* shapeInsideInfo() const | |
| 273 { | |
| 274 return m_rareData && m_rareData->m_shapeInsideInfo && ShapeInsideInfo::i
sEnabledFor(*this) ? m_rareData->m_shapeInsideInfo.get() : 0; | |
| 275 } | |
| 276 void setShapeInsideInfo(PassOwnPtr<ShapeInsideInfo> value) | |
| 277 { | |
| 278 if (!m_rareData) | |
| 279 m_rareData = adoptPtr(new RenderBlockRareData()); | |
| 280 m_rareData->m_shapeInsideInfo = value; | |
| 281 } | |
| 282 ShapeInsideInfo* layoutShapeInsideInfo() const; | |
| 283 bool allowsShapeInsideInfoSharing(const RenderBlock* other) const; | |
| 284 LayoutSize logicalOffsetFromShapeAncestorContainer(const RenderBlock* contai
ner) const; | 264 LayoutSize logicalOffsetFromShapeAncestorContainer(const RenderBlock* contai
ner) const; |
| 285 virtual void imageChanged(WrappedImagePtr, const IntRect* = 0) OVERRIDE; | |
| 286 | 265 |
| 287 // inline-block elements paint all phases atomically. This function ensures
that. Certain other elements | 266 // inline-block elements paint all phases atomically. This function ensures
that. Certain other elements |
| 288 // (grid items, flex items) require this behavior as well, and this function
exists as a helper for them. | 267 // (grid items, flex items) require this behavior as well, and this function
exists as a helper for them. |
| 289 // It is expected that the caller will call this function independent of the
value of paintInfo.phase. | 268 // It is expected that the caller will call this function independent of the
value of paintInfo.phase. |
| 290 static void paintAsInlineBlock(RenderObject*, PaintInfo&, const LayoutPoint&
); | 269 static void paintAsInlineBlock(RenderObject*, PaintInfo&, const LayoutPoint&
); |
| 291 protected: | 270 protected: |
| 292 virtual void willBeDestroyed() OVERRIDE; | 271 virtual void willBeDestroyed() OVERRIDE; |
| 293 | 272 |
| 294 void dirtyForLayoutFromPercentageHeightDescendants(SubtreeLayoutScope&); | 273 void dirtyForLayoutFromPercentageHeightDescendants(SubtreeLayoutScope&); |
| 295 | 274 |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 354 protected: | 333 protected: |
| 355 virtual void addOverflowFromChildren(); | 334 virtual void addOverflowFromChildren(); |
| 356 void addOverflowFromPositionedObjects(); | 335 void addOverflowFromPositionedObjects(); |
| 357 void addOverflowFromBlockChildren(); | 336 void addOverflowFromBlockChildren(); |
| 358 void addVisualOverflowFromTheme(); | 337 void addVisualOverflowFromTheme(); |
| 359 | 338 |
| 360 virtual void addFocusRingRects(Vector<IntRect>&, const LayoutPoint& addition
alOffset, const RenderLayerModelObject* paintContainer = 0) OVERRIDE; | 339 virtual void addFocusRingRects(Vector<IntRect>&, const LayoutPoint& addition
alOffset, const RenderLayerModelObject* paintContainer = 0) OVERRIDE; |
| 361 | 340 |
| 362 virtual void computeSelfHitTestRects(Vector<LayoutRect>&, const LayoutPoint&
layerOffset) const OVERRIDE; | 341 virtual void computeSelfHitTestRects(Vector<LayoutRect>&, const LayoutPoint&
layerOffset) const OVERRIDE; |
| 363 | 342 |
| 364 bool updateRegionsAndShapesLogicalSize(RenderFlowThread*); | |
| 365 void computeRegionRangeForBlock(RenderFlowThread*); | 343 void computeRegionRangeForBlock(RenderFlowThread*); |
| 366 | 344 |
| 367 void updateBlockChildDirtyBitsBeforeLayout(bool relayoutChildren, RenderBox*
); | 345 void updateBlockChildDirtyBitsBeforeLayout(bool relayoutChildren, RenderBox*
); |
| 368 | 346 |
| 369 virtual bool isInlineBlockOrInlineTable() const OVERRIDE FINAL { return isIn
line() && isReplaced(); } | 347 virtual bool isInlineBlockOrInlineTable() const OVERRIDE FINAL { return isIn
line() && isReplaced(); } |
| 370 | 348 |
| 371 private: | 349 private: |
| 372 void computeShapeSize(); | |
| 373 void updateRegionsAndShapesAfterChildLayout(RenderFlowThread*, bool); | |
| 374 void updateShapeInsideInfoAfterStyleChange(const ShapeValue*, const ShapeVal
ue* oldShape); | |
| 375 void relayoutShapeDescendantIfMoved(RenderBlock* child, LayoutSize offset); | |
| 376 | |
| 377 virtual RenderObjectChildList* virtualChildren() OVERRIDE FINAL { return chi
ldren(); } | 350 virtual RenderObjectChildList* virtualChildren() OVERRIDE FINAL { return chi
ldren(); } |
| 378 virtual const RenderObjectChildList* virtualChildren() const OVERRIDE FINAL
{ return children(); } | 351 virtual const RenderObjectChildList* virtualChildren() const OVERRIDE FINAL
{ return children(); } |
| 379 | 352 |
| 380 virtual const char* renderName() const OVERRIDE; | 353 virtual const char* renderName() const OVERRIDE; |
| 381 | 354 |
| 382 virtual bool isRenderBlock() const OVERRIDE FINAL { return true; } | 355 virtual bool isRenderBlock() const OVERRIDE FINAL { return true; } |
| 383 | 356 |
| 384 void makeChildrenNonInline(RenderObject* insertionPoint = 0); | 357 void makeChildrenNonInline(RenderObject* insertionPoint = 0); |
| 385 virtual void removeLeftoverAnonymousBlock(RenderBlock* child); | 358 virtual void removeLeftoverAnonymousBlock(RenderBlock* child); |
| 386 | 359 |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 541 : m_paginationStrut(0) | 514 : m_paginationStrut(0) |
| 542 , m_pageLogicalOffset(0) | 515 , m_pageLogicalOffset(0) |
| 543 , m_lineBreakToAvoidWidow(-1) | 516 , m_lineBreakToAvoidWidow(-1) |
| 544 , m_didBreakAtLineToAvoidWidow(false) | 517 , m_didBreakAtLineToAvoidWidow(false) |
| 545 { | 518 { |
| 546 } | 519 } |
| 547 | 520 |
| 548 LayoutUnit m_paginationStrut; | 521 LayoutUnit m_paginationStrut; |
| 549 LayoutUnit m_pageLogicalOffset; | 522 LayoutUnit m_pageLogicalOffset; |
| 550 | 523 |
| 551 OwnPtr<ShapeInsideInfo> m_shapeInsideInfo; | |
| 552 int m_lineBreakToAvoidWidow : 31; | 524 int m_lineBreakToAvoidWidow : 31; |
| 553 unsigned m_didBreakAtLineToAvoidWidow : 1; | 525 unsigned m_didBreakAtLineToAvoidWidow : 1; |
| 554 }; | 526 }; |
| 555 | 527 |
| 556 protected: | 528 protected: |
| 557 OwnPtr<RenderBlockRareData> m_rareData; | 529 OwnPtr<RenderBlockRareData> m_rareData; |
| 558 | 530 |
| 559 RenderObjectChildList m_children; | 531 RenderObjectChildList m_children; |
| 560 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>. | 532 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>. |
| 561 | 533 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 572 // (calling moveChildTo, moveAllChildrenTo, and makeChildrenNonInline). | 544 // (calling moveChildTo, moveAllChildrenTo, and makeChildrenNonInline). |
| 573 friend class RenderRubyBase; | 545 friend class RenderRubyBase; |
| 574 // FIXME-BLOCKFLOW: Remove this when the line layout stuff has all moved out
of RenderBlock | 546 // FIXME-BLOCKFLOW: Remove this when the line layout stuff has all moved out
of RenderBlock |
| 575 friend class LineBreaker; | 547 friend class LineBreaker; |
| 576 | 548 |
| 577 // FIXME: This is temporary as we move code that accesses block flow | 549 // FIXME: This is temporary as we move code that accesses block flow |
| 578 // member variables out of RenderBlock and into RenderBlockFlow. | 550 // member variables out of RenderBlock and into RenderBlockFlow. |
| 579 friend class RenderBlockFlow; | 551 friend class RenderBlockFlow; |
| 580 }; | 552 }; |
| 581 | 553 |
| 582 | |
| 583 inline bool RenderBlock::allowsShapeInsideInfoSharing(const RenderBlock* other)
const | |
| 584 { | |
| 585 if (!other) | |
| 586 return false; | |
| 587 for (const RenderBlock* current = this; current && current != other && !curr
ent->isRenderFlowThread(); current = current->containingBlock()) { | |
| 588 if (current->isInline() || current->isFloating()) | |
| 589 return false; | |
| 590 if (current->parent() != current->containingBlock()) | |
| 591 return false; | |
| 592 } | |
| 593 return true; | |
| 594 } | |
| 595 | |
| 596 DEFINE_RENDER_OBJECT_TYPE_CASTS(RenderBlock, isRenderBlock()); | 554 DEFINE_RENDER_OBJECT_TYPE_CASTS(RenderBlock, isRenderBlock()); |
| 597 | 555 |
| 598 } // namespace WebCore | 556 } // namespace WebCore |
| 599 | 557 |
| 600 #endif // RenderBlock_h | 558 #endif // RenderBlock_h |
| OLD | NEW |