Changeset 155303 in webkit
- Timestamp:
- Sep 8, 2013, 4:30:17 AM (11 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r155302 r155303 1 2013-09-08 Antti Koivisto <antti@apple.com> 2 3 Rename needsShadowTreeWalker 4 https://bugs.webkit.org/show_bug.cgi?id=121005 5 6 Reviewed by Andreas Kling. 7 8 Rename to needsNodeRenderingTraversalSlowPath. 9 10 * dom/ContainerNode.h: 11 (WebCore::Node::needsNodeRenderingTraversalSlowPath): 12 * dom/Element.cpp: 13 (WebCore::shouldUseNodeRenderingTraversalSlowPath): 14 (WebCore::Element::resetNeedsNodeRenderingTraversalSlowPath): 15 16 Only Elements can have this flag. Move the code here from Node. 17 18 (WebCore::Element::addShadowRoot): 19 (WebCore::Element::setBeforePseudoElement): 20 (WebCore::Element::setAfterPseudoElement): 21 (WebCore::Element::clearBeforePseudoElement): 22 (WebCore::Element::clearAfterPseudoElement): 23 24 Reset after clear too. 25 26 * dom/Element.h: 27 * dom/Element.h: 28 * dom/Node.cpp: 29 * dom/Node.h: 30 (WebCore::Node::isInsertionPoint): 31 (WebCore::Node::setNeedsNodeRenderingTraversalSlowPath): 32 33 Make protected. 34 35 * dom/NodeRenderingTraversal.h: 36 (WebCore::NodeRenderingTraversal::parent): 37 (WebCore::NodeRenderingTraversal::nextSibling): 38 (WebCore::NodeRenderingTraversal::previousSibling): 39 1 40 2013-09-08 Andreas Kling <akling@apple.com> 2 41 -
trunk/Source/WebCore/dom/ContainerNode.h
r154957 r155303 221 221 } 222 222 223 inline bool Node::needs ShadowTreeWalker() const224 { 225 if (getFlag(Needs ShadowTreeWalkerFlag))223 inline bool Node::needsNodeRenderingTraversalSlowPath() const 224 { 225 if (getFlag(NeedsNodeRenderingTraversalSlowPathFlag)) 226 226 return true; 227 227 ContainerNode* parent = parentOrShadowHostNode(); 228 return parent && parent->getFlag(Needs ShadowTreeWalkerFlag);228 return parent && parent->getFlag(NeedsNodeRenderingTraversalSlowPathFlag); 229 229 } 230 230 -
trunk/Source/WebCore/dom/Element.cpp
r155093 r155303 1409 1409 } 1410 1410 1411 static bool shouldUseNodeRenderingTraversalSlowPath(const Element& element) 1412 { 1413 if (element.isShadowRoot()) 1414 return true; 1415 if (element.isPseudoElement() || element.beforePseudoElement() || element.afterPseudoElement()) 1416 return true; 1417 return element.isInsertionPoint() || element.shadowRoot(); 1418 } 1419 1420 void Element::resetNeedsNodeRenderingTraversalSlowPath() 1421 { 1422 setNeedsNodeRenderingTraversalSlowPath(shouldUseNodeRenderingTraversalSlowPath(*this)); 1423 } 1424 1411 1425 void Element::addShadowRoot(PassRefPtr<ShadowRoot> newShadowRoot) 1412 1426 { … … 1422 1436 ChildNodeInsertionNotifier(this).notify(shadowRoot); 1423 1437 1424 // Existence of shadow roots requires the host and its children to do traversal using ComposedShadowTreeWalker. 1425 setNeedsShadowTreeWalker(); 1438 resetNeedsNodeRenderingTraversalSlowPath(); 1426 1439 1427 1440 // FIXME(94905): ShadowHost should be reattached during recalcStyle. … … 2350 2363 { 2351 2364 ensureElementRareData().setBeforePseudoElement(element); 2352 resetNeeds ShadowTreeWalker();2365 resetNeedsNodeRenderingTraversalSlowPath(); 2353 2366 } 2354 2367 … … 2356 2369 { 2357 2370 ensureElementRareData().setAfterPseudoElement(element); 2358 resetNeeds ShadowTreeWalker();2371 resetNeedsNodeRenderingTraversalSlowPath(); 2359 2372 } 2360 2373 … … 2375 2388 disconnectPseudoElement(elementRareData()->beforePseudoElement()); 2376 2389 elementRareData()->setBeforePseudoElement(nullptr); 2390 resetNeedsNodeRenderingTraversalSlowPath(); 2377 2391 } 2378 2392 … … 2383 2397 disconnectPseudoElement(elementRareData()->afterPseudoElement()); 2384 2398 elementRareData()->setAfterPseudoElement(nullptr); 2399 resetNeedsNodeRenderingTraversalSlowPath(); 2385 2400 } 2386 2401 -
trunk/Source/WebCore/dom/Element.h
r154957 r155303 591 591 void clearBeforePseudoElement(); 592 592 void clearAfterPseudoElement(); 593 void resetNeedsNodeRenderingTraversalSlowPath(); 593 594 594 595 virtual bool areAuthorShadowsAllowed() const { return true; } -
trunk/Source/WebCore/dom/Node.cpp
r155131 r155303 1046 1046 } 1047 1047 1048 bool Node::needsShadowTreeWalkerSlow() const1049 {1050 if (isShadowRoot())1051 return true;1052 if (!isElementNode())1053 return false;1054 const Element* asElement = toElement(this);1055 if (asElement->isPseudoElement() || asElement->beforePseudoElement() || asElement->afterPseudoElement())1056 return true;1057 return asElement->isInsertionPoint() || asElement->shadowRoot();1058 }1059 1060 1048 bool Node::isRootEditableElement() const 1061 1049 { -
trunk/Source/WebCore/dom/Node.h
r154877 r155303 256 256 bool isDocumentFragment() const { return getFlag(IsDocumentFragmentFlag); } 257 257 bool isShadowRoot() const { return isDocumentFragment() && isTreeScope(); } 258 bool isInsertionPoint() const { return getFlag(Needs ShadowTreeWalkerFlag) && isInsertionPointNode(); }258 bool isInsertionPoint() const { return getFlag(NeedsNodeRenderingTraversalSlowPathFlag) && isInsertionPointNode(); } 259 259 // Returns Node rather than InsertionPoint. Should be used only for language bindings. 260 260 Node* insertionParentForBinding() const; 261 261 262 bool needsShadowTreeWalker() const; 263 bool needsShadowTreeWalkerSlow() const; 264 void setNeedsShadowTreeWalker() { setFlag(NeedsShadowTreeWalkerFlag); } 265 void resetNeedsShadowTreeWalker() { setFlag(needsShadowTreeWalkerSlow(), NeedsShadowTreeWalkerFlag); } 262 bool needsNodeRenderingTraversalSlowPath() const; 266 263 267 264 bool inNamedFlow() const { return getFlag(InNamedFlowFlag); } … … 634 631 HasScopedHTMLStyleChildFlag = 1 << 22, 635 632 HasEventTargetDataFlag = 1 << 23, 636 Needs ShadowTreeWalkerFlag = 1 << 25,633 NeedsNodeRenderingTraversalSlowPathFlag = 1 << 25, 637 634 IsInShadowTreeFlag = 1 << 26, 638 635 … … 653 650 CreateContainer = DefaultNodeFlags | IsContainerFlag, 654 651 CreateElement = CreateContainer | IsElementFlag, 655 CreatePseudoElement = CreateElement | InDocumentFlag | Needs ShadowTreeWalkerFlag,656 CreateShadowRoot = CreateContainer | IsDocumentFragmentFlag | Needs ShadowTreeWalkerFlag | IsInShadowTreeFlag,652 CreatePseudoElement = CreateElement | InDocumentFlag | NeedsNodeRenderingTraversalSlowPathFlag, 653 CreateShadowRoot = CreateContainer | IsDocumentFragmentFlag | NeedsNodeRenderingTraversalSlowPathFlag | IsInShadowTreeFlag, 657 654 CreateDocumentFragment = CreateContainer | IsDocumentFragmentFlag, 658 655 CreateStyledElement = CreateElement | IsStyledElementFlag, … … 660 657 CreateSVGElement = CreateStyledElement | IsSVGFlag | HasCustomStyleResolveCallbacksFlag, 661 658 CreateDocument = CreateContainer | InDocumentFlag, 662 CreateInsertionPoint = CreateHTMLElement | Needs ShadowTreeWalkerFlag,659 CreateInsertionPoint = CreateHTMLElement | NeedsNodeRenderingTraversalSlowPathFlag, 663 660 CreateEditingText = CreateText | IsEditingTextFlag, 664 661 }; … … 678 675 679 676 void setHasCustomStyleResolveCallbacks() { setFlag(true, HasCustomStyleResolveCallbacksFlag); } 677 678 void setNeedsNodeRenderingTraversalSlowPath(bool flag) { setFlag(flag, NeedsNodeRenderingTraversalSlowPathFlag); } 680 679 681 680 Document* documentInternal() const { return treeScope()->documentScope(); } -
trunk/Source/WebCore/dom/NodeRenderingTraversal.h
r154327 r155303 1 1 /* 2 2 * Copyright (C) 2012 Google Inc. All rights reserved. 3 * Copyright (C) 2013 Apple Inc. All rights reserved. 3 4 * 4 5 * Redistribution and use in source and binary forms, with or without … … 28 29 #define NodeRenderingTraversal_h 29 30 30 #include " Element.h"31 #include "ContainerNode.h" 31 32 32 33 namespace WebCore { 33 34 class InsertionPoint;35 34 36 35 namespace NodeRenderingTraversal { 37 36 38 37 ContainerNode* parent(const Node*); 39 ContainerNode* parentSlow(const Node*);40 38 Node* nextSibling(const Node*); 41 Node* nextSiblingSlow(const Node*);42 39 Node* previousSibling(const Node*); 43 Node* previousSiblingSlow(const Node*);44 40 45 41 Node* nextInScope(const Node*); … … 48 44 Node* lastChildInScope(const Node*); 49 45 46 ContainerNode* parentSlow(const Node*); 47 Node* nextSiblingSlow(const Node*); 48 Node* previousSiblingSlow(const Node*); 49 50 50 inline ContainerNode* parent(const Node* node) 51 51 { 52 if (!node->needsShadowTreeWalker()) { 53 #ifndef NDEBUG 54 ASSERT(node->parentNode() == parentSlow(node)); 55 #endif 56 return node->parentNodeGuaranteedHostFree(); 57 } 52 if (node->needsNodeRenderingTraversalSlowPath()) 53 return parentSlow(node); 58 54 59 return parentSlow(node); 55 ASSERT(node->parentNode() == parentSlow(node)); 56 return node->parentNodeGuaranteedHostFree(); 60 57 } 61 58 62 59 inline Node* nextSibling(const Node* node) 63 60 { 64 if (!node->needsShadowTreeWalker()) { 65 ASSERT(nextSiblingSlow(node) == node->nextSibling()); 66 return node->nextSibling(); 67 } 61 if (node->needsNodeRenderingTraversalSlowPath()) 62 return nextSiblingSlow(node); 68 63 69 return nextSiblingSlow(node); 64 ASSERT(nextSiblingSlow(node) == node->nextSibling()); 65 return node->nextSibling(); 70 66 } 71 67 72 68 inline Node* previousSibling(const Node* node) 73 69 { 74 if (!node->needsShadowTreeWalker()) { 75 ASSERT(previousSiblingSlow(node) == node->previousSibling()); 76 return node->previousSibling(); 77 } 70 if (node->needsNodeRenderingTraversalSlowPath()) 71 return previousSiblingSlow(node); 78 72 79 return previousSiblingSlow(node); 73 ASSERT(previousSiblingSlow(node) == node->previousSibling()); 74 return node->previousSibling(); 80 75 } 81 76
Note:
See TracChangeset
for help on using the changeset viewer.