1 /** 2 * Copyright (C) 2007 Rob Buis <buis (at) kde.org> 3 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann (at) kde.org> 4 * Copyright (C) 2007 Eric Seidel <eric (at) webkit.org> 5 * Copyright (C) 2009 Google, Inc. All rights reserved. 6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 7 * 8 * This library is free software; you can redistribute it and/or 9 * modify it under the terms of the GNU Library General Public 10 * License as published by the Free Software Foundation; either 11 * version 2 of the License, or (at your option) any later version. 12 * 13 * This library is distributed in the hope that it will be useful, 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 * Library General Public License for more details. 17 * 18 * You should have received a copy of the GNU Library General Public License 19 * along with this library; see the file COPYING.LIB. If not, write to 20 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 21 * Boston, MA 02110-1301, USA. 22 */ 23 24 #ifndef SVGRenderSupport_h 25 #define SVGRenderSupport_h 26 27 #include "core/rendering/PaintInfo.h" 28 29 namespace WebCore { 30 31 class FloatPoint; 32 class FloatRect; 33 class ImageBuffer; 34 class LayoutRect; 35 class RenderBoxModelObject; 36 class RenderGeometryMap; 37 class RenderLayerModelObject; 38 class RenderObject; 39 class RenderStyle; 40 class RenderSVGRoot; 41 class TransformState; 42 43 // SVGRendererSupport is a helper class sharing code between all SVG renderers. 44 class SVGRenderSupport { 45 public: 46 // Shares child layouting code between RenderSVGRoot/RenderSVG(Hidden)Container 47 static void layoutChildren(RenderObject*, bool selfNeedsLayout); 48 49 // Helper function determining wheter overflow is hidden 50 static bool isOverflowHidden(const RenderObject*); 51 52 // Calculates the repaintRect in combination with filter, clipper and masker in local coordinates. 53 static void intersectRepaintRectWithResources(const RenderObject*, FloatRect&); 54 55 // Determines whether a container needs to be laid out because it's filtered and a child is being laid out. 56 static bool filtersForceContainerLayout(RenderObject*); 57 58 // Determines whether the passed point lies in a clipping area 59 static bool pointInClippingArea(RenderObject*, const FloatPoint&); 60 61 static void computeContainerBoundingBoxes(const RenderObject* container, FloatRect& objectBoundingBox, bool& objectBoundingBoxValid, FloatRect& strokeBoundingBox, FloatRect& repaintBoundingBox); 62 static bool paintInfoIntersectsRepaintRect(const FloatRect& localRepaintRect, const AffineTransform& localTransform, const PaintInfo&); 63 64 // Important functions used by nearly all SVG renderers centralizing coordinate transformations / repaint rect calculations 65 static LayoutRect clippedOverflowRectForRepaint(const RenderObject*, const RenderLayerModelObject* repaintContainer); 66 static void computeFloatRectForRepaint(const RenderObject*, const RenderLayerModelObject* repaintContainer, FloatRect&, bool fixed); 67 static void mapLocalToContainer(const RenderObject*, const RenderLayerModelObject* repaintContainer, TransformState&, bool* wasFixed = 0); 68 static const RenderObject* pushMappingToContainer(const RenderObject*, const RenderLayerModelObject* ancestorToStopAt, RenderGeometryMap&); 69 static bool checkForSVGRepaintDuringLayout(RenderObject*); 70 71 // Shared between SVG renderers and resources. 72 static void applyStrokeStyleToContext(GraphicsContext*, const RenderStyle*, const RenderObject*); 73 static void applyStrokeStyleToStrokeData(StrokeData*, const RenderStyle*, const RenderObject*); 74 75 // Determines if any ancestor's transform has changed. 76 static bool transformToRootChanged(RenderObject*); 77 78 // FIXME: These methods do not belong here. 79 static const RenderSVGRoot* findTreeRootObject(const RenderObject*); 80 81 // Helper method for determining whether an RenderSVGInlineText object has zero length text. 82 static bool isEmptySVGInlineText(const RenderObject*); 83 84 private: 85 // This class is not constructable. 86 SVGRenderSupport(); 87 ~SVGRenderSupport(); 88 }; 89 90 } // namespace WebCore 91 92 #endif // SVGRenderSupport_h 93