Home | History | Annotate | Download | only in svg
      1 /*
      2  * Copyright (C) 2006 Apple Computer, 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 "core/rendering/svg/RenderSVGBlock.h"
     25 
     26 namespace WebCore {
     27 
     28 class SVGForeignObjectElement;
     29 
     30 class RenderSVGForeignObject FINAL : public RenderSVGBlock {
     31 public:
     32     explicit RenderSVGForeignObject(SVGForeignObjectElement*);
     33     virtual ~RenderSVGForeignObject();
     34 
     35     virtual const char* renderName() const { return "RenderSVGForeignObject"; }
     36 
     37     virtual void paint(PaintInfo&, const LayoutPoint&);
     38 
     39     virtual LayoutRect clippedOverflowRectForRepaint(const RenderLayerModelObject* repaintContainer) const OVERRIDE;
     40     virtual void computeFloatRectForRepaint(const RenderLayerModelObject* repaintContainer, FloatRect&, bool fixed = false) const OVERRIDE;
     41 
     42     virtual bool requiresLayer() const { return false; }
     43     virtual void layout();
     44 
     45     virtual FloatRect objectBoundingBox() const { return FloatRect(FloatPoint(), m_viewport.size()); }
     46     virtual FloatRect strokeBoundingBox() const { return FloatRect(FloatPoint(), m_viewport.size()); }
     47     virtual FloatRect repaintRectInLocalCoordinates() const { return FloatRect(FloatPoint(), m_viewport.size()); }
     48 
     49     virtual bool nodeAtFloatPoint(const HitTestRequest&, HitTestResult&, const FloatPoint& pointInParent, HitTestAction);
     50     virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAction) OVERRIDE;
     51     virtual bool isSVGForeignObject() const { return true; }
     52 
     53     virtual void mapLocalToContainer(const RenderLayerModelObject* repaintContainer, TransformState&, MapCoordinatesFlags = ApplyContainerFlip, bool* wasFixed = 0) const OVERRIDE;
     54     virtual const RenderObject* pushMappingToContainer(const RenderLayerModelObject* ancestorToStopAt, RenderGeometryMap&) const OVERRIDE;
     55     virtual void setNeedsTransformUpdate() { m_needsTransformUpdate = true; }
     56 
     57 private:
     58     virtual void updateLogicalWidth() OVERRIDE;
     59     virtual void computeLogicalHeight(LayoutUnit logicalHeight, LayoutUnit logicalTop, LogicalExtentComputedValues&) const OVERRIDE;
     60 
     61     virtual const AffineTransform& localToParentTransform() const;
     62     virtual AffineTransform localTransform() const { return m_localTransform; }
     63 
     64     bool m_needsTransformUpdate : 1;
     65     FloatRect m_viewport;
     66     AffineTransform m_localTransform;
     67     mutable AffineTransform m_localToParentTransform;
     68 };
     69 
     70 }
     71 
     72 #endif
     73