diff options
| author | Simon Hausmann <simon.hausmann@digia.com> | 2012-10-23 10:25:11 +0200 |
|---|---|---|
| committer | Simon Hausmann <simon.hausmann@digia.com> | 2012-10-23 10:25:11 +0200 |
| commit | 5ea819f80c6840c492386bfafbffb059c7e2091f (patch) | |
| tree | 42ad0b1d82eff090d14278a088ea0f4840a0f938 /Source/WebCore/dom | |
| parent | 43a42f108af6bcbd91f2672731c3047c26213af1 (diff) | |
| download | qtwebkit-5ea819f80c6840c492386bfafbffb059c7e2091f.tar.gz | |
Imported WebKit commit 20434eb8eb95065803473139d8794e98a7672f75 (http://svn.webkit.org/repository/webkit/trunk@132191)
New snapshot that should fix build with latest qtbase and the QPlastiqueStyle removal
Diffstat (limited to 'Source/WebCore/dom')
| -rw-r--r-- | Source/WebCore/dom/Attr.cpp | 4 | ||||
| -rw-r--r-- | Source/WebCore/dom/ComposedShadowTreeWalker.cpp | 16 | ||||
| -rw-r--r-- | Source/WebCore/dom/ContainerNode.h | 6 | ||||
| -rw-r--r-- | Source/WebCore/dom/Element.cpp | 65 | ||||
| -rw-r--r-- | Source/WebCore/dom/Element.h | 6 | ||||
| -rw-r--r-- | Source/WebCore/dom/ElementAttributeData.cpp | 2 | ||||
| -rw-r--r-- | Source/WebCore/dom/ProcessingInstruction.cpp | 6 | ||||
| -rw-r--r-- | Source/WebCore/dom/ScriptElement.cpp | 8 | ||||
| -rw-r--r-- | Source/WebCore/dom/ShadowRoot.cpp | 24 | ||||
| -rw-r--r-- | Source/WebCore/dom/StyledElement.cpp | 6 | ||||
| -rw-r--r-- | Source/WebCore/dom/StyledElement.h | 2 | ||||
| -rw-r--r-- | Source/WebCore/dom/ViewportArguments.cpp | 3 |
12 files changed, 89 insertions, 59 deletions
diff --git a/Source/WebCore/dom/Attr.cpp b/Source/WebCore/dom/Attr.cpp index 95c3fe052..57efe2982 100644 --- a/Source/WebCore/dom/Attr.cpp +++ b/Source/WebCore/dom/Attr.cpp @@ -130,7 +130,7 @@ void Attr::setValue(const AtomicString& value, ExceptionCode&) setValue(value); if (m_element) - m_element->didModifyAttribute(elementAttribute()); + m_element->didModifyAttribute(qualifiedName(), value); } void Attr::setNodeValue(const String& v, ExceptionCode& ec) @@ -182,7 +182,7 @@ void Attr::childrenChanged(bool, Node*, Node*, int) m_standaloneValue = newValue; if (m_element) - m_element->attributeChanged(elementAttribute()); + m_element->attributeChanged(qualifiedName(), newValue); } bool Attr::isId() const diff --git a/Source/WebCore/dom/ComposedShadowTreeWalker.cpp b/Source/WebCore/dom/ComposedShadowTreeWalker.cpp index 8b0ec7e24..e88230e64 100644 --- a/Source/WebCore/dom/ComposedShadowTreeWalker.cpp +++ b/Source/WebCore/dom/ComposedShadowTreeWalker.cpp @@ -30,6 +30,7 @@ #include "ContentDistributor.h" #include "Element.h" #include "ElementShadow.h" +#include "HTMLContentElement.h" #include "InsertionPoint.h" namespace WebCore { @@ -51,11 +52,22 @@ static inline ElementShadow* shadowOfParent(const Node* node) return 0; } +static inline ElementShadow* shadowOfParentForDistribution(const Node* node) +{ + if (!node) + return 0; + + if (Element* parent = parentElementForDistribution(node)) + return parent->shadow(); + + return 0; +} + static inline InsertionPoint* resolveReprojection(const Node* node) { InsertionPoint* insertionPoint = 0; const Node* current = node; - while (ElementShadow* shadow = shadowOfParent(current)) { + while (ElementShadow* shadow = shadowOfParentForDistribution(current)) { shadow->ensureDistribution(); if (InsertionPoint* insertedTo = shadow->insertionPointFor(node)) { current = insertedTo; @@ -260,7 +272,7 @@ Node* ComposedShadowTreeWalker::traverseParent(const Node* node, ParentTraversal ASSERT(toShadowRoot(node)->isYoungest()); return 0; } - if (ElementShadow* shadow = shadowOfParent(node)) { + if (ElementShadow* shadow = shadowOfParentForDistribution(node)) { shadow->ensureDistribution(); if (InsertionPoint* insertionPoint = resolveReprojection(node)) { if (details) diff --git a/Source/WebCore/dom/ContainerNode.h b/Source/WebCore/dom/ContainerNode.h index dd4a9898d..69b5f421a 100644 --- a/Source/WebCore/dom/ContainerNode.h +++ b/Source/WebCore/dom/ContainerNode.h @@ -124,7 +124,6 @@ public: // node that is of the type CDATA_SECTION_NODE, TEXT_NODE or COMMENT_NODE has changed its value. virtual void childrenChanged(bool createdByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0); - void attachAsNode(); void attachChildren(); void attachChildrenLazily(); void detachChildren(); @@ -200,11 +199,6 @@ inline ContainerNode::ContainerNode(Document* document, ConstructionType type) { } -inline void ContainerNode::attachAsNode() -{ - Node::attach(); -} - inline void ContainerNode::attachChildren() { for (Node* child = firstChild(); child; child = child->nextSibling()) { diff --git a/Source/WebCore/dom/Element.cpp b/Source/WebCore/dom/Element.cpp index 97dc9c9f6..e8456f704 100644 --- a/Source/WebCore/dom/Element.cpp +++ b/Source/WebCore/dom/Element.cpp @@ -692,61 +692,60 @@ inline void Element::setAttributeInternal(size_t index, const QualifiedName& nam existingAttribute->setValue(newValue); if (!inSynchronizationOfLazyAttribute) - didModifyAttribute(*existingAttribute); + didModifyAttribute(name, newValue); } -void Element::attributeChanged(const Attribute& attribute) +void Element::attributeChanged(const QualifiedName& name, const AtomicString& newValue) { - parseAttribute(attribute); + parseAttribute(Attribute(name, newValue)); document()->incDOMTreeVersion(); - if (isIdAttributeName(attribute.name())) { - if (attribute.value() != attributeData()->idForStyleResolution()) { - if (attribute.isNull()) + if (isIdAttributeName(name)) { + if (newValue != attributeData()->idForStyleResolution()) { + if (newValue.isNull()) attributeData()->setIdForStyleResolution(nullAtom); else if (document()->inQuirksMode()) - attributeData()->setIdForStyleResolution(attribute.value().lower()); + attributeData()->setIdForStyleResolution(newValue.lower()); else - attributeData()->setIdForStyleResolution(attribute.value()); + attributeData()->setIdForStyleResolution(newValue); setNeedsStyleRecalc(); } - } else if (attribute.name() == HTMLNames::nameAttr) - setHasName(!attribute.isNull()); + } else if (name == HTMLNames::nameAttr) + setHasName(!newValue.isNull()); if (!needsStyleRecalc() && document()->attached()) { StyleResolver* styleResolver = document()->styleResolverIfExists(); - if (!styleResolver || styleResolver->hasSelectorForAttribute(attribute.name().localName())) + if (!styleResolver || styleResolver->hasSelectorForAttribute(name.localName())) setNeedsStyleRecalc(); } - invalidateNodeListCachesInAncestors(&attribute.name(), this); + invalidateNodeListCachesInAncestors(&name, this); if (!AXObjectCache::accessibilityEnabled()) return; - const QualifiedName& attrName = attribute.name(); - if (attrName == aria_activedescendantAttr) { + if (name == aria_activedescendantAttr) { // any change to aria-activedescendant attribute triggers accessibility focus change, but document focus remains intact document()->axObjectCache()->handleActiveDescendantChanged(this); - } else if (attrName == roleAttr) { + } else if (name == roleAttr) { // the role attribute can change at any time, and the AccessibilityObject must pick up these changes document()->axObjectCache()->handleAriaRoleChanged(this); - } else if (attrName == aria_valuenowAttr) { + } else if (name == aria_valuenowAttr) { // If the valuenow attribute changes, AX clients need to be notified. document()->axObjectCache()->postNotification(this, AXObjectCache::AXValueChanged, true); - } else if (attrName == aria_labelAttr || attrName == aria_labeledbyAttr || attrName == altAttr || attrName == titleAttr) { + } else if (name == aria_labelAttr || name == aria_labeledbyAttr || name == altAttr || name == titleAttr) { // If the content of an element changes due to an attribute change, notify accessibility. document()->axObjectCache()->contentChanged(this); - } else if (attrName == aria_checkedAttr) + } else if (name == aria_checkedAttr) document()->axObjectCache()->checkedStateChanged(this); - else if (attrName == aria_selectedAttr) + else if (name == aria_selectedAttr) document()->axObjectCache()->selectedChildrenChanged(this); - else if (attrName == aria_expandedAttr) + else if (name == aria_expandedAttr) document()->axObjectCache()->handleAriaExpandedChange(this); - else if (attrName == aria_hiddenAttr) + else if (name == aria_hiddenAttr) document()->axObjectCache()->childrenChanged(this); - else if (attrName == aria_invalidAttr) + else if (name == aria_invalidAttr) document()->axObjectCache()->postNotification(this, AXObjectCache::AXInvalidStatusChanged, true); } @@ -854,7 +853,7 @@ void Element::parserSetAttributes(const Vector<Attribute>& attributeVector, Frag // attributeChanged mutates m_attributeData. // FIXME: Find a way so we don't have to do this. for (unsigned i = 0; i < filteredAttributes.size(); ++i) - attributeChanged(filteredAttributes[i]); + attributeChanged(filteredAttributes[i].name(), filteredAttributes[i].value()); } bool Element::hasAttributes() const @@ -1016,13 +1015,11 @@ void Element::attach() if (ElementShadow* shadow = this->shadow()) { parentPusher.push(); shadow->attach(); - attachChildren(); - attachAsNode(); } else { if (firstChild()) parentPusher.push(); - ContainerNode::attach(); } + ContainerNode::attach(); if (hasRareData()) { ElementRareData* data = elementRareData(); @@ -1565,7 +1562,7 @@ void Element::addAttributeInternal(const QualifiedName& name, const AtomicString willModifyAttribute(name, nullAtom, value); m_attributeData->addAttribute(Attribute(name, value)); if (!inSynchronizationOfLazyAttribute) - didAddAttribute(Attribute(name, value)); + didAddAttribute(name, value); } void Element::removeAttribute(const AtomicString& name) @@ -2181,23 +2178,23 @@ void Element::willModifyAttribute(const QualifiedName& name, const AtomicString& #endif } -void Element::didAddAttribute(const Attribute& attribute) +void Element::didAddAttribute(const QualifiedName& name, const AtomicString& value) { - attributeChanged(attribute); - InspectorInstrumentation::didModifyDOMAttr(document(), this, attribute.localName(), attribute.value()); + attributeChanged(name, value); + InspectorInstrumentation::didModifyDOMAttr(document(), this, name.localName(), value); dispatchSubtreeModifiedEvent(); } -void Element::didModifyAttribute(const Attribute& attribute) +void Element::didModifyAttribute(const QualifiedName& name, const AtomicString& value) { - attributeChanged(attribute); - InspectorInstrumentation::didModifyDOMAttr(document(), this, attribute.localName(), attribute.value()); + attributeChanged(name, value); + InspectorInstrumentation::didModifyDOMAttr(document(), this, name.localName(), value); // Do not dispatch a DOMSubtreeModified event here; see bug 81141. } void Element::didRemoveAttribute(const QualifiedName& name) { - attributeChanged(Attribute(name, nullAtom)); + attributeChanged(name, nullAtom); InspectorInstrumentation::didRemoveDOMAttr(document(), this, name.localName()); dispatchSubtreeModifiedEvent(); } diff --git a/Source/WebCore/dom/Element.h b/Source/WebCore/dom/Element.h index 519c50d77..893bbeef0 100644 --- a/Source/WebCore/dom/Element.h +++ b/Source/WebCore/dom/Element.h @@ -245,7 +245,7 @@ public: NamedNodeMap* attributes() const; // This method is called whenever an attribute is added, changed or removed. - virtual void attributeChanged(const Attribute&); + virtual void attributeChanged(const QualifiedName&, const AtomicString&); virtual void parseAttribute(const Attribute&); // Only called by the parser immediately after element construction. @@ -474,9 +474,9 @@ private: enum SynchronizationOfLazyAttribute { NotInSynchronizationOfLazyAttribute = 0, InSynchronizationOfLazyAttribute }; - void didAddAttribute(const Attribute&); + void didAddAttribute(const QualifiedName&, const AtomicString&); void willModifyAttribute(const QualifiedName&, const AtomicString& oldValue, const AtomicString& newValue); - void didModifyAttribute(const Attribute&); + void didModifyAttribute(const QualifiedName&, const AtomicString&); void didRemoveAttribute(const QualifiedName&); void updateInvalidAttributes() const; diff --git a/Source/WebCore/dom/ElementAttributeData.cpp b/Source/WebCore/dom/ElementAttributeData.cpp index 981ae5814..1f0fd858b 100644 --- a/Source/WebCore/dom/ElementAttributeData.cpp +++ b/Source/WebCore/dom/ElementAttributeData.cpp @@ -338,7 +338,7 @@ void ElementAttributeData::cloneDataFrom(const ElementAttributeData& sourceData, static_cast<StyledElement&>(targetElement).styleAttributeChanged(attribute.value(), StyledElement::DoNotReparseStyleAttribute); continue; } - targetElement.attributeChanged(attribute); + targetElement.attributeChanged(attribute.name(), attribute.value()); } if (targetElement.isStyledElement() && sourceData.m_inlineStyleDecl) { diff --git a/Source/WebCore/dom/ProcessingInstruction.cpp b/Source/WebCore/dom/ProcessingInstruction.cpp index 4bca1d1eb..ec1733c74 100644 --- a/Source/WebCore/dom/ProcessingInstruction.cpp +++ b/Source/WebCore/dom/ProcessingInstruction.cpp @@ -24,6 +24,7 @@ #include "CSSStyleSheet.h" #include "CachedCSSStyleSheet.h" #include "CachedResourceLoader.h" +#include "CachedResourceRequest.h" #include "CachedXSLStyleSheet.h" #include "Document.h" #include "DocumentStyleSheetCollection.h" @@ -163,7 +164,7 @@ void ProcessingInstruction::checkStyleSheet() m_loading = true; document()->styleSheetCollection()->addPendingSheet(); - ResourceRequest request(document()->completeURL(href)); + CachedResourceRequest request(ResourceRequest(document()->completeURL(href))); #if ENABLE(XSLT) if (m_isXSL) m_cachedSheet = document()->cachedResourceLoader()->requestXSLStyleSheet(request); @@ -173,8 +174,9 @@ void ProcessingInstruction::checkStyleSheet() String charset = attrs.get("charset"); if (charset.isEmpty()) charset = document()->charset(); + request.setCharset(charset); - m_cachedSheet = document()->cachedResourceLoader()->requestCSSStyleSheet(request, charset); + m_cachedSheet = document()->cachedResourceLoader()->requestCSSStyleSheet(request); } if (m_cachedSheet) m_cachedSheet->addClient(this); diff --git a/Source/WebCore/dom/ScriptElement.cpp b/Source/WebCore/dom/ScriptElement.cpp index 209fc79c1..cfdd1a436 100644 --- a/Source/WebCore/dom/ScriptElement.cpp +++ b/Source/WebCore/dom/ScriptElement.cpp @@ -26,6 +26,7 @@ #include "CachedScript.h" #include "CachedResourceLoader.h" +#include "CachedResourceRequest.h" #include "ContentSecurityPolicy.h" #include "CrossOriginAccessControl.h" #include "Document.h" @@ -256,16 +257,17 @@ bool ScriptElement::requestScript(const String& sourceUrl) ASSERT(!m_cachedScript); if (!stripLeadingAndTrailingHTMLSpaces(sourceUrl).isEmpty()) { - ResourceRequest request = ResourceRequest(m_element->document()->completeURL(sourceUrl)); + CachedResourceRequest request(ResourceRequest(m_element->document()->completeURL(sourceUrl))); String crossOriginMode = m_element->fastGetAttribute(HTMLNames::crossoriginAttr); if (!crossOriginMode.isNull()) { m_requestUsesAccessControl = true; StoredCredentials allowCredentials = equalIgnoringCase(crossOriginMode, "use-credentials") ? AllowStoredCredentials : DoNotAllowStoredCredentials; - updateRequestForAccessControl(request, m_element->document()->securityOrigin(), allowCredentials); + updateRequestForAccessControl(request.mutableResourceRequest(), m_element->document()->securityOrigin(), allowCredentials); } + request.setCharset(scriptCharset()); - m_cachedScript = m_element->document()->cachedResourceLoader()->requestScript(request, scriptCharset()); + m_cachedScript = m_element->document()->cachedResourceLoader()->requestScript(request); m_isExternalScript = true; } diff --git a/Source/WebCore/dom/ShadowRoot.cpp b/Source/WebCore/dom/ShadowRoot.cpp index 0da9f27a9..75192cded 100644 --- a/Source/WebCore/dom/ShadowRoot.cpp +++ b/Source/WebCore/dom/ShadowRoot.cpp @@ -38,6 +38,7 @@ #include "HTMLInputElement.h" #include "HTMLNames.h" #include "HTMLTextAreaElement.h" +#include "HistogramSupport.h" #include "InsertionPoint.h" #include "NodeRareData.h" #include "RuntimeEnabledFeatures.h" @@ -86,8 +87,28 @@ static bool allowsAuthorShadowRoot(Element* element) return element->areAuthorShadowsAllowed(); } +enum ShadowRootUsageOriginType { + ShadowRootUsageOriginWeb = 0, + ShadowRootUsageOriginNotWeb, + ShadowRootUsageOriginTypes +}; + +static inline ShadowRootUsageOriginType determineUsageType(Element* host) +{ + // Enables only on CHROMIUM since this cost won't worth paying for platforms which don't collect this metrics. +#if PLATFORM(CHROMIUM) + if (!host) + return ShadowRootUsageOriginWeb; + return host->document()->url().string().startsWith("http") ? ShadowRootUsageOriginWeb : ShadowRootUsageOriginNotWeb; +#else + UNUSED_PARAM(host); + return ShadowRootUsageOriginWeb; +#endif +} + PassRefPtr<ShadowRoot> ShadowRoot::create(Element* element, ExceptionCode& ec) { + HistogramSupport::histogramEnumeration("WebCore.ShadowRoot.constructor", determineUsageType(element), ShadowRootUsageOriginTypes); return create(element, AuthorShadowRoot, ec); } @@ -215,8 +236,7 @@ void ShadowRoot::attach() { StyleResolver* styleResolver = document()->styleResolver(); styleResolver->pushParentShadowRoot(this); - attachChildren(); - attachAsNode(); + DocumentFragment::attach(); styleResolver->popParentShadowRoot(this); } diff --git a/Source/WebCore/dom/StyledElement.cpp b/Source/WebCore/dom/StyledElement.cpp index d4c5e94b9..576aa2284 100644 --- a/Source/WebCore/dom/StyledElement.cpp +++ b/Source/WebCore/dom/StyledElement.cpp @@ -148,14 +148,14 @@ CSSStyleDeclaration* StyledElement::style() return ensureInlineStyle()->ensureInlineCSSStyleDeclaration(this); } -void StyledElement::attributeChanged(const Attribute& attribute) +void StyledElement::attributeChanged(const QualifiedName& name, const AtomicString& newValue) { - if (isPresentationAttribute(attribute.name())) { + if (isPresentationAttribute(name)) { setAttributeStyleDirty(); setNeedsStyleRecalc(InlineStyleChange); } - Element::attributeChanged(attribute); + Element::attributeChanged(name, newValue); } void StyledElement::styleAttributeChanged(const AtomicString& newStyleString, ShouldReparseStyleAttribute shouldReparse) diff --git a/Source/WebCore/dom/StyledElement.h b/Source/WebCore/dom/StyledElement.h index 0d0f773ca..cf59ed1ad 100644 --- a/Source/WebCore/dom/StyledElement.h +++ b/Source/WebCore/dom/StyledElement.h @@ -62,7 +62,7 @@ public: protected: StyledElement(const QualifiedName&, Document*, ConstructionType); - virtual void attributeChanged(const Attribute&) OVERRIDE; + virtual void attributeChanged(const QualifiedName&, const AtomicString&) OVERRIDE; virtual void parseAttribute(const Attribute&) OVERRIDE; virtual bool isPresentationAttribute(const QualifiedName&) const { return false; } diff --git a/Source/WebCore/dom/ViewportArguments.cpp b/Source/WebCore/dom/ViewportArguments.cpp index e457b037a..dc16bd63a 100644 --- a/Source/WebCore/dom/ViewportArguments.cpp +++ b/Source/WebCore/dom/ViewportArguments.cpp @@ -363,6 +363,9 @@ void reportViewportWarning(Document* document, ViewportErrorCode errorCode, cons if (!replacement2.isNull()) message.replace("%replacement2", replacement2); + if ((errorCode == UnrecognizedViewportArgumentValueError || errorCode == TruncatedViewportArgumentValueError) && replacement1.find(';') != WTF::notFound) + message.append(" Note that ';' is not a separator in viewport values. The list should be comma-separated."); + document->domWindow()->console()->addMessage(HTMLMessageSource, LogMessageType, viewportErrorMessageLevel(errorCode), message, document->url().string(), parserLineNumber(document)); } |
