Bug 843480 - zoom on iframe is applied twice. r=jwatt

This commit is contained in:
Robert Longson 2016-08-03 07:37:35 +01:00
parent 6229606616
commit 5d48332dcd
4 changed files with 60 additions and 16 deletions

View File

@ -72,31 +72,31 @@ function runTest()
/* Tests the consistency with farthestViewportElement /* Tests the consistency with farthestViewportElement
(code is from test_viewport.html) */ (code is from test_viewport.html) */
// root.farthestViewportElement == null (but actually == root) // root.farthestViewportElement == null (but actually == root)
is((function(){try{return root.getScreenCTM().e}catch(e){return e}})(), 11, "root.getScreenCTM().e"); is((function(){try{return root.getScreenCTM().e}catch(e){return e}})(), 91.5, "root.getScreenCTM().e");
is((function(){try{return root.getScreenCTM().f}catch(e){return e}})(), 22, "root.getScreenCTM().f"); is((function(){try{return root.getScreenCTM().f}catch(e){return e}})(), 33, "root.getScreenCTM().f");
// inner.farthestViewportElement == root // inner.farthestViewportElement == root
is((function(){try{return inner.getScreenCTM().e}catch(e){return e}})(), 15, "inner.getScreenCTM().e"); is((function(){try{return inner.getScreenCTM().e}catch(e){return e}})(), 97.5, "inner.getScreenCTM().e");
is((function(){try{return inner.getScreenCTM().f}catch(e){return e}})(), 28, "inner.getScreenCTM().f"); is((function(){try{return inner.getScreenCTM().f}catch(e){return e}})(), 42, "inner.getScreenCTM().f");
// g1.farthestViewportElement == root // g1.farthestViewportElement == root
is((function(){try{return g1.getScreenCTM().e}catch(e){return e}})(), 45, "g1.getScreenCTM().e"); is((function(){try{return g1.getScreenCTM().e}catch(e){return e}})(), 142.5, "g1.getScreenCTM().e");
is((function(){try{return g1.getScreenCTM().f}catch(e){return e}})(), 68, "g1.getScreenCTM().f"); is((function(){try{return g1.getScreenCTM().f}catch(e){return e}})(), 102, "g1.getScreenCTM().f");
// outer.farthestViewportElement == null (but actually == root) // outer.farthestViewportElement == null (but actually == root)
is((function(){try{return outer.getScreenCTM().e}catch(e){return e}})(), 46, "outer.getScreenCTM().e"); is((function(){try{return outer.getScreenCTM().e}catch(e){return e}})(), 144, "outer.getScreenCTM().e");
is((function(){try{return outer.getScreenCTM().f}catch(e){return e}})(), 69, "outer.getScreenCTM().f"); is((function(){try{return outer.getScreenCTM().f}catch(e){return e}})(), 103.5, "outer.getScreenCTM().f");
// outer.farthestViewportElement == null (but actually == root) // outer.farthestViewportElement == null (but actually == root)
is((function(){try{return outer2.getScreenCTM().e}catch(e){return e}})(), -19, "outer2.getScreenCTM().e"); is((function(){try{return outer2.getScreenCTM().e}catch(e){return e}})(), -19, "outer2.getScreenCTM().e");
is((function(){try{return outer2.getScreenCTM().f}catch(e){return e}})(), -8, "outer2.getScreenCTM().f"); is((function(){try{return outer2.getScreenCTM().f}catch(e){return e}})(), -8, "outer2.getScreenCTM().f");
// g2.farthestViewportElement == outer (but actually == root) // g2.farthestViewportElement == outer (but actually == root)
is((function(){try{return g2.getScreenCTM().e}catch(e){return e}})(), 646, "g2.getScreenCTM().e"); is((function(){try{return g2.getScreenCTM().e}catch(e){return e}})(), 1044, "g2.getScreenCTM().e");
is((function(){try{return g2.getScreenCTM().f}catch(e){return e}})(), 769, "g2.getScreenCTM().f"); is((function(){try{return g2.getScreenCTM().f}catch(e){return e}})(), 1153.5, "g2.getScreenCTM().f");
// g3.farthestViewportElement == null (but actually == null) // g3.farthestViewportElement == null (but actually == null)
is((function(){try{return g3.getScreenCTM()}catch(e){return e}})(), null, "g3.getScreenCTM()"); is((function(){try{return g3.getScreenCTM()}catch(e){return e}})(), null, "g3.getScreenCTM()");
// symbolRect.farthestViewportElement == root // symbolRect.farthestViewportElement == root
is((function(){try{return symbolRect.getScreenCTM().e}catch(e){return e}})(), 85, "symbolRect.getScreenCTM().e"); is((function(){try{return symbolRect.getScreenCTM().e}catch(e){return e}})(), 202.5, "symbolRect.getScreenCTM().e");
is((function(){try{return symbolRect.getScreenCTM().f}catch(e){return e}})(), 108, "symbolRect.getScreenCTM().f"); is((function(){try{return symbolRect.getScreenCTM().f}catch(e){return e}})(), 162, "symbolRect.getScreenCTM().f");
// fO.farthestViewportElement == root // fO.farthestViewportElement == root
is((function(){try{return fO.getScreenCTM().e}catch(e){return e}})(), 16, "symbolRect.getScreenCTM().e"); is((function(){try{return fO.getScreenCTM().e}catch(e){return e}})(), 99, "symbolRect.getScreenCTM().e");
is((function(){try{return fO.getScreenCTM().f}catch(e){return e}})(), 29, "symbolRect.getScreenCTM().f"); is((function(){try{return fO.getScreenCTM().f}catch(e){return e}})(), 43.5, "symbolRect.getScreenCTM().f");
// g5.farthestViewportElement == root // g5.farthestViewportElement == root
is((function(){try{return g5.getScreenCTM()}catch(e){return e}})(), null, "g5.getScreenCTM()"); is((function(){try{return g5.getScreenCTM()}catch(e){return e}})(), null, "g5.getScreenCTM()");

View File

@ -19,4 +19,5 @@ skip-if(B2G||Mulet) random-if(d2d) == feImage-zoom-01a.svg feImage-zoom
skip-if(B2G||Mulet) random-if(d2d) == feImage-zoom-01b.svg feImage-zoom-01-ref.svg # Initial mulet triage: parity with B2G/B2G Desktop skip-if(B2G||Mulet) random-if(d2d) == feImage-zoom-01b.svg feImage-zoom-01-ref.svg # Initial mulet triage: parity with B2G/B2G Desktop
skip-if(B2G||Mulet) == foreignObject-zoom-01.svg pass.svg # Initial mulet triage: parity with B2G/B2G Desktop skip-if(B2G||Mulet) == foreignObject-zoom-01.svg pass.svg # Initial mulet triage: parity with B2G/B2G Desktop
skip-if(B2G||Mulet) == zoom-invalidation-01.svg pass.svg # Initial mulet triage: parity with B2G/B2G Desktop skip-if(B2G||Mulet) == zoom-invalidation-01.svg pass.svg # Initial mulet triage: parity with B2G/B2G Desktop
skip-if(B2G||Mulet) == replaced-element-zoom-01.html pass.svg # Initial mulet triage: parity with B2G/B2G Desktop
fuzzy-if(winWidget,12,7) == zoomed-svg-with-viewBox-01.svg zoomed-svg-with-viewBox-01-ref.svg fuzzy-if(winWidget,12,7) == zoomed-svg-with-viewBox-01.svg zoomed-svg-with-viewBox-01-ref.svg

View File

@ -0,0 +1,39 @@
<!doctype html>
<html reftest-zoom="2" class="reftest-wait">
<head>
<title>SVG page zoom test</title>
<style>
iframe, object, img {
width: 150px;
height: 100px;
border: none;
}
body {
background-color: lime;
}
</style>
<script>
var expected = 3;
var actual = 0;
function process_load() {
++actual;
if (actual == expected)
document.documentElement.removeAttribute("class");
}
</script>
</head>
<body>
<div>
<iframe onload="process_load()" src="pass.svg"></iframe>
</div>
<div>
<object onload="process_load()" data="pass.svg"></object>
</div>
<div>
<img onload="process_load()" src="pass.svg">
</div>
</body>
</html>

View File

@ -9,6 +9,7 @@
// Keep others in (case-insensitive) order: // Keep others in (case-insensitive) order:
#include "nsDisplayList.h" #include "nsDisplayList.h"
#include "nsIDocument.h" #include "nsIDocument.h"
#include "nsIDOMHTMLIFrameElement.h"
#include "nsIInterfaceRequestorUtils.h" #include "nsIInterfaceRequestorUtils.h"
#include "nsIObjectLoadingContent.h" #include "nsIObjectLoadingContent.h"
#include "nsRenderingContext.h" #include "nsRenderingContext.h"
@ -906,8 +907,11 @@ nsSVGOuterSVGFrame::IsRootOfReplacedElementSubDoc(nsIFrame **aEmbeddingFrame)
if (window) { if (window) {
nsCOMPtr<nsIDOMElement> frameElement = window->GetFrameElement(); nsCOMPtr<nsIDOMElement> frameElement = window->GetFrameElement();
nsCOMPtr<nsIObjectLoadingContent> olc = do_QueryInterface(frameElement); nsCOMPtr<nsIObjectLoadingContent> olc = do_QueryInterface(frameElement);
if (olc) { nsCOMPtr<nsIDOMHTMLIFrameElement> iframeElement =
// Our document is inside an HTML 'object', 'embed' or 'applet' element do_QueryInterface(frameElement);
if (olc || iframeElement) {
// Our document is inside an HTML 'object', 'embed', 'applet'
// or 'iframe' element
if (aEmbeddingFrame) { if (aEmbeddingFrame) {
nsCOMPtr<nsIContent> element = do_QueryInterface(frameElement); nsCOMPtr<nsIContent> element = do_QueryInterface(frameElement);
*aEmbeddingFrame = element->GetPrimaryFrame(); *aEmbeddingFrame = element->GetPrimaryFrame();