Chromium Code Reviews| Index: Source/core/rendering/RenderLayerClipPathInfo.cpp |
| diff --git a/Source/core/rendering/RenderLayerClipPathInfo.cpp b/Source/core/rendering/RenderLayerClipPathInfo.cpp |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..ecb1ed87087bc57fd54de68266c41ebe70e244e3 |
| --- /dev/null |
| +++ b/Source/core/rendering/RenderLayerClipPathInfo.cpp |
| @@ -0,0 +1,54 @@ |
| +// Copyright 2014 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 "config.h" |
| + |
| +#include "core/rendering/RenderLayerClipPathInfo.h" |
| + |
| +#include "core/rendering/RenderLayer.h" |
| +#include "core/rendering/svg/RenderSVGResourceContainer.h" |
| + |
| +namespace blink { |
| + |
| +RenderLayerClipPathInfo::RenderLayerClipPathInfo(RenderLayer* layer) |
| + : m_layer(layer) |
| +{ |
| +} |
| + |
| +RenderLayerClipPathInfo::~RenderLayerClipPathInfo() |
| +{ |
| + removeReferenceClipPathClients(); |
| +} |
| + |
| +void RenderLayerClipPathInfo::updateReferenceClipPathClients(ClipPathOperation* clipPathOperation) |
| +{ |
| + ASSERT(clipPathOperation->type() == ClipPathOperation::REFERENCE); |
| + |
| + removeReferenceClipPathClients(); |
| + ReferenceClipPathOperation* referenceClipPathOperation = toReferenceClipPathOperation(clipPathOperation); |
| + Element* clipPath = m_layer->renderer()->node()->document().getElementById(referenceClipPathOperation->fragment()); |
|
esprehn
2014/08/06 17:25:10
This is not Shadow DOM aware.
|
| + if (!isSVGClipPathElement(clipPath)) |
| + return; |
| + if (clipPath->renderer()) |
| + toRenderSVGResourceContainer(clipPath->renderer())->addClientRenderLayer(m_layer); |
| + else |
| + toSVGClipPathElement(clipPath)->addClient(m_layer->renderer()->node()); |
| + |
| + m_clipPathElement = PassRefPtr<SVGClipPathElement>(toSVGClipPathElement(clipPath)); |
| +} |
| + |
| +void RenderLayerClipPathInfo::removeReferenceClipPathClients() |
| +{ |
| + if (!m_clipPathElement) |
| + return; |
| + |
| + if (m_clipPathElement->renderer()) |
| + toRenderSVGResourceContainer(m_clipPathElement->renderer())->removeClientRenderLayer(m_layer); |
| + else |
| + m_clipPathElement->removeClient(m_layer->renderer()->node()); |
| + |
| + m_clipPathElement.clear(); |
| +} |
| + |
| +} // namespace blink |