| 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 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 823 | 814 |
| 824 void setForceNeedsCompositedScrolling(ForceNeedsCompositedScrollingMode); | 815 void setForceNeedsCompositedScrolling(ForceNeedsCompositedScrollingMode); |
| 825 | 816 |
| 826 private: | 817 private: |
| 827 enum CollectLayersBehavior { | 818 enum CollectLayersBehavior { |
| 828 ForceLayerToStackingContainer, | 819 ForceLayerToStackingContainer, |
| 829 OverflowScrollCanBeStackingContainers, | 820 OverflowScrollCanBeStackingContainers, |
| 830 OnlyStackingContextsCanBeStackingContainers | 821 OnlyStackingContextsCanBeStackingContainers |
| 831 }; | 822 }; |
| 832 | 823 |
| 824 void setHasHorizontalScrollbar(bool); |
| 825 void setHasVerticalScrollbar(bool); |
| 826 |
| 827 PassRefPtr<Scrollbar> createScrollbar(ScrollbarOrientation); |
| 828 void destroyScrollbar(ScrollbarOrientation); |
| 829 |
| 830 bool hasOverflowControls() const; |
| 831 |
| 833 void updateZOrderLists(); | 832 void updateZOrderLists(); |
| 834 void rebuildZOrderLists(); | 833 void rebuildZOrderLists(); |
| 835 // See the comment for collectLayers for information about the layerToForceA
sStackingContainer parameter. | 834 // See the comment for collectLayers for information about the layerToForceA
sStackingContainer parameter. |
| 836 void rebuildZOrderLists(OwnPtr<Vector<RenderLayer*> >&, OwnPtr<Vector<Render
Layer*> >&, const RenderLayer* layerToForceAsStackingContainer = 0, CollectLayer
sBehavior = OverflowScrollCanBeStackingContainers); | 835 void rebuildZOrderLists(OwnPtr<Vector<RenderLayer*> >&, OwnPtr<Vector<Render
Layer*> >&, const RenderLayer* layerToForceAsStackingContainer = 0, CollectLayer
sBehavior = OverflowScrollCanBeStackingContainers); |
| 837 void clearZOrderLists(); | 836 void clearZOrderLists(); |
| 838 | 837 |
| 839 void updateNormalFlowList(); | 838 void updateNormalFlowList(); |
| 840 | 839 |
| 841 bool isStackingContext(const RenderStyle* style) const { return !style->hasA
utoZIndex() || isRootLayer(); } | 840 bool isStackingContext(const RenderStyle* style) const { return !style->hasA
utoZIndex() || isRootLayer(); } |
| 842 | 841 |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 999 bool hasHorizontalOverflow() const; | 998 bool hasHorizontalOverflow() const; |
| 1000 bool hasVerticalOverflow() const; | 999 bool hasVerticalOverflow() const; |
| 1001 bool hasScrollableHorizontalOverflow() const; | 1000 bool hasScrollableHorizontalOverflow() const; |
| 1002 bool hasScrollableVerticalOverflow() const; | 1001 bool hasScrollableVerticalOverflow() const; |
| 1003 | 1002 |
| 1004 bool shouldBeNormalFlowOnly() const; | 1003 bool shouldBeNormalFlowOnly() const; |
| 1005 bool shouldBeNormalFlowOnlyIgnoringCompositedScrolling() const; | 1004 bool shouldBeNormalFlowOnlyIgnoringCompositedScrolling() const; |
| 1006 | 1005 |
| 1007 bool shouldBeSelfPaintingLayer() const; | 1006 bool shouldBeSelfPaintingLayer() const; |
| 1008 | 1007 |
| 1009 int scrollPosition(Scrollbar*) const; | |
| 1010 | |
| 1011 // ScrollableArea interface | 1008 // ScrollableArea interface |
| 1012 virtual void invalidateScrollbarRect(Scrollbar*, const IntRect&); | 1009 virtual void invalidateScrollbarRect(Scrollbar*, const IntRect&); |
| 1013 virtual void invalidateScrollCornerRect(const IntRect&); | 1010 virtual void invalidateScrollCornerRect(const IntRect&); |
| 1014 virtual bool isActive() const; | 1011 virtual bool isActive() const; |
| 1015 virtual bool isScrollCornerVisible() const; | 1012 virtual bool isScrollCornerVisible() const; |
| 1016 virtual IntRect scrollCornerRect() const; | 1013 virtual IntRect scrollCornerRect() const; |
| 1017 virtual IntRect convertFromScrollbarToContainingView(const Scrollbar*, const
IntRect&) const; | 1014 virtual IntRect convertFromScrollbarToContainingView(const Scrollbar*, const
IntRect&) const; |
| 1018 virtual IntRect convertFromContainingViewToScrollbar(const Scrollbar*, const
IntRect&) const; | 1015 virtual IntRect convertFromContainingViewToScrollbar(const Scrollbar*, const
IntRect&) const; |
| 1019 virtual IntPoint convertFromScrollbarToContainingView(const Scrollbar*, cons
t IntPoint&) const; | 1016 virtual IntPoint convertFromScrollbarToContainingView(const Scrollbar*, cons
t IntPoint&) const; |
| 1020 virtual IntPoint convertFromContainingViewToScrollbar(const Scrollbar*, cons
t IntPoint&) const; | 1017 virtual IntPoint convertFromContainingViewToScrollbar(const Scrollbar*, cons
t IntPoint&) const; |
| 1021 virtual int scrollSize(ScrollbarOrientation) const; | 1018 virtual int scrollSize(ScrollbarOrientation) const; |
| 1022 virtual void setScrollOffset(const IntPoint&); | 1019 virtual void setScrollOffset(const IntPoint&); |
| 1023 virtual IntPoint scrollPosition() const; | 1020 virtual IntPoint scrollPosition() const; |
| 1024 virtual IntPoint minimumScrollPosition() const; | 1021 virtual IntPoint minimumScrollPosition() const; |
| 1025 virtual IntPoint maximumScrollPosition() const; | 1022 virtual IntPoint maximumScrollPosition() const; |
| 1026 virtual IntRect visibleContentRect(VisibleContentRectIncludesScrollbars) con
st; | 1023 virtual IntRect visibleContentRect(VisibleContentRectIncludesScrollbars) con
st; |
| 1027 virtual int visibleHeight() const; | 1024 virtual int visibleHeight() const; |
| 1028 virtual int visibleWidth() const; | 1025 virtual int visibleWidth() const; |
| 1029 virtual IntSize contentsSize() const; | 1026 virtual IntSize contentsSize() const; |
| 1030 virtual IntSize overhangAmount() const; | 1027 virtual IntSize overhangAmount() const; |
| 1031 virtual IntPoint lastKnownMousePosition() const; | 1028 virtual IntPoint lastKnownMousePosition() const; |
| 1032 virtual bool shouldSuspendScrollAnimations() const; | 1029 virtual bool shouldSuspendScrollAnimations() const; |
| 1033 virtual bool scrollbarsCanBeActive() const; | 1030 virtual bool scrollbarsCanBeActive() const; |
| 1034 virtual IntRect scrollableAreaBoundingBox() const OVERRIDE; | 1031 virtual IntRect scrollableAreaBoundingBox() const OVERRIDE; |
| 1032 virtual bool userInputScrollable(ScrollbarOrientation) const OVERRIDE; |
| 1033 virtual int pageStep(ScrollbarOrientation) const OVERRIDE; |
| 1035 | 1034 |
| 1036 // Rectangle encompassing the scroll corner and resizer rect. | 1035 // Rectangle encompassing the scroll corner and resizer rect. |
| 1037 IntRect scrollCornerAndResizerRect() const; | 1036 IntRect scrollCornerAndResizerRect() const; |
| 1038 | 1037 |
| 1039 void updateCompositingLayersAfterScroll(); | 1038 void updateCompositingLayersAfterScroll(); |
| 1040 | 1039 |
| 1041 IntSize scrollbarOffset(const Scrollbar*) const; | 1040 IntSize scrollbarOffset(const Scrollbar*) const; |
| 1042 | 1041 |
| 1043 void updateResizerAreaSet(); | 1042 void updateResizerAreaSet(); |
| 1044 void updateScrollableAreaSet(bool hasOverflow); | 1043 void updateScrollableAreaSet(bool hasOverflow); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1096 // Returns true if z ordering would not change if this layer were a stacking
container. | 1095 // Returns true if z ordering would not change if this layer were a stacking
container. |
| 1097 bool canBeStackingContainer() const; | 1096 bool canBeStackingContainer() const; |
| 1098 | 1097 |
| 1099 friend class RenderLayerBacking; | 1098 friend class RenderLayerBacking; |
| 1100 friend class RenderLayerCompositor; | 1099 friend class RenderLayerCompositor; |
| 1101 friend class RenderLayerModelObject; | 1100 friend class RenderLayerModelObject; |
| 1102 | 1101 |
| 1103 // Only safe to call from RenderLayerModelObject::destroyLayer(RenderArena*) | 1102 // Only safe to call from RenderLayerModelObject::destroyLayer(RenderArena*) |
| 1104 void destroy(RenderArena*); | 1103 void destroy(RenderArena*); |
| 1105 | 1104 |
| 1106 LayoutUnit overflowTop() const; | |
| 1107 LayoutUnit overflowBottom() const; | |
| 1108 LayoutUnit overflowLeft() const; | |
| 1109 LayoutUnit overflowRight() const; | |
| 1110 | |
| 1111 IntRect rectForHorizontalScrollbar(const IntRect& borderBoxRect) const; | 1105 IntRect rectForHorizontalScrollbar(const IntRect& borderBoxRect) const; |
| 1112 IntRect rectForVerticalScrollbar(const IntRect& borderBoxRect) const; | 1106 IntRect rectForVerticalScrollbar(const IntRect& borderBoxRect) const; |
| 1113 | 1107 |
| 1114 LayoutUnit verticalScrollbarStart(int minX, int maxX) const; | 1108 LayoutUnit verticalScrollbarStart(int minX, int maxX) const; |
| 1115 LayoutUnit horizontalScrollbarStart(int minX) const; | 1109 LayoutUnit horizontalScrollbarStart(int minX) const; |
| 1116 | 1110 |
| 1117 bool overflowControlsIntersectRect(const IntRect& localRect) const; | 1111 bool overflowControlsIntersectRect(const IntRect& localRect) const; |
| 1118 | 1112 |
| 1119 protected: | 1113 protected: |
| 1120 // The bitfields are up here so they will fall into the padding from Scrolla
bleArea on 64-bit. | 1114 // 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... |
| 1203 // Our (x,y) coordinates are in our parent layer's coordinate space. | 1197 // Our (x,y) coordinates are in our parent layer's coordinate space. |
| 1204 LayoutPoint m_topLeft; | 1198 LayoutPoint m_topLeft; |
| 1205 | 1199 |
| 1206 // The layer's width/height | 1200 // The layer's width/height |
| 1207 IntSize m_layerSize; | 1201 IntSize m_layerSize; |
| 1208 | 1202 |
| 1209 // This is the (scroll) offset from scrollOrigin(). | 1203 // This is the (scroll) offset from scrollOrigin(). |
| 1210 IntSize m_scrollOffset; | 1204 IntSize m_scrollOffset; |
| 1211 | 1205 |
| 1212 // The width/height of our scrolled area. | 1206 // The width/height of our scrolled area. |
| 1213 LayoutSize m_scrollSize; | 1207 LayoutRect m_overflowRect; |
| 1214 | 1208 |
| 1215 // For layers with overflow, we have a pair of scrollbars. | 1209 // For layers with overflow, we have a pair of scrollbars. |
| 1216 RefPtr<Scrollbar> m_hBar; | 1210 RefPtr<Scrollbar> m_hBar; |
| 1217 RefPtr<Scrollbar> m_vBar; | 1211 RefPtr<Scrollbar> m_vBar; |
| 1218 | 1212 |
| 1219 // For layers that establish stacking contexts, m_posZOrderList holds a sort
ed list of all the | 1213 // For layers that establish stacking contexts, m_posZOrderList holds a sort
ed list of all the |
| 1220 // descendant layers within the stacking context that have z-indices of 0 or
greater | 1214 // descendant layers within the stacking context that have z-indices of 0 or
greater |
| 1221 // (auto will count as 0). m_negZOrderList holds descendants within our sta
cking context with negative | 1215 // (auto will count as 0). m_negZOrderList holds descendants within our sta
cking context with negative |
| 1222 // z-indices. | 1216 // z-indices. |
| 1223 OwnPtr<Vector<RenderLayer*> > m_posZOrderList; | 1217 OwnPtr<Vector<RenderLayer*> > m_posZOrderList; |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1322 | 1316 |
| 1323 } // namespace WebCore | 1317 } // namespace WebCore |
| 1324 | 1318 |
| 1325 #ifndef NDEBUG | 1319 #ifndef NDEBUG |
| 1326 // Outside the WebCore namespace for ease of invocation from gdb. | 1320 // Outside the WebCore namespace for ease of invocation from gdb. |
| 1327 void showLayerTree(const WebCore::RenderLayer*); | 1321 void showLayerTree(const WebCore::RenderLayer*); |
| 1328 void showLayerTree(const WebCore::RenderObject*); | 1322 void showLayerTree(const WebCore::RenderObject*); |
| 1329 #endif | 1323 #endif |
| 1330 | 1324 |
| 1331 #endif // RenderLayer_h | 1325 #endif // RenderLayer_h |
| OLD | NEW |