| 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 enum OverlayScrollbarSizeRelevancy { IgnoreOverlayScrollbarSize, IncludeOverlayS
crollbarSize }; | 42 enum OverlayScrollbarSizeRelevancy { IgnoreOverlayScrollbarSize, IncludeOverlayS
crollbarSize }; |
| 43 enum MarginDirection { BlockDirection, InlineDirection }; | 43 enum MarginDirection { BlockDirection, InlineDirection }; |
| 44 | 44 |
| 45 enum ShouldComputePreferred { ComputeActual, ComputePreferred }; | 45 enum ShouldComputePreferred { ComputeActual, ComputePreferred }; |
| 46 | 46 |
| 47 enum ScrollOffsetClamping { | 47 enum ScrollOffsetClamping { |
| 48 ScrollOffsetUnclamped, | 48 ScrollOffsetUnclamped, |
| 49 ScrollOffsetClamped | 49 ScrollOffsetClamped |
| 50 }; | 50 }; |
| 51 | 51 |
| 52 using SnapAreaSet = WillBeHeapHashSet<RawPtrWillBeWeakMember<const LayoutBox>>; |
| 53 |
| 52 struct LayoutBoxRareData { | 54 struct LayoutBoxRareData { |
| 53 WTF_MAKE_NONCOPYABLE(LayoutBoxRareData); USING_FAST_MALLOC(LayoutBoxRareData
); | 55 WTF_MAKE_NONCOPYABLE(LayoutBoxRareData); USING_FAST_MALLOC(LayoutBoxRareData
); |
| 54 public: | 56 public: |
| 55 LayoutBoxRareData() | 57 LayoutBoxRareData() |
| 56 : m_inlineBoxWrapper(nullptr) | 58 : m_inlineBoxWrapper(nullptr) |
| 57 , m_spannerPlaceholder(nullptr) | 59 , m_spannerPlaceholder(nullptr) |
| 58 , m_overrideLogicalContentHeight(-1) | 60 , m_overrideLogicalContentHeight(-1) |
| 59 , m_overrideLogicalContentWidth(-1) | 61 , m_overrideLogicalContentWidth(-1) |
| 60 , m_previousBorderBoxSize(-1, -1) | 62 , m_previousBorderBoxSize(-1, -1) |
| 63 , m_snapContainer(nullptr) |
| 64 , m_snapAreas(nullptr) |
| 61 { | 65 { |
| 62 } | 66 } |
| 63 | 67 |
| 64 // For inline replaced elements, the inline box that owns us. | 68 // For inline replaced elements, the inline box that owns us. |
| 65 InlineBox* m_inlineBoxWrapper; | 69 InlineBox* m_inlineBoxWrapper; |
| 66 | 70 |
| 67 // For spanners, the spanner placeholder that lays us out within the multico
l container. | 71 // For spanners, the spanner placeholder that lays us out within the multico
l container. |
| 68 LayoutMultiColumnSpannerPlaceholder* m_spannerPlaceholder; | 72 LayoutMultiColumnSpannerPlaceholder* m_spannerPlaceholder; |
| 69 | 73 |
| 70 LayoutUnit m_overrideLogicalContentHeight; | 74 LayoutUnit m_overrideLogicalContentHeight; |
| 71 LayoutUnit m_overrideLogicalContentWidth; | 75 LayoutUnit m_overrideLogicalContentWidth; |
| 72 | 76 |
| 73 // Set by LayoutBox::savePreviousBoxSizesIfNeeded(). | 77 // Set by LayoutBox::savePreviousBoxSizesIfNeeded(). |
| 74 LayoutSize m_previousBorderBoxSize; | 78 LayoutSize m_previousBorderBoxSize; |
| 75 LayoutRect m_previousContentBoxRect; | 79 LayoutRect m_previousContentBoxRect; |
| 76 LayoutRect m_previousLayoutOverflowRect; | 80 LayoutRect m_previousLayoutOverflowRect; |
| 77 | 81 |
| 78 LayoutUnit m_pageLogicalOffset; | 82 LayoutUnit m_pageLogicalOffset; |
| 79 | 83 |
| 80 LayoutUnit m_paginationStrut; | 84 LayoutUnit m_paginationStrut; |
| 85 |
| 86 // For snap area, the owning snap container. |
| 87 LayoutBox* m_snapContainer; |
| 88 // For snap container, the descendant snap areas that contribute snap |
| 89 // points. |
| 90 OwnPtrWillBeMember<SnapAreaSet> m_snapAreas; |
| 91 |
| 92 SnapAreaSet& ensureSnapAreas() |
| 93 { |
| 94 if (!m_snapAreas) |
| 95 m_snapAreas = adoptPtrWillBeNoop(new SnapAreaSet); |
| 96 |
| 97 return *m_snapAreas; |
| 98 } |
| 99 |
| 81 }; | 100 }; |
| 82 | 101 |
| 83 // LayoutBox implements the full CSS box model. | 102 // LayoutBox implements the full CSS box model. |
| 84 // | 103 // |
| 85 // LayoutBoxModelObject only introduces some abstractions for LayoutInline and | 104 // LayoutBoxModelObject only introduces some abstractions for LayoutInline and |
| 86 // LayoutBox. The logic for the model is in LayoutBox, e.g. the storage for the | 105 // LayoutBox. The logic for the model is in LayoutBox, e.g. the storage for the |
| 87 // rectangle and offset forming the CSS box (m_frameRect) and the getters for | 106 // rectangle and offset forming the CSS box (m_frameRect) and the getters for |
| 88 // the different boxes. | 107 // the different boxes. |
| 89 // | 108 // |
| 90 // LayoutBox is also the uppermost class to support scrollbars, however the | 109 // LayoutBox is also the uppermost class to support scrollbars, however the |
| (...skipping 745 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 836 void markShapeOutsideDependentsForLayout() | 855 void markShapeOutsideDependentsForLayout() |
| 837 { | 856 { |
| 838 if (isFloating()) | 857 if (isFloating()) |
| 839 removeFloatingOrPositionedChildFromBlockLists(); | 858 removeFloatingOrPositionedChildFromBlockLists(); |
| 840 } | 859 } |
| 841 | 860 |
| 842 void setIntrinsicContentLogicalHeight(LayoutUnit intrinsicContentLogicalHeig
ht) const { m_intrinsicContentLogicalHeight = intrinsicContentLogicalHeight; } | 861 void setIntrinsicContentLogicalHeight(LayoutUnit intrinsicContentLogicalHeig
ht) const { m_intrinsicContentLogicalHeight = intrinsicContentLogicalHeight; } |
| 843 | 862 |
| 844 bool canRenderBorderImage() const; | 863 bool canRenderBorderImage() const; |
| 845 | 864 |
| 865 // For snap areas, returns the snap container that owns us. |
| 866 LayoutBox* snapContainer() const; |
| 867 void setSnapContainer(LayoutBox*); |
| 868 // For snap containers, returns all associated snap areas. |
| 869 SnapAreaSet* snapAreas() const; |
| 870 |
| 846 protected: | 871 protected: |
| 847 void willBeDestroyed() override; | 872 void willBeDestroyed() override; |
| 873 void insertedIntoTree() override; |
| 848 | 874 |
| 849 void styleWillChange(StyleDifference, const ComputedStyle& newStyle) overrid
e; | 875 void styleWillChange(StyleDifference, const ComputedStyle& newStyle) overrid
e; |
| 850 void styleDidChange(StyleDifference, const ComputedStyle* oldStyle) override
; | 876 void styleDidChange(StyleDifference, const ComputedStyle* oldStyle) override
; |
| 851 void updateFromStyle() override; | 877 void updateFromStyle() override; |
| 852 | 878 |
| 853 // Returns false if it could not cheaply compute the extent (e.g. fixed back
ground), in which case the returned rect may be incorrect. | 879 // Returns false if it could not cheaply compute the extent (e.g. fixed back
ground), in which case the returned rect may be incorrect. |
| 854 // FIXME: make this a const method once the LayoutBox reference in BoxPainte
r is const. | 880 // FIXME: make this a const method once the LayoutBox reference in BoxPainte
r is const. |
| 855 bool getBackgroundPaintedExtent(LayoutRect&) const; | 881 bool getBackgroundPaintedExtent(LayoutRect&) const; |
| 856 virtual bool foregroundIsKnownToBeOpaqueInRect(const LayoutRect& localRect,
unsigned maxDepthToTest) const; | 882 virtual bool foregroundIsKnownToBeOpaqueInRect(const LayoutRect& localRect,
unsigned maxDepthToTest) const; |
| 857 bool computeBackgroundIsKnownToBeObscured() const override; | 883 bool computeBackgroundIsKnownToBeObscured() const override; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 883 | 909 |
| 884 private: | 910 private: |
| 885 bool mustInvalidateBackgroundOrBorderPaintOnHeightChange() const; | 911 bool mustInvalidateBackgroundOrBorderPaintOnHeightChange() const; |
| 886 bool mustInvalidateBackgroundOrBorderPaintOnWidthChange() const; | 912 bool mustInvalidateBackgroundOrBorderPaintOnWidthChange() const; |
| 887 inline bool mustInvalidateFillLayersPaintOnWidthChange(const FillLayer&) con
st; | 913 inline bool mustInvalidateFillLayersPaintOnWidthChange(const FillLayer&) con
st; |
| 888 | 914 |
| 889 void invalidatePaintRectClippedByOldAndNewBounds(const LayoutBoxModelObject&
paintInvalidationContainer, const LayoutRect&, const LayoutRect& oldBounds, con
st LayoutRect& newBounds); | 915 void invalidatePaintRectClippedByOldAndNewBounds(const LayoutBoxModelObject&
paintInvalidationContainer, const LayoutRect&, const LayoutRect& oldBounds, con
st LayoutRect& newBounds); |
| 890 | 916 |
| 891 void updateShapeOutsideInfoAfterStyleChange(const ComputedStyle&, const Comp
utedStyle* oldStyle); | 917 void updateShapeOutsideInfoAfterStyleChange(const ComputedStyle&, const Comp
utedStyle* oldStyle); |
| 892 void updateGridPositionAfterStyleChange(const ComputedStyle*); | 918 void updateGridPositionAfterStyleChange(const ComputedStyle*); |
| 919 void updateScrollSnapMappingAfterStyleChange(const ComputedStyle*, const Com
putedStyle* oldStyle); |
| 920 void clearScrollSnapMapping(); |
| 921 void addScrollSnapMapping(); |
| 893 | 922 |
| 894 bool autoWidthShouldFitContent() const; | 923 bool autoWidthShouldFitContent() const; |
| 895 LayoutUnit shrinkToFitLogicalWidth(LayoutUnit availableLogicalWidth, LayoutU
nit bordersPlusPadding) const; | 924 LayoutUnit shrinkToFitLogicalWidth(LayoutUnit availableLogicalWidth, LayoutU
nit bordersPlusPadding) const; |
| 896 | 925 |
| 897 // Returns true if we queued up a paint invalidation. | 926 // Returns true if we queued up a paint invalidation. |
| 898 bool invalidatePaintOfLayerRectsForImage(WrappedImagePtr, const FillLayer&,
bool drawingBackground); | 927 bool invalidatePaintOfLayerRectsForImage(WrappedImagePtr, const FillLayer&,
bool drawingBackground); |
| 899 | 928 |
| 900 bool stretchesToViewportInQuirksMode() const; | 929 bool stretchesToViewportInQuirksMode() const; |
| 901 bool skipContainingBlockForPercentHeightCalculation(const LayoutBox* contain
ingBlock) const; | 930 bool skipContainingBlockForPercentHeightCalculation(const LayoutBox* contain
ingBlock) const; |
| 902 | 931 |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 964 | 993 |
| 965 // Our intrinsic height, used for min-height: min-content etc. Maintained by | 994 // Our intrinsic height, used for min-height: min-content etc. Maintained by |
| 966 // updateLogicalHeight. This is logicalHeight() before it is clamped to | 995 // updateLogicalHeight. This is logicalHeight() before it is clamped to |
| 967 // min/max. | 996 // min/max. |
| 968 mutable LayoutUnit m_intrinsicContentLogicalHeight; | 997 mutable LayoutUnit m_intrinsicContentLogicalHeight; |
| 969 | 998 |
| 970 void inflatePaintInvalidationRectForReflectionAndFilter(LayoutRect&) const; | 999 void inflatePaintInvalidationRectForReflectionAndFilter(LayoutRect&) const; |
| 971 | 1000 |
| 972 LayoutRectOutsets m_marginBoxOutsets; | 1001 LayoutRectOutsets m_marginBoxOutsets; |
| 973 | 1002 |
| 1003 void addSnapArea(const LayoutBox&); |
| 1004 void removeSnapArea(const LayoutBox&); |
| 1005 |
| 974 protected: | 1006 protected: |
| 975 // The logical width of the element if it were to break its lines at every | 1007 // The logical width of the element if it were to break its lines at every |
| 976 // possible opportunity. | 1008 // possible opportunity. |
| 977 // | 1009 // |
| 978 // See LayoutObject::minPreferredLogicalWidth() for more details. | 1010 // See LayoutObject::minPreferredLogicalWidth() for more details. |
| 979 LayoutUnit m_minPreferredLogicalWidth; | 1011 LayoutUnit m_minPreferredLogicalWidth; |
| 980 | 1012 |
| 981 // The logical width of the element if it never breaks any lines at all. | 1013 // The logical width of the element if it never breaks any lines at all. |
| 982 // | 1014 // |
| 983 // See LayoutObject::maxPreferredLogicalWidth() for more details. | 1015 // See LayoutObject::maxPreferredLogicalWidth() for more details. |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1059 if (UNLIKELY(inlineBoxWrapper() != nullptr)) | 1091 if (UNLIKELY(inlineBoxWrapper() != nullptr)) |
| 1060 deleteLineBoxWrapper(); | 1092 deleteLineBoxWrapper(); |
| 1061 } | 1093 } |
| 1062 | 1094 |
| 1063 ensureRareData().m_inlineBoxWrapper = boxWrapper; | 1095 ensureRareData().m_inlineBoxWrapper = boxWrapper; |
| 1064 } | 1096 } |
| 1065 | 1097 |
| 1066 } // namespace blink | 1098 } // namespace blink |
| 1067 | 1099 |
| 1068 #endif // LayoutBox_h | 1100 #endif // LayoutBox_h |
| OLD | NEW |