| 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 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 void setMarginEndForChild(RenderBox* child, LayoutUnit value) const { child-
>setMarginEnd(value, style()); } | 240 void setMarginEndForChild(RenderBox* child, LayoutUnit value) const { child-
>setMarginEnd(value, style()); } |
| 241 void setMarginBeforeForChild(RenderBox* child, LayoutUnit value) const { chi
ld->setMarginBefore(value, style()); } | 241 void setMarginBeforeForChild(RenderBox* child, LayoutUnit value) const { chi
ld->setMarginBefore(value, style()); } |
| 242 void setMarginAfterForChild(RenderBox* child, LayoutUnit value) const { chil
d->setMarginAfter(value, style()); } | 242 void setMarginAfterForChild(RenderBox* child, LayoutUnit value) const { chil
d->setMarginAfter(value, style()); } |
| 243 LayoutUnit collapsedMarginBeforeForChild(const RenderBox* child) const; | 243 LayoutUnit collapsedMarginBeforeForChild(const RenderBox* child) const; |
| 244 LayoutUnit collapsedMarginAfterForChild(const RenderBox* child) const; | 244 LayoutUnit collapsedMarginAfterForChild(const RenderBox* child) const; |
| 245 | 245 |
| 246 virtual void updateFirstLetter(); | 246 virtual void updateFirstLetter(); |
| 247 | 247 |
| 248 virtual void scrollbarsChanged(bool /*horizontalScrollbarChanged*/, bool /*v
erticalScrollbarChanged*/) { }; | 248 virtual void scrollbarsChanged(bool /*horizontalScrollbarChanged*/, bool /*v
erticalScrollbarChanged*/) { }; |
| 249 | 249 |
| 250 LayoutUnit logicalLeftOffsetForContent(RenderRegion*) const; | 250 LayoutUnit availableLogicalWidthForContent() const |
| 251 LayoutUnit logicalRightOffsetForContent(RenderRegion*) const; | |
| 252 LayoutUnit availableLogicalWidthForContent(RenderRegion* region) const | |
| 253 { | 251 { |
| 254 return max<LayoutUnit>(0, logicalRightOffsetForContent(region) - logical
LeftOffsetForContent(region)); | 252 return max<LayoutUnit>(0, logicalRightOffsetForContent() - logicalLeftOf
fsetForContent()); |
| 255 } | |
| 256 LayoutUnit startOffsetForContent(RenderRegion* region) const | |
| 257 { | |
| 258 return style()->isLeftToRightDirection() ? logicalLeftOffsetForContent(r
egion) : logicalWidth() - logicalRightOffsetForContent(region); | |
| 259 } | |
| 260 LayoutUnit endOffsetForContent(RenderRegion* region) const | |
| 261 { | |
| 262 return !style()->isLeftToRightDirection() ? logicalLeftOffsetForContent(
region) : logicalWidth() - logicalRightOffsetForContent(region); | |
| 263 } | |
| 264 LayoutUnit logicalLeftOffsetForContent(LayoutUnit blockOffset) const | |
| 265 { | |
| 266 return logicalLeftOffsetForContent(regionAtBlockOffset(blockOffset)); | |
| 267 } | |
| 268 LayoutUnit logicalRightOffsetForContent(LayoutUnit blockOffset) const | |
| 269 { | |
| 270 return logicalRightOffsetForContent(regionAtBlockOffset(blockOffset)); | |
| 271 } | |
| 272 LayoutUnit availableLogicalWidthForContent(LayoutUnit blockOffset) const | |
| 273 { | |
| 274 return availableLogicalWidthForContent(regionAtBlockOffset(blockOffset))
; | |
| 275 } | |
| 276 LayoutUnit startOffsetForContent(LayoutUnit blockOffset) const | |
| 277 { | |
| 278 return startOffsetForContent(regionAtBlockOffset(blockOffset)); | |
| 279 } | |
| 280 LayoutUnit endOffsetForContent(LayoutUnit blockOffset) const | |
| 281 { | |
| 282 return endOffsetForContent(regionAtBlockOffset(blockOffset)); | |
| 283 } | 253 } |
| 284 LayoutUnit logicalLeftOffsetForContent() const { return isHorizontalWritingM
ode() ? borderLeft() + paddingLeft() : borderTop() + paddingTop(); } | 254 LayoutUnit logicalLeftOffsetForContent() const { return isHorizontalWritingM
ode() ? borderLeft() + paddingLeft() : borderTop() + paddingTop(); } |
| 285 LayoutUnit logicalRightOffsetForContent() const { return logicalLeftOffsetFo
rContent() + availableLogicalWidth(); } | 255 LayoutUnit logicalRightOffsetForContent() const { return logicalLeftOffsetFo
rContent() + availableLogicalWidth(); } |
| 286 LayoutUnit startOffsetForContent() const { return style()->isLeftToRightDire
ction() ? logicalLeftOffsetForContent() : logicalWidth() - logicalRightOffsetFor
Content(); } | 256 LayoutUnit startOffsetForContent() const { return style()->isLeftToRightDire
ction() ? logicalLeftOffsetForContent() : logicalWidth() - logicalRightOffsetFor
Content(); } |
| 287 LayoutUnit endOffsetForContent() const { return !style()->isLeftToRightDirec
tion() ? logicalLeftOffsetForContent() : logicalWidth() - logicalRightOffsetForC
ontent(); } | 257 LayoutUnit endOffsetForContent() const { return !style()->isLeftToRightDirec
tion() ? logicalLeftOffsetForContent() : logicalWidth() - logicalRightOffsetForC
ontent(); } |
| 288 | 258 |
| 289 #ifndef NDEBUG | 259 #ifndef NDEBUG |
| 290 void checkPositionedObjectsNeedLayout(); | 260 void checkPositionedObjectsNeedLayout(); |
| 291 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; |
| 292 #endif | 262 #endif |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 378 protected: | 348 protected: |
| 379 virtual void addOverflowFromChildren(); | 349 virtual void addOverflowFromChildren(); |
| 380 void addOverflowFromPositionedObjects(); | 350 void addOverflowFromPositionedObjects(); |
| 381 void addOverflowFromBlockChildren(); | 351 void addOverflowFromBlockChildren(); |
| 382 void addVisualOverflowFromTheme(); | 352 void addVisualOverflowFromTheme(); |
| 383 | 353 |
| 384 virtual void addFocusRingRects(Vector<IntRect>&, const LayoutPoint& addition
alOffset, const RenderLayerModelObject* paintContainer = 0) OVERRIDE; | 354 virtual void addFocusRingRects(Vector<IntRect>&, const LayoutPoint& addition
alOffset, const RenderLayerModelObject* paintContainer = 0) OVERRIDE; |
| 385 | 355 |
| 386 virtual void computeSelfHitTestRects(Vector<LayoutRect>&, const LayoutPoint&
layerOffset) const OVERRIDE; | 356 virtual void computeSelfHitTestRects(Vector<LayoutRect>&, const LayoutPoint&
layerOffset) const OVERRIDE; |
| 387 | 357 |
| 388 bool updateRegionsAndShapesLogicalSize(RenderFlowThread*); | |
| 389 void computeRegionRangeForBlock(RenderFlowThread*); | |
| 390 | |
| 391 void updateBlockChildDirtyBitsBeforeLayout(bool relayoutChildren, RenderBox*
); | 358 void updateBlockChildDirtyBitsBeforeLayout(bool relayoutChildren, RenderBox*
); |
| 392 | 359 |
| 393 virtual void checkForPaginationLogicalHeightChange(LayoutUnit& pageLogicalHe
ight, bool& pageLogicalHeightChanged, bool& hasSpecifiedPageLogicalHeight); | 360 virtual void checkForPaginationLogicalHeightChange(LayoutUnit& pageLogicalHe
ight, bool& pageLogicalHeightChanged, bool& hasSpecifiedPageLogicalHeight); |
| 394 | 361 |
| 395 virtual bool isInlineBlockOrInlineTable() const OVERRIDE FINAL { return isIn
line() && isReplaced(); } | 362 virtual bool isInlineBlockOrInlineTable() const OVERRIDE FINAL { return isIn
line() && isReplaced(); } |
| 396 | 363 |
| 397 private: | 364 private: |
| 398 void computeShapeSize(); | 365 void computeShapeSize(); |
| 399 void updateRegionsAndShapesAfterChildLayout(RenderFlowThread*, bool); | |
| 400 void updateShapeInsideInfoAfterStyleChange(const ShapeValue*, const ShapeVal
ue* oldShape); | 366 void updateShapeInsideInfoAfterStyleChange(const ShapeValue*, const ShapeVal
ue* oldShape); |
| 401 void relayoutShapeDescendantIfMoved(RenderBlock* child, LayoutSize offset); | 367 void relayoutShapeDescendantIfMoved(RenderBlock* child, LayoutSize offset); |
| 402 | 368 |
| 403 virtual RenderObjectChildList* virtualChildren() OVERRIDE FINAL { return chi
ldren(); } | 369 virtual RenderObjectChildList* virtualChildren() OVERRIDE FINAL { return chi
ldren(); } |
| 404 virtual const RenderObjectChildList* virtualChildren() const OVERRIDE FINAL
{ return children(); } | 370 virtual const RenderObjectChildList* virtualChildren() const OVERRIDE FINAL
{ return children(); } |
| 405 | 371 |
| 406 virtual const char* renderName() const OVERRIDE; | 372 virtual const char* renderName() const OVERRIDE; |
| 407 | 373 |
| 408 virtual bool isRenderBlock() const OVERRIDE FINAL { return true; } | 374 virtual bool isRenderBlock() const OVERRIDE FINAL { return true; } |
| 409 | 375 |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 548 | 514 |
| 549 // A page break is required at some offset due to space shortage in the curr
ent fragmentainer. | 515 // A page break is required at some offset due to space shortage in the curr
ent fragmentainer. |
| 550 void setPageBreak(LayoutUnit offset, LayoutUnit spaceShortage); | 516 void setPageBreak(LayoutUnit offset, LayoutUnit spaceShortage); |
| 551 | 517 |
| 552 // Update minimum page height required to avoid fragmentation where it shoul
dn't occur (inside | 518 // Update minimum page height required to avoid fragmentation where it shoul
dn't occur (inside |
| 553 // unbreakable content, between orphans and widows, etc.). This will be used
as a hint to the | 519 // unbreakable content, between orphans and widows, etc.). This will be used
as a hint to the |
| 554 // column balancer to help set a good minimum column height. | 520 // column balancer to help set a good minimum column height. |
| 555 void updateMinimumPageHeight(LayoutUnit offset, LayoutUnit minHeight); | 521 void updateMinimumPageHeight(LayoutUnit offset, LayoutUnit minHeight); |
| 556 | 522 |
| 557 LayoutUnit adjustForUnsplittableChild(RenderBox* child, LayoutUnit logicalOf
fset, bool includeMargins = false); // If the child is unsplittable and can't fi
t on the current page, return the top of the next page/column. | 523 LayoutUnit adjustForUnsplittableChild(RenderBox* child, LayoutUnit logicalOf
fset, bool includeMargins = false); // If the child is unsplittable and can't fi
t on the current page, return the top of the next page/column. |
| 558 void adjustLinePositionForPagination(RootInlineBox*, LayoutUnit& deltaOffset
, RenderFlowThread*); // Computes a deltaOffset value that put a line at the top
of the next page if it doesn't fit on the current page. | 524 void adjustLinePositionForPagination(RootInlineBox*, LayoutUnit& deltaOffset
); // Computes a deltaOffset value that put a line at the top of the next page i
f it doesn't fit on the current page. |
| 559 void updateRegionForLine(RootInlineBox*) const; | |
| 560 | 525 |
| 561 // Adjust from painting offsets to the local coords of this renderer | 526 // Adjust from painting offsets to the local coords of this renderer |
| 562 void offsetForContents(LayoutPoint&) const; | 527 void offsetForContents(LayoutPoint&) const; |
| 563 | 528 |
| 564 // This function is called to test a line box that has moved in the block di
rection to see if it has ended up in a new | 529 // This function is called to test a line box that has moved in the block di
rection to see if it has ended up in a new |
| 565 // region/page/column that has a different available line width than the old
one. Used to know when you have to dirty a | 530 // region/page/column that has a different available line width than the old
one. Used to know when you have to dirty a |
| 566 // line, i.e., that it can't be re-used. | 531 // line, i.e., that it can't be re-used. |
| 567 bool lineWidthForPaginatedLineChanged(RootInlineBox*, LayoutUnit lineDelta,
RenderFlowThread*) const; | 532 bool lineWidthForPaginatedLineChanged(RootInlineBox*, LayoutUnit lineDelta)
const; |
| 568 | |
| 569 bool logicalWidthChangedInRegions(RenderFlowThread*) const; | |
| 570 | 533 |
| 571 virtual bool requiresColumns(int desiredColumnCount) const; | 534 virtual bool requiresColumns(int desiredColumnCount) const; |
| 572 | 535 |
| 573 virtual bool updateLogicalWidthAndColumnWidth(); | 536 virtual bool updateLogicalWidthAndColumnWidth(); |
| 574 | 537 |
| 575 virtual bool canCollapseAnonymousBlockChild() const { return true; } | 538 virtual bool canCollapseAnonymousBlockChild() const { return true; } |
| 576 | 539 |
| 577 public: | 540 public: |
| 578 virtual LayoutUnit offsetFromLogicalTopOfFirstPage() const OVERRIDE FINAL; | 541 virtual LayoutUnit offsetFromLogicalTopOfFirstPage() const OVERRIDE FINAL; |
| 579 RenderRegion* regionAtBlockOffset(LayoutUnit) const; | |
| 580 RenderRegion* clampToStartAndEndRegions(RenderRegion*) const; | |
| 581 | 542 |
| 582 public: | 543 public: |
| 583 | 544 |
| 584 // Allocated only when some of these fields have non-default values | 545 // Allocated only when some of these fields have non-default values |
| 585 struct RenderBlockRareData { | 546 struct RenderBlockRareData { |
| 586 WTF_MAKE_NONCOPYABLE(RenderBlockRareData); WTF_MAKE_FAST_ALLOCATED; | 547 WTF_MAKE_NONCOPYABLE(RenderBlockRareData); WTF_MAKE_FAST_ALLOCATED; |
| 587 public: | 548 public: |
| 588 RenderBlockRareData() | 549 RenderBlockRareData() |
| 589 : m_paginationStrut(0) | 550 : m_paginationStrut(0) |
| 590 , m_pageLogicalOffset(0) | 551 , m_pageLogicalOffset(0) |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 624 // FIXME: This is temporary as we move code that accesses block flow | 585 // FIXME: This is temporary as we move code that accesses block flow |
| 625 // member variables out of RenderBlock and into RenderBlockFlow. | 586 // member variables out of RenderBlock and into RenderBlockFlow. |
| 626 friend class RenderBlockFlow; | 587 friend class RenderBlockFlow; |
| 627 }; | 588 }; |
| 628 | 589 |
| 629 | 590 |
| 630 inline bool RenderBlock::allowsShapeInsideInfoSharing(const RenderBlock* other)
const | 591 inline bool RenderBlock::allowsShapeInsideInfoSharing(const RenderBlock* other)
const |
| 631 { | 592 { |
| 632 if (!other) | 593 if (!other) |
| 633 return false; | 594 return false; |
| 634 for (const RenderBlock* current = this; current && current != other && !curr
ent->isRenderFlowThread(); current = current->containingBlock()) { | 595 for (const RenderBlock* current = this; current && current != other; current
= current->containingBlock()) { |
| 635 if (current->isInline() || current->isFloating()) | 596 if (current->isInline() || current->isFloating()) |
| 636 return false; | 597 return false; |
| 637 if (current->parent() != current->containingBlock()) | 598 if (current->parent() != current->containingBlock()) |
| 638 return false; | 599 return false; |
| 639 } | 600 } |
| 640 return true; | 601 return true; |
| 641 } | 602 } |
| 642 | 603 |
| 643 DEFINE_RENDER_OBJECT_TYPE_CASTS(RenderBlock, isRenderBlock()); | 604 DEFINE_RENDER_OBJECT_TYPE_CASTS(RenderBlock, isRenderBlock()); |
| 644 | 605 |
| 645 } // namespace WebCore | 606 } // namespace WebCore |
| 646 | 607 |
| 647 #endif // RenderBlock_h | 608 #endif // RenderBlock_h |
| OLD | NEW |