зеркало из https://github.com/mozilla/pjs.git
Bug 722882 - use or foreignObject with a percentage x or y attribute does not update properly when enclosed in an svg element which changes width or height. r=jwatt
This commit is contained in:
Родитель
34b93c5b01
Коммит
b30f4c1a36
|
@ -0,0 +1,33 @@
|
|||
<!--
|
||||
Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/
|
||||
-->
|
||||
<svg xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
class="reftest-wait">
|
||||
<defs>
|
||||
<symbol id="sym1">
|
||||
<rect width="100" height="100" fill="lime" />
|
||||
</symbol>
|
||||
</defs>
|
||||
<rect width="100%" height="100%" fill="lime"/>
|
||||
<rect x="50%" width="100" height="100" fill="red" />
|
||||
<svg id="svg" width="50%">
|
||||
<use x="50%" xlink:href="#sym1"/>
|
||||
</svg>
|
||||
<script type="text/javascript">
|
||||
<![CDATA[
|
||||
|
||||
document.addEventListener("MozReftestInvalidate", doTest, false);
|
||||
// in case we're not gecko
|
||||
setTimeout(doTest, 5000);
|
||||
|
||||
function doTest() {
|
||||
var svg = document.getElementById("svg");
|
||||
svg.setAttribute("width", "100%");
|
||||
document.documentElement.removeAttribute('class');
|
||||
}
|
||||
|
||||
]]>
|
||||
</script>
|
||||
</svg>
|
После Ширина: | Высота: | Размер: 914 B |
|
@ -107,6 +107,7 @@ random-if(/^Windows\x20NT\x205\.1/.test(http.oscpu)) == dynamic-text-04.svg dyna
|
|||
== dynamic-use-03.svg pass.svg
|
||||
== dynamic-use-04.svg pass.svg
|
||||
== dynamic-use-05.svg pass.svg
|
||||
== dynamic-use-06.svg pass.svg
|
||||
random == dynamic-use-nested-01.svg dynamic-use-nested-01-ref.svg # bug 467498
|
||||
== dynamic-use-remove-width.svg dynamic-use-remove-width-ref.svg
|
||||
== linked-pattern-01.svg pass.svg
|
||||
|
|
|
@ -408,10 +408,16 @@ nsSVGForeignObjectFrame::NotifySVGChanged(PRUint32 aFlags)
|
|||
}
|
||||
|
||||
} else if (aFlags & COORD_CONTEXT_CHANGED) {
|
||||
// Our coordinate context's width/height has changed. If we have a
|
||||
// percentage width/height our dimensions will change so we must reflow.
|
||||
nsSVGForeignObjectElement *fO =
|
||||
static_cast<nsSVGForeignObjectElement*>(mContent);
|
||||
// Coordinate context changes affect mCanvasTM if we have a
|
||||
// percentage 'x' or 'y'
|
||||
if (fO->mLengthAttributes[nsSVGForeignObjectElement::X].IsPercentage() ||
|
||||
fO->mLengthAttributes[nsSVGForeignObjectElement::Y].IsPercentage()) {
|
||||
mCanvasTM = nsnull;
|
||||
}
|
||||
// Our coordinate context's width/height has changed. If we have a
|
||||
// percentage width/height our dimensions will change so we must reflow.
|
||||
if (fO->mLengthAttributes[nsSVGForeignObjectElement::WIDTH].IsPercentage() ||
|
||||
fO->mLengthAttributes[nsSVGForeignObjectElement::HEIGHT].IsPercentage()) {
|
||||
reflow = true;
|
||||
|
|
|
@ -87,6 +87,9 @@ public:
|
|||
}
|
||||
#endif
|
||||
|
||||
// nsISVGChildFrame interface:
|
||||
virtual void NotifySVGChanged(PRUint32 aFlags);
|
||||
|
||||
// nsIAnonymousContentCreator
|
||||
virtual nsresult CreateAnonymousContent(nsTArray<ContentInfo>& aElements);
|
||||
virtual void AppendAnonymousContentTo(nsBaseContentList& aElements,
|
||||
|
@ -177,6 +180,26 @@ nsSVGUseFrame::IsLeaf() const
|
|||
}
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsISVGChildFrame methods
|
||||
|
||||
void
|
||||
nsSVGUseFrame::NotifySVGChanged(PRUint32 aFlags)
|
||||
{
|
||||
if (aFlags & COORD_CONTEXT_CHANGED &&
|
||||
!(aFlags & TRANSFORM_CHANGED)) {
|
||||
// Coordinate context changes affect mCanvasTM if we have a
|
||||
// percentage 'x' or 'y'
|
||||
nsSVGUseElement *use = static_cast<nsSVGUseElement*>(mContent);
|
||||
if (use->mLengthAttributes[nsSVGUseElement::X].IsPercentage() ||
|
||||
use->mLengthAttributes[nsSVGUseElement::Y].IsPercentage()) {
|
||||
aFlags |= TRANSFORM_CHANGED;
|
||||
}
|
||||
}
|
||||
|
||||
nsSVGUseFrameBase::NotifySVGChanged(aFlags);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsIAnonymousContentCreator methods:
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче