| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "core/paint/PrePaintTreeWalk.h" |
| 6 |
| 7 #include "core/dom/DocumentLifecycle.h" |
| 8 #include "core/frame/FrameView.h" |
| 9 #include "core/frame/LocalFrame.h" |
| 10 #include "core/layout/LayoutPart.h" |
| 11 #include "core/layout/LayoutView.h" |
| 12 |
| 13 namespace blink { |
| 14 |
| 15 struct PrePaintTreeWalkContext { |
| 16 PaintPropertyTreeBuilderContext treeBuilderContext; |
| 17 }; |
| 18 |
| 19 void PrePaintTreeWalk::walk(FrameView& rootFrame) |
| 20 { |
| 21 DCHECK(rootFrame.frame().document()->lifecycle().state() == DocumentLifecycl
e::InPrePaint); |
| 22 |
| 23 PaintPropertyTreeBuilderRootContext treeBuilderRootContext; |
| 24 m_propertyTreeBuilder.buildTreeRootNodes(rootFrame, treeBuilderRootContext); |
| 25 PrePaintTreeWalkContext rootContext = { treeBuilderRootContext }; |
| 26 walk(rootFrame, rootContext); |
| 27 } |
| 28 |
| 29 void PrePaintTreeWalk::walk(FrameView& frameView, const PrePaintTreeWalkContext&
context) |
| 30 { |
| 31 PrePaintTreeWalkContext localContext(context); |
| 32 m_propertyTreeBuilder.buildTreeNodes(frameView, localContext.treeBuilderCont
ext); |
| 33 if (LayoutView* layoutView = frameView.layoutView()) |
| 34 walk(*layoutView, localContext); |
| 35 } |
| 36 |
| 37 void PrePaintTreeWalk::walk(const LayoutObject& object, const PrePaintTreeWalkCo
ntext& context) |
| 38 { |
| 39 PrePaintTreeWalkContext localContext(context); |
| 40 m_propertyTreeBuilder.buildTreeNodes(object, localContext.treeBuilderContext
); |
| 41 |
| 42 for (const LayoutObject* child = object.slowFirstChild(); child; child = chi
ld->nextSibling()) { |
| 43 if (child->isBoxModelObject() || child->isSVG()) |
| 44 walk(*child, localContext); |
| 45 } |
| 46 |
| 47 if (object.isLayoutPart()) { |
| 48 Widget* widget = toLayoutPart(object).widget(); |
| 49 if (widget && widget->isFrameView()) |
| 50 walk(*toFrameView(widget), localContext); |
| 51 // TODO(pdr): Investigate RemoteFrameView (crbug.com/579281). |
| 52 } |
| 53 } |
| 54 |
| 55 } // namespace blink |
| OLD | NEW |