Diff
Copied: branches/chromium/1229/LayoutTests/http/tests/loading/remove-child-triggers-parser-expected.txt (from rev 125988, trunk/LayoutTests/http/tests/loading/remove-child-triggers-parser-expected.txt) (0 => 126676)
--- branches/chromium/1229/LayoutTests/http/tests/loading/remove-child-triggers-parser-expected.txt (rev 0)
+++ branches/chromium/1229/LayoutTests/http/tests/loading/remove-child-triggers-parser-expected.txt 2012-08-25 02:27:56 UTC (rev 126676)
@@ -0,0 +1,6 @@
+main frame - didStartProvisionalLoadForFrame
+main frame - didCommitLoadForFrame
+main frame - didFinishDocumentLoadForFrame
+main frame - didHandleOnloadEventsForFrame
+main frame - didFinishLoadForFrame
+
Copied: branches/chromium/1229/LayoutTests/http/tests/loading/remove-child-triggers-parser.html (from rev 125988, trunk/LayoutTests/http/tests/loading/remove-child-triggers-parser.html) (0 => 126676)
--- branches/chromium/1229/LayoutTests/http/tests/loading/remove-child-triggers-parser.html (rev 0)
+++ branches/chromium/1229/LayoutTests/http/tests/loading/remove-child-triggers-parser.html 2012-08-25 02:27:56 UTC (rev 126676)
@@ -0,0 +1,18 @@
+<script></script>
+<!-- This test covers Bug 93641 -->
+<script>
+if (window.testRunner)
+ testRunner.dumpAsText();
+setTimeout(function() { var child = document.documentElement; child.parentNode.removeChild(child); }, 36);
+</script>
+<script></script>
+<span></span>
+<div></div>
+<span></span>
+<nobr>
+<span></span>
+<div>
+ <link rel="stylesheet" href=""
+ <script>;</script>
+ <nobr>
+</div>
Modified: branches/chromium/1229/Source/WebCore/dom/ContainerNodeAlgorithms.h (126675 => 126676)
--- branches/chromium/1229/Source/WebCore/dom/ContainerNodeAlgorithms.h 2012-08-25 02:26:06 UTC (rev 126675)
+++ branches/chromium/1229/Source/WebCore/dom/ContainerNodeAlgorithms.h 2012-08-25 02:27:56 UTC (rev 126676)
@@ -260,9 +260,10 @@
inline void ChildNodeRemovalNotifier::notify(Node* node)
{
- if (node->inDocument())
+ if (node->inDocument()) {
notifyNodeRemovedFromDocument(node);
- else if (node->isContainerNode())
+ node->document()->notifyRemovePendingSheetIfNeeded();
+ } else if (node->isContainerNode())
notifyNodeRemovedFromTree(toContainerNode(node));
}
Modified: branches/chromium/1229/Source/WebCore/dom/Document.cpp (126675 => 126676)
--- branches/chromium/1229/Source/WebCore/dom/Document.cpp 2012-08-25 02:26:06 UTC (rev 126675)
+++ branches/chromium/1229/Source/WebCore/dom/Document.cpp 2012-08-25 02:27:56 UTC (rev 126676)
@@ -553,6 +553,7 @@
m_hasDirtyStyleResolver = false;
m_pendingStylesheets = 0;
m_ignorePendingStylesheets = false;
+ m_needsNotifyRemoveAllPendingStylesheet = false;
m_hasNodesWithPlaceholderStyle = false;
m_pendingSheetLayout = NoLayoutWithPendingSheets;
@@ -3313,7 +3314,7 @@
}
// This method is called whenever a top-level stylesheet has finished loading.
-void Document::removePendingSheet()
+void Document::removePendingSheet(RemovePendingSheetNotificationType notification)
{
// Make sure we knew this sheet was pending, and that our count isn't out of sync.
ASSERT(m_pendingStylesheets > 0);
@@ -3328,6 +3329,18 @@
if (m_pendingStylesheets)
return;
+ if (notification == RemovePendingSheetNotifyLater) {
+ setNeedsNotifyRemoveAllPendingStylesheet();
+ return;
+ }
+
+ didRemoveAllPendingStylesheet();
+}
+
+void Document::didRemoveAllPendingStylesheet()
+{
+ m_needsNotifyRemoveAllPendingStylesheet = false;
+
styleResolverChanged(RecalcStyleIfNeeded);
if (ScriptableDocumentParser* parser = scriptableDocumentParser())
@@ -3337,6 +3350,7 @@
view()->scrollToFragment(m_url);
}
+
void Document::evaluateMediaQueryList()
{
if (m_mediaQueryMatcher)
Modified: branches/chromium/1229/Source/WebCore/dom/Document.h (126675 => 126676)
--- branches/chromium/1229/Source/WebCore/dom/Document.h 2012-08-25 02:26:06 UTC (rev 126675)
+++ branches/chromium/1229/Source/WebCore/dom/Document.h 2012-08-25 02:27:56 UTC (rev 126676)
@@ -480,8 +480,14 @@
/**
* Updates the pending sheet count and then calls updateActiveStylesheets.
*/
- void removePendingSheet();
+ enum RemovePendingSheetNotificationType {
+ RemovePendingSheetNotifyImmediately,
+ RemovePendingSheetNotifyLater
+ };
+ void removePendingSheet(RemovePendingSheetNotificationType = RemovePendingSheetNotifyImmediately);
+ void notifyRemovePendingSheetIfNeeded();
+
/**
* This method returns true if all top-level stylesheets have loaded (including
* any @imports that they may be loading).
@@ -1226,6 +1232,8 @@
void collectActiveStylesheets(Vector<RefPtr<StyleSheet> >&);
bool testAddedStylesheetRequiresStyleRecalc(StyleSheetContents*);
void analyzeStylesheetChange(StyleResolverUpdateFlag, const Vector<RefPtr<StyleSheet> >& newStylesheets, bool& requiresStyleResolverReset, bool& requiresFullStyleRecalc);
+ void didRemoveAllPendingStylesheet();
+ void setNeedsNotifyRemoveAllPendingStylesheet() { m_needsNotifyRemoveAllPendingStylesheet = true; }
void seamlessParentUpdatedStylesheets();
void notifySeamlessChildDocumentsOfStylesheetUpdate() const;
@@ -1301,7 +1309,8 @@
// But sometimes you need to ignore pending stylesheet count to
// force an immediate layout when requested by JS.
- bool m_ignorePendingStylesheets;
+ bool m_ignorePendingStylesheets : 1;
+ bool m_needsNotifyRemoveAllPendingStylesheet : 1;
// If we do ignore the pending stylesheet count, then we need to add a boolean
// to track that this happened so that we can do a full repaint when the stylesheets
@@ -1555,6 +1564,12 @@
#endif
};
+inline void Document::notifyRemovePendingSheetIfNeeded()
+{
+ if (m_needsNotifyRemoveAllPendingStylesheet)
+ didRemoveAllPendingStylesheet();
+}
+
// Put these methods here, because they require the Document definition, but we really want to inline them.
inline bool Node::isDocumentNode() const
Modified: branches/chromium/1229/Source/WebCore/html/HTMLLinkElement.cpp (126675 => 126676)
--- branches/chromium/1229/Source/WebCore/html/HTMLLinkElement.cpp 2012-08-25 02:26:06 UTC (rev 126675)
+++ branches/chromium/1229/Source/WebCore/html/HTMLLinkElement.cpp 2012-08-25 02:27:56 UTC (rev 126676)
@@ -278,7 +278,7 @@
clearSheet();
if (styleSheetIsLoading())
- removePendingSheet();
+ removePendingSheet(RemovePendingSheetNotifyLater);
if (document()->renderer())
document()->styleResolverChanged(DeferRecalcStyle);
@@ -458,7 +458,7 @@
document()->addPendingSheet();
}
-void HTMLLinkElement::removePendingSheet()
+void HTMLLinkElement::removePendingSheet(RemovePendingSheetNotificationType notification)
{
PendingSheetType type = m_pendingSheetType;
m_pendingSheetType = None;
@@ -470,7 +470,11 @@
document()->styleResolverChanged(RecalcStyleImmediately);
return;
}
- document()->removePendingSheet();
+
+ document()->removePendingSheet(
+ notification == RemovePendingSheetNotifyImmediately
+ ? Document::RemovePendingSheetNotifyImmediately
+ : Document::RemovePendingSheetNotifyLater);
}
DOMSettableTokenList* HTMLLinkElement::sizes() const
Modified: branches/chromium/1229/Source/WebCore/html/HTMLLinkElement.h (126675 => 126676)
--- branches/chromium/1229/Source/WebCore/html/HTMLLinkElement.h 2012-08-25 02:26:06 UTC (rev 126675)
+++ branches/chromium/1229/Source/WebCore/html/HTMLLinkElement.h 2012-08-25 02:27:56 UTC (rev 126676)
@@ -105,8 +105,14 @@
enum PendingSheetType { None, NonBlocking, Blocking };
void addPendingSheet(PendingSheetType);
- void removePendingSheet();
+ enum RemovePendingSheetNotificationType {
+ RemovePendingSheetNotifyImmediately,
+ RemovePendingSheetNotifyLater
+ };
+
+ void removePendingSheet(RemovePendingSheetNotificationType = RemovePendingSheetNotifyImmediately);
+
#if ENABLE(MICRODATA)
virtual String itemValueText() const OVERRIDE;
virtual void setItemValueText(const String&, ExceptionCode&) OVERRIDE;