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 #if ENABLE(SVG) && ENABLE(SVG_FOREIGN_OBJECT)
     25 #include "AffineTransform.h"
     26 #include "FloatPoint.h"
     27 #include "RenderSVGBlock.h"
     28 
     29 namespace WebCore {
     30 
     31 class SVGForeignObjectElement;
     32 
     33 class RenderSVGForeignObject : public RenderSVGBlock {
     34 public:
     35     explicit RenderSVGForeignObject(SVGForeignObjectElement*);
     36     virtual ~RenderSVGForeignObject();
     37 
     38     virtual const char* renderName() const { return "RenderSVGForeignObject"; }
     39 
     40     virtual void paint(PaintInfo&, int parentX, int parentY);
     41 
     42     virtual IntRect clippedOverflowRectForRepaint(RenderBoxModelObject* repaintContainer);
     43     virtual void computeRectForRepaint(RenderBoxModelObject* repaintContainer, IntRect&, bool fixed = false);
     44 
     45     virtual bool requiresLayer() const { return false; }
     46     virtual void layout();
     47 
     48     virtual FloatRect objectBoundingBox() const { return m_viewport; }
     49     virtual FloatRect strokeBoundingBox() const { return m_viewport; }
     50     virtual FloatRect repaintRectInLocalCoordinates() const { return m_viewport; }
     51 
     52     virtual bool nodeAtFloatPoint(const HitTestRequest&, HitTestResult&, const FloatPoint& pointInParent, HitTestAction);
     53     virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, int x, int y, int tx, int ty, HitTestAction);
     54     virtual bool isSVGForeignObject() const { return true; }
     55 
     56     virtual void mapLocalToContainer(RenderBoxModelObject* repaintContainer, bool fixed , bool useTransforms, TransformState&) const;
     57     virtual void setNeedsTransformUpdate() { m_needsTransformUpdate = true; }
     58 
     59 private:
     60     virtual void computeLogicalWidth();
     61     virtual void computeLogicalHeight();
     62 
     63     virtual const AffineTransform& localToParentTransform() const;
     64     virtual AffineTransform localTransform() const { return m_localTransform; }
     65 
     66     bool m_needsTransformUpdate : 1;
     67     FloatRect m_viewport;
     68     AffineTransform m_localTransform;
     69     mutable AffineTransform m_localToParentTransform;
     70 };
     71 
     72 }
     73 
     74 #endif
     75 #endif
     76