2 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details.
14 * You should have received a copy of the GNU Library General Public License
15 * along with this library; see the file COPYING.LIB. If not, write to
16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
23 #include "SVGShadowTreeElements.h"
26 #include "FloatSize.h"
27 #include "RenderObject.h"
29 #include "SVGUseElement.h"
33 // SVGShadowTreeContainerElement
35 SVGShadowTreeContainerElement::SVGShadowTreeContainerElement(Document* document)
36 : SVGGElement(SVGNames::gTag, document)
40 PassRefPtr<SVGShadowTreeContainerElement> SVGShadowTreeContainerElement::create(Document* document)
42 return adoptRef(new SVGShadowTreeContainerElement(document));
45 FloatSize SVGShadowTreeContainerElement::containerTranslation() const
47 return FloatSize(m_xOffset.value(this), m_yOffset.value(this));
50 PassRefPtr<Element> SVGShadowTreeContainerElement::cloneElementWithoutAttributesAndChildren() const
52 return adoptRef(new SVGShadowTreeContainerElement(document()));
54 // SVGShadowTreeRootElement
56 inline SVGShadowTreeRootElement::SVGShadowTreeRootElement(Document* document, SVGUseElement* shadowParent)
57 : SVGShadowTreeContainerElement(document)
59 setShadowHost(shadowParent);
63 PassRefPtr<SVGShadowTreeRootElement> SVGShadowTreeRootElement::create(Document* document, SVGUseElement* shadowParent)
65 return adoptRef(new SVGShadowTreeRootElement(document, shadowParent));
68 void SVGShadowTreeRootElement::attachElement(PassRefPtr<RenderStyle> style, RenderArena* arena)
72 // Create the renderer with the specified style
73 RenderObject* renderer = createRenderer(arena, style.get());
75 setRenderer(renderer);
76 renderer->setStyle(style);
79 // Set these explicitly since this normally happens during an attach()
82 // Add the renderer to the render tree
84 shadowHost()->renderer()->addChild(renderer);
87 void SVGShadowTreeRootElement::clearShadowHost()