Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2014 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 "config.h" | |
| 6 | |
| 7 #include "core/rendering/RenderLayerClipPathInfo.h" | |
| 8 | |
| 9 #include "core/rendering/RenderLayer.h" | |
| 10 #include "core/rendering/svg/RenderSVGResourceContainer.h" | |
| 11 | |
| 12 namespace blink { | |
| 13 | |
| 14 RenderLayerClipPathInfo::RenderLayerClipPathInfo(RenderLayer* layer) | |
| 15 : m_layer(layer) | |
| 16 { | |
| 17 } | |
| 18 | |
| 19 RenderLayerClipPathInfo::~RenderLayerClipPathInfo() | |
| 20 { | |
| 21 removeReferenceClipPathClients(); | |
| 22 } | |
| 23 | |
| 24 void RenderLayerClipPathInfo::updateReferenceClipPathClients(ClipPathOperation* clipPathOperation) | |
| 25 { | |
| 26 ASSERT(clipPathOperation->type() == ClipPathOperation::REFERENCE); | |
| 27 | |
| 28 removeReferenceClipPathClients(); | |
| 29 ReferenceClipPathOperation* referenceClipPathOperation = toReferenceClipPath Operation(clipPathOperation); | |
| 30 Element* clipPath = m_layer->renderer()->node()->document().getElementById(r eferenceClipPathOperation->fragment()); | |
|
esprehn
2014/08/06 17:25:10
This is not Shadow DOM aware.
| |
| 31 if (!isSVGClipPathElement(clipPath)) | |
| 32 return; | |
| 33 if (clipPath->renderer()) | |
| 34 toRenderSVGResourceContainer(clipPath->renderer())->addClientRenderLayer (m_layer); | |
| 35 else | |
| 36 toSVGClipPathElement(clipPath)->addClient(m_layer->renderer()->node()); | |
| 37 | |
| 38 m_clipPathElement = PassRefPtr<SVGClipPathElement>(toSVGClipPathElement(clip Path)); | |
| 39 } | |
| 40 | |
| 41 void RenderLayerClipPathInfo::removeReferenceClipPathClients() | |
| 42 { | |
| 43 if (!m_clipPathElement) | |
| 44 return; | |
| 45 | |
| 46 if (m_clipPathElement->renderer()) | |
| 47 toRenderSVGResourceContainer(m_clipPathElement->renderer())->removeClien tRenderLayer(m_layer); | |
| 48 else | |
| 49 m_clipPathElement->removeClient(m_layer->renderer()->node()); | |
| 50 | |
| 51 m_clipPathElement.clear(); | |
| 52 } | |
| 53 | |
| 54 } // namespace blink | |
| OLD | NEW |