~ubuntu-branches/ubuntu/karmic/webkit/karmic-proposed

« back to all changes in this revision

Viewing changes to WebCore/rendering/SVGRenderSupport.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Gustavo Noronha Silva
  • Date: 2009-05-15 18:30:58 UTC
  • mfrom: (1.1.8 upstream)
  • Revision ID: james.westby@ubuntu.com-20090515183058-50q5exjo9b1kxy9s
Tags: 1.1.7-1
* New upstream release
* debian/libwebkit-1.0-2.symbols:
- updated with the new symbols in 1.1.7
* debian/libwebkit-dev.install, debian/libwebkit-dev.links,
  debian/rules:
- Build, and ship gtk-doc documentation (Closes: #526683)
* debian/copyright:
- updated.

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
#if ENABLE(SVG)
27
27
#include "SVGRenderSupport.h"
28
28
 
29
 
#include "TransformationMatrix.h"
30
29
#include "ImageBuffer.h"
31
30
#include "RenderObject.h"
32
31
#include "RenderSVGContainer.h"
36
35
#include "SVGResourceMasker.h"
37
36
#include "SVGStyledElement.h"
38
37
#include "SVGURIReference.h"
 
38
#include "TransformState.h"
 
39
#include "TransformationMatrix.h"
39
40
#include <wtf/UnusedParam.h>
40
41
 
41
42
namespace WebCore {
42
43
 
43
 
void prepareToRenderSVGContent(RenderObject* object, RenderObject::PaintInfo& paintInfo, const FloatRect& boundingBox, SVGResourceFilter*& filter, SVGResourceFilter* rootFilter)
 
44
IntRect SVGRenderBase::clippedOverflowRectForRepaint(RenderObject* object, RenderBoxModelObject* repaintContainer)
 
45
{
 
46
    // Return early for any cases where we don't actually paint
 
47
    if (object->style()->visibility() != VISIBLE && !object->enclosingLayer()->hasVisibleContent())
 
48
        return IntRect();
 
49
 
 
50
    // Pass our local paint rect to computeRectForRepaint() which will
 
51
    // map to parent coords and recurse up the parent chain.
 
52
    IntRect repaintRect = enclosingIntRect(object->repaintRectInLocalCoordinates());
 
53
    object->computeRectForRepaint(repaintContainer, repaintRect);
 
54
    return repaintRect;
 
55
}
 
56
 
 
57
void SVGRenderBase::computeRectForRepaint(RenderObject* object, RenderBoxModelObject* repaintContainer, IntRect& repaintRect, bool fixed)
 
58
{
 
59
    // Translate to coords in our parent renderer, and then call computeRectForRepaint on our parent
 
60
    repaintRect = object->localToParentTransform().mapRect(repaintRect);
 
61
    object->parent()->computeRectForRepaint(repaintContainer, repaintRect, fixed);
 
62
}
 
63
 
 
64
void SVGRenderBase::mapLocalToContainer(const RenderObject* object, RenderBoxModelObject* repaintContainer, bool fixed , bool useTransforms, TransformState& transformState)
 
65
{
 
66
    ASSERT(!fixed); // We should have no fixed content in the SVG rendering tree.
 
67
    ASSERT(useTransforms); // mapping a point through SVG w/o respecting trasnforms is useless.
 
68
    transformState.applyTransform(object->localToParentTransform());
 
69
    object->parent()->mapLocalToContainer(repaintContainer, fixed, useTransforms, transformState);
 
70
}
 
71
 
 
72
void SVGRenderBase::prepareToRenderSVGContent(RenderObject* object, RenderObject::PaintInfo& paintInfo, const FloatRect& boundingBox, SVGResourceFilter*& filter, SVGResourceFilter* rootFilter)
44
73
{
45
74
#if !ENABLE(SVG_FILTERS)
46
75
    UNUSED_PARAM(filter);
109
138
        svgElement->document()->accessSVGExtensions()->addPendingResource(maskerId, styledElement);
110
139
}
111
140
 
112
 
void finishRenderSVGContent(RenderObject* object, RenderObject::PaintInfo& paintInfo, const FloatRect& boundingBox, SVGResourceFilter*& filter, GraphicsContext* savedContext)
 
141
void SVGRenderBase::finishRenderSVGContent(RenderObject* object, RenderObject::PaintInfo& paintInfo, const FloatRect& boundingBox, SVGResourceFilter*& filter, GraphicsContext* savedContext)
113
142
{
114
143
#if !ENABLE(SVG_FILTERS)
115
144
    UNUSED_PARAM(boundingBox);
156
185
        svgContainer->setDrawsContents(false);
157
186
}
158
187
 
159
 
void clampImageBufferSizeToViewport(RenderObject* object, IntSize& size)
 
188
void clampImageBufferSizeToViewport(FrameView* frameView, IntSize& size)
160
189
{
161
 
    if (!object || !object->isRenderView())
162
 
        return;
163
 
 
164
 
    RenderView* view = toRenderView(object);
165
 
    if (!view->frameView())
166
 
        return;
167
 
 
168
 
    int viewWidth = view->frameView()->visibleWidth();
169
 
    int viewHeight = view->frameView()->visibleHeight();
 
190
    if (!frameView)
 
191
        return;
 
192
 
 
193
    int viewWidth = frameView->visibleWidth();
 
194
    int viewHeight = frameView->visibleHeight();
170
195
 
171
196
    if (size.width() > viewWidth)
172
197
        size.setWidth(viewWidth);
175
200
        size.setHeight(viewHeight);
176
201
}
177
202
 
178
 
FloatRect computeContainerBoundingBox(const RenderObject* container, bool includeAllPaintedContent)
 
203
FloatRect SVGRenderBase::computeContainerBoundingBox(const RenderObject* container, bool includeAllPaintedContent)
179
204
{
180
205
    FloatRect boundingBox;
181
206
 
189
214
    return boundingBox;
190
215
}
191
216
 
192
 
FloatRect filterBoundingBoxForRenderer(const RenderObject* object)
 
217
FloatRect SVGRenderBase::filterBoundingBoxForRenderer(const RenderObject* object)
193
218
{
194
219
#if ENABLE(SVG_FILTERS)
195
220
    SVGResourceFilter* filter = getFilterById(object->document(), object->style()->svgStyle()->filter());