- Revision
- 161205
- Author
- [email protected]
- Date
- 2014-01-02 01:49:41 -0800 (Thu, 02 Jan 2014)
Log Message
Remove public attachRenderTree
https://bugs.webkit.org/show_bug.cgi?id=126368
Reviewed by Andreas Kling.
Remove the remaining explicit render tree construction.
* dom/Document.cpp:
(WebCore::Document::createRenderTree):
Use recalcStyle() instead of calling attachRenderTree directly.
* html/HTMLViewSourceDocument.cpp:
(WebCore::HTMLViewSourceDocument::addText):
Remove forgotten attachTextRenderer.
* html/shadow/InsertionPoint.cpp:
(WebCore::InsertionPoint::InsertionPoint):
Remove willAttachRenderers/didAttachRenderers hack.
* html/shadow/InsertionPoint.h:
(WebCore::toInsertionPoint):
* loader/PlaceholderDocument.cpp:
(WebCore::PlaceholderDocument::createRenderTree):
Seriously, nothing to do here.
* style/StyleResolveTree.cpp:
(WebCore::Style::attachDistributedChildren):
(WebCore::Style::attachChildren):
(WebCore::Style::detachDistributedChildren):
(WebCore::Style::detachChildren):
Making attaching and detaching distributed insertion point children part of ResolveTree internals.
* style/StyleResolveTree.h:
Remove interfaces with no clients.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (161204 => 161205)
--- trunk/Source/WebCore/ChangeLog 2014-01-02 06:21:06 UTC (rev 161204)
+++ trunk/Source/WebCore/ChangeLog 2014-01-02 09:49:41 UTC (rev 161205)
@@ -1,3 +1,46 @@
+2014-01-01 Antti Koivisto <[email protected]>
+
+ Remove public attachRenderTree
+ https://bugs.webkit.org/show_bug.cgi?id=126368
+
+ Reviewed by Andreas Kling.
+
+ Remove the remaining explicit render tree construction.
+
+ * dom/Document.cpp:
+ (WebCore::Document::createRenderTree):
+
+ Use recalcStyle() instead of calling attachRenderTree directly.
+
+ * html/HTMLViewSourceDocument.cpp:
+ (WebCore::HTMLViewSourceDocument::addText):
+
+ Remove forgotten attachTextRenderer.
+
+ * html/shadow/InsertionPoint.cpp:
+ (WebCore::InsertionPoint::InsertionPoint):
+
+ Remove willAttachRenderers/didAttachRenderers hack.
+
+ * html/shadow/InsertionPoint.h:
+ (WebCore::toInsertionPoint):
+ * loader/PlaceholderDocument.cpp:
+ (WebCore::PlaceholderDocument::createRenderTree):
+
+ Seriously, nothing to do here.
+
+ * style/StyleResolveTree.cpp:
+ (WebCore::Style::attachDistributedChildren):
+ (WebCore::Style::attachChildren):
+ (WebCore::Style::detachDistributedChildren):
+ (WebCore::Style::detachChildren):
+
+ Making attaching and detaching distributed insertion point children part of ResolveTree internals.
+
+ * style/StyleResolveTree.h:
+
+ Remove interfaces with no clients.
+
2014-01-01 Seokju Kwon <[email protected]>
Remove stale ScriptProfiler methods
Modified: trunk/Source/WebCore/dom/Document.cpp (161204 => 161205)
--- trunk/Source/WebCore/dom/Document.cpp 2014-01-02 06:21:06 UTC (rev 161204)
+++ trunk/Source/WebCore/dom/Document.cpp 2014-01-02 09:49:41 UTC (rev 161205)
@@ -1959,9 +1959,6 @@
#endif
recalcStyle(Style::Force);
-
- if (m_documentElement)
- Style::attachRenderTree(*m_documentElement);
}
static void pageWheelEventHandlerCountChanged(Page& page)
Modified: trunk/Source/WebCore/html/HTMLViewSourceDocument.cpp (161204 => 161205)
--- trunk/Source/WebCore/html/HTMLViewSourceDocument.cpp 2014-01-02 06:21:06 UTC (rev 161204)
+++ trunk/Source/WebCore/html/HTMLViewSourceDocument.cpp 2014-01-02 09:49:41 UTC (rev 161205)
@@ -240,7 +240,6 @@
}
RefPtr<Text> text = Text::create(*this, substring);
m_current->parserAppendChild(text);
- Style::attachTextRenderer(*text);
if (i < size - 1)
finishLine();
}
Modified: trunk/Source/WebCore/html/shadow/InsertionPoint.cpp (161204 => 161205)
--- trunk/Source/WebCore/html/shadow/InsertionPoint.cpp 2014-01-02 06:21:06 UTC (rev 161204)
+++ trunk/Source/WebCore/html/shadow/InsertionPoint.cpp 2014-01-02 09:49:41 UTC (rev 161205)
@@ -43,44 +43,12 @@
: HTMLElement(tagName, document, CreateInsertionPoint)
, m_hasDistribution(false)
{
- setHasCustomStyleResolveCallbacks();
}
InsertionPoint::~InsertionPoint()
{
}
-void InsertionPoint::willAttachRenderers()
-{
- if (ShadowRoot* shadowRoot = containingShadowRoot())
- ContentDistributor::ensureDistribution(shadowRoot);
- for (Node* current = firstDistributed(); current; current = nextDistributedTo(current)) {
- if (current->isTextNode()) {
- if (current->renderer())
- continue;
- Style::attachTextRenderer(*toText(current));
- continue;
- }
- if (current->isElementNode()) {
- if (current->renderer())
- Style::detachRenderTree(*toElement(current));
- Style::attachRenderTree(*toElement(current));
- }
- }
-}
-
-void InsertionPoint::willDetachRenderers()
-{
- for (Node* current = firstDistributed(); current; current = nextDistributedTo(current)) {
- if (current->isTextNode()) {
- Style::detachTextRenderer(*toText(current));
- continue;
- }
- if (current->isElementNode())
- Style::detachRenderTree(*toElement(current));
- }
-}
-
bool InsertionPoint::shouldUseFallbackElements() const
{
return isActive() && !hasDistribution();
Modified: trunk/Source/WebCore/html/shadow/InsertionPoint.h (161204 => 161205)
--- trunk/Source/WebCore/html/shadow/InsertionPoint.h 2014-01-02 06:21:06 UTC (rev 161204)
+++ trunk/Source/WebCore/html/shadow/InsertionPoint.h 2014-01-02 09:49:41 UTC (rev 161205)
@@ -55,9 +55,6 @@
virtual MatchType matchTypeFor(Node*) const { return AlwaysMatches; }
- virtual void willAttachRenderers() OVERRIDE;
- virtual void willDetachRenderers() OVERRIDE;
-
bool shouldUseFallbackElements() const;
Node* firstDistributed() const;
@@ -78,17 +75,9 @@
bool m_hasDistribution;
};
-inline InsertionPoint* toInsertionPoint(Node* node)
-{
- ASSERT_WITH_SECURITY_IMPLICATION(!node || node->isInsertionPoint());
- return static_cast<InsertionPoint*>(node);
-}
+inline bool isInsertionPoint(const Node& node) { return node.isInsertionPoint(); }
-inline const InsertionPoint* toInsertionPoint(const Node* node)
-{
- ASSERT_WITH_SECURITY_IMPLICATION(!node || node->isInsertionPoint());
- return static_cast<const InsertionPoint*>(node);
-}
+NODE_TYPE_CASTS(InsertionPoint);
inline bool isActiveInsertionPoint(const Node* node)
{
Modified: trunk/Source/WebCore/loader/PlaceholderDocument.cpp (161204 => 161205)
--- trunk/Source/WebCore/loader/PlaceholderDocument.cpp 2014-01-02 06:21:06 UTC (rev 161204)
+++ trunk/Source/WebCore/loader/PlaceholderDocument.cpp 2014-01-02 09:49:41 UTC (rev 161205)
@@ -33,9 +33,6 @@
void PlaceholderDocument::createRenderTree()
{
ASSERT(!renderView());
-
- for (auto& child : childrenOfType<Element>(*this))
- Style::attachRenderTree(child);
}
} // namespace WebCore
Modified: trunk/Source/WebCore/style/StyleResolveTree.cpp (161204 => 161205)
--- trunk/Source/WebCore/style/StyleResolveTree.cpp 2014-01-02 06:21:06 UTC (rev 161204)
+++ trunk/Source/WebCore/style/StyleResolveTree.cpp 2014-01-02 09:49:41 UTC (rev 161205)
@@ -34,6 +34,7 @@
#include "ElementRareData.h"
#include "ElementTraversal.h"
#include "FlowThreadController.h"
+#include "InsertionPoint.h"
#include "NodeRenderStyle.h"
#include "NodeRenderingTraversal.h"
#include "NodeTraversal.h"
@@ -61,6 +62,7 @@
enum DetachType { NormalDetach, ReattachDetach };
static void attachRenderTree(Element&, PassRefPtr<RenderStyle>);
+static void attachTextRenderer(Text&);
static void detachRenderTree(Element&, DetachType);
Change determineChange(const RenderStyle* s1, const RenderStyle* s2, Settings* settings)
@@ -296,7 +298,7 @@
static void reattachTextRenderersForWhitespaceOnlySiblingsAfterAttachIfNeeded(Node& current)
{
- if (current.isInsertionPoint())
+ if (isInsertionPoint(current))
return;
// This function finds sibling text renderers where the results of textRendererIsNeeded may have changed as a result of
// the current node gaining or losing the renderer. This can only affect white space text nodes.
@@ -431,10 +433,32 @@
textRenderer->setTextWithOffset(textNode.dataImpl(), offsetOfReplacedData, lengthOfReplacedData);
}
+static void attachDistributedChildren(InsertionPoint& insertionPoint)
+{
+ if (ShadowRoot* shadowRoot = insertionPoint.containingShadowRoot())
+ ContentDistributor::ensureDistribution(shadowRoot);
+ for (Node* current = insertionPoint.firstDistributed(); current; current = insertionPoint.nextDistributedTo(current)) {
+ if (current->isTextNode()) {
+ if (current->renderer())
+ continue;
+ attachTextRenderer(*toText(current));
+ continue;
+ }
+ if (current->isElementNode()) {
+ if (current->renderer())
+ detachRenderTree(*toElement(current));
+ attachRenderTree(*toElement(current), nullptr);
+ }
+ }
+}
+
static void attachChildren(ContainerNode& current)
{
+ if (isInsertionPoint(current))
+ attachDistributedChildren(toInsertionPoint(current));
+
for (Node* child = current.firstChild(); child; child = child->nextSibling()) {
- ASSERT(!child->renderer() || current.shadowRoot() || current.isInsertionPoint());
+ ASSERT(!child->renderer() || current.shadowRoot() || isInsertionPoint(current));
if (child->renderer())
continue;
if (child->isTextNode()) {
@@ -549,8 +573,23 @@
current.didAttachRenderers();
}
+static void detachDistributedChildren(InsertionPoint& insertionPoint)
+{
+ for (Node* current = insertionPoint.firstDistributed(); current; current = insertionPoint.nextDistributedTo(current)) {
+ if (current->isTextNode()) {
+ detachTextRenderer(*toText(current));
+ continue;
+ }
+ if (current->isElementNode())
+ detachRenderTree(*toElement(current));
+ }
+}
+
static void detachChildren(ContainerNode& current, DetachType detachType)
{
+ if (isInsertionPoint(current))
+ detachDistributedChildren(toInsertionPoint(current));
+
for (Node* child = current.firstChild(); child; child = child->nextSibling()) {
if (child->isTextNode()) {
Style::detachTextRenderer(*toText(child));
@@ -875,21 +914,10 @@
resolveTree(*documentElement, change);
}
-void attachRenderTree(Element& element)
-{
- attachRenderTree(element, nullptr);
- reattachTextRenderersForWhitespaceOnlySiblingsAfterAttachIfNeeded(element);
-}
-
void detachRenderTree(Element& element)
{
detachRenderTree(element, NormalDetach);
}
-void detachRenderTreeInReattachMode(Element& element)
-{
- detachRenderTree(element, ReattachDetach);
}
-
}
-}
Modified: trunk/Source/WebCore/style/StyleResolveTree.h (161204 => 161205)
--- trunk/Source/WebCore/style/StyleResolveTree.h 2014-01-02 06:21:06 UTC (rev 161204)
+++ trunk/Source/WebCore/style/StyleResolveTree.h 2014-01-02 09:49:41 UTC (rev 161205)
@@ -41,12 +41,8 @@
void resolveTree(Element&, Change);
void resolveTree(Document&, Change);
-void attachRenderTree(Element&);
void detachRenderTree(Element&);
-// FIXME: This is only used for "lazy reattach" for shadow trees.
-void detachRenderTreeInReattachMode(Element&);
-void attachTextRenderer(Text&);
void detachTextRenderer(Text&);
void updateTextRendererAfterContentChange(Text&, unsigned offsetOfReplacedData, unsigned lengthOfReplacedData);