diff --git a/layout/style/crashtests/580685.html b/layout/style/crashtests/580685.html new file mode 100644 index 00000000000..4cb01539350 --- /dev/null +++ b/layout/style/crashtests/580685.html @@ -0,0 +1,10 @@ + + + + + + \ No newline at end of file diff --git a/layout/style/crashtests/crashtests.list b/layout/style/crashtests/crashtests.list index 18e4a756e44..5725c36198d 100644 --- a/layout/style/crashtests/crashtests.list +++ b/layout/style/crashtests/crashtests.list @@ -59,3 +59,4 @@ load 565248-1.html load 558943-1.xhtml load 571105-1.xhtml load 573127-1.html +load 580685.html diff --git a/layout/style/nsRuleNode.cpp b/layout/style/nsRuleNode.cpp index ee1cc6b457d..1aad6df9eec 100644 --- a/layout/style/nsRuleNode.cpp +++ b/layout/style/nsRuleNode.cpp @@ -277,12 +277,15 @@ static nscoord CalcLengthWith(const nsCSSValue& aValue, const nsStyleFont *rootStyleFont = styleFont; Element* docElement = aPresContext->Document()->GetRootElement(); - rootStyle = aPresContext->StyleSet()->ResolveStyleFor(docElement, - nsnull); - if (rootStyle) { - rootStyleFont = rootStyle->GetStyleFont(); - rootFontSize = rootStyleFont->mFont.size; + if (docElement) { + rootStyle = aPresContext->StyleSet()->ResolveStyleFor(docElement, + nsnull); + if (rootStyle) { + rootStyleFont = rootStyle->GetStyleFont(); + } } + + rootFontSize = rootStyleFont->mFont.size; } return ScaleCoord(aValue, float(rootFontSize)); diff --git a/layout/style/test/Makefile.in b/layout/style/test/Makefile.in index 77607d4a4a0..abc335bbef1 100644 --- a/layout/style/test/Makefile.in +++ b/layout/style/test/Makefile.in @@ -132,6 +132,7 @@ _TEST_FILES = test_acid3_test46.html \ test_bug524175.html \ test_bug534804.html \ test_bug573255.html \ + test_bug580685.html \ test_cascade.html \ test_compute_data_with_start_struct.html \ test_computed_style_no_pseudo.html \ diff --git a/layout/style/test/test_bug580685.html b/layout/style/test/test_bug580685.html new file mode 100644 index 00000000000..a887b319490 --- /dev/null +++ b/layout/style/test/test_bug580685.html @@ -0,0 +1,42 @@ + + + + + Test for Bug 580685 + + + + + +Mozilla Bug 580685 +

+ +

+ +
+
+
+ +