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 blink {
     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 OVERRIDE { return "RenderSVGForeignObject"; }
     36 
     37     virtual bool isChildAllowed(RenderObject*, RenderStyle*) const OVERRIDE;
     38 
     39     virtual void paint(PaintInfo&, const LayoutPoint&) OVERRIDE;
     40 
     41     virtual void layout() OVERRIDE;
     42 
     43     virtual FloatRect objectBoundingBox() const OVERRIDE { return FloatRect(FloatPoint(), m_viewport.size()); }
     44     virtual FloatRect strokeBoundingBox() const OVERRIDE { return FloatRect(FloatPoint(), m_viewport.size()); }
     45     virtual FloatRect paintInvalidationRectInLocalCoordinates() const OVERRIDE { return FloatRect(FloatPoint(), m_viewport.size()); }
     46 
     47     virtual void mapRectToPaintInvalidationBacking(const RenderLayerModelObject* paintInvalidationContainer, LayoutRect&, const PaintInvalidationState*) const OVERRIDE;
     48     virtual bool nodeAtFloatPoint(const HitTestRequest&, HitTestResult&, const FloatPoint& pointInParent, HitTestAction) OVERRIDE;
     49     virtual bool isSVGForeignObject() const OVERRIDE { return true; }
     50 
     51     virtual void setNeedsTransformUpdate() OVERRIDE { m_needsTransformUpdate = true; }
     52 
     53     FloatRect viewportRect() { return m_viewport; }
     54 
     55 private:
     56     virtual void updateLogicalWidth() OVERRIDE;
     57     virtual void computeLogicalHeight(LayoutUnit logicalHeight, LayoutUnit logicalTop, LogicalExtentComputedValues&) const OVERRIDE;
     58 
     59     virtual const AffineTransform& localToParentTransform() const OVERRIDE;
     60 
     61     bool m_needsTransformUpdate : 1;
     62     FloatRect m_viewport;
     63     mutable AffineTransform m_localToParentTransform;
     64 };
     65 
     66 }
     67 
     68 #endif
     69