Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(158)

Side by Side Diff: sky/engine/core/dom/Node.cpp

Issue 810793005: Implement Node.ownerScope (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Update to spec. Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « sky/engine/core/dom/Node.h ('k') | sky/engine/core/dom/Node.idl » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved. 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved.
6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) 7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/)
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 879 matching lines...) Expand 10 before | Expand all | Expand 10 after
890 } 890 }
891 891
892 // FIXME: End of obviously misplaced HTML editing functions. Try to move these out of Node. 892 // FIXME: End of obviously misplaced HTML editing functions. Try to move these out of Node.
893 893
894 Document* Node::ownerDocument() const 894 Document* Node::ownerDocument() const
895 { 895 {
896 Document* doc = &document(); 896 Document* doc = &document();
897 return doc == this ? 0 : doc; 897 return doc == this ? 0 : doc;
898 } 898 }
899 899
900 ContainerNode* Node::ownerScope() const
901 {
902 if (inDocument())
903 return &treeScope().rootNode();
904 if (ShadowRoot* root = containingShadowRoot())
905 return root;
906 return 0;
907 }
908
900 static void appendTextContent(const Node* node, bool convertBRsToNewlines, Strin gBuilder& content) 909 static void appendTextContent(const Node* node, bool convertBRsToNewlines, Strin gBuilder& content)
901 { 910 {
902 if (node->nodeType() == Node::TEXT_NODE) { 911 if (node->nodeType() == Node::TEXT_NODE) {
903 content.append(toCharacterData(node)->data()); 912 content.append(toCharacterData(node)->data());
904 return; 913 return;
905 } 914 }
906 915
907 for (Node* child = toContainerNode(node)->firstChild(); child; child = child ->nextSibling()) { 916 for (Node* child = toContainerNode(node)->firstChild(); child; child = child ->nextSibling()) {
908 appendTextContent(child, convertBRsToNewlines, content); 917 appendTextContent(child, convertBRsToNewlines, content);
909 } 918 }
(...skipping 823 matching lines...) Expand 10 before | Expand all | Expand 10 after
1733 node->showTreeForThis(); 1742 node->showTreeForThis();
1734 } 1743 }
1735 1744
1736 void showNodePath(const blink::Node* node) 1745 void showNodePath(const blink::Node* node)
1737 { 1746 {
1738 if (node) 1747 if (node)
1739 node->showNodePathForThis(); 1748 node->showNodePathForThis();
1740 } 1749 }
1741 1750
1742 #endif 1751 #endif
OLDNEW
« no previous file with comments | « sky/engine/core/dom/Node.h ('k') | sky/engine/core/dom/Node.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698