Chromium Code Reviews| Index: third_party/WebKit/Source/platform/graphics/paint/PropertyTreeState.cpp |
| diff --git a/third_party/WebKit/Source/platform/graphics/paint/PropertyTreeState.cpp b/third_party/WebKit/Source/platform/graphics/paint/PropertyTreeState.cpp |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..b25cf7b7455601b33c7c29b0bb6421ca6f7c3cc8 |
| --- /dev/null |
| +++ b/third_party/WebKit/Source/platform/graphics/paint/PropertyTreeState.cpp |
| @@ -0,0 +1,50 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "platform/graphics/paint/PropertyTreeState.h" |
| + |
| +namespace blink { |
| + |
| +bool PropertyTreeState::hasDirectCompositingReasons() const { |
|
trchen
2016/12/20 23:49:36
This feels a weird place to me. IMO the concept of
chrishtr
2016/12/20 23:58:10
doesn't apply to chunks.
I don't have it on chunk
trchen
2016/12/21 00:37:11
Ah, I see. It all makes sense now. However I feel
|
| + switch (innermostNode()) { |
| + case Transform: |
| + return transform()->hasDirectCompositingReasons(); |
| + case Clip: |
| + return clip()->hasDirectCompositingReasons(); |
| + case Effect: |
| + return effect()->hasDirectCompositingReasons(); |
| + default: |
| + return false; |
| + } |
| +} |
| + |
| +PropertyTreeState::InnermostNode PropertyTreeState::innermostNode() const { |
|
trchen
2016/12/20 23:49:36
Likewise, an imaginary combined tree of mixed type
chrishtr
2016/12/20 23:58:10
See above. I've added it on PropertyTreeState for
|
| + if (!m_transform->isRoot() && m_clip->localTransformSpace() != m_transform && |
| + m_effect->localTransformSpace() != m_transform) |
|
trchen
2016/12/20 23:49:36
FYI there is one corner case where the transform s
chrishtr
2016/12/20 23:58:10
In this case, the position: fixed chunk would poin
trchen
2016/12/21 00:37:11
It seemed to me you want to guarantee that if stat
|
| + return Transform; |
| + if (!m_effect->isRoot() && m_effect->outputClip() == m_clip) { |
| + return Effect; |
| + } |
| + if (!m_clip->isRoot()) |
| + return Clip; |
| + return None; |
| +} |
| + |
| +const PropertyTreeState* PropertyTreeStateIterator::next() { |
| + switch (m_properties.innermostNode()) { |
| + case PropertyTreeState::Transform: |
| + m_properties.setTransform(m_properties.transform()->parent()); |
| + return &m_properties; |
| + case PropertyTreeState::Clip: |
| + m_properties.setClip(m_properties.clip()->parent()); |
| + return &m_properties; |
| + case PropertyTreeState::Effect: |
| + m_properties.setEffect(m_properties.effect()->parent()); |
| + return &m_properties; |
| + case PropertyTreeState::None: |
| + return nullptr; |
| + } |
| +} |
| + |
| +} // namespace blink |