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

Unified Diff: third_party/WebKit/Source/platform/graphics/compositing/PaintArtifactCompositor.cpp

Issue 2105273004: GeometryMapper: Support computing visual rects in spaces that are not direct ancestors. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: none Created 4 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/platform/graphics/compositing/PaintArtifactCompositor.cpp
diff --git a/third_party/WebKit/Source/platform/graphics/compositing/PaintArtifactCompositor.cpp b/third_party/WebKit/Source/platform/graphics/compositing/PaintArtifactCompositor.cpp
index 6ef8b4e5949d332e6c7a5ba8ed916dd1e7b22006..b7081ff953795a0c4ec008188a3cfd20d7cfc6c5 100644
--- a/third_party/WebKit/Source/platform/graphics/compositing/PaintArtifactCompositor.cpp
+++ b/third_party/WebKit/Source/platform/graphics/compositing/PaintArtifactCompositor.cpp
@@ -19,6 +19,7 @@
#include "platform/graphics/paint/DrawingDisplayItem.h"
#include "platform/graphics/paint/ForeignLayerDisplayItem.h"
#include "platform/graphics/paint/PaintArtifact.h"
+#include "platform/graphics/paint/PropertyTreeState.h"
#include "platform/graphics/paint/TransformPaintPropertyNode.h"
#include "public/platform/Platform.h"
#include "public/platform/WebCompositorSupport.h"
@@ -123,42 +124,6 @@ static gfx::Transform transformToTransformSpace(const TransformPaintPropertyNode
return gfx::Transform(TransformationMatrix::toSkMatrix44(matrix));
}
-unsigned clipNodeDepth(const ClipPaintPropertyNode* node)
-{
- unsigned depth = 0;
- while (node) {
- depth++;
- node = node->parent();
- }
- return depth;
-}
-
-const ClipPaintPropertyNode* nearestCommonAncestor(const ClipPaintPropertyNode* a, const ClipPaintPropertyNode* b)
-{
- // Measure both depths.
- unsigned depthA = clipNodeDepth(a);
- unsigned depthB = clipNodeDepth(b);
-
- // Make it so depthA >= depthB.
- if (depthA < depthB) {
- std::swap(a, b);
- std::swap(depthA, depthB);
- }
-
- // Make it so depthA == depthB.
- while (depthA > depthB) {
- a = a->parent();
- depthA--;
- }
-
- // Walk up until we find the ancestor.
- while (a != b) {
- a = a->parent();
- b = b->parent();
- }
- return a;
-}
-
const TransformPaintPropertyNode* localTransformSpace(const ClipPaintPropertyNode* clip)
{
return clip ? clip->localTransformSpace() : nullptr;
@@ -205,7 +170,7 @@ public:
cc::Layer* switchToNewClipLayer(const ClipPaintPropertyNode* clip)
{
// Walk up to the nearest common ancestor.
- const auto* ancestor = nearestCommonAncestor(clip, m_clipLayers.last().first);
+ const auto* ancestor = propertyTreeNearestCommonAncestor<ClipPaintPropertyNode>(clip, m_clipLayers.last().first);
while (m_clipLayers.last().first != ancestor)
m_clipLayers.removeLast();

Powered by Google App Engine
This is Rietveld 408576698