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

Side by Side Diff: Source/core/rendering/RenderLayer.h

Issue 22893055: Split computeScrollDimensions() out of RenderLayer (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Updated after Ian's comment. Created 7 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/rendering/RenderBox.cpp ('k') | Source/core/rendering/RenderLayer.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2003, 2009, 2012 Apple Inc. All rights reserved. 2 * Copyright (C) 2003, 2009, 2012 Apple Inc. All rights reserved.
3 * 3 *
4 * Portions are Copyright (C) 1998 Netscape Communications Corporation. 4 * Portions are Copyright (C) 1998 Netscape Communications Corporation.
5 * 5 *
6 * Other contributors: 6 * Other contributors:
7 * Robert O'Callahan <roc+@cs.cmu.edu> 7 * Robert O'Callahan <roc+@cs.cmu.edu>
8 * David Baron <dbaron@fas.harvard.edu> 8 * David Baron <dbaron@fas.harvard.edu>
9 * Christian Biesinger <cbiesinger@web.de> 9 * Christian Biesinger <cbiesinger@web.de>
10 * Randall Jesup <rjesup@wgate.com> 10 * Randall Jesup <rjesup@wgate.com>
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 LayoutRect rect() const { return LayoutRect(location(), size()); } 376 LayoutRect rect() const { return LayoutRect(location(), size()); }
377 377
378 // See comments on isPointInResizeControl. 378 // See comments on isPointInResizeControl.
379 IntRect resizerCornerRect(const IntRect& bounds, ResizerHitTestType) const; 379 IntRect resizerCornerRect(const IntRect& bounds, ResizerHitTestType) const;
380 380
381 int scrollWidth() const; 381 int scrollWidth() const;
382 int scrollHeight() const; 382 int scrollHeight() const;
383 383
384 void panScrollFromPoint(const IntPoint&); 384 void panScrollFromPoint(const IntPoint&);
385 385
386 enum ScrollOffsetClamping {
387 ScrollOffsetUnclamped,
388 ScrollOffsetClamped
389 };
390
391 // Scrolling methods for layers that can scroll their overflow. 386 // Scrolling methods for layers that can scroll their overflow.
392 void scrollByRecursively(const IntSize&, ScrollOffsetClamping = ScrollOffset Unclamped); 387 void scrollByRecursively(const IntSize&, ScrollOffsetClamping = ScrollOffset Unclamped);
393 void scrollToOffset(const IntSize&, ScrollOffsetClamping = ScrollOffsetUncla mped); 388 void scrollToOffset(const IntSize&, ScrollOffsetClamping = ScrollOffsetUncla mped);
394 void scrollToXOffset(int x, ScrollOffsetClamping clamp = ScrollOffsetUnclamp ed) { scrollToOffset(IntSize(x, scrollYOffset()), clamp); } 389 void scrollToXOffset(int x, ScrollOffsetClamping clamp = ScrollOffsetUnclamp ed) { scrollToOffset(IntSize(x, scrollYOffset()), clamp); }
395 void scrollToYOffset(int y, ScrollOffsetClamping clamp = ScrollOffsetUnclamp ed) { scrollToOffset(IntSize(scrollXOffset(), y), clamp); } 390 void scrollToYOffset(int y, ScrollOffsetClamping clamp = ScrollOffsetUnclamp ed) { scrollToOffset(IntSize(scrollXOffset(), y), clamp); }
396
397 void scrollRectToVisible(const LayoutRect&, const ScrollAlignment& alignX, c onst ScrollAlignment& alignY); 391 void scrollRectToVisible(const LayoutRect&, const ScrollAlignment& alignX, c onst ScrollAlignment& alignY);
398 392
399 LayoutRect getRectToExpose(const LayoutRect& visibleRect, const LayoutRect& exposeRect, const ScrollAlignment& alignX, const ScrollAlignment& alignY); 393 LayoutRect getRectToExpose(const LayoutRect& visibleRect, const LayoutRect& exposeRect, const ScrollAlignment& alignX, const ScrollAlignment& alignY);
400 394
401 bool hasHorizontalScrollbar() const { return horizontalScrollbar(); } 395 bool hasHorizontalScrollbar() const { return horizontalScrollbar(); }
402 bool hasVerticalScrollbar() const { return verticalScrollbar(); } 396 bool hasVerticalScrollbar() const { return verticalScrollbar(); }
403 397
404 int verticalScrollbarWidth(OverlayScrollbarSizeRelevancy = IgnoreOverlayScro llbarSize) const; 398 int verticalScrollbarWidth(OverlayScrollbarSizeRelevancy = IgnoreOverlayScro llbarSize) const;
405 int horizontalScrollbarHeight(OverlayScrollbarSizeRelevancy = IgnoreOverlayS crollbarSize) const; 399 int horizontalScrollbarHeight(OverlayScrollbarSizeRelevancy = IgnoreOverlayS crollbarSize) const;
406 400
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after
879 enum UpdateLayerPositionsAfterScrollFlag { 873 enum UpdateLayerPositionsAfterScrollFlag {
880 NoFlag = 0, 874 NoFlag = 0,
881 IsOverflowScroll = 1 << 0, 875 IsOverflowScroll = 1 << 0,
882 HasSeenViewportConstrainedAncestor = 1 << 1, 876 HasSeenViewportConstrainedAncestor = 1 << 1,
883 HasSeenAncestorWithOverflowClip = 1 << 2, 877 HasSeenAncestorWithOverflowClip = 1 << 2,
884 HasChangedAncestor = 1 << 3 878 HasChangedAncestor = 1 << 3
885 }; 879 };
886 typedef unsigned UpdateLayerPositionsAfterScrollFlags; 880 typedef unsigned UpdateLayerPositionsAfterScrollFlags;
887 void updateLayerPositionsAfterScroll(RenderGeometryMap*, UpdateLayerPosition sAfterScrollFlags = NoFlag); 881 void updateLayerPositionsAfterScroll(RenderGeometryMap*, UpdateLayerPosition sAfterScrollFlags = NoFlag);
888 882
889 IntSize clampScrollOffset(const IntSize&) const;
890
891 void setNextSibling(RenderLayer* next) { m_next = next; } 883 void setNextSibling(RenderLayer* next) { m_next = next; }
892 void setPreviousSibling(RenderLayer* prev) { m_previous = prev; } 884 void setPreviousSibling(RenderLayer* prev) { m_previous = prev; }
893 void setParent(RenderLayer* parent); 885 void setParent(RenderLayer* parent);
894 void setFirstChild(RenderLayer* first) { m_first = first; } 886 void setFirstChild(RenderLayer* first) { m_first = first; }
895 void setLastChild(RenderLayer* last) { m_last = last; } 887 void setLastChild(RenderLayer* last) { m_last = last; }
896 888
897 LayoutPoint renderBoxLocation() const { return renderer()->isBox() ? toRende rBox(renderer())->location() : LayoutPoint(); } 889 LayoutPoint renderBoxLocation() const { return renderer()->isBox() ? toRende rBox(renderer())->location() : LayoutPoint(); }
898 890
899 // layerToForceAsStackingContainer allows us to build pre-promotion and 891 // layerToForceAsStackingContainer allows us to build pre-promotion and
900 // post-promotion layer lists, by allowing us to treat a layer as if it is a 892 // post-promotion layer lists, by allowing us to treat a layer as if it is a
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
970 const LayoutPoint& translationOffset = LayoutPoint() ) const; 962 const LayoutPoint& translationOffset = LayoutPoint() ) const;
971 963
972 bool hitTestContents(const HitTestRequest&, HitTestResult&, const LayoutRect & layerBounds, const HitTestLocation&, HitTestFilter) const; 964 bool hitTestContents(const HitTestRequest&, HitTestResult&, const LayoutRect & layerBounds, const HitTestLocation&, HitTestFilter) const;
973 bool hitTestContentsForFragments(const LayerFragments&, const HitTestRequest &, HitTestResult&, const HitTestLocation&, HitTestFilter, bool& insideClipRect) const; 965 bool hitTestContentsForFragments(const LayerFragments&, const HitTestRequest &, HitTestResult&, const HitTestLocation&, HitTestFilter, bool& insideClipRect) const;
974 bool hitTestResizerInFragments(const LayerFragments&, const HitTestLocation& ) const; 966 bool hitTestResizerInFragments(const LayerFragments&, const HitTestLocation& ) const;
975 RenderLayer* hitTestTransformedLayerInFragments(RenderLayer* rootLayer, Rend erLayer* containerLayer, const HitTestRequest&, HitTestResult&, 967 RenderLayer* hitTestTransformedLayerInFragments(RenderLayer* rootLayer, Rend erLayer* containerLayer, const HitTestRequest&, HitTestResult&,
976 const LayoutRect& hitTestRect, const HitTestLocation&, const HitTestingT ransformState* = 0, double* zOffset = 0); 968 const LayoutRect& hitTestRect, const HitTestLocation&, const HitTestingT ransformState* = 0, double* zOffset = 0);
977 969
978 bool listBackgroundIsKnownToBeOpaqueInRect(const Vector<RenderLayer*>*, cons t LayoutRect&) const; 970 bool listBackgroundIsKnownToBeOpaqueInRect(const Vector<RenderLayer*>*, cons t LayoutRect&) const;
979 971
980 void computeScrollDimensions();
981 bool hasHorizontalOverflow() const;
982 bool hasVerticalOverflow() const;
983 bool hasScrollableHorizontalOverflow() const;
984 bool hasScrollableVerticalOverflow() const;
985
986 bool shouldBeNormalFlowOnly() const; 972 bool shouldBeNormalFlowOnly() const;
987 bool shouldBeNormalFlowOnlyIgnoringCompositedScrolling() const; 973 bool shouldBeNormalFlowOnlyIgnoringCompositedScrolling() const;
988 974
989 bool shouldBeSelfPaintingLayer() const; 975 bool shouldBeSelfPaintingLayer() const;
990 976
991 // Start of ScrollableArea interface 977 // Start of ScrollableArea interface
992 // To be moved to RenderLayerScrollableArea 978 // To be moved to RenderLayerScrollableArea
993 ScrollableArea* enclosingScrollableArea() const; 979 ScrollableArea* enclosingScrollableArea() const;
994 980
995 void updateNeedsCompositedScrolling(); 981 void updateNeedsCompositedScrolling();
(...skipping 19 matching lines...) Expand all
1015 void invalidateScrollbarRect(Scrollbar*, const IntRect&); 1001 void invalidateScrollbarRect(Scrollbar*, const IntRect&);
1016 void invalidateScrollCornerRect(const IntRect&); 1002 void invalidateScrollCornerRect(const IntRect&);
1017 bool isActive() const; 1003 bool isActive() const;
1018 bool isScrollCornerVisible() const; 1004 bool isScrollCornerVisible() const;
1019 IntRect scrollCornerRect() const; 1005 IntRect scrollCornerRect() const;
1020 IntRect convertFromScrollbarToContainingView(const Scrollbar*, const IntRect &) const; 1006 IntRect convertFromScrollbarToContainingView(const Scrollbar*, const IntRect &) const;
1021 IntRect convertFromContainingViewToScrollbar(const Scrollbar*, const IntRect &) const; 1007 IntRect convertFromContainingViewToScrollbar(const Scrollbar*, const IntRect &) const;
1022 IntPoint convertFromScrollbarToContainingView(const Scrollbar*, const IntPoi nt&) const; 1008 IntPoint convertFromScrollbarToContainingView(const Scrollbar*, const IntPoi nt&) const;
1023 IntPoint convertFromContainingViewToScrollbar(const Scrollbar*, const IntPoi nt&) const; 1009 IntPoint convertFromContainingViewToScrollbar(const Scrollbar*, const IntPoi nt&) const;
1024 int scrollSize(ScrollbarOrientation) const; 1010 int scrollSize(ScrollbarOrientation) const;
1025 void setScrollOffset(const IntPoint&);
1026 IntPoint minimumScrollPosition() const;
1027 IntPoint maximumScrollPosition() const;
1028 int visibleHeight() const; 1011 int visibleHeight() const;
1029 int visibleWidth() const; 1012 int visibleWidth() const;
1030 IntSize contentsSize() const;
1031 IntSize overhangAmount() const; 1013 IntSize overhangAmount() const;
1032 IntPoint lastKnownMousePosition() const; 1014 IntPoint lastKnownMousePosition() const;
1033 bool shouldSuspendScrollAnimations() const; 1015 bool shouldSuspendScrollAnimations() const;
1034 bool scrollbarsCanBeActive() const; 1016 bool scrollbarsCanBeActive() const;
1035 IntRect scrollableAreaBoundingBox() const; 1017 IntRect scrollableAreaBoundingBox() const;
1036 bool userInputScrollable(ScrollbarOrientation) const; 1018 bool userInputScrollable(ScrollbarOrientation) const;
1037 int pageStep(ScrollbarOrientation) const; 1019 int pageStep(ScrollbarOrientation) const;
1038 // End of ScrollableArea interface 1020 // End of ScrollableArea interface
1039 1021
1040 // FIXME: This should be removed once we have transitioned to RenderLayerScr ollableArea. 1022 // FIXME: This should be removed once we have transitioned to RenderLayerScr ollableArea.
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
1113 1095
1114 LayoutUnit verticalScrollbarStart(int minX, int maxX) const; 1096 LayoutUnit verticalScrollbarStart(int minX, int maxX) const;
1115 LayoutUnit horizontalScrollbarStart(int minX) const; 1097 LayoutUnit horizontalScrollbarStart(int minX) const;
1116 1098
1117 bool overflowControlsIntersectRect(const IntRect& localRect) const; 1099 bool overflowControlsIntersectRect(const IntRect& localRect) const;
1118 1100
1119 protected: 1101 protected:
1120 // Keeps track of whether the layer is currently resizing, so events can cau se resizing to start and stop. 1102 // Keeps track of whether the layer is currently resizing, so events can cau se resizing to start and stop.
1121 unsigned m_inResizeMode : 1; 1103 unsigned m_inResizeMode : 1;
1122 1104
1123 unsigned m_scrollDimensionsDirty : 1;
1124 unsigned m_zOrderListsDirty : 1; 1105 unsigned m_zOrderListsDirty : 1;
1125 unsigned m_normalFlowListDirty: 1; 1106 unsigned m_normalFlowListDirty: 1;
1126 unsigned m_isNormalFlowOnly : 1; 1107 unsigned m_isNormalFlowOnly : 1;
1127 1108
1128 unsigned m_isSelfPaintingLayer : 1; 1109 unsigned m_isSelfPaintingLayer : 1;
1129 1110
1130 // If have no self-painting descendants, we don't have to walk our children during painting. This can lead to 1111 // If have no self-painting descendants, we don't have to walk our children during painting. This can lead to
1131 // significant savings, especially if the tree has lots of non-self-painting layers grouped together (e.g. table cells). 1112 // significant savings, especially if the tree has lots of non-self-painting layers grouped together (e.g. table cells).
1132 unsigned m_hasSelfPaintingLayerDescendant : 1; 1113 unsigned m_hasSelfPaintingLayerDescendant : 1;
1133 unsigned m_hasSelfPaintingLayerDescendantDirty : 1; 1114 unsigned m_hasSelfPaintingLayerDescendantDirty : 1;
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
1199 1180
1200 // Our current relative position offset. 1181 // Our current relative position offset.
1201 LayoutSize m_offsetForInFlowPosition; 1182 LayoutSize m_offsetForInFlowPosition;
1202 1183
1203 // Our (x,y) coordinates are in our parent layer's coordinate space. 1184 // Our (x,y) coordinates are in our parent layer's coordinate space.
1204 LayoutPoint m_topLeft; 1185 LayoutPoint m_topLeft;
1205 1186
1206 // The layer's width/height 1187 // The layer's width/height
1207 IntSize m_layerSize; 1188 IntSize m_layerSize;
1208 1189
1209 // The width/height of our scrolled area.
1210 LayoutRect m_overflowRect;
1211
1212 // For layers with overflow, we have a pair of scrollbars. 1190 // For layers with overflow, we have a pair of scrollbars.
1213 RefPtr<Scrollbar> m_hBar; 1191 RefPtr<Scrollbar> m_hBar;
1214 RefPtr<Scrollbar> m_vBar; 1192 RefPtr<Scrollbar> m_vBar;
1215 1193
1216 // For layers that establish stacking contexts, m_posZOrderList holds a sort ed list of all the 1194 // For layers that establish stacking contexts, m_posZOrderList holds a sort ed list of all the
1217 // descendant layers within the stacking context that have z-indices of 0 or greater 1195 // descendant layers within the stacking context that have z-indices of 0 or greater
1218 // (auto will count as 0). m_negZOrderList holds descendants within our sta cking context with negative 1196 // (auto will count as 0). m_negZOrderList holds descendants within our sta cking context with negative
1219 // z-indices. 1197 // z-indices.
1220 OwnPtr<Vector<RenderLayer*> > m_posZOrderList; 1198 OwnPtr<Vector<RenderLayer*> > m_posZOrderList;
1221 OwnPtr<Vector<RenderLayer*> > m_negZOrderList; 1199 OwnPtr<Vector<RenderLayer*> > m_negZOrderList;
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
1320 1298
1321 } // namespace WebCore 1299 } // namespace WebCore
1322 1300
1323 #ifndef NDEBUG 1301 #ifndef NDEBUG
1324 // Outside the WebCore namespace for ease of invocation from gdb. 1302 // Outside the WebCore namespace for ease of invocation from gdb.
1325 void showLayerTree(const WebCore::RenderLayer*); 1303 void showLayerTree(const WebCore::RenderLayer*);
1326 void showLayerTree(const WebCore::RenderObject*); 1304 void showLayerTree(const WebCore::RenderObject*);
1327 #endif 1305 #endif
1328 1306
1329 #endif // RenderLayer_h 1307 #endif // RenderLayer_h
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderBox.cpp ('k') | Source/core/rendering/RenderLayer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698