From bba057ef6601de64d299893f1ccfbd24e3fc3d0c Mon Sep 17 00:00:00 2001 From: Adam Casey Date: Wed, 11 Dec 2013 14:13:48 -0500 Subject: [PATCH] Bug 874919 - Added a check to DoGetWidth/Height so the width/height properties of getComputedStyle now return correct values on inline SVG elements. r=bz --- layout/style/nsComputedDOMStyle.cpp | 10 ++++- layout/style/test/mochitest.ini | 1 + layout/style/test/test_bug874919.html | 55 +++++++++++++++++++++++++++ 3 files changed, 64 insertions(+), 2 deletions(-) create mode 100644 layout/style/test/test_bug874919.html diff --git a/layout/style/nsComputedDOMStyle.cpp b/layout/style/nsComputedDOMStyle.cpp index f6e029a02e28..d3dddaa3fb6d 100644 --- a/layout/style/nsComputedDOMStyle.cpp +++ b/layout/style/nsComputedDOMStyle.cpp @@ -3729,7 +3729,10 @@ nsComputedDOMStyle::DoGetHeight() const nsStyleDisplay* displayData = StyleDisplay(); if (displayData->mDisplay == NS_STYLE_DISPLAY_INLINE && - !(mInnerFrame->IsFrameOfType(nsIFrame::eReplaced))) { + !(mInnerFrame->IsFrameOfType(nsIFrame::eReplaced)) && + // An outer SVG frame should behave the same as eReplaced in this case + mInnerFrame->GetType() != nsGkAtoms::svgOuterSVGFrame) { + calcHeight = false; } } @@ -3770,7 +3773,10 @@ nsComputedDOMStyle::DoGetWidth() const nsStyleDisplay *displayData = StyleDisplay(); if (displayData->mDisplay == NS_STYLE_DISPLAY_INLINE && - !(mInnerFrame->IsFrameOfType(nsIFrame::eReplaced))) { + !(mInnerFrame->IsFrameOfType(nsIFrame::eReplaced)) && + // An outer SVG frame should behave the same as eReplaced in this case + mInnerFrame->GetType() != nsGkAtoms::svgOuterSVGFrame) { + calcWidth = false; } } diff --git a/layout/style/test/mochitest.ini b/layout/style/test/mochitest.ini index 0f3d4ca41a07..09ff5d90bd10 100644 --- a/layout/style/test/mochitest.ini +++ b/layout/style/test/mochitest.ini @@ -89,6 +89,7 @@ support-files = file_bug645998-1.css file_bug645998-2.css [test_bug798567.html] [test_bug798843_pref.html] [test_bug829816.html] +[test_bug874919.html] support-files = file_bug829816.css [test_bug887741_at-rules_in_declaration_lists.html] [test_bug892929.html] diff --git a/layout/style/test/test_bug874919.html b/layout/style/test/test_bug874919.html new file mode 100644 index 000000000000..df9facd74ea3 --- /dev/null +++ b/layout/style/test/test_bug874919.html @@ -0,0 +1,55 @@ + + + + + Test for Bug 874919 + + + + + +Mozilla Bug 874919 +

+
+ + + + + + +
+
+
+
+
+ +