1 | /** |
2 | * Copyright (C) 2007 Rob Buis <buis@kde.org> |
3 | * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org> |
4 | * Copyright (C) 2007 Eric Seidel <eric@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 | #pragma once |
25 | |
26 | #include "PaintInfo.h" |
27 | #include "RenderObject.h" |
28 | |
29 | namespace WebCore { |
30 | |
31 | class FloatPoint; |
32 | class FloatRect; |
33 | class ImageBuffer; |
34 | class LayoutRect; |
35 | class RenderBoxModelObject; |
36 | class RenderElement; |
37 | class RenderGeometryMap; |
38 | class RenderLayerModelObject; |
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 | static void layoutDifferentRootIfNeeded(const RenderElement&); |
47 | |
48 | // Shares child layouting code between RenderSVGRoot/RenderSVG(Hidden)Container |
49 | static void layoutChildren(RenderElement&, bool selfNeedsLayout); |
50 | |
51 | // Helper function determining wheter overflow is hidden |
52 | static bool isOverflowHidden(const RenderElement&); |
53 | |
54 | // Calculates the repaintRect in combination with filter, clipper and masker in local coordinates. |
55 | static void intersectRepaintRectWithResources(const RenderElement&, FloatRect&); |
56 | |
57 | // Determines whether a container needs to be laid out because it's filtered and a child is being laid out. |
58 | static bool filtersForceContainerLayout(const RenderElement&); |
59 | |
60 | // Determines whether the passed point lies in a clipping area |
61 | static bool pointInClippingArea(const RenderElement&, const FloatPoint&); |
62 | |
63 | static void computeContainerBoundingBoxes(const RenderElement& container, FloatRect& objectBoundingBox, bool& objectBoundingBoxValid, FloatRect& strokeBoundingBox, FloatRect& repaintBoundingBox); |
64 | static bool paintInfoIntersectsRepaintRect(const FloatRect& localRepaintRect, const AffineTransform& localTransform, const PaintInfo&); |
65 | |
66 | // Important functions used by nearly all SVG renderers centralizing coordinate transformations / repaint rect calculations |
67 | static LayoutRect clippedOverflowRectForRepaint(const RenderElement&, const RenderLayerModelObject* repaintContainer); |
68 | static Optional<FloatRect> computeFloatVisibleRectInContainer(const RenderElement&, const FloatRect&, const RenderLayerModelObject* container, RenderObject::VisibleRectContext); |
69 | static const RenderElement& localToParentTransform(const RenderElement&, AffineTransform &); |
70 | static void mapLocalToContainer(const RenderElement&, const RenderLayerModelObject* repaintContainer, TransformState&, bool* wasFixed); |
71 | static const RenderElement* pushMappingToContainer(const RenderElement&, const RenderLayerModelObject* ancestorToStopAt, RenderGeometryMap&); |
72 | static bool checkForSVGRepaintDuringLayout(const RenderElement&); |
73 | |
74 | // Shared between SVG renderers and resources. |
75 | static void applyStrokeStyleToContext(GraphicsContext*, const RenderStyle&, const RenderElement&); |
76 | |
77 | // Determines if any ancestor's transform has changed. |
78 | static bool transformToRootChanged(RenderElement*); |
79 | |
80 | static void clipContextToCSSClippingArea(GraphicsContext&, const RenderElement& renderer); |
81 | |
82 | static void styleChanged(RenderElement&, const RenderStyle*); |
83 | |
84 | #if ENABLE(CSS_COMPOSITING) |
85 | static bool isolatesBlending(const RenderStyle&); |
86 | static void updateMaskedAncestorShouldIsolateBlending(const RenderElement&); |
87 | #endif |
88 | |
89 | static RenderSVGRoot* findTreeRootObject(RenderElement&); |
90 | static const RenderSVGRoot* findTreeRootObject(const RenderElement&); |
91 | |
92 | private: |
93 | // This class is not constructable. |
94 | SVGRenderSupport(); |
95 | ~SVGRenderSupport(); |
96 | }; |
97 | |
98 | } // namespace WebCore |
99 | |