| 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 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights
reserved. | 4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights
reserved. |
| 5 * | 5 * |
| 6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
| 7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
| 8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
| 9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
| 10 * | 10 * |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 // Remove empty text nodes. | 60 // Remove empty text nodes. |
| 61 if (!length()) { | 61 if (!length()) { |
| 62 // Care must be taken to get the next node before removing the current n
ode. | 62 // Care must be taken to get the next node before removing the current n
ode. |
| 63 Node* nextNode = NodeTraversal::nextPostOrder(*this); | 63 Node* nextNode = NodeTraversal::nextPostOrder(*this); |
| 64 remove(IGNORE_EXCEPTION); | 64 remove(IGNORE_EXCEPTION); |
| 65 return nextNode; | 65 return nextNode; |
| 66 } | 66 } |
| 67 | 67 |
| 68 // Merge text nodes. | 68 // Merge text nodes. |
| 69 while (Node* nextSibling = this->nextSibling()) { | 69 while (Node* nextSibling = this->nextSibling()) { |
| 70 if (nextSibling->getNodeType() != TEXT_NODE) | 70 if (nextSibling->getNodeType() != kTextNode) |
| 71 break; | 71 break; |
| 72 | 72 |
| 73 Text* nextText = toText(nextSibling); | 73 Text* nextText = toText(nextSibling); |
| 74 | 74 |
| 75 // Remove empty text nodes. | 75 // Remove empty text nodes. |
| 76 if (!nextText->length()) { | 76 if (!nextText->length()) { |
| 77 nextText->remove(IGNORE_EXCEPTION); | 77 nextText->remove(IGNORE_EXCEPTION); |
| 78 continue; | 78 continue; |
| 79 } | 79 } |
| 80 | 80 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 // does not exist yet. | 134 // does not exist yet. |
| 135 DCHECK(DOMDataStore::getWrapper(newText, v8::Isolate::GetCurrent()).IsEmpty(
)); | 135 DCHECK(DOMDataStore::getWrapper(newText, v8::Isolate::GetCurrent()).IsEmpty(
)); |
| 136 | 136 |
| 137 return newText; | 137 return newText; |
| 138 } | 138 } |
| 139 | 139 |
| 140 static const Text* earliestLogicallyAdjacentTextNode(const Text* t) | 140 static const Text* earliestLogicallyAdjacentTextNode(const Text* t) |
| 141 { | 141 { |
| 142 for (const Node* n = t->previousSibling(); n; n = n->previousSibling()) { | 142 for (const Node* n = t->previousSibling(); n; n = n->previousSibling()) { |
| 143 Node::NodeType type = n->getNodeType(); | 143 Node::NodeType type = n->getNodeType(); |
| 144 if (type == Node::TEXT_NODE || type == Node::CDATA_SECTION_NODE) { | 144 if (type == Node::kTextNode || type == Node::kCdataSectionNode) { |
| 145 t = toText(n); | 145 t = toText(n); |
| 146 continue; | 146 continue; |
| 147 } | 147 } |
| 148 | 148 |
| 149 break; | 149 break; |
| 150 } | 150 } |
| 151 return t; | 151 return t; |
| 152 } | 152 } |
| 153 | 153 |
| 154 static const Text* latestLogicallyAdjacentTextNode(const Text* t) | 154 static const Text* latestLogicallyAdjacentTextNode(const Text* t) |
| 155 { | 155 { |
| 156 for (const Node* n = t->nextSibling(); n; n = n->nextSibling()) { | 156 for (const Node* n = t->nextSibling(); n; n = n->nextSibling()) { |
| 157 Node::NodeType type = n->getNodeType(); | 157 Node::NodeType type = n->getNodeType(); |
| 158 if (type == Node::TEXT_NODE || type == Node::CDATA_SECTION_NODE) { | 158 if (type == Node::kTextNode || type == Node::kCdataSectionNode) { |
| 159 t = toText(n); | 159 t = toText(n); |
| 160 continue; | 160 continue; |
| 161 } | 161 } |
| 162 | 162 |
| 163 break; | 163 break; |
| 164 } | 164 } |
| 165 return t; | 165 return t; |
| 166 } | 166 } |
| 167 | 167 |
| 168 String Text::wholeText() const | 168 String Text::wholeText() const |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 return this; | 226 return this; |
| 227 } | 227 } |
| 228 | 228 |
| 229 String Text::nodeName() const | 229 String Text::nodeName() const |
| 230 { | 230 { |
| 231 return "#text"; | 231 return "#text"; |
| 232 } | 232 } |
| 233 | 233 |
| 234 Node::NodeType Text::getNodeType() const | 234 Node::NodeType Text::getNodeType() const |
| 235 { | 235 { |
| 236 return TEXT_NODE; | 236 return kTextNode; |
| 237 } | 237 } |
| 238 | 238 |
| 239 Node* Text::cloneNode(bool /*deep*/) | 239 Node* Text::cloneNode(bool /*deep*/) |
| 240 { | 240 { |
| 241 return cloneWithData(data()); | 241 return cloneWithData(data()); |
| 242 } | 242 } |
| 243 | 243 |
| 244 static inline bool canHaveWhitespaceChildren(const LayoutObject& parent) | 244 static inline bool canHaveWhitespaceChildren(const LayoutObject& parent) |
| 245 { | 245 { |
| 246 // <button> should allow whitespace even though LayoutFlexibleBox doesn't. | 246 // <button> should allow whitespace even though LayoutFlexibleBox doesn't. |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 458 result.append("; "); | 458 result.append("; "); |
| 459 result.append("value="); | 459 result.append("value="); |
| 460 result.append(s); | 460 result.append(s); |
| 461 } | 461 } |
| 462 | 462 |
| 463 strncpy(buffer, result.toString().utf8().data(), length - 1); | 463 strncpy(buffer, result.toString().utf8().data(), length - 1); |
| 464 } | 464 } |
| 465 #endif | 465 #endif |
| 466 | 466 |
| 467 } // namespace blink | 467 } // namespace blink |
| OLD | NEW |