Chromium Code Reviews| 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 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 322 | 322 |
| 323 if (ScrollAnimatorBase* scrollAnimator = existingScrollAnimator()) | 323 if (ScrollAnimatorBase* scrollAnimator = existingScrollAnimator()) |
| 324 scrollAnimator->cancelAnimation(); | 324 scrollAnimator->cancelAnimation(); |
| 325 cancelProgrammaticScrollAnimation(); | 325 cancelProgrammaticScrollAnimation(); |
| 326 | 326 |
| 327 detachScrollbars(); | 327 detachScrollbars(); |
| 328 | 328 |
| 329 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator()) | 329 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator()) |
| 330 scrollingCoordinator->willDestroyScrollableArea(this); | 330 scrollingCoordinator->willDestroyScrollableArea(this); |
| 331 | 331 |
| 332 FrameHost* frameHost = m_frame->host(); | 332 // We need to check for host since there are situations where a plugin may |
| 333 DCHECK(frameHost); | 333 // get updated after its been detached. See crbug.com/671331 for details. |
| 334 frameHost->globalRootScrollerController().didDisposeScrollableArea(*this); | 334 // This should be ok since plugins can't become the root scroller. |
| 335 if (FrameHost* frameHost = m_frame->host()) | |
|
dcheng
2016/12/12 21:32:46
What's the stack where we hit this and it's null?
| |
| 336 frameHost->globalRootScrollerController().didDisposeScrollableArea(*this); | |
| 335 | 337 |
| 336 // We need to clear the RootFrameViewport's animator since it gets called | 338 // We need to clear the RootFrameViewport's animator since it gets called |
| 337 // from non-GC'd objects and RootFrameViewport will still have a pointer to | 339 // from non-GC'd objects and RootFrameViewport will still have a pointer to |
| 338 // this class. | 340 // this class. |
| 339 if (m_viewportScrollableArea) | 341 if (m_viewportScrollableArea) |
| 340 m_viewportScrollableArea->clearScrollableArea(); | 342 m_viewportScrollableArea->clearScrollableArea(); |
| 341 | 343 |
| 342 clearScrollableArea(); | 344 clearScrollableArea(); |
| 343 | 345 |
| 344 // Destroy |m_autoSizeInfo| as early as possible, to avoid dereferencing | 346 // Destroy |m_autoSizeInfo| as early as possible, to avoid dereferencing |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 523 updateScrollbarsIfNeeded(); | 525 updateScrollbarsIfNeeded(); |
| 524 | 526 |
| 525 frameRectsChanged(); | 527 frameRectsChanged(); |
| 526 | 528 |
| 527 updateParentScrollableAreaSet(); | 529 updateParentScrollableAreaSet(); |
| 528 | 530 |
| 529 if (frameSizeChanged) { | 531 if (frameSizeChanged) { |
| 530 viewportSizeChanged(newRect.width() != oldRect.width(), | 532 viewportSizeChanged(newRect.width() != oldRect.width(), |
| 531 newRect.height() != oldRect.height()); | 533 newRect.height() != oldRect.height()); |
| 532 | 534 |
| 533 if (m_frame->isMainFrame()) | |
| 534 m_frame->host()->visualViewport().mainFrameDidChangeSize(); | |
| 535 | |
| 536 frame().loader().restoreScrollPositionAndViewState(); | 535 frame().loader().restoreScrollPositionAndViewState(); |
| 537 } | 536 } |
| 538 } | 537 } |
| 539 | 538 |
| 540 Page* FrameView::page() const { | 539 Page* FrameView::page() const { |
| 541 return frame().page(); | 540 return frame().page(); |
| 542 } | 541 } |
| 543 | 542 |
| 544 LayoutView* FrameView::layoutView() const { | 543 LayoutView* FrameView::layoutView() const { |
| 545 return frame().contentLayoutObject(); | 544 return frame().contentLayoutObject(); |
| (...skipping 982 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1528 } | 1527 } |
| 1529 | 1528 |
| 1530 void FrameView::viewportSizeChanged(bool widthChanged, bool heightChanged) { | 1529 void FrameView::viewportSizeChanged(bool widthChanged, bool heightChanged) { |
| 1531 DCHECK(widthChanged || heightChanged); | 1530 DCHECK(widthChanged || heightChanged); |
| 1532 | 1531 |
| 1533 if (LayoutViewItem layoutView = this->layoutViewItem()) { | 1532 if (LayoutViewItem layoutView = this->layoutViewItem()) { |
| 1534 if (layoutView.usesCompositing()) | 1533 if (layoutView.usesCompositing()) |
| 1535 layoutView.compositor()->frameViewDidChangeSize(); | 1534 layoutView.compositor()->frameViewDidChangeSize(); |
| 1536 } | 1535 } |
| 1537 | 1536 |
| 1538 // Ensure the root scroller compositing layers update geometry in response to | 1537 // We need to check for host since there are situations where a plugin may |
| 1539 // the URL bar resizing. | 1538 // get updated after its been detached. See crbug.com/671331 for details. |
| 1540 if (m_frame->isMainFrame()) { | 1539 if (m_frame->isMainFrame() && m_frame->host()) { |
| 1541 m_frame->document() | 1540 // Ensure the root scroller compositing layers update geometry in response |
| 1542 ->frameHost() | 1541 // to the URL bar resizing. |
| 1543 ->globalRootScrollerController() | 1542 m_frame->host()->globalRootScrollerController().mainFrameViewResized(); |
| 1544 .mainFrameViewResized(); | 1543 |
| 1544 m_frame->host()->visualViewport().mainFrameDidChangeSize(); | |
| 1545 } | 1545 } |
| 1546 | 1546 |
| 1547 showOverlayScrollbars(); | 1547 showOverlayScrollbars(); |
| 1548 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { | 1548 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { |
| 1549 // The background must be repainted when the FrameView is resized, even if | 1549 // The background must be repainted when the FrameView is resized, even if |
| 1550 // the initial containing block does not change (so we can't rely on layout | 1550 // the initial containing block does not change (so we can't rely on layout |
| 1551 // to issue the invalidation). This is because the background fills the | 1551 // to issue the invalidation). This is because the background fills the |
| 1552 // main GraphicsLayer, which takes the size of the layout viewport. | 1552 // main GraphicsLayer, which takes the size of the layout viewport. |
| 1553 // TODO(skobes): Paint non-fixed backgrounds into the scrolling contents | 1553 // TODO(skobes): Paint non-fixed backgrounds into the scrolling contents |
| 1554 // layer and avoid this invalidation (http://crbug.com/568847). | 1554 // layer and avoid this invalidation (http://crbug.com/568847). |
| (...skipping 3109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4664 DCHECK(m_frame->isMainFrame()); | 4664 DCHECK(m_frame->isMainFrame()); |
| 4665 return m_initialViewportSize.width(); | 4665 return m_initialViewportSize.width(); |
| 4666 } | 4666 } |
| 4667 | 4667 |
| 4668 int FrameView::initialViewportHeight() const { | 4668 int FrameView::initialViewportHeight() const { |
| 4669 DCHECK(m_frame->isMainFrame()); | 4669 DCHECK(m_frame->isMainFrame()); |
| 4670 return m_initialViewportSize.height(); | 4670 return m_initialViewportSize.height(); |
| 4671 } | 4671 } |
| 4672 | 4672 |
| 4673 } // namespace blink | 4673 } // namespace blink |
| OLD | NEW |