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 885 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
896 bool Node::isMouseFocusable() const | 896 bool Node::isMouseFocusable() const |
897 { | 897 { |
898 return isFocusable(); | 898 return isFocusable(); |
899 } | 899 } |
900 | 900 |
901 Node* Node::focusDelegate() | 901 Node* Node::focusDelegate() |
902 { | 902 { |
903 return this; | 903 return this; |
904 } | 904 } |
905 | 905 |
| 906 #if ENABLE(DIALOG_ELEMENT) |
| 907 bool Node::isInert() const |
| 908 { |
| 909 Element* dialog = document()->activeModalDialog(); |
| 910 return dialog && !containsIncludingShadowDOM(dialog) && !dialog->containsInc
ludingShadowDOM(this); |
| 911 } |
| 912 #endif |
| 913 |
906 unsigned Node::nodeIndex() const | 914 unsigned Node::nodeIndex() const |
907 { | 915 { |
908 Node *_tempNode = previousSibling(); | 916 Node *_tempNode = previousSibling(); |
909 unsigned count=0; | 917 unsigned count=0; |
910 for ( count=0; _tempNode; count++ ) | 918 for ( count=0; _tempNode; count++ ) |
911 _tempNode = _tempNode->previousSibling(); | 919 _tempNode = _tempNode->previousSibling(); |
912 return count; | 920 return count; |
913 } | 921 } |
914 | 922 |
915 template<unsigned type> | 923 template<unsigned type> |
(...skipping 1387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2303 (*iter)->observedSubtreeNodeWillDetach(this); | 2311 (*iter)->observedSubtreeNodeWillDetach(this); |
2304 } | 2312 } |
2305 } | 2313 } |
2306 } | 2314 } |
2307 | 2315 |
2308 void Node::handleLocalEvents(Event* event) | 2316 void Node::handleLocalEvents(Event* event) |
2309 { | 2317 { |
2310 if (!hasEventTargetData()) | 2318 if (!hasEventTargetData()) |
2311 return; | 2319 return; |
2312 | 2320 |
2313 if (isElementNode() && toElement(this)->disabled() && event->isMouseEvent()) | 2321 if (disabled() && event->isMouseEvent()) |
2314 return; | 2322 return; |
2315 | 2323 |
2316 fireEventListeners(event); | 2324 fireEventListeners(event); |
2317 } | 2325 } |
2318 | 2326 |
2319 void Node::dispatchScopedEvent(PassRefPtr<Event> event) | 2327 void Node::dispatchScopedEvent(PassRefPtr<Event> event) |
2320 { | 2328 { |
2321 dispatchScopedEventDispatchMediator(EventDispatchMediator::create(event)); | 2329 dispatchScopedEventDispatchMediator(EventDispatchMediator::create(event)); |
2322 } | 2330 } |
2323 | 2331 |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2443 void Node::dispatchChangeEvent() | 2451 void Node::dispatchChangeEvent() |
2444 { | 2452 { |
2445 dispatchScopedEvent(Event::create(eventNames().changeEvent, true, false)); | 2453 dispatchScopedEvent(Event::create(eventNames().changeEvent, true, false)); |
2446 } | 2454 } |
2447 | 2455 |
2448 void Node::dispatchInputEvent() | 2456 void Node::dispatchInputEvent() |
2449 { | 2457 { |
2450 dispatchScopedEvent(Event::create(eventNames().inputEvent, true, false)); | 2458 dispatchScopedEvent(Event::create(eventNames().inputEvent, true, false)); |
2451 } | 2459 } |
2452 | 2460 |
| 2461 bool Node::disabled() const |
| 2462 { |
| 2463 #if ENABLE(DIALOG_ELEMENT) |
| 2464 if (isInert()) |
| 2465 return true; |
| 2466 #endif |
| 2467 return false; |
| 2468 } |
| 2469 |
2453 void Node::defaultEventHandler(Event* event) | 2470 void Node::defaultEventHandler(Event* event) |
2454 { | 2471 { |
2455 if (event->target() != this) | 2472 if (event->target() != this) |
2456 return; | 2473 return; |
2457 const AtomicString& eventType = event->type(); | 2474 const AtomicString& eventType = event->type(); |
2458 if (eventType == eventNames().keydownEvent || eventType == eventNames().keyp
ressEvent) { | 2475 if (eventType == eventNames().keydownEvent || eventType == eventNames().keyp
ressEvent) { |
2459 if (event->isKeyboardEvent()) | 2476 if (event->isKeyboardEvent()) |
2460 if (Frame* frame = document()->frame()) | 2477 if (Frame* frame = document()->frame()) |
2461 frame->eventHandler()->defaultKeyboardEventHandler(static_cast<K
eyboardEvent*>(event)); | 2478 frame->eventHandler()->defaultKeyboardEventHandler(static_cast<K
eyboardEvent*>(event)); |
2462 } else if (eventType == eventNames().clickEvent) { | 2479 } else if (eventType == eventNames().clickEvent) { |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2502 if (startNode && startNode->renderer()) | 2519 if (startNode && startNode->renderer()) |
2503 if (Frame* frame = document()->frame()) | 2520 if (Frame* frame = document()->frame()) |
2504 frame->eventHandler()->defaultWheelEventHandler(startNode, wheel
Event); | 2521 frame->eventHandler()->defaultWheelEventHandler(startNode, wheel
Event); |
2505 } else if (event->type() == eventNames().webkitEditableContentChangedEvent)
{ | 2522 } else if (event->type() == eventNames().webkitEditableContentChangedEvent)
{ |
2506 dispatchInputEvent(); | 2523 dispatchInputEvent(); |
2507 } | 2524 } |
2508 } | 2525 } |
2509 | 2526 |
2510 bool Node::willRespondToMouseMoveEvents() | 2527 bool Node::willRespondToMouseMoveEvents() |
2511 { | 2528 { |
2512 if (isElementNode() && toElement(this)->disabled()) | 2529 if (disabled()) |
2513 return false; | 2530 return false; |
2514 return hasEventListeners(eventNames().mousemoveEvent) || hasEventListeners(e
ventNames().mouseoverEvent) || hasEventListeners(eventNames().mouseoutEvent); | 2531 return hasEventListeners(eventNames().mousemoveEvent) || hasEventListeners(e
ventNames().mouseoverEvent) || hasEventListeners(eventNames().mouseoutEvent); |
2515 } | 2532 } |
2516 | 2533 |
2517 bool Node::willRespondToMouseClickEvents() | 2534 bool Node::willRespondToMouseClickEvents() |
2518 { | 2535 { |
2519 if (isElementNode() && toElement(this)->disabled()) | 2536 if (disabled()) |
2520 return false; | 2537 return false; |
2521 return isContentEditable(UserSelectAllIsAlwaysNonEditable) || hasEventListen
ers(eventNames().mouseupEvent) || hasEventListeners(eventNames().mousedownEvent)
|| hasEventListeners(eventNames().clickEvent) || hasEventListeners(eventNames()
.DOMActivateEvent); | 2538 return isContentEditable(UserSelectAllIsAlwaysNonEditable) || hasEventListen
ers(eventNames().mouseupEvent) || hasEventListeners(eventNames().mousedownEvent)
|| hasEventListeners(eventNames().clickEvent) || hasEventListeners(eventNames()
.DOMActivateEvent); |
2522 } | 2539 } |
2523 | 2540 |
2524 bool Node::willRespondToTouchEvents() | 2541 bool Node::willRespondToTouchEvents() |
2525 { | 2542 { |
2526 #if ENABLE(TOUCH_EVENTS) | 2543 #if ENABLE(TOUCH_EVENTS) |
2527 if (isElementNode() && toElement(this)->disabled()) | 2544 if (disabled()) |
2528 return false; | 2545 return false; |
2529 return hasEventListeners(eventNames().touchstartEvent) || hasEventListeners(
eventNames().touchmoveEvent) || hasEventListeners(eventNames().touchcancelEvent)
|| hasEventListeners(eventNames().touchendEvent); | 2546 return hasEventListeners(eventNames().touchstartEvent) || hasEventListeners(
eventNames().touchmoveEvent) || hasEventListeners(eventNames().touchcancelEvent)
|| hasEventListeners(eventNames().touchendEvent); |
2530 #else | 2547 #else |
2531 return false; | 2548 return false; |
2532 #endif | 2549 #endif |
2533 } | 2550 } |
2534 | 2551 |
2535 #if ENABLE(MICRODATA) | 2552 #if ENABLE(MICRODATA) |
2536 DOMSettableTokenList* Node::itemProp() | 2553 DOMSettableTokenList* Node::itemProp() |
2537 { | 2554 { |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2748 node->showTreeForThis(); | 2765 node->showTreeForThis(); |
2749 } | 2766 } |
2750 | 2767 |
2751 void showNodePath(const WebCore::Node* node) | 2768 void showNodePath(const WebCore::Node* node) |
2752 { | 2769 { |
2753 if (node) | 2770 if (node) |
2754 node->showNodePathForThis(); | 2771 node->showNodePathForThis(); |
2755 } | 2772 } |
2756 | 2773 |
2757 #endif | 2774 #endif |
OLD | NEW |