Skip to content

Commit

Permalink
Merge r183887 - RenderLayer::currentTransform computes a pixel snappe…
Browse files Browse the repository at this point in the history
…d rect it doesn't use.

https://bugs.webkit.org/show_bug.cgi?id=144708

Reviewed by Simon Fraser.

* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::currentTransform):

Only compute a pixel snapped rect if we actually end up needing it. The common case
is that this rect is not needed, so pushing it inside the two if statements
speeds up the common case.
  • Loading branch information
David Hyatt authored and carlosgcampos committed May 12, 2015
1 parent faa9428 commit 22cb891
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
14 changes: 14 additions & 0 deletions Source/WebCore/ChangeLog
@@ -1,3 +1,17 @@
2015-05-06 David Hyatt <hyatt@apple.com>

RenderLayer::currentTransform computes a pixel snapped rect it doesn't use.
https://bugs.webkit.org/show_bug.cgi?id=144708

Reviewed by Simon Fraser.

* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::currentTransform):

Only compute a pixel snapped rect if we actually end up needing it. The common case
is that this rect is not needed, so pushing it inside the two if statements
speeds up the common case.

2015-05-06 David Hyatt <hyatt@apple.com>

Optimize topLeftLocationOffset() addition in updateLayerPosition
Expand Down
5 changes: 3 additions & 2 deletions Source/WebCore/rendering/RenderLayer.cpp
Expand Up @@ -971,12 +971,12 @@ TransformationMatrix RenderLayer::currentTransform(RenderStyle::ApplyTransformOr
{
if (!m_transform)
return TransformationMatrix();

RenderBox* box = renderBox();
ASSERT(box);
FloatRect pixelSnappedBorderRect = snapRectToDevicePixels(box->borderBoxRect(), box->document().deviceScaleFactor());
if (renderer().style().isRunningAcceleratedAnimation()) {
TransformationMatrix currTransform;
FloatRect pixelSnappedBorderRect = snapRectToDevicePixels(box->borderBoxRect(), box->document().deviceScaleFactor());
RefPtr<RenderStyle> style = renderer().animation().getAnimatedStyleForRenderer(renderer());
style->applyTransform(currTransform, pixelSnappedBorderRect, applyOrigin);
makeMatrixRenderable(currTransform, canRender3DTransforms());
Expand All @@ -986,6 +986,7 @@ TransformationMatrix RenderLayer::currentTransform(RenderStyle::ApplyTransformOr
// m_transform includes transform-origin, so we need to recompute the transform here.
if (applyOrigin == RenderStyle::ExcludeTransformOrigin) {
TransformationMatrix currTransform;
FloatRect pixelSnappedBorderRect = snapRectToDevicePixels(box->borderBoxRect(), box->document().deviceScaleFactor());
box->style().applyTransform(currTransform, pixelSnappedBorderRect, RenderStyle::ExcludeTransformOrigin);
makeMatrixRenderable(currTransform, canRender3DTransforms());
return currTransform;
Expand Down

0 comments on commit 22cb891

Please sign in to comment.