| 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 enum ScrollOffsetClamping { | 50 enum ScrollOffsetClamping { |
| 51 ScrollOffsetUnclamped, | 51 ScrollOffsetUnclamped, |
| 52 ScrollOffsetClamped | 52 ScrollOffsetClamped |
| 53 }; | 53 }; |
| 54 | 54 |
| 55 enum ApplyOverflowClipFlag { | 55 enum ApplyOverflowClipFlag { |
| 56 ApplyOverflowClip, | 56 ApplyOverflowClip, |
| 57 ApplyNonScrollOverflowClip | 57 ApplyNonScrollOverflowClip |
| 58 }; | 58 }; |
| 59 | 59 |
| 60 using SnapAreaSet = HashSet<const LayoutBox*>; | |
| 61 | |
| 62 struct LayoutBoxRareData { | 60 struct LayoutBoxRareData { |
| 63 WTF_MAKE_NONCOPYABLE(LayoutBoxRareData); USING_FAST_MALLOC(LayoutBoxRareData
); | 61 WTF_MAKE_NONCOPYABLE(LayoutBoxRareData); USING_FAST_MALLOC(LayoutBoxRareData
); |
| 64 public: | 62 public: |
| 65 LayoutBoxRareData() | 63 LayoutBoxRareData() |
| 66 : m_spannerPlaceholder(nullptr) | 64 : m_spannerPlaceholder(nullptr) |
| 67 , m_overrideLogicalContentHeight(-1) | 65 , m_overrideLogicalContentHeight(-1) |
| 68 , m_overrideLogicalContentWidth(-1) | 66 , m_overrideLogicalContentWidth(-1) |
| 69 , m_previousBorderBoxSize(LayoutUnit(-1), LayoutUnit(-1)) | 67 , m_previousBorderBoxSize(LayoutUnit(-1), LayoutUnit(-1)) |
| 70 , m_percentHeightContainer(nullptr) | 68 , m_percentHeightContainer(nullptr) |
| 71 , m_snapContainer(nullptr) | |
| 72 , m_snapAreas(nullptr) | |
| 73 { | 69 { |
| 74 } | 70 } |
| 75 | 71 |
| 76 // For spanners, the spanner placeholder that lays us out within the multico
l container. | 72 // For spanners, the spanner placeholder that lays us out within the multico
l container. |
| 77 LayoutMultiColumnSpannerPlaceholder* m_spannerPlaceholder; | 73 LayoutMultiColumnSpannerPlaceholder* m_spannerPlaceholder; |
| 78 | 74 |
| 79 LayoutUnit m_overrideLogicalContentHeight; | 75 LayoutUnit m_overrideLogicalContentHeight; |
| 80 LayoutUnit m_overrideLogicalContentWidth; | 76 LayoutUnit m_overrideLogicalContentWidth; |
| 81 | 77 |
| 82 // Set by LayoutBox::savePreviousBoxSizesIfNeeded(). | 78 // Set by LayoutBox::savePreviousBoxSizesIfNeeded(). |
| 83 LayoutSize m_previousBorderBoxSize; | 79 LayoutSize m_previousBorderBoxSize; |
| 84 LayoutRect m_previousContentBoxRect; | 80 LayoutRect m_previousContentBoxRect; |
| 85 LayoutRect m_previousLayoutOverflowRect; | 81 LayoutRect m_previousLayoutOverflowRect; |
| 86 | 82 |
| 87 LayoutUnit m_pageLogicalOffset; | 83 LayoutUnit m_pageLogicalOffset; |
| 88 | 84 |
| 89 LayoutUnit m_paginationStrut; | 85 LayoutUnit m_paginationStrut; |
| 90 | 86 |
| 91 LayoutBlock* m_percentHeightContainer; | 87 LayoutBlock* m_percentHeightContainer; |
| 92 // For snap area, the owning snap container. | |
| 93 LayoutBox* m_snapContainer; | |
| 94 // For snap container, the descendant snap areas that contribute snap | |
| 95 // points. | |
| 96 OwnPtr<SnapAreaSet> m_snapAreas; | |
| 97 | |
| 98 SnapAreaSet& ensureSnapAreas() | |
| 99 { | |
| 100 if (!m_snapAreas) | |
| 101 m_snapAreas = adoptPtr(new SnapAreaSet); | |
| 102 | |
| 103 return *m_snapAreas; | |
| 104 } | |
| 105 }; | 88 }; |
| 106 | 89 |
| 107 // LayoutBox implements the full CSS box model. | 90 // LayoutBox implements the full CSS box model. |
| 108 // | 91 // |
| 109 // LayoutBoxModelObject only introduces some abstractions for LayoutInline and | 92 // LayoutBoxModelObject only introduces some abstractions for LayoutInline and |
| 110 // LayoutBox. The logic for the model is in LayoutBox, e.g. the storage for the | 93 // LayoutBox. The logic for the model is in LayoutBox, e.g. the storage for the |
| 111 // rectangle and offset forming the CSS box (m_frameRect) and the getters for | 94 // rectangle and offset forming the CSS box (m_frameRect) and the getters for |
| 112 // the different boxes. | 95 // the different boxes. |
| 113 // | 96 // |
| 114 // LayoutBox is also the uppermost class to support scrollbars, however the | 97 // LayoutBox is also the uppermost class to support scrollbars, however the |
| (...skipping 812 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 927 | 910 |
| 928 void mapLocalToAncestor(const LayoutBoxModelObject* ancestor, TransformState
&, MapCoordinatesFlags = ApplyContainerFlip) const override; | 911 void mapLocalToAncestor(const LayoutBoxModelObject* ancestor, TransformState
&, MapCoordinatesFlags = ApplyContainerFlip) const override; |
| 929 void mapAncestorToLocal(const LayoutBoxModelObject*, TransformState&, MapCoo
rdinatesFlags) const override; | 912 void mapAncestorToLocal(const LayoutBoxModelObject*, TransformState&, MapCoo
rdinatesFlags) const override; |
| 930 | 913 |
| 931 void clearPreviousPaintInvalidationRects() override; | 914 void clearPreviousPaintInvalidationRects() override; |
| 932 | 915 |
| 933 LayoutBlock* percentHeightContainer() const { return m_rareData ? m_rareData
->m_percentHeightContainer : nullptr; } | 916 LayoutBlock* percentHeightContainer() const { return m_rareData ? m_rareData
->m_percentHeightContainer : nullptr; } |
| 934 void setPercentHeightContainer(LayoutBlock*); | 917 void setPercentHeightContainer(LayoutBlock*); |
| 935 void removeFromPercentHeightContainer(); | 918 void removeFromPercentHeightContainer(); |
| 936 void clearPercentHeightDescendants(); | 919 void clearPercentHeightDescendants(); |
| 937 // For snap areas, returns the snap container that owns us. | |
| 938 LayoutBox* snapContainer() const; | |
| 939 void setSnapContainer(LayoutBox*); | |
| 940 // For snap containers, returns all associated snap areas. | |
| 941 SnapAreaSet* snapAreas() const; | |
| 942 void clearSnapAreas(); | |
| 943 | 920 |
| 944 bool hitTestClippedOutByRoundedBorder(const HitTestLocation& locationInConta
iner, const LayoutPoint& borderBoxLocation) const; | 921 bool hitTestClippedOutByRoundedBorder(const HitTestLocation& locationInConta
iner, const LayoutPoint& borderBoxLocation) const; |
| 945 | 922 |
| 946 protected: | 923 protected: |
| 947 void willBeDestroyed() override; | 924 void willBeDestroyed() override; |
| 948 | 925 |
| 949 void insertedIntoTree() override; | 926 void insertedIntoTree() override; |
| 950 void willBeRemovedFromTree() override; | 927 void willBeRemovedFromTree() override; |
| 951 | 928 |
| 952 void styleWillChange(StyleDifference, const ComputedStyle& newStyle) overrid
e; | 929 void styleWillChange(StyleDifference, const ComputedStyle& newStyle) overrid
e; |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 994 | 971 |
| 995 private: | 972 private: |
| 996 bool mustInvalidateBackgroundOrBorderPaintOnHeightChange() const; | 973 bool mustInvalidateBackgroundOrBorderPaintOnHeightChange() const; |
| 997 bool mustInvalidateBackgroundOrBorderPaintOnWidthChange() const; | 974 bool mustInvalidateBackgroundOrBorderPaintOnWidthChange() const; |
| 998 inline bool mustInvalidateFillLayersPaintOnWidthChange(const FillLayer&) con
st; | 975 inline bool mustInvalidateFillLayersPaintOnWidthChange(const FillLayer&) con
st; |
| 999 | 976 |
| 1000 void invalidatePaintRectClippedByOldAndNewBounds(const LayoutBoxModelObject&
paintInvalidationContainer, const LayoutRect&, const LayoutRect& oldBounds, con
st LayoutRect& newBounds); | 977 void invalidatePaintRectClippedByOldAndNewBounds(const LayoutBoxModelObject&
paintInvalidationContainer, const LayoutRect&, const LayoutRect& oldBounds, con
st LayoutRect& newBounds); |
| 1001 | 978 |
| 1002 void updateShapeOutsideInfoAfterStyleChange(const ComputedStyle&, const Comp
utedStyle* oldStyle); | 979 void updateShapeOutsideInfoAfterStyleChange(const ComputedStyle&, const Comp
utedStyle* oldStyle); |
| 1003 void updateGridPositionAfterStyleChange(const ComputedStyle*); | 980 void updateGridPositionAfterStyleChange(const ComputedStyle*); |
| 1004 void updateScrollSnapMappingAfterStyleChange(const ComputedStyle*, const Com
putedStyle* oldStyle); | |
| 1005 void clearScrollSnapMapping(); | |
| 1006 void addScrollSnapMapping(); | |
| 1007 | 981 |
| 1008 bool autoWidthShouldFitContent() const; | 982 bool autoWidthShouldFitContent() const; |
| 1009 LayoutUnit shrinkToFitLogicalWidth(LayoutUnit availableLogicalWidth, LayoutU
nit bordersPlusPadding) const; | 983 LayoutUnit shrinkToFitLogicalWidth(LayoutUnit availableLogicalWidth, LayoutU
nit bordersPlusPadding) const; |
| 1010 | 984 |
| 1011 // Returns true if we queued up a paint invalidation. | 985 // Returns true if we queued up a paint invalidation. |
| 1012 bool invalidatePaintOfLayerRectsForImage(WrappedImagePtr, const FillLayer&,
bool drawingBackground); | 986 bool invalidatePaintOfLayerRectsForImage(WrappedImagePtr, const FillLayer&,
bool drawingBackground); |
| 1013 | 987 |
| 1014 bool stretchesToViewportInQuirksMode() const; | 988 bool stretchesToViewportInQuirksMode() const; |
| 1015 bool skipContainingBlockForPercentHeightCalculation(const LayoutBox* contain
ingBlock) const; | 989 bool skipContainingBlockForPercentHeightCalculation(const LayoutBox* contain
ingBlock) const; |
| 1016 | 990 |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1082 // Our intrinsic height, used for min-height: min-content etc. Maintained by | 1056 // Our intrinsic height, used for min-height: min-content etc. Maintained by |
| 1083 // updateLogicalHeight. This is logicalHeight() before it is clamped to | 1057 // updateLogicalHeight. This is logicalHeight() before it is clamped to |
| 1084 // min/max. | 1058 // min/max. |
| 1085 mutable LayoutUnit m_intrinsicContentLogicalHeight; | 1059 mutable LayoutUnit m_intrinsicContentLogicalHeight; |
| 1086 | 1060 |
| 1087 void inflateVisualRectForReflectionAndFilter(LayoutRect&) const; | 1061 void inflateVisualRectForReflectionAndFilter(LayoutRect&) const; |
| 1088 void inflateVisualRectForReflectionAndFilterUnderContainer(LayoutRect&, cons
t LayoutObject& container, const LayoutBoxModelObject* ancestorToStopAt) const; | 1062 void inflateVisualRectForReflectionAndFilterUnderContainer(LayoutRect&, cons
t LayoutObject& container, const LayoutBoxModelObject* ancestorToStopAt) const; |
| 1089 | 1063 |
| 1090 LayoutRectOutsets m_marginBoxOutsets; | 1064 LayoutRectOutsets m_marginBoxOutsets; |
| 1091 | 1065 |
| 1092 void addSnapArea(const LayoutBox&); | |
| 1093 void removeSnapArea(const LayoutBox&); | |
| 1094 | |
| 1095 protected: | 1066 protected: |
| 1096 // The logical width of the element if it were to break its lines at every | 1067 // The logical width of the element if it were to break its lines at every |
| 1097 // possible opportunity. | 1068 // possible opportunity. |
| 1098 // | 1069 // |
| 1099 // See LayoutObject::minPreferredLogicalWidth() for more details. | 1070 // See LayoutObject::minPreferredLogicalWidth() for more details. |
| 1100 LayoutUnit m_minPreferredLogicalWidth; | 1071 LayoutUnit m_minPreferredLogicalWidth; |
| 1101 | 1072 |
| 1102 // The logical width of the element if it never breaks any lines at all. | 1073 // The logical width of the element if it never breaks any lines at all. |
| 1103 // | 1074 // |
| 1104 // See LayoutObject::maxPreferredLogicalWidth() for more details. | 1075 // See LayoutObject::maxPreferredLogicalWidth() for more details. |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1193 || breakValue == BreakLeft | 1164 || breakValue == BreakLeft |
| 1194 || breakValue == BreakPage | 1165 || breakValue == BreakPage |
| 1195 || breakValue == BreakRecto | 1166 || breakValue == BreakRecto |
| 1196 || breakValue == BreakRight | 1167 || breakValue == BreakRight |
| 1197 || breakValue == BreakVerso; | 1168 || breakValue == BreakVerso; |
| 1198 } | 1169 } |
| 1199 | 1170 |
| 1200 } // namespace blink | 1171 } // namespace blink |
| 1201 | 1172 |
| 1202 #endif // LayoutBox_h | 1173 #endif // LayoutBox_h |
| OLD | NEW |