Changeset 73618 in webkit
- Timestamp:
- Dec 9, 2010 9:23:00 AM (13 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 22 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r73616 r73618 1 2010-12-08 Dimitri Glazkov <dglazkov@chromium.org> 2 3 Reviewed by Darin Adler. 4 5 Provide a generic way to store shadowParent on a Node. 6 https://bugs.webkit.org/show_bug.cgi?id=50184 7 8 This patch makes TreeShared::m_parent act as either parentNode() or 9 shadowHost() for Node. The distinction is controlled by IsShadowRootFlag. 10 11 Refactoring, so no new tests. See performance result testing in bug. 12 13 * dom/Element.cpp: 14 (WebCore::Element::recalcStyle): Changed to use parentOrHostNode(). 15 * dom/Node.cpp: 16 (WebCore::Node::shadowHost): Added. 17 (WebCore::Node::setShadowHost): Added. 18 (WebCore::Node::isContentEditable): Changed to use parentOrHostNode(). 19 (WebCore::Node::isContentRichlyEditable): Ditto. 20 (WebCore::Node::nextRenderer): Ditto. 21 (WebCore::Node::virtualComputedStyle): Ditto. 22 (WebCore::Node::canStartSelection): Ditto. 23 (WebCore::Node::shadowTreeRootNode): Changed to use parentNodeGuaranteedHostFree(). 24 (WebCore::Node::getEventAncestors): Ditto. 25 (WebCore::Node::defaultEventHandler): Changed to use parentOrHostNode(). 26 * dom/Node.h: Added an extra flag and adjusted bit counts. 27 (WebCore::Node::isShadowNode): Made non-virtual, switched to use flag. 28 (WebCore::Node::parentNode): Made to recognize flag. 29 (WebCore::Node::parentOrHostNode): Changed to use straight parent() and made const. 30 (WebCore::Node::parentNodeGuaranteedHostFree): Added. 31 (WebCore::Node::shadowParentNode): Made non-virtual and const. 32 * editing/TextIterator.cpp: 33 (WebCore::depthCrossingShadowBoundaries): Changed to use parentOrHostNode(); 34 (WebCore::nextInPreOrderCrossingShadowBoundaries): Ditto. 35 (WebCore::previousInPostOrderCrossingShadowBoundaries): Ditto. 36 (WebCore::setUpFullyClippedStack): Ditto. 37 (WebCore::TextIterator::advance): Ditto. 38 (WebCore::SimplifiedBackwardsTextIterator::advance): Ditto. 39 * page/DOMSelection.cpp: 40 (WebCore::DOMSelection::anchorNode): Changed to use parentNodeGuaranteedHostFree(). 41 (WebCore::DOMSelection::focusNode): Ditto. 42 (WebCore::DOMSelection::baseNode): Ditto. 43 (WebCore::DOMSelection::extentNode): Ditto. 44 (WebCore::DOMSelection::getRangeAt): Ditto. 45 * rendering/MediaControlElements.cpp: 46 (WebCore::MediaControlShadowRootElement::MediaControlShadowRootElement): 47 Changed to setShadowHost(). 48 (WebCore::MediaControlShadowRootElement::updateStyle): Changed to use shadowHost(). 49 (WebCore::MediaControlShadowRootElement::detach): Added an override to 50 explicitly set shadowHost to 0. Otherwise, the element will leak. 51 * rendering/MediaControlElements.h: Added detach def, removed members that are 52 no longer needed. 53 * rendering/RenderSVGShadowTreeRootContainer.cpp: 54 (WebCore::RenderSVGShadowTreeRootContainer::~RenderSVGShadowTreeRootContainer): 55 Added explicit clearing of shadowHost to avoid leaking and crashes, 56 because SVG shadow DOM can be dynamically attached/detached, producing 57 stale nodes in over/out event handling. 58 * rendering/RenderSlider.cpp: 59 (WebCore::SliderThumbElement::defaultEventHandler): Changed to use shadowHost(). 60 * rendering/RenderTextControlSingleLine.cpp: 61 (WebCore::RenderTextControlSingleLine::~RenderTextControlSingleLine): 62 Added explicit clearing of shadowHost and explicit destruction to 63 avoid out-of-order removal of children. 64 * rendering/RenderTreeAsText.cpp: 65 (WebCore::nodePosition): Simplified code. 66 * rendering/SVGShadowTreeElements.cpp: 67 (WebCore::SVGShadowTreeRootElement::SVGShadowTreeRootElement): Added 68 setting of shadowHost. 69 (WebCore::SVGShadowTreeRootElement::attachElement): Changed to use shadowHost(). 70 (WebCore::SVGShadowTreeRootElement::clearShadowHost): Added. 71 * rendering/SVGShadowTreeElements.h: Added def, removed members that are 72 no longer needed. 73 * rendering/ShadowElement.cpp: 74 (WebCore::ShadowBlockElement::initAsPart): Changed to use shadowHost(). 75 * rendering/ShadowElement.h: Removed members that are no longer needed. 76 (WebCore::ShadowElement::ShadowElement): Added setting of shadowHost. 77 (WebCore::ShadowElement::detach): Added. 78 * rendering/TextControlInnerElements.cpp: 79 (WebCore::TextControlInnerElement::TextControlInnerElement): Added setting 80 of shadowHost. 81 (WebCore::TextControlInnerElement::attachInnerElement): Changed to use 82 isShadowNode(). 83 (WebCore::TextControlInnerElement::detach): Added. 84 * rendering/TextControlInnerElements.h: Removed members that are no 85 longer needed. 86 * svg/SVGElement.cpp: 87 (WebCore::SVGElement::ownerSVGElement): Simplified code. 88 (WebCore::SVGElement::viewportElement): Ditto. 89 * svg/SVGLocatable.cpp: 90 (WebCore::SVGLocatable::computeCTM): Ditto. 91 * svg/SVGStyledElement.cpp: 92 (WebCore::SVGStyledElement::title): Ditto. 93 * svg/SVGUseElement.cpp: 94 (WebCore::ShadowTreeUpdateBlocker::while): Ditto. 95 1 96 2010-12-09 Hans Wennborg <hans@chromium.org> 2 97 -
trunk/WebCore/dom/Element.cpp
r73114 r73618 983 983 // Ref currentStyle in case it would otherwise be deleted when setRenderStyle() is called. 984 984 RefPtr<RenderStyle> currentStyle(renderStyle()); 985 bool hasParentStyle = parent Node() ? parentNode()->renderStyle() : false;985 bool hasParentStyle = parentOrHostNode() ? parentOrHostNode()->renderStyle() : false; 986 986 bool hasPositionalRules = needsStyleRecalc() && currentStyle && currentStyle->childrenAffectedByPositionalRules(); 987 987 bool hasDirectAdjacentRules = currentStyle && currentStyle->childrenAffectedByDirectAdjacentRules(); 988 989 if (!hasParentStyle && isShadowNode())990 hasParentStyle = true;991 988 992 989 if ((change > NoChange || needsStyleRecalc())) { -
trunk/WebCore/dom/Node.cpp
r73559 r73618 481 481 return new NodeRareData; 482 482 } 483 483 484 Element* Node::shadowHost() const 485 { 486 return toElement(shadowParentNode()); 487 } 488 489 void Node::setShadowHost(Element* host) 490 { 491 if (host) 492 setFlag(IsShadowRootFlag); 493 else 494 clearFlag(IsShadowRootFlag); 495 496 setParent(host); 497 } 498 484 499 short Node::tabIndex() const 485 500 { … … 667 682 bool Node::isContentEditable() const 668 683 { 669 return parent () && parent()->isContentEditable();684 return parentOrHostNode() && parentOrHostNode()->isContentEditable(); 670 685 } 671 686 672 687 bool Node::isContentRichlyEditable() const 673 688 { 674 return parent () && parent()->isContentRichlyEditable();689 return parentOrHostNode() && parentOrHostNode()->isContentRichlyEditable(); 675 690 } 676 691 … … 1268 1283 // Avoid an O(n^2) problem with this function by not checking for nextRenderer() when the parent element hasn't even 1269 1284 // been attached yet. 1270 if (parent () && !parent()->attached())1285 if (parentOrHostNode() && !parentOrHostNode()->attached()) 1271 1286 return 0; 1272 1287 … … 1395 1410 RenderStyle* Node::virtualComputedStyle(PseudoId pseudoElementSpecifier) 1396 1411 { 1397 return parent () ? parent()->computedStyle(pseudoElementSpecifier) : 0;1412 return parentOrHostNode() ? parentOrHostNode()->computedStyle(pseudoElementSpecifier) : 0; 1398 1413 } 1399 1414 … … 1418 1433 return false; 1419 1434 } 1420 return parent () ? parent()->canStartSelection() : true;1435 return parentOrHostNode() ? parentOrHostNode()->canStartSelection() : true; 1421 1436 } 1422 1437 … … 1444 1459 if (root->isShadowNode()) 1445 1460 return root; 1446 root = root->parentNode ();1461 root = root->parentNodeGuaranteedHostFree(); 1447 1462 } 1448 1463 return 0; … … 2537 2552 target = ancestor; 2538 2553 } else 2539 ancestor = ancestor->parentNode ();2554 ancestor = ancestor->parentNodeGuaranteedHostFree(); 2540 2555 2541 2556 if (!ancestor) … … 2949 2964 Node* startNode = this; 2950 2965 while (startNode && !startNode->renderer()) 2951 startNode = startNode->parent ();2966 startNode = startNode->parentOrHostNode(); 2952 2967 2953 2968 if (startNode && startNode->renderer()) -
trunk/WebCore/dom/Node.h
r73270 r73618 75 75 typedef int ExceptionCode; 76 76 77 const int nodeStyleChangeShift = 2 4;77 const int nodeStyleChangeShift = 25; 78 78 79 79 // SyntheticStyleChange means that we need to go through the entire style change logic even though … … 139 139 virtual void setNodeValue(const String&, ExceptionCode&); 140 140 virtual NodeType nodeType() const = 0; 141 ContainerNode* parentNode() const { return parent(); }141 ContainerNode* parentNode() const; 142 142 Element* parentElement() const; 143 143 Node* previousSibling() const { return m_previous; } … … 206 206 virtual bool isCharacterDataNode() const { return false; } 207 207 bool isDocumentNode() const; 208 virtual bool isShadowNode() const { return false; } 209 virtual ContainerNode* shadowParentNode() { return 0; } 208 bool isShadowNode() const { return getFlag(IsShadowRootFlag); } 209 // FIXME: Eliminate all uses, fold into shadowHost. 210 ContainerNode* shadowParentNode() const; 210 211 Node* shadowAncestorNode(); 211 212 Node* shadowTreeRootNode(); 212 213 bool isInShadowTree(); 213 214 // Node's parent or shadow tree host. 214 ContainerNode* parentOrHostNode(); 215 ContainerNode* parentOrHostNode() const; 216 // Use when it's guaranteed to that shadowParentNode is 0. 217 ContainerNode* parentNodeGuaranteedHostFree() const; 215 218 216 219 // Returns the enclosing event parent node (or self) that, when clicked, would trigger a navigation. … … 582 585 InDetachFlag = 1 << 16, 583 586 HasRareDataFlag = 1 << 17, 587 IsShadowRootFlag = 1 << 18, 584 588 585 589 // These bits are used by derived classes, pulled up here so they can 586 590 // be stored in the same memory word as the Node bits above. 587 IsParsingChildrenFinishedFlag = 1 << 1 8, // Element588 IsStyleAttributeValidFlag = 1 << 19, // StyledElement589 IsSynchronizingStyleAttributeFlag = 1 << 2 0, // StyledElement591 IsParsingChildrenFinishedFlag = 1 << 19, // Element 592 IsStyleAttributeValidFlag = 1 << 20, // StyledElement 593 IsSynchronizingStyleAttributeFlag = 1 << 21, // StyledElement 590 594 #if ENABLE(SVG) 591 AreSVGAttributesValidFlag = 1 << 21, // Element 592 IsSynchronizingSVGAttributesFlag = 1 << 22, // SVGElement 593 HasSVGRareDataFlag = 1 << 23, // SVGElement 594 #endif 595 AreSVGAttributesValidFlag = 1 << 22, // Element 596 IsSynchronizingSVGAttributesFlag = 1 << 23, // SVGElement 597 HasSVGRareDataFlag = 1 << 24, // SVGElement 598 #endif 599 595 600 StyleChangeMask = 1 << nodeStyleChangeShift | 1 << (nodeStyleChangeShift + 1), 596 601 … … 602 607 }; 603 608 604 // 5bits remaining609 // 4 bits remaining 605 610 606 611 bool getFlag(NodeFlags mask) const { return m_nodeFlags & mask; } … … 633 638 NodeRareData* ensureRareData(); 634 639 640 Element* shadowHost() const; 641 void setShadowHost(Element*); 642 635 643 private: 636 644 #if USE(JSC) … … 704 712 } 705 713 706 inline ContainerNode* Node::parent OrHostNode()714 inline ContainerNode* Node::parentNode() const 707 715 { 708 if (ContainerNode* parent = parentNode()) 709 return parent; 710 return shadowParentNode(); 716 return getFlag(IsShadowRootFlag) ? 0 : parent(); 717 } 718 719 inline ContainerNode* Node::parentOrHostNode() const 720 { 721 return parent(); 722 } 723 724 inline ContainerNode* Node::parentNodeGuaranteedHostFree() const 725 { 726 ASSERT(!getFlag(IsShadowRootFlag)); 727 return parentOrHostNode(); 728 } 729 730 inline ContainerNode* Node::shadowParentNode() const 731 { 732 return getFlag(IsShadowRootFlag) ? parent() : 0; 711 733 } 712 734 -
trunk/WebCore/editing/TextIterator.cpp
r72989 r73618 166 166 // -------- 167 167 168 static inline ContainerNode* parentCrossingShadowBoundaries(Node* node)169 {170 if (ContainerNode* parent = node->parentNode())171 return parent;172 return node->shadowParentNode();173 }174 175 168 #if !ASSERT_DISABLED 176 169 … … 178 171 { 179 172 unsigned depth = 0; 180 for (Node* parent = parentCrossingShadowBoundaries(node); parent; parent = parentCrossingShadowBoundaries(parent))173 for (Node* parent = node->parentOrHostNode(); parent; parent = parent->parentOrHostNode()) 181 174 ++depth; 182 175 return depth; … … 194 187 return next; 195 188 } 196 for (Node* node = rangeEndContainer; node; node = parentCrossingShadowBoundaries(node)) {189 for (Node* node = rangeEndContainer; node; node = node->parentOrHostNode()) { 197 190 if (Node* next = node->nextSibling()) 198 191 return next; … … 209 202 return previous; 210 203 } 211 for (Node* node = rangeStartContainer; node; node = parentCrossingShadowBoundaries(node)) {204 for (Node* node = rangeStartContainer; node; node = node->parentOrHostNode()) { 212 205 if (Node* previous = node->previousSibling()) 213 206 return previous; … … 248 241 // Put the nodes in a vector so we can iterate in reverse order. 249 242 Vector<Node*, 100> ancestry; 250 for (Node* parent = parentCrossingShadowBoundaries(node); parent; parent = parentCrossingShadowBoundaries(parent))243 for (Node* parent = node->parentOrHostNode(); parent; parent = parent->parentOrHostNode()) 251 244 ancestry.append(parent); 252 245 … … 428 421 if (!next) { 429 422 bool pastEnd = m_node->traverseNextNode() == m_pastEndNode; 430 Node* parentNode = parentCrossingShadowBoundaries(m_node);423 Node* parentNode = m_node->parentOrHostNode(); 431 424 while (!next && parentNode) { 432 425 if ((pastEnd && parentNode == m_endContainer) || m_endContainer->isDescendantOf(parentNode)) … … 435 428 m_node = parentNode; 436 429 m_fullyClippedStack.pop(); 437 parentNode = parentCrossingShadowBoundaries(m_node);430 parentNode = m_node->parentOrHostNode(); 438 431 if (haveRenderer) 439 432 exitNode(); … … 1149 1142 // Exit all other containers. 1150 1143 while (!m_node->previousSibling()) { 1151 if (!setCurrentNode( parentCrossingShadowBoundaries(m_node)))1144 if (!setCurrentNode(m_node->parentOrHostNode())) 1152 1145 break; 1153 1146 m_fullyClippedStack.pop(); -
trunk/WebCore/page/DOMSelection.cpp
r69868 r73618 101 101 return 0; 102 102 if (Node* shadowAncestor = selectionShadowAncestor(m_frame)) 103 return shadowAncestor->parentNode ();103 return shadowAncestor->parentNodeGuaranteedHostFree(); 104 104 return anchorPosition(visibleSelection()).node(); 105 105 } … … 119 119 return 0; 120 120 if (Node* shadowAncestor = selectionShadowAncestor(m_frame)) 121 return shadowAncestor->parentNode ();121 return shadowAncestor->parentNodeGuaranteedHostFree(); 122 122 return focusPosition(visibleSelection()).node(); 123 123 } … … 137 137 return 0; 138 138 if (Node* shadowAncestor = selectionShadowAncestor(m_frame)) 139 return shadowAncestor->parentNode ();139 return shadowAncestor->parentNodeGuaranteedHostFree(); 140 140 return basePosition(visibleSelection()).node(); 141 141 } … … 155 155 return 0; 156 156 if (Node* shadowAncestor = selectionShadowAncestor(m_frame)) 157 return shadowAncestor->parentNode ();157 return shadowAncestor->parentNodeGuaranteedHostFree(); 158 158 return extentPosition(visibleSelection()).node(); 159 159 } … … 371 371 372 372 if (Node* shadowAncestor = selectionShadowAncestor(m_frame)) { 373 ContainerNode* container = shadowAncestor->parentNode ();373 ContainerNode* container = shadowAncestor->parentNodeGuaranteedHostFree(); 374 374 int offset = shadowAncestor->nodeIndex(); 375 375 return Range::create(shadowAncestor->document(), container, offset, container, offset); -
trunk/WebCore/rendering/MediaControlElements.cpp
r72259 r73618 66 66 inline MediaControlShadowRootElement::MediaControlShadowRootElement(HTMLMediaElement* mediaElement) 67 67 : HTMLDivElement(divTag, mediaElement->document()) 68 , m_mediaElement(mediaElement) 69 { 68 { 69 setShadowHost(mediaElement); 70 70 } 71 71 … … 92 92 { 93 93 if (renderer()) { 94 RenderStyle* timelineContainerStyle = m_mediaElement->renderer()->getCachedPseudoStyle(MEDIA_CONTROLS_TIMELINE_CONTAINER);94 RenderStyle* timelineContainerStyle = shadowHost()->renderer()->getCachedPseudoStyle(MEDIA_CONTROLS_TIMELINE_CONTAINER); 95 95 renderer()->setStyle(timelineContainerStyle); 96 96 } 97 } 98 99 void MediaControlShadowRootElement::detach() 100 { 101 HTMLDivElement::detach(); 102 // FIXME: Remove once shadow DOM uses Element::setShadowRoot(). 103 setShadowHost(0); 97 104 } 98 105 -
trunk/WebCore/rendering/MediaControlElements.h
r68126 r73618 77 77 78 78 void updateStyle(); 79 virtual void detach(); 79 80 80 81 private: 81 82 MediaControlShadowRootElement(HTMLMediaElement*); 82 83 virtual bool isShadowNode() const { return true; }84 virtual ContainerNode* shadowParentNode() { return m_mediaElement; }85 86 HTMLMediaElement* m_mediaElement;87 83 }; 88 84 -
trunk/WebCore/rendering/RenderSVGShadowTreeRootContainer.cpp
r66498 r73618 37 37 RenderSVGShadowTreeRootContainer::~RenderSVGShadowTreeRootContainer() 38 38 { 39 if (m_shadowRoot && m_shadowRoot->attached()) 39 if (m_shadowRoot && m_shadowRoot->attached()) { 40 40 m_shadowRoot->detach(); 41 m_shadowRoot->clearShadowHost(); 42 } 41 43 } 42 44 -
trunk/WebCore/rendering/RenderSlider.cpp
r73023 r73618 107 107 108 108 m_inDragMode = true; 109 document()->frame()->eventHandler()->setCapturingMouseEventsNode(shadow Parent());109 document()->frame()->eventHandler()->setCapturingMouseEventsNode(shadowHost()); 110 110 event->setDefaultHandled(); 111 111 return; -
trunk/WebCore/rendering/RenderTextControlSingleLine.cpp
r73572 r73618 68 68 } 69 69 70 if (m_innerBlock) 70 if (m_innerBlock) { 71 71 m_innerBlock->detach(); 72 m_innerBlock = 0; 73 } 72 74 73 75 if (m_innerSpinButton) -
trunk/WebCore/rendering/RenderTreeAsText.cpp
r73385 r73618 686 686 Node* parent; 687 687 for (Node* n = node; n; n = parent) { 688 parent = n->parentNode(); 689 if (!parent) 690 parent = n->shadowParentNode(); 688 parent = n->parentOrHostNode(); 691 689 if (n != node) 692 690 result += " of "; -
trunk/WebCore/rendering/SVGShadowTreeElements.cpp
r66498 r73618 52 52 inline SVGShadowTreeRootElement::SVGShadowTreeRootElement(Document* document, SVGUseElement* shadowParent) 53 53 : SVGShadowTreeContainerElement(document) 54 , m_shadowParent(shadowParent)55 54 { 55 setShadowHost(shadowParent); 56 56 setInDocument(); 57 57 } … … 64 64 void SVGShadowTreeRootElement::attachElement(PassRefPtr<RenderStyle> style, RenderArena* arena) 65 65 { 66 ASSERT( m_shadowParent);66 ASSERT(shadowHost()); 67 67 68 68 // Create the renderer with the specified style … … 78 78 // Add the renderer to the render tree 79 79 if (renderer) 80 m_shadowParent->renderer()->addChild(renderer); 80 shadowHost()->renderer()->addChild(renderer); 81 } 82 83 void SVGShadowTreeRootElement::clearShadowHost() 84 { 85 setShadowHost(0); 81 86 } 82 87 -
trunk/WebCore/rendering/SVGShadowTreeElements.h
r66498 r73618 56 56 57 57 void attachElement(PassRefPtr<RenderStyle>, RenderArena*); 58 59 virtual ContainerNode* shadowParentNode() { return m_shadowParent; } 58 void clearShadowHost(); 60 59 61 60 private: 62 61 SVGShadowTreeRootElement(Document*, SVGUseElement* shadowParent); 63 64 virtual bool isShadowNode() const { return m_shadowParent; }65 66 ContainerNode* m_shadowParent;67 62 }; 68 63 -
trunk/WebCore/rendering/ShadowElement.cpp
r73488 r73618 76 76 void ShadowBlockElement::initAsPart(PseudoId pseudoId) 77 77 { 78 RenderObject* parentRenderer = shadow Parent()->renderer();78 RenderObject* parentRenderer = shadowHost()->renderer(); 79 79 RefPtr<RenderStyle> styleForPart = createStyleForPart(parentRenderer, pseudoId); 80 80 setRenderer(createRenderer(parentRenderer->renderArena(), styleForPart.get())); -
trunk/WebCore/rendering/ShadowElement.h
r73488 r73618 42 42 , m_shadowParent(shadowParent) 43 43 { 44 BaseElement::setShadowHost(shadowParent); 44 45 } 45 46 46 HTMLElement* shadowParent() const { return m_shadowParent.get(); } 47 public: 48 virtual void detach(); 47 49 48 50 private: 49 virtual bool isShadowNode() const { return true; }50 virtual ContainerNode* shadowParentNode() { return m_shadowParent.get(); }51 52 51 RefPtr<HTMLElement> m_shadowParent; 53 52 }; 53 54 template<class BaseElement> 55 void ShadowElement<BaseElement>::detach() 56 { 57 BaseElement::detach(); 58 // FIXME: Remove once shadow DOM uses Element::setShadowRoot(). 59 BaseElement::setShadowHost(0); 60 } 54 61 55 62 class ShadowBlockElement : public ShadowElement<HTMLDivElement> { -
trunk/WebCore/rendering/TextControlInnerElements.cpp
r72807 r73618 80 80 , m_shadowParent(shadowParent) 81 81 { 82 setShadowHost(shadowParent); 82 83 } 83 84 … … 103 104 setInDocument(); 104 105 105 // For elements without a shadow parent, add the node to the DOM normally.106 if (! m_shadowParent) {106 // For elements not yet in shadow DOM, add the node to the DOM normally. 107 if (!isShadowNode()) { 107 108 // FIXME: This code seems very wrong. Why are we magically adding |this| to the DOM here? 108 109 // We shouldn't be calling parser API methods outside of the parser! … … 113 114 if (renderer) 114 115 parent->renderer()->addChild(renderer); 116 } 117 118 void TextControlInnerElement::detach() 119 { 120 HTMLDivElement::detach(); 121 // FIXME: Remove once shadow DOM uses Element::setShadowRoot(). 122 setShadowHost(0); 115 123 } 116 124 -
trunk/WebCore/rendering/TextControlInnerElements.h
r72782 r73618 40 40 public: 41 41 static PassRefPtr<TextControlInnerElement> create(HTMLElement* shadowParent); 42 virtual void detach(); 42 43 43 44 void attachInnerElement(Node*, PassRefPtr<RenderStyle>, RenderArena*); … … 47 48 48 49 private: 49 virtual bool isMouseFocusable() const { return false; } 50 virtual bool isShadowNode() const { return m_shadowParent.get(); } 51 virtual ContainerNode* shadowParentNode() { return m_shadowParent.get(); } 52 void setShadowParentNode(HTMLElement* shadowParent) { m_shadowParent = shadowParent; } 50 virtual bool isMouseFocusable() const { return false; } 53 51 54 52 RefPtr<HTMLElement> m_shadowParent; -
trunk/WebCore/svg/SVGElement.cpp
r73432 r73618 119 119 SVGSVGElement* SVGElement::ownerSVGElement() const 120 120 { 121 ContainerNode* n = isShadowNode() ? const_cast<SVGElement*>(this)->shadowParentNode() : parentNode();121 ContainerNode* n = parentOrHostNode(); 122 122 while (n) { 123 123 if (n->hasTagName(SVGNames::svgTag)) 124 124 return static_cast<SVGSVGElement*>(n); 125 125 126 n = n-> isShadowNode() ? n->shadowParentNode() : n->parentNode();126 n = n->parentOrHostNode(); 127 127 } 128 128 … … 134 134 // This function needs shadow tree support - as RenderSVGContainer uses this function 135 135 // to determine the "overflow" property. <use> on <symbol> wouldn't work otherwhise. 136 ContainerNode* n = isShadowNode() ? const_cast<SVGElement*>(this)->shadowParentNode() : parentNode();136 ContainerNode* n = parentOrHostNode(); 137 137 while (n) { 138 138 if (n->hasTagName(SVGNames::svgTag) || n->hasTagName(SVGNames::imageTag) || n->hasTagName(SVGNames::symbolTag)) 139 139 return static_cast<SVGElement*>(n); 140 140 141 n = n-> isShadowNode() ? n->shadowParentNode() : n->parentNode();141 n = n->parentOrHostNode(); 142 142 } 143 143 -
trunk/WebCore/svg/SVGLocatable.cpp
r71103 r73618 98 98 break; 99 99 100 current = current-> isShadowNode() ? current->shadowParentNode() : current->parentNode();100 current = current->parentOrHostNode(); 101 101 } 102 102 -
trunk/WebCore/svg/SVGStyledElement.cpp
r73130 r73618 82 82 while (parent) { 83 83 if (!parent->isShadowNode()) { 84 parent = parent->parentNode ();84 parent = parent->parentNodeGuaranteedHostFree(); 85 85 continue; 86 86 } -
trunk/WebCore/svg/SVGUseElement.cpp
r73258 r73618 497 497 return; 498 498 499 parent = parent->parentNode ();499 parent = parent->parentNodeGuaranteedHostFree(); 500 500 } 501 501
Note: See TracChangeset
for help on using the changeset viewer.