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 2285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2296 DCHECK(isUserActionElement()); | 2296 DCHECK(isUserActionElement()); |
2297 return document().userActionElements().isHovered(this); | 2297 return document().userActionElements().isHovered(this); |
2298 } | 2298 } |
2299 | 2299 |
2300 bool Node::isUserActionElementFocused() const | 2300 bool Node::isUserActionElementFocused() const |
2301 { | 2301 { |
2302 DCHECK(isUserActionElement()); | 2302 DCHECK(isUserActionElement()); |
2303 return document().userActionElements().isFocused(this); | 2303 return document().userActionElements().isFocused(this); |
2304 } | 2304 } |
2305 | 2305 |
| 2306 std::ostream& operator<<(std::ostream& os, CustomElementState state) |
| 2307 { |
| 2308 switch (state) { |
| 2309 case CustomElementState::Uncustomized: return os << "Uncustomized"; |
| 2310 case CustomElementState::Undefined: return os << "Undefined"; |
| 2311 case CustomElementState::Custom: return os << "Custom"; |
| 2312 default: NOTREACHED(); |
| 2313 } |
| 2314 return os; |
| 2315 } |
| 2316 |
| 2317 CustomElementState Node::getCustomElementState() const |
| 2318 { |
| 2319 return !isCustomElement() |
| 2320 ? CustomElementState::Uncustomized |
| 2321 : (getFlag(CustomElementCustomFlag) ? CustomElementState::Custom : Custo
mElementState::Undefined); |
| 2322 } |
| 2323 |
| 2324 void Node::setCustomElementState(CustomElementState newState) |
| 2325 { |
| 2326 CustomElementState oldState = getCustomElementState(); |
| 2327 |
| 2328 switch (newState) { |
| 2329 case CustomElementState::Uncustomized: |
| 2330 NOTREACHED(); // Everything starts in this state |
| 2331 return; |
| 2332 |
| 2333 case CustomElementState::Undefined: |
| 2334 DCHECK_EQ(CustomElementState::Uncustomized, oldState); |
| 2335 break; |
| 2336 |
| 2337 case CustomElementState::Custom: |
| 2338 DCHECK_EQ(CustomElementState::Undefined, oldState); |
| 2339 break; |
| 2340 } |
| 2341 |
| 2342 DCHECK(isHTMLElement()); |
| 2343 DCHECK_NE(V0Upgraded, getV0CustomElementState()); |
| 2344 |
| 2345 setFlag(CustomElementFlag); |
| 2346 if (newState == CustomElementState::Custom) |
| 2347 setFlag(CustomElementCustomFlag); |
| 2348 DCHECK(newState == getCustomElementState()); |
| 2349 |
| 2350 // TODO(kojii): Should fire pseudoStateChanged() when :defined selector is |
| 2351 // ready. |
| 2352 // toElement(this)->pseudoStateChanged(CSSSelector::PseudoDefined); |
| 2353 } |
| 2354 |
2306 void Node::setV0CustomElementState(V0CustomElementState newState) | 2355 void Node::setV0CustomElementState(V0CustomElementState newState) |
2307 { | 2356 { |
2308 V0CustomElementState oldState = getV0CustomElementState(); | 2357 V0CustomElementState oldState = getV0CustomElementState(); |
2309 | 2358 |
2310 switch (newState) { | 2359 switch (newState) { |
2311 case V0NotCustomElement: | 2360 case V0NotCustomElement: |
2312 ASSERT_NOT_REACHED(); // Everything starts in this state | 2361 ASSERT_NOT_REACHED(); // Everything starts in this state |
2313 return; | 2362 return; |
2314 | 2363 |
2315 case V0WaitingForUpgrade: | 2364 case V0WaitingForUpgrade: |
2316 DCHECK_EQ(V0NotCustomElement, oldState); | 2365 DCHECK_EQ(V0NotCustomElement, oldState); |
2317 break; | 2366 break; |
2318 | 2367 |
2319 case V0Upgraded: | 2368 case V0Upgraded: |
2320 DCHECK_EQ(V0WaitingForUpgrade, oldState); | 2369 DCHECK_EQ(V0WaitingForUpgrade, oldState); |
2321 break; | 2370 break; |
2322 } | 2371 } |
2323 | 2372 |
2324 DCHECK(isHTMLElement() || isSVGElement()); | 2373 DCHECK(isHTMLElement() || isSVGElement()); |
| 2374 DCHECK(CustomElementState::Custom != getCustomElementState()); |
2325 setFlag(V0CustomElementFlag); | 2375 setFlag(V0CustomElementFlag); |
2326 setFlag(newState == V0Upgraded, V0CustomElementUpgradedFlag); | 2376 setFlag(newState == V0Upgraded, V0CustomElementUpgradedFlag); |
2327 | 2377 |
2328 if (oldState == V0NotCustomElement || newState == V0Upgraded) | 2378 if (oldState == V0NotCustomElement || newState == V0Upgraded) |
2329 toElement(this)->pseudoStateChanged(CSSSelector::PseudoUnresolved); | 2379 toElement(this)->pseudoStateChanged(CSSSelector::PseudoUnresolved); |
2330 } | 2380 } |
2331 | 2381 |
2332 void Node::updateAssignmentForInsertedInto(ContainerNode* insertionPoint) | 2382 void Node::updateAssignmentForInsertedInto(ContainerNode* insertionPoint) |
2333 { | 2383 { |
2334 if (isShadowHost(insertionPoint)) { | 2384 if (isShadowHost(insertionPoint)) { |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2424 | 2474 |
2425 void showNodePath(const blink::Node* node) | 2475 void showNodePath(const blink::Node* node) |
2426 { | 2476 { |
2427 if (node) | 2477 if (node) |
2428 node->showNodePathForThis(); | 2478 node->showNodePathForThis(); |
2429 else | 2479 else |
2430 fprintf(stderr, "Cannot showNodePath for (nil)\n"); | 2480 fprintf(stderr, "Cannot showNodePath for (nil)\n"); |
2431 } | 2481 } |
2432 | 2482 |
2433 #endif | 2483 #endif |
OLD | NEW |