OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights
reserved. | 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 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 72 matching lines...) Loading... |
83 : m_layer(layer) | 83 : m_layer(layer) |
84 , m_inResizeMode(false) | 84 , m_inResizeMode(false) |
85 , m_scrollsOverflow(false) | 85 , m_scrollsOverflow(false) |
86 , m_scrollDimensionsDirty(true) | 86 , m_scrollDimensionsDirty(true) |
87 , m_inOverflowRelayout(false) | 87 , m_inOverflowRelayout(false) |
88 , m_nextTopmostScrollChild(0) | 88 , m_nextTopmostScrollChild(0) |
89 , m_topmostScrollChild(0) | 89 , m_topmostScrollChild(0) |
90 , m_needsCompositedScrolling(false) | 90 , m_needsCompositedScrolling(false) |
91 , m_scrollCorner(nullptr) | 91 , m_scrollCorner(nullptr) |
92 , m_resizer(nullptr) | 92 , m_resizer(nullptr) |
| 93 #if ENABLE(ASSERT) |
| 94 , m_hasBeenDisposed(false) |
| 95 #endif |
93 { | 96 { |
94 Node* node = box().node(); | 97 Node* node = box().node(); |
95 if (node && node->isElementNode()) { | 98 if (node && node->isElementNode()) { |
96 // We save and restore only the scrollOffset as the other scroll values
are recalculated. | 99 // We save and restore only the scrollOffset as the other scroll values
are recalculated. |
97 Element* element = toElement(node); | 100 Element* element = toElement(node); |
98 m_scrollOffset = element->savedLayerScrollOffset(); | 101 m_scrollOffset = element->savedLayerScrollOffset(); |
99 if (!m_scrollOffset.isZero()) | 102 if (!m_scrollOffset.isZero()) |
100 scrollAnimator()->setCurrentPosition(FloatPoint(m_scrollOffset.width
(), m_scrollOffset.height())); | 103 scrollAnimator()->setCurrentPosition(FloatPoint(m_scrollOffset.width
(), m_scrollOffset.height())); |
101 element->setSavedLayerScrollOffset(IntSize()); | 104 element->setSavedLayerScrollOffset(IntSize()); |
102 } | 105 } |
103 | 106 |
104 updateResizerAreaSet(); | 107 updateResizerAreaSet(); |
105 } | 108 } |
106 | 109 |
107 DeprecatedPaintLayerScrollableArea::~DeprecatedPaintLayerScrollableArea() | 110 DeprecatedPaintLayerScrollableArea::~DeprecatedPaintLayerScrollableArea() |
108 { | 111 { |
| 112 ASSERT(m_hasBeenDisposed); |
| 113 } |
| 114 |
| 115 void DeprecatedPaintLayerScrollableArea::dispose() |
| 116 { |
109 if (inResizeMode() && !box().documentBeingDestroyed()) { | 117 if (inResizeMode() && !box().documentBeingDestroyed()) { |
110 if (LocalFrame* frame = box().frame()) | 118 if (LocalFrame* frame = box().frame()) |
111 frame->eventHandler().resizeScrollableAreaDestroyed(); | 119 frame->eventHandler().resizeScrollableAreaDestroyed(); |
112 } | 120 } |
113 | 121 |
114 if (LocalFrame* frame = box().frame()) { | 122 if (LocalFrame* frame = box().frame()) { |
115 if (FrameView* frameView = frame->view()) { | 123 if (FrameView* frameView = frame->view()) { |
116 frameView->removeScrollableArea(this); | 124 frameView->removeScrollableArea(this); |
117 frameView->removeAnimatingScrollableArea(this); | 125 frameView->removeAnimatingScrollableArea(this); |
118 } | 126 } |
(...skipping 16 matching lines...) Loading... |
135 frameView->removeResizerArea(box()); | 143 frameView->removeResizerArea(box()); |
136 } | 144 } |
137 | 145 |
138 destroyScrollbar(HorizontalScrollbar); | 146 destroyScrollbar(HorizontalScrollbar); |
139 destroyScrollbar(VerticalScrollbar); | 147 destroyScrollbar(VerticalScrollbar); |
140 | 148 |
141 if (m_scrollCorner) | 149 if (m_scrollCorner) |
142 m_scrollCorner->destroy(); | 150 m_scrollCorner->destroy(); |
143 if (m_resizer) | 151 if (m_resizer) |
144 m_resizer->destroy(); | 152 m_resizer->destroy(); |
| 153 |
| 154 #if ENABLE(ASSERT) |
| 155 m_hasBeenDisposed = true; |
| 156 #endif |
| 157 } |
| 158 |
| 159 DEFINE_TRACE(DeprecatedPaintLayerScrollableArea) |
| 160 { |
| 161 visitor->trace(m_hBar); |
| 162 visitor->trace(m_vBar); |
| 163 ScrollableArea::trace(visitor); |
145 } | 164 } |
146 | 165 |
147 HostWindow* DeprecatedPaintLayerScrollableArea::hostWindow() const | 166 HostWindow* DeprecatedPaintLayerScrollableArea::hostWindow() const |
148 { | 167 { |
149 if (Page* page = box().frame()->page()) | 168 if (Page* page = box().frame()->page()) |
150 return &page->chromeClient(); | 169 return &page->chromeClient(); |
151 return nullptr; | 170 return nullptr; |
152 } | 171 } |
153 | 172 |
154 GraphicsLayer* DeprecatedPaintLayerScrollableArea::layerForScrolling() const | 173 GraphicsLayer* DeprecatedPaintLayerScrollableArea::layerForScrolling() const |
(...skipping 773 matching lines...) Loading... |
928 didAddScrollbar(widget.get(), HorizontalScrollbar); | 947 didAddScrollbar(widget.get(), HorizontalScrollbar); |
929 else | 948 else |
930 didAddScrollbar(widget.get(), VerticalScrollbar); | 949 didAddScrollbar(widget.get(), VerticalScrollbar); |
931 } | 950 } |
932 box().document().view()->addChild(widget.get()); | 951 box().document().view()->addChild(widget.get()); |
933 return widget.release(); | 952 return widget.release(); |
934 } | 953 } |
935 | 954 |
936 void DeprecatedPaintLayerScrollableArea::destroyScrollbar(ScrollbarOrientation o
rientation) | 955 void DeprecatedPaintLayerScrollableArea::destroyScrollbar(ScrollbarOrientation o
rientation) |
937 { | 956 { |
938 RefPtrWillBePersistent<Scrollbar>& scrollbar = orientation == HorizontalScro
llbar ? m_hBar : m_vBar; | 957 RefPtrWillBeMember<Scrollbar>& scrollbar = orientation == HorizontalScrollba
r ? m_hBar : m_vBar; |
939 if (!scrollbar) | 958 if (!scrollbar) |
940 return; | 959 return; |
941 | 960 |
942 if (!scrollbar->isCustomScrollbar()) | 961 if (!scrollbar->isCustomScrollbar()) |
943 willRemoveScrollbar(scrollbar.get(), orientation); | 962 willRemoveScrollbar(scrollbar.get(), orientation); |
944 | 963 |
945 toFrameView(scrollbar->parent())->removeChild(scrollbar.get()); | 964 toFrameView(scrollbar->parent())->removeChild(scrollbar.get()); |
946 scrollbar->disconnectFromScrollableArea(); | 965 scrollbar->disconnectFromScrollableArea(); |
947 scrollbar = nullptr; | 966 scrollbar = nullptr; |
948 } | 967 } |
(...skipping 444 matching lines...) Loading... |
1393 void DeprecatedPaintLayerScrollableArea::setTopmostScrollChild(DeprecatedPaintLa
yer* scrollChild) | 1412 void DeprecatedPaintLayerScrollableArea::setTopmostScrollChild(DeprecatedPaintLa
yer* scrollChild) |
1394 { | 1413 { |
1395 // We only want to track the topmost scroll child for scrollable areas with | 1414 // We only want to track the topmost scroll child for scrollable areas with |
1396 // overlay scrollbars. | 1415 // overlay scrollbars. |
1397 if (!hasOverlayScrollbars()) | 1416 if (!hasOverlayScrollbars()) |
1398 return; | 1417 return; |
1399 m_nextTopmostScrollChild = scrollChild; | 1418 m_nextTopmostScrollChild = scrollChild; |
1400 } | 1419 } |
1401 | 1420 |
1402 } // namespace blink | 1421 } // namespace blink |
OLD | NEW |