Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(116)

Side by Side Diff: third_party/WebKit/Source/core/page/scrolling/RootScrollerController.cpp

Issue 2290353002: Fix crash when scrolling in a remote process frame (Closed)
Patch Set: Added TODOs Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/page/scrolling/TopDocumentRootScrollerController.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/page/scrolling/RootScrollerController.h" 5 #include "core/page/scrolling/RootScrollerController.h"
6 6
7 #include "core/dom/Document.h" 7 #include "core/dom/Document.h"
8 #include "core/dom/Element.h" 8 #include "core/dom/Element.h"
9 #include "core/frame/FrameHost.h" 9 #include "core/frame/FrameHost.h"
10 #include "core/frame/FrameView.h" 10 #include "core/frame/FrameView.h"
11 #include "core/layout/LayoutBox.h" 11 #include "core/layout/LayoutBox.h"
12 #include "core/paint/PaintLayerScrollableArea.h" 12 #include "core/paint/PaintLayerScrollableArea.h"
13 #include "platform/graphics/GraphicsLayer.h" 13 #include "platform/graphics/GraphicsLayer.h"
14 #include "platform/scroll/ScrollableArea.h" 14 #include "platform/scroll/ScrollableArea.h"
15 15
16 namespace blink { 16 namespace blink {
17 17
18 class RootFrameViewport; 18 class RootFrameViewport;
19 19
20 namespace { 20 namespace {
21 21
22 bool fillsViewport(const Element& element) 22 bool fillsViewport(const Element& element)
23 { 23 {
24 DCHECK(element.layoutObject()); 24 DCHECK(element.layoutObject());
25 DCHECK(element.layoutObject()->isBox()); 25 DCHECK(element.layoutObject()->isBox());
26 26
27 LayoutObject* layoutObject = element.layoutObject(); 27 LayoutObject* layoutObject = element.layoutObject();
28 28
29 // TODO(bokan): Broken for OOPIF. 29 // TODO(bokan): Broken for OOPIF. crbug.com/642378.
30 Document& topDocument = element.document().topDocument(); 30 Document& topDocument = element.document().topDocument();
31 31
32 Vector<FloatQuad> quads; 32 Vector<FloatQuad> quads;
33 layoutObject->absoluteQuads(quads); 33 layoutObject->absoluteQuads(quads);
34 DCHECK_EQ(quads.size(), 1u); 34 DCHECK_EQ(quads.size(), 1u);
35 35
36 if (!quads[0].isRectilinear()) 36 if (!quads[0].isRectilinear())
37 return false; 37 return false;
38 38
39 LayoutRect boundingBox(quads[0].boundingBox()); 39 LayoutRect boundingBox(quads[0].boundingBox());
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 return nullptr; 152 return nullptr;
153 } 153 }
154 154
155 bool RootScrollerController::isViewportScrollCallback( 155 bool RootScrollerController::isViewportScrollCallback(
156 const ScrollStateCallback* callback) const 156 const ScrollStateCallback* callback) const
157 { 157 {
158 // TopDocumentRootScrollerController must override this method to actually 158 // TopDocumentRootScrollerController must override this method to actually
159 // do the comparison. 159 // do the comparison.
160 DCHECK(!m_document->isInMainFrame()); 160 DCHECK(!m_document->isInMainFrame());
161 161
162 // If we don't have a local owner we must be in a remote iframe.
163 // RootScrollerController doesn't yet work in OOPIF and in any case we have
164 // no way to get at the ViewportScrollCallback so just return false.
165 // TODO(bokan): Make document.rootScroller work in OOPIF. crbug.com/642378.
166 if (!m_document->localOwner())
167 return false;
168
162 RootScrollerController* topDocumentController = 169 RootScrollerController* topDocumentController =
163 m_document->topDocument().rootScrollerController(); 170 m_document->topDocument().rootScrollerController();
164 return topDocumentController->isViewportScrollCallback(callback); 171 return topDocumentController->isViewportScrollCallback(callback);
165 } 172 }
166 173
167 Element* RootScrollerController::defaultEffectiveRootScroller() 174 Element* RootScrollerController::defaultEffectiveRootScroller()
168 { 175 {
169 DCHECK(m_document); 176 DCHECK(m_document);
170 return m_document->documentElement(); 177 return m_document->documentElement();
171 } 178 }
172 179
173 } // namespace blink 180 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/page/scrolling/TopDocumentRootScrollerController.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698