Changeset 53365 in webkit


Ignore:
Timestamp:
Jan 16, 2010 3:04:32 PM (14 years ago)
Author:
oliver@apple.com
Message:

2010-01-16 Oliver Hunt <oliver@apple.com>

Reviewed by Nikolas Zimmermann.

Copying TransformationMatrix consumed a lot of cpu time while scroll with cursor over content
https://bugs.webkit.org/show_bug.cgi?id=33766

Make localToParentTransform return by reference to avid copy overhead.
This is a little gnarly in places as it means we need to be able to
return temporary values in a few implementations, so we have to add
class fields to hold them, heppily the classes that these effect are

sufficiently uncommon for this to be okay.

  • rendering/RenderForeignObject.cpp: (WebCore::RenderForeignObject::localToParentTransform):
  • rendering/RenderForeignObject.h:
  • rendering/RenderObject.cpp: (WebCore::RenderObject::localTransform): (WebCore::RenderObject::localToParentTransform):
  • rendering/RenderObject.h:
  • rendering/RenderPath.cpp: (WebCore::RenderPath::localToParentTransform): (WebCore::RenderPath::nodeAtFloatPoint):
  • rendering/RenderPath.h:
  • rendering/RenderSVGImage.h: (WebCore::RenderSVGImage::localToParentTransform):
  • rendering/RenderSVGRoot.cpp: (WebCore::RenderSVGRoot::localToParentTransform):
  • rendering/RenderSVGRoot.h:
  • rendering/RenderSVGText.h: (WebCore::RenderSVGText::localToParentTransform):
  • rendering/RenderSVGTransformableContainer.cpp: (WebCore::RenderSVGTransformableContainer::localToParentTransform):
  • rendering/RenderSVGTransformableContainer.h:
  • rendering/RenderSVGViewportContainer.cpp: (WebCore::RenderSVGViewportContainer::localToParentTransform):
  • rendering/RenderSVGViewportContainer.h:
Location:
trunk/WebCore
Files:
15 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r53364 r53365  
     12010-01-16  Oliver Hunt  <oliver@apple.com>
     2
     3        Reviewed by Nikolas Zimmermann.
     4
     5        Copying TransformationMatrix consumed a lot of cpu time while scroll with cursor over content
     6        https://bugs.webkit.org/show_bug.cgi?id=33766
     7
     8        Make localToParentTransform return by reference to avid copy overhead.
     9        This is a little gnarly in places as it means we need to be able to
     10        return temporary values in a few implementations, so we have to add
     11        class fields to hold them, heppily the classes that these effect are
     12         sufficiently uncommon for this to be okay.
     13
     14        * rendering/RenderForeignObject.cpp:
     15        (WebCore::RenderForeignObject::localToParentTransform):
     16        * rendering/RenderForeignObject.h:
     17        * rendering/RenderObject.cpp:
     18        (WebCore::RenderObject::localTransform):
     19        (WebCore::RenderObject::localToParentTransform):
     20        * rendering/RenderObject.h:
     21        * rendering/RenderPath.cpp:
     22        (WebCore::RenderPath::localToParentTransform):
     23        (WebCore::RenderPath::nodeAtFloatPoint):
     24        * rendering/RenderPath.h:
     25        * rendering/RenderSVGImage.h:
     26        (WebCore::RenderSVGImage::localToParentTransform):
     27        * rendering/RenderSVGRoot.cpp:
     28        (WebCore::RenderSVGRoot::localToParentTransform):
     29        * rendering/RenderSVGRoot.h:
     30        * rendering/RenderSVGText.h:
     31        (WebCore::RenderSVGText::localToParentTransform):
     32        * rendering/RenderSVGTransformableContainer.cpp:
     33        (WebCore::RenderSVGTransformableContainer::localToParentTransform):
     34        * rendering/RenderSVGTransformableContainer.h:
     35        * rendering/RenderSVGViewportContainer.cpp:
     36        (WebCore::RenderSVGViewportContainer::localToParentTransform):
     37        * rendering/RenderSVGViewportContainer.h:
     38
    1392010-01-16  Darin Adler  <darin@apple.com>
    240
  • trunk/WebCore/rendering/RenderForeignObject.cpp

    r53103 r53365  
    8989}
    9090
    91 TransformationMatrix RenderForeignObject::localToParentTransform() const
     91const TransformationMatrix& RenderForeignObject::localToParentTransform() const
    9292{
    93     return localTransform() * translationForAttributes();
     93    m_localToParentTransform = localTransform() * translationForAttributes();
     94    return m_localToParentTransform;
    9495}
    9596
  • trunk/WebCore/rendering/RenderForeignObject.h

    r52647 r53365  
    3939    virtual void paint(PaintInfo&, int parentX, int parentY);
    4040
    41     virtual TransformationMatrix localToParentTransform() const;
     41    virtual const TransformationMatrix& localToParentTransform() const;
    4242
    4343    virtual void computeRectForRepaint(RenderBoxModelObject* repaintContainer, IntRect&, bool fixed = false);
     
    5959
    6060    TransformationMatrix m_localTransform;
     61    mutable TransformationMatrix m_localToParentTransform;
    6162};
    6263
  • trunk/WebCore/rendering/RenderObject.cpp

    r53355 r53365  
    25102510TransformationMatrix RenderObject::localTransform() const
    25112511{
    2512     return TransformationMatrix();
    2513 }
    2514 
    2515 TransformationMatrix RenderObject::localToParentTransform() const
    2516 {
    2517     // FIXME: This double virtual call indirection is temporary until I can land the
    2518     // rest of the of the localToParentTransform() support for SVG.
    2519     return localTransform();
     2512    static const TransformationMatrix identity;
     2513    return identity;
     2514}
     2515
     2516const TransformationMatrix& RenderObject::localToParentTransform() const
     2517{
     2518    static const TransformationMatrix identity;
     2519    return identity;
    25202520}
    25212521
  • trunk/WebCore/rendering/RenderObject.h

    r53357 r53365  
    348348    // Returns the full transform mapping from local coordinates to local coords for the parent SVG renderer
    349349    // This includes any viewport transforms and x/y offsets as well as the transform="" value off the element.
    350     virtual TransformationMatrix localToParentTransform() const;
     350    virtual const TransformationMatrix& localToParentTransform() const;
    351351
    352352    // Walks up the parent chain to create a transform which maps from local to document coords
  • trunk/WebCore/rendering/RenderPath.cpp

    r53349 r53365  
    7070}
    7171
    72 TransformationMatrix RenderPath::localToParentTransform() const
     72const TransformationMatrix& RenderPath::localToParentTransform() const
    7373{
    7474    return m_localTransform;
     
    266266        return false;
    267267
    268     FloatPoint localPoint = localToParentTransform().inverse().mapPoint(pointInParent);
     268    FloatPoint localPoint = m_localTransform.inverse().mapPoint(pointInParent);
    269269
    270270    PointerEventsHitRules hitRules(PointerEventsHitRules::SVG_PATH_HITTESTING, style()->pointerEvents());
  • trunk/WebCore/rendering/RenderPath.h

    r52866 r53365  
    5353    virtual FloatRect repaintRectInLocalCoordinates() const;
    5454
    55     virtual TransformationMatrix localToParentTransform() const;
     55    virtual const TransformationMatrix& localToParentTransform() const;
    5656
    5757    void setPath(const Path&);
  • trunk/WebCore/rendering/RenderSVGImage.h

    r52865 r53365  
    4444        virtual bool isSVGImage() const { return true; }
    4545
    46         virtual TransformationMatrix localToParentTransform() const { return m_localTransform; }
     46        virtual const TransformationMatrix& localToParentTransform() const { return m_localTransform; }
    4747
    4848        virtual FloatRect objectBoundingBox() const;
  • trunk/WebCore/rendering/RenderSVGRoot.cpp

    r53300 r53365  
    225225}
    226226
    227 TransformationMatrix RenderSVGRoot::localToParentTransform() const
     227const TransformationMatrix& RenderSVGRoot::localToParentTransform() const
    228228{
    229229    IntSize parentToBorderBoxOffset = parentOriginToBorderBox();
     
    232232    borderBoxOriginToParentOrigin.translate(parentToBorderBoxOffset.width(), parentToBorderBoxOffset.height());
    233233
    234     return localToBorderBoxTransform() * borderBoxOriginToParentOrigin;
     234    m_localToParentTransform = localToBorderBoxTransform() * borderBoxOriginToParentOrigin;
     235    return m_localToParentTransform;
    235236}
    236237
  • trunk/WebCore/rendering/RenderSVGRoot.h

    r52647 r53365  
    5555    virtual void paint(PaintInfo&, int parentX, int parentY);
    5656
    57     virtual TransformationMatrix localToParentTransform() const;
     57    virtual const TransformationMatrix& localToParentTransform() const;
    5858
    5959    bool fillContains(const FloatPoint&) const;
     
    8686    RenderObjectChildList m_children;
    8787    FloatSize m_viewportSize;
     88    mutable TransformationMatrix m_localToParentTransform;
    8889};
    8990
  • trunk/WebCore/rendering/RenderSVGText.h

    r52647 r53365  
    4545    virtual bool isSVGText() const { return true; }
    4646
    47     virtual TransformationMatrix localToParentTransform() const { return m_localTransform; }
     47    virtual const TransformationMatrix& localToParentTransform() const { return m_localTransform; }
    4848
    4949    virtual void paint(PaintInfo&, int tx, int ty);
  • trunk/WebCore/rendering/RenderSVGTransformableContainer.cpp

    r43211 r53365  
    3535}
    3636
    37 TransformationMatrix RenderSVGTransformableContainer::localToParentTransform() const
     37const TransformationMatrix& RenderSVGTransformableContainer::localToParentTransform() const
    3838{
    3939    return m_localTransform;
  • trunk/WebCore/rendering/RenderSVGTransformableContainer.h

    r43211 r53365  
    3232        RenderSVGTransformableContainer(SVGStyledTransformableElement*);
    3333
    34         virtual TransformationMatrix localToParentTransform() const;
     34        virtual const TransformationMatrix& localToParentTransform() const;
    3535
    3636    private:
  • trunk/WebCore/rendering/RenderSVGViewportContainer.cpp

    r52866 r53365  
    106106}
    107107
    108 TransformationMatrix RenderSVGViewportContainer::localToParentTransform() const
     108const TransformationMatrix& RenderSVGViewportContainer::localToParentTransform() const
    109109{
    110110    TransformationMatrix viewportTranslation;
    111111    viewportTranslation.translate(m_viewport.x(), m_viewport.y());
    112     return viewportTransform() * viewportTranslation;
     112    m_localToParentTransform = viewportTransform() * viewportTranslation;
     113    return m_localToParentTransform;
    113114    // If this class were ever given a localTransform(), then the above would read:
    114115    // return viewportTransform() * localTransform() * viewportTranslation;
  • trunk/WebCore/rendering/RenderSVGViewportContainer.h

    r52866 r53365  
    4747
    4848    TransformationMatrix viewportTransform() const;
    49     virtual TransformationMatrix localToParentTransform() const;
     49    virtual const TransformationMatrix& localToParentTransform() const;
    5050
    5151    // FIXME: This override should be removed once callers of RenderBox::absoluteTransform() can be removed.
     
    5858
    5959    FloatRect m_viewport;
     60    mutable TransformationMatrix m_localToParentTransform;
    6061};
    6162 
Note: See TracChangeset for help on using the changeset viewer.