| 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 670 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 681 return true; | 681 return true; |
| 682 | 682 |
| 683 // FIXME: Respect editableLevel for ARIA editable elements. | 683 // FIXME: Respect editableLevel for ARIA editable elements. |
| 684 if (editableLevel == RichlyEditable) | 684 if (editableLevel == RichlyEditable) |
| 685 return false; | 685 return false; |
| 686 | 686 |
| 687 ASSERT(document()); | 687 ASSERT(document()); |
| 688 ASSERT(AXObjectCache::accessibilityEnabled()); | 688 ASSERT(AXObjectCache::accessibilityEnabled()); |
| 689 ASSERT(document()->existingAXObjectCache()); | 689 ASSERT(document()->existingAXObjectCache()); |
| 690 | 690 |
| 691 if (document()) { | 691 if (AXObjectCache* cache = document()->existingAXObjectCache()) |
| 692 if (AXObjectCache* cache = document()->existingAXObjectCache()) | 692 return cache->rootAXEditableElement(this); |
| 693 return cache->rootAXEditableElement(this); | |
| 694 } | |
| 695 | 693 |
| 696 return false; | 694 return false; |
| 697 } | 695 } |
| 698 | 696 |
| 699 bool Node::shouldUseInputMethod() | 697 bool Node::shouldUseInputMethod() |
| 700 { | 698 { |
| 701 return isContentEditable(UserSelectAllIsAlwaysNonEditable); | 699 return isContentEditable(UserSelectAllIsAlwaysNonEditable); |
| 702 } | 700 } |
| 703 | 701 |
| 704 RenderBox* Node::renderBox() const | 702 RenderBox* Node::renderBox() const |
| (...skipping 698 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1403 es.throwDOMException(SyntaxError); | 1401 es.throwDOMException(SyntaxError); |
| 1404 return 0; | 1402 return 0; |
| 1405 } | 1403 } |
| 1406 | 1404 |
| 1407 SelectorQuery* selectorQuery = document()->selectorQueryCache()->add(selecto
rs, document(), es); | 1405 SelectorQuery* selectorQuery = document()->selectorQueryCache()->add(selecto
rs, document(), es); |
| 1408 if (!selectorQuery) | 1406 if (!selectorQuery) |
| 1409 return 0; | 1407 return 0; |
| 1410 return selectorQuery->queryAll(this); | 1408 return selectorQuery->queryAll(this); |
| 1411 } | 1409 } |
| 1412 | 1410 |
| 1413 Document *Node::ownerDocument() const | 1411 Document* Node::ownerDocument() const |
| 1414 { | 1412 { |
| 1415 Document *doc = document(); | 1413 Document* doc = document(); |
| 1416 return doc == this ? 0 : doc; | 1414 return doc == this ? 0 : doc; |
| 1417 } | 1415 } |
| 1418 | 1416 |
| 1419 KURL Node::baseURI() const | 1417 KURL Node::baseURI() const |
| 1420 { | 1418 { |
| 1421 return parentNode() ? parentNode()->baseURI() : KURL(); | 1419 return parentNode() ? parentNode()->baseURI() : KURL(); |
| 1422 } | 1420 } |
| 1423 | 1421 |
| 1424 bool Node::isEqualNode(Node* other) const | 1422 bool Node::isEqualNode(Node* other) const |
| 1425 { | 1423 { |
| (...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2055 result = "<none>"; | 2053 result = "<none>"; |
| 2056 else | 2054 else |
| 2057 result = s; | 2055 result = s; |
| 2058 | 2056 |
| 2059 strncpy(buffer, result.utf8().data(), length - 1); | 2057 strncpy(buffer, result.utf8().data(), length - 1); |
| 2060 } | 2058 } |
| 2061 | 2059 |
| 2062 static ContainerNode* parentOrShadowHostOrFrameOwner(const Node* node) | 2060 static ContainerNode* parentOrShadowHostOrFrameOwner(const Node* node) |
| 2063 { | 2061 { |
| 2064 ContainerNode* parent = node->parentOrShadowHostNode(); | 2062 ContainerNode* parent = node->parentOrShadowHostNode(); |
| 2065 if (!parent && node->document() && node->document()->frame()) | 2063 if (!parent && node->document()->frame()) |
| 2066 parent = node->document()->frame()->ownerElement(); | 2064 parent = node->document()->frame()->ownerElement(); |
| 2067 return parent; | 2065 return parent; |
| 2068 } | 2066 } |
| 2069 | 2067 |
| 2070 static void showSubTreeAcrossFrame(const Node* node, const Node* markedNode, con
st String& indent) | 2068 static void showSubTreeAcrossFrame(const Node* node, const Node* markedNode, con
st String& indent) |
| 2071 { | 2069 { |
| 2072 if (node == markedNode) | 2070 if (node == markedNode) |
| 2073 fputs("*", stderr); | 2071 fputs("*", stderr); |
| 2074 fputs(indent.utf8().data(), stderr); | 2072 fputs(indent.utf8().data(), stderr); |
| 2075 node->showNode(); | 2073 node->showNode(); |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2186 document()->addMutationObserverTypes((*iter)->mutationTypes()); | 2184 document()->addMutationObserverTypes((*iter)->mutationTypes()); |
| 2187 } | 2185 } |
| 2188 } | 2186 } |
| 2189 } | 2187 } |
| 2190 | 2188 |
| 2191 static inline bool tryAddEventListener(Node* targetNode, const AtomicString& eve
ntType, PassRefPtr<EventListener> listener, bool useCapture) | 2189 static inline bool tryAddEventListener(Node* targetNode, const AtomicString& eve
ntType, PassRefPtr<EventListener> listener, bool useCapture) |
| 2192 { | 2190 { |
| 2193 if (!targetNode->EventTarget::addEventListener(eventType, listener, useCaptu
re)) | 2191 if (!targetNode->EventTarget::addEventListener(eventType, listener, useCaptu
re)) |
| 2194 return false; | 2192 return false; |
| 2195 | 2193 |
| 2196 if (Document* document = targetNode->document()) { | 2194 Document* document = targetNode->document(); |
| 2197 document->addListenerTypeIfNeeded(eventType); | 2195 document->addListenerTypeIfNeeded(eventType); |
| 2198 if (eventType == eventNames().wheelEvent || eventType == eventNames().mo
usewheelEvent) | 2196 if (eventType == eventNames().wheelEvent || eventType == eventNames().mousew
heelEvent) |
| 2199 document->didAddWheelEventHandler(); | 2197 document->didAddWheelEventHandler(); |
| 2200 else if (eventNames().isTouchEventType(eventType)) | 2198 else if (eventNames().isTouchEventType(eventType)) |
| 2201 document->didAddTouchEventHandler(targetNode); | 2199 document->didAddTouchEventHandler(targetNode); |
| 2202 } | |
| 2203 | 2200 |
| 2204 return true; | 2201 return true; |
| 2205 } | 2202 } |
| 2206 | 2203 |
| 2207 bool Node::addEventListener(const AtomicString& eventType, PassRefPtr<EventListe
ner> listener, bool useCapture) | 2204 bool Node::addEventListener(const AtomicString& eventType, PassRefPtr<EventListe
ner> listener, bool useCapture) |
| 2208 { | 2205 { |
| 2209 return tryAddEventListener(this, eventType, listener, useCapture); | 2206 return tryAddEventListener(this, eventType, listener, useCapture); |
| 2210 } | 2207 } |
| 2211 | 2208 |
| 2212 static inline bool tryRemoveEventListener(Node* targetNode, const AtomicString&
eventType, EventListener* listener, bool useCapture) | 2209 static inline bool tryRemoveEventListener(Node* targetNode, const AtomicString&
eventType, EventListener* listener, bool useCapture) |
| 2213 { | 2210 { |
| 2214 if (!targetNode->EventTarget::removeEventListener(eventType, listener, useCa
pture)) | 2211 if (!targetNode->EventTarget::removeEventListener(eventType, listener, useCa
pture)) |
| 2215 return false; | 2212 return false; |
| 2216 | 2213 |
| 2217 // FIXME: Notify Document that the listener has vanished. We need to keep tr
ack of a number of | 2214 // FIXME: Notify Document that the listener has vanished. We need to keep tr
ack of a number of |
| 2218 // listeners for each type, not just a bool - see https://bugs.webkit.org/sh
ow_bug.cgi?id=33861 | 2215 // listeners for each type, not just a bool - see https://bugs.webkit.org/sh
ow_bug.cgi?id=33861 |
| 2219 if (Document* document = targetNode->document()) { | 2216 Document* document = targetNode->document(); |
| 2220 if (eventType == eventNames().wheelEvent || eventType == eventNames().mo
usewheelEvent) | 2217 if (eventType == eventNames().wheelEvent || eventType == eventNames().mousew
heelEvent) |
| 2221 document->didRemoveWheelEventHandler(); | 2218 document->didRemoveWheelEventHandler(); |
| 2222 else if (eventNames().isTouchEventType(eventType)) | 2219 else if (eventNames().isTouchEventType(eventType)) |
| 2223 document->didRemoveTouchEventHandler(targetNode); | 2220 document->didRemoveTouchEventHandler(targetNode); |
| 2224 } | |
| 2225 | 2221 |
| 2226 return true; | 2222 return true; |
| 2227 } | 2223 } |
| 2228 | 2224 |
| 2229 bool Node::removeEventListener(const AtomicString& eventType, EventListener* lis
tener, bool useCapture) | 2225 bool Node::removeEventListener(const AtomicString& eventType, EventListener* lis
tener, bool useCapture) |
| 2230 { | 2226 { |
| 2231 return tryRemoveEventListener(this, eventType, listener, useCapture); | 2227 return tryRemoveEventListener(this, eventType, listener, useCapture); |
| 2232 } | 2228 } |
| 2233 | 2229 |
| 2234 typedef HashMap<Node*, OwnPtr<EventTargetData> > EventTargetDataMap; | 2230 typedef HashMap<Node*, OwnPtr<EventTargetData> > EventTargetDataMap; |
| (...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2686 for (Node* child = firstChild(); child; child = child->nextSibling()) { | 2682 for (Node* child = firstChild(); child; child = child->nextSibling()) { |
| 2687 if (child->hasTagName(HTMLNames::styleTag) && toHTMLStyleElement(child)-
>isRegisteredAsScoped()) | 2683 if (child->hasTagName(HTMLNames::styleTag) && toHTMLStyleElement(child)-
>isRegisteredAsScoped()) |
| 2688 count++; | 2684 count++; |
| 2689 } | 2685 } |
| 2690 | 2686 |
| 2691 return count; | 2687 return count; |
| 2692 } | 2688 } |
| 2693 | 2689 |
| 2694 void Node::setFocus(bool flag) | 2690 void Node::setFocus(bool flag) |
| 2695 { | 2691 { |
| 2696 if (Document* document = this->document()) | 2692 document()->userActionElements().setFocused(this, flag); |
| 2697 document->userActionElements().setFocused(this, flag); | |
| 2698 } | 2693 } |
| 2699 | 2694 |
| 2700 void Node::setActive(bool flag, bool) | 2695 void Node::setActive(bool flag, bool) |
| 2701 { | 2696 { |
| 2702 if (Document* document = this->document()) | 2697 document()->userActionElements().setActive(this, flag); |
| 2703 document->userActionElements().setActive(this, flag); | |
| 2704 } | 2698 } |
| 2705 | 2699 |
| 2706 void Node::setHovered(bool flag) | 2700 void Node::setHovered(bool flag) |
| 2707 { | 2701 { |
| 2708 if (Document* document = this->document()) | 2702 document()->userActionElements().setHovered(this, flag); |
| 2709 document->userActionElements().setHovered(this, flag); | |
| 2710 } | 2703 } |
| 2711 | 2704 |
| 2712 bool Node::isUserActionElementActive() const | 2705 bool Node::isUserActionElementActive() const |
| 2713 { | 2706 { |
| 2714 ASSERT(isUserActionElement()); | 2707 ASSERT(isUserActionElement()); |
| 2715 return document()->userActionElements().isActive(this); | 2708 return document()->userActionElements().isActive(this); |
| 2716 } | 2709 } |
| 2717 | 2710 |
| 2718 bool Node::isUserActionElementInActiveChain() const | 2711 bool Node::isUserActionElementInActiveChain() const |
| 2719 { | 2712 { |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2773 node->showTreeForThis(); | 2766 node->showTreeForThis(); |
| 2774 } | 2767 } |
| 2775 | 2768 |
| 2776 void showNodePath(const WebCore::Node* node) | 2769 void showNodePath(const WebCore::Node* node) |
| 2777 { | 2770 { |
| 2778 if (node) | 2771 if (node) |
| 2779 node->showNodePathForThis(); | 2772 node->showNodePathForThis(); |
| 2780 } | 2773 } |
| 2781 | 2774 |
| 2782 #endif | 2775 #endif |
| OLD | NEW |