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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/paint/PropertyTreeState.cpp

Issue 2581843002: Implement merging non-composited paint property nodes in the PACompositor. (Closed)
Patch Set: none Created 3 years, 12 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "platform/graphics/paint/PropertyTreeState.h"
6
7 #include "platform/graphics/paint/GeometryMapper.h"
8
9 namespace blink {
10
11 bool PropertyTreeState::hasDirectCompositingReasons() const {
12 switch (innermostNode()) {
13 case Transform:
14 return transform()->hasDirectCompositingReasons();
15 case Clip:
16 return clip()->hasDirectCompositingReasons();
17 case Effect:
18 return effect()->hasDirectCompositingReasons();
19 default:
20 return false;
21 }
22 }
23
24 template <typename PropertyNode>
25 bool isAncestorOf(const PropertyNode* ancestor, const PropertyNode* child) {
26 while (child && child != ancestor) {
27 child = child->parent();
28 }
29 return child == ancestor;
30 }
31
32 PropertyTreeState::InnermostNode PropertyTreeState::innermostNode() const {
pdr. 2016/12/22 19:46:26 Please document this.
chrishtr 2016/12/22 19:53:54 Done.
33 // TODO(chrishtr): this is very inefficient when innermostNode() is called
34 // repeatedly.
35 bool clipTransformStrictAncestorOfTransform =
36 m_clip->localTransformSpace() != m_transform.get() &&
37 isAncestorOf<TransformPaintPropertyNode>(m_clip->localTransformSpace(),
38 m_transform.get());
39 bool effectTransformStrictAncestorOfTransform =
40 m_effect->localTransformSpace() != m_transform.get() &&
41 isAncestorOf<TransformPaintPropertyNode>(m_effect->localTransformSpace(),
42 m_transform.get());
43
44 if (!m_transform->isRoot() && clipTransformStrictAncestorOfTransform &&
45 effectTransformStrictAncestorOfTransform)
46 return Transform;
47
48 bool clipAncestorOfEffect =
49 isAncestorOf<ClipPaintPropertyNode>(m_clip.get(), m_effect->outputClip());
50
51 if (!m_effect->isRoot() && clipAncestorOfEffect) {
52 return Effect;
53 }
54 if (!m_clip->isRoot())
55 return Clip;
56 return None;
57 }
58
59 const PropertyTreeState* PropertyTreeStateIterator::next() {
60 switch (m_properties.innermostNode()) {
61 case PropertyTreeState::Transform:
62 m_properties.setTransform(m_properties.transform()->parent());
63 return &m_properties;
64 case PropertyTreeState::Clip:
65 m_properties.setClip(m_properties.clip()->parent());
66 return &m_properties;
67 case PropertyTreeState::Effect:
68 m_properties.setEffect(m_properties.effect()->parent());
69 return &m_properties;
70 case PropertyTreeState::None:
71 return nullptr;
72 }
73 }
74
75 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698