Changeset 84251 in webkit


Ignore:
Timestamp:
Apr 19, 2011 6:41:54 AM (13 years ago)
Author:
commit-queue@webkit.org
Message:

2011-04-19 Sheriff Bot <webkit.review.bot@gmail.com>

Unreviewed, rolling out r84050.
http://trac.webkit.org/changeset/84050
https://bugs.webkit.org/show_bug.cgi?id=58892

fast/dom/HTMLKeygenElement/keygen.html is crashing on Chromium
(Requested by jknotten on #webkit).

  • dom/ContainerNode.cpp: (WebCore::ContainerNode::takeAllChildrenFrom): (WebCore::ContainerNode::removeBetween): (WebCore::ContainerNode::removeChildren): (WebCore::ContainerNode::parserAddChild):
  • dom/Document.cpp: (WebCore::Document::Document): (WebCore::Document::~Document): (WebCore::Document::setDocType):
  • dom/Element.h:
  • dom/Node.cpp: (WebCore::Node::treeScope): (WebCore::Node::setTreeScope): (WebCore::Node::setTreeScopeRecursively):
  • dom/Node.h: (WebCore::Node::document):
  • dom/ShadowRoot.cpp: (WebCore::ShadowRoot::ShadowRoot):
  • dom/ShadowRoot.h:
  • dom/TreeScope.cpp: (WebCore::TreeScope::TreeScope): (WebCore::TreeScope::setParentTreeScope):
  • dom/TreeScope.h:
  • rendering/RenderSlider.cpp:
Location:
trunk/Source/WebCore
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r84249 r84251  
     12011-04-19  Sheriff Bot  <webkit.review.bot@gmail.com>
     2
     3        Unreviewed, rolling out r84050.
     4        http://trac.webkit.org/changeset/84050
     5        https://bugs.webkit.org/show_bug.cgi?id=58892
     6
     7        fast/dom/HTMLKeygenElement/keygen.html is crashing on Chromium
     8        (Requested by jknotten on #webkit).
     9
     10        * dom/ContainerNode.cpp:
     11        (WebCore::ContainerNode::takeAllChildrenFrom):
     12        (WebCore::ContainerNode::removeBetween):
     13        (WebCore::ContainerNode::removeChildren):
     14        (WebCore::ContainerNode::parserAddChild):
     15        * dom/Document.cpp:
     16        (WebCore::Document::Document):
     17        (WebCore::Document::~Document):
     18        (WebCore::Document::setDocType):
     19        * dom/Element.h:
     20        * dom/Node.cpp:
     21        (WebCore::Node::treeScope):
     22        (WebCore::Node::setTreeScope):
     23        (WebCore::Node::setTreeScopeRecursively):
     24        * dom/Node.h:
     25        (WebCore::Node::document):
     26        * dom/ShadowRoot.cpp:
     27        (WebCore::ShadowRoot::ShadowRoot):
     28        * dom/ShadowRoot.h:
     29        * dom/TreeScope.cpp:
     30        (WebCore::TreeScope::TreeScope):
     31        (WebCore::TreeScope::setParentTreeScope):
     32        * dom/TreeScope.h:
     33        * rendering/RenderSlider.cpp:
     34
    1352011-04-19  Kinuko Yasuda  <kinuko@chromium.org>
    236
  • trunk/Source/WebCore/dom/ContainerNode.cpp

    r84056 r84251  
    9191        ASSERT(!ec);
    9292        parserAddChild(child.get());
    93         // FIXME: Together with adoptNode above, the tree scope might get updated recursively twice
    94         // (if the document changed or oldParent was in a shadow tree, AND *this is in a shadow tree).
    95         // Can we do better?
    96         child->setTreeScopeRecursively(treeScope());
    9793        if (attached() && !child->attached())
    9894            child->attach();
     
    486482    oldChild->setParent(0);
    487483
    488     oldChild->setTreeScopeRecursively(document());
    489 
    490484    allowEventDispatch();
    491485}
     
    537531        n->setNextSibling(0);
    538532        n->setParent(0);
    539         n->setTreeScopeRecursively(document());
    540533
    541534        m_firstChild = next;
     
    656649    // FIXME: This method should take a PassRefPtr.
    657650    appendChildToContainer<Node, ContainerNode>(newChild.get(), this);
    658     newChild->setTreeScopeRecursively(treeScope());
    659    
    660651    allowEventDispatch();
    661652
  • trunk/Source/WebCore/dom/Document.cpp

    r84169 r84251  
    378378
    379379Document::Document(Frame* frame, const KURL& url, bool isXHTML, bool isHTML)
    380     : TreeScope(0)
     380    : TreeScope(this)
    381381    , m_guardRefCount(0)
    382382    , m_compatibilityMode(NoQuirksMode)
     
    434434    , m_writeRecursionDepth(0)
    435435{
    436 
    437436    m_document = this;
    438437
     
    515514    ASSERT(!m_styleRecalcTimer.isActive());
    516515    ASSERT(!m_parentTreeScope);
    517     ASSERT(!m_guardRefCount);
    518516
    519517    m_scriptRunner.clear();
     
    673671    m_docType = docType;
    674672    if (m_docType)
    675         m_docType->setTreeScopeRecursively(this);
     673        m_docType->setTreeScope(this);
    676674}
    677675
  • trunk/Source/WebCore/dom/Element.h

    r84050 r84251  
    4040class ElementRareData;
    4141class IntSize;
    42 class ShadowRoot;
    4342class WebKitAnimationList;
    4443
     
    231230    virtual void recalcStyle(StyleChange = NoChange);
    232231
    233     // FIXME: Make these return a proper ShadowRoot* (bug 58703).
    234232    ContainerNode* shadowRoot() const;
    235233    ContainerNode* ensureShadowRoot();
  • trunk/Source/WebCore/dom/Node.cpp

    r84225 r84251  
    7878#include "ScriptController.h"
    7979#include "SelectorNodeList.h"
    80 #include "ShadowRoot.h"
    8180#include "StaticNodeList.h"
    8281#include "TagNodeList.h"
     
    470469TreeScope* Node::treeScope() const
    471470{
    472     // FIXME: Using m_document directly is not good -> see comment with document() in the header file.
    473471    if (!hasRareData())
    474         return m_document;
     472        return document();
    475473    TreeScope* scope = rareData()->treeScope();
    476     return scope ? scope : m_document;
    477 }
    478 
    479 void Node::setTreeScopeRecursively(TreeScope* newTreeScope, bool includeRoot)
    480 {
    481     ASSERT(this);
    482     ASSERT(!includeRoot || !isDocumentNode());
     474    // FIXME: Until we land shadow scopes, there should be no non-document scopes.
     475    ASSERT(!scope);
     476    return scope ? scope : document();
     477}
     478
     479void Node::setTreeScope(TreeScope* newTreeScope)
     480{
     481    ASSERT(!isDocumentNode());
    483482    ASSERT(newTreeScope);
    484     ASSERT(!m_deletionHasBegun);
    485 
    486     TreeScope* currentTreeScope = treeScope();
    487     if (currentTreeScope == newTreeScope)
     483    ASSERT(!inDocument() || treeScope() == newTreeScope);
     484
     485    if (newTreeScope->isDocumentNode()) {
     486        if (hasRareData())
     487            rareData()->setTreeScope(0);
     488        // Setting the new document scope will be handled implicitly
     489        // by setDocument() below.
     490    } else {
     491        // FIXME: Until we land shadow scopes, this branch should be inert.
     492        ASSERT_NOT_REACHED();
     493        ensureRareData()->setTreeScope(newTreeScope);
     494    }
     495
     496    setDocument(newTreeScope->document());
     497}
     498
     499void Node::setTreeScopeRecursively(TreeScope* newTreeScope)
     500{
     501    ASSERT(!isDocumentNode());
     502    ASSERT(newTreeScope);
     503    if (treeScope() == newTreeScope)
    488504        return;
    489505
     
    497513        currentDocument->incDOMTreeVersion();
    498514
    499     for (Node* node = includeRoot ? this : traverseNextNode(this); node; node = node->traverseNextNode(this)) {
    500         if (newTreeScope == newDocument) {
    501             if (node->hasRareData())
    502                 node->rareData()->setTreeScope(0);
    503             // Setting the new document tree scope will be handled implicitly
    504             // by setDocument() below.
    505         } else
    506             node->ensureRareData()->setTreeScope(newTreeScope);
    507 
    508         node->setDocument(newDocument);
    509 
    510         if (!node->isElementNode())
    511             continue;
    512         // FIXME: Remove toShadowRoot() once shadowRoot() returns a proper ShadowRoot* (bug 58703).
    513         if (ShadowRoot* shadowRoot = toShadowRoot(toElement(node)->shadowRoot())) {
    514             shadowRoot->setParentTreeScope(newTreeScope);
    515             if (currentDocument != newDocument)
    516                 shadowRoot->setDocumentRecursively(newDocument);
    517         }
     515    for (Node* node = this; node; node = node->traverseNextNode(this)) {
     516        node->setTreeScope(newTreeScope);
     517        // FIXME: Once shadow scopes are landed, update parent scope, etc.
    518518    }
    519519}
  • trunk/Source/WebCore/dom/Node.h

    r84225 r84251  
    360360    {
    361361        ASSERT(this);
    362         // FIXME: below ASSERT is useful, but prevents the use of document() in the constructor or destructor
    363         // due to the virtual function call to nodeType().
    364362        ASSERT(m_document || (nodeType() == DOCUMENT_TYPE_NODE && !inDocument()));
    365363        return m_document;
     
    368366    TreeScope* treeScope() const;
    369367
     368    // Do not use this method to change the scope of a node until after the node has been
     369    // removed from its previous scope. Do not use to change documents.
     370    void setTreeScope(TreeScope*);
     371
    370372    // Used by the basic DOM methods (e.g., appendChild()).
    371     void setTreeScopeRecursively(TreeScope*, bool includeRoot = true);
     373    void setTreeScopeRecursively(TreeScope*);
    372374
    373375    // Returns true if this node is associated with a document and is in its associated document's
  • trunk/Source/WebCore/dom/ShadowRoot.cpp

    r84050 r84251  
    2828#include "ShadowRoot.h"
    2929
    30 #include "Document.h"
    31 #include "NodeRareData.h"
    32 
    3330namespace WebCore {
    3431
    3532ShadowRoot::ShadowRoot(Document* document)
    36     : TreeScope(document)
     33    : DocumentFragment(document)
    3734{
    3835    ASSERT(document);
    39    
    40     // Assume document as parent scope.
    41     setParentTreeScope(document);
    42     // Shadow tree scopes have the scope pointer point to themselves.
    43     // This way, direct children will receive the correct scope pointer.
    44     ensureRareData()->setTreeScope(this);
    45 }
    46 
    47 ShadowRoot::~ShadowRoot()
    48 {
    4936}
    5037
     
    5239{
    5340    return "#shadow-root";
    54 }
    55 
    56 Node::NodeType ShadowRoot::nodeType() const
    57 {
    58     // FIXME: Decide correct node type (bug 58704).
    59     return DOCUMENT_FRAGMENT_NODE;
    60 }
    61 
    62 PassRefPtr<Node> ShadowRoot::cloneNode(bool)
    63 {
    64     // ShadowRoot should not be arbitrarily cloned.
    65     return 0;
    66 }
    67 
    68 bool ShadowRoot::childTypeAllowed(NodeType type) const
    69 {
    70     switch (type) {
    71     case ELEMENT_NODE:
    72     case PROCESSING_INSTRUCTION_NODE:
    73     case COMMENT_NODE:
    74     case TEXT_NODE:
    75     case CDATA_SECTION_NODE:
    76     case ENTITY_REFERENCE_NODE:
    77         return true;
    78     default:
    79         return false;
    80     }
    8141}
    8242
  • trunk/Source/WebCore/dom/ShadowRoot.h

    r84050 r84251  
    2828#define ShadowRoot_h
    2929
    30 #include "TreeScope.h"
     30#include "DocumentFragment.h"
    3131
    3232namespace WebCore {
     
    3434class Document;
    3535
    36 class ShadowRoot : public TreeScope {
     36class ShadowRoot : public DocumentFragment {
    3737public:
    3838    static PassRefPtr<ShadowRoot> create(Document*);
     
    4343private:
    4444    ShadowRoot(Document*);
    45     virtual ~ShadowRoot();
    46 
    4745    virtual String nodeName() const;
    48     virtual NodeType nodeType() const;
    49     virtual PassRefPtr<Node> cloneNode(bool deep);
    50     virtual bool childTypeAllowed(NodeType) const;
    5146};
    5247
     
    5651}
    5752
    58 inline ShadowRoot* toShadowRoot(Node* node)
    59 {
    60     ASSERT(!node || node->isShadowBoundary());
    61     return static_cast<ShadowRoot*>(node);
    62 }
    63 
    6453} // namespace
    6554
  • trunk/Source/WebCore/dom/TreeScope.cpp

    r84050 r84251  
    3737using namespace HTMLNames;
    3838
    39 TreeScope::TreeScope(Document* document)
    40     : ContainerNode(document)
     39TreeScope::TreeScope(Document* document, ConstructionType constructionType)
     40    : ContainerNode(0, constructionType)
    4141    , m_parentTreeScope(0)
    4242    , m_accessKeyMapValid(false)
    4343    , m_numNodeListCaches(0)
    4444{
     45    m_document = document;
     46    if (document != this) {
     47        // Assume document as parent scope
     48        m_parentTreeScope = document;
     49        // FIXME: This branch should be inert until shadow scopes are landed.
     50        ASSERT_NOT_REACHED();
     51    }
    4552}
    4653
     
    6370    ASSERT(!isDocumentNode());
    6471    // Every scope other than document needs a parent scope.
     72    ASSERT(m_parentTreeScope);
    6573    ASSERT(newParentScope);
    6674
  • trunk/Source/WebCore/dom/TreeScope.h

    r84050 r84251  
    4040public:
    4141    TreeScope* parentTreeScope() const { return m_parentTreeScope; }
    42     void setParentTreeScope(TreeScope*);
    4342
    4443    Element* getElementById(const AtomicString&) const;
     
    6766
    6867protected:
    69     TreeScope(Document*);
     68    TreeScope(Document*, ConstructionType = CreateContainer);
     69
    7070    virtual ~TreeScope();
    7171
    7272    void destroyTreeScopeData();
     73
     74    void setParentTreeScope(TreeScope*);
    7375
    7476private:
  • trunk/Source/WebCore/rendering/RenderSlider.cpp

    r84050 r84251  
    3838#include "RenderTheme.h"
    3939#include "RenderView.h"
    40 #include "ShadowRoot.h"
     40#include "ShadowElement.h"
    4141#include "SliderThumbElement.h"
    4242#include "StepRange.h"
Note: See TracChangeset for help on using the changeset viewer.