Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(206)

Side by Side Diff: third_party/WebKit/Source/core/dom/Node.cpp

Issue 1489433002: Support the essential part of Shadow DOM v1 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Revert Internals.* Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 #include "core/events/PointerEvent.h" 72 #include "core/events/PointerEvent.h"
73 #include "core/events/TextEvent.h" 73 #include "core/events/TextEvent.h"
74 #include "core/events/TouchEvent.h" 74 #include "core/events/TouchEvent.h"
75 #include "core/events/UIEvent.h" 75 #include "core/events/UIEvent.h"
76 #include "core/events/WheelEvent.h" 76 #include "core/events/WheelEvent.h"
77 #include "core/frame/EventHandlerRegistry.h" 77 #include "core/frame/EventHandlerRegistry.h"
78 #include "core/frame/LocalDOMWindow.h" 78 #include "core/frame/LocalDOMWindow.h"
79 #include "core/frame/LocalFrame.h" 79 #include "core/frame/LocalFrame.h"
80 #include "core/html/HTMLDialogElement.h" 80 #include "core/html/HTMLDialogElement.h"
81 #include "core/html/HTMLFrameOwnerElement.h" 81 #include "core/html/HTMLFrameOwnerElement.h"
82 #include "core/html/HTMLSlotElement.h"
82 #include "core/input/EventHandler.h" 83 #include "core/input/EventHandler.h"
83 #include "core/layout/LayoutBox.h" 84 #include "core/layout/LayoutBox.h"
84 #include "core/page/ContextMenuController.h" 85 #include "core/page/ContextMenuController.h"
85 #include "core/page/Page.h" 86 #include "core/page/Page.h"
86 #include "core/svg/graphics/SVGImage.h" 87 #include "core/svg/graphics/SVGImage.h"
87 #include "platform/EventDispatchForbiddenScope.h" 88 #include "platform/EventDispatchForbiddenScope.h"
88 #include "platform/TraceEvent.h" 89 #include "platform/TraceEvent.h"
89 #include "platform/TracedValue.h" 90 #include "platform/TracedValue.h"
90 #include "wtf/HashSet.h" 91 #include "wtf/HashSet.h"
91 #include "wtf/Partitions.h" 92 #include "wtf/Partitions.h"
(...skipping 861 matching lines...) Expand 10 before | Expand all | Expand 10 after
953 // but if the element is draggable then dragging should take priority ov er selection. 954 // but if the element is draggable then dragging should take priority ov er selection.
954 if (style.userDrag() == DRAG_ELEMENT && style.userSelect() == SELECT_NON E) 955 if (style.userDrag() == DRAG_ELEMENT && style.userSelect() == SELECT_NON E)
955 return false; 956 return false;
956 } 957 }
957 ContainerNode* parent = ComposedTreeTraversal::parent(*this); 958 ContainerNode* parent = ComposedTreeTraversal::parent(*this);
958 return parent ? parent->canStartSelection() : true; 959 return parent ? parent->canStartSelection() : true;
959 } 960 }
960 961
961 bool Node::canParticipateInComposedTree() const 962 bool Node::canParticipateInComposedTree() const
962 { 963 {
963 return !isShadowRoot() && !isActiveInsertionPoint(*this); 964 return !isShadowRoot() && !isSlotOrActiveInsertionPoint();
965 }
966
967 bool Node::isSlotOrActiveInsertionPoint() const
968 {
969 return isHTMLSlotElement(*this) || isActiveInsertionPoint(*this);
964 } 970 }
965 971
966 Element* Node::shadowHost() const 972 Element* Node::shadowHost() const
967 { 973 {
968 if (ShadowRoot* root = containingShadowRoot()) 974 if (ShadowRoot* root = containingShadowRoot())
969 return root->host(); 975 return root->host();
970 return nullptr; 976 return nullptr;
971 } 977 }
972 978
973 ShadowRoot* Node::containingShadowRoot() const 979 ShadowRoot* Node::containingShadowRoot() const
(...skipping 1222 matching lines...) Expand 10 before | Expand all | Expand 10 after
2196 for (size_t i = 0; i < insertionPoints.size(); ++i) { 2202 for (size_t i = 0; i < insertionPoints.size(); ++i) {
2197 InsertionPoint* insertionPoint = insertionPoints[i]; 2203 InsertionPoint* insertionPoint = insertionPoints[i];
2198 ASSERT(insertionPoint->containingShadowRoot()); 2204 ASSERT(insertionPoint->containingShadowRoot());
2199 if (!insertionPoint->containingShadowRoot()->isOpen()) 2205 if (!insertionPoint->containingShadowRoot()->isOpen())
2200 break; 2206 break;
2201 filteredInsertionPoints.append(insertionPoint); 2207 filteredInsertionPoints.append(insertionPoint);
2202 } 2208 }
2203 return StaticNodeList::adopt(filteredInsertionPoints); 2209 return StaticNodeList::adopt(filteredInsertionPoints);
2204 } 2210 }
2205 2211
2212 HTMLSlotElement* Node::assignedSlot() const
2213 {
2214 ASSERT(!needsDistributionRecalc());
2215 Element* parent = parentElement();
2216 if (!parent)
2217 return nullptr;
2218 if (ElementShadow* shadow = parent->shadow()) {
2219 if (shadow->isV1())
2220 return shadow->assignedSlotFor(*this);
2221 }
2222 return nullptr;
2223 }
2224
2206 void Node::setFocus(bool flag) 2225 void Node::setFocus(bool flag)
2207 { 2226 {
2208 document().userActionElements().setFocused(this, flag); 2227 document().userActionElements().setFocused(this, flag);
2209 } 2228 }
2210 2229
2211 void Node::setActive(bool flag) 2230 void Node::setActive(bool flag)
2212 { 2231 {
2213 document().userActionElements().setActive(this, flag); 2232 document().userActionElements().setActive(this, flag);
2214 } 2233 }
2215 2234
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
2351 2370
2352 void showNodePath(const blink::Node* node) 2371 void showNodePath(const blink::Node* node)
2353 { 2372 {
2354 if (node) 2373 if (node)
2355 node->showNodePathForThis(); 2374 node->showNodePathForThis();
2356 else 2375 else
2357 fprintf(stderr, "Cannot showNodePath for (nil)\n"); 2376 fprintf(stderr, "Cannot showNodePath for (nil)\n");
2358 } 2377 }
2359 2378
2360 #endif 2379 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/Node.h ('k') | third_party/WebKit/Source/core/dom/NodeComputedStyle.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698