Changeset 109290 in webkit


Ignore:
Timestamp:
Feb 29, 2012 5:55:08 PM (12 years ago)
Author:
shinyak@chromium.org
Message:

Methods in ShadowTree and TreeScopeAdopter should be multiple shadow roots aware.
https://bugs.webkit.org/show_bug.cgi?id=79768

Reviewed by Hajime Morita.

Source/WebCore:

Some methods in ShadowTree and TreeScopeAdopter were not multiple shadow roots aware.
They should consider multiple shadow roots.

Test: fast/dom/shadow/multiple-shadowroot-adopt.html

  • dom/ShadowTree.cpp:

(WebCore::ShadowTree::setParentTreeScope):
(WebCore):
(WebCore::ShadowTree::childNeedsStyleRecalc):
(WebCore::ShadowTree::needsStyleRecalc):

  • dom/ShadowTree.h:

(WebCore):
(ShadowTree):

  • dom/TreeScopeAdopter.cpp:

(WebCore::shadowTreeFor):
(WebCore::TreeScopeAdopter::moveTreeToNewScope):
(WebCore::TreeScopeAdopter::moveTreeToNewDocument):
(WebCore::TreeScopeAdopter::moveShadowTreeToNewDocument):
(WebCore):

  • dom/TreeScopeAdopter.h:

(TreeScopeAdopter):

LayoutTests:

  • fast/dom/shadow/multiple-shadowroot-adopt-expected.txt: Added.
  • fast/dom/shadow/multiple-shadowroot-adopt.html: Added.
  • platform/efl/Skipped:
  • platform/mac/Skipped:
  • platform/qt/Skipped:
  • platform/win/Skipped:
  • platform/wincairo/Skipped:
  • platform/wk2/Skipped:
Location:
trunk
Files:
2 added
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r109288 r109290  
     12012-02-29  Shinya Kawanaka  <shinyak@chromium.org>
     2
     3        Methods in ShadowTree and TreeScopeAdopter should be multiple shadow roots aware.
     4        https://bugs.webkit.org/show_bug.cgi?id=79768
     5
     6        Reviewed by Hajime Morita.
     7
     8        * fast/dom/shadow/multiple-shadowroot-adopt-expected.txt: Added.
     9        * fast/dom/shadow/multiple-shadowroot-adopt.html: Added.
     10        * platform/efl/Skipped:
     11        * platform/mac/Skipped:
     12        * platform/qt/Skipped:
     13        * platform/win/Skipped:
     14        * platform/wincairo/Skipped:
     15        * platform/wk2/Skipped:
     16
    1172012-02-29  David Levin  <levin@chromium.org>
    218
  • trunk/LayoutTests/platform/efl/Skipped

    r109238 r109290  
    20952095fast/dom/shadow/multiple-shadowroot.html
    20962096fast/dom/shadow/multiple-shadowroot-rendering.html
     2097fast/dom/shadow/multiple-shadowroot-adopt.html
    20972098
    20982099# CSS Filters support not yet enabled (needs ENABLE_CSS_FILTERS).
  • trunk/LayoutTests/platform/mac/Skipped

    r109251 r109290  
    438438fast/dom/shadow/multiple-shadowroot.html
    439439fast/dom/shadow/multiple-shadowroot-rendering.html
     440fast/dom/shadow/multiple-shadowroot-adopt.html
    440441
    441442# JSC does not support setIsolatedWorldSecurityOrigin (http://webkit.org/b/61540)
  • trunk/LayoutTests/platform/qt/Skipped

    r109251 r109290  
    176176fast/dom/shadow/multiple-shadowroot.html
    177177fast/dom/shadow/multiple-shadowroot-rendering.html
     178fast/dom/shadow/multiple-shadowroot-adopt.html
    178179
    179180# CSS Regions support not yet enabled. http://webkit.org/b/57312
  • trunk/LayoutTests/platform/win/Skipped

    r109251 r109290  
    14641464fast/dom/shadow/multiple-shadowroot.html
    14651465fast/dom/shadow/multiple-shadowroot-rendering.html
     1466fast/dom/shadow/multiple-shadowroot-adopt.html
    14661467
    14671468# CSS Regions support not yet enabled. http://webkit.org/b/57312
  • trunk/LayoutTests/platform/wincairo/Skipped

    r109251 r109290  
    19771977fast/dom/shadow/multiple-shadowroot.html
    19781978fast/dom/shadow/multiple-shadowroot-rendering.html
     1979fast/dom/shadow/multiple-shadowroot-adopt.html
    19791980
    19801981# CSS Regions support not yet enabled. http://webkit.org/b/57312
  • trunk/LayoutTests/platform/wk2/Skipped

    r109251 r109290  
    10751075fast/dom/shadow/multiple-shadowroot.html
    10761076fast/dom/shadow/multiple-shadowroot-rendering.html
     1077fast/dom/shadow/multiple-shadowroot-adopt.html
    10771078
    10781079# WTR needs an implementation for eventSender.continuousMouseScrollBy
  • trunk/Source/WebCore/ChangeLog

    r109288 r109290  
     12012-02-29  Shinya Kawanaka  <shinyak@chromium.org>
     2
     3        Methods in ShadowTree and TreeScopeAdopter should be multiple shadow roots aware.
     4        https://bugs.webkit.org/show_bug.cgi?id=79768
     5
     6        Reviewed by Hajime Morita.
     7
     8        Some methods in ShadowTree and TreeScopeAdopter were not multiple shadow roots aware.
     9        They should consider multiple shadow roots.
     10
     11        Test: fast/dom/shadow/multiple-shadowroot-adopt.html
     12
     13        * dom/ShadowTree.cpp:
     14        (WebCore::ShadowTree::setParentTreeScope):
     15        (WebCore):
     16        (WebCore::ShadowTree::childNeedsStyleRecalc):
     17        (WebCore::ShadowTree::needsStyleRecalc):
     18        * dom/ShadowTree.h:
     19        (WebCore):
     20        (ShadowTree):
     21        * dom/TreeScopeAdopter.cpp:
     22        (WebCore::shadowTreeFor):
     23        (WebCore::TreeScopeAdopter::moveTreeToNewScope):
     24        (WebCore::TreeScopeAdopter::moveTreeToNewDocument):
     25        (WebCore::TreeScopeAdopter::moveShadowTreeToNewDocument):
     26        (WebCore):
     27        * dom/TreeScopeAdopter.h:
     28        (TreeScopeAdopter):
     29
    1302012-02-29  David Levin  <levin@chromium.org>
    231
  • trunk/Source/WebCore/dom/ShadowTree.cpp

    r109203 r109290  
    152152}
    153153
     154void ShadowTree::setParentTreeScope(TreeScope* scope)
     155{
     156    for (ShadowRoot* root = youngestShadowRoot(); root; root = root->olderShadowRoot())
     157        root->setParentTreeScope(scope);
     158}
     159
    154160void ShadowTree::attach()
    155161{
     
    214220{
    215221    ASSERT(youngestShadowRoot());
    216     if (!youngestShadowRoot())
    217         return false;
    218 
    219     return youngestShadowRoot()->childNeedsStyleRecalc();
     222    for (ShadowRoot* root = youngestShadowRoot(); root; root = root->olderShadowRoot())
     223        if (root->childNeedsStyleRecalc())
     224            return true;
     225
     226    return false;
    220227}
    221228
     
    223230{
    224231    ASSERT(youngestShadowRoot());
    225     if (!youngestShadowRoot())
    226         return false;
    227 
    228     return youngestShadowRoot()->needsStyleRecalc();
     232    for (ShadowRoot* root = youngestShadowRoot(); root; root = root->olderShadowRoot())
     233        if (root->needsStyleRecalc())
     234            return true;
     235
     236    return false;
    229237}
    230238
  • trunk/Source/WebCore/dom/ShadowTree.h

    r109203 r109290  
    4141class HTMLContentSelector;
    4242class InsertionPoint;
     43class TreeScope;
    4344
    4445class ShadowTree {
     
    5960    void removedFromTree(bool deep);
    6061    void willRemove();
     62
     63    void setParentTreeScope(TreeScope*);
    6164
    6265    void attach();
  • trunk/Source/WebCore/dom/TreeScopeAdopter.cpp

    r108959 r109290  
    3333namespace WebCore {
    3434
    35 static inline ShadowRoot* shadowRootFor(Node* node)
     35static inline ShadowTree* shadowTreeFor(Node* node)
    3636{
    37     return node->isElementNode() && toElement(node)->hasShadowRoot() ? toElement(node)->shadowTree()->youngestShadowRoot() : 0;
     37    return node->isElementNode() ? toElement(node)->shadowTree() : 0;
    3838}
    3939
     
    6464            moveNodeToNewDocument(node, oldDocument, newDocument);
    6565
    66         if (ShadowRoot* shadow = shadowRootFor(node)) {
    67             shadow->setParentTreeScope(m_newScope);
     66        if (ShadowTree* tree = shadowTreeFor(node)) {
     67            tree->setParentTreeScope(m_newScope);
    6868            if (willMoveToNewDocument)
    69                 moveTreeToNewDocument(shadow, oldDocument, newDocument);
     69                moveShadowTreeToNewDocument(tree, oldDocument, newDocument);
    7070        }
    7171    }
     
    7676    for (Node* node = root; node; node = node->traverseNextNode(root)) {
    7777        moveNodeToNewDocument(node, oldDocument, newDocument);
    78         if (ShadowRoot* shadow = shadowRootFor(node))
    79             moveTreeToNewDocument(shadow, oldDocument, newDocument);
     78        if (ShadowTree* tree = shadowTreeFor(node))
     79            moveShadowTreeToNewDocument(tree, oldDocument, newDocument);
    8080    }
     81}
     82
     83inline void TreeScopeAdopter::moveShadowTreeToNewDocument(ShadowTree* tree, Document* oldDocument, Document* newDocument) const
     84{
     85    for (ShadowRoot* root = tree->youngestShadowRoot(); root; root = root->olderShadowRoot())
     86        moveTreeToNewDocument(root, oldDocument, newDocument);
    8187}
    8288
  • trunk/Source/WebCore/dom/TreeScopeAdopter.h

    r104528 r109290  
    4747    void moveTreeToNewDocument(Node*, Document* oldDocument, Document* newDocument) const;
    4848    void moveNodeToNewDocument(Node*, Document* oldDocument, Document* newDocument) const;
     49    void moveShadowTreeToNewDocument(ShadowTree*, Document* oldDocument, Document* newDocument) const;
    4950
    5051    Node* m_toAdopt;
Note: See TracChangeset for help on using the changeset viewer.