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 1162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1173 if (isDocumentFragment() && toDocumentFragment(this)->isTemplateContent()) | 1173 if (isDocumentFragment() && toDocumentFragment(this)->isTemplateContent()) |
1174 return static_cast<const TemplateContentDocumentFragment*>(this)->host()
; | 1174 return static_cast<const TemplateContentDocumentFragment*>(this)->host()
; |
1175 return parentOrShadowHostNode(); | 1175 return parentOrShadowHostNode(); |
1176 } | 1176 } |
1177 | 1177 |
1178 bool Node::isBlockFlowElement() const | 1178 bool Node::isBlockFlowElement() const |
1179 { | 1179 { |
1180 return isElementNode() && renderer() && renderer()->isRenderBlockFlow(); | 1180 return isElementNode() && renderer() && renderer()->isRenderBlockFlow(); |
1181 } | 1181 } |
1182 | 1182 |
1183 Element *Node::enclosingBlockFlowElement() const | |
1184 { | |
1185 Node *n = const_cast<Node *>(this); | |
1186 if (isBlockFlowElement()) | |
1187 return toElement(n); | |
1188 | |
1189 while (1) { | |
1190 n = n->parentNode(); | |
1191 if (!n) | |
1192 break; | |
1193 if (n->isBlockFlowElement() || isHTMLBodyElement(*n)) | |
1194 return toElement(n); | |
1195 } | |
1196 return 0; | |
1197 } | |
1198 | |
1199 bool Node::isRootEditableElement() const | 1183 bool Node::isRootEditableElement() const |
1200 { | 1184 { |
1201 return hasEditableStyle() && isElementNode() && (!parentNode() || !parentNod
e()->hasEditableStyle() | 1185 return hasEditableStyle() && isElementNode() && (!parentNode() || !parentNod
e()->hasEditableStyle() |
1202 || !parentNode()->isElementNode() || isHTMLBodyElement((*this))); | 1186 || !parentNode()->isElementNode() || isHTMLBodyElement((*this))); |
1203 } | 1187 } |
1204 | 1188 |
1205 Element* Node::rootEditableElement(EditableType editableType) const | 1189 Element* Node::rootEditableElement(EditableType editableType) const |
1206 { | 1190 { |
1207 if (editableType == HasEditableAXRole) { | 1191 if (editableType == HasEditableAXRole) { |
1208 if (AXObjectCache* cache = document().existingAXObjectCache()) | 1192 if (AXObjectCache* cache = document().existingAXObjectCache()) |
1209 return const_cast<Element*>(cache->rootAXEditableElement(this)); | 1193 return const_cast<Element*>(cache->rootAXEditableElement(this)); |
1210 } | 1194 } |
1211 | 1195 |
1212 return rootEditableElement(); | 1196 return rootEditableElement(); |
1213 } | 1197 } |
1214 | 1198 |
1215 Element* Node::rootEditableElement() const | 1199 Element* Node::rootEditableElement() const |
1216 { | 1200 { |
1217 Element* result = 0; | 1201 Element* result = 0; |
1218 for (Node* n = const_cast<Node*>(this); n && n->hasEditableStyle(); n = n->p
arentNode()) { | 1202 for (Node* n = const_cast<Node*>(this); n && n->hasEditableStyle(); n = n->p
arentNode()) { |
1219 if (n->isElementNode()) | 1203 if (n->isElementNode()) |
1220 result = toElement(n); | 1204 result = toElement(n); |
1221 if (isHTMLBodyElement(*n)) | 1205 if (isHTMLBodyElement(*n)) |
1222 break; | 1206 break; |
1223 } | 1207 } |
1224 return result; | 1208 return result; |
1225 } | 1209 } |
1226 | 1210 |
1227 bool Node::inSameContainingBlockFlowElement(Node *n) | |
1228 { | |
1229 return n ? enclosingBlockFlowElement() == n->enclosingBlockFlowElement() : f
alse; | |
1230 } | |
1231 | |
1232 // FIXME: End of obviously misplaced HTML editing functions. Try to move these
out of Node. | 1211 // FIXME: End of obviously misplaced HTML editing functions. Try to move these
out of Node. |
1233 | 1212 |
1234 Document* Node::ownerDocument() const | 1213 Document* Node::ownerDocument() const |
1235 { | 1214 { |
1236 Document* doc = &document(); | 1215 Document* doc = &document(); |
1237 return doc == this ? 0 : doc; | 1216 return doc == this ? 0 : doc; |
1238 } | 1217 } |
1239 | 1218 |
1240 KURL Node::baseURI() const | 1219 KURL Node::baseURI() const |
1241 { | 1220 { |
(...skipping 1308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2550 node->showTreeForThis(); | 2529 node->showTreeForThis(); |
2551 } | 2530 } |
2552 | 2531 |
2553 void showNodePath(const blink::Node* node) | 2532 void showNodePath(const blink::Node* node) |
2554 { | 2533 { |
2555 if (node) | 2534 if (node) |
2556 node->showNodePathForThis(); | 2535 node->showNodePathForThis(); |
2557 } | 2536 } |
2558 | 2537 |
2559 #endif | 2538 #endif |
OLD | NEW |