[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.18-1-697-g2f78b87
oliver at apple.com
oliver at apple.com
Wed Jan 20 22:26:48 UTC 2010
The following commit has been merged in the debian/unstable branch:
commit 7bbf123aa8746691105c416a160698cced618449
Author: oliver at apple.com <oliver at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Sat Jan 16 23:04:32 2010 +0000
2010-01-16 Oliver Hunt <oliver at 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:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@53365 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index e29fcc2..f438f67 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,41 @@
+2010-01-16 Oliver Hunt <oliver at 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:
+
2010-01-16 Darin Adler <darin at apple.com>
Reviewed by Oliver Hunt and Alexey Proskuryakov.
diff --git a/WebCore/rendering/RenderForeignObject.cpp b/WebCore/rendering/RenderForeignObject.cpp
index 35bc207..573ae96 100644
--- a/WebCore/rendering/RenderForeignObject.cpp
+++ b/WebCore/rendering/RenderForeignObject.cpp
@@ -88,9 +88,10 @@ void RenderForeignObject::computeRectForRepaint(RenderBoxModelObject* repaintCon
RenderBlock::computeRectForRepaint(repaintContainer, rect, fixed);
}
-TransformationMatrix RenderForeignObject::localToParentTransform() const
+const TransformationMatrix& RenderForeignObject::localToParentTransform() const
{
- return localTransform() * translationForAttributes();
+ m_localToParentTransform = localTransform() * translationForAttributes();
+ return m_localToParentTransform;
}
void RenderForeignObject::layout()
diff --git a/WebCore/rendering/RenderForeignObject.h b/WebCore/rendering/RenderForeignObject.h
index d64c015..8ad223f 100644
--- a/WebCore/rendering/RenderForeignObject.h
+++ b/WebCore/rendering/RenderForeignObject.h
@@ -38,7 +38,7 @@ public:
virtual void paint(PaintInfo&, int parentX, int parentY);
- virtual TransformationMatrix localToParentTransform() const;
+ virtual const TransformationMatrix& localToParentTransform() const;
virtual void computeRectForRepaint(RenderBoxModelObject* repaintContainer, IntRect&, bool fixed = false);
virtual bool requiresLayer() const { return false; }
@@ -58,6 +58,7 @@ public:
virtual TransformationMatrix localTransform() const { return m_localTransform; }
TransformationMatrix m_localTransform;
+ mutable TransformationMatrix m_localToParentTransform;
};
} // namespace WebCore
diff --git a/WebCore/rendering/RenderObject.cpp b/WebCore/rendering/RenderObject.cpp
index 74d0ef3..9d4e2cd 100644
--- a/WebCore/rendering/RenderObject.cpp
+++ b/WebCore/rendering/RenderObject.cpp
@@ -2509,14 +2509,14 @@ FloatRect RenderObject::repaintRectInLocalCoordinates() const
TransformationMatrix RenderObject::localTransform() const
{
- return TransformationMatrix();
+ static const TransformationMatrix identity;
+ return identity;
}
-TransformationMatrix RenderObject::localToParentTransform() const
+const TransformationMatrix& RenderObject::localToParentTransform() const
{
- // FIXME: This double virtual call indirection is temporary until I can land the
- // rest of the of the localToParentTransform() support for SVG.
- return localTransform();
+ static const TransformationMatrix identity;
+ return identity;
}
TransformationMatrix RenderObject::absoluteTransform() const
diff --git a/WebCore/rendering/RenderObject.h b/WebCore/rendering/RenderObject.h
index 3b02b84..7d7a9ee 100644
--- a/WebCore/rendering/RenderObject.h
+++ b/WebCore/rendering/RenderObject.h
@@ -347,7 +347,7 @@ public:
// Returns the full transform mapping from local coordinates to local coords for the parent SVG renderer
// This includes any viewport transforms and x/y offsets as well as the transform="" value off the element.
- virtual TransformationMatrix localToParentTransform() const;
+ virtual const TransformationMatrix& localToParentTransform() const;
// Walks up the parent chain to create a transform which maps from local to document coords
// NOTE: This method is deprecated! It doesn't respect scroll offsets or repaint containers.
diff --git a/WebCore/rendering/RenderPath.cpp b/WebCore/rendering/RenderPath.cpp
index 1d42d7e..f497dcf 100644
--- a/WebCore/rendering/RenderPath.cpp
+++ b/WebCore/rendering/RenderPath.cpp
@@ -69,7 +69,7 @@ RenderPath::RenderPath(SVGStyledTransformableElement* node)
{
}
-TransformationMatrix RenderPath::localToParentTransform() const
+const TransformationMatrix& RenderPath::localToParentTransform() const
{
return m_localTransform;
}
@@ -265,7 +265,7 @@ bool RenderPath::nodeAtFloatPoint(const HitTestRequest&, HitTestResult& result,
if (hitTestAction != HitTestForeground)
return false;
- FloatPoint localPoint = localToParentTransform().inverse().mapPoint(pointInParent);
+ FloatPoint localPoint = m_localTransform.inverse().mapPoint(pointInParent);
PointerEventsHitRules hitRules(PointerEventsHitRules::SVG_PATH_HITTESTING, style()->pointerEvents());
diff --git a/WebCore/rendering/RenderPath.h b/WebCore/rendering/RenderPath.h
index ae08088..be4c2dc 100644
--- a/WebCore/rendering/RenderPath.h
+++ b/WebCore/rendering/RenderPath.h
@@ -52,7 +52,7 @@ private:
virtual FloatRect markerBoundingBox() const;
virtual FloatRect repaintRectInLocalCoordinates() const;
- virtual TransformationMatrix localToParentTransform() const;
+ virtual const TransformationMatrix& localToParentTransform() const;
void setPath(const Path&);
diff --git a/WebCore/rendering/RenderSVGImage.h b/WebCore/rendering/RenderSVGImage.h
index 7791613..0558aed 100644
--- a/WebCore/rendering/RenderSVGImage.h
+++ b/WebCore/rendering/RenderSVGImage.h
@@ -43,7 +43,7 @@ namespace WebCore {
virtual const char* renderName() const { return "RenderSVGImage"; }
virtual bool isSVGImage() const { return true; }
- virtual TransformationMatrix localToParentTransform() const { return m_localTransform; }
+ virtual const TransformationMatrix& localToParentTransform() const { return m_localTransform; }
virtual FloatRect objectBoundingBox() const;
virtual FloatRect strokeBoundingBox() const { return m_localBounds; }
diff --git a/WebCore/rendering/RenderSVGRoot.cpp b/WebCore/rendering/RenderSVGRoot.cpp
index 176817f..4a3bbcc 100644
--- a/WebCore/rendering/RenderSVGRoot.cpp
+++ b/WebCore/rendering/RenderSVGRoot.cpp
@@ -224,14 +224,15 @@ TransformationMatrix RenderSVGRoot::localToRepaintContainerTransform(const IntPo
return localToParentTransform() * parentToContainer;
}
-TransformationMatrix RenderSVGRoot::localToParentTransform() const
+const TransformationMatrix& RenderSVGRoot::localToParentTransform() const
{
IntSize parentToBorderBoxOffset = parentOriginToBorderBox();
TransformationMatrix borderBoxOriginToParentOrigin;
borderBoxOriginToParentOrigin.translate(parentToBorderBoxOffset.width(), parentToBorderBoxOffset.height());
- return localToBorderBoxTransform() * borderBoxOriginToParentOrigin;
+ m_localToParentTransform = localToBorderBoxTransform() * borderBoxOriginToParentOrigin;
+ return m_localToParentTransform;
}
// FIXME: This method should be removed as soon as callers to RenderBox::absoluteTransform() can be removed.
diff --git a/WebCore/rendering/RenderSVGRoot.h b/WebCore/rendering/RenderSVGRoot.h
index 3937b41..b2f8f7c 100644
--- a/WebCore/rendering/RenderSVGRoot.h
+++ b/WebCore/rendering/RenderSVGRoot.h
@@ -54,7 +54,7 @@ private:
virtual void layout();
virtual void paint(PaintInfo&, int parentX, int parentY);
- virtual TransformationMatrix localToParentTransform() const;
+ virtual const TransformationMatrix& localToParentTransform() const;
bool fillContains(const FloatPoint&) const;
bool strokeContains(const FloatPoint&) const;
@@ -85,6 +85,7 @@ private:
RenderObjectChildList m_children;
FloatSize m_viewportSize;
+ mutable TransformationMatrix m_localToParentTransform;
};
inline RenderSVGRoot* toRenderSVGRoot(RenderObject* object)
diff --git a/WebCore/rendering/RenderSVGText.h b/WebCore/rendering/RenderSVGText.h
index 3a36fde..d001d1c 100644
--- a/WebCore/rendering/RenderSVGText.h
+++ b/WebCore/rendering/RenderSVGText.h
@@ -44,7 +44,7 @@ private:
virtual bool isSVGText() const { return true; }
- virtual TransformationMatrix localToParentTransform() const { return m_localTransform; }
+ virtual const TransformationMatrix& localToParentTransform() const { return m_localTransform; }
virtual void paint(PaintInfo&, int tx, int ty);
virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, int x, int y, int tx, int ty, HitTestAction);
diff --git a/WebCore/rendering/RenderSVGTransformableContainer.cpp b/WebCore/rendering/RenderSVGTransformableContainer.cpp
index 2324eee..6520c6e 100644
--- a/WebCore/rendering/RenderSVGTransformableContainer.cpp
+++ b/WebCore/rendering/RenderSVGTransformableContainer.cpp
@@ -34,7 +34,7 @@ RenderSVGTransformableContainer::RenderSVGTransformableContainer(SVGStyledTransf
{
}
-TransformationMatrix RenderSVGTransformableContainer::localToParentTransform() const
+const TransformationMatrix& RenderSVGTransformableContainer::localToParentTransform() const
{
return m_localTransform;
}
diff --git a/WebCore/rendering/RenderSVGTransformableContainer.h b/WebCore/rendering/RenderSVGTransformableContainer.h
index c929761..43e4001 100644
--- a/WebCore/rendering/RenderSVGTransformableContainer.h
+++ b/WebCore/rendering/RenderSVGTransformableContainer.h
@@ -31,7 +31,7 @@ namespace WebCore {
public:
RenderSVGTransformableContainer(SVGStyledTransformableElement*);
- virtual TransformationMatrix localToParentTransform() const;
+ virtual const TransformationMatrix& localToParentTransform() const;
private:
virtual void calculateLocalTransform();
diff --git a/WebCore/rendering/RenderSVGViewportContainer.cpp b/WebCore/rendering/RenderSVGViewportContainer.cpp
index ef8207a..b46e8c2 100644
--- a/WebCore/rendering/RenderSVGViewportContainer.cpp
+++ b/WebCore/rendering/RenderSVGViewportContainer.cpp
@@ -105,11 +105,12 @@ TransformationMatrix RenderSVGViewportContainer::viewportTransform() const
return TransformationMatrix();
}
-TransformationMatrix RenderSVGViewportContainer::localToParentTransform() const
+const TransformationMatrix& RenderSVGViewportContainer::localToParentTransform() const
{
TransformationMatrix viewportTranslation;
viewportTranslation.translate(m_viewport.x(), m_viewport.y());
- return viewportTransform() * viewportTranslation;
+ m_localToParentTransform = viewportTransform() * viewportTranslation;
+ return m_localToParentTransform;
// If this class were ever given a localTransform(), then the above would read:
// return viewportTransform() * localTransform() * viewportTranslation;
}
diff --git a/WebCore/rendering/RenderSVGViewportContainer.h b/WebCore/rendering/RenderSVGViewportContainer.h
index 2dc5544..ee08b60 100644
--- a/WebCore/rendering/RenderSVGViewportContainer.h
+++ b/WebCore/rendering/RenderSVGViewportContainer.h
@@ -46,7 +46,7 @@ private:
virtual const char* renderName() const { return "RenderSVGViewportContainer"; }
TransformationMatrix viewportTransform() const;
- virtual TransformationMatrix localToParentTransform() const;
+ virtual const TransformationMatrix& localToParentTransform() const;
// FIXME: This override should be removed once callers of RenderBox::absoluteTransform() can be removed.
virtual TransformationMatrix absoluteTransform() const;
@@ -57,6 +57,7 @@ private:
virtual bool pointIsInsideViewportClip(const FloatPoint& pointInParent);
FloatRect m_viewport;
+ mutable TransformationMatrix m_localToParentTransform;
};
inline RenderSVGViewportContainer* toRenderSVGViewportContainer(RenderObject* object)
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list