Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(231)

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutBox.h

Issue 2208463003: First step of PaintInvalidator implementation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: - Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 56
57 using SnapAreaSet = HashSet<const LayoutBox*>; 57 using SnapAreaSet = HashSet<const LayoutBox*>;
58 58
59 struct LayoutBoxRareData { 59 struct LayoutBoxRareData {
60 WTF_MAKE_NONCOPYABLE(LayoutBoxRareData); USING_FAST_MALLOC(LayoutBoxRareData ); 60 WTF_MAKE_NONCOPYABLE(LayoutBoxRareData); USING_FAST_MALLOC(LayoutBoxRareData );
61 public: 61 public:
62 LayoutBoxRareData() 62 LayoutBoxRareData()
63 : m_spannerPlaceholder(nullptr) 63 : m_spannerPlaceholder(nullptr)
64 , m_overrideLogicalContentHeight(-1) 64 , m_overrideLogicalContentHeight(-1)
65 , m_overrideLogicalContentWidth(-1) 65 , m_overrideLogicalContentWidth(-1)
66 , m_previousBorderBoxSize(LayoutUnit(-1), LayoutUnit(-1))
67 , m_percentHeightContainer(nullptr) 66 , m_percentHeightContainer(nullptr)
68 , m_snapContainer(nullptr) 67 , m_snapContainer(nullptr)
69 , m_snapAreas(nullptr) 68 , m_snapAreas(nullptr)
70 { 69 {
71 } 70 }
72 71
73 // 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.
74 LayoutMultiColumnSpannerPlaceholder* m_spannerPlaceholder; 73 LayoutMultiColumnSpannerPlaceholder* m_spannerPlaceholder;
75 74
76 LayoutUnit m_overrideLogicalContentHeight; 75 LayoutUnit m_overrideLogicalContentHeight;
77 LayoutUnit m_overrideLogicalContentWidth; 76 LayoutUnit m_overrideLogicalContentWidth;
78 77
79 // Set by LayoutBox::savePreviousBoxSizesIfNeeded().
80 LayoutSize m_previousBorderBoxSize;
81 LayoutRect m_previousContentBoxRect;
82 LayoutRect m_previousLayoutOverflowRect;
83
84 LayoutUnit m_pageLogicalOffset; 78 LayoutUnit m_pageLogicalOffset;
85
86 LayoutUnit m_paginationStrut; 79 LayoutUnit m_paginationStrut;
87 80
88 LayoutBlock* m_percentHeightContainer; 81 LayoutBlock* m_percentHeightContainer;
89 // For snap area, the owning snap container. 82 // For snap area, the owning snap container.
90 LayoutBox* m_snapContainer; 83 LayoutBox* m_snapContainer;
91 // For snap container, the descendant snap areas that contribute snap 84 // For snap container, the descendant snap areas that contribute snap
92 // points. 85 // points.
93 std::unique_ptr<SnapAreaSet> m_snapAreas; 86 std::unique_ptr<SnapAreaSet> m_snapAreas;
94 87
95 SnapAreaSet& ensureSnapAreas() 88 SnapAreaSet& ensureSnapAreas()
(...skipping 863 matching lines...) Expand 10 before | Expand all | Expand 10 after
959 void clearPercentHeightDescendants(); 952 void clearPercentHeightDescendants();
960 // For snap areas, returns the snap container that owns us. 953 // For snap areas, returns the snap container that owns us.
961 LayoutBox* snapContainer() const; 954 LayoutBox* snapContainer() const;
962 void setSnapContainer(LayoutBox*); 955 void setSnapContainer(LayoutBox*);
963 // For snap containers, returns all associated snap areas. 956 // For snap containers, returns all associated snap areas.
964 SnapAreaSet* snapAreas() const; 957 SnapAreaSet* snapAreas() const;
965 void clearSnapAreas(); 958 void clearSnapAreas();
966 959
967 bool hitTestClippedOutByRoundedBorder(const HitTestLocation& locationInConta iner, const LayoutPoint& borderBoxLocation) const; 960 bool hitTestClippedOutByRoundedBorder(const HitTestLocation& locationInConta iner, const LayoutPoint& borderBoxLocation) const;
968 961
969 bool mustInvalidateFillLayersPaintOnWidthChange(const FillLayer&) const; 962 static bool mustInvalidateFillLayersPaintOnWidthChange(const FillLayer&);
970 bool mustInvalidateFillLayersPaintOnHeightChange(const FillLayer&) const; 963 static bool mustInvalidateFillLayersPaintOnHeightChange(const FillLayer&);
964
965 bool mustInvalidateBackgroundOrBorderPaintOnHeightChange() const;
966 bool mustInvalidateBackgroundOrBorderPaintOnWidthChange() const;
967
968 // Returns true if the box intersects the viewport visible to the user.
969 bool intersectsVisibleViewport() const;
970
971 bool hasNonCompositedScrollbars() const final;
971 972
972 protected: 973 protected:
973 void willBeDestroyed() override; 974 void willBeDestroyed() override;
974 975
975 void insertedIntoTree() override; 976 void insertedIntoTree() override;
976 void willBeRemovedFromTree() override; 977 void willBeRemovedFromTree() override;
977 978
978 void styleWillChange(StyleDifference, const ComputedStyle& newStyle) overrid e; 979 void styleWillChange(StyleDifference, const ComputedStyle& newStyle) overrid e;
979 void styleDidChange(StyleDifference, const ComputedStyle* oldStyle) override ; 980 void styleDidChange(StyleDifference, const ComputedStyle* oldStyle) override ;
980 void updateFromStyle() override; 981 void updateFromStyle() override;
(...skipping 11 matching lines...) Expand all
992 993
993 virtual bool shouldComputeSizeAsReplaced() const { return isAtomicInlineLeve l() && !isInlineBlockOrInlineTable(); } 994 virtual bool shouldComputeSizeAsReplaced() const { return isAtomicInlineLeve l() && !isInlineBlockOrInlineTable(); }
994 995
995 LayoutObject* splitAnonymousBoxesAroundChild(LayoutObject* beforeChild); 996 LayoutObject* splitAnonymousBoxesAroundChild(LayoutObject* beforeChild);
996 997
997 virtual bool hitTestOverflowControl(HitTestResult&, const HitTestLocation&, const LayoutPoint&) { return false; } 998 virtual bool hitTestOverflowControl(HitTestResult&, const HitTestLocation&, const LayoutPoint&) { return false; }
998 virtual bool hitTestChildren(HitTestResult&, const HitTestLocation& location InContainer, const LayoutPoint& accumulatedOffset, HitTestAction); 999 virtual bool hitTestChildren(HitTestResult&, const HitTestLocation& location InContainer, const LayoutPoint& accumulatedOffset, HitTestAction);
999 void addLayerHitTestRects(LayerHitTestRects&, const PaintLayer* currentCompo sitedLayer, const LayoutPoint& layerOffset, const LayoutRect& containerRect) con st override; 1000 void addLayerHitTestRects(LayerHitTestRects&, const PaintLayer* currentCompo sitedLayer, const LayoutPoint& layerOffset, const LayoutRect& containerRect) con st override;
1000 void computeSelfHitTestRects(Vector<LayoutRect>&, const LayoutPoint& layerOf fset) const override; 1001 void computeSelfHitTestRects(Vector<LayoutRect>&, const LayoutPoint& layerOf fset) const override;
1001 1002
1002 PaintInvalidationReason getPaintInvalidationReason(const PaintInvalidationSt ate&,
1003 const LayoutRect& oldBounds, const LayoutPoint& oldPositionFromPaintInva lidationContainer,
1004 const LayoutRect& newBounds, const LayoutPoint& newPositionFromPaintInva lidationContainer) const override;
1005 void incrementallyInvalidatePaint(const LayoutBoxModelObject& paintInvalidat ionContainer, const LayoutRect& oldBounds, const LayoutRect& newBounds, const La youtPoint& positionFromPaintInvalidationContainer) override;
1006
1007 PaintInvalidationReason invalidatePaintIfNeeded(const PaintInvalidationState &) override; 1003 PaintInvalidationReason invalidatePaintIfNeeded(const PaintInvalidationState &) override;
1004 PaintInvalidationReason invalidatePaintIfNeeded(const PaintInvalidatorContex t&) const override;
1008 void invalidatePaintOfSubtreesIfNeeded(const PaintInvalidationState& childPa intInvalidationState) override; 1005 void invalidatePaintOfSubtreesIfNeeded(const PaintInvalidationState& childPa intInvalidationState) override;
1009 1006
1010 bool hasStretchedLogicalWidth() const; 1007 bool hasStretchedLogicalWidth() const;
1011 1008
1012 bool hasNonCompositedScrollbars() const final;
1013 void excludeScrollbars(LayoutRect&, OverlayScrollbarClipBehavior = IgnoreOve rlayScrollbarSize) const; 1009 void excludeScrollbars(LayoutRect&, OverlayScrollbarClipBehavior = IgnoreOve rlayScrollbarSize) const;
1014 1010
1015 LayoutUnit containingBlockLogicalWidthForPositioned(const LayoutBoxModelObje ct* containingBlock, bool checkForPerpendicularWritingMode = true) const; 1011 LayoutUnit containingBlockLogicalWidthForPositioned(const LayoutBoxModelObje ct* containingBlock, bool checkForPerpendicularWritingMode = true) const;
1016 LayoutUnit containingBlockLogicalHeightForPositioned(const LayoutBoxModelObj ect* containingBlock, bool checkForPerpendicularWritingMode = true) const; 1012 LayoutUnit containingBlockLogicalHeightForPositioned(const LayoutBoxModelObj ect* containingBlock, bool checkForPerpendicularWritingMode = true) const;
1017 1013
1018 static void computeBlockStaticDistance(Length& logicalTop, Length& logicalBo ttom, const LayoutBox* child, const LayoutBoxModelObject* containerBlock); 1014 static void computeBlockStaticDistance(Length& logicalTop, Length& logicalBo ttom, const LayoutBox* child, const LayoutBoxModelObject* containerBlock);
1019 static void computeInlineStaticDistance(Length& logicalLeft, Length& logical Right, const LayoutBox* child, const LayoutBoxModelObject* containerBlock, Layou tUnit containerLogicalWidth); 1015 static void computeInlineStaticDistance(Length& logicalLeft, Length& logical Right, const LayoutBox* child, const LayoutBoxModelObject* containerBlock, Layou tUnit containerLogicalWidth);
1020 static void computeLogicalLeftPositionedOffset(LayoutUnit& logicalLeftPos, c onst LayoutBox* child, LayoutUnit logicalWidthValue, const LayoutBoxModelObject* containerBlock, LayoutUnit containerLogicalWidth); 1016 static void computeLogicalLeftPositionedOffset(LayoutUnit& logicalLeftPos, c onst LayoutBox* child, LayoutUnit logicalWidthValue, const LayoutBoxModelObject* containerBlock, LayoutUnit containerLogicalWidth);
1021 static void computeLogicalTopPositionedOffset(LayoutUnit& logicalTopPos, con st LayoutBox* child, LayoutUnit logicalHeightValue, const LayoutBoxModelObject* containerBlock, LayoutUnit containerLogicalHeight); 1017 static void computeLogicalTopPositionedOffset(LayoutUnit& logicalTopPos, con st LayoutBox* child, LayoutUnit logicalHeightValue, const LayoutBoxModelObject* containerBlock, LayoutUnit containerLogicalHeight);
1022 1018
1023 private: 1019 private:
1024 bool mustInvalidateBackgroundOrBorderPaintOnHeightChange() const;
1025 bool mustInvalidateBackgroundOrBorderPaintOnWidthChange() const;
1026
1027 void invalidatePaintRectClippedByOldAndNewBounds(const LayoutBoxModelObject& paintInvalidationContainer, const LayoutRect&, const LayoutRect& oldBounds, con st LayoutRect& newBounds);
1028
1029 void updateShapeOutsideInfoAfterStyleChange(const ComputedStyle&, const Comp utedStyle* oldStyle); 1020 void updateShapeOutsideInfoAfterStyleChange(const ComputedStyle&, const Comp utedStyle* oldStyle);
1030 void updateGridPositionAfterStyleChange(const ComputedStyle*); 1021 void updateGridPositionAfterStyleChange(const ComputedStyle*);
1031 void updateScrollSnapMappingAfterStyleChange(const ComputedStyle*, const Com putedStyle* oldStyle); 1022 void updateScrollSnapMappingAfterStyleChange(const ComputedStyle*, const Com putedStyle* oldStyle);
1032 void clearScrollSnapMapping(); 1023 void clearScrollSnapMapping();
1033 void addScrollSnapMapping(); 1024 void addScrollSnapMapping();
1034 1025
1035 bool autoWidthShouldFitContent() const; 1026 bool autoWidthShouldFitContent() const;
1036 LayoutUnit shrinkToFitLogicalWidth(LayoutUnit availableLogicalWidth, LayoutU nit bordersPlusPadding) const; 1027 LayoutUnit shrinkToFitLogicalWidth(LayoutUnit availableLogicalWidth, LayoutU nit bordersPlusPadding) const;
1037 1028
1038 bool stretchesToViewportInQuirksMode() const; 1029 bool stretchesToViewportInQuirksMode() const;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
1071 // details about those widths. 1062 // details about those widths.
1072 virtual void computePreferredLogicalWidths() { clearPreferredLogicalWidthsDi rty(); } 1063 virtual void computePreferredLogicalWidths() { clearPreferredLogicalWidthsDi rty(); }
1073 1064
1074 LayoutBoxRareData& ensureRareData() 1065 LayoutBoxRareData& ensureRareData()
1075 { 1066 {
1076 if (!m_rareData) 1067 if (!m_rareData)
1077 m_rareData = wrapUnique(new LayoutBoxRareData()); 1068 m_rareData = wrapUnique(new LayoutBoxRareData());
1078 return *m_rareData.get(); 1069 return *m_rareData.get();
1079 } 1070 }
1080 1071
1081 bool needToSavePreviousBoxSizes();
1082 void savePreviousBoxSizesIfNeeded();
1083 LayoutSize computePreviousBorderBoxSize(const LayoutSize& previousBoundsSize ) const;
1084
1085 bool logicalHeightComputesAsNone(SizeType) const; 1072 bool logicalHeightComputesAsNone(SizeType) const;
1086 1073
1087 bool isBox() const = delete; // This will catch anyone doing an unnecessary check. 1074 bool isBox() const = delete; // This will catch anyone doing an unnecessary check.
1088 1075
1089 void frameRectChanged() 1076 void frameRectChanged()
1090 { 1077 {
1091 // The frame rect may change because of layout of other objects. 1078 // The frame rect may change because of layout of other objects.
1092 // Should check this object for paint invalidation. 1079 // Should check this object for paint invalidation.
1093 if (!needsLayout()) 1080 if (!needsLayout())
1094 setMayNeedPaintInvalidation(); 1081 setMayNeedPaintInvalidation();
1095 } 1082 }
1096 1083
1097 // Returns true if the box intersects the viewport visible to the user.
1098 bool intersectsVisibleViewport() const;
1099
1100 virtual bool isInSelfHitTestingPhase(HitTestAction hitTestAction) const { re turn hitTestAction == HitTestForeground; } 1084 virtual bool isInSelfHitTestingPhase(HitTestAction hitTestAction) const { re turn hitTestAction == HitTestForeground; }
1101 1085
1102 void updateBackgroundAttachmentFixedStatusAfterStyleChange(); 1086 void updateBackgroundAttachmentFixedStatusAfterStyleChange();
1103 1087
1104 // The CSS border box rect for this box. 1088 // The CSS border box rect for this box.
1105 // 1089 //
1106 // The rectangle is in this box's physical coordinates but with a 1090 // The rectangle is in this box's physical coordinates but with a
1107 // flipped block-flow direction (see the COORDINATE SYSTEMS section 1091 // flipped block-flow direction (see the COORDINATE SYSTEMS section
1108 // in LayoutBoxModelObject). The location is the distance from this 1092 // in LayoutBoxModelObject). The location is the distance from this
1109 // object's border edge to the container's border edge (which is not 1093 // object's border edge to the container's border edge (which is not
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
1233 || breakValue == BreakLeft 1217 || breakValue == BreakLeft
1234 || breakValue == BreakPage 1218 || breakValue == BreakPage
1235 || breakValue == BreakRecto 1219 || breakValue == BreakRecto
1236 || breakValue == BreakRight 1220 || breakValue == BreakRight
1237 || breakValue == BreakVerso; 1221 || breakValue == BreakVerso;
1238 } 1222 }
1239 1223
1240 } // namespace blink 1224 } // namespace blink
1241 1225
1242 #endif // LayoutBox_h 1226 #endif // LayoutBox_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutBlockFlowLine.cpp ('k') | third_party/WebKit/Source/core/layout/LayoutBox.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698