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

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

Issue 2531343002: Don't assume current root scroller is a LayoutBox. (Closed)
Patch Set: Created 4 years 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/web/tests/RootScrollerTest.cpp » ('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/RootScrollerUtil.h" 5 #include "core/page/scrolling/RootScrollerUtil.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/FrameView.h" 9 #include "core/frame/FrameView.h"
10 #include "core/layout/LayoutBox.h" 10 #include "core/layout/LayoutBox.h"
(...skipping 18 matching lines...) Expand all
29 } 29 }
30 30
31 if (!element.layoutObject() || !element.layoutObject()->isBox()) 31 if (!element.layoutObject() || !element.layoutObject()->isBox())
32 return nullptr; 32 return nullptr;
33 33
34 return static_cast<PaintInvalidationCapableScrollableArea*>( 34 return static_cast<PaintInvalidationCapableScrollableArea*>(
35 toLayoutBoxModelObject(element.layoutObject())->getScrollableArea()); 35 toLayoutBoxModelObject(element.layoutObject())->getScrollableArea());
36 } 36 }
37 37
38 PaintLayer* paintLayerForRootScroller(const Element* element) { 38 PaintLayer* paintLayerForRootScroller(const Element* element) {
39 if (!element || !element->layoutObject()) 39 if (!element || !element->layoutObject() || !element->layoutObject()->isBox())
40 return nullptr; 40 return nullptr;
41 41
42 DCHECK(element->layoutObject()->isBox());
43 LayoutBox* box = toLayoutBox(element->layoutObject()); 42 LayoutBox* box = toLayoutBox(element->layoutObject());
44 43
45 // If the root scroller is the <html> element we do a bit of a fake out 44 // If the root scroller is the <html> element we do a bit of a fake out
46 // because while <html> has a PaintLayer, scrolling for it is handled by the 45 // because while <html> has a PaintLayer, scrolling for it is handled by the
47 // #document's PaintLayer (i.e. the PaintLayerCompositor's root layer). The 46 // #document's PaintLayer (i.e. the PaintLayerCompositor's root layer). The
48 // reason the root scroller is the <html> layer and not #document is because 47 // reason the root scroller is the <html> layer and not #document is because
49 // the latter is a Node but not an Element. 48 // the latter is a Node but not an Element.
50 if (element->isSameNode(element->document().documentElement())) { 49 if (element->isSameNode(element->document().documentElement())) {
51 if (!box->view()) 50 if (!box->view())
52 return nullptr; 51 return nullptr;
53 return box->view()->layer(); 52 return box->view()->layer();
54 } 53 }
55 54
56 return box->layer(); 55 return box->layer();
57 } 56 }
58 57
59 } // namespace RootScrollerUtil 58 } // namespace RootScrollerUtil
60 59
61 } // namespace blink 60 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/web/tests/RootScrollerTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698