OLD | NEW |
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 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
449 void scrollToYOffset(int y, ScrollOffsetClamping clamp = ScrollOffsetUnclamp
ed) { scrollToOffset(IntSize(scrollXOffset(), y), clamp); } | 449 void scrollToYOffset(int y, ScrollOffsetClamping clamp = ScrollOffsetUnclamp
ed) { scrollToOffset(IntSize(scrollXOffset(), y), clamp); } |
450 | 450 |
451 int scrollXOffset() const { return m_scrollOffset.width() + scrollOrigin().x
(); } | 451 int scrollXOffset() const { return m_scrollOffset.width() + scrollOrigin().x
(); } |
452 int scrollYOffset() const { return m_scrollOffset.height() + scrollOrigin().
y(); } | 452 int scrollYOffset() const { return m_scrollOffset.height() + scrollOrigin().
y(); } |
453 IntSize adjustedScrollOffset() const { return IntSize(scrollXOffset(), scrol
lYOffset()); } | 453 IntSize adjustedScrollOffset() const { return IntSize(scrollXOffset(), scrol
lYOffset()); } |
454 | 454 |
455 void scrollRectToVisible(const LayoutRect&, const ScrollAlignment& alignX, c
onst ScrollAlignment& alignY); | 455 void scrollRectToVisible(const LayoutRect&, const ScrollAlignment& alignX, c
onst ScrollAlignment& alignY); |
456 | 456 |
457 LayoutRect getRectToExpose(const LayoutRect& visibleRect, const LayoutRect&
exposeRect, const ScrollAlignment& alignX, const ScrollAlignment& alignY); | 457 LayoutRect getRectToExpose(const LayoutRect& visibleRect, const LayoutRect&
exposeRect, const ScrollAlignment& alignX, const ScrollAlignment& alignY); |
458 | 458 |
459 bool scrollsOverflow() const; | |
460 bool hasScrollbars() const { return m_hBar || m_vBar; } | |
461 void setHasHorizontalScrollbar(bool); | |
462 void setHasVerticalScrollbar(bool); | |
463 | |
464 PassRefPtr<Scrollbar> createScrollbar(ScrollbarOrientation); | |
465 void destroyScrollbar(ScrollbarOrientation); | |
466 | |
467 bool hasHorizontalScrollbar() const { return horizontalScrollbar(); } | 459 bool hasHorizontalScrollbar() const { return horizontalScrollbar(); } |
468 bool hasVerticalScrollbar() const { return verticalScrollbar(); } | 460 bool hasVerticalScrollbar() const { return verticalScrollbar(); } |
469 | 461 |
470 // ScrollableArea overrides | 462 // ScrollableArea overrides |
471 virtual Scrollbar* horizontalScrollbar() const { return m_hBar.get(); } | 463 virtual Scrollbar* horizontalScrollbar() const { return m_hBar.get(); } |
472 virtual Scrollbar* verticalScrollbar() const { return m_vBar.get(); } | 464 virtual Scrollbar* verticalScrollbar() const { return m_vBar.get(); } |
473 virtual ScrollableArea* enclosingScrollableArea() const; | 465 virtual ScrollableArea* enclosingScrollableArea() const; |
474 | 466 |
475 int verticalScrollbarWidth(OverlayScrollbarSizeRelevancy = IgnoreOverlayScro
llbarSize) const; | 467 int verticalScrollbarWidth(OverlayScrollbarSizeRelevancy = IgnoreOverlayScro
llbarSize) const; |
476 int horizontalScrollbarHeight(OverlayScrollbarSizeRelevancy = IgnoreOverlayS
crollbarSize) const; | 468 int horizontalScrollbarHeight(OverlayScrollbarSizeRelevancy = IgnoreOverlayS
crollbarSize) const; |
477 | 469 |
478 bool hasOverflowControls() const; | |
479 // isPointInResizeControl() is used for testing if a pointer/touch position
is in the resize control | 470 // isPointInResizeControl() is used for testing if a pointer/touch position
is in the resize control |
480 // area. | 471 // area. |
481 bool isPointInResizeControl(const IntPoint& absolutePoint, ResizerHitTestTyp
e resizerHitTestType) const; | 472 bool isPointInResizeControl(const IntPoint& absolutePoint, ResizerHitTestTyp
e resizerHitTestType) const; |
482 bool hitTestOverflowControls(HitTestResult&, const IntPoint& localPoint); | 473 bool hitTestOverflowControls(HitTestResult&, const IntPoint& localPoint); |
483 IntSize offsetFromResizeCorner(const IntPoint& absolutePoint) const; | 474 IntSize offsetFromResizeCorner(const IntPoint& absolutePoint) const; |
484 | 475 |
485 void paintOverflowControls(GraphicsContext*, const IntPoint&, const IntRect&
damageRect, bool paintingOverlayControls = false); | 476 void paintOverflowControls(GraphicsContext*, const IntPoint&, const IntRect&
damageRect, bool paintingOverlayControls = false); |
486 void paintScrollCorner(GraphicsContext*, const IntPoint&, const IntRect& dam
ageRect); | 477 void paintScrollCorner(GraphicsContext*, const IntPoint&, const IntRect& dam
ageRect); |
487 void paintResizer(GraphicsContext*, const IntPoint&, const IntRect& damageRe
ct); | 478 void paintResizer(GraphicsContext*, const IntPoint&, const IntRect& damageRe
ct); |
488 | 479 |
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
874 | 865 |
875 void setForceNeedsCompositedScrolling(ForceNeedsCompositedScrollingMode); | 866 void setForceNeedsCompositedScrolling(ForceNeedsCompositedScrollingMode); |
876 | 867 |
877 private: | 868 private: |
878 enum CollectLayersBehavior { | 869 enum CollectLayersBehavior { |
879 ForceLayerToStackingContainer, | 870 ForceLayerToStackingContainer, |
880 OverflowScrollCanBeStackingContainers, | 871 OverflowScrollCanBeStackingContainers, |
881 OnlyStackingContextsCanBeStackingContainers | 872 OnlyStackingContextsCanBeStackingContainers |
882 }; | 873 }; |
883 | 874 |
| 875 void setHasHorizontalScrollbar(bool); |
| 876 void setHasVerticalScrollbar(bool); |
| 877 |
| 878 PassRefPtr<Scrollbar> createScrollbar(ScrollbarOrientation); |
| 879 void destroyScrollbar(ScrollbarOrientation); |
| 880 |
| 881 bool hasOverflowControls() const; |
| 882 |
884 void updateZOrderLists(); | 883 void updateZOrderLists(); |
885 void rebuildZOrderLists(); | 884 void rebuildZOrderLists(); |
886 // See the comment for collectLayers for information about the layerToForceA
sStackingContainer parameter. | 885 // See the comment for collectLayers for information about the layerToForceA
sStackingContainer parameter. |
887 void rebuildZOrderLists(OwnPtr<Vector<RenderLayer*> >&, OwnPtr<Vector<Render
Layer*> >&, const RenderLayer* layerToForceAsStackingContainer = 0, CollectLayer
sBehavior = OverflowScrollCanBeStackingContainers); | 886 void rebuildZOrderLists(OwnPtr<Vector<RenderLayer*> >&, OwnPtr<Vector<Render
Layer*> >&, const RenderLayer* layerToForceAsStackingContainer = 0, CollectLayer
sBehavior = OverflowScrollCanBeStackingContainers); |
888 void clearZOrderLists(); | 887 void clearZOrderLists(); |
889 | 888 |
890 void updateNormalFlowList(); | 889 void updateNormalFlowList(); |
891 | 890 |
892 bool isStackingContext(const RenderStyle* style) const { return !style->hasA
utoZIndex() || isRootLayer(); } | 891 bool isStackingContext(const RenderStyle* style) const { return !style->hasA
utoZIndex() || isRootLayer(); } |
893 | 892 |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1047 bool hasHorizontalOverflow() const; | 1046 bool hasHorizontalOverflow() const; |
1048 bool hasVerticalOverflow() const; | 1047 bool hasVerticalOverflow() const; |
1049 bool hasScrollableHorizontalOverflow() const; | 1048 bool hasScrollableHorizontalOverflow() const; |
1050 bool hasScrollableVerticalOverflow() const; | 1049 bool hasScrollableVerticalOverflow() const; |
1051 | 1050 |
1052 bool shouldBeNormalFlowOnly() const; | 1051 bool shouldBeNormalFlowOnly() const; |
1053 bool shouldBeNormalFlowOnlyIgnoringCompositedScrolling() const; | 1052 bool shouldBeNormalFlowOnlyIgnoringCompositedScrolling() const; |
1054 | 1053 |
1055 bool shouldBeSelfPaintingLayer() const; | 1054 bool shouldBeSelfPaintingLayer() const; |
1056 | 1055 |
1057 int scrollPosition(Scrollbar*) const; | |
1058 | |
1059 // ScrollableArea interface | 1056 // ScrollableArea interface |
1060 virtual void invalidateScrollbarRect(Scrollbar*, const IntRect&); | 1057 virtual void invalidateScrollbarRect(Scrollbar*, const IntRect&); |
1061 virtual void invalidateScrollCornerRect(const IntRect&); | 1058 virtual void invalidateScrollCornerRect(const IntRect&); |
1062 virtual bool isActive() const; | 1059 virtual bool isActive() const; |
1063 virtual bool isScrollCornerVisible() const; | 1060 virtual bool isScrollCornerVisible() const; |
1064 virtual IntRect scrollCornerRect() const; | 1061 virtual IntRect scrollCornerRect() const; |
1065 virtual IntRect convertFromScrollbarToContainingView(const Scrollbar*, const
IntRect&) const; | 1062 virtual IntRect convertFromScrollbarToContainingView(const Scrollbar*, const
IntRect&) const; |
1066 virtual IntRect convertFromContainingViewToScrollbar(const Scrollbar*, const
IntRect&) const; | 1063 virtual IntRect convertFromContainingViewToScrollbar(const Scrollbar*, const
IntRect&) const; |
1067 virtual IntPoint convertFromScrollbarToContainingView(const Scrollbar*, cons
t IntPoint&) const; | 1064 virtual IntPoint convertFromScrollbarToContainingView(const Scrollbar*, cons
t IntPoint&) const; |
1068 virtual IntPoint convertFromContainingViewToScrollbar(const Scrollbar*, cons
t IntPoint&) const; | 1065 virtual IntPoint convertFromContainingViewToScrollbar(const Scrollbar*, cons
t IntPoint&) const; |
1069 virtual int scrollSize(ScrollbarOrientation) const; | 1066 virtual int scrollSize(ScrollbarOrientation) const; |
1070 virtual void setScrollOffset(const IntPoint&); | 1067 virtual void setScrollOffset(const IntPoint&); |
1071 virtual IntPoint scrollPosition() const; | 1068 virtual IntPoint scrollPosition() const; |
1072 virtual IntPoint minimumScrollPosition() const; | 1069 virtual IntPoint minimumScrollPosition() const; |
1073 virtual IntPoint maximumScrollPosition() const; | 1070 virtual IntPoint maximumScrollPosition() const; |
1074 virtual IntRect visibleContentRect(VisibleContentRectIncludesScrollbars) con
st; | 1071 virtual IntRect visibleContentRect(VisibleContentRectIncludesScrollbars) con
st; |
1075 virtual int visibleHeight() const; | 1072 virtual int visibleHeight() const; |
1076 virtual int visibleWidth() const; | 1073 virtual int visibleWidth() const; |
1077 virtual IntSize contentsSize() const; | 1074 virtual IntSize contentsSize() const; |
1078 virtual IntSize overhangAmount() const; | 1075 virtual IntSize overhangAmount() const; |
1079 virtual IntPoint lastKnownMousePosition() const; | 1076 virtual IntPoint lastKnownMousePosition() const; |
1080 virtual bool shouldSuspendScrollAnimations() const; | 1077 virtual bool shouldSuspendScrollAnimations() const; |
1081 virtual bool scrollbarsCanBeActive() const; | 1078 virtual bool scrollbarsCanBeActive() const; |
1082 virtual IntRect scrollableAreaBoundingBox() const OVERRIDE; | 1079 virtual IntRect scrollableAreaBoundingBox() const OVERRIDE; |
| 1080 virtual bool userInputScrollable(ScrollbarOrientation) const OVERRIDE; |
| 1081 virtual int pageStep(ScrollbarOrientation) const OVERRIDE; |
1083 | 1082 |
1084 // Rectangle encompassing the scroll corner and resizer rect. | 1083 // Rectangle encompassing the scroll corner and resizer rect. |
1085 IntRect scrollCornerAndResizerRect() const; | 1084 IntRect scrollCornerAndResizerRect() const; |
1086 | 1085 |
1087 void updateCompositingLayersAfterScroll(); | 1086 void updateCompositingLayersAfterScroll(); |
1088 | 1087 |
1089 IntSize scrollbarOffset(const Scrollbar*) const; | 1088 IntSize scrollbarOffset(const Scrollbar*) const; |
1090 | 1089 |
1091 void updateResizerAreaSet(); | 1090 void updateResizerAreaSet(); |
1092 void updateScrollableAreaSet(bool hasOverflow); | 1091 void updateScrollableAreaSet(bool hasOverflow); |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1144 // Returns true if z ordering would not change if this layer were a stacking
container. | 1143 // Returns true if z ordering would not change if this layer were a stacking
container. |
1145 bool canBeStackingContainer() const; | 1144 bool canBeStackingContainer() const; |
1146 | 1145 |
1147 friend class RenderLayerBacking; | 1146 friend class RenderLayerBacking; |
1148 friend class RenderLayerCompositor; | 1147 friend class RenderLayerCompositor; |
1149 friend class RenderLayerModelObject; | 1148 friend class RenderLayerModelObject; |
1150 | 1149 |
1151 // Only safe to call from RenderBoxModelObject::destroyLayer(RenderArena*) | 1150 // Only safe to call from RenderBoxModelObject::destroyLayer(RenderArena*) |
1152 void destroy(RenderArena*); | 1151 void destroy(RenderArena*); |
1153 | 1152 |
1154 LayoutUnit overflowTop() const; | |
1155 LayoutUnit overflowBottom() const; | |
1156 LayoutUnit overflowLeft() const; | |
1157 LayoutUnit overflowRight() const; | |
1158 | |
1159 IntRect rectForHorizontalScrollbar(const IntRect& borderBoxRect) const; | 1153 IntRect rectForHorizontalScrollbar(const IntRect& borderBoxRect) const; |
1160 IntRect rectForVerticalScrollbar(const IntRect& borderBoxRect) const; | 1154 IntRect rectForVerticalScrollbar(const IntRect& borderBoxRect) const; |
1161 | 1155 |
1162 LayoutUnit verticalScrollbarStart(int minX, int maxX) const; | 1156 LayoutUnit verticalScrollbarStart(int minX, int maxX) const; |
1163 LayoutUnit horizontalScrollbarStart(int minX) const; | 1157 LayoutUnit horizontalScrollbarStart(int minX) const; |
1164 | 1158 |
1165 bool overflowControlsIntersectRect(const IntRect& localRect) const; | 1159 bool overflowControlsIntersectRect(const IntRect& localRect) const; |
1166 | 1160 |
1167 protected: | 1161 protected: |
1168 // The bitfields are up here so they will fall into the padding from Scrolla
bleArea on 64-bit. | 1162 // The bitfields are up here so they will fall into the padding from Scrolla
bleArea on 64-bit. |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1251 // Our (x,y) coordinates are in our parent layer's coordinate space. | 1245 // Our (x,y) coordinates are in our parent layer's coordinate space. |
1252 LayoutPoint m_topLeft; | 1246 LayoutPoint m_topLeft; |
1253 | 1247 |
1254 // The layer's width/height | 1248 // The layer's width/height |
1255 IntSize m_layerSize; | 1249 IntSize m_layerSize; |
1256 | 1250 |
1257 // This is the (scroll) offset from scrollOrigin(). | 1251 // This is the (scroll) offset from scrollOrigin(). |
1258 IntSize m_scrollOffset; | 1252 IntSize m_scrollOffset; |
1259 | 1253 |
1260 // The width/height of our scrolled area. | 1254 // The width/height of our scrolled area. |
1261 LayoutSize m_scrollSize; | 1255 LayoutRect m_overflowRect; |
1262 | 1256 |
1263 // For layers with overflow, we have a pair of scrollbars. | 1257 // For layers with overflow, we have a pair of scrollbars. |
1264 RefPtr<Scrollbar> m_hBar; | 1258 RefPtr<Scrollbar> m_hBar; |
1265 RefPtr<Scrollbar> m_vBar; | 1259 RefPtr<Scrollbar> m_vBar; |
1266 | 1260 |
1267 // For layers that establish stacking contexts, m_posZOrderList holds a sort
ed list of all the | 1261 // For layers that establish stacking contexts, m_posZOrderList holds a sort
ed list of all the |
1268 // descendant layers within the stacking context that have z-indices of 0 or
greater | 1262 // descendant layers within the stacking context that have z-indices of 0 or
greater |
1269 // (auto will count as 0). m_negZOrderList holds descendants within our sta
cking context with negative | 1263 // (auto will count as 0). m_negZOrderList holds descendants within our sta
cking context with negative |
1270 // z-indices. | 1264 // z-indices. |
1271 OwnPtr<Vector<RenderLayer*> > m_posZOrderList; | 1265 OwnPtr<Vector<RenderLayer*> > m_posZOrderList; |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1370 | 1364 |
1371 } // namespace WebCore | 1365 } // namespace WebCore |
1372 | 1366 |
1373 #ifndef NDEBUG | 1367 #ifndef NDEBUG |
1374 // Outside the WebCore namespace for ease of invocation from gdb. | 1368 // Outside the WebCore namespace for ease of invocation from gdb. |
1375 void showLayerTree(const WebCore::RenderLayer*); | 1369 void showLayerTree(const WebCore::RenderLayer*); |
1376 void showLayerTree(const WebCore::RenderObject*); | 1370 void showLayerTree(const WebCore::RenderObject*); |
1377 #endif | 1371 #endif |
1378 | 1372 |
1379 #endif // RenderLayer_h | 1373 #endif // RenderLayer_h |
OLD | NEW |