OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org> | 2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org> |
3 * 1999 Lars Knoll <knoll@kde.org> | 3 * 1999 Lars Knoll <knoll@kde.org> |
4 * 1999 Antti Koivisto <koivisto@kde.org> | 4 * 1999 Antti Koivisto <koivisto@kde.org> |
5 * 2000 Dirk Mueller <mueller@kde.org> | 5 * 2000 Dirk Mueller <mueller@kde.org> |
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. |
7 * (C) 2006 Graham Dennis (graham.dennis@gmail.com) | 7 * (C) 2006 Graham Dennis (graham.dennis@gmail.com) |
8 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) | 8 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) |
9 * Copyright (C) 2009 Google Inc. All rights reserved. | 9 * Copyright (C) 2009 Google Inc. All rights reserved. |
10 * | 10 * |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 | 88 |
89 using namespace HTMLNames; | 89 using namespace HTMLNames; |
90 | 90 |
91 double FrameView::s_currentFrameTimeStamp = 0.0; | 91 double FrameView::s_currentFrameTimeStamp = 0.0; |
92 bool FrameView::s_inPaintContents = false; | 92 bool FrameView::s_inPaintContents = false; |
93 | 93 |
94 // The maximum number of updateWidgets iterations that should be done before ret
urning. | 94 // The maximum number of updateWidgets iterations that should be done before ret
urning. |
95 static const unsigned maxUpdateWidgetsIterations = 2; | 95 static const unsigned maxUpdateWidgetsIterations = 2; |
96 static const double resourcePriorityUpdateDelayAfterScroll = 0.250; | 96 static const double resourcePriorityUpdateDelayAfterScroll = 0.250; |
97 | 97 |
| 98 void FrameViewAutoSizeData::enableAutoSizeMode(bool enable, const IntSize& minSi
ze, const IntSize& maxSize) |
| 99 { |
| 100 ASSERT(!enable || !minSize.isEmpty()); |
| 101 ASSERT(minSize.width() <= maxSize.width()); |
| 102 ASSERT(minSize.height() <= maxSize.height()); |
| 103 |
| 104 if (m_shouldAutoSize == enable && m_minAutoSize == minSize && m_maxAutoSize
== maxSize) |
| 105 return; |
| 106 |
| 107 m_shouldAutoSize = enable; |
| 108 m_minAutoSize = minSize; |
| 109 m_maxAutoSize = maxSize; |
| 110 m_didRunAutosize = false; |
| 111 |
| 112 m_frameView->setLayoutSizeFixedToFrameSize(enable); |
| 113 m_frameView->setNeedsLayout(); |
| 114 m_frameView->scheduleRelayout(); |
| 115 if (m_shouldAutoSize) |
| 116 return; |
| 117 |
| 118 // Since autosize mode forces the scrollbar mode, change them to being auto. |
| 119 m_frameView->setVerticalScrollbarLock(false); |
| 120 m_frameView->setHorizontalScrollbarLock(false); |
| 121 m_frameView->setScrollbarModes(ScrollbarAuto, ScrollbarAuto); |
| 122 } |
| 123 |
| 124 void FrameViewAutoSizeData::autoSizeIfEnabled() |
| 125 { |
| 126 if (!m_shouldAutoSize) |
| 127 return; |
| 128 |
| 129 if (m_inAutoSize) |
| 130 return; |
| 131 |
| 132 TemporaryChange<bool> changeInAutoSize(m_inAutoSize, true); |
| 133 |
| 134 Document* document = m_frameView->frame().document(); |
| 135 if (!document || !document->isActive()) |
| 136 return; |
| 137 |
| 138 Element* documentElement = document->documentElement(); |
| 139 if (!documentElement) |
| 140 return; |
| 141 |
| 142 // If this is the first time we run autosize, start from small height and |
| 143 // allow it to grow. |
| 144 if (!m_didRunAutosize) |
| 145 m_frameView->resize(m_frameView->frameRect().width(), m_minAutoSize.heig
ht()); |
| 146 |
| 147 IntSize size = m_frameView->frameRect().size(); |
| 148 |
| 149 // Do the resizing twice. The first time is basically a rough calculation us
ing the preferred width |
| 150 // which may result in a height change during the second iteration. |
| 151 for (int i = 0; i < 2; i++) { |
| 152 // Update various sizes including contentsSize, scrollHeight, etc. |
| 153 document->updateLayoutIgnorePendingStylesheets(); |
| 154 |
| 155 RenderView* renderView = document->renderView(); |
| 156 if (!renderView) |
| 157 return; |
| 158 |
| 159 int width = renderView->minPreferredLogicalWidth(); |
| 160 |
| 161 RenderBox* documentRenderBox = documentElement->renderBox(); |
| 162 if (!documentRenderBox) |
| 163 return; |
| 164 |
| 165 int height = documentRenderBox->scrollHeight(); |
| 166 IntSize newSize(width, height); |
| 167 |
| 168 // Check to see if a scrollbar is needed for a given dimension and |
| 169 // if so, increase the other dimension to account for the scrollbar. |
| 170 // Since the dimensions are only for the view rectangle, once a |
| 171 // dimension exceeds the maximum, there is no need to increase it furthe
r. |
| 172 if (newSize.width() > m_maxAutoSize.width()) { |
| 173 RefPtr<Scrollbar> localHorizontalScrollbar = m_frameView->horizontal
Scrollbar(); |
| 174 if (!localHorizontalScrollbar) |
| 175 localHorizontalScrollbar = m_frameView->createScrollbar(Horizont
alScrollbar); |
| 176 if (!localHorizontalScrollbar->isOverlayScrollbar()) |
| 177 newSize.setHeight(newSize.height() + localHorizontalScrollbar->h
eight()); |
| 178 |
| 179 // Don't bother checking for a vertical scrollbar because the width
is at |
| 180 // already greater the maximum. |
| 181 } else if (newSize.height() > m_maxAutoSize.height()) { |
| 182 RefPtr<Scrollbar> localVerticalScrollbar = m_frameView->verticalScro
llbar(); |
| 183 if (!localVerticalScrollbar) |
| 184 localVerticalScrollbar = m_frameView->createScrollbar(VerticalSc
rollbar); |
| 185 if (!localVerticalScrollbar->isOverlayScrollbar()) |
| 186 newSize.setWidth(newSize.width() + localVerticalScrollbar->width
()); |
| 187 |
| 188 // Don't bother checking for a horizontal scrollbar because the heig
ht is |
| 189 // already greater the maximum. |
| 190 } |
| 191 |
| 192 // Ensure the size is at least the min bounds. |
| 193 newSize = newSize.expandedTo(m_minAutoSize); |
| 194 |
| 195 // Bound the dimensions by the max bounds and determine what scrollbars
to show. |
| 196 ScrollbarMode horizonalScrollbarMode = ScrollbarAlwaysOff; |
| 197 if (newSize.width() > m_maxAutoSize.width()) { |
| 198 newSize.setWidth(m_maxAutoSize.width()); |
| 199 horizonalScrollbarMode = ScrollbarAlwaysOn; |
| 200 } |
| 201 ScrollbarMode verticalScrollbarMode = ScrollbarAlwaysOff; |
| 202 if (newSize.height() > m_maxAutoSize.height()) { |
| 203 newSize.setHeight(m_maxAutoSize.height()); |
| 204 verticalScrollbarMode = ScrollbarAlwaysOn; |
| 205 } |
| 206 |
| 207 if (newSize == size) |
| 208 continue; |
| 209 |
| 210 // While loading only allow the size to increase (to avoid twitching dur
ing intermediate smaller states) |
| 211 // unless autoresize has just been turned on or the maximum size is smal
ler than the current size. |
| 212 if (m_didRunAutosize && size.height() <= m_maxAutoSize.height() && size.
width() <= m_maxAutoSize.width() |
| 213 && !m_frameView->frame().document()->loadEventFinished() && (newSize
.height() < size.height() || newSize.width() < size.width())) |
| 214 break; |
| 215 |
| 216 m_frameView->resize(newSize.width(), newSize.height()); |
| 217 // Force the scrollbar state to avoid the scrollbar code adding them and
causing them to be needed. For example, |
| 218 // a vertical scrollbar may cause text to wrap and thus increase the hei
ght (which is the only reason the scollbar is needed). |
| 219 m_frameView->setVerticalScrollbarLock(false); |
| 220 m_frameView->setHorizontalScrollbarLock(false); |
| 221 m_frameView->setScrollbarModes(horizonalScrollbarMode, verticalScrollbar
Mode, true, true); |
| 222 } |
| 223 m_didRunAutosize = true; |
| 224 } |
| 225 |
98 static RenderLayer::UpdateLayerPositionsFlags updateLayerPositionFlags(RenderLay
er* layer, bool isRelayoutingSubtree, bool didFullPaintInvalidation) | 226 static RenderLayer::UpdateLayerPositionsFlags updateLayerPositionFlags(RenderLay
er* layer, bool isRelayoutingSubtree, bool didFullPaintInvalidation) |
99 { | 227 { |
100 RenderLayer::UpdateLayerPositionsFlags flags = didFullPaintInvalidation ? Re
nderLayer::NeedsFullPaintInvalidationInBacking : RenderLayer::CheckForPaintInval
idation; | 228 RenderLayer::UpdateLayerPositionsFlags flags = didFullPaintInvalidation ? Re
nderLayer::NeedsFullPaintInvalidationInBacking : RenderLayer::CheckForPaintInval
idation; |
101 | 229 |
102 if (isRelayoutingSubtree && (layer->isPaginated() || layer->enclosingPaginat
ionLayer())) | 230 if (isRelayoutingSubtree && (layer->isPaginated() || layer->enclosingPaginat
ionLayer())) |
103 flags |= RenderLayer::UpdatePagination; | 231 flags |= RenderLayer::UpdatePagination; |
104 | 232 |
105 return flags; | 233 return flags; |
106 } | 234 } |
107 | 235 |
108 FrameView::FrameView(LocalFrame* frame) | 236 FrameView::FrameView(LocalFrame* frame) |
109 : m_frame(frame) | 237 : m_frame(frame) |
110 , m_canHaveScrollbars(true) | 238 , m_canHaveScrollbars(true) |
111 , m_slowRepaintObjectCount(0) | 239 , m_slowRepaintObjectCount(0) |
112 , m_hasPendingLayout(false) | 240 , m_hasPendingLayout(false) |
113 , m_layoutSubtreeRoot(0) | 241 , m_layoutSubtreeRoot(0) |
114 , m_inSynchronousPostLayout(false) | 242 , m_inSynchronousPostLayout(false) |
115 , m_postLayoutTasksTimer(this, &FrameView::postLayoutTimerFired) | 243 , m_postLayoutTasksTimer(this, &FrameView::postLayoutTimerFired) |
116 , m_updateWidgetsTimer(this, &FrameView::updateWidgetsTimerFired) | 244 , m_updateWidgetsTimer(this, &FrameView::updateWidgetsTimerFired) |
117 , m_isTransparent(false) | 245 , m_isTransparent(false) |
118 , m_baseBackgroundColor(Color::white) | 246 , m_baseBackgroundColor(Color::white) |
119 , m_mediaType("screen") | 247 , m_mediaType("screen") |
120 , m_overflowStatusDirty(true) | 248 , m_overflowStatusDirty(true) |
121 , m_viewportRenderer(0) | 249 , m_viewportRenderer(0) |
122 , m_wasScrolledByUser(false) | 250 , m_wasScrolledByUser(false) |
123 , m_inProgrammaticScroll(false) | 251 , m_inProgrammaticScroll(false) |
124 , m_safeToPropagateScrollToParent(true) | 252 , m_safeToPropagateScrollToParent(true) |
125 , m_isTrackingPaintInvalidations(false) | 253 , m_isTrackingPaintInvalidations(false) |
126 , m_scrollCorner(0) | 254 , m_scrollCorner(0) |
127 , m_shouldAutoSize(false) | |
128 , m_inAutoSize(false) | |
129 , m_didRunAutosize(false) | |
130 , m_hasSoftwareFilters(false) | 255 , m_hasSoftwareFilters(false) |
131 , m_visibleContentScaleFactor(1) | 256 , m_visibleContentScaleFactor(1) |
132 , m_inputEventsScaleFactorForEmulation(1) | 257 , m_inputEventsScaleFactorForEmulation(1) |
133 , m_layoutSizeFixedToFrameSize(true) | 258 , m_layoutSizeFixedToFrameSize(true) |
134 , m_didScrollTimer(this, &FrameView::didScrollTimerFired) | 259 , m_didScrollTimer(this, &FrameView::didScrollTimerFired) |
135 { | 260 { |
136 ASSERT(m_frame); | 261 ASSERT(m_frame); |
137 init(); | 262 init(); |
138 | 263 |
139 if (!m_frame->isMainFrame()) | 264 if (!m_frame->isMainFrame()) |
(...skipping 755 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
895 if (body && body->renderer()) { | 1020 if (body && body->renderer()) { |
896 if (isHTMLFrameSetElement(*body)) { | 1021 if (isHTMLFrameSetElement(*body)) { |
897 body->renderer()->setChildNeedsLayout(); | 1022 body->renderer()->setChildNeedsLayout(); |
898 } else if (isHTMLBodyElement(*body)) { | 1023 } else if (isHTMLBodyElement(*body)) { |
899 if (!m_firstLayout && m_size.height() != layoutSize().height
() && body->renderer()->enclosingBox()->stretchesToViewport()) | 1024 if (!m_firstLayout && m_size.height() != layoutSize().height
() && body->renderer()->enclosingBox()->stretchesToViewport()) |
900 body->renderer()->setChildNeedsLayout(); | 1025 body->renderer()->setChildNeedsLayout(); |
901 } | 1026 } |
902 } | 1027 } |
903 } | 1028 } |
904 updateCounters(); | 1029 updateCounters(); |
905 autoSizeIfEnabled(); | 1030 ensureAutoSizeData().autoSizeIfEnabled(); |
906 | 1031 |
907 ScrollbarMode hMode; | 1032 ScrollbarMode hMode; |
908 ScrollbarMode vMode; | 1033 ScrollbarMode vMode; |
909 calculateScrollbarModesForLayoutAndSetViewportRenderer(hMode, vMode); | 1034 calculateScrollbarModesForLayoutAndSetViewportRenderer(hMode, vMode); |
910 | 1035 |
911 if (!inSubtreeLayout) { | 1036 if (!inSubtreeLayout) { |
912 // Now set our scrollbar state for the layout. | 1037 // Now set our scrollbar state for the layout. |
913 ScrollbarMode currentHMode = horizontalScrollbarMode(); | 1038 ScrollbarMode currentHMode = horizontalScrollbarMode(); |
914 ScrollbarMode currentVMode = verticalScrollbarMode(); | 1039 ScrollbarMode currentVMode = verticalScrollbarMode(); |
915 | 1040 |
(...skipping 864 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1780 | 1905 |
1781 if (!useOverlayScrollbars) | 1906 if (!useOverlayScrollbars) |
1782 renderView()->compositor()->frameViewDidChangeSize(); | 1907 renderView()->compositor()->frameViewDidChangeSize(); |
1783 } | 1908 } |
1784 } | 1909 } |
1785 | 1910 |
1786 void FrameView::handleLoadCompleted() | 1911 void FrameView::handleLoadCompleted() |
1787 { | 1912 { |
1788 // Once loading has completed, allow autoSize one last opportunity to | 1913 // Once loading has completed, allow autoSize one last opportunity to |
1789 // reduce the size of the frame. | 1914 // reduce the size of the frame. |
1790 autoSizeIfEnabled(); | 1915 ensureAutoSizeData().autoSizeIfEnabled(); |
1791 } | 1916 } |
1792 | 1917 |
1793 void FrameView::scheduleRelayout() | 1918 void FrameView::scheduleRelayout() |
1794 { | 1919 { |
1795 ASSERT(m_frame->view() == this); | 1920 ASSERT(m_frame->view() == this); |
1796 | 1921 |
1797 if (isSubtreeLayout()) { | 1922 if (isSubtreeLayout()) { |
1798 m_layoutSubtreeRoot->markContainingBlocksForLayout(false); | 1923 m_layoutSubtreeRoot->markContainingBlocksForLayout(false); |
1799 m_layoutSubtreeRoot = 0; | 1924 m_layoutSubtreeRoot = 0; |
1800 } | 1925 } |
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2137 return; | 2262 return; |
2138 | 2263 |
2139 for (RenderObject* renderer = view; renderer; renderer = renderer->nextInPre
Order()) { | 2264 for (RenderObject* renderer = view; renderer; renderer = renderer->nextInPre
Order()) { |
2140 if (!renderer->isCounter()) | 2265 if (!renderer->isCounter()) |
2141 continue; | 2266 continue; |
2142 | 2267 |
2143 toRenderCounter(renderer)->updateCounter(); | 2268 toRenderCounter(renderer)->updateCounter(); |
2144 } | 2269 } |
2145 } | 2270 } |
2146 | 2271 |
2147 void FrameView::autoSizeIfEnabled() | |
2148 { | |
2149 if (!m_shouldAutoSize) | |
2150 return; | |
2151 | |
2152 if (m_inAutoSize) | |
2153 return; | |
2154 | |
2155 TemporaryChange<bool> changeInAutoSize(m_inAutoSize, true); | |
2156 | |
2157 Document* document = frame().document(); | |
2158 if (!document || !document->isActive()) | |
2159 return; | |
2160 | |
2161 Element* documentElement = document->documentElement(); | |
2162 if (!documentElement) | |
2163 return; | |
2164 | |
2165 // If this is the first time we run autosize, start from small height and | |
2166 // allow it to grow. | |
2167 if (!m_didRunAutosize) | |
2168 resize(frameRect().width(), m_minAutoSize.height()); | |
2169 | |
2170 IntSize size = frameRect().size(); | |
2171 | |
2172 // Do the resizing twice. The first time is basically a rough calculation us
ing the preferred width | |
2173 // which may result in a height change during the second iteration. | |
2174 for (int i = 0; i < 2; i++) { | |
2175 // Update various sizes including contentsSize, scrollHeight, etc. | |
2176 document->updateLayoutIgnorePendingStylesheets(); | |
2177 | |
2178 RenderView* renderView = document->renderView(); | |
2179 if (!renderView) | |
2180 return; | |
2181 | |
2182 int width = renderView->minPreferredLogicalWidth(); | |
2183 | |
2184 RenderBox* documentRenderBox = documentElement->renderBox(); | |
2185 if (!documentRenderBox) | |
2186 return; | |
2187 | |
2188 int height = documentRenderBox->scrollHeight(); | |
2189 IntSize newSize(width, height); | |
2190 | |
2191 // Check to see if a scrollbar is needed for a given dimension and | |
2192 // if so, increase the other dimension to account for the scrollbar. | |
2193 // Since the dimensions are only for the view rectangle, once a | |
2194 // dimension exceeds the maximum, there is no need to increase it furthe
r. | |
2195 if (newSize.width() > m_maxAutoSize.width()) { | |
2196 RefPtr<Scrollbar> localHorizontalScrollbar = horizontalScrollbar(); | |
2197 if (!localHorizontalScrollbar) | |
2198 localHorizontalScrollbar = createScrollbar(HorizontalScrollbar); | |
2199 if (!localHorizontalScrollbar->isOverlayScrollbar()) | |
2200 newSize.setHeight(newSize.height() + localHorizontalScrollbar->h
eight()); | |
2201 | |
2202 // Don't bother checking for a vertical scrollbar because the width
is at | |
2203 // already greater the maximum. | |
2204 } else if (newSize.height() > m_maxAutoSize.height()) { | |
2205 RefPtr<Scrollbar> localVerticalScrollbar = verticalScrollbar(); | |
2206 if (!localVerticalScrollbar) | |
2207 localVerticalScrollbar = createScrollbar(VerticalScrollbar); | |
2208 if (!localVerticalScrollbar->isOverlayScrollbar()) | |
2209 newSize.setWidth(newSize.width() + localVerticalScrollbar->width
()); | |
2210 | |
2211 // Don't bother checking for a horizontal scrollbar because the heig
ht is | |
2212 // already greater the maximum. | |
2213 } | |
2214 | |
2215 // Ensure the size is at least the min bounds. | |
2216 newSize = newSize.expandedTo(m_minAutoSize); | |
2217 | |
2218 // Bound the dimensions by the max bounds and determine what scrollbars
to show. | |
2219 ScrollbarMode horizonalScrollbarMode = ScrollbarAlwaysOff; | |
2220 if (newSize.width() > m_maxAutoSize.width()) { | |
2221 newSize.setWidth(m_maxAutoSize.width()); | |
2222 horizonalScrollbarMode = ScrollbarAlwaysOn; | |
2223 } | |
2224 ScrollbarMode verticalScrollbarMode = ScrollbarAlwaysOff; | |
2225 if (newSize.height() > m_maxAutoSize.height()) { | |
2226 newSize.setHeight(m_maxAutoSize.height()); | |
2227 verticalScrollbarMode = ScrollbarAlwaysOn; | |
2228 } | |
2229 | |
2230 if (newSize == size) | |
2231 continue; | |
2232 | |
2233 // While loading only allow the size to increase (to avoid twitching dur
ing intermediate smaller states) | |
2234 // unless autoresize has just been turned on or the maximum size is smal
ler than the current size. | |
2235 if (m_didRunAutosize && size.height() <= m_maxAutoSize.height() && size.
width() <= m_maxAutoSize.width() | |
2236 && !m_frame->document()->loadEventFinished() && (newSize.height() <
size.height() || newSize.width() < size.width())) | |
2237 break; | |
2238 | |
2239 resize(newSize.width(), newSize.height()); | |
2240 // Force the scrollbar state to avoid the scrollbar code adding them and
causing them to be needed. For example, | |
2241 // a vertical scrollbar may cause text to wrap and thus increase the hei
ght (which is the only reason the scollbar is needed). | |
2242 setVerticalScrollbarLock(false); | |
2243 setHorizontalScrollbarLock(false); | |
2244 setScrollbarModes(horizonalScrollbarMode, verticalScrollbarMode, true, t
rue); | |
2245 } | |
2246 m_didRunAutosize = true; | |
2247 } | |
2248 | |
2249 void FrameView::updateOverflowStatus(bool horizontalOverflow, bool verticalOverf
low) | 2272 void FrameView::updateOverflowStatus(bool horizontalOverflow, bool verticalOverf
low) |
2250 { | 2273 { |
2251 if (!m_viewportRenderer) | 2274 if (!m_viewportRenderer) |
2252 return; | 2275 return; |
2253 | 2276 |
2254 if (m_overflowStatusDirty) { | 2277 if (m_overflowStatusDirty) { |
2255 m_horizontalOverflow = horizontalOverflow; | 2278 m_horizontalOverflow = horizontalOverflow; |
2256 m_verticalOverflow = verticalOverflow; | 2279 m_verticalOverflow = verticalOverflow; |
2257 m_overflowStatusDirty = false; | 2280 m_overflowStatusDirty = false; |
2258 return; | 2281 return; |
(...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2893 for (Frame* child = m_frame->tree().firstChild(); child; child = child->tree
().nextSibling()) { | 2916 for (Frame* child = m_frame->tree().firstChild(); child; child = child->tree
().nextSibling()) { |
2894 if (!child->isLocalFrame()) | 2917 if (!child->isLocalFrame()) |
2895 continue; | 2918 continue; |
2896 | 2919 |
2897 toLocalFrame(child)->view()->invalidateTreeIfNeededRecursive(); | 2920 toLocalFrame(child)->view()->invalidateTreeIfNeededRecursive(); |
2898 } | 2921 } |
2899 } | 2922 } |
2900 | 2923 |
2901 void FrameView::enableAutoSizeMode(bool enable, const IntSize& minSize, const In
tSize& maxSize) | 2924 void FrameView::enableAutoSizeMode(bool enable, const IntSize& minSize, const In
tSize& maxSize) |
2902 { | 2925 { |
2903 ASSERT(!enable || !minSize.isEmpty()); | 2926 ensureAutoSizeData().enableAutoSizeMode(enable, minSize, maxSize); |
2904 ASSERT(minSize.width() <= maxSize.width()); | |
2905 ASSERT(minSize.height() <= maxSize.height()); | |
2906 | |
2907 if (m_shouldAutoSize == enable && m_minAutoSize == minSize && m_maxAutoSize
== maxSize) | |
2908 return; | |
2909 | |
2910 | |
2911 m_shouldAutoSize = enable; | |
2912 m_minAutoSize = minSize; | |
2913 m_maxAutoSize = maxSize; | |
2914 m_didRunAutosize = false; | |
2915 | |
2916 setLayoutSizeFixedToFrameSize(enable); | |
2917 setNeedsLayout(); | |
2918 scheduleRelayout(); | |
2919 if (m_shouldAutoSize) | |
2920 return; | |
2921 | |
2922 // Since autosize mode forces the scrollbar mode, change them to being auto. | |
2923 setVerticalScrollbarLock(false); | |
2924 setHorizontalScrollbarLock(false); | |
2925 setScrollbarModes(ScrollbarAuto, ScrollbarAuto); | |
2926 } | 2927 } |
2927 | 2928 |
2928 void FrameView::forceLayout(bool allowSubtree) | 2929 void FrameView::forceLayout(bool allowSubtree) |
2929 { | 2930 { |
2930 layout(allowSubtree); | 2931 layout(allowSubtree); |
2931 } | 2932 } |
2932 | 2933 |
2933 void FrameView::forceLayoutForPagination(const FloatSize& pageSize, const FloatS
ize& originalPageSize, float maximumShrinkFactor) | 2934 void FrameView::forceLayoutForPagination(const FloatSize& pageSize, const FloatS
ize& originalPageSize, float maximumShrinkFactor) |
2934 { | 2935 { |
2935 // Dumping externalRepresentation(m_frame->renderer()).ascii() is a good tri
ck to see | 2936 // Dumping externalRepresentation(m_frame->renderer()).ascii() is a good tri
ck to see |
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3288 void FrameView::willRemoveScrollbar(Scrollbar* scrollbar, ScrollbarOrientation o
rientation) | 3289 void FrameView::willRemoveScrollbar(Scrollbar* scrollbar, ScrollbarOrientation o
rientation) |
3289 { | 3290 { |
3290 ScrollableArea::willRemoveScrollbar(scrollbar, orientation); | 3291 ScrollableArea::willRemoveScrollbar(scrollbar, orientation); |
3291 if (AXObjectCache* cache = axObjectCache()) { | 3292 if (AXObjectCache* cache = axObjectCache()) { |
3292 cache->remove(scrollbar); | 3293 cache->remove(scrollbar); |
3293 cache->handleScrollbarUpdate(this); | 3294 cache->handleScrollbarUpdate(this); |
3294 } | 3295 } |
3295 } | 3296 } |
3296 | 3297 |
3297 } // namespace blink | 3298 } // namespace blink |
OLD | NEW |