1/* 2 * Copyright (C) 2006 Apple Inc. 3 * Copyright (C) 2009 Google, Inc. 4 * 5 * This library is free software; you can redistribute it and/or 6 * modify it under the terms of the GNU Library General Public 7 * License as published by the Free Software Foundation; either 8 * version 2 of the License, or (at your option) any later version. 9 * 10 * This library is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 * Library General Public License for more details. 14 * 15 * You should have received a copy of the GNU Library General Public License 16 * along with this library; see the file COPYING.LIB. If not, write to 17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 18 * Boston, MA 02110-1301, USA. 19 */ 20 21#ifndef RenderSVGForeignObject_h 22#define RenderSVGForeignObject_h 23 24#include "AffineTransform.h" 25#include "FloatPoint.h" 26#include "FloatRect.h" 27#include "RenderSVGBlock.h" 28 29namespace WebCore { 30 31class SVGForeignObjectElement; 32 33class RenderSVGForeignObject final : public RenderSVGBlock { 34public: 35 RenderSVGForeignObject(SVGForeignObjectElement&, PassRef<RenderStyle>); 36 virtual ~RenderSVGForeignObject(); 37 38 SVGForeignObjectElement& foreignObjectElement() const; 39 40 virtual void paint(PaintInfo&, const LayoutPoint&); 41 42 virtual LayoutRect clippedOverflowRectForRepaint(const RenderLayerModelObject* repaintContainer) const override; 43 virtual void computeFloatRectForRepaint(const RenderLayerModelObject* repaintContainer, FloatRect&, bool fixed = false) const override; 44 45 virtual bool requiresLayer() const { return false; } 46 virtual void layout(); 47 48 virtual FloatRect objectBoundingBox() const { return FloatRect(FloatPoint(), m_viewport.size()); } 49 virtual FloatRect strokeBoundingBox() const { return FloatRect(FloatPoint(), m_viewport.size()); } 50 virtual FloatRect repaintRectInLocalCoordinates() const { return FloatRect(FloatPoint(), m_viewport.size()); } 51 52 virtual bool nodeAtFloatPoint(const HitTestRequest&, HitTestResult&, const FloatPoint& pointInParent, HitTestAction); 53 virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAction) override; 54 virtual bool isSVGForeignObject() const { return true; } 55 56 virtual void mapLocalToContainer(const RenderLayerModelObject* repaintContainer, TransformState&, MapCoordinatesFlags = ApplyContainerFlip, bool* wasFixed = 0) const override; 57 virtual const RenderObject* pushMappingToContainer(const RenderLayerModelObject* ancestorToStopAt, RenderGeometryMap&) const override; 58 virtual void setNeedsTransformUpdate() { m_needsTransformUpdate = true; } 59 60private: 61 void graphicsElement() const = delete; 62 virtual const char* renderName() const override { return "RenderSVGForeignObject"; } 63 64 virtual void updateLogicalWidth() override; 65 virtual void computeLogicalHeight(LayoutUnit logicalHeight, LayoutUnit logicalTop, LogicalExtentComputedValues&) const override; 66 67 virtual const AffineTransform& localToParentTransform() const; 68 virtual AffineTransform localTransform() const { return m_localTransform; } 69 70 bool m_needsTransformUpdate : 1; 71 FloatRect m_viewport; 72 AffineTransform m_localTransform; 73 mutable AffineTransform m_localToParentTransform; 74}; 75 76} 77 78#endif 79