Changeset 85617 in webkit
- Timestamp:
- May 3, 2011 10:17:44 AM (13 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 25 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r85616 r85617 1 2011-05-02 Roland Steiner <rolandsteiner@chromium.org> 2 3 Reviewed by Dimitri Glazkov. 4 5 Bug 59966 - Update ID hash on the containing TreeScope rather than the Document 6 https://bugs.webkit.org/show_bug.cgi?id=59966 7 8 No new tests. (refactoring) 9 10 * accessibility/AccessibilityRenderObject.cpp: 11 (WebCore::AccessibilityRenderObject::elementsFromAttribute): 12 (WebCore::AccessibilityRenderObject::activeDescendant): 13 * accessibility/AccessibilityRenderObject.h: 14 (WebCore::AccessibilityRenderObject::isAccessibilityRenderObject): 15 * css/CSSCursorImageValue.cpp: 16 (WebCore::resourceReferencedByCursorElement): 17 (WebCore::CSSCursorImageValue::~CSSCursorImageValue): 18 (WebCore::CSSCursorImageValue::updateIfSVGCursorIsUsed): 19 (WebCore::CSSCursorImageValue::cachedImage): 20 * dom/DynamicNodeList.cpp: 21 (WebCore::DynamicNodeList::itemWithName): 22 * dom/Element.h: 23 (WebCore::Element::updateId): 24 * dom/Node.cpp: 25 (WebCore::Node::querySelector): 26 * html/FormAssociatedElement.cpp: 27 (WebCore::FormAssociatedElement::insertedIntoTree): 28 (WebCore::FormAssociatedElement::resetFormOwner): 29 * html/HTMLInputElement.cpp: 30 (WebCore::HTMLInputElement::dataList): 31 * html/HTMLLabelElement.cpp: 32 (WebCore::HTMLLabelElement::control): 33 * rendering/svg/RenderSVGTextPath.cpp: 34 (WebCore::RenderSVGTextPath::layoutPath): 35 * svg/SVGAElement.cpp: 36 (WebCore::SVGAElement::defaultEventHandler): 37 * svg/SVGAltGlyphElement.cpp: 38 (WebCore::SVGAltGlyphElement::glyphElement): 39 * svg/SVGFEImageElement.cpp: 40 (WebCore::SVGFEImageElement::requestImageResource): 41 (WebCore::SVGFEImageElement::build): 42 * svg/SVGLinearGradientElement.cpp: 43 (WebCore::SVGLinearGradientElement::collectGradientAttributes): 44 * svg/SVGMPathElement.cpp: 45 (WebCore::SVGMPathElement::pathElement): 46 * svg/SVGPatternElement.cpp: 47 (WebCore::SVGPatternElement::collectPatternAttributes): 48 * svg/SVGRadialGradientElement.cpp: 49 (WebCore::SVGRadialGradientElement::collectGradientAttributes): 50 * svg/SVGSVGElement.cpp: 51 (WebCore::SVGSVGElement::getElementById): 52 * svg/SVGTRefElement.cpp: 53 (WebCore::SVGTRefElement::updateReferencedText): 54 * svg/SVGTextPathElement.cpp: 55 (WebCore::SVGTextPathElement::insertedIntoDocument): 56 * svg/SVGUseElement.cpp: 57 (WebCore::SVGUseElement::buildPendingResource): 58 (WebCore::SVGUseElement::hasCycleUseReferencing): 59 (WebCore::SVGUseElement::expandUseElementsInShadowTree): 60 * svg/SVGViewSpec.cpp: 61 (WebCore::SVGViewSpec::viewTarget): 62 * svg/animation/SVGSMILElement.cpp: 63 (WebCore::SVGSMILElement::eventBaseFor): 64 (WebCore::SVGSMILElement::connectConditions): 65 (WebCore::SVGSMILElement::targetElement): 66 * xml/XPathFunctions.cpp: 67 (WebCore::XPath::FunId::evaluate): 68 1 69 2011-05-03 Sam Weinig <sam@webkit.org> 2 70 -
trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp
r85414 r85617 1214 1214 return; 1215 1215 1216 Document* document = m_renderer->document();1217 if (! document)1216 TreeScope* scope = node->treeScope(); 1217 if (!scope) 1218 1218 return; 1219 1219 … … 1229 1229 for (unsigned i = 0; i < size; ++i) { 1230 1230 String idName = idVector[i]; 1231 Element* idElement = document->getElementById(idName);1231 Element* idElement = scope->getElementById(idName); 1232 1232 if (idElement) 1233 1233 elements.append(idElement); … … 2838 2838 return 0; 2839 2839 2840 Element* target = document()->getElementById(activeDescendantAttrStr);2840 Element* target = element->treeScope()->getElementById(activeDescendantAttrStr); 2841 2841 if (!target) 2842 2842 return 0; -
trunk/Source/WebCore/accessibility/AccessibilityRenderObject.h
r84600 r85617 63 63 virtual ~AccessibilityRenderObject(); 64 64 65 bool isAccessibilityRenderObject() const { return true; }65 virtual bool isAccessibilityRenderObject() const { return true; } 66 66 67 67 virtual bool isAnchor() const; -
trunk/Source/WebCore/css/CSSCursorImageValue.cpp
r74574 r85617 24 24 25 25 #include "CachedResourceLoader.h" 26 #include " Document.h"26 #include "TreeScope.h" 27 27 #include "PlatformString.h" 28 28 #include <wtf/MathExtras.h> … … 44 44 } 45 45 46 static inline SVGCursorElement* resourceReferencedByCursorElement(const String& fragmentId, Document* document)46 static inline SVGCursorElement* resourceReferencedByCursorElement(const String& fragmentId, TreeScope* scope) 47 47 { 48 Element* element = document->getElementById(SVGURIReference::getTarget(fragmentId));48 Element* element = scope->getElementById(SVGURIReference::getTarget(fragmentId)); 49 49 if (element && element->hasTagName(SVGNames::cursorTag)) 50 50 return static_cast<SVGCursorElement*>(element); … … 73 73 SVGElement* referencedElement = *it; 74 74 referencedElement->cursorImageValueRemoved(); 75 if (SVGCursorElement* cursorElement = resourceReferencedByCursorElement(url, referencedElement-> document()))75 if (SVGCursorElement* cursorElement = resourceReferencedByCursorElement(url, referencedElement->treeScope())) 76 76 cursorElement->removeClient(referencedElement); 77 77 } … … 91 91 return false; 92 92 93 if (SVGCursorElement* cursorElement = resourceReferencedByCursorElement(url, element-> document())) {93 if (SVGCursorElement* cursorElement = resourceReferencedByCursorElement(url, element->treeScope())) { 94 94 // FIXME: This will override hot spot specified in CSS, which is probably incorrect. 95 95 float x = roundf(cursorElement->x().value(0)); … … 119 119 #if ENABLE(SVG) 120 120 if (isSVGCursorIdentifier(url) && loader && loader->document()) { 121 // FIXME: This will fail if the <cursor> element is in a shadow DOM (bug 59827) 121 122 if (SVGCursorElement* cursorElement = resourceReferencedByCursorElement(url, loader->document())) 122 123 url = cursorElement->href(); -
trunk/Source/WebCore/dom/DynamicNodeList.cpp
r84309 r85617 123 123 { 124 124 if (m_rootNode->isDocumentNode() || m_rootNode->inDocument()) { 125 Element* node = m_rootNode-> document()->getElementById(elementId);125 Element* node = m_rootNode->treeScope()->getElementById(elementId); 126 126 if (node && nodeMatches(node)) { 127 127 for (ContainerNode* p = node->parentNode(); p; p = p->parentNode()) { -
trunk/Source/WebCore/dom/Element.h
r84706 r85617 485 485 return; 486 486 487 Document* doc = document();487 TreeScope* scope = treeScope(); 488 488 if (!oldId.isEmpty()) 489 doc->removeElementById(oldId, this);489 scope->removeElementById(oldId, this); 490 490 if (!newId.isEmpty()) 491 doc->addElementById(newId, this);491 scope->addElementById(newId, this); 492 492 } 493 493 -
trunk/Source/WebCore/dom/Node.cpp
r85572 r85617 1882 1882 // FIXME: we could also optimize for the the [id="foo"] case 1883 1883 if (strictParsing && inDocument() && querySelectorList.hasOneSelector() && querySelectorList.first()->m_match == CSSSelector::Id) { 1884 Element* element = document()->getElementById(querySelectorList.first()->value());1884 Element* element = treeScope()->getElementById(querySelectorList.first()->value()); 1885 1885 if (element && (isDocumentNode() || element->isDescendantOf(this)) && selectorChecker.checkSelector(querySelectorList.first(), element)) 1886 1886 return element; -
trunk/Source/WebCore/html/FormAssociatedElement.cpp
r80797 r85617 78 78 HTMLElement* element = toHTMLElement(this); 79 79 if (element->fastHasAttribute(formAttr)) { 80 Element* formElement = element-> document()->getElementById(element->fastGetAttribute(formAttr));80 Element* formElement = element->treeScope()->getElementById(element->fastGetAttribute(formAttr)); 81 81 if (formElement && formElement->hasTagName(formTag)) { 82 82 if (m_form) … … 137 137 // the first element in the document to have an ID that equal to 138 138 // the value of form attribute, so we put the result of 139 // document()->getElementById() over the given element.140 Element* firstElement = element-> document()->getElementById(formId);139 // treeScope()->getElementById() over the given element. 140 Element* firstElement = element->treeScope()->getElementById(formId); 141 141 if (firstElement && firstElement->hasTagName(formTag)) 142 142 m_form = static_cast<HTMLFormElement*>(firstElement); -
trunk/Source/WebCore/html/HTMLInputElement.cpp
r84695 r85617 1292 1292 return 0; 1293 1293 1294 Element* element = document()->getElementById(fastGetAttribute(listAttr));1294 Element* element = treeScope()->getElementById(fastGetAttribute(listAttr)); 1295 1295 if (!element) 1296 1296 return 0; -
trunk/Source/WebCore/html/HTMLLabelElement.cpp
r73270 r85617 82 82 // Find the first element whose id is controlId. If it is found and it is a labelable form control, 83 83 // return it, otherwise return 0. 84 return nodeAsLabelableFormControl( document()->getElementById(controlId));84 return nodeAsLabelableFormControl(treeScope()->getElementById(controlId)); 85 85 } 86 86 -
trunk/Source/WebCore/rendering/svg/RenderSVGTextPath.cpp
r75325 r85617 46 46 SVGTextPathElement* textPathElement = static_cast<SVGTextPathElement*>(node()); 47 47 String pathId = SVGURIReference::getTarget(textPathElement->href()); 48 Element* targetElement = textPathElement-> document()->getElementById(pathId);48 Element* targetElement = textPathElement->treeScope()->getElementById(pathId); 49 49 if (!targetElement || !targetElement->hasTagName(SVGNames::pathTag)) 50 50 return Path(); -
trunk/Source/WebCore/svg/SVGAElement.cpp
r81965 r85617 165 165 #if ENABLE(SVG_ANIMATION) 166 166 if (url[0] == '#') { 167 Element* targetElement = document()->getElementById(url.substring(1));167 Element* targetElement = treeScope()->getElementById(url.substring(1)); 168 168 if (SVGSMILElement::isSMILElement(targetElement)) { 169 169 static_cast<SVGSMILElement*>(targetElement)->beginByLinkActivation(); -
trunk/Source/WebCore/svg/SVGAltGlyphElement.cpp
r78345 r85617 103 103 SVGGlyphElement* SVGAltGlyphElement::glyphElement() const 104 104 { 105 Element* elt = document()->getElementById(getTarget(getAttribute(XLinkNames::hrefAttr)));105 Element* elt = treeScope()->getElementById(getTarget(getAttribute(XLinkNames::hrefAttr))); 106 106 if (!elt || !elt->hasTagName(SVGNames::glyphTag)) 107 107 return 0; -
trunk/Source/WebCore/svg/SVGFEImageElement.cpp
r78345 r85617 67 67 } 68 68 69 Element* hrefElement = document()->getElementById(SVGURIReference::getTarget(href()));69 Element* hrefElement = treeScope()->getElementById(SVGURIReference::getTarget(href())); 70 70 if (hrefElement && hrefElement->isSVGElement() && hrefElement->renderer()) 71 71 return; … … 155 155 { 156 156 if (!m_cachedImage && !m_targetImage) { 157 Element* hrefElement = document()->getElementById(SVGURIReference::getTarget(href()));157 Element* hrefElement = treeScope()->getElementById(SVGURIReference::getTarget(href())); 158 158 if (!hrefElement || !hrefElement->isSVGElement()) 159 159 return 0; -
trunk/Source/WebCore/svg/SVGLinearGradientElement.cpp
r78345 r85617 182 182 183 183 // Respect xlink:href, take attributes from referenced element 184 Node* refNode = ownerDocument()->getElementById(SVGURIReference::getTarget(current->href()));184 Node* refNode = treeScope()->getElementById(SVGURIReference::getTarget(current->href())); 185 185 if (refNode && (refNode->hasTagName(SVGNames::linearGradientTag) || refNode->hasTagName(SVGNames::radialGradientTag))) { 186 186 current = static_cast<SVGGradientElement*>(refNode); -
trunk/Source/WebCore/svg/SVGMPathElement.cpp
r78249 r85617 79 79 SVGPathElement* SVGMPathElement::pathElement() 80 80 { 81 Element* target = document()->getElementById(getTarget(href()));81 Element* target = treeScope()->getElementById(getTarget(href())); 82 82 if (target && target->hasTagName(SVGNames::pathTag)) 83 83 return static_cast<SVGPathElement*>(target); -
trunk/Source/WebCore/svg/SVGPatternElement.cpp
r78345 r85617 276 276 277 277 // Respect xlink:href, take attributes from referenced element 278 Node* refNode = ownerDocument()->getElementById(SVGURIReference::getTarget(current->href()));278 Node* refNode = treeScope()->getElementById(SVGURIReference::getTarget(current->href())); 279 279 if (refNode && refNode->hasTagName(SVGNames::patternTag)) { 280 280 current = static_cast<const SVGPatternElement*>(const_cast<const Node*>(refNode)); -
trunk/Source/WebCore/svg/SVGRadialGradientElement.cpp
r78345 r85617 196 196 197 197 // Respect xlink:href, take attributes from referenced element 198 Node* refNode = ownerDocument()->getElementById(SVGURIReference::getTarget(current->href()));198 Node* refNode = treeScope()->getElementById(SVGURIReference::getTarget(current->href())); 199 199 if (refNode && (refNode->hasTagName(SVGNames::radialGradientTag) || refNode->hasTagName(SVGNames::linearGradientTag))) { 200 200 current = static_cast<SVGGradientElement*>(refNode); -
trunk/Source/WebCore/svg/SVGSVGElement.cpp
r84851 r85617 642 642 Element* SVGSVGElement::getElementById(const AtomicString& id) const 643 643 { 644 Element* element = document()->getElementById(id);644 Element* element = treeScope()->getElementById(id); 645 645 if (element && element->isDescendantOf(this)) 646 646 return element; -
trunk/Source/WebCore/svg/SVGTRefElement.cpp
r78345 r85617 48 48 void SVGTRefElement::updateReferencedText() 49 49 { 50 Element* target = document()->getElementById(SVGURIReference::getTarget(href()));50 Element* target = treeScope()->getElementById(SVGURIReference::getTarget(href())); 51 51 String textContent; 52 52 if (target && target->isSVGElement()) -
trunk/Source/WebCore/svg/SVGTextPathElement.cpp
r83710 r85617 158 158 159 159 String id = SVGURIReference::getTarget(href()); 160 Element* targetElement = ownerDocument()->getElementById(id);160 Element* targetElement = treeScope()->getElementById(id); 161 161 if (!targetElement) { 162 162 document()->accessSVGExtensions()->addPendingResource(id, this); -
trunk/Source/WebCore/svg/SVGUseElement.cpp
r85413 r85617 474 474 // Once the pending resource appears, it will call buildPendingResource(), so we're called a second time. 475 475 String id = SVGURIReference::getTarget(href()); 476 Element* targetElement = document()->getElementById(id);476 Element* targetElement = treeScope()->getElementById(id); 477 477 ASSERT(!m_targetElementInstance); 478 478 … … 519 519 520 520 String id = SVGURIReference::getTarget(href()); 521 Element* targetElement = document()->getElementById(id);521 Element* targetElement = treeScope()->getElementById(id); 522 522 if (!targetElement) { 523 523 // The only time we should get here is when the use element has not been … … 770 770 { 771 771 String id = SVGURIReference::getTarget(use->href()); 772 Element* targetElement = document()->getElementById(id);772 Element* targetElement = treeScope()->getElementById(id); 773 773 newTarget = 0; 774 774 if (targetElement && targetElement->isSVGElement()) … … 851 851 852 852 String id = SVGURIReference::getTarget(use->href()); 853 Element* targetElement = document()->getElementById(id);853 Element* targetElement = treeScope()->getElementById(id); 854 854 SVGElement* target = 0; 855 855 if (targetElement && targetElement->isSVGElement()) -
trunk/Source/WebCore/svg/SVGViewSpec.cpp
r74782 r85617 67 67 SVGElement* SVGViewSpec::viewTarget() const 68 68 { 69 return static_cast<SVGElement*>(m_contextElement-> document()->getElementById(m_viewTargetString));69 return static_cast<SVGElement*>(m_contextElement->treeScope()->getElementById(m_viewTargetString)); 70 70 } 71 71 -
trunk/Source/WebCore/svg/animation/SVGSMILElement.cpp
r84729 r85617 426 426 inline Element* SVGSMILElement::eventBaseFor(const Condition& condition) const 427 427 { 428 return condition.m_baseID.isEmpty() ? targetElement() : document()->getElementById(condition.m_baseID);428 return condition.m_baseID.isEmpty() ? targetElement() : treeScope()->getElementById(condition.m_baseID); 429 429 } 430 430 … … 446 446 } else if (condition.m_type == Condition::Syncbase) { 447 447 ASSERT(!condition.m_baseID.isEmpty()); 448 condition.m_syncbase = document()->getElementById(condition.m_baseID);448 condition.m_syncbase = treeScope()->getElementById(condition.m_baseID); 449 449 if (!isSMILElement(condition.m_syncbase.get())) { 450 450 condition.m_syncbase = 0; … … 500 500 501 501 String href = xlinkHref(); 502 ContainerNode* target = href.isEmpty() ? parentNode() : document()->getElementById(SVGURIReference::getTarget(href));502 ContainerNode* target = href.isEmpty() ? parentNode() : treeScope()->getElementById(SVGURIReference::getTarget(href)); 503 503 if (!target || !target->isSVGElement()) 504 504 return 0; -
trunk/Source/WebCore/xml/XPathFunctions.cpp
r72500 r85617 31 31 #if ENABLE(XPATH) 32 32 33 #include "Document.h"34 33 #include "Element.h" 35 34 #include "NamedNodeMap.h" 36 35 #include "ProcessingInstruction.h" 36 #include "TreeScope.h" 37 37 #include "XMLNames.h" 38 38 #include "XPathUtil.h" … … 333 333 } 334 334 335 Document* contextDocument = evaluationContext().node->document();335 TreeScope* contextScope = evaluationContext().node->treeScope(); 336 336 NodeSet result; 337 337 HashSet<Node*> resultSet; … … 352 352 // If there are several nodes with the same id, id() should return the first one. 353 353 // In WebKit, getElementById behaves so, too, although its behavior in this case is formally undefined. 354 Node* node = context Document->getElementById(String(&idList[startPos], endPos - startPos));354 Node* node = contextScope->getElementById(String(&idList[startPos], endPos - startPos)); 355 355 if (node && resultSet.add(node).second) 356 356 result.append(node);
Note: See TracChangeset
for help on using the changeset viewer.