зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1419764 - Improve performance where a transform is set by direct matrix manipulation. r=dholbert
This commit is contained in:
Родитель
5bdb87edca
Коммит
d339da0191
|
@ -96,7 +96,7 @@ public:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
mSVGView->mTransforms = new nsSVGAnimatedTransformList();
|
mSVGView->mTransforms = new nsSVGAnimatedTransformList();
|
||||||
if (NS_FAILED(mSVGView->mTransforms->SetBaseValueString(aParams))) {
|
if (NS_FAILED(mSVGView->mTransforms->SetBaseValueString(aParams, mRoot))) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else if (IsMatchingParameter(aToken, NS_LITERAL_STRING("zoomAndPan"))) {
|
} else if (IsMatchingParameter(aToken, NS_LITERAL_STRING("zoomAndPan"))) {
|
||||||
|
|
|
@ -21,7 +21,8 @@ namespace mozilla {
|
||||||
using namespace dom;
|
using namespace dom;
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
nsSVGAnimatedTransformList::SetBaseValueString(const nsAString& aValue)
|
nsSVGAnimatedTransformList::SetBaseValueString(const nsAString& aValue,
|
||||||
|
nsSVGElement* aSVGElement)
|
||||||
{
|
{
|
||||||
SVGTransformList newBaseValue;
|
SVGTransformList newBaseValue;
|
||||||
nsresult rv = newBaseValue.SetValueFromString(aValue);
|
nsresult rv = newBaseValue.SetValueFromString(aValue);
|
||||||
|
@ -29,11 +30,12 @@ nsSVGAnimatedTransformList::SetBaseValueString(const nsAString& aValue)
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
return SetBaseValue(newBaseValue);
|
return SetBaseValue(newBaseValue, aSVGElement);
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
nsSVGAnimatedTransformList::SetBaseValue(const SVGTransformList& aValue)
|
nsSVGAnimatedTransformList::SetBaseValue(const SVGTransformList& aValue,
|
||||||
|
nsSVGElement* aSVGElement)
|
||||||
{
|
{
|
||||||
SVGAnimatedTransformList *domWrapper =
|
SVGAnimatedTransformList *domWrapper =
|
||||||
SVGAnimatedTransformList::GetDOMWrapperIfExists(this);
|
SVGAnimatedTransformList::GetDOMWrapperIfExists(this);
|
||||||
|
@ -60,7 +62,12 @@ nsSVGAnimatedTransformList::SetBaseValue(const SVGTransformList& aValue)
|
||||||
domWrapper->InternalBaseValListWillChangeLengthTo(mBaseVal.Length());
|
domWrapper->InternalBaseValListWillChangeLengthTo(mBaseVal.Length());
|
||||||
} else {
|
} else {
|
||||||
mIsAttrSet = true;
|
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;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,9 +60,11 @@ public:
|
||||||
return mBaseVal;
|
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();
|
void ClearBaseValue();
|
||||||
|
|
||||||
|
|
|
@ -621,7 +621,7 @@ nsSVGElement::ParseAttribute(int32_t aNamespaceID,
|
||||||
// nsSVGAnimatedTransformList is/has been allocated:
|
// nsSVGAnimatedTransformList is/has been allocated:
|
||||||
nsSVGAnimatedTransformList *transformList =
|
nsSVGAnimatedTransformList *transformList =
|
||||||
GetAnimatedTransformList(DO_ALLOCATE);
|
GetAnimatedTransformList(DO_ALLOCATE);
|
||||||
rv = transformList->SetBaseValueString(aValue);
|
rv = transformList->SetBaseValueString(aValue, this);
|
||||||
if (NS_FAILED(rv)) {
|
if (NS_FAILED(rv)) {
|
||||||
transformList->ClearBaseValue();
|
transformList->ClearBaseValue();
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -153,6 +153,7 @@ skip-if = toolkit == 'android' # Bug 1355836
|
||||||
[test_flush_on_paint.html]
|
[test_flush_on_paint.html]
|
||||||
skip-if = true # Bug 688128
|
skip-if = true # Bug 688128
|
||||||
[test_frame_reconstruction_for_pseudo_elements.html]
|
[test_frame_reconstruction_for_pseudo_elements.html]
|
||||||
|
[test_frame_reconstruction_for_svg_transforms.html]
|
||||||
[test_frame_reconstruction_scroll_restore.html]
|
[test_frame_reconstruction_scroll_restore.html]
|
||||||
[test_getBoxQuads_convertPointRectQuad.html]
|
[test_getBoxQuads_convertPointRectQuad.html]
|
||||||
support-files =
|
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>
|
Загрузка…
Ссылка в новой задаче