mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-08 10:44:56 +00:00
Bug 895023: Null-check SVG image document's root frame, before dereferencing it. r=seth
This commit is contained in:
parent
d42a274908
commit
8dde80d3f4
@ -510,6 +510,9 @@ VectorImage::GetIntrinsicSize(nsSize* aSize)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsIFrame* rootFrame = mSVGDocumentWrapper->GetRootLayoutFrame();
|
||||
if (!rootFrame)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
*aSize = nsSize(-1, -1);
|
||||
nsIFrame::IntrinsicSize rfSize = rootFrame->GetIntrinsicSize();
|
||||
if (rfSize.width.GetUnit() == eStyleUnit_Coord)
|
||||
@ -529,6 +532,9 @@ VectorImage::GetIntrinsicRatio(nsSize* aRatio)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsIFrame* rootFrame = mSVGDocumentWrapper->GetRootLayoutFrame();
|
||||
if (!rootFrame)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
*aRatio = rootFrame->GetIntrinsicRatio();
|
||||
return NS_OK;
|
||||
}
|
||||
|
13
layout/reftests/svg/as-image/background-display-none-1.html
Normal file
13
layout/reftests/svg/as-image/background-display-none-1.html
Normal file
@ -0,0 +1,13 @@
|
||||
<!DOCTYPE html>
|
||||
<!--
|
||||
Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/
|
||||
-->
|
||||
<!-- Test for a CSS background pointing to an SVG image that has "display:none"
|
||||
on the root node. -->
|
||||
<html>
|
||||
<body>
|
||||
<div style="width: 100px; height: 100px;
|
||||
background-image: url('display-none.svg')">
|
||||
</body>
|
||||
</html>
|
8
layout/reftests/svg/as-image/display-none.svg
Normal file
8
layout/reftests/svg/as-image/display-none.svg
Normal file
@ -0,0 +1,8 @@
|
||||
<!--
|
||||
Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/
|
||||
-->
|
||||
<svg xmlns="http://www.w3.org/2000/svg" version="1.1"
|
||||
width="100" height="100" style="display: none">
|
||||
<rect width="100%" height="100%" fill="red"/>
|
||||
</svg>
|
After Width: | Height: | Size: 280 B |
12
layout/reftests/svg/as-image/img-display-none-1.html
Normal file
12
layout/reftests/svg/as-image/img-display-none-1.html
Normal file
@ -0,0 +1,12 @@
|
||||
<!DOCTYPE html>
|
||||
<!--
|
||||
Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/
|
||||
-->
|
||||
<!-- Test for an <img> tag pointing to an SVG image that has "display:none"
|
||||
on the root node. -->
|
||||
<html>
|
||||
<body>
|
||||
<img src="display-none.svg">
|
||||
</body>
|
||||
</html>
|
@ -3,7 +3,8 @@
|
||||
# zoom/
|
||||
include zoom/reftest.list
|
||||
|
||||
# Trivial background-image tests
|
||||
# Background-image tests
|
||||
== background-display-none-1.html about:blank
|
||||
skip-if(B2G) == background-simple-1.html lime100x100-ref.html # bug 773482
|
||||
== background-simple-2.html lime100x100-ref.html
|
||||
|
||||
@ -67,6 +68,7 @@ random == img-and-image-1.html img-and-image-1-ref.svg # bug 645267
|
||||
== img-blobURI-1.html lime100x100-ref.html
|
||||
random-if(/^Windows\x20NT\x205\.1/.test(http.oscpu)) == img-blobURI-2.html lime100x100-ref.html
|
||||
== img-content-outside-viewBox-1.html img-content-outside-viewBox-1-ref.html
|
||||
== img-display-none-1.html about:blank
|
||||
== img-dyn-1.html img-dyn-1-ref.html
|
||||
== img-foreignObject-1.html lime100x100-ref.html
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user