| 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 | 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All |
| 6 * rights reserved. | 6 * rights reserved. |
| 7 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) | 7 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) |
| 8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. | 8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. |
| 9 * (http://www.torchmobile.com/) | 9 * (http://www.torchmobile.com/) |
| 10 * | 10 * |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 } | 273 } |
| 274 | 274 |
| 275 Node::~Node() { | 275 Node::~Node() { |
| 276 // With Oilpan, the rare data finalizer also asserts for | 276 // With Oilpan, the rare data finalizer also asserts for |
| 277 // this condition (we cannot directly access it here.) | 277 // this condition (we cannot directly access it here.) |
| 278 RELEASE_ASSERT(hasRareData() || !layoutObject()); | 278 RELEASE_ASSERT(hasRareData() || !layoutObject()); |
| 279 InstanceCounters::decrementCounter(InstanceCounters::NodeCounter); | 279 InstanceCounters::decrementCounter(InstanceCounters::NodeCounter); |
| 280 } | 280 } |
| 281 | 281 |
| 282 NodeRareData* Node::rareData() const { | 282 NodeRareData* Node::rareData() const { |
| 283 ASSERT_WITH_SECURITY_IMPLICATION(hasRareData()); | 283 SECURITY_DCHECK(hasRareData()); |
| 284 return static_cast<NodeRareData*>(m_data.m_rareData); | 284 return static_cast<NodeRareData*>(m_data.m_rareData); |
| 285 } | 285 } |
| 286 | 286 |
| 287 NodeRareData& Node::ensureRareData() { | 287 NodeRareData& Node::ensureRareData() { |
| 288 if (hasRareData()) | 288 if (hasRareData()) |
| 289 return *rareData(); | 289 return *rareData(); |
| 290 | 290 |
| 291 if (isElementNode()) | 291 if (isElementNode()) |
| 292 m_data.m_rareData = ElementRareData::create(m_data.m_layoutObject); | 292 m_data.m_rareData = ElementRareData::create(m_data.m_layoutObject); |
| 293 else | 293 else |
| (...skipping 628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 922 | 922 |
| 923 const ComputedStyle* Node::virtualEnsureComputedStyle( | 923 const ComputedStyle* Node::virtualEnsureComputedStyle( |
| 924 PseudoId pseudoElementSpecifier) { | 924 PseudoId pseudoElementSpecifier) { |
| 925 return parentOrShadowHostNode() | 925 return parentOrShadowHostNode() |
| 926 ? parentOrShadowHostNode()->ensureComputedStyle( | 926 ? parentOrShadowHostNode()->ensureComputedStyle( |
| 927 pseudoElementSpecifier) | 927 pseudoElementSpecifier) |
| 928 : nullptr; | 928 : nullptr; |
| 929 } | 929 } |
| 930 | 930 |
| 931 int Node::maxCharacterOffset() const { | 931 int Node::maxCharacterOffset() const { |
| 932 ASSERT_NOT_REACHED(); | 932 NOTREACHED(); |
| 933 return 0; | 933 return 0; |
| 934 } | 934 } |
| 935 | 935 |
| 936 // FIXME: Shouldn't these functions be in the editing code? Code that asks | 936 // FIXME: Shouldn't these functions be in the editing code? Code that asks |
| 937 // questions about HTML in the core DOM class is obviously misplaced. | 937 // questions about HTML in the core DOM class is obviously misplaced. |
| 938 bool Node::canStartSelection() const { | 938 bool Node::canStartSelection() const { |
| 939 if (isDisabledFormControl(this)) | 939 if (isDisabledFormControl(this)) |
| 940 return false; | 940 return false; |
| 941 | 941 |
| 942 if (hasEditableStyle(*this)) | 942 if (hasEditableStyle(*this)) |
| (...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1316 ASSERT_NO_EXCEPTION); | 1316 ASSERT_NO_EXCEPTION); |
| 1317 } | 1317 } |
| 1318 return; | 1318 return; |
| 1319 } | 1319 } |
| 1320 case kAttributeNode: | 1320 case kAttributeNode: |
| 1321 case kDocumentNode: | 1321 case kDocumentNode: |
| 1322 case kDocumentTypeNode: | 1322 case kDocumentTypeNode: |
| 1323 // Do nothing. | 1323 // Do nothing. |
| 1324 return; | 1324 return; |
| 1325 } | 1325 } |
| 1326 ASSERT_NOT_REACHED(); | 1326 NOTREACHED(); |
| 1327 } | 1327 } |
| 1328 | 1328 |
| 1329 unsigned short Node::compareDocumentPosition( | 1329 unsigned short Node::compareDocumentPosition( |
| 1330 const Node* otherNode, | 1330 const Node* otherNode, |
| 1331 ShadowTreesTreatment treatment) const { | 1331 ShadowTreesTreatment treatment) const { |
| 1332 if (otherNode == this) | 1332 if (otherNode == this) |
| 1333 return kDocumentPositionEquivalent; | 1333 return kDocumentPositionEquivalent; |
| 1334 | 1334 |
| 1335 const Attr* attr1 = getNodeType() == kAttributeNode ? toAttr(this) : nullptr; | 1335 const Attr* attr1 = getNodeType() == kAttributeNode ? toAttr(this) : nullptr; |
| 1336 const Attr* attr2 = | 1336 const Attr* attr2 = |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1370 // additional attributes might change the order between existing | 1370 // additional attributes might change the order between existing |
| 1371 // attributes. | 1371 // attributes. |
| 1372 if (attr1->getQualifiedName() == attr.name()) | 1372 if (attr1->getQualifiedName() == attr.name()) |
| 1373 return kDocumentPositionImplementationSpecific | | 1373 return kDocumentPositionImplementationSpecific | |
| 1374 kDocumentPositionFollowing; | 1374 kDocumentPositionFollowing; |
| 1375 if (attr2->getQualifiedName() == attr.name()) | 1375 if (attr2->getQualifiedName() == attr.name()) |
| 1376 return kDocumentPositionImplementationSpecific | | 1376 return kDocumentPositionImplementationSpecific | |
| 1377 kDocumentPositionPreceding; | 1377 kDocumentPositionPreceding; |
| 1378 } | 1378 } |
| 1379 | 1379 |
| 1380 ASSERT_NOT_REACHED(); | 1380 NOTREACHED(); |
| 1381 return kDocumentPositionDisconnected; | 1381 return kDocumentPositionDisconnected; |
| 1382 } | 1382 } |
| 1383 | 1383 |
| 1384 // If one node is in the document and the other is not, we must be | 1384 // If one node is in the document and the other is not, we must be |
| 1385 // disconnected. If the nodes have different owning documents, they must be | 1385 // disconnected. If the nodes have different owning documents, they must be |
| 1386 // disconnected. Note that we avoid comparing Attr nodes here, since they | 1386 // disconnected. Note that we avoid comparing Attr nodes here, since they |
| 1387 // return false from isConnected() all the time (which seems like a bug). | 1387 // return false from isConnected() all the time (which seems like a bug). |
| 1388 if (start1->isConnected() != start2->isConnected() || | 1388 if (start1->isConnected() != start2->isConnected() || |
| 1389 (treatment == TreatShadowTreesAsDisconnected && | 1389 (treatment == TreatShadowTreesAsDisconnected && |
| 1390 start1->treeScope() != start2->treeScope())) { | 1390 start1->treeScope() != start2->treeScope())) { |
| (...skipping 923 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2314 | 2314 |
| 2315 if (element->isDefined() != wasDefined) | 2315 if (element->isDefined() != wasDefined) |
| 2316 element->pseudoStateChanged(CSSSelector::PseudoDefined); | 2316 element->pseudoStateChanged(CSSSelector::PseudoDefined); |
| 2317 } | 2317 } |
| 2318 | 2318 |
| 2319 void Node::setV0CustomElementState(V0CustomElementState newState) { | 2319 void Node::setV0CustomElementState(V0CustomElementState newState) { |
| 2320 V0CustomElementState oldState = getV0CustomElementState(); | 2320 V0CustomElementState oldState = getV0CustomElementState(); |
| 2321 | 2321 |
| 2322 switch (newState) { | 2322 switch (newState) { |
| 2323 case V0NotCustomElement: | 2323 case V0NotCustomElement: |
| 2324 ASSERT_NOT_REACHED(); // Everything starts in this state | 2324 NOTREACHED(); // Everything starts in this state |
| 2325 return; | 2325 return; |
| 2326 | 2326 |
| 2327 case V0WaitingForUpgrade: | 2327 case V0WaitingForUpgrade: |
| 2328 DCHECK_EQ(V0NotCustomElement, oldState); | 2328 DCHECK_EQ(V0NotCustomElement, oldState); |
| 2329 break; | 2329 break; |
| 2330 | 2330 |
| 2331 case V0Upgraded: | 2331 case V0Upgraded: |
| 2332 DCHECK_EQ(V0WaitingForUpgrade, oldState); | 2332 DCHECK_EQ(V0WaitingForUpgrade, oldState); |
| 2333 break; | 2333 break; |
| 2334 } | 2334 } |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2411 case Node::kProcessingInstructionNode: | 2411 case Node::kProcessingInstructionNode: |
| 2412 return toCharacterData(this)->length(); | 2412 return toCharacterData(this)->length(); |
| 2413 case Node::kElementNode: | 2413 case Node::kElementNode: |
| 2414 case Node::kDocumentNode: | 2414 case Node::kDocumentNode: |
| 2415 case Node::kDocumentFragmentNode: | 2415 case Node::kDocumentFragmentNode: |
| 2416 return toContainerNode(this)->countChildren(); | 2416 return toContainerNode(this)->countChildren(); |
| 2417 case Node::kAttributeNode: | 2417 case Node::kAttributeNode: |
| 2418 case Node::kDocumentTypeNode: | 2418 case Node::kDocumentTypeNode: |
| 2419 return 0; | 2419 return 0; |
| 2420 } | 2420 } |
| 2421 ASSERT_NOT_REACHED(); | 2421 NOTREACHED(); |
| 2422 return 0; | 2422 return 0; |
| 2423 } | 2423 } |
| 2424 | 2424 |
| 2425 DISABLE_CFI_PERF | 2425 DISABLE_CFI_PERF |
| 2426 v8::Local<v8::Object> Node::wrap(v8::Isolate* isolate, | 2426 v8::Local<v8::Object> Node::wrap(v8::Isolate* isolate, |
| 2427 v8::Local<v8::Object> creationContext) { | 2427 v8::Local<v8::Object> creationContext) { |
| 2428 DCHECK(!DOMDataStore::containsWrapper(this, isolate)); | 2428 DCHECK(!DOMDataStore::containsWrapper(this, isolate)); |
| 2429 | 2429 |
| 2430 const WrapperTypeInfo* wrapperType = wrapperTypeInfo(); | 2430 const WrapperTypeInfo* wrapperType = wrapperTypeInfo(); |
| 2431 | 2431 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2465 if (node) { | 2465 if (node) { |
| 2466 std::stringstream stream; | 2466 std::stringstream stream; |
| 2467 node->printNodePathTo(stream); | 2467 node->printNodePathTo(stream); |
| 2468 LOG(INFO) << stream.str(); | 2468 LOG(INFO) << stream.str(); |
| 2469 } else { | 2469 } else { |
| 2470 LOG(INFO) << "Cannot showNodePath for <null>"; | 2470 LOG(INFO) << "Cannot showNodePath for <null>"; |
| 2471 } | 2471 } |
| 2472 } | 2472 } |
| 2473 | 2473 |
| 2474 #endif | 2474 #endif |
| OLD | NEW |