mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-10 20:05:49 +00:00
Bug 1419764 - Improve performance where a transform is set by direct matrix manipulation. r=dholbert
MozReview-Commit-ID: zzDTSXtRiU
This commit is contained in:
parent
c47d3e44c9
commit
4e0dcdc8da
@ -96,7 +96,7 @@ public:
|
||||
return false;
|
||||
}
|
||||
mSVGView->mTransforms = new nsSVGAnimatedTransformList();
|
||||
if (NS_FAILED(mSVGView->mTransforms->SetBaseValueString(aParams))) {
|
||||
if (NS_FAILED(mSVGView->mTransforms->SetBaseValueString(aParams, mRoot))) {
|
||||
return false;
|
||||
}
|
||||
} else if (IsMatchingParameter(aToken, NS_LITERAL_STRING("zoomAndPan"))) {
|
||||
|
@ -21,7 +21,8 @@ namespace mozilla {
|
||||
using namespace dom;
|
||||
|
||||
nsresult
|
||||
nsSVGAnimatedTransformList::SetBaseValueString(const nsAString& aValue)
|
||||
nsSVGAnimatedTransformList::SetBaseValueString(const nsAString& aValue,
|
||||
nsSVGElement* aSVGElement)
|
||||
{
|
||||
SVGTransformList newBaseValue;
|
||||
nsresult rv = newBaseValue.SetValueFromString(aValue);
|
||||
@ -29,11 +30,12 @@ nsSVGAnimatedTransformList::SetBaseValueString(const nsAString& aValue)
|
||||
return rv;
|
||||
}
|
||||
|
||||
return SetBaseValue(newBaseValue);
|
||||
return SetBaseValue(newBaseValue, aSVGElement);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsSVGAnimatedTransformList::SetBaseValue(const SVGTransformList& aValue)
|
||||
nsSVGAnimatedTransformList::SetBaseValue(const SVGTransformList& aValue,
|
||||
nsSVGElement* aSVGElement)
|
||||
{
|
||||
SVGAnimatedTransformList *domWrapper =
|
||||
SVGAnimatedTransformList::GetDOMWrapperIfExists(this);
|
||||
@ -60,7 +62,12 @@ nsSVGAnimatedTransformList::SetBaseValue(const SVGTransformList& aValue)
|
||||
domWrapper->InternalBaseValListWillChangeLengthTo(mBaseVal.Length());
|
||||
} else {
|
||||
mIsAttrSet = true;
|
||||
mHadTransformBeforeLastBaseValChange = hadTransform;
|
||||
// If we set this flag to false, we're indicating that aSVGElement's frames
|
||||
// will need reconstructing to account for stacking context changes.
|
||||
// If aSVGElement doesn't have any frames, then that's clearly unnecessary,
|
||||
// so in that case we set the flag to true.
|
||||
mHadTransformBeforeLastBaseValChange =
|
||||
!aSVGElement->GetPrimaryFrame() || hadTransform;
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
@ -60,9 +60,11 @@ public:
|
||||
return mBaseVal;
|
||||
}
|
||||
|
||||
nsresult SetBaseValue(const SVGTransformList& aValue);
|
||||
nsresult SetBaseValue(const SVGTransformList& aValue,
|
||||
nsSVGElement* aSVGElement);
|
||||
|
||||
nsresult SetBaseValueString(const nsAString& aValue);
|
||||
nsresult SetBaseValueString(const nsAString& aValue,
|
||||
nsSVGElement* aSVGElement);
|
||||
|
||||
void ClearBaseValue();
|
||||
|
||||
|
@ -621,7 +621,7 @@ nsSVGElement::ParseAttribute(int32_t aNamespaceID,
|
||||
// nsSVGAnimatedTransformList is/has been allocated:
|
||||
nsSVGAnimatedTransformList *transformList =
|
||||
GetAnimatedTransformList(DO_ALLOCATE);
|
||||
rv = transformList->SetBaseValueString(aValue);
|
||||
rv = transformList->SetBaseValueString(aValue, this);
|
||||
if (NS_FAILED(rv)) {
|
||||
transformList->ClearBaseValue();
|
||||
} else {
|
||||
|
@ -153,6 +153,7 @@ skip-if = toolkit == 'android' # Bug 1355836
|
||||
[test_flush_on_paint.html]
|
||||
skip-if = true # Bug 688128
|
||||
[test_frame_reconstruction_for_pseudo_elements.html]
|
||||
[test_frame_reconstruction_for_svg_transforms.html]
|
||||
[test_frame_reconstruction_scroll_restore.html]
|
||||
[test_getBoxQuads_convertPointRectQuad.html]
|
||||
support-files =
|
||||
|
@ -0,0 +1,46 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=1419764
|
||||
-->
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Test for Bug 1419764</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
<script type="application/javascript">
|
||||
|
||||
/** Test for Bug 1419764 **/
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
function run() {
|
||||
var utils = SpecialPowers.getDOMWindowUtils(window);
|
||||
var rect = document.querySelector("rect");
|
||||
|
||||
var matrix = rect.transform.baseVal[0].matrix;
|
||||
|
||||
matrix.e = 100;
|
||||
document.documentElement.offsetTop; // flush layout
|
||||
|
||||
var startcount = utils.framesConstructed;
|
||||
|
||||
matrix.e = 200;
|
||||
document.documentElement.offsetTop; // flush layout
|
||||
|
||||
var endcount = utils.framesConstructed;
|
||||
is(endcount, startcount, "should not do frame construction");
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body onload="run()">
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1419764">Mozilla Bug 1419764</a>
|
||||
<svg>
|
||||
<rect transform="translate(1 1)" width="20" height="20" fill="yellow"/>
|
||||
</svg>
|
||||
<pre id="test">
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
@ -8,7 +8,7 @@ fuzzy-if(skiaContent,7,90) == rotate-angle-1.svg rotate-angle-ref.svg
|
||||
fuzzy-if(skiaContent,7,90) == rotate-angle-2.svg rotate-angle-ref.svg
|
||||
fuzzy-if(skiaContent,7,130) == rotate-angle-3.svg rotate-angle-ref.svg
|
||||
fuzzy-if(skiaContent,7,90) == rotate-angle-4.svg rotate-angle-ref.svg
|
||||
fuzzy-if(skiaContent,1,130) == rotate-angle-5.svg rotate-angle-ref.svg
|
||||
fuzzy-if(skiaContent,7,60) == rotate-angle-5.svg rotate-angle-ref.svg
|
||||
fuzzy(12,27) fuzzy-if(skiaContent,1,180) fuzzy-if(Android,16,3) fuzzy-if(webrender,7-7,306-306) == scale-1.svg scale-1-ref.svg # bug 981004
|
||||
== set-transform-1.svg lime.svg
|
||||
fuzzy-if(winWidget||gtkWidget||OSX,1,27) fuzzy-if(skiaContent,7,1548) == skew-1.svg skew-1-ref.svg # bug 983671, Bug 1260629
|
||||
|
Loading…
Reference in New Issue
Block a user