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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
90 , m_isTrackingPaintInvalidations(false) | 90 , m_isTrackingPaintInvalidations(false) |
91 , m_hasSoftwareFilters(false) | 91 , m_hasSoftwareFilters(false) |
92 , m_visibleContentScaleFactor(1) | 92 , m_visibleContentScaleFactor(1) |
93 , m_inputEventsScaleFactorForEmulation(1) | 93 , m_inputEventsScaleFactorForEmulation(1) |
94 , m_layoutSizeFixedToFrameSize(true) | 94 , m_layoutSizeFixedToFrameSize(true) |
95 , m_didScrollTimer(this, &FrameView::didScrollTimerFired) | 95 , m_didScrollTimer(this, &FrameView::didScrollTimerFired) |
96 , m_needsUpdateWidgetPositions(false) | 96 , m_needsUpdateWidgetPositions(false) |
97 { | 97 { |
98 ASSERT(m_frame); | 98 ASSERT(m_frame); |
99 init(); | 99 init(); |
100 | |
101 ScrollableArea::setVerticalScrollElasticity(ScrollElasticityAllowed); | |
102 ScrollableArea::setHorizontalScrollElasticity(ScrollElasticityAllowed); | |
103 } | 100 } |
104 | 101 |
105 PassRefPtr<FrameView> FrameView::create(LocalFrame* frame) | 102 PassRefPtr<FrameView> FrameView::create(LocalFrame* frame) |
106 { | 103 { |
107 RefPtr<FrameView> view = adoptRef(new FrameView(frame)); | 104 RefPtr<FrameView> view = adoptRef(new FrameView(frame)); |
108 view->show(); | 105 view->show(); |
109 return view.release(); | 106 return view.release(); |
110 } | 107 } |
111 | 108 |
112 PassRefPtr<FrameView> FrameView::create(LocalFrame* frame, const IntSize& initia lSize) | 109 PassRefPtr<FrameView> FrameView::create(LocalFrame* frame, const IntSize& initia lSize) |
113 { | 110 { |
114 RefPtr<FrameView> view = adoptRef(new FrameView(frame)); | 111 RefPtr<FrameView> view = adoptRef(new FrameView(frame)); |
115 view->Widget::setFrameRect(IntRect(view->location(), initialSize)); | 112 view->Widget::setFrameRect(IntRect(view->location(), initialSize)); |
116 view->setLayoutSizeInternal(initialSize); | 113 view->setLayoutSizeInternal(initialSize); |
117 | 114 |
118 view->show(); | 115 view->show(); |
119 return view.release(); | 116 return view.release(); |
120 } | 117 } |
121 | 118 |
122 FrameView::~FrameView() | 119 FrameView::~FrameView() |
123 { | 120 { |
124 if (m_postLayoutTasksTimer.isActive()) | 121 if (m_postLayoutTasksTimer.isActive()) |
125 m_postLayoutTasksTimer.stop(); | 122 m_postLayoutTasksTimer.stop(); |
126 | 123 |
127 if (m_didScrollTimer.isActive()) | 124 if (m_didScrollTimer.isActive()) |
128 m_didScrollTimer.stop(); | 125 m_didScrollTimer.stop(); |
129 | 126 |
130 resetScrollbars(); | |
131 | |
132 // Custom scrollbars should already be destroyed at this point | |
133 ASSERT(!horizontalScrollbar() || !horizontalScrollbar()->isCustomScrollbar() ); | |
134 ASSERT(!verticalScrollbar() || !verticalScrollbar()->isCustomScrollbar()); | |
135 | |
136 setHasHorizontalScrollbar(false); // Remove native scrollbars now before we lose the connection to the HostWindow. | |
137 setHasVerticalScrollbar(false); | |
138 | |
139 ASSERT(m_frame); | 127 ASSERT(m_frame); |
140 ASSERT(m_frame->view() != this || !m_frame->contentRenderer()); | 128 ASSERT(m_frame->view() != this || !m_frame->contentRenderer()); |
141 // FIXME: Do we need to do something here for OOPI? | 129 // FIXME: Do we need to do something here for OOPI? |
142 } | 130 } |
143 | 131 |
144 void FrameView::reset() | 132 void FrameView::reset() |
145 { | 133 { |
146 m_hasPendingLayout = false; | 134 m_hasPendingLayout = false; |
147 m_layoutSubtreeRoot = 0; | 135 m_layoutSubtreeRoot = 0; |
148 m_doFullPaintInvalidation = false; | 136 m_doFullPaintInvalidation = false; |
(...skipping 10 matching lines...) Expand all Loading... | |
159 m_lastViewportSize = IntSize(); | 147 m_lastViewportSize = IntSize(); |
160 m_lastZoomFactor = 1.0f; | 148 m_lastZoomFactor = 1.0f; |
161 m_isTrackingPaintInvalidations = false; | 149 m_isTrackingPaintInvalidations = false; |
162 m_trackedPaintInvalidationRects.clear(); | 150 m_trackedPaintInvalidationRects.clear(); |
163 m_lastPaintTime = 0; | 151 m_lastPaintTime = 0; |
164 m_paintBehavior = PaintBehaviorNormal; | 152 m_paintBehavior = PaintBehaviorNormal; |
165 m_isPainting = false; | 153 m_isPainting = false; |
166 m_viewportConstrainedObjects.clear(); | 154 m_viewportConstrainedObjects.clear(); |
167 } | 155 } |
168 | 156 |
169 void FrameView::resetScrollbars() | |
170 { | |
171 // Reset the document's scrollbars back to our defaults before we yield the floor. | |
172 m_firstLayout = true; | |
173 setScrollbarsSuppressed(true); | |
174 if (m_canHaveScrollbars) | |
175 setScrollbarModes(ScrollbarAuto, ScrollbarAuto); | |
176 else | |
177 setScrollbarModes(ScrollbarAlwaysOff, ScrollbarAlwaysOff); | |
178 setScrollbarsSuppressed(false); | |
179 } | |
180 | |
181 void FrameView::init() | 157 void FrameView::init() |
182 { | 158 { |
183 reset(); | 159 reset(); |
184 | 160 |
185 m_size = LayoutSize(); | 161 m_size = LayoutSize(); |
186 } | 162 } |
187 | 163 |
188 void FrameView::prepareForDetach() | 164 void FrameView::prepareForDetach() |
189 { | 165 { |
190 RELEASE_ASSERT(!isInPerformLayout()); | 166 // FIXME(sky): Remove |
191 | |
192 if (ScrollAnimator* scrollAnimator = existingScrollAnimator()) | |
193 scrollAnimator->cancelAnimations(); | |
194 cancelProgrammaticScrollAnimation(); | |
195 | |
196 if (m_frame->page()) { | |
197 if (ScrollingCoordinator* scrollingCoordinator = m_frame->page()->scroll ingCoordinator()) | |
198 scrollingCoordinator->willDestroyScrollableArea(this); | |
199 } | |
200 } | 167 } |
201 | 168 |
202 void FrameView::recalculateScrollbarOverlayStyle() | 169 void FrameView::recalculateScrollbarOverlayStyle() |
203 { | 170 { |
204 ScrollbarOverlayStyle oldOverlayStyle = scrollbarOverlayStyle(); | 171 // FIXME(sky): Remove. |
205 ScrollbarOverlayStyle overlayStyle = ScrollbarOverlayStyleDefault; | |
206 | |
207 Color backgroundColor = documentBackgroundColor(); | |
208 // Reduce the background color from RGB to a lightness value | |
209 // and determine which scrollbar style to use based on a lightness | |
210 // heuristic. | |
211 double hue, saturation, lightness; | |
212 backgroundColor.getHSL(hue, saturation, lightness); | |
213 if (lightness <= .5) | |
214 overlayStyle = ScrollbarOverlayStyleLight; | |
215 | |
216 if (oldOverlayStyle != overlayStyle) | |
217 setScrollbarOverlayStyle(overlayStyle); | |
218 } | 172 } |
219 | 173 |
220 void FrameView::clear() | 174 void FrameView::clear() |
221 { | 175 { |
222 reset(); | 176 reset(); |
223 setScrollbarsSuppressed(true); | |
224 } | 177 } |
225 | 178 |
226 bool FrameView::didFirstLayout() const | 179 bool FrameView::didFirstLayout() const |
227 { | 180 { |
228 return !m_firstLayout; | 181 return !m_firstLayout; |
229 } | 182 } |
230 | 183 |
231 void FrameView::invalidateRect(const IntRect& rect) | 184 void FrameView::invalidateRect(const IntRect& rect) |
232 { | 185 { |
233 // For querying RenderLayer::compositingState() when invalidating scrollbars . | 186 // For querying RenderLayer::compositingState() when invalidating scrollbars . |
234 // FIXME: do all scrollbar invalidations after layout of all frames is compl ete. It's currently not recursively true. | 187 // FIXME: do all scrollbar invalidations after layout of all frames is compl ete. It's currently not recursively true. |
235 DisableCompositingQueryAsserts disabler; | 188 DisableCompositingQueryAsserts disabler; |
236 if (!parent()) { | 189 if (!parent()) { |
237 if (HostWindow* window = hostWindow()) | 190 if (HostWindow* window = hostWindow()) |
238 window->invalidateContentsAndRootView(rect); | 191 window->invalidateContentsAndRootView(rect); |
239 return; | 192 return; |
240 } | 193 } |
241 } | 194 } |
242 | 195 |
243 void FrameView::setFrameRect(const IntRect& newRect) | 196 void FrameView::setFrameRect(const IntRect& newRect) |
244 { | 197 { |
245 IntRect oldRect = frameRect(); | 198 IntRect oldRect = frameRect(); |
246 if (newRect == oldRect) | 199 if (newRect == oldRect) |
247 return; | 200 return; |
248 | 201 |
249 ScrollView::setFrameRect(newRect); | 202 Widget::setFrameRect(newRect); |
250 | 203 |
251 if (RenderView* renderView = this->renderView()) { | 204 if (RenderView* renderView = this->renderView()) { |
252 if (renderView->usesCompositing()) | 205 if (renderView->usesCompositing()) |
253 renderView->compositor()->frameViewDidChangeSize(); | 206 renderView->compositor()->frameViewDidChangeSize(); |
254 } | 207 } |
255 | 208 |
256 viewportConstrainedVisibleContentSizeChanged(newRect.width() != oldRect.widt h(), newRect.height() != oldRect.height()); | 209 viewportConstrainedVisibleContentSizeChanged(newRect.width() != oldRect.widt h(), newRect.height() != oldRect.height()); |
257 | 210 |
258 if (oldRect.size() != newRect.size() | 211 if (oldRect.size() != newRect.size() |
259 && m_frame->settings()->pinchVirtualViewportEnabled()) | 212 && m_frame->settings()->pinchVirtualViewportEnabled()) |
260 page()->frameHost().pinchViewport().mainFrameDidChangeSize(); | 213 page()->frameHost().pinchViewport().mainFrameDidChangeSize(); |
261 } | 214 } |
262 | 215 |
263 Page* FrameView::page() const | 216 Page* FrameView::page() const |
264 { | 217 { |
265 return frame().page(); | 218 return frame().page(); |
266 } | 219 } |
267 | 220 |
268 RenderView* FrameView::renderView() const | 221 RenderView* FrameView::renderView() const |
269 { | 222 { |
270 return frame().contentRenderer(); | 223 return frame().contentRenderer(); |
271 } | 224 } |
272 | 225 |
273 void FrameView::setCanHaveScrollbars(bool canHaveScrollbars) | 226 void FrameView::setCanHaveScrollbars(bool canHaveScrollbars) |
274 { | 227 { |
275 m_canHaveScrollbars = canHaveScrollbars; | 228 // FIXME(sky): Remove |
276 ScrollView::setCanHaveScrollbars(canHaveScrollbars); | |
277 } | 229 } |
278 | 230 |
279 void FrameView::setContentsSize(const IntSize& size) | 231 void FrameView::setContentsSize(const IntSize&) |
280 { | 232 { |
281 if (size == contentsSize()) | 233 // FIXME(sky): Remove |
282 return; | |
283 | |
284 ScrollView::setContentsSize(size); | |
285 ScrollView::contentsResized(); | |
286 } | 234 } |
287 | 235 |
288 IntPoint FrameView::clampOffsetAtScale(const IntPoint& offset, float scale) cons t | 236 IntPoint FrameView::clampOffsetAtScale(const IntPoint& offset, float scale) cons t |
289 { | 237 { |
290 IntPoint maxScrollExtent(contentsSize().width() - scrollOrigin().x(), conten tsSize().height() - scrollOrigin().y()); | |
291 FloatSize scaledSize = unscaledVisibleContentSize(); | 238 FloatSize scaledSize = unscaledVisibleContentSize(); |
292 if (scale) | 239 if (scale) |
293 scaledSize.scale(1 / scale); | 240 scaledSize.scale(1 / scale); |
294 | 241 |
295 IntPoint clampedOffset = offset; | 242 IntPoint clampedOffset = offset; |
296 clampedOffset = clampedOffset.shrunkTo(maxScrollExtent - expandedIntSize(sca ledSize)); | 243 clampedOffset = clampedOffset.shrunkTo( |
244 IntPoint(size()) - expandedIntSize(scaledSize)); | |
297 clampedOffset = clampedOffset.expandedTo(-scrollOrigin()); | 245 clampedOffset = clampedOffset.expandedTo(-scrollOrigin()); |
298 | 246 |
299 return clampedOffset; | 247 return clampedOffset; |
300 } | 248 } |
301 | 249 |
302 void FrameView::adjustViewSize() | 250 void FrameView::adjustViewSize() |
303 { | 251 { |
304 RenderView* renderView = this->renderView(); | 252 RenderView* renderView = this->renderView(); |
305 if (!renderView) | 253 if (!renderView) |
306 return; | 254 return; |
307 | 255 |
308 ASSERT(m_frame->view() == this); | 256 ASSERT(m_frame->view() == this); |
309 | 257 |
310 const IntRect rect = renderView->documentRect(); | 258 const IntRect rect = renderView->documentRect(); |
311 const IntSize& size = rect.size(); | 259 const IntSize& size = rect.size(); |
312 ScrollView::setScrollOrigin(IntPoint(-rect.x(), -rect.y()), true, size == co ntentsSize()); | |
313 | |
314 setContentsSize(size); | 260 setContentsSize(size); |
315 } | 261 } |
316 | 262 |
317 void FrameView::applyOverflowToViewportAndSetRenderer(RenderObject* o, Scrollbar Mode& hMode, ScrollbarMode& vMode) | 263 void FrameView::applyOverflowToViewportAndSetRenderer(RenderObject* o, Scrollbar Mode& hMode, ScrollbarMode& vMode) |
318 { | 264 { |
319 // Handle the overflow:hidden/scroll case for the body/html elements. WinIE treats | 265 // Handle the overflow:hidden/scroll case for the body/html elements. WinIE treats |
320 // overflow:hidden and overflow:scroll on <body> as applying to the document 's | 266 // overflow:hidden and overflow:scroll on <body> as applying to the document 's |
321 // scrollbars. The CSS2.1 draft states that HTML UAs should use the <html> or <body> element and XML/XHTML UAs should | 267 // scrollbars. The CSS2.1 draft states that HTML UAs should use the <html> or <body> element and XML/XHTML UAs should |
322 // use the root element. | 268 // use the root element. |
323 | 269 |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
389 void FrameView::recalcOverflowAfterStyleChange() | 335 void FrameView::recalcOverflowAfterStyleChange() |
390 { | 336 { |
391 RenderView* renderView = this->renderView(); | 337 RenderView* renderView = this->renderView(); |
392 RELEASE_ASSERT(renderView); | 338 RELEASE_ASSERT(renderView); |
393 if (!renderView->needsOverflowRecalcAfterStyleChange()) | 339 if (!renderView->needsOverflowRecalcAfterStyleChange()) |
394 return; | 340 return; |
395 | 341 |
396 renderView->recalcOverflowAfterStyleChange(); | 342 renderView->recalcOverflowAfterStyleChange(); |
397 | 343 |
398 IntRect documentRect = renderView->documentRect(); | 344 IntRect documentRect = renderView->documentRect(); |
399 if (scrollOrigin() == -documentRect.location() && contentsSize() == document Rect.size()) | 345 if (size() == documentRect.size()) |
400 return; | 346 return; |
401 | 347 |
402 if (needsLayout()) | 348 if (needsLayout()) |
403 return; | 349 return; |
404 | 350 |
405 InUpdateScrollbarsScope inUpdateScrollbarsScope(this); | |
406 | |
407 bool shouldHaveHorizontalScrollbar = false; | |
408 bool shouldHaveVerticalScrollbar = false; | |
409 computeScrollbarExistence(shouldHaveHorizontalScrollbar, shouldHaveVerticalS crollbar, documentRect.size()); | |
410 | |
411 bool hasHorizontalScrollbar = horizontalScrollbar(); | |
412 bool hasVerticalScrollbar = verticalScrollbar(); | |
413 if (hasHorizontalScrollbar != shouldHaveHorizontalScrollbar | |
414 || hasVerticalScrollbar != shouldHaveVerticalScrollbar) { | |
415 setNeedsLayout(); | |
416 return; | |
417 } | |
418 | |
419 adjustViewSize(); | 351 adjustViewSize(); |
420 updateScrollbarGeometry(); | |
421 } | 352 } |
422 | 353 |
423 bool FrameView::usesCompositedScrolling() const | 354 bool FrameView::usesCompositedScrolling() const |
424 { | 355 { |
425 RenderView* renderView = this->renderView(); | 356 RenderView* renderView = this->renderView(); |
426 if (!renderView) | 357 if (!renderView) |
427 return false; | 358 return false; |
428 if (m_frame->settings() && m_frame->settings()->preferCompositingToLCDTextEn abled()) | 359 if (m_frame->settings() && m_frame->settings()->preferCompositingToLCDTextEn abled()) |
429 return renderView->compositor()->inCompositingMode(); | 360 return renderView->compositor()->inCompositingMode(); |
430 return false; | 361 return false; |
(...skipping 24 matching lines...) Expand all Loading... | |
455 } | 386 } |
456 | 387 |
457 GraphicsLayer* FrameView::layerForScrollCorner() const | 388 GraphicsLayer* FrameView::layerForScrollCorner() const |
458 { | 389 { |
459 RenderView* renderView = this->renderView(); | 390 RenderView* renderView = this->renderView(); |
460 if (!renderView) | 391 if (!renderView) |
461 return 0; | 392 return 0; |
462 return renderView->compositor()->layerForScrollCorner(); | 393 return renderView->compositor()->layerForScrollCorner(); |
463 } | 394 } |
464 | 395 |
396 IntRect FrameView::contentsToScreen(const IntRect& rect) const | |
397 { | |
398 HostWindow* window = hostWindow(); | |
399 if (!window) | |
400 return IntRect(); | |
401 return window->rootViewToScreen(contentsToRootView(rect)); | |
402 } | |
403 | |
404 bool FrameView::scheduleAnimation() | |
405 { | |
406 if (HostWindow* window = hostWindow()) { | |
407 window->scheduleAnimation(); | |
408 return true; | |
409 } | |
410 return false; | |
411 } | |
412 | |
465 bool FrameView::isEnclosedInCompositingLayer() const | 413 bool FrameView::isEnclosedInCompositingLayer() const |
466 { | 414 { |
467 return false; | 415 return false; |
468 } | 416 } |
469 | 417 |
470 RenderObject* FrameView::layoutRoot(bool onlyDuringLayout) const | 418 RenderObject* FrameView::layoutRoot(bool onlyDuringLayout) const |
471 { | 419 { |
472 return onlyDuringLayout && layoutPending() ? 0 : m_layoutSubtreeRoot; | 420 return onlyDuringLayout && layoutPending() ? 0 : m_layoutSubtreeRoot; |
473 } | 421 } |
474 | 422 |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
602 return; | 550 return; |
603 } | 551 } |
604 | 552 |
605 FontCachePurgePreventer fontCachePurgePreventer; | 553 FontCachePurgePreventer fontCachePurgePreventer; |
606 RenderLayer* layer; | 554 RenderLayer* layer; |
607 { | 555 { |
608 TemporaryChange<bool> changeSchedulingEnabled(m_layoutSchedulingEnabled, false); | 556 TemporaryChange<bool> changeSchedulingEnabled(m_layoutSchedulingEnabled, false); |
609 | 557 |
610 m_nestedLayoutCount++; | 558 m_nestedLayoutCount++; |
611 | 559 |
612 ScrollbarMode hMode; | |
613 ScrollbarMode vMode; | |
614 calculateScrollbarModesForLayoutAndSetViewportRenderer(hMode, vMode); | |
615 | |
616 if (!inSubtreeLayout) { | 560 if (!inSubtreeLayout) { |
617 // Now set our scrollbar state for the layout. | |
618 ScrollbarMode currentHMode = horizontalScrollbarMode(); | |
619 ScrollbarMode currentVMode = verticalScrollbarMode(); | |
620 | |
621 if (m_firstLayout) { | 561 if (m_firstLayout) { |
622 setScrollbarsSuppressed(true); | |
623 | |
624 m_doFullPaintInvalidation = true; | 562 m_doFullPaintInvalidation = true; |
625 m_firstLayout = false; | 563 m_firstLayout = false; |
626 m_firstLayoutCallbackPending = true; | 564 m_firstLayoutCallbackPending = true; |
627 m_lastViewportSize = layoutSize(IncludeScrollbars); | 565 m_lastViewportSize = layoutSize(IncludeScrollbars); |
628 m_lastZoomFactor = rootForThisLayout->style()->zoom(); | 566 m_lastZoomFactor = rootForThisLayout->style()->zoom(); |
629 | |
630 // Set the initial vMode to AlwaysOn if we're auto. | |
631 if (vMode == ScrollbarAuto) | |
632 setVerticalScrollbarMode(ScrollbarAlwaysOn); // This causes a vertical scrollbar to appear. | |
633 // Set the initial hMode to AlwaysOff if we're auto. | |
634 if (hMode == ScrollbarAuto) | |
635 setHorizontalScrollbarMode(ScrollbarAlwaysOff); // This caus es a horizontal scrollbar to disappear. | |
636 | |
637 setScrollbarModes(hMode, vMode); | |
638 setScrollbarsSuppressed(false, true); | |
639 } else if (hMode != currentHMode || vMode != currentVMode) { | |
640 setScrollbarModes(hMode, vMode); | |
641 } | 567 } |
642 | 568 |
643 m_size = LayoutSize(layoutSize().width(), layoutSize().height()); | 569 m_size = LayoutSize(layoutSize().width(), layoutSize().height()); |
644 | 570 |
645 // We need to set m_doFullPaintInvalidation before triggering layout as RenderObject::checkForPaintInvalidation | 571 // We need to set m_doFullPaintInvalidation before triggering layout as RenderObject::checkForPaintInvalidation |
646 // checks the boolean to disable local paint invalidations. | 572 // checks the boolean to disable local paint invalidations. |
647 m_doFullPaintInvalidation |= renderView()->shouldDoFullPaintInvalida tionForNextLayout(); | 573 m_doFullPaintInvalidation |= renderView()->shouldDoFullPaintInvalida tionForNextLayout(); |
648 } | 574 } |
649 | 575 |
650 layer = rootForThisLayout->enclosingLayer(); | 576 layer = rootForThisLayout->enclosingLayer(); |
(...skipping 14 matching lines...) Expand all Loading... | |
665 layer->updateLayerPositionsAfterLayout(); | 591 layer->updateLayerPositionsAfterLayout(); |
666 | 592 |
667 if (m_doFullPaintInvalidation) | 593 if (m_doFullPaintInvalidation) |
668 renderView()->compositor()->fullyInvalidatePaint(); | 594 renderView()->compositor()->fullyInvalidatePaint(); |
669 renderView()->compositor()->didLayout(); | 595 renderView()->compositor()->didLayout(); |
670 | 596 |
671 m_layoutCount++; | 597 m_layoutCount++; |
672 | 598 |
673 ASSERT(!rootForThisLayout->needsLayout()); | 599 ASSERT(!rootForThisLayout->needsLayout()); |
674 | 600 |
675 if (document->hasListenerType(Document::OVERFLOWCHANGED_LISTENER)) | 601 if (document->hasListenerType(Document::OVERFLOWCHANGED_LISTENER)) { |
676 updateOverflowStatus(layoutSize().width() < contentsWidth(), layoutSize( ).height() < contentsHeight()); | 602 updateOverflowStatus(layoutSize().width() < width(), |
603 layoutSize().height() < height()); | |
604 } | |
677 | 605 |
678 scheduleOrPerformPostLayoutTasks(); | 606 scheduleOrPerformPostLayoutTasks(); |
679 | 607 |
680 TRACE_EVENT_END1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Layout", " endData", InspectorLayoutEvent::endData(rootForThisLayout)); | 608 TRACE_EVENT_END1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Layout", " endData", InspectorLayoutEvent::endData(rootForThisLayout)); |
681 | 609 |
682 m_nestedLayoutCount--; | 610 m_nestedLayoutCount--; |
683 if (m_nestedLayoutCount) | 611 if (m_nestedLayoutCount) |
684 return; | 612 return; |
685 | 613 |
686 #if ENABLE(ASSERT) | 614 #if ENABLE(ASSERT) |
(...skipping 20 matching lines...) Expand all Loading... | |
707 ASSERT(renderView()); | 635 ASSERT(renderView()); |
708 RenderView& rootForPaintInvalidation = *renderView(); | 636 RenderView& rootForPaintInvalidation = *renderView(); |
709 ASSERT(!rootForPaintInvalidation.needsLayout()); | 637 ASSERT(!rootForPaintInvalidation.needsLayout()); |
710 | 638 |
711 TRACE_EVENT1("blink", "FrameView::invalidateTree", "root", rootForPaintInval idation.debugName().ascii()); | 639 TRACE_EVENT1("blink", "FrameView::invalidateTree", "root", rootForPaintInval idation.debugName().ascii()); |
712 | 640 |
713 PaintInvalidationState rootPaintInvalidationState(rootForPaintInvalidation); | 641 PaintInvalidationState rootPaintInvalidationState(rootForPaintInvalidation); |
714 | 642 |
715 rootForPaintInvalidation.invalidateTreeIfNeeded(rootPaintInvalidationState); | 643 rootForPaintInvalidation.invalidateTreeIfNeeded(rootPaintInvalidationState); |
716 | 644 |
717 // Invalidate the paint of the frameviews scrollbars if needed | |
718 if (hasVerticalBarDamage()) | |
719 invalidateRect(verticalBarDamage()); | |
720 if (hasHorizontalBarDamage()) | |
721 invalidateRect(horizontalBarDamage()); | |
722 resetScrollbarDamage(); | |
723 | |
724 m_doFullPaintInvalidation = false; | 645 m_doFullPaintInvalidation = false; |
725 #ifndef NDEBUG | 646 #ifndef NDEBUG |
726 renderView()->assertSubtreeClearedPaintInvalidationState(); | 647 renderView()->assertSubtreeClearedPaintInvalidationState(); |
727 #endif | 648 #endif |
728 | 649 |
729 if (m_frame->selection().isCaretBoundsDirty()) | 650 if (m_frame->selection().isCaretBoundsDirty()) |
730 m_frame->selection().invalidateCaretRect(); | 651 m_frame->selection().invalidateCaretRect(); |
731 } | 652 } |
732 | 653 |
733 DocumentLifecycle& FrameView::lifecycle() const | 654 DocumentLifecycle& FrameView::lifecycle() const |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
916 } | 837 } |
917 | 838 |
918 bool FrameView::shouldSetCursor() const | 839 bool FrameView::shouldSetCursor() const |
919 { | 840 { |
920 Page* page = frame().page(); | 841 Page* page = frame().page(); |
921 return page && page->visibilityState() != PageVisibilityStateHidden && page- >focusController().isActive() && page->settings().deviceSupportsMouse(); | 842 return page && page->visibilityState() != PageVisibilityStateHidden && page- >focusController().isActive() && page->settings().deviceSupportsMouse(); |
922 } | 843 } |
923 | 844 |
924 void FrameView::scrollContentsIfNeededRecursive() | 845 void FrameView::scrollContentsIfNeededRecursive() |
925 { | 846 { |
926 scrollContentsIfNeeded(); | 847 // FIXME(sky): Remove |
927 } | 848 } |
928 | 849 |
929 void FrameView::scrollContentsIfNeeded() | 850 void FrameView::scrollContentsIfNeeded() |
930 { | 851 { |
931 bool didScroll = !pendingScrollDelta().isZero(); | 852 // FIXME(sky): Remove |
932 ScrollView::scrollContentsIfNeeded(); | |
933 if (didScroll) | |
934 updateFixedElementPaintInvalidationRectsAfterScroll(); | |
935 } | 853 } |
936 | 854 |
937 bool FrameView::scrollContentsFastPath(const IntSize& scrollDelta) | 855 bool FrameView::scrollContentsFastPath(const IntSize& scrollDelta) |
938 { | 856 { |
939 if (!contentsInCompositedLayer() || hasSlowRepaintObjects()) | 857 if (!contentsInCompositedLayer() || hasSlowRepaintObjects()) |
940 return false; | 858 return false; |
941 | 859 |
942 if (!m_viewportConstrainedObjects || m_viewportConstrainedObjects->isEmpty() ) | 860 if (!m_viewportConstrainedObjects || m_viewportConstrainedObjects->isEmpty() ) |
943 return true; | 861 return true; |
944 | 862 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
988 updateRect.unite(scrolledRect); | 906 updateRect.unite(scrolledRect); |
989 // FIXME: We should be able to issue these invalidations separately and before we actually scroll. | 907 // FIXME: We should be able to issue these invalidations separately and before we actually scroll. |
990 renderView()->layer()->paintInvalidator().setBackingNeedsPaintInvalidati onInRect(rootViewToContents(updateRect)); | 908 renderView()->layer()->paintInvalidator().setBackingNeedsPaintInvalidati onInRect(rootViewToContents(updateRect)); |
991 } | 909 } |
992 | 910 |
993 return true; | 911 return true; |
994 } | 912 } |
995 | 913 |
996 void FrameView::scrollContentsSlowPath(const IntRect& updateRect) | 914 void FrameView::scrollContentsSlowPath(const IntRect& updateRect) |
997 { | 915 { |
998 if (contentsInCompositedLayer()) { | 916 // FIXME(sky): Remove |
999 IntRect updateRect = visibleContentRect(); | |
1000 ASSERT(renderView()); | |
1001 renderView()->layer()->paintInvalidator().setBackingNeedsPaintInvalidati onInRect(updateRect); | |
1002 } | |
1003 ScrollView::scrollContentsSlowPath(updateRect); | |
1004 } | 917 } |
1005 | 918 |
1006 void FrameView::restoreScrollbar() | 919 void FrameView::restoreScrollbar() |
1007 { | 920 { |
1008 setScrollbarsSuppressed(false); | 921 // FIXME(sky): Remove |
1009 } | 922 } |
1010 | 923 |
1011 void FrameView::scrollElementToRect(Element* element, const IntRect& rect) | 924 void FrameView::scrollElementToRect(Element* element, const IntRect& rect) |
1012 { | 925 { |
1013 // FIXME(http://crbug.com/371896) - This method shouldn't be manually doing | 926 // FIXME(http://crbug.com/371896) - This method shouldn't be manually doing |
1014 // coordinate transformations to the PinchViewport. | 927 // coordinate transformations to the PinchViewport. |
1015 IntRect targetRect(rect); | 928 IntRect targetRect(rect); |
1016 | 929 |
1017 m_frame->document()->updateLayoutIgnorePendingStylesheets(); | 930 m_frame->document()->updateLayoutIgnorePendingStylesheets(); |
1018 | 931 |
(...skipping 18 matching lines...) Expand all Loading... | |
1037 setScrollPosition(targetOffset); | 950 setScrollPosition(targetOffset); |
1038 | 951 |
1039 if (pinchVirtualViewportEnabled) { | 952 if (pinchVirtualViewportEnabled) { |
1040 IntPoint remainder = IntPoint(targetOffset - scrollPosition()); | 953 IntPoint remainder = IntPoint(targetOffset - scrollPosition()); |
1041 m_frame->page()->frameHost().pinchViewport().move(remainder); | 954 m_frame->page()->frameHost().pinchViewport().move(remainder); |
1042 } | 955 } |
1043 } | 956 } |
1044 | 957 |
1045 void FrameView::setScrollPosition(const IntPoint& scrollPoint, ScrollBehavior sc rollBehavior) | 958 void FrameView::setScrollPosition(const IntPoint& scrollPoint, ScrollBehavior sc rollBehavior) |
1046 { | 959 { |
1047 cancelProgrammaticScrollAnimation(); | 960 // FIXME(sky): Remove |
1048 TemporaryChange<bool> changeInProgrammaticScroll(m_inProgrammaticScroll, tru e); | |
1049 | |
1050 IntPoint newScrollPosition = adjustScrollPositionWithinRange(scrollPoint); | |
1051 | |
1052 if (newScrollPosition == scrollPosition()) | |
1053 return; | |
1054 | |
1055 if (scrollBehavior == ScrollBehaviorAuto) { | |
1056 RenderObject* renderer = m_frame->document()->documentElement() ? m_fram e->document()->documentElement()->renderer() : 0; | |
1057 if (renderer) | |
1058 scrollBehavior = renderer->style()->scrollBehavior(); | |
1059 else | |
1060 scrollBehavior = ScrollBehaviorInstant; | |
1061 } | |
1062 ScrollView::setScrollPosition(newScrollPosition, scrollBehavior); | |
1063 } | 961 } |
1064 | 962 |
1065 void FrameView::setScrollPositionNonProgrammatically(const IntPoint& scrollPoint ) | 963 void FrameView::setScrollPositionNonProgrammatically(const IntPoint&) |
1066 { | 964 { |
1067 IntPoint newScrollPosition = adjustScrollPositionWithinRange(scrollPoint); | 965 // FIXME(sky): Remove |
1068 | |
1069 if (newScrollPosition == scrollPosition()) | |
1070 return; | |
1071 | |
1072 TemporaryChange<bool> changeInProgrammaticScroll(m_inProgrammaticScroll, fal se); | |
1073 notifyScrollPositionChanged(newScrollPosition); | |
1074 } | 966 } |
1075 | 967 |
1076 IntSize FrameView::layoutSize(IncludeScrollbarsInRect scrollbarInclusion) const | 968 // FIXME(sky): remove |
969 IntSize FrameView::layoutSize(IncludeScrollbarsInRect) const | |
1077 { | 970 { |
1078 return scrollbarInclusion == ExcludeScrollbars ? excludeScrollbars(m_layoutS ize) : m_layoutSize; | 971 return m_layoutSize; |
1079 } | 972 } |
1080 | 973 |
1081 void FrameView::setLayoutSize(const IntSize& size) | 974 void FrameView::setLayoutSize(const IntSize& size) |
1082 { | 975 { |
1083 ASSERT(!layoutSizeFixedToFrameSize()); | 976 ASSERT(!layoutSizeFixedToFrameSize()); |
1084 | 977 |
1085 setLayoutSizeInternal(size); | 978 setLayoutSizeInternal(size); |
1086 } | 979 } |
1087 | 980 |
1088 void FrameView::scrollPositionChanged() | 981 void FrameView::scrollPositionChanged() |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1167 if (!frame || !frame->selection().isCaretOrRange()) { | 1060 if (!frame || !frame->selection().isCaretOrRange()) { |
1168 page->chrome().client().clearCompositedSelectionBounds(); | 1061 page->chrome().client().clearCompositedSelectionBounds(); |
1169 return; | 1062 return; |
1170 } | 1063 } |
1171 | 1064 |
1172 // TODO(jdduke): Compute and route selection bounds through ChromeClient. | 1065 // TODO(jdduke): Compute and route selection bounds through ChromeClient. |
1173 } | 1066 } |
1174 | 1067 |
1175 bool FrameView::isRubberBandInProgress() const | 1068 bool FrameView::isRubberBandInProgress() const |
1176 { | 1069 { |
1177 if (scrollbarsSuppressed()) | 1070 // FIXME(sky): Remove |
1178 return false; | |
1179 | |
1180 // If the main thread updates the scroll position for this FrameView, we sho uld return | |
1181 // ScrollAnimator::isRubberBandInProgress(). | |
1182 if (ScrollAnimator* scrollAnimator = existingScrollAnimator()) | |
1183 return scrollAnimator->isRubberBandInProgress(); | |
1184 | |
1185 return false; | 1071 return false; |
1186 } | 1072 } |
1187 | 1073 |
1188 HostWindow* FrameView::hostWindow() const | 1074 HostWindow* FrameView::hostWindow() const |
1189 { | 1075 { |
1190 Page* page = frame().page(); | 1076 Page* page = frame().page(); |
1191 if (!page) | 1077 if (!page) |
1192 return 0; | 1078 return 0; |
1193 return &page->chrome(); | 1079 return &page->chrome(); |
1194 } | 1080 } |
1195 | 1081 |
1196 void FrameView::contentRectangleForPaintInvalidation(const IntRect& r) | 1082 void FrameView::contentRectangleForPaintInvalidation(const IntRect& r) |
1197 { | 1083 { |
1198 ASSERT(paintInvalidationIsAllowed()); | 1084 ASSERT(paintInvalidationIsAllowed()); |
1199 | 1085 |
1200 if (m_isTrackingPaintInvalidations) { | 1086 if (m_isTrackingPaintInvalidations) { |
1201 IntRect paintInvalidationRect = r; | 1087 IntRect paintInvalidationRect = r; |
1202 paintInvalidationRect.move(-scrollOffset()); | 1088 paintInvalidationRect.move(-scrollOffset()); |
1203 m_trackedPaintInvalidationRects.append(paintInvalidationRect); | 1089 m_trackedPaintInvalidationRects.append(paintInvalidationRect); |
1204 // FIXME: http://crbug.com/368518. Eventually, invalidateContentRectangl eForPaint | 1090 // FIXME: http://crbug.com/368518. Eventually, invalidateContentRectangl eForPaint |
1205 // is going away entirely once all layout tests are FCM. In the short | 1091 // is going away entirely once all layout tests are FCM. In the short |
1206 // term, no code should be tracking non-composited FrameView paint inval idations. | 1092 // term, no code should be tracking non-composited FrameView paint inval idations. |
1207 RELEASE_ASSERT_NOT_REACHED(); | 1093 RELEASE_ASSERT_NOT_REACHED(); |
1208 } | 1094 } |
1209 | 1095 |
1210 ScrollView::contentRectangleForPaintInvalidation(r); | 1096 IntRect paintRect = r; |
1097 if (clipsPaintInvalidations() && !paintsEntireContents()) | |
1098 paintRect.intersect(visibleContentRect()); | |
1099 if (paintRect.isEmpty()) | |
1100 return; | |
1101 | |
1102 if (HostWindow* window = hostWindow()) | |
1103 window->invalidateContentsAndRootView(contentsToWindow(paintRect)); | |
1211 } | 1104 } |
1212 | 1105 |
1213 void FrameView::contentsResized() | 1106 void FrameView::contentsResized() |
1214 { | 1107 { |
1215 ScrollView::contentsResized(); | |
1216 setNeedsLayout(); | 1108 setNeedsLayout(); |
1217 } | 1109 } |
1218 | 1110 |
1219 void FrameView::scrollbarExistenceDidChange() | 1111 void FrameView::scrollbarExistenceDidChange() |
1220 { | 1112 { |
1221 // We check to make sure the view is attached to a frame() as this method ca n | 1113 // We check to make sure the view is attached to a frame() as this method ca n |
1222 // be triggered before the view is attached by LocalFrame::createView(...) s etting | 1114 // be triggered before the view is attached by LocalFrame::createView(...) s etting |
1223 // various values such as setScrollBarModes(...) for example. An ASSERT is | 1115 // various values such as setScrollBarModes(...) for example. An ASSERT is |
1224 // triggered when a view is layout before being attached to a frame(). | 1116 // triggered when a view is layout before being attached to a frame(). |
1225 if (!frame().view()) | 1117 if (!frame().view()) |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1473 m_overflowStatusDirty = false; | 1365 m_overflowStatusDirty = false; |
1474 return; | 1366 return; |
1475 } | 1367 } |
1476 } | 1368 } |
1477 | 1369 |
1478 IntRect FrameView::windowClipRect(IncludeScrollbarsInRect scrollbarInclusion) co nst | 1370 IntRect FrameView::windowClipRect(IncludeScrollbarsInRect scrollbarInclusion) co nst |
1479 { | 1371 { |
1480 ASSERT(m_frame->view() == this); | 1372 ASSERT(m_frame->view() == this); |
1481 | 1373 |
1482 if (paintsEntireContents()) | 1374 if (paintsEntireContents()) |
1483 return IntRect(IntPoint(), contentsSize()); | 1375 return IntRect(IntPoint(), size()); |
1484 | 1376 |
1485 // Set our clip rect to be our contents. | 1377 // Set our clip rect to be our contents. |
1486 IntRect clipRect = contentsToWindow(visibleContentRect(scrollbarInclusion)); | 1378 IntRect clipRect = contentsToWindow(visibleContentRect(scrollbarInclusion)); |
1487 return clipRect; | 1379 return clipRect; |
1488 } | 1380 } |
1489 | 1381 |
1490 bool FrameView::isActive() const | 1382 bool FrameView::isActive() const |
1491 { | 1383 { |
1492 Page* page = frame().page(); | 1384 Page* page = frame().page(); |
1493 return page && page->focusController().isActive(); | 1385 return page && page->focusController().isActive(); |
1494 } | 1386 } |
1495 | 1387 |
1496 void FrameView::scrollTo(const IntSize& newOffset) | 1388 void FrameView::scrollTo(const IntSize& newOffset) |
1497 { | 1389 { |
1498 LayoutSize offset = scrollOffset(); | 1390 // FIXME(sky): remove |
1499 ScrollView::scrollTo(newOffset); | |
1500 if (offset != scrollOffset()) { | |
1501 updateLayersAndCompositingAfterScrollIfNeeded(); | |
1502 scrollPositionChanged(); | |
1503 } | |
1504 frame().loaderClient()->didChangeScrollOffset(); | |
1505 } | 1391 } |
1506 | 1392 |
1507 void FrameView::invalidateScrollbarRect(Scrollbar* scrollbar, const IntRect& rec t) | 1393 void FrameView::invalidateScrollbarRect(Scrollbar*, const IntRect&) |
1508 { | 1394 { |
1509 // Add in our offset within the FrameView. | 1395 // FIXME(sky): remove |
1510 IntRect dirtyRect = rect; | |
1511 dirtyRect.moveBy(scrollbar->location()); | |
1512 | |
1513 if (isInPerformLayout()) | |
1514 addScrollbarDamage(scrollbar, rect); | |
1515 else | |
1516 invalidateRect(dirtyRect); | |
1517 } | 1396 } |
1518 | 1397 |
1519 void FrameView::getTickmarks(Vector<IntRect>& tickmarks) const | 1398 void FrameView::getTickmarks(Vector<IntRect>& tickmarks) const |
1520 { | 1399 { |
1521 if (!m_tickmarks.isEmpty()) | 1400 if (!m_tickmarks.isEmpty()) |
1522 tickmarks = m_tickmarks; | 1401 tickmarks = m_tickmarks; |
1523 else | 1402 else |
1524 tickmarks = frame().document()->markers().renderedRectsForMarkers(Docume ntMarker::TextMatch); | 1403 tickmarks = frame().document()->markers().renderedRectsForMarkers(Docume ntMarker::TextMatch); |
1525 } | 1404 } |
1526 | 1405 |
1527 void FrameView::setVisibleContentScaleFactor(float visibleContentScaleFactor) | 1406 void FrameView::setVisibleContentScaleFactor(float visibleContentScaleFactor) |
1528 { | 1407 { |
1529 if (m_visibleContentScaleFactor == visibleContentScaleFactor) | 1408 if (m_visibleContentScaleFactor == visibleContentScaleFactor) |
1530 return; | 1409 return; |
1531 | |
1532 m_visibleContentScaleFactor = visibleContentScaleFactor; | 1410 m_visibleContentScaleFactor = visibleContentScaleFactor; |
1533 updateScrollbars(scrollOffset()); | |
1534 } | 1411 } |
1535 | 1412 |
1536 void FrameView::setInputEventsTransformForEmulation(const IntSize& offset, float contentScaleFactor) | 1413 void FrameView::setInputEventsTransformForEmulation(const IntSize& offset, float contentScaleFactor) |
1537 { | 1414 { |
1538 m_inputEventsOffsetForEmulation = offset; | 1415 m_inputEventsOffsetForEmulation = offset; |
1539 m_inputEventsScaleFactorForEmulation = contentScaleFactor; | 1416 m_inputEventsScaleFactorForEmulation = contentScaleFactor; |
1540 } | 1417 } |
1541 | 1418 |
1542 IntSize FrameView::inputEventsOffsetForEmulation() const | 1419 IntSize FrameView::inputEventsOffsetForEmulation() const |
1543 { | 1420 { |
(...skipping 16 matching lines...) Expand all Loading... | |
1560 return !!m_frame->document(); | 1437 return !!m_frame->document(); |
1561 } | 1438 } |
1562 | 1439 |
1563 IntRect FrameView::scrollableAreaBoundingBox() const | 1440 IntRect FrameView::scrollableAreaBoundingBox() const |
1564 { | 1441 { |
1565 return frameRect(); | 1442 return frameRect(); |
1566 } | 1443 } |
1567 | 1444 |
1568 bool FrameView::isScrollable() | 1445 bool FrameView::isScrollable() |
1569 { | 1446 { |
1570 // Check for: | 1447 // FIXME(sky): Remove |
1571 // 1) If there an actual overflow. | 1448 return false; |
1572 // 2) display:none or visibility:hidden set to self or inherited. | |
1573 // 3) overflow{-x,-y}: hidden; | |
1574 // 4) scrolling: no; | |
1575 | |
1576 // Covers #1 | |
1577 IntSize contentsSize = this->contentsSize(); | |
1578 IntSize visibleContentSize = visibleContentRect().size(); | |
1579 if ((contentsSize.height() <= visibleContentSize.height() && contentsSize.wi dth() <= visibleContentSize.width())) | |
1580 return false; | |
1581 | |
1582 | |
1583 // Cover #3 and #4. | |
1584 ScrollbarMode horizontalMode; | |
1585 ScrollbarMode verticalMode; | |
1586 calculateScrollbarModesForLayoutAndSetViewportRenderer(horizontalMode, verti calMode, RulesFromWebContentOnly); | |
1587 if (horizontalMode == ScrollbarAlwaysOff && verticalMode == ScrollbarAlwaysO ff) | |
1588 return false; | |
1589 | |
1590 return true; | |
1591 } | 1449 } |
1592 | 1450 |
1593 void FrameView::notifyPageThatContentAreaWillPaint() const | 1451 void FrameView::notifyPageThatContentAreaWillPaint() const |
1594 { | 1452 { |
1595 Page* page = m_frame->page(); | 1453 Page* page = m_frame->page(); |
1596 if (!page) | 1454 if (!page) |
1597 return; | 1455 return; |
1598 | 1456 |
1599 contentAreaWillPaint(); | |
1600 | |
1601 if (!m_scrollableAreas) | 1457 if (!m_scrollableAreas) |
1602 return; | 1458 return; |
1603 | 1459 |
1604 for (HashSet<ScrollableArea*>::const_iterator it = m_scrollableAreas->begin( ), end = m_scrollableAreas->end(); it != end; ++it) { | 1460 for (HashSet<ScrollableArea*>::const_iterator it = m_scrollableAreas->begin( ), end = m_scrollableAreas->end(); it != end; ++it) { |
1605 ScrollableArea* scrollableArea = *it; | 1461 ScrollableArea* scrollableArea = *it; |
1606 | 1462 |
1607 if (!scrollableArea->scrollbarsCanBeActive()) | 1463 if (!scrollableArea->scrollbarsCanBeActive()) |
1608 continue; | 1464 continue; |
1609 | 1465 |
1610 scrollableArea->contentAreaWillPaint(); | 1466 scrollableArea->contentAreaWillPaint(); |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1741 | 1597 |
1742 void FrameView::setNodeToDraw(Node* node) | 1598 void FrameView::setNodeToDraw(Node* node) |
1743 { | 1599 { |
1744 m_nodeToDraw = node; | 1600 m_nodeToDraw = node; |
1745 } | 1601 } |
1746 | 1602 |
1747 void FrameView::paintOverhangAreas(GraphicsContext* context, const IntRect& hori zontalOverhangArea, const IntRect& verticalOverhangArea, const IntRect& dirtyRec t) | 1603 void FrameView::paintOverhangAreas(GraphicsContext* context, const IntRect& hori zontalOverhangArea, const IntRect& verticalOverhangArea, const IntRect& dirtyRec t) |
1748 { | 1604 { |
1749 if (m_frame->page()->chrome().client().paintCustomOverhangArea(context, hori zontalOverhangArea, verticalOverhangArea, dirtyRect)) | 1605 if (m_frame->page()->chrome().client().paintCustomOverhangArea(context, hori zontalOverhangArea, verticalOverhangArea, dirtyRect)) |
1750 return; | 1606 return; |
1751 | |
1752 ScrollView::paintOverhangAreas(context, horizontalOverhangArea, verticalOver hangArea, dirtyRect); | |
1753 } | 1607 } |
1754 | 1608 |
1755 void FrameView::updateWidgetPositionsIfNeeded() | 1609 void FrameView::updateWidgetPositionsIfNeeded() |
1756 { | 1610 { |
1757 if (!m_needsUpdateWidgetPositions) | 1611 if (!m_needsUpdateWidgetPositions) |
1758 return; | 1612 return; |
1759 | 1613 |
1760 m_needsUpdateWidgetPositions = false; | 1614 m_needsUpdateWidgetPositions = false; |
1761 | 1615 |
1762 updateWidgetPositions(); | 1616 updateWidgetPositions(); |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1947 m_scrollableAreas->add(scrollableArea); | 1801 m_scrollableAreas->add(scrollableArea); |
1948 } | 1802 } |
1949 | 1803 |
1950 void FrameView::removeScrollableArea(ScrollableArea* scrollableArea) | 1804 void FrameView::removeScrollableArea(ScrollableArea* scrollableArea) |
1951 { | 1805 { |
1952 if (!m_scrollableAreas) | 1806 if (!m_scrollableAreas) |
1953 return; | 1807 return; |
1954 m_scrollableAreas->remove(scrollableArea); | 1808 m_scrollableAreas->remove(scrollableArea); |
1955 } | 1809 } |
1956 | 1810 |
1811 void FrameView::addChild(PassRefPtr<Widget> prpChild) | |
1812 { | |
1813 Widget* child = prpChild.get(); | |
1814 ASSERT(child != this && !child->parent()); | |
1815 child->setParent(this); | |
1816 m_children.add(prpChild); | |
1817 } | |
1818 | |
1957 void FrameView::removeChild(Widget* widget) | 1819 void FrameView::removeChild(Widget* widget) |
1958 { | 1820 { |
1959 if (widget->isFrameView()) | 1821 ASSERT(widget->parent() == this); |
1960 removeScrollableArea(toFrameView(widget)); | 1822 widget->setParent(0); |
1961 | 1823 m_children.remove(widget); |
1962 ScrollView::removeChild(widget); | |
1963 } | 1824 } |
1964 | 1825 |
1965 bool FrameView::wheelEvent(const PlatformWheelEvent& wheelEvent) | 1826 bool FrameView::wheelEvent(const PlatformWheelEvent& wheelEvent) |
1966 { | 1827 { |
1967 bool allowScrolling = userInputScrollable(HorizontalScrollbar) || userInputS crollable(VerticalScrollbar); | 1828 // FIXME(sky): Remove |
1968 | |
1969 if (!isScrollable()) | |
1970 allowScrolling = false; | |
1971 | |
1972 if (allowScrolling && ScrollableArea::handleWheelEvent(wheelEvent)) | |
1973 return true; | |
1974 | |
1975 // If the frame didn't handle the event, give the pinch-zoom viewport a chan ce to | |
1976 // process the scroll event. | |
1977 if (m_frame->settings()->pinchVirtualViewportEnabled()) | |
1978 return page()->frameHost().pinchViewport().handleWheelEvent(wheelEvent); | |
1979 | |
1980 return false; | 1829 return false; |
1981 } | 1830 } |
1982 | 1831 |
1983 bool FrameView::isVerticalDocument() const | 1832 bool FrameView::isVerticalDocument() const |
1984 { | 1833 { |
1985 RenderView* renderView = this->renderView(); | 1834 RenderView* renderView = this->renderView(); |
1986 if (!renderView) | 1835 if (!renderView) |
1987 return true; | 1836 return true; |
1988 | 1837 |
1989 return renderView->style()->isHorizontalWritingMode(); | 1838 return renderView->style()->isHorizontalWritingMode(); |
(...skipping 14 matching lines...) Expand all Loading... | |
2004 if (!page || !page->settings().deviceSupportsMouse()) | 1853 if (!page || !page->settings().deviceSupportsMouse()) |
2005 return; | 1854 return; |
2006 page->chrome().setCursor(cursor); | 1855 page->chrome().setCursor(cursor); |
2007 } | 1856 } |
2008 | 1857 |
2009 void FrameView::frameRectsChanged() | 1858 void FrameView::frameRectsChanged() |
2010 { | 1859 { |
2011 if (layoutSizeFixedToFrameSize()) | 1860 if (layoutSizeFixedToFrameSize()) |
2012 setLayoutSizeInternal(frameRect().size()); | 1861 setLayoutSizeInternal(frameRect().size()); |
2013 | 1862 |
2014 ScrollView::frameRectsChanged(); | 1863 HashSet<RefPtr<Widget> >::const_iterator end = m_children.end(); |
1864 for (HashSet<RefPtr<Widget> >::const_iterator current = m_children.begin(); | |
1865 current != end; ++current) { | |
abarth-chromium
2014/10/24 03:16:06
for (const auto& widget : m_children) {
...
}
F
ojan
2014/10/24 03:21:01
Amazing. Done.
I guess it's time to actually lear
| |
1866 (*current)->frameRectsChanged(); | |
1867 } | |
2015 } | 1868 } |
2016 | 1869 |
2017 void FrameView::setLayoutSizeInternal(const IntSize& size) | 1870 void FrameView::setLayoutSizeInternal(const IntSize& size) |
2018 { | 1871 { |
2019 if (m_layoutSize == size) | 1872 if (m_layoutSize == size) |
2020 return; | 1873 return; |
2021 | 1874 |
2022 m_layoutSize = size; | 1875 m_layoutSize = size; |
2023 contentsResized(); | 1876 contentsResized(); |
2024 } | 1877 } |
2025 | 1878 |
2026 } // namespace blink | 1879 } // namespace blink |
OLD | NEW |