зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1555030 - Add NS_FRAME_SVG_LAYOUT into SVGViewFrame and nsSVGStopFrame. r=dholbert,longsonr
To avoid hitting the assertion for ResizeObserver, which calls GetBBox() for all SVG elements. Note: If the target has SVG layout and its primary frame cannot be queries as nsSVGDisplayableFrame, we return a default gfxRect(). And always returning a default gfxRect() on <view> or <stop> element makes ResizeObserver doesn't report it (because it is always not active). This behavior is the same as what Google Chrome has. (i.e. No event is fired.) Differential Revision: https://phabricator.services.mozilla.com/D32904 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
d03d62e5f9
Коммит
c0b92f7a6f
|
@ -28,7 +28,7 @@ class SVGViewFrame final : public nsFrame {
|
|||
protected:
|
||||
explicit SVGViewFrame(ComputedStyle* aStyle, nsPresContext* aPresContext)
|
||||
: nsFrame(aStyle, aPresContext, kClassID) {
|
||||
AddStateBits(NS_FRAME_IS_NONDISPLAY);
|
||||
AddStateBits(NS_FRAME_SVG_LAYOUT | NS_FRAME_IS_NONDISPLAY);
|
||||
}
|
||||
|
||||
public:
|
||||
|
|
|
@ -25,7 +25,7 @@ class nsSVGStopFrame : public nsFrame {
|
|||
protected:
|
||||
explicit nsSVGStopFrame(ComputedStyle* aStyle, nsPresContext* aPresContext)
|
||||
: nsFrame(aStyle, aPresContext, kClassID) {
|
||||
AddStateBits(NS_FRAME_IS_NONDISPLAY);
|
||||
AddStateBits(NS_FRAME_SVG_LAYOUT | NS_FRAME_IS_NONDISPLAY);
|
||||
}
|
||||
|
||||
public:
|
||||
|
|
|
@ -188,7 +188,7 @@ function test5() {
|
|||
function test6() {
|
||||
let target = document.querySelector('polygon');
|
||||
let helper = new ResizeTestHelper(
|
||||
"test6: observe svg:path",
|
||||
"test6: observe svg:polygon",
|
||||
[
|
||||
{
|
||||
setup: observer => {
|
||||
|
@ -311,6 +311,58 @@ function test10() {
|
|||
return helper.start();
|
||||
}
|
||||
|
||||
function test11() {
|
||||
// <svg>
|
||||
// <view></view>
|
||||
// <defs>
|
||||
// <linearGradient>
|
||||
// <stop></stop>
|
||||
// </linearGradient>
|
||||
// </defs>
|
||||
// </svg>
|
||||
const svgNS = "http://www.w3.org/2000/svg";
|
||||
let svg = document.createElementNS(svgNS, 'svg');
|
||||
document.body.appendChild(svg);
|
||||
|
||||
let view = document.createElementNS(svgNS, 'view');
|
||||
svg.appendChild(view);
|
||||
|
||||
let defs = document.createElementNS(svgNS, 'defs');
|
||||
let linearGradient = document.createElementNS(svgNS, 'linearGradient');
|
||||
let stop = document.createElementNS(svgNS, 'stop');
|
||||
linearGradient.appendChild(stop);
|
||||
defs.appendChild(linearGradient);
|
||||
svg.appendChild(defs);
|
||||
|
||||
let helper = new ResizeTestHelper(
|
||||
"test11: observe svg non-displayable element",
|
||||
[
|
||||
{
|
||||
setup: observer => {
|
||||
observer.observe(view);
|
||||
},
|
||||
notify: (entries, observer) => {
|
||||
assert_unreached("no entries should be observed on <view> Element");
|
||||
},
|
||||
timeout: () => {
|
||||
// expected
|
||||
}
|
||||
},
|
||||
{
|
||||
setup: observer => {
|
||||
observer.observe(stop);
|
||||
},
|
||||
notify: (entries, observer) => {
|
||||
assert_unreached("no entries should be observed on <stop> Element");
|
||||
},
|
||||
timeout: () => {
|
||||
// expected
|
||||
}
|
||||
},
|
||||
]);
|
||||
return helper.start(() => svg.remove());
|
||||
}
|
||||
|
||||
let guard;
|
||||
test(_ => {
|
||||
assert_own_property(window, "ResizeObserver");
|
||||
|
@ -328,6 +380,7 @@ test0()
|
|||
.then(() => { return test8(); })
|
||||
.then(() => { return test9(); })
|
||||
.then(() => { return test10(); })
|
||||
.then(() => { return test11(); })
|
||||
.then(() => { guard.done(); });
|
||||
|
||||
</script>
|
||||
|
|
Загрузка…
Ссылка в новой задаче