HTMLStyleElement::removedFrom seems incorrect.
authorshinyak@chromium.org <shinyak@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 27 Jun 2012 15:18:07 +0000 (15:18 +0000)
committershinyak@chromium.org <shinyak@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 27 Jun 2012 15:18:07 +0000 (15:18 +0000)
https://bugs.webkit.org/show_bug.cgi?id=89986

Reviewed by Hajime Morita.

This is a follow-up patch for Bug 88495. The Same bug as Bug 88495 seems to exist on
HTMLStyleElement::removedFrom().

No new tests, hard to write a test case.

* html/HTMLStyleElement.cpp:
(WebCore::HTMLStyleElement::removedFrom):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@121344 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/html/HTMLStyleElement.cpp

index 7fa3f3510b3d04d0050a0a8d652bcb1a34bd9e30..2a6b4cd83c5180389830c0dd06f1242de9fad0a3 100755 (executable)
@@ -1,3 +1,18 @@
+2012-06-27  Shinya Kawanaka  <shinyak@chromium.org>
+
+        HTMLStyleElement::removedFrom seems incorrect.
+        https://bugs.webkit.org/show_bug.cgi?id=89986
+
+        Reviewed by Hajime Morita.
+
+        This is a follow-up patch for Bug 88495. The Same bug as Bug 88495 seems to exist on
+        HTMLStyleElement::removedFrom().
+
+        No new tests, hard to write a test case.
+
+        * html/HTMLStyleElement.cpp:
+        (WebCore::HTMLStyleElement::removedFrom):
+
 2012-06-27  Mike Reed  <reed@google.com>
 
         Cleanup scaling code in text-decorations for SVG InlineText. Use scale() instead of getCTM/normalizeTransform/setCTM
index e2189e96bdc0035e8209d488207e71aff809bdf9..26990a5df284a97c6a241f5c70a28eb8d877e918 100644 (file)
@@ -199,9 +199,13 @@ void HTMLStyleElement::removedFrom(ContainerNode* insertionPoint)
     // Now, if we want to register <style scoped> even if it's not inDocument,
     // we'd need to find a way to discern whether that is the case, or whether <style scoped> itself is about to be removed.
     if (m_scopedStyleRegistrationState != NotRegistered) {
-        ContainerNode* scope = parentNode()? parentNode() : insertionPoint;
-        if (m_scopedStyleRegistrationState == RegisteredInShadowRoot)
-            scope = scope->shadowRoot();
+        ContainerNode* scope;
+        if (m_scopedStyleRegistrationState == RegisteredInShadowRoot) {
+            scope = shadowRoot();
+            if (!scope)
+                scope = insertionPoint->shadowRoot();
+        } else
+            scope = parentNode() ? parentNode() : insertionPoint;
         unregisterWithScopingNode(scope);
     }
 #endif