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 12 matching lines...) Expand all Loading... |
23 #ifndef RenderBox_h | 23 #ifndef RenderBox_h |
24 #define RenderBox_h | 24 #define RenderBox_h |
25 | 25 |
26 #include "core/rendering/RenderBoxModelObject.h" | 26 #include "core/rendering/RenderBoxModelObject.h" |
27 #include "core/rendering/RenderOverflow.h" | 27 #include "core/rendering/RenderOverflow.h" |
28 #include "core/rendering/shapes/ShapeOutsideInfo.h" | 28 #include "core/rendering/shapes/ShapeOutsideInfo.h" |
29 #include "platform/scroll/ScrollTypes.h" | 29 #include "platform/scroll/ScrollTypes.h" |
30 | 30 |
31 namespace blink { | 31 namespace blink { |
32 | 32 |
| 33 class RenderMultiColumnSpannerPlaceholder; |
| 34 |
33 struct PaintInfo; | 35 struct PaintInfo; |
34 | 36 |
35 enum SizeType { MainOrPreferredSize, MinSize, MaxSize }; | 37 enum SizeType { MainOrPreferredSize, MinSize, MaxSize }; |
36 enum AvailableLogicalHeightType { ExcludeMarginBorderPadding, IncludeMarginBorde
rPadding }; | 38 enum AvailableLogicalHeightType { ExcludeMarginBorderPadding, IncludeMarginBorde
rPadding }; |
37 enum OverlayScrollbarSizeRelevancy { IgnoreOverlayScrollbarSize, IncludeOverlayS
crollbarSize }; | 39 enum OverlayScrollbarSizeRelevancy { IgnoreOverlayScrollbarSize, IncludeOverlayS
crollbarSize }; |
38 enum MarginDirection { BlockDirection, InlineDirection }; | 40 enum MarginDirection { BlockDirection, InlineDirection }; |
39 | 41 |
40 enum ShouldComputePreferred { ComputeActual, ComputePreferred }; | 42 enum ShouldComputePreferred { ComputeActual, ComputePreferred }; |
41 | 43 |
42 enum ScrollOffsetClamping { | 44 enum ScrollOffsetClamping { |
43 ScrollOffsetUnclamped, | 45 ScrollOffsetUnclamped, |
44 ScrollOffsetClamped | 46 ScrollOffsetClamped |
45 }; | 47 }; |
46 | 48 |
47 struct RenderBoxRareData { | 49 struct RenderBoxRareData { |
48 WTF_MAKE_NONCOPYABLE(RenderBoxRareData); WTF_MAKE_FAST_ALLOCATED; | 50 WTF_MAKE_NONCOPYABLE(RenderBoxRareData); WTF_MAKE_FAST_ALLOCATED; |
49 public: | 51 public: |
50 RenderBoxRareData() | 52 RenderBoxRareData() |
51 : m_inlineBoxWrapper(0) | 53 : m_inlineBoxWrapper(0) |
| 54 , m_spannerPlaceholder(0) |
52 , m_overrideLogicalContentHeight(-1) | 55 , m_overrideLogicalContentHeight(-1) |
53 , m_overrideLogicalContentWidth(-1) | 56 , m_overrideLogicalContentWidth(-1) |
54 , m_previousBorderBoxSize(-1, -1) | 57 , m_previousBorderBoxSize(-1, -1) |
55 { | 58 { |
56 } | 59 } |
57 | 60 |
58 // For inline replaced elements, the inline box that owns us. | 61 // For inline replaced elements, the inline box that owns us. |
59 InlineBox* m_inlineBoxWrapper; | 62 InlineBox* m_inlineBoxWrapper; |
60 | 63 |
| 64 // For spanners, the spanner placeholder that lays us out within the multico
l container. |
| 65 RenderMultiColumnSpannerPlaceholder* m_spannerPlaceholder; |
| 66 |
61 LayoutUnit m_overrideLogicalContentHeight; | 67 LayoutUnit m_overrideLogicalContentHeight; |
62 LayoutUnit m_overrideLogicalContentWidth; | 68 LayoutUnit m_overrideLogicalContentWidth; |
63 | 69 |
64 // Set by RenderBox::updatePreviousBorderBoxSizeIfNeeded(). | 70 // Set by RenderBox::updatePreviousBorderBoxSizeIfNeeded(). |
65 LayoutSize m_previousBorderBoxSize; | 71 LayoutSize m_previousBorderBoxSize; |
66 }; | 72 }; |
67 | 73 |
68 class RenderBox : public RenderBoxModelObject { | 74 class RenderBox : public RenderBoxModelObject { |
69 public: | 75 public: |
70 explicit RenderBox(ContainerNode*); | 76 explicit RenderBox(ContainerNode*); |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 // does include the intrinsic padding in the content box as this is what som
e callers expect (like getComputedStyle). | 186 // does include the intrinsic padding in the content box as this is what som
e callers expect (like getComputedStyle). |
181 LayoutRect computedCSSContentBoxRect() const { return LayoutRect(borderLeft(
) + computedCSSPaddingLeft(), borderTop() + computedCSSPaddingTop(), clientWidth
() - computedCSSPaddingLeft() - computedCSSPaddingRight(), clientHeight() - comp
utedCSSPaddingTop() - computedCSSPaddingBottom()); } | 187 LayoutRect computedCSSContentBoxRect() const { return LayoutRect(borderLeft(
) + computedCSSPaddingLeft(), borderTop() + computedCSSPaddingTop(), clientWidth
() - computedCSSPaddingLeft() - computedCSSPaddingRight(), clientHeight() - comp
utedCSSPaddingTop() - computedCSSPaddingBottom()); } |
182 | 188 |
183 virtual void addFocusRingRects(Vector<LayoutRect>&, const LayoutPoint& addit
ionalOffset) const override; | 189 virtual void addFocusRingRects(Vector<LayoutRect>&, const LayoutPoint& addit
ionalOffset) const override; |
184 | 190 |
185 // Use this with caution! No type checking is done! | 191 // Use this with caution! No type checking is done! |
186 RenderBox* previousSiblingBox() const; | 192 RenderBox* previousSiblingBox() const; |
187 RenderBox* nextSiblingBox() const; | 193 RenderBox* nextSiblingBox() const; |
188 RenderBox* parentBox() const; | 194 RenderBox* parentBox() const; |
189 | 195 |
| 196 // Return the previous sibling column set or spanner placeholder. Only to be
used on multicol container children. |
| 197 RenderBox* previousSiblingMultiColumnBox() const; |
| 198 // Return the next sibling column set or spanner placeholder. Only to be use
d on multicol container children. |
| 199 RenderBox* nextSiblingMultiColumnBox() const; |
| 200 |
190 bool canResize() const; | 201 bool canResize() const; |
191 | 202 |
192 // Visual and layout overflow are in the coordinate space of the box. This
means that they aren't purely physical directions. | 203 // Visual and layout overflow are in the coordinate space of the box. This
means that they aren't purely physical directions. |
193 // For horizontal-tb and vertical-lr they will match physical directions, bu
t for horizontal-bt and vertical-rl, the top/bottom and left/right | 204 // For horizontal-tb and vertical-lr they will match physical directions, bu
t for horizontal-bt and vertical-rl, the top/bottom and left/right |
194 // respectively are flipped when compared to their physical counterparts. F
or example minX is on the left in vertical-lr, | 205 // respectively are flipped when compared to their physical counterparts. F
or example minX is on the left in vertical-lr, |
195 // but it is on the right in vertical-rl. | 206 // but it is on the right in vertical-rl. |
196 LayoutRect noOverflowRect() const; | 207 LayoutRect noOverflowRect() const; |
197 LayoutRect layoutOverflowRect() const { return m_overflow ? m_overflow->layo
utOverflowRect() : noOverflowRect(); } | 208 LayoutRect layoutOverflowRect() const { return m_overflow ? m_overflow->layo
utOverflowRect() : noOverflowRect(); } |
198 IntRect pixelSnappedLayoutOverflowRect() const { return pixelSnappedIntRect(
layoutOverflowRect()); } | 209 IntRect pixelSnappedLayoutOverflowRect() const { return pixelSnappedIntRect(
layoutOverflowRect()); } |
199 LayoutSize maxLayoutOverflow() const { return LayoutSize(layoutOverflowRect(
).maxX(), layoutOverflowRect().maxY()); } | 210 LayoutSize maxLayoutOverflow() const { return LayoutSize(layoutOverflowRect(
).maxX(), layoutOverflowRect().maxY()); } |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
389 virtual InlineBox* createInlineBox(); | 400 virtual InlineBox* createInlineBox(); |
390 void dirtyLineBoxes(bool fullLayout); | 401 void dirtyLineBoxes(bool fullLayout); |
391 | 402 |
392 // For inline replaced elements, this function returns the inline box that o
wns us. Enables | 403 // For inline replaced elements, this function returns the inline box that o
wns us. Enables |
393 // the replaced RenderObject to quickly determine what line it is contained
on and to easily | 404 // the replaced RenderObject to quickly determine what line it is contained
on and to easily |
394 // iterate over structures on the line. | 405 // iterate over structures on the line. |
395 InlineBox* inlineBoxWrapper() const { return m_rareData ? m_rareData->m_inli
neBoxWrapper : 0; } | 406 InlineBox* inlineBoxWrapper() const { return m_rareData ? m_rareData->m_inli
neBoxWrapper : 0; } |
396 void setInlineBoxWrapper(InlineBox*); | 407 void setInlineBoxWrapper(InlineBox*); |
397 void deleteLineBoxWrapper(); | 408 void deleteLineBoxWrapper(); |
398 | 409 |
| 410 void setSpannerPlaceholder(RenderMultiColumnSpannerPlaceholder&); |
| 411 void clearSpannerPlaceholder(); |
| 412 virtual RenderMultiColumnSpannerPlaceholder* spannerPlaceholder() const fina
l { return m_rareData ? m_rareData->m_spannerPlaceholder : 0; } |
| 413 |
399 virtual LayoutRect clippedOverflowRectForPaintInvalidation(const RenderLayer
ModelObject* paintInvalidationContainer, const PaintInvalidationState* = 0) cons
t override; | 414 virtual LayoutRect clippedOverflowRectForPaintInvalidation(const RenderLayer
ModelObject* paintInvalidationContainer, const PaintInvalidationState* = 0) cons
t override; |
400 virtual void mapRectToPaintInvalidationBacking(const RenderLayerModelObject*
paintInvalidationContainer, LayoutRect&, const PaintInvalidationState*) const o
verride; | 415 virtual void mapRectToPaintInvalidationBacking(const RenderLayerModelObject*
paintInvalidationContainer, LayoutRect&, const PaintInvalidationState*) const o
verride; |
401 virtual void invalidatePaintForOverhangingFloats(bool paintAllDescendants); | 416 virtual void invalidatePaintForOverhangingFloats(bool paintAllDescendants); |
402 | 417 |
403 virtual LayoutUnit containingBlockLogicalWidthForContent() const override; | 418 virtual LayoutUnit containingBlockLogicalWidthForContent() const override; |
404 LayoutUnit containingBlockLogicalHeightForContent(AvailableLogicalHeightType
) const; | 419 LayoutUnit containingBlockLogicalHeightForContent(AvailableLogicalHeightType
) const; |
405 | 420 |
406 LayoutUnit containingBlockAvailableLineWidth() const; | 421 LayoutUnit containingBlockAvailableLineWidth() const; |
407 LayoutUnit perpendicularContainingBlockLogicalHeight() const; | 422 LayoutUnit perpendicularContainingBlockLogicalHeight() const; |
408 | 423 |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
646 void markShapeOutsideDependentsForLayout() | 661 void markShapeOutsideDependentsForLayout() |
647 { | 662 { |
648 if (isFloating()) | 663 if (isFloating()) |
649 removeFloatingOrPositionedChildFromBlockLists(); | 664 removeFloatingOrPositionedChildFromBlockLists(); |
650 } | 665 } |
651 | 666 |
652 bool backgroundHasOpaqueTopLayer() const; | 667 bool backgroundHasOpaqueTopLayer() const; |
653 | 668 |
654 void setIntrinsicContentLogicalHeight(LayoutUnit intrinsicContentLogicalHeig
ht) const { m_intrinsicContentLogicalHeight = intrinsicContentLogicalHeight; } | 669 void setIntrinsicContentLogicalHeight(LayoutUnit intrinsicContentLogicalHeig
ht) const { m_intrinsicContentLogicalHeight = intrinsicContentLogicalHeight; } |
655 protected: | 670 protected: |
| 671 virtual void willBeRemovedFromTree() override; |
656 virtual void willBeDestroyed() override; | 672 virtual void willBeDestroyed() override; |
657 | 673 |
658 | |
659 virtual void styleWillChange(StyleDifference, const RenderStyle& newStyle) o
verride; | 674 virtual void styleWillChange(StyleDifference, const RenderStyle& newStyle) o
verride; |
660 virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle) ov
erride; | 675 virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle) ov
erride; |
661 virtual void updateFromStyle() override; | 676 virtual void updateFromStyle() override; |
662 | 677 |
663 // Returns false if it could not cheaply compute the extent (e.g. fixed back
ground), in which case the returned rect may be incorrect. | 678 // Returns false if it could not cheaply compute the extent (e.g. fixed back
ground), in which case the returned rect may be incorrect. |
664 // FIXME: make this a const method once the RenderBox reference in BoxPainte
r is const. | 679 // FIXME: make this a const method once the RenderBox reference in BoxPainte
r is const. |
665 bool getBackgroundPaintedExtent(LayoutRect&); | 680 bool getBackgroundPaintedExtent(LayoutRect&); |
666 virtual bool foregroundIsKnownToBeOpaqueInRect(const LayoutRect& localRect,
unsigned maxDepthToTest) const; | 681 virtual bool foregroundIsKnownToBeOpaqueInRect(const LayoutRect& localRect,
unsigned maxDepthToTest) const; |
667 virtual bool computeBackgroundIsKnownToBeObscured() override; | 682 virtual bool computeBackgroundIsKnownToBeObscured() override; |
668 | 683 |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
795 inline RenderBox* RenderBox::firstChildBox() const | 810 inline RenderBox* RenderBox::firstChildBox() const |
796 { | 811 { |
797 return toRenderBox(slowFirstChild()); | 812 return toRenderBox(slowFirstChild()); |
798 } | 813 } |
799 | 814 |
800 inline RenderBox* RenderBox::lastChildBox() const | 815 inline RenderBox* RenderBox::lastChildBox() const |
801 { | 816 { |
802 return toRenderBox(slowLastChild()); | 817 return toRenderBox(slowLastChild()); |
803 } | 818 } |
804 | 819 |
| 820 inline RenderBox* RenderBox::previousSiblingMultiColumnBox() const |
| 821 { |
| 822 ASSERT(isRenderMultiColumnSpannerPlaceholder() || isRenderMultiColumnSet()); |
| 823 RenderBox* previousBox = previousSiblingBox(); |
| 824 if (previousBox->isRenderFlowThread()) |
| 825 return 0; |
| 826 return previousBox; |
| 827 } |
| 828 |
| 829 inline RenderBox* RenderBox::nextSiblingMultiColumnBox() const |
| 830 { |
| 831 ASSERT(isRenderMultiColumnSpannerPlaceholder() || isRenderMultiColumnSet()); |
| 832 return nextSiblingBox(); |
| 833 } |
| 834 |
805 inline void RenderBox::setInlineBoxWrapper(InlineBox* boxWrapper) | 835 inline void RenderBox::setInlineBoxWrapper(InlineBox* boxWrapper) |
806 { | 836 { |
807 if (boxWrapper) { | 837 if (boxWrapper) { |
808 ASSERT(!inlineBoxWrapper()); | 838 ASSERT(!inlineBoxWrapper()); |
809 // m_inlineBoxWrapper should already be 0. Deleting it is a safeguard ag
ainst security issues. | 839 // m_inlineBoxWrapper should already be 0. Deleting it is a safeguard ag
ainst security issues. |
810 // Otherwise, there will two line box wrappers keeping the reference to
this renderer, and | 840 // Otherwise, there will two line box wrappers keeping the reference to
this renderer, and |
811 // only one will be notified when the renderer is getting destroyed. The
second line box wrapper | 841 // only one will be notified when the renderer is getting destroyed. The
second line box wrapper |
812 // will keep a stale reference. | 842 // will keep a stale reference. |
813 if (UNLIKELY(inlineBoxWrapper() != 0)) | 843 if (UNLIKELY(inlineBoxWrapper() != 0)) |
814 deleteLineBoxWrapper(); | 844 deleteLineBoxWrapper(); |
815 } | 845 } |
816 | 846 |
817 ensureRareData().m_inlineBoxWrapper = boxWrapper; | 847 ensureRareData().m_inlineBoxWrapper = boxWrapper; |
818 } | 848 } |
819 | 849 |
820 } // namespace blink | 850 } // namespace blink |
821 | 851 |
822 #endif // RenderBox_h | 852 #endif // RenderBox_h |
OLD | NEW |