| 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 * Copyright (C) 2003, 2006, 2007 Apple Inc. All rights reserved. | 4 * Copyright (C) 2003, 2006, 2007 Apple Inc. All rights reserved. |
| 5 * | 5 * |
| 6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
| 7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
| 8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
| 9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
| 10 * | 10 * |
| (...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 virtual LayoutUnit marginLeft() const override { return m_marginBoxOutsets.l
eft(); } | 337 virtual LayoutUnit marginLeft() const override { return m_marginBoxOutsets.l
eft(); } |
| 338 virtual LayoutUnit marginRight() const override { return m_marginBoxOutsets.
right(); } | 338 virtual LayoutUnit marginRight() const override { return m_marginBoxOutsets.
right(); } |
| 339 void setMarginTop(LayoutUnit margin) { m_marginBoxOutsets.setTop(margin); } | 339 void setMarginTop(LayoutUnit margin) { m_marginBoxOutsets.setTop(margin); } |
| 340 void setMarginBottom(LayoutUnit margin) { m_marginBoxOutsets.setBottom(margi
n); } | 340 void setMarginBottom(LayoutUnit margin) { m_marginBoxOutsets.setBottom(margi
n); } |
| 341 void setMarginLeft(LayoutUnit margin) { m_marginBoxOutsets.setLeft(margin);
} | 341 void setMarginLeft(LayoutUnit margin) { m_marginBoxOutsets.setLeft(margin);
} |
| 342 void setMarginRight(LayoutUnit margin) { m_marginBoxOutsets.setRight(margin)
; } | 342 void setMarginRight(LayoutUnit margin) { m_marginBoxOutsets.setRight(margin)
; } |
| 343 | 343 |
| 344 LayoutUnit marginLogicalLeft() const { return m_marginBoxOutsets.logicalLeft
(style()->writingMode()); } | 344 LayoutUnit marginLogicalLeft() const { return m_marginBoxOutsets.logicalLeft
(style()->writingMode()); } |
| 345 LayoutUnit marginLogicalRight() const { return m_marginBoxOutsets.logicalRig
ht(style()->writingMode()); } | 345 LayoutUnit marginLogicalRight() const { return m_marginBoxOutsets.logicalRig
ht(style()->writingMode()); } |
| 346 | 346 |
| 347 virtual LayoutUnit marginBefore(const LayoutStyle* overrideStyle = 0) const
override final { return m_marginBoxOutsets.before((overrideStyle ? overrideStyle
: style())->writingMode()); } | 347 virtual LayoutUnit marginBefore(const ComputedStyle* overrideStyle = 0) cons
t override final { return m_marginBoxOutsets.before((overrideStyle ? overrideSty
le : style())->writingMode()); } |
| 348 virtual LayoutUnit marginAfter(const LayoutStyle* overrideStyle = 0) const o
verride final { return m_marginBoxOutsets.after((overrideStyle ? overrideStyle :
style())->writingMode()); } | 348 virtual LayoutUnit marginAfter(const ComputedStyle* overrideStyle = 0) const
override final { return m_marginBoxOutsets.after((overrideStyle ? overrideStyle
: style())->writingMode()); } |
| 349 virtual LayoutUnit marginStart(const LayoutStyle* overrideStyle = 0) const o
verride final | 349 virtual LayoutUnit marginStart(const ComputedStyle* overrideStyle = 0) const
override final |
| 350 { | 350 { |
| 351 const LayoutStyle* styleToUse = overrideStyle ? overrideStyle : style(); | 351 const ComputedStyle* styleToUse = overrideStyle ? overrideStyle : style(
); |
| 352 return m_marginBoxOutsets.start(styleToUse->writingMode(), styleToUse->d
irection()); | 352 return m_marginBoxOutsets.start(styleToUse->writingMode(), styleToUse->d
irection()); |
| 353 } | 353 } |
| 354 virtual LayoutUnit marginEnd(const LayoutStyle* overrideStyle = 0) const ove
rride final | 354 virtual LayoutUnit marginEnd(const ComputedStyle* overrideStyle = 0) const o
verride final |
| 355 { | 355 { |
| 356 const LayoutStyle* styleToUse = overrideStyle ? overrideStyle : style(); | 356 const ComputedStyle* styleToUse = overrideStyle ? overrideStyle : style(
); |
| 357 return m_marginBoxOutsets.end(styleToUse->writingMode(), styleToUse->dir
ection()); | 357 return m_marginBoxOutsets.end(styleToUse->writingMode(), styleToUse->dir
ection()); |
| 358 } | 358 } |
| 359 void setMarginBefore(LayoutUnit value, const LayoutStyle* overrideStyle = 0)
{ m_marginBoxOutsets.setBefore((overrideStyle ? overrideStyle : style())->writi
ngMode(), value); } | 359 void setMarginBefore(LayoutUnit value, const ComputedStyle* overrideStyle =
0) { m_marginBoxOutsets.setBefore((overrideStyle ? overrideStyle : style())->wri
tingMode(), value); } |
| 360 void setMarginAfter(LayoutUnit value, const LayoutStyle* overrideStyle = 0)
{ m_marginBoxOutsets.setAfter((overrideStyle ? overrideStyle : style())->writing
Mode(), value); } | 360 void setMarginAfter(LayoutUnit value, const ComputedStyle* overrideStyle = 0
) { m_marginBoxOutsets.setAfter((overrideStyle ? overrideStyle : style())->writi
ngMode(), value); } |
| 361 void setMarginStart(LayoutUnit value, const LayoutStyle* overrideStyle = 0) | 361 void setMarginStart(LayoutUnit value, const ComputedStyle* overrideStyle = 0
) |
| 362 { | 362 { |
| 363 const LayoutStyle* styleToUse = overrideStyle ? overrideStyle : style(); | 363 const ComputedStyle* styleToUse = overrideStyle ? overrideStyle : style(
); |
| 364 m_marginBoxOutsets.setStart(styleToUse->writingMode(), styleToUse->direc
tion(), value); | 364 m_marginBoxOutsets.setStart(styleToUse->writingMode(), styleToUse->direc
tion(), value); |
| 365 } | 365 } |
| 366 void setMarginEnd(LayoutUnit value, const LayoutStyle* overrideStyle = 0) | 366 void setMarginEnd(LayoutUnit value, const ComputedStyle* overrideStyle = 0) |
| 367 { | 367 { |
| 368 const LayoutStyle* styleToUse = overrideStyle ? overrideStyle : style(); | 368 const ComputedStyle* styleToUse = overrideStyle ? overrideStyle : style(
); |
| 369 m_marginBoxOutsets.setEnd(styleToUse->writingMode(), styleToUse->directi
on(), value); | 369 m_marginBoxOutsets.setEnd(styleToUse->writingMode(), styleToUse->directi
on(), value); |
| 370 } | 370 } |
| 371 | 371 |
| 372 // The following functions are used to implement collapsing margins. | 372 // The following functions are used to implement collapsing margins. |
| 373 // All objects know their maximal positive and negative margins. The | 373 // All objects know their maximal positive and negative margins. The |
| 374 // formula for computing a collapsed margin is |maxPosMargin| - |maxNegmargi
n|. | 374 // formula for computing a collapsed margin is |maxPosMargin| - |maxNegmargi
n|. |
| 375 // For a non-collapsing box, such as a leaf element, this formula will simpl
y return | 375 // For a non-collapsing box, such as a leaf element, this formula will simpl
y return |
| 376 // the margin of the element. Blocks override the maxMarginBefore and maxMa
rginAfter | 376 // the margin of the element. Blocks override the maxMarginBefore and maxMa
rginAfter |
| 377 // methods. | 377 // methods. |
| 378 virtual bool isSelfCollapsingBlock() const { return false; } | 378 virtual bool isSelfCollapsingBlock() const { return false; } |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 647 if (isHorizontalWritingMode()) | 647 if (isHorizontalWritingMode()) |
| 648 rect.setY(m_frameRect.height() - rect.maxY()); | 648 rect.setY(m_frameRect.height() - rect.maxY()); |
| 649 else | 649 else |
| 650 rect.setX(m_frameRect.width() - rect.maxX()); | 650 rect.setX(m_frameRect.width() - rect.maxX()); |
| 651 } | 651 } |
| 652 // These represent your location relative to your container as a physical of
fset. | 652 // These represent your location relative to your container as a physical of
fset. |
| 653 // In layout related methods you almost always want the logical location (e.
g. x() and y()). | 653 // In layout related methods you almost always want the logical location (e.
g. x() and y()). |
| 654 LayoutPoint topLeftLocation() const; | 654 LayoutPoint topLeftLocation() const; |
| 655 LayoutSize topLeftLocationOffset() const { return toLayoutSize(topLeftLocati
on()); } | 655 LayoutSize topLeftLocationOffset() const { return toLayoutSize(topLeftLocati
on()); } |
| 656 | 656 |
| 657 LayoutRect logicalVisualOverflowRectForPropagation(const LayoutStyle&) const
; | 657 LayoutRect logicalVisualOverflowRectForPropagation(const ComputedStyle&) con
st; |
| 658 LayoutRect visualOverflowRectForPropagation(const LayoutStyle&) const; | 658 LayoutRect visualOverflowRectForPropagation(const ComputedStyle&) const; |
| 659 LayoutRect logicalLayoutOverflowRectForPropagation(const LayoutStyle&) const
; | 659 LayoutRect logicalLayoutOverflowRectForPropagation(const ComputedStyle&) con
st; |
| 660 LayoutRect layoutOverflowRectForPropagation(const LayoutStyle&) const; | 660 LayoutRect layoutOverflowRectForPropagation(const ComputedStyle&) const; |
| 661 | 661 |
| 662 bool hasOverflowModel() const { return m_overflow; } | 662 bool hasOverflowModel() const { return m_overflow; } |
| 663 bool hasVisualOverflow() const { return m_overflow && !borderBoxRect().conta
ins(m_overflow->visualOverflowRect()); } | 663 bool hasVisualOverflow() const { return m_overflow && !borderBoxRect().conta
ins(m_overflow->visualOverflowRect()); } |
| 664 | 664 |
| 665 virtual bool needsPreferredWidthsRecalculation() const; | 665 virtual bool needsPreferredWidthsRecalculation() const; |
| 666 virtual void computeIntrinsicRatioInformation(FloatSize& /* intrinsicSize */
, double& /* intrinsicRatio */) const { } | 666 virtual void computeIntrinsicRatioInformation(FloatSize& /* intrinsicSize */
, double& /* intrinsicRatio */) const { } |
| 667 | 667 |
| 668 IntSize scrolledContentOffset() const; | 668 IntSize scrolledContentOffset() const; |
| 669 void applyCachedClipAndScrollOffsetForPaintInvalidation(LayoutRect& paintRec
t) const; | 669 void applyCachedClipAndScrollOffsetForPaintInvalidation(LayoutRect& paintRec
t) const; |
| 670 | 670 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 709 if (isFloating()) | 709 if (isFloating()) |
| 710 removeFloatingOrPositionedChildFromBlockLists(); | 710 removeFloatingOrPositionedChildFromBlockLists(); |
| 711 } | 711 } |
| 712 | 712 |
| 713 bool backgroundHasOpaqueTopLayer() const; | 713 bool backgroundHasOpaqueTopLayer() const; |
| 714 | 714 |
| 715 void setIntrinsicContentLogicalHeight(LayoutUnit intrinsicContentLogicalHeig
ht) const { m_intrinsicContentLogicalHeight = intrinsicContentLogicalHeight; } | 715 void setIntrinsicContentLogicalHeight(LayoutUnit intrinsicContentLogicalHeig
ht) const { m_intrinsicContentLogicalHeight = intrinsicContentLogicalHeight; } |
| 716 protected: | 716 protected: |
| 717 virtual void willBeDestroyed() override; | 717 virtual void willBeDestroyed() override; |
| 718 | 718 |
| 719 virtual void styleWillChange(StyleDifference, const LayoutStyle& newStyle) o
verride; | 719 virtual void styleWillChange(StyleDifference, const ComputedStyle& newStyle)
override; |
| 720 virtual void styleDidChange(StyleDifference, const LayoutStyle* oldStyle) ov
erride; | 720 virtual void styleDidChange(StyleDifference, const ComputedStyle* oldStyle)
override; |
| 721 virtual void updateFromStyle() override; | 721 virtual void updateFromStyle() override; |
| 722 | 722 |
| 723 // Returns false if it could not cheaply compute the extent (e.g. fixed back
ground), in which case the returned rect may be incorrect. | 723 // Returns false if it could not cheaply compute the extent (e.g. fixed back
ground), in which case the returned rect may be incorrect. |
| 724 // FIXME: make this a const method once the LayoutBox reference in BoxPainte
r is const. | 724 // FIXME: make this a const method once the LayoutBox reference in BoxPainte
r is const. |
| 725 bool getBackgroundPaintedExtent(LayoutRect&); | 725 bool getBackgroundPaintedExtent(LayoutRect&); |
| 726 virtual bool foregroundIsKnownToBeOpaqueInRect(const LayoutRect& localRect,
unsigned maxDepthToTest) const; | 726 virtual bool foregroundIsKnownToBeOpaqueInRect(const LayoutRect& localRect,
unsigned maxDepthToTest) const; |
| 727 virtual bool computeBackgroundIsKnownToBeObscured() override; | 727 virtual bool computeBackgroundIsKnownToBeObscured() override; |
| 728 | 728 |
| 729 void computePositionedLogicalWidth(LogicalExtentComputedValues&) const; | 729 void computePositionedLogicalWidth(LogicalExtentComputedValues&) const; |
| 730 | 730 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 751 virtual bool paintInvalidationStateIsDirty() const override; | 751 virtual bool paintInvalidationStateIsDirty() const override; |
| 752 #endif | 752 #endif |
| 753 | 753 |
| 754 virtual PaintInvalidationReason invalidatePaintIfNeeded(PaintInvalidationSta
te&, const LayoutBoxModelObject& newPaintInvalidationContainer) override; | 754 virtual PaintInvalidationReason invalidatePaintIfNeeded(PaintInvalidationSta
te&, const LayoutBoxModelObject& newPaintInvalidationContainer) override; |
| 755 | 755 |
| 756 virtual bool hasNonCompositedScrollbars() const override final; | 756 virtual bool hasNonCompositedScrollbars() const override final; |
| 757 | 757 |
| 758 private: | 758 private: |
| 759 void invalidatePaintRectClippedByOldAndNewBounds(const LayoutBoxModelObject&
paintInvalidationContainer, const LayoutRect&, const LayoutRect& oldBounds, con
st LayoutRect& newBounds); | 759 void invalidatePaintRectClippedByOldAndNewBounds(const LayoutBoxModelObject&
paintInvalidationContainer, const LayoutRect&, const LayoutRect& oldBounds, con
st LayoutRect& newBounds); |
| 760 | 760 |
| 761 void updateShapeOutsideInfoAfterStyleChange(const LayoutStyle&, const Layout
Style* oldStyle); | 761 void updateShapeOutsideInfoAfterStyleChange(const ComputedStyle&, const Comp
utedStyle* oldStyle); |
| 762 void updateGridPositionAfterStyleChange(const LayoutStyle*); | 762 void updateGridPositionAfterStyleChange(const ComputedStyle*); |
| 763 | 763 |
| 764 bool autoWidthShouldFitContent() const; | 764 bool autoWidthShouldFitContent() const; |
| 765 LayoutUnit shrinkToFitLogicalWidth(LayoutUnit availableLogicalWidth, LayoutU
nit bordersPlusPadding) const; | 765 LayoutUnit shrinkToFitLogicalWidth(LayoutUnit availableLogicalWidth, LayoutU
nit bordersPlusPadding) const; |
| 766 | 766 |
| 767 // Returns true if we queued up a paint invalidation. | 767 // Returns true if we queued up a paint invalidation. |
| 768 bool paintInvalidationLayerRectsForImage(WrappedImagePtr, const FillLayer&,
bool drawingBackground); | 768 bool paintInvalidationLayerRectsForImage(WrappedImagePtr, const FillLayer&,
bool drawingBackground); |
| 769 | 769 |
| 770 bool skipContainingBlockForPercentHeightCalculation(const LayoutBox* contain
ingBlock) const; | 770 bool skipContainingBlockForPercentHeightCalculation(const LayoutBox* contain
ingBlock) const; |
| 771 | 771 |
| 772 LayoutUnit containingBlockLogicalWidthForPositioned(const LayoutBoxModelObje
ct* containingBlock, bool checkForPerpendicularWritingMode = true) const; | 772 LayoutUnit containingBlockLogicalWidthForPositioned(const LayoutBoxModelObje
ct* containingBlock, bool checkForPerpendicularWritingMode = true) const; |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 912 if (UNLIKELY(inlineBoxWrapper() != 0)) | 912 if (UNLIKELY(inlineBoxWrapper() != 0)) |
| 913 deleteLineBoxWrapper(); | 913 deleteLineBoxWrapper(); |
| 914 } | 914 } |
| 915 | 915 |
| 916 ensureRareData().m_inlineBoxWrapper = boxWrapper; | 916 ensureRareData().m_inlineBoxWrapper = boxWrapper; |
| 917 } | 917 } |
| 918 | 918 |
| 919 } // namespace blink | 919 } // namespace blink |
| 920 | 920 |
| 921 #endif // LayoutBox_h | 921 #endif // LayoutBox_h |
| OLD | NEW |