Changeset 161205 in webkit


Ignore:
Timestamp:
Jan 2, 2014 1:49:41 AM (10 years ago)
Author:
Antti Koivisto
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.

Location:
trunk/Source/WebCore
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r161204 r161205  
     12014-01-01  Antti Koivisto  <antti@apple.com>
     2
     3        Remove public attachRenderTree
     4        https://bugs.webkit.org/show_bug.cgi?id=126368
     5
     6        Reviewed by Andreas Kling.
     7
     8        Remove the remaining explicit render tree construction.
     9
     10        * dom/Document.cpp:
     11        (WebCore::Document::createRenderTree):
     12       
     13           Use recalcStyle() instead of calling attachRenderTree directly.
     14
     15        * html/HTMLViewSourceDocument.cpp:
     16        (WebCore::HTMLViewSourceDocument::addText):
     17       
     18            Remove forgotten attachTextRenderer.
     19
     20        * html/shadow/InsertionPoint.cpp:
     21        (WebCore::InsertionPoint::InsertionPoint):
     22       
     23            Remove willAttachRenderers/didAttachRenderers hack.
     24
     25        * html/shadow/InsertionPoint.h:
     26        (WebCore::toInsertionPoint):
     27        * loader/PlaceholderDocument.cpp:
     28        (WebCore::PlaceholderDocument::createRenderTree):
     29       
     30            Seriously, nothing to do here.
     31
     32        * style/StyleResolveTree.cpp:
     33        (WebCore::Style::attachDistributedChildren):
     34        (WebCore::Style::attachChildren):
     35        (WebCore::Style::detachDistributedChildren):
     36        (WebCore::Style::detachChildren):
     37       
     38            Making attaching and detaching distributed insertion point children part of ResolveTree internals.
     39
     40        * style/StyleResolveTree.h:
     41       
     42            Remove interfaces with no clients.
     43
    1442014-01-01  Seokju Kwon  <seokju@webkit.org>
    245
  • trunk/Source/WebCore/dom/Document.cpp

    r161203 r161205  
    19601960
    19611961    recalcStyle(Style::Force);
    1962 
    1963     if (m_documentElement)
    1964         Style::attachRenderTree(*m_documentElement);
    19651962}
    19661963
  • trunk/Source/WebCore/html/HTMLViewSourceDocument.cpp

    r161195 r161205  
    241241        RefPtr<Text> text = Text::create(*this, substring);
    242242        m_current->parserAppendChild(text);
    243         Style::attachTextRenderer(*text);
    244243        if (i < size - 1)
    245244            finishLine();
  • trunk/Source/WebCore/html/shadow/InsertionPoint.cpp

    r160908 r161205  
    4444    , m_hasDistribution(false)
    4545{
    46     setHasCustomStyleResolveCallbacks();
    4746}
    4847
    4948InsertionPoint::~InsertionPoint()
    5049{
    51 }
    52 
    53 void InsertionPoint::willAttachRenderers()
    54 {
    55     if (ShadowRoot* shadowRoot = containingShadowRoot())
    56         ContentDistributor::ensureDistribution(shadowRoot);
    57     for (Node* current = firstDistributed(); current; current = nextDistributedTo(current)) {
    58         if (current->isTextNode()) {
    59             if (current->renderer())
    60                 continue;
    61             Style::attachTextRenderer(*toText(current));
    62             continue;
    63         }
    64         if (current->isElementNode()) {
    65             if (current->renderer())
    66                 Style::detachRenderTree(*toElement(current));
    67             Style::attachRenderTree(*toElement(current));
    68         }
    69     }
    70 }
    71 
    72 void InsertionPoint::willDetachRenderers()
    73 {
    74     for (Node* current = firstDistributed(); current; current = nextDistributedTo(current)) {
    75         if (current->isTextNode()) {
    76             Style::detachTextRenderer(*toText(current));
    77             continue;
    78         }
    79         if (current->isElementNode())
    80             Style::detachRenderTree(*toElement(current));
    81     }
    8250}
    8351
  • trunk/Source/WebCore/html/shadow/InsertionPoint.h

    r159036 r161205  
    5656    virtual MatchType matchTypeFor(Node*) const { return AlwaysMatches; }
    5757
    58     virtual void willAttachRenderers() OVERRIDE;
    59     virtual void willDetachRenderers() OVERRIDE;
    60 
    6158    bool shouldUseFallbackElements() const;
    6259
     
    7976};
    8077
    81 inline InsertionPoint* toInsertionPoint(Node* node)
    82 {
    83     ASSERT_WITH_SECURITY_IMPLICATION(!node || node->isInsertionPoint());
    84     return static_cast<InsertionPoint*>(node);
    85 }
     78inline bool isInsertionPoint(const Node& node) { return node.isInsertionPoint(); }
    8679
    87 inline const InsertionPoint* toInsertionPoint(const Node* node)
    88 {
    89     ASSERT_WITH_SECURITY_IMPLICATION(!node || node->isInsertionPoint());
    90     return static_cast<const InsertionPoint*>(node);
    91 }
     80NODE_TYPE_CASTS(InsertionPoint);
    9281
    9382inline bool isActiveInsertionPoint(const Node* node)
  • trunk/Source/WebCore/loader/PlaceholderDocument.cpp

    r161196 r161205  
    3434{
    3535    ASSERT(!renderView());
    36 
    37     for (auto& child : childrenOfType<Element>(*this))
    38         Style::attachRenderTree(child);
    3936}
    4037
  • trunk/Source/WebCore/style/StyleResolveTree.cpp

    r161199 r161205  
    3535#include "ElementTraversal.h"
    3636#include "FlowThreadController.h"
     37#include "InsertionPoint.h"
    3738#include "NodeRenderStyle.h"
    3839#include "NodeRenderingTraversal.h"
     
    6263
    6364static void attachRenderTree(Element&, PassRefPtr<RenderStyle>);
     65static void attachTextRenderer(Text&);
    6466static void detachRenderTree(Element&, DetachType);
    6567
     
    297299static void reattachTextRenderersForWhitespaceOnlySiblingsAfterAttachIfNeeded(Node& current)
    298300{
    299     if (current.isInsertionPoint())
     301    if (isInsertionPoint(current))
    300302        return;
    301303    // This function finds sibling text renderers where the results of textRendererIsNeeded may have changed as a result of
     
    432434}
    433435
     436static void attachDistributedChildren(InsertionPoint& insertionPoint)
     437{
     438    if (ShadowRoot* shadowRoot = insertionPoint.containingShadowRoot())
     439        ContentDistributor::ensureDistribution(shadowRoot);
     440    for (Node* current = insertionPoint.firstDistributed(); current; current = insertionPoint.nextDistributedTo(current)) {
     441        if (current->isTextNode()) {
     442            if (current->renderer())
     443                continue;
     444            attachTextRenderer(*toText(current));
     445            continue;
     446        }
     447        if (current->isElementNode()) {
     448            if (current->renderer())
     449                detachRenderTree(*toElement(current));
     450            attachRenderTree(*toElement(current), nullptr);
     451        }
     452    }
     453}
     454
    434455static void attachChildren(ContainerNode& current)
    435456{
     457    if (isInsertionPoint(current))
     458        attachDistributedChildren(toInsertionPoint(current));
     459
    436460    for (Node* child = current.firstChild(); child; child = child->nextSibling()) {
    437         ASSERT(!child->renderer() || current.shadowRoot() || current.isInsertionPoint());
     461        ASSERT(!child->renderer() || current.shadowRoot() || isInsertionPoint(current));
    438462        if (child->renderer())
    439463            continue;
     
    550574}
    551575
     576static void detachDistributedChildren(InsertionPoint& insertionPoint)
     577{
     578    for (Node* current = insertionPoint.firstDistributed(); current; current = insertionPoint.nextDistributedTo(current)) {
     579        if (current->isTextNode()) {
     580            detachTextRenderer(*toText(current));
     581            continue;
     582        }
     583        if (current->isElementNode())
     584            detachRenderTree(*toElement(current));
     585    }
     586}
     587
    552588static void detachChildren(ContainerNode& current, DetachType detachType)
    553589{
     590    if (isInsertionPoint(current))
     591        detachDistributedChildren(toInsertionPoint(current));
     592
    554593    for (Node* child = current.firstChild(); child; child = child->nextSibling()) {
    555594        if (child->isTextNode()) {
     
    876915}
    877916
    878 void attachRenderTree(Element& element)
    879 {
    880     attachRenderTree(element, nullptr);
    881     reattachTextRenderersForWhitespaceOnlySiblingsAfterAttachIfNeeded(element);
    882 }
    883 
    884917void detachRenderTree(Element& element)
    885918{
     
    887920}
    888921
    889 void detachRenderTreeInReattachMode(Element& element)
    890 {
    891     detachRenderTree(element, ReattachDetach);
    892 }
    893 
    894 }
    895 }
     922}
     923}
  • trunk/Source/WebCore/style/StyleResolveTree.h

    r161199 r161205  
    4242void resolveTree(Document&, Change);
    4343
    44 void attachRenderTree(Element&);
    4544void detachRenderTree(Element&);
    46 // FIXME: This is only used for "lazy reattach" for shadow trees.
    47 void detachRenderTreeInReattachMode(Element&);
    4845
    49 void attachTextRenderer(Text&);
    5046void detachTextRenderer(Text&);
    5147void updateTextRendererAfterContentChange(Text&, unsigned offsetOfReplacedData, unsigned lengthOfReplacedData);
Note: See TracChangeset for help on using the changeset viewer.