/src/3rdparty/webkit/Source/WebCore/rendering/svg/SVGRenderSupport.h

https://bitbucket.org/ultra_iter/qt-vtl · C Header · 83 lines · 35 code · 16 blank · 32 comment · 0 complexity · 79d5bf71cead418277bf065a71a20a8e MD5 · raw file

  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. #ifndef SVGRenderSupport_h
  24. #define SVGRenderSupport_h
  25. #if ENABLE(SVG)
  26. #include "PaintInfo.h"
  27. namespace WebCore {
  28. class FloatPoint;
  29. class FloatRect;
  30. class ImageBuffer;
  31. class RenderBoxModelObject;
  32. class RenderObject;
  33. class RenderStyle;
  34. class RenderSVGRoot;
  35. class TransformState;
  36. // SVGRendererSupport is a helper class sharing code between all SVG renderers.
  37. class SVGRenderSupport {
  38. public:
  39. // Used by all SVG renderers who apply clip/filter/etc. resources to the renderer content
  40. static bool prepareToRenderSVGContent(RenderObject*, PaintInfo&);
  41. static void finishRenderSVGContent(RenderObject*, PaintInfo&, GraphicsContext* savedContext);
  42. // Shares child layouting code between RenderSVGRoot/RenderSVG(Hidden)Container
  43. static void layoutChildren(RenderObject*, bool selfNeedsLayout);
  44. // Helper function determining wheter overflow is hidden
  45. static bool isOverflowHidden(const RenderObject*);
  46. // Calculates the repaintRect in combination with filter, clipper and masker in local coordinates.
  47. static void intersectRepaintRectWithResources(const RenderObject*, FloatRect&);
  48. // Determines whether the passed point lies in a clipping area
  49. static bool pointInClippingArea(RenderObject*, const FloatPoint&);
  50. static void computeContainerBoundingBoxes(const RenderObject* container, FloatRect& objectBoundingBox, FloatRect& strokeBoundingBox, FloatRect& repaintBoundingBox);
  51. static bool paintInfoIntersectsRepaintRect(const FloatRect& localRepaintRect, const AffineTransform& localTransform, const PaintInfo&);
  52. // Important functions used by nearly all SVG renderers centralizing coordinate transformations / repaint rect calculations
  53. static IntRect clippedOverflowRectForRepaint(RenderObject*, RenderBoxModelObject* repaintContainer);
  54. static void computeRectForRepaint(RenderObject*, RenderBoxModelObject* repaintContainer, IntRect&, bool fixed);
  55. static void mapLocalToContainer(const RenderObject*, RenderBoxModelObject* repaintContainer, bool useTransforms, bool fixed, TransformState&);
  56. // Shared between SVG renderers and resources.
  57. static void applyStrokeStyleToContext(GraphicsContext*, const RenderStyle*, const RenderObject*);
  58. // FIXME: These methods do not belong here.
  59. static const RenderSVGRoot* findTreeRootObject(const RenderObject*);
  60. private:
  61. // This class is not constructable.
  62. SVGRenderSupport();
  63. ~SVGRenderSupport();
  64. };
  65. } // namespace WebCore
  66. #endif // ENABLE(SVG)
  67. #endif // SVGRenderSupport_h