Title: [153938] trunk/Source/WebCore
- Revision
- 153938
- Author
- [email protected]
- Date
- 2013-08-12 03:25:21 -0700 (Mon, 12 Aug 2013)
Log Message
Move some Document recalcStyle code to StyleResolveTree
https://bugs.webkit.org/show_bug.cgi?id=119676
Reviewed by Andreas Kling.
Move the code that resolves the document and child styles to Style::resolveTree(Document*).
* dom/Document.cpp:
(WebCore::Document::recalcStyle):
* style/StyleResolveTree.cpp:
(WebCore::Style::resolveTree):
* style/StyleResolveTree.h:
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (153937 => 153938)
--- trunk/Source/WebCore/ChangeLog 2013-08-12 10:22:06 UTC (rev 153937)
+++ trunk/Source/WebCore/ChangeLog 2013-08-12 10:25:21 UTC (rev 153938)
@@ -1,3 +1,18 @@
+2013-08-12 Antti Koivisto <[email protected]>
+
+ Move some Document recalcStyle code to StyleResolveTree
+ https://bugs.webkit.org/show_bug.cgi?id=119676
+
+ Reviewed by Andreas Kling.
+
+ Move the code that resolves the document and child styles to Style::resolveTree(Document*).
+
+ * dom/Document.cpp:
+ (WebCore::Document::recalcStyle):
+ * style/StyleResolveTree.cpp:
+ (WebCore::Style::resolveTree):
+ * style/StyleResolveTree.h:
+
2013-08-12 Allan Sandfeld Jensen <[email protected]>
Resource leak related to gstreamer and videos
Modified: trunk/Source/WebCore/dom/Document.cpp (153937 => 153938)
--- trunk/Source/WebCore/dom/Document.cpp 2013-08-12 10:22:06 UTC (rev 153937)
+++ trunk/Source/WebCore/dom/Document.cpp 2013-08-12 10:25:21 UTC (rev 153938)
@@ -146,7 +146,6 @@
#include "Settings.h"
#include "ShadowRoot.h"
#include "StylePropertySet.h"
-#include "StyleResolveForDocument.h"
#include "StyleResolver.h"
#include "StyleSheetContents.h"
#include "StyleSheetList.h"
@@ -1777,25 +1776,12 @@
if (m_pendingStyleRecalcShouldForce)
change = Style::Force;
- // Recalculating the root style (on the document) is not needed in the common case.
- if ((change == Style::Force) || (shouldDisplaySeamlesslyWithParent() && (change >= Style::Inherit))) {
- // style selector may set this again during recalc
+ if (change == Style::Force) {
+ // This may get set again during style resolve.
m_hasNodesWithPlaceholderStyle = false;
-
- RefPtr<RenderStyle> documentStyle = Style::resolveForDocument(this);
-
- Style::Change documentChange = Style::determineChange(documentStyle.get(), renderer()->style(), settings());
- if (documentChange != Style::NoChange)
- renderer()->setStyle(documentStyle.release());
}
- for (Node* n = firstChild(); n; n = n->nextSibling()) {
- if (!n->isElementNode())
- continue;
- Element* element = toElement(n);
- if (change >= Style::Inherit || element->childNeedsStyleRecalc() || element->needsStyleRecalc())
- Style::resolveTree(element, change);
- }
+ resolveTree(this, change);
#if USE(ACCELERATED_COMPOSITING)
if (view())
Modified: trunk/Source/WebCore/style/StyleResolveTree.cpp (153937 => 153938)
--- trunk/Source/WebCore/style/StyleResolveTree.cpp 2013-08-12 10:22:06 UTC (rev 153937)
+++ trunk/Source/WebCore/style/StyleResolveTree.cpp 2013-08-12 10:25:21 UTC (rev 153938)
@@ -34,6 +34,7 @@
#include "RenderText.h"
#include "Settings.h"
#include "ShadowRoot.h"
+#include "StyleResolveForDocument.h"
#include "StyleResolver.h"
#include "Text.h"
@@ -281,6 +282,25 @@
current->didRecalcStyle(change);
}
+void resolveTree(Document* document, Change change)
+{
+ bool resolveRootStyle = change == Force || (document->shouldDisplaySeamlesslyWithParent() && change >= Inherit);
+ if (resolveRootStyle) {
+ RefPtr<RenderStyle> documentStyle = resolveForDocument(document);
+
+ Style::Change documentChange = determineChange(documentStyle.get(), document->renderer()->style(), document->settings());
+ if (documentChange != NoChange)
+ document->renderer()->setStyle(documentStyle.release());
+ }
+
+ for (Node* child = document->firstChild(); child; child = child->nextSibling()) {
+ if (!child->isElementNode())
+ continue;
+ Element* elementChild = toElement(child);
+ if (change >= Inherit || elementChild->childNeedsStyleRecalc() || elementChild->needsStyleRecalc())
+ resolveTree(elementChild, change);
+ }
}
}
+}
Modified: trunk/Source/WebCore/style/StyleResolveTree.h (153937 => 153938)
--- trunk/Source/WebCore/style/StyleResolveTree.h 2013-08-12 10:22:06 UTC (rev 153937)
+++ trunk/Source/WebCore/style/StyleResolveTree.h 2013-08-12 10:25:21 UTC (rev 153938)
@@ -28,6 +28,7 @@
namespace WebCore {
+class Document;
class Element;
class RenderStyle;
class Settings;
@@ -37,6 +38,7 @@
enum Change { NoChange, NoInherit, Inherit, Detach, Force };
void resolveTree(Element*, Change);
+void resolveTree(Document*, Change);
Change determineChange(const RenderStyle*, const RenderStyle*, Settings*);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes