Bug 1107508. Disable stylesheets in <use>-cloned subtrees for now. r=heycam
authorRobert O'Callahan <robert@ocallahan.org>
Mon, 22 Dec 2014 16:09:32 +1300
changeset 221503 eb15e3f893453d6a4472f8905271aba33f8b68d5
parent 221451 0ca2f419c34f20561cde7a7e537974def6b63d05
child 221504 eeeba6f2f1e1ae0634e1dca4c38fe08c25454d7c
push id28032
push userkwierso@gmail.com
push dateTue, 30 Dec 2014 01:28:14 +0000
treeherdermozilla-central@67872ce17918 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersheycam
bugs1107508
milestone37.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 1107508. Disable stylesheets in <use>-cloned subtrees for now. r=heycam
dom/base/nsStyleLinkElement.cpp
layout/base/crashtests/1107508-1.html
layout/base/crashtests/crashtests.list
--- a/dom/base/nsStyleLinkElement.cpp
+++ b/dom/base/nsStyleLinkElement.cpp
@@ -300,16 +300,23 @@ nsStyleLinkElement::DoUpdateStyleSheet(n
   *aWillNotify = false;
 
   nsCOMPtr<nsIContent> thisContent;
   CallQueryInterface(this, getter_AddRefs(thisContent));
 
   // All instances of nsStyleLinkElement should implement nsIContent.
   NS_ENSURE_TRUE(thisContent, NS_ERROR_FAILURE);
 
+  if (thisContent->IsInAnonymousSubtree() &&
+      thisContent->IsAnonymousContentInSVGUseSubtree()) {
+    // Stylesheets in <use>-cloned subtrees are disabled until we figure out
+    // how they should behave.
+    return NS_OK;
+  }
+
   // Check for a ShadowRoot because link elements are inert in a
   // ShadowRoot.
   ShadowRoot* containingShadow = thisContent->GetContainingShadow();
   if (thisContent->IsHTML(nsGkAtoms::link) &&
       (aOldShadowRoot || containingShadow)) {
     return NS_OK;
   }
 
new file mode 100644
--- /dev/null
+++ b/layout/base/crashtests/1107508-1.html
@@ -0,0 +1,18 @@
+<!DOCTYPE HTML>
+<html>
+<svg id="s">
+  <style>
+    #b { display: none; }
+    rect { fill:orange; }
+  </style>
+  <rect width="10" height="10" fill="lime"/>
+</svg>
+<style>
+  #b { display: block; }
+  rect { fill:blue; }
+</style>
+<div id="b" style="border:2px solid black">
+  <svg>
+    <use xlink:href="#s"/>
+  </svg>
+</div>
--- a/layout/base/crashtests/crashtests.list
+++ b/layout/base/crashtests/crashtests.list
@@ -449,8 +449,9 @@ load 936988-1.html
 load 931450.html
 load 931460-1.html
 load 935765-1.html
 load 942690.html
 load 973390-1.html
 load 1001237.html
 load 1043163-1.html
 load 1061028.html
+load 1107508-1.html