Bug 841225 - Do not create frames for HTML elements within a <tspan>. r=bzbarsky
authorCameron McCormack <cam@mcc.id.au>
Thu, 14 Feb 2013 17:23:52 +1100
changeset 131723 86d7b194cd33336083c379d5abf10935b430f7d5
parent 131722 f3cba77064cd0bbc24174bd7f4e62bf12e5a6fdf
child 131724 758dbd8fbeed6b17d30f8da4ac405015597194aa
push id2323
push userbbajaj@mozilla.com
push dateMon, 01 Apr 2013 19:47:02 +0000
treeherdermozilla-beta@7712be144d91 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbzbarsky
bugs841225
milestone21.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 841225 - Do not create frames for HTML elements within a <tspan>. r=bzbarsky
layout/base/nsCSSFrameConstructor.cpp
layout/reftests/svg/text/ignore-invalid-child-2-ref.svg
layout/reftests/svg/text/ignore-invalid-child-2.svg
layout/reftests/svg/text/reftest.list
--- a/layout/base/nsCSSFrameConstructor.cpp
+++ b/layout/base/nsCSSFrameConstructor.cpp
@@ -5300,20 +5300,20 @@ nsCSSFrameConstructor::AddFrameConstruct
       // Nothing to do here; suppressed text inside SVG
       return;
     }
   } else {
     Element* element = aContent->AsElement();
 
     // Don't create frames for non-SVG element children of SVG elements.
     if (aNameSpaceID != kNameSpaceID_SVG &&
-        aParentFrame &&
-        IsFrameForSVG(aParentFrame) &&
-        !aParentFrame->IsFrameOfType(nsIFrame::eSVGForeignObject)
-        ) {
+        ((aParentFrame &&
+          IsFrameForSVG(aParentFrame) &&
+          !aParentFrame->IsFrameOfType(nsIFrame::eSVGForeignObject)) ||
+         (aFlags & ITEM_IS_WITHIN_SVG_TEXT))) {
       SetAsUndisplayedContent(aItems, element, styleContext,
                               isGeneratedContent);
       return;
     }
 
     data = FindHTMLData(element, aTag, aNameSpaceID, aParentFrame,
                         styleContext);
     if (!data) {
new file mode 100644
--- /dev/null
+++ b/layout/reftests/svg/text/ignore-invalid-child-2-ref.svg
@@ -0,0 +1,12 @@
+<!--
+     Any copyright is dedicated to the Public Domain.
+     http://creativecommons.org/publicdomain/zero/1.0/
+-->
+<svg xmlns="http://www.w3.org/2000/svg" width="700" height="200">
+  <text x="100" y="100" style="font: 16px sans-serif">
+    <tspan>
+      ab
+      ef
+    </tspan>
+  </text>
+</svg>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/svg/text/ignore-invalid-child-2.svg
@@ -0,0 +1,13 @@
+<!--
+     Any copyright is dedicated to the Public Domain.
+     http://creativecommons.org/publicdomain/zero/1.0/
+-->
+<svg xmlns="http://www.w3.org/2000/svg" width="700" height="200">
+  <text x="100" y="100" style="font: 16px sans-serif">
+    <tspan>
+      ab
+      <progress xmlns="http://www.w3.org/1999/xhtml">cd</progress>
+      ef
+    </tspan>
+  </text>
+</svg>
--- a/layout/reftests/svg/text/reftest.list
+++ b/layout/reftests/svg/text/reftest.list
@@ -132,16 +132,17 @@ HTTP(../..) == simple-transform-rotate.s
 # pseudo-elements
 == pseudo-first-line.svg pseudo-first-line-ref.svg
 == pseudo-first-line-2.svg pseudo-first-line-2-ref.svg
 == pseudo-first-letter.svg pseudo-first-letter-ref.svg
 == ignore-before-after.svg ignore-prop-ref.svg
 
 # invalid child nodes
 == ignore-invalid-child.svg ignore-invalid-child-ref.svg
+== ignore-invalid-child-2.svg ignore-invalid-child-2-ref.svg
 
 # text inside a link
 == link-surrounding.svg simple.svg
 
 # dynamic document changes
 == dynamic-font-size.svg dynamic-font-size-ref.svg
 == dynamic-dominant-baseline.svg dynamic-dominant-baseline-ref.svg
 == dynamic-multiple-x.svg dynamic-multiple-x-ref.svg