| 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 #include "core/dom/NodeRareData.h" | 49 #include "core/dom/NodeRareData.h" |
| 50 #include "core/dom/NodeTraversal.h" | 50 #include "core/dom/NodeTraversal.h" |
| 51 #include "core/dom/ProcessingInstruction.h" | 51 #include "core/dom/ProcessingInstruction.h" |
| 52 #include "core/dom/Range.h" | 52 #include "core/dom/Range.h" |
| 53 #include "core/dom/StaticNodeList.h" | 53 #include "core/dom/StaticNodeList.h" |
| 54 #include "core/dom/StyleEngine.h" | 54 #include "core/dom/StyleEngine.h" |
| 55 #include "core/dom/TemplateContentDocumentFragment.h" | 55 #include "core/dom/TemplateContentDocumentFragment.h" |
| 56 #include "core/dom/Text.h" | 56 #include "core/dom/Text.h" |
| 57 #include "core/dom/TreeScopeAdopter.h" | 57 #include "core/dom/TreeScopeAdopter.h" |
| 58 #include "core/dom/UserActionElementSet.h" | 58 #include "core/dom/UserActionElementSet.h" |
| 59 #include "core/dom/custom/CustomElement.h" |
| 59 #include "core/dom/shadow/ElementShadow.h" | 60 #include "core/dom/shadow/ElementShadow.h" |
| 60 #include "core/dom/shadow/FlatTreeTraversal.h" | 61 #include "core/dom/shadow/FlatTreeTraversal.h" |
| 61 #include "core/dom/shadow/InsertionPoint.h" | 62 #include "core/dom/shadow/InsertionPoint.h" |
| 62 #include "core/dom/shadow/ShadowRoot.h" | 63 #include "core/dom/shadow/ShadowRoot.h" |
| 63 #include "core/dom/shadow/SlotAssignment.h" | 64 #include "core/dom/shadow/SlotAssignment.h" |
| 64 #include "core/editing/EditingUtilities.h" | 65 #include "core/editing/EditingUtilities.h" |
| 65 #include "core/editing/markers/DocumentMarkerController.h" | 66 #include "core/editing/markers/DocumentMarkerController.h" |
| 66 #include "core/events/Event.h" | 67 #include "core/events/Event.h" |
| 67 #include "core/events/EventDispatchMediator.h" | 68 #include "core/events/EventDispatchMediator.h" |
| 68 #include "core/events/EventDispatcher.h" | 69 #include "core/events/EventDispatcher.h" |
| (...skipping 2144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2213 DCHECK(isUserActionElement()); | 2214 DCHECK(isUserActionElement()); |
| 2214 return document().userActionElements().isHovered(this); | 2215 return document().userActionElements().isHovered(this); |
| 2215 } | 2216 } |
| 2216 | 2217 |
| 2217 bool Node::isUserActionElementFocused() const | 2218 bool Node::isUserActionElementFocused() const |
| 2218 { | 2219 { |
| 2219 DCHECK(isUserActionElement()); | 2220 DCHECK(isUserActionElement()); |
| 2220 return document().userActionElements().isFocused(this); | 2221 return document().userActionElements().isFocused(this); |
| 2221 } | 2222 } |
| 2222 | 2223 |
| 2223 std::ostream& operator<<(std::ostream& os, CustomElementState state) | |
| 2224 { | |
| 2225 switch (state) { | |
| 2226 case CustomElementState::Uncustomized: return os << "Uncustomized"; | |
| 2227 case CustomElementState::Undefined: return os << "Undefined"; | |
| 2228 case CustomElementState::Custom: return os << "Custom"; | |
| 2229 default: NOTREACHED(); | |
| 2230 } | |
| 2231 return os; | |
| 2232 } | |
| 2233 | |
| 2234 CustomElementState Node::getCustomElementState() const | |
| 2235 { | |
| 2236 return !isCustomElement() | |
| 2237 ? CustomElementState::Uncustomized | |
| 2238 : (getFlag(CustomElementCustomFlag) ? CustomElementState::Custom : Custo
mElementState::Undefined); | |
| 2239 } | |
| 2240 | |
| 2241 void Node::setCustomElementState(CustomElementState newState) | 2224 void Node::setCustomElementState(CustomElementState newState) |
| 2242 { | 2225 { |
| 2243 CustomElementState oldState = getCustomElementState(); | 2226 CustomElementState oldState = getCustomElementState(); |
| 2244 | 2227 |
| 2245 switch (newState) { | 2228 switch (newState) { |
| 2246 case CustomElementState::Uncustomized: | 2229 case CustomElementState::Uncustomized: |
| 2247 NOTREACHED(); // Everything starts in this state | 2230 NOTREACHED(); // Everything starts in this state |
| 2248 return; | 2231 return; |
| 2249 | 2232 |
| 2250 case CustomElementState::Undefined: | 2233 case CustomElementState::Undefined: |
| 2251 DCHECK_EQ(CustomElementState::Uncustomized, oldState); | 2234 DCHECK_EQ(CustomElementState::Uncustomized, oldState); |
| 2252 break; | 2235 break; |
| 2253 | 2236 |
| 2254 case CustomElementState::Custom: | 2237 case CustomElementState::Custom: |
| 2255 DCHECK_EQ(CustomElementState::Undefined, oldState); | 2238 DCHECK_EQ(CustomElementState::Undefined, oldState); |
| 2256 break; | 2239 break; |
| 2240 |
| 2241 case CustomElementState::Failed: |
| 2242 DCHECK_NE(CustomElementState::Failed, oldState); |
| 2243 break; |
| 2257 } | 2244 } |
| 2258 | 2245 |
| 2259 DCHECK(isHTMLElement()); | 2246 DCHECK(isHTMLElement()); |
| 2260 DCHECK_NE(V0Upgraded, getV0CustomElementState()); | 2247 DCHECK_NE(V0Upgraded, getV0CustomElementState()); |
| 2261 #if DCHECK_IS_ON() | |
| 2262 bool wasDefined = toElement(this)->isDefined(); | |
| 2263 #endif | |
| 2264 | 2248 |
| 2265 setFlag(CustomElementFlag); | 2249 Element* element = toElement(this); |
| 2266 if (newState == CustomElementState::Custom) | 2250 bool wasDefined = element->isDefined(); |
| 2267 setFlag(CustomElementCustomFlag); | 2251 |
| 2252 m_nodeFlags = (m_nodeFlags & ~CustomElementStateMask) |
| 2253 | static_cast<NodeFlags>(newState); |
| 2268 DCHECK(newState == getCustomElementState()); | 2254 DCHECK(newState == getCustomElementState()); |
| 2269 | 2255 |
| 2270 // When the state goes from Uncustomized to Undefined, and then to Custom, | 2256 if (element->isDefined() != wasDefined) |
| 2271 // isDefined is always flipped. | 2257 element->pseudoStateChanged(CSSSelector::PseudoDefined); |
| 2272 #if DCHECK_IS_ON() | |
| 2273 DCHECK_NE(wasDefined, toElement(this)->isDefined()); | |
| 2274 #endif | |
| 2275 toElement(this)->pseudoStateChanged(CSSSelector::PseudoDefined); | |
| 2276 } | 2258 } |
| 2277 | 2259 |
| 2278 void Node::setV0CustomElementState(V0CustomElementState newState) | 2260 void Node::setV0CustomElementState(V0CustomElementState newState) |
| 2279 { | 2261 { |
| 2280 V0CustomElementState oldState = getV0CustomElementState(); | 2262 V0CustomElementState oldState = getV0CustomElementState(); |
| 2281 | 2263 |
| 2282 switch (newState) { | 2264 switch (newState) { |
| 2283 case V0NotCustomElement: | 2265 case V0NotCustomElement: |
| 2284 ASSERT_NOT_REACHED(); // Everything starts in this state | 2266 ASSERT_NOT_REACHED(); // Everything starts in this state |
| 2285 return; | 2267 return; |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2421 | 2403 |
| 2422 void showNodePath(const blink::Node* node) | 2404 void showNodePath(const blink::Node* node) |
| 2423 { | 2405 { |
| 2424 if (node) | 2406 if (node) |
| 2425 node->showNodePathForThis(); | 2407 node->showNodePathForThis(); |
| 2426 else | 2408 else |
| 2427 fprintf(stderr, "Cannot showNodePath for (nil)\n"); | 2409 fprintf(stderr, "Cannot showNodePath for (nil)\n"); |
| 2428 } | 2410 } |
| 2429 | 2411 |
| 2430 #endif | 2412 #endif |
| OLD | NEW |