| OLD | NEW |
| 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 1089 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1100 return toElement(parent); | 1100 return toElement(parent); |
| 1101 } | 1101 } |
| 1102 | 1102 |
| 1103 ContainerNode* Node::parentOrShadowHostOrTemplateHostNode() const | 1103 ContainerNode* Node::parentOrShadowHostOrTemplateHostNode() const |
| 1104 { | 1104 { |
| 1105 if (isDocumentFragment() && toDocumentFragment(this)->isTemplateContent()) | 1105 if (isDocumentFragment() && toDocumentFragment(this)->isTemplateContent()) |
| 1106 return static_cast<const TemplateContentDocumentFragment*>(this)->host()
; | 1106 return static_cast<const TemplateContentDocumentFragment*>(this)->host()
; |
| 1107 return parentOrShadowHostNode(); | 1107 return parentOrShadowHostNode(); |
| 1108 } | 1108 } |
| 1109 | 1109 |
| 1110 bool Node::isRootEditableElement() const | 1110 // TODO(yoichio): Move to core/editing |
| 1111 bool isRootEditableElement(const Node& node) |
| 1111 { | 1112 { |
| 1112 return hasEditableStyle() && isElementNode() && (!parentNode() || !parentNod
e()->hasEditableStyle() | 1113 return node.hasEditableStyle() && node.isElementNode() && (!node.parentNode(
) || !node.parentNode()->hasEditableStyle() |
| 1113 || !parentNode()->isElementNode() || this == document().body()); | 1114 || !node.parentNode()->isElementNode() || &node == node.document().body(
)); |
| 1114 } | 1115 } |
| 1115 | 1116 |
| 1116 Element* Node::rootEditableElement(EditableType editableType) const | 1117 // TODO(yoichio): Move to core/editing |
| 1118 Element* rootEditableElement(const Node& node, EditableType editableType) |
| 1117 { | 1119 { |
| 1118 if (editableType == HasEditableAXRole) { | 1120 if (editableType == HasEditableAXRole) { |
| 1119 if (AXObjectCache* cache = document().existingAXObjectCache()) | 1121 if (AXObjectCache* cache = node.document().existingAXObjectCache()) |
| 1120 return const_cast<Element*>(cache->rootAXEditableElement(this)); | 1122 return const_cast<Element*>(cache->rootAXEditableElement(&node)); |
| 1121 } | 1123 } |
| 1122 | 1124 |
| 1123 return rootEditableElement(); | 1125 return rootEditableElement(node); |
| 1124 } | 1126 } |
| 1125 | 1127 |
| 1126 Element* Node::rootEditableElement() const | 1128 // TODO(yoichio): Move to core/editing |
| 1129 Element* rootEditableElement(const Node& node) |
| 1127 { | 1130 { |
| 1128 const Node* result = nullptr; | 1131 const Node* result = nullptr; |
| 1129 for (const Node* n = this; n && n->hasEditableStyle(); n = n->parentNode())
{ | 1132 for (const Node* n = &node; n && n->hasEditableStyle(); n = n->parentNode())
{ |
| 1130 if (n->isElementNode()) | 1133 if (n->isElementNode()) |
| 1131 result = n; | 1134 result = n; |
| 1132 if (document().body() == n) | 1135 if (node.document().body() == n) |
| 1133 break; | 1136 break; |
| 1134 } | 1137 } |
| 1135 return toElement(const_cast<Node*>(result)); | 1138 return toElement(const_cast<Node*>(result)); |
| 1136 } | 1139 } |
| 1137 | 1140 |
| 1138 // FIXME: End of obviously misplaced HTML editing functions. Try to move these
out of Node. | 1141 // FIXME: End of obviously misplaced HTML editing functions. Try to move these
out of Node. |
| 1139 | 1142 |
| 1140 Document* Node::ownerDocument() const | 1143 Document* Node::ownerDocument() const |
| 1141 { | 1144 { |
| 1142 Document* doc = &document(); | 1145 Document* doc = &document(); |
| (...skipping 1358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2501 | 2504 |
| 2502 void showNodePath(const blink::Node* node) | 2505 void showNodePath(const blink::Node* node) |
| 2503 { | 2506 { |
| 2504 if (node) | 2507 if (node) |
| 2505 node->showNodePathForThis(); | 2508 node->showNodePathForThis(); |
| 2506 else | 2509 else |
| 2507 fprintf(stderr, "Cannot showNodePath for (nil)\n"); | 2510 fprintf(stderr, "Cannot showNodePath for (nil)\n"); |
| 2508 } | 2511 } |
| 2509 | 2512 |
| 2510 #endif | 2513 #endif |
| OLD | NEW |