⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 157940 in webkit


Ignore:
Timestamp:
Oct 24, 2013, 11:41:42 AM (13 years ago)
Author:
akling@apple.com
Message:

SVG: RenderElement-ize intersectRepaintRectWithResources().
<​https://webkit.org/b/123278>

SVGRenderSupport::intersectRepaintRectWithResources() is only ever
called with non-text renderers so make it take RenderElement&.

Had to tweak RenderSVGResource::resourceBoundingBox() to take the
renderer by reference.

Reviewed by Antti Koivisto.

Location:
trunk/Source/WebCore
Files:
20 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r157939 r157940  
     12013-10-24  Andreas Kling  <akling@apple.com>
     2
     3        SVG: RenderElement-ize intersectRepaintRectWithResources().
     4        <https://webkit.org/b/123278>
     5
     6        SVGRenderSupport::intersectRepaintRectWithResources() is only ever
     7        called with non-text renderers so make it take RenderElement&.
     8
     9        Had to tweak RenderSVGResource::resourceBoundingBox() to take the
     10        renderer by reference.
     11
     12        Reviewed by Antti Koivisto.
     13
    1142013-10-24  Joseph Pecoraro  <pecoraro@apple.com>
    215
  • trunk/Source/WebCore/rendering/svg/RenderSVGContainer.cpp

    r157515 r157940  
    170170{
    171171    SVGRenderSupport::computeContainerBoundingBoxes(this, m_objectBoundingBox, m_objectBoundingBoxValid, m_strokeBoundingBox, m_repaintBoundingBox);
    172     SVGRenderSupport::intersectRepaintRectWithResources(this, m_repaintBoundingBox);
     172    SVGRenderSupport::intersectRepaintRectWithResources(*this, m_repaintBoundingBox);
    173173}
    174174
  • trunk/Source/WebCore/rendering/svg/RenderSVGImage.cpp

    r156876 r157940  
    9999    if (m_needsBoundariesUpdate) {
    100100        m_repaintBoundingBoxExcludingShadow = m_objectBoundingBox;
    101         SVGRenderSupport::intersectRepaintRectWithResources(this, m_repaintBoundingBoxExcludingShadow);
     101        SVGRenderSupport::intersectRepaintRectWithResources(*this, m_repaintBoundingBoxExcludingShadow);
    102102
    103103        m_repaintBoundingBox = m_repaintBoundingBoxExcludingShadow;
  • trunk/Source/WebCore/rendering/svg/RenderSVGResource.h

    r157919 r157940  
    6565    virtual bool applyResource(RenderObject*, RenderStyle*, GraphicsContext*&, unsigned short resourceMode) = 0;
    6666    virtual void postApplyResource(RenderObject*, GraphicsContext*&, unsigned short, const Path*, const RenderSVGShape*) { }
    67     virtual FloatRect resourceBoundingBox(RenderObject*) = 0;
     67    virtual FloatRect resourceBoundingBox(const RenderObject&) = 0;
    6868
    6969    virtual RenderSVGResourceType resourceType() const = 0;
  • trunk/Source/WebCore/rendering/svg/RenderSVGResourceClipper.cpp

    r157924 r157940  
    310310}
    311311
    312 FloatRect RenderSVGResourceClipper::resourceBoundingBox(RenderObject* object)
     312FloatRect RenderSVGResourceClipper::resourceBoundingBox(const RenderObject& object)
    313313{
    314314    // Resource was not layouted yet. Give back the boundingBox of the object.
    315315    if (selfNeedsLayout())
    316         return object->objectBoundingBox();
     316        return object.objectBoundingBox();
    317317   
    318318    if (m_clipBoundaries.isEmpty())
    … …  
    320320
    321321    if (clipPathElement().clipPathUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) {
    322         FloatRect objectBoundingBox = object->objectBoundingBox();
     322        FloatRect objectBoundingBox = object.objectBoundingBox();
    323323        AffineTransform transform;
    324324        transform.translate(objectBoundingBox.x(), objectBoundingBox.y());
  • trunk/Source/WebCore/rendering/svg/RenderSVGResourceClipper.h

    r156968 r157940  
    5757    // FIXME: We made applyClippingToContext public because we cannot call applyResource on HTML elements (it asserts on RenderObject::objectBoundingBox)
    5858    bool applyClippingToContext(RenderObject*, const FloatRect&, const FloatRect&, GraphicsContext*);
    59     virtual FloatRect resourceBoundingBox(RenderObject*);
     59    virtual FloatRect resourceBoundingBox(const RenderObject&) OVERRIDE;
    6060
    6161    virtual RenderSVGResourceType resourceType() const { return ClipperResourceType; }
  • trunk/Source/WebCore/rendering/svg/RenderSVGResourceFilter.cpp

    r157924 r157940  
    312312}
    313313
    314 FloatRect RenderSVGResourceFilter::resourceBoundingBox(RenderObject* object)
    315 {
    316     return SVGLengthContext::resolveRectangle<SVGFilterElement>(&filterElement(), filterElement().filterUnits(), object->objectBoundingBox());
     314FloatRect RenderSVGResourceFilter::resourceBoundingBox(const RenderObject& object)
     315{
     316    return SVGLengthContext::resolveRectangle<SVGFilterElement>(&filterElement(), filterElement().filterUnits(), object.objectBoundingBox());
    317317}
    318318
  • trunk/Source/WebCore/rendering/svg/RenderSVGResourceFilter.h

    r157907 r157940  
    7878    virtual void postApplyResource(RenderObject*, GraphicsContext*&, unsigned short resourceMode, const Path*, const RenderSVGShape*);
    7979
    80     virtual FloatRect resourceBoundingBox(RenderObject*);
     80    virtual FloatRect resourceBoundingBox(const RenderObject&) OVERRIDE;
    8181
    8282    std::unique_ptr<SVGFilterBuilder> buildPrimitives(SVGFilter*);
  • trunk/Source/WebCore/rendering/svg/RenderSVGResourceGradient.h

    r157653 r157940  
    5353    virtual bool applyResource(RenderObject*, RenderStyle*, GraphicsContext*&, unsigned short resourceMode) OVERRIDE FINAL;
    5454    virtual void postApplyResource(RenderObject*, GraphicsContext*&, unsigned short resourceMode, const Path*, const RenderSVGShape*) OVERRIDE FINAL;
    55     virtual FloatRect resourceBoundingBox(RenderObject*) OVERRIDE FINAL { return FloatRect(); }
     55    virtual FloatRect resourceBoundingBox(const RenderObject&) OVERRIDE FINAL { return FloatRect(); }
    5656
    5757protected:
  • trunk/Source/WebCore/rendering/svg/RenderSVGResourceMarker.h

    r155755 r157940  
    5757
    5858    virtual bool applyResource(RenderObject*, RenderStyle*, GraphicsContext*&, unsigned short) { return false; }
    59     virtual FloatRect resourceBoundingBox(RenderObject*) { return FloatRect(); }
     59    virtual FloatRect resourceBoundingBox(const RenderObject&) OVERRIDE { return FloatRect(); }
    6060
    6161    FloatPoint referencePoint() const;
  • trunk/Source/WebCore/rendering/svg/RenderSVGResourceMasker.cpp

    r157924 r157940  
    162162}
    163163
    164 FloatRect RenderSVGResourceMasker::resourceBoundingBox(RenderObject* object)
     164FloatRect RenderSVGResourceMasker::resourceBoundingBox(const RenderObject& object)
    165165{
    166     FloatRect objectBoundingBox = object->objectBoundingBox();
     166    FloatRect objectBoundingBox = object.objectBoundingBox();
    167167    FloatRect maskBoundaries = SVGLengthContext::resolveRectangle<SVGMaskElement>(&maskElement(), maskElement().maskUnits(), objectBoundingBox);
    168168
  • trunk/Source/WebCore/rendering/svg/RenderSVGResourceMasker.h

    r156968 r157940  
    4949    virtual void removeClientFromCache(RenderObject*, bool markForInvalidation = true);
    5050    virtual bool applyResource(RenderObject*, RenderStyle*, GraphicsContext*&, unsigned short resourceMode);
    51     virtual FloatRect resourceBoundingBox(RenderObject*);
     51    virtual FloatRect resourceBoundingBox(const RenderObject&) OVERRIDE;
    5252
    5353    SVGUnitTypes::SVGUnitType maskUnits() const { return maskElement().maskUnits(); }
  • trunk/Source/WebCore/rendering/svg/RenderSVGResourcePattern.h

    r157653 r157940  
    5454    virtual bool applyResource(RenderObject*, RenderStyle*, GraphicsContext*&, unsigned short resourceMode);
    5555    virtual void postApplyResource(RenderObject*, GraphicsContext*&, unsigned short resourceMode, const Path*, const RenderSVGShape*);
    56     virtual FloatRect resourceBoundingBox(RenderObject*) { return FloatRect(); }
     56    virtual FloatRect resourceBoundingBox(const RenderObject&) OVERRIDE { return FloatRect(); }
    5757
    5858    virtual RenderSVGResourceType resourceType() const { return s_resourceType; }
  • trunk/Source/WebCore/rendering/svg/RenderSVGResourceSolidColor.h

    r101517 r157940  
    3838    virtual bool applyResource(RenderObject*, RenderStyle*, GraphicsContext*&, unsigned short resourceMode);
    3939    virtual void postApplyResource(RenderObject*, GraphicsContext*&, unsigned short resourceMode, const Path*, const RenderSVGShape*);
    40     virtual FloatRect resourceBoundingBox(RenderObject*) { return FloatRect(); }
     40    virtual FloatRect resourceBoundingBox(const RenderObject&) OVERRIDE { return FloatRect(); }
    4141
    4242    virtual RenderSVGResourceType resourceType() const { return s_resourceType; }
  • trunk/Source/WebCore/rendering/svg/RenderSVGRoot.cpp

    r157828 r157940  
    400400{
    401401    SVGRenderSupport::computeContainerBoundingBoxes(this, m_objectBoundingBox, m_objectBoundingBoxValid, m_strokeBoundingBox, m_repaintBoundingBoxExcludingShadow);
    402     SVGRenderSupport::intersectRepaintRectWithResources(this, m_repaintBoundingBoxExcludingShadow);
     402    SVGRenderSupport::intersectRepaintRectWithResources(*this, m_repaintBoundingBoxExcludingShadow);
    403403    m_repaintBoundingBoxExcludingShadow.inflate(borderAndPaddingWidth());
    404404
  • trunk/Source/WebCore/rendering/svg/RenderSVGShape.cpp

    r157919 r157940  
    405405{
    406406    m_repaintBoundingBoxExcludingShadow = strokeBoundingBox();
    407     SVGRenderSupport::intersectRepaintRectWithResources(this, m_repaintBoundingBoxExcludingShadow);
     407    SVGRenderSupport::intersectRepaintRectWithResources(*this, m_repaintBoundingBoxExcludingShadow);
    408408
    409409    m_repaintBoundingBox = m_repaintBoundingBoxExcludingShadow;
  • trunk/Source/WebCore/rendering/svg/RenderSVGText.cpp

    r157515 r157940  
    528528{
    529529    FloatRect repaintRect = strokeBoundingBox();
    530     SVGRenderSupport::intersectRepaintRectWithResources(this, repaintRect);
     530    SVGRenderSupport::intersectRepaintRectWithResources(*this, repaintRect);
    531531
    532532    if (const ShadowData* textShadow = style()->textShadow())
  • trunk/Source/WebCore/rendering/svg/SVGRenderSupport.cpp

    r157222 r157940  
    372372}
    373373
    374 void SVGRenderSupport::intersectRepaintRectWithResources(const RenderObject* object, FloatRect& repaintRect)
    375 {
    376     ASSERT(object);
    377 
    378     RenderObject* renderer = const_cast<RenderObject*>(object);
    379     SVGResources* resources = SVGResourcesCache::cachedResourcesForRenderObject(renderer);
     374void SVGRenderSupport::intersectRepaintRectWithResources(const RenderElement& renderer, FloatRect& repaintRect)
     375{
     376    SVGResources* resources = SVGResourcesCache::cachedResourcesForRenderObject(&renderer);
    380377    if (!resources)
    381378        return;
  • trunk/Source/WebCore/rendering/svg/SVGRenderSupport.h

    r156285 r157940  
    5555
    5656    // Calculates the repaintRect in combination with filter, clipper and masker in local coordinates.
    57     static void intersectRepaintRectWithResources(const RenderObject*, FloatRect&);
     57    static void intersectRepaintRectWithResources(const RenderElement&, FloatRect&);
    5858
    5959    // Determines whether a container needs to be laid out because it's filtered and a child is being laid out.
  • trunk/Source/WebCore/rendering/svg/SVGRenderTreeAsText.cpp

    r157919 r157940  
    650650            ts << " ";
    651651            writeStandardPrefix(ts, *masker, 0);
    652             ts << " " << masker->resourceBoundingBox(&renderer) << "\n";
     652            ts << " " << masker->resourceBoundingBox(renderer) << "\n";
    653653        }
    654654    }
    … …  
    660660            ts << " ";
    661661            writeStandardPrefix(ts, *clipper, 0);
    662             ts << " " << clipper->resourceBoundingBox(&renderer) << "\n";
     662            ts << " " << clipper->resourceBoundingBox(renderer) << "\n";
    663663        }
    664664    }
    … …  
    671671            ts << " ";
    672672            writeStandardPrefix(ts, *filter, 0);
    673             ts << " " << filter->resourceBoundingBox(&renderer) << "\n";
     673            ts << " " << filter->resourceBoundingBox(renderer) << "\n";
    674674        }
    675675    }
Note: See TracChangeset for help on using the changeset viewer.