OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2009 Apple Inc. All rights reserved. |
3 * Copyright (C) 2011 Google Inc. All rights reserved. | 3 * Copyright (C) 2011 Google Inc. All rights reserved. |
4 * Copyright (C) 2009 Joseph Pecoraro | 4 * Copyright (C) 2009 Joseph Pecoraro |
5 * | 5 * |
6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
8 * are met: | 8 * are met: |
9 * | 9 * |
10 * 1. Redistributions of source code must retain the above copyright | 10 * 1. Redistributions of source code must retain the above copyright |
(...skipping 895 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
906 m_domEditor->replaceWholeText(toText(node), value, errorString); | 906 m_domEditor->replaceWholeText(toText(node), value, errorString); |
907 } | 907 } |
908 | 908 |
909 static Node* nextNodeWithShadowDOMInMind(const Node& current, const Node* stayWi
thin, bool includeUserAgentShadowDOM) | 909 static Node* nextNodeWithShadowDOMInMind(const Node& current, const Node* stayWi
thin, bool includeUserAgentShadowDOM) |
910 { | 910 { |
911 // At first traverse the subtree. | 911 // At first traverse the subtree. |
912 if (current.isElementNode()) { | 912 if (current.isElementNode()) { |
913 const Element& element = toElement(current); | 913 const Element& element = toElement(current); |
914 ElementShadow* elementShadow = element.shadow(); | 914 ElementShadow* elementShadow = element.shadow(); |
915 if (elementShadow) { | 915 if (elementShadow) { |
916 ShadowRoot* shadowRoot = elementShadow->youngestShadowRoot(); | 916 ShadowRoot& shadowRoot = elementShadow->youngestShadowRoot(); |
917 if (shadowRoot) { | 917 if (shadowRoot.type() != ShadowRootType::UserAgent || includeUserAge
ntShadowDOM) |
918 if (shadowRoot->type() != ShadowRootType::UserAgent || includeUs
erAgentShadowDOM) | 918 return &shadowRoot; |
919 return shadowRoot; | 919 |
920 } | |
921 } | 920 } |
922 } | 921 } |
923 if (current.hasChildren()) | 922 if (current.hasChildren()) |
924 return current.firstChild(); | 923 return current.firstChild(); |
925 | 924 |
926 // Then traverse siblings of the node itself and its ancestors. | 925 // Then traverse siblings of the node itself and its ancestors. |
927 const Node* node = ¤t; | 926 const Node* node = ¤t; |
928 do { | 927 do { |
929 if (node == stayWithin) | 928 if (node == stayWithin) |
930 return nullptr; | 929 return nullptr; |
(...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1531 HTMLFrameOwnerElement* frameOwner = toHTMLFrameOwnerElement(node); | 1530 HTMLFrameOwnerElement* frameOwner = toHTMLFrameOwnerElement(node); |
1532 if (LocalFrame* frame = frameOwner->contentFrame() && frameOwner->co
ntentFrame()->isLocalFrame() ? toLocalFrame(frameOwner->contentFrame()) : nullpt
r) | 1531 if (LocalFrame* frame = frameOwner->contentFrame() && frameOwner->co
ntentFrame()->isLocalFrame() ? toLocalFrame(frameOwner->contentFrame()) : nullpt
r) |
1533 value->setFrameId(IdentifiersFactory::frameId(frame)); | 1532 value->setFrameId(IdentifiersFactory::frameId(frame)); |
1534 if (Document* doc = frameOwner->contentDocument()) | 1533 if (Document* doc = frameOwner->contentDocument()) |
1535 value->setContentDocument(buildObjectForNode(doc, 0, nodesMap)); | 1534 value->setContentDocument(buildObjectForNode(doc, 0, nodesMap)); |
1536 } | 1535 } |
1537 | 1536 |
1538 ElementShadow* shadow = element->shadow(); | 1537 ElementShadow* shadow = element->shadow(); |
1539 if (shadow) { | 1538 if (shadow) { |
1540 RefPtr<TypeBuilder::Array<TypeBuilder::DOM::Node> > shadowRoots = Ty
peBuilder::Array<TypeBuilder::DOM::Node>::create(); | 1539 RefPtr<TypeBuilder::Array<TypeBuilder::DOM::Node> > shadowRoots = Ty
peBuilder::Array<TypeBuilder::DOM::Node>::create(); |
1541 for (ShadowRoot* root = shadow->youngestShadowRoot(); root; root = r
oot->olderShadowRoot()) | 1540 for (ShadowRoot* root = &shadow->youngestShadowRoot(); root; root =
root->olderShadowRoot()) |
1542 shadowRoots->addItem(buildObjectForNode(root, 0, nodesMap)); | 1541 shadowRoots->addItem(buildObjectForNode(root, 0, nodesMap)); |
1543 value->setShadowRoots(shadowRoots); | 1542 value->setShadowRoots(shadowRoots); |
1544 forcePushChildren = true; | 1543 forcePushChildren = true; |
1545 } | 1544 } |
1546 | 1545 |
1547 if (isHTMLLinkElement(*element)) { | 1546 if (isHTMLLinkElement(*element)) { |
1548 HTMLLinkElement& linkElement = toHTMLLinkElement(*element); | 1547 HTMLLinkElement& linkElement = toHTMLLinkElement(*element); |
1549 if (linkElement.isImport() && linkElement.import() && innerParentNod
e(linkElement.import()) == linkElement) | 1548 if (linkElement.isImport() && linkElement.import() && innerParentNod
e(linkElement.import()) == linkElement) |
1550 value->setImportedDocument(buildObjectForNode(linkElement.import
(), 0, nodesMap)); | 1549 value->setImportedDocument(buildObjectForNode(linkElement.import
(), 0, nodesMap)); |
1551 forcePushChildren = true; | 1550 forcePushChildren = true; |
(...skipping 599 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2151 visitor->trace(m_document); | 2150 visitor->trace(m_document); |
2152 visitor->trace(m_revalidateTask); | 2151 visitor->trace(m_revalidateTask); |
2153 visitor->trace(m_searchResults); | 2152 visitor->trace(m_searchResults); |
2154 #endif | 2153 #endif |
2155 visitor->trace(m_history); | 2154 visitor->trace(m_history); |
2156 visitor->trace(m_domEditor); | 2155 visitor->trace(m_domEditor); |
2157 InspectorBaseAgent::trace(visitor); | 2156 InspectorBaseAgent::trace(visitor); |
2158 } | 2157 } |
2159 | 2158 |
2160 } // namespace blink | 2159 } // namespace blink |
OLD | NEW |