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 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
400 void scrollToYOffset(int y, ScrollOffsetClamping clamp = ScrollOffsetUnclamp
ed) { scrollToOffset(IntSize(scrollXOffset(), y), clamp); } | 400 void scrollToYOffset(int y, ScrollOffsetClamping clamp = ScrollOffsetUnclamp
ed) { scrollToOffset(IntSize(scrollXOffset(), y), clamp); } |
401 | 401 |
402 int scrollXOffset() const { return m_scrollOffset.width() + scrollOrigin().x
(); } | 402 int scrollXOffset() const { return m_scrollOffset.width() + scrollOrigin().x
(); } |
403 int scrollYOffset() const { return m_scrollOffset.height() + scrollOrigin().
y(); } | 403 int scrollYOffset() const { return m_scrollOffset.height() + scrollOrigin().
y(); } |
404 IntSize adjustedScrollOffset() const { return IntSize(scrollXOffset(), scrol
lYOffset()); } | 404 IntSize adjustedScrollOffset() const { return IntSize(scrollXOffset(), scrol
lYOffset()); } |
405 | 405 |
406 void scrollRectToVisible(const LayoutRect&, const ScrollAlignment& alignX, c
onst ScrollAlignment& alignY); | 406 void scrollRectToVisible(const LayoutRect&, const ScrollAlignment& alignX, c
onst ScrollAlignment& alignY); |
407 | 407 |
408 LayoutRect getRectToExpose(const LayoutRect& visibleRect, const LayoutRect&
exposeRect, const ScrollAlignment& alignX, const ScrollAlignment& alignY); | 408 LayoutRect getRectToExpose(const LayoutRect& visibleRect, const LayoutRect&
exposeRect, const ScrollAlignment& alignX, const ScrollAlignment& alignY); |
409 | 409 |
410 bool scrollsOverflow() const; | |
411 bool hasScrollbars() const { return m_hBar || m_vBar; } | |
412 void setHasHorizontalScrollbar(bool); | |
413 void setHasVerticalScrollbar(bool); | |
414 | |
415 PassRefPtr<Scrollbar> createScrollbar(ScrollbarOrientation); | |
416 void destroyScrollbar(ScrollbarOrientation); | |
417 | |
418 bool hasHorizontalScrollbar() const { return horizontalScrollbar(); } | 410 bool hasHorizontalScrollbar() const { return horizontalScrollbar(); } |
419 bool hasVerticalScrollbar() const { return verticalScrollbar(); } | 411 bool hasVerticalScrollbar() const { return verticalScrollbar(); } |
420 | 412 |
421 // ScrollableArea overrides | 413 // ScrollableArea overrides |
422 virtual Scrollbar* horizontalScrollbar() const { return m_hBar.get(); } | 414 virtual Scrollbar* horizontalScrollbar() const { return m_hBar.get(); } |
423 virtual Scrollbar* verticalScrollbar() const { return m_vBar.get(); } | 415 virtual Scrollbar* verticalScrollbar() const { return m_vBar.get(); } |
424 virtual ScrollableArea* enclosingScrollableArea() const; | 416 virtual ScrollableArea* enclosingScrollableArea() const; |
425 | 417 |
426 int verticalScrollbarWidth(OverlayScrollbarSizeRelevancy = IgnoreOverlayScro
llbarSize) const; | 418 int verticalScrollbarWidth(OverlayScrollbarSizeRelevancy = IgnoreOverlayScro
llbarSize) const; |
427 int horizontalScrollbarHeight(OverlayScrollbarSizeRelevancy = IgnoreOverlayS
crollbarSize) const; | 419 int horizontalScrollbarHeight(OverlayScrollbarSizeRelevancy = IgnoreOverlayS
crollbarSize) const; |
428 | 420 |
429 bool hasOverflowControls() const; | |
430 // isPointInResizeControl() is used for testing if a pointer/touch position
is in the resize control | 421 // isPointInResizeControl() is used for testing if a pointer/touch position
is in the resize control |
431 // area. | 422 // area. |
432 bool isPointInResizeControl(const IntPoint& absolutePoint, ResizerHitTestTyp
e resizerHitTestType) const; | 423 bool isPointInResizeControl(const IntPoint& absolutePoint, ResizerHitTestTyp
e resizerHitTestType) const; |
433 bool hitTestOverflowControls(HitTestResult&, const IntPoint& localPoint); | 424 bool hitTestOverflowControls(HitTestResult&, const IntPoint& localPoint); |
434 IntSize offsetFromResizeCorner(const IntPoint& absolutePoint) const; | 425 IntSize offsetFromResizeCorner(const IntPoint& absolutePoint) const; |
435 | 426 |
436 void paintOverflowControls(GraphicsContext*, const IntPoint&, const IntRect&
damageRect, bool paintingOverlayControls = false); | 427 void paintOverflowControls(GraphicsContext*, const IntPoint&, const IntRect&
damageRect, bool paintingOverlayControls = false); |
437 void paintScrollCorner(GraphicsContext*, const IntPoint&, const IntRect& dam
ageRect); | 428 void paintScrollCorner(GraphicsContext*, const IntPoint&, const IntRect& dam
ageRect); |
438 void paintResizer(GraphicsContext*, const IntPoint&, const IntRect& damageRe
ct); | 429 void paintResizer(GraphicsContext*, const IntPoint&, const IntRect& damageRe
ct); |
439 | 430 |
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
820 | 811 |
821 void setForceNeedsCompositedScrolling(ForceNeedsCompositedScrollingMode); | 812 void setForceNeedsCompositedScrolling(ForceNeedsCompositedScrollingMode); |
822 | 813 |
823 private: | 814 private: |
824 enum CollectLayersBehavior { | 815 enum CollectLayersBehavior { |
825 ForceLayerToStackingContainer, | 816 ForceLayerToStackingContainer, |
826 OverflowScrollCanBeStackingContainers, | 817 OverflowScrollCanBeStackingContainers, |
827 OnlyStackingContextsCanBeStackingContainers | 818 OnlyStackingContextsCanBeStackingContainers |
828 }; | 819 }; |
829 | 820 |
| 821 void setHasHorizontalScrollbar(bool); |
| 822 void setHasVerticalScrollbar(bool); |
| 823 |
| 824 PassRefPtr<Scrollbar> createScrollbar(ScrollbarOrientation); |
| 825 void destroyScrollbar(ScrollbarOrientation); |
| 826 |
| 827 bool hasOverflowControls() const; |
| 828 |
830 void updateZOrderLists(); | 829 void updateZOrderLists(); |
831 void rebuildZOrderLists(); | 830 void rebuildZOrderLists(); |
832 // See the comment for collectLayers for information about the layerToForceA
sStackingContainer parameter. | 831 // See the comment for collectLayers for information about the layerToForceA
sStackingContainer parameter. |
833 void rebuildZOrderLists(OwnPtr<Vector<RenderLayer*> >&, OwnPtr<Vector<Render
Layer*> >&, const RenderLayer* layerToForceAsStackingContainer = 0, CollectLayer
sBehavior = OverflowScrollCanBeStackingContainers); | 832 void rebuildZOrderLists(OwnPtr<Vector<RenderLayer*> >&, OwnPtr<Vector<Render
Layer*> >&, const RenderLayer* layerToForceAsStackingContainer = 0, CollectLayer
sBehavior = OverflowScrollCanBeStackingContainers); |
834 void clearZOrderLists(); | 833 void clearZOrderLists(); |
835 | 834 |
836 void updateNormalFlowList(); | 835 void updateNormalFlowList(); |
837 | 836 |
838 bool isStackingContext(const RenderStyle* style) const { return !style->hasA
utoZIndex() || isRootLayer(); } | 837 bool isStackingContext(const RenderStyle* style) const { return !style->hasA
utoZIndex() || isRootLayer(); } |
839 | 838 |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
993 bool hasHorizontalOverflow() const; | 992 bool hasHorizontalOverflow() const; |
994 bool hasVerticalOverflow() const; | 993 bool hasVerticalOverflow() const; |
995 bool hasScrollableHorizontalOverflow() const; | 994 bool hasScrollableHorizontalOverflow() const; |
996 bool hasScrollableVerticalOverflow() const; | 995 bool hasScrollableVerticalOverflow() const; |
997 | 996 |
998 bool shouldBeNormalFlowOnly() const; | 997 bool shouldBeNormalFlowOnly() const; |
999 bool shouldBeNormalFlowOnlyIgnoringCompositedScrolling() const; | 998 bool shouldBeNormalFlowOnlyIgnoringCompositedScrolling() const; |
1000 | 999 |
1001 bool shouldBeSelfPaintingLayer() const; | 1000 bool shouldBeSelfPaintingLayer() const; |
1002 | 1001 |
1003 int scrollPosition(Scrollbar*) const; | |
1004 | |
1005 // ScrollableArea interface | 1002 // ScrollableArea interface |
1006 virtual void invalidateScrollbarRect(Scrollbar*, const IntRect&); | 1003 virtual void invalidateScrollbarRect(Scrollbar*, const IntRect&); |
1007 virtual void invalidateScrollCornerRect(const IntRect&); | 1004 virtual void invalidateScrollCornerRect(const IntRect&); |
1008 virtual bool isActive() const; | 1005 virtual bool isActive() const; |
1009 virtual bool isScrollCornerVisible() const; | 1006 virtual bool isScrollCornerVisible() const; |
1010 virtual IntRect scrollCornerRect() const; | 1007 virtual IntRect scrollCornerRect() const; |
1011 virtual IntRect convertFromScrollbarToContainingView(const Scrollbar*, const
IntRect&) const; | 1008 virtual IntRect convertFromScrollbarToContainingView(const Scrollbar*, const
IntRect&) const; |
1012 virtual IntRect convertFromContainingViewToScrollbar(const Scrollbar*, const
IntRect&) const; | 1009 virtual IntRect convertFromContainingViewToScrollbar(const Scrollbar*, const
IntRect&) const; |
1013 virtual IntPoint convertFromScrollbarToContainingView(const Scrollbar*, cons
t IntPoint&) const; | 1010 virtual IntPoint convertFromScrollbarToContainingView(const Scrollbar*, cons
t IntPoint&) const; |
1014 virtual IntPoint convertFromContainingViewToScrollbar(const Scrollbar*, cons
t IntPoint&) const; | 1011 virtual IntPoint convertFromContainingViewToScrollbar(const Scrollbar*, cons
t IntPoint&) const; |
1015 virtual int scrollSize(ScrollbarOrientation) const; | 1012 virtual int scrollSize(ScrollbarOrientation) const; |
1016 virtual void setScrollOffset(const IntPoint&); | 1013 virtual void setScrollOffset(const IntPoint&); |
1017 virtual IntPoint scrollPosition() const; | 1014 virtual IntPoint scrollPosition() const; |
1018 virtual IntPoint minimumScrollPosition() const; | 1015 virtual IntPoint minimumScrollPosition() const; |
1019 virtual IntPoint maximumScrollPosition() const; | 1016 virtual IntPoint maximumScrollPosition() const; |
1020 virtual IntRect visibleContentRect(VisibleContentRectIncludesScrollbars) con
st; | 1017 virtual IntRect visibleContentRect(VisibleContentRectIncludesScrollbars) con
st; |
1021 virtual int visibleHeight() const; | 1018 virtual int visibleHeight() const; |
1022 virtual int visibleWidth() const; | 1019 virtual int visibleWidth() const; |
1023 virtual IntSize contentsSize() const; | 1020 virtual IntSize contentsSize() const; |
1024 virtual IntSize overhangAmount() const; | 1021 virtual IntSize overhangAmount() const; |
1025 virtual IntPoint lastKnownMousePosition() const; | 1022 virtual IntPoint lastKnownMousePosition() const; |
1026 virtual bool shouldSuspendScrollAnimations() const; | 1023 virtual bool shouldSuspendScrollAnimations() const; |
1027 virtual bool scrollbarsCanBeActive() const; | 1024 virtual bool scrollbarsCanBeActive() const; |
1028 virtual IntRect scrollableAreaBoundingBox() const OVERRIDE; | 1025 virtual IntRect scrollableAreaBoundingBox() const OVERRIDE; |
| 1026 virtual bool userInputScrollable(ScrollbarOrientation) const OVERRIDE; |
| 1027 virtual int pageStep(ScrollbarOrientation) const OVERRIDE; |
1029 | 1028 |
1030 // Rectangle encompassing the scroll corner and resizer rect. | 1029 // Rectangle encompassing the scroll corner and resizer rect. |
1031 IntRect scrollCornerAndResizerRect() const; | 1030 IntRect scrollCornerAndResizerRect() const; |
1032 | 1031 |
1033 void updateCompositingLayersAfterScroll(); | 1032 void updateCompositingLayersAfterScroll(); |
1034 | 1033 |
1035 IntSize scrollbarOffset(const Scrollbar*) const; | 1034 IntSize scrollbarOffset(const Scrollbar*) const; |
1036 | 1035 |
1037 void updateResizerAreaSet(); | 1036 void updateResizerAreaSet(); |
1038 void updateScrollableAreaSet(bool hasOverflow); | 1037 void updateScrollableAreaSet(bool hasOverflow); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1087 void setCompositingReasons(CompositingReasons reasons) { m_compositingProper
ties.compositingReasons = reasons; } | 1086 void setCompositingReasons(CompositingReasons reasons) { m_compositingProper
ties.compositingReasons = reasons; } |
1088 CompositingReasons compositingReasons() const { return m_compositingProperti
es.compositingReasons; } | 1087 CompositingReasons compositingReasons() const { return m_compositingProperti
es.compositingReasons; } |
1089 | 1088 |
1090 // Returns true if z ordering would not change if this layer were a stacking
container. | 1089 // Returns true if z ordering would not change if this layer were a stacking
container. |
1091 bool canBeStackingContainer() const; | 1090 bool canBeStackingContainer() const; |
1092 | 1091 |
1093 friend class RenderLayerBacking; | 1092 friend class RenderLayerBacking; |
1094 friend class RenderLayerCompositor; | 1093 friend class RenderLayerCompositor; |
1095 friend class RenderLayerModelObject; | 1094 friend class RenderLayerModelObject; |
1096 | 1095 |
1097 LayoutUnit overflowTop() const; | |
1098 LayoutUnit overflowBottom() const; | |
1099 LayoutUnit overflowLeft() const; | |
1100 LayoutUnit overflowRight() const; | |
1101 | |
1102 IntRect rectForHorizontalScrollbar(const IntRect& borderBoxRect) const; | 1096 IntRect rectForHorizontalScrollbar(const IntRect& borderBoxRect) const; |
1103 IntRect rectForVerticalScrollbar(const IntRect& borderBoxRect) const; | 1097 IntRect rectForVerticalScrollbar(const IntRect& borderBoxRect) const; |
1104 | 1098 |
1105 LayoutUnit verticalScrollbarStart(int minX, int maxX) const; | 1099 LayoutUnit verticalScrollbarStart(int minX, int maxX) const; |
1106 LayoutUnit horizontalScrollbarStart(int minX) const; | 1100 LayoutUnit horizontalScrollbarStart(int minX) const; |
1107 | 1101 |
1108 bool overflowControlsIntersectRect(const IntRect& localRect) const; | 1102 bool overflowControlsIntersectRect(const IntRect& localRect) const; |
1109 | 1103 |
1110 protected: | 1104 protected: |
1111 // The bitfields are up here so they will fall into the padding from Scrolla
bleArea on 64-bit. | 1105 // 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... |
1194 // Our (x,y) coordinates are in our parent layer's coordinate space. | 1188 // Our (x,y) coordinates are in our parent layer's coordinate space. |
1195 LayoutPoint m_topLeft; | 1189 LayoutPoint m_topLeft; |
1196 | 1190 |
1197 // The layer's width/height | 1191 // The layer's width/height |
1198 IntSize m_layerSize; | 1192 IntSize m_layerSize; |
1199 | 1193 |
1200 // This is the (scroll) offset from scrollOrigin(). | 1194 // This is the (scroll) offset from scrollOrigin(). |
1201 IntSize m_scrollOffset; | 1195 IntSize m_scrollOffset; |
1202 | 1196 |
1203 // The width/height of our scrolled area. | 1197 // The width/height of our scrolled area. |
1204 LayoutSize m_scrollSize; | 1198 LayoutRect m_overflowRect; |
1205 | 1199 |
1206 // For layers with overflow, we have a pair of scrollbars. | 1200 // For layers with overflow, we have a pair of scrollbars. |
1207 RefPtr<Scrollbar> m_hBar; | 1201 RefPtr<Scrollbar> m_hBar; |
1208 RefPtr<Scrollbar> m_vBar; | 1202 RefPtr<Scrollbar> m_vBar; |
1209 | 1203 |
1210 // For layers that establish stacking contexts, m_posZOrderList holds a sort
ed list of all the | 1204 // For layers that establish stacking contexts, m_posZOrderList holds a sort
ed list of all the |
1211 // descendant layers within the stacking context that have z-indices of 0 or
greater | 1205 // descendant layers within the stacking context that have z-indices of 0 or
greater |
1212 // (auto will count as 0). m_negZOrderList holds descendants within our sta
cking context with negative | 1206 // (auto will count as 0). m_negZOrderList holds descendants within our sta
cking context with negative |
1213 // z-indices. | 1207 // z-indices. |
1214 OwnPtr<Vector<RenderLayer*> > m_posZOrderList; | 1208 OwnPtr<Vector<RenderLayer*> > m_posZOrderList; |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1313 | 1307 |
1314 } // namespace WebCore | 1308 } // namespace WebCore |
1315 | 1309 |
1316 #ifndef NDEBUG | 1310 #ifndef NDEBUG |
1317 // Outside the WebCore namespace for ease of invocation from gdb. | 1311 // Outside the WebCore namespace for ease of invocation from gdb. |
1318 void showLayerTree(const WebCore::RenderLayer*); | 1312 void showLayerTree(const WebCore::RenderLayer*); |
1319 void showLayerTree(const WebCore::RenderObject*); | 1313 void showLayerTree(const WebCore::RenderObject*); |
1320 #endif | 1314 #endif |
1321 | 1315 |
1322 #endif // RenderLayer_h | 1316 #endif // RenderLayer_h |
OLD | NEW |