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

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

Issue 1686483002: Oilpan: Remove most WillBe types from the code base (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months 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 Peter Kelly (pmk@post.com) 4 * (C) 2001 Peter Kelly (pmk@post.com)
5 * (C) 2001 Dirk Mueller (mueller@kde.org) 5 * (C) 2001 Dirk Mueller (mueller@kde.org)
6 * (C) 2007 David Smith (catfish.man@gmail.com) 6 * (C) 2007 David Smith (catfish.man@gmail.com)
7 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc. All rights reserved. 7 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc. All rights reserved.
8 * (C) 2007 Eric Seidel (eric@webkit.org) 8 * (C) 2007 Eric Seidel (eric@webkit.org)
9 * 9 *
10 * This library is free software; you can redistribute it and/or 10 * This library is free software; you can redistribute it and/or
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 return *scrollCustomizationCallbacks; 153 return *scrollCustomizationCallbacks;
154 } 154 }
155 155
156 } // namespace 156 } // namespace
157 157
158 using namespace HTMLNames; 158 using namespace HTMLNames;
159 using namespace XMLNames; 159 using namespace XMLNames;
160 160
161 enum class ClassStringContent { Empty, WhiteSpaceOnly, HasClasses }; 161 enum class ClassStringContent { Empty, WhiteSpaceOnly, HasClasses };
162 162
163 PassRefPtrWillBeRawPtr<Element> Element::create(const QualifiedName& tagName, Do cument* document) 163 RawPtr<Element> Element::create(const QualifiedName& tagName, Document* document )
164 { 164 {
165 return adoptRefWillBeNoop(new Element(tagName, document, CreateElement)); 165 return new Element(tagName, document, CreateElement);
166 } 166 }
167 167
168 Element::Element(const QualifiedName& tagName, Document* document, ConstructionT ype type) 168 Element::Element(const QualifiedName& tagName, Document* document, ConstructionT ype type)
169 : ContainerNode(document, type) 169 : ContainerNode(document, type)
170 , m_tagName(tagName) 170 , m_tagName(tagName)
171 { 171 {
172 } 172 }
173 173
174 Element::~Element() 174 Element::~Element()
175 { 175 {
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 const HTMLCanvasElement* canvas = Traversal<HTMLCanvasElement>::firstAnc estorOrSelf(*this); 258 const HTMLCanvasElement* canvas = Traversal<HTMLCanvasElement>::firstAnc estorOrSelf(*this);
259 ASSERT(canvas); 259 ASSERT(canvas);
260 return canvas->layoutObject() && canvas->layoutObject()->style()->visibi lity() == VISIBLE; 260 return canvas->layoutObject() && canvas->layoutObject()->style()->visibi lity() == VISIBLE;
261 } 261 }
262 262
263 // FIXME: Even if we are not visible, we might have a child that is visible. 263 // FIXME: Even if we are not visible, we might have a child that is visible.
264 // Hyatt wants to fix that some day with a "has visible content" flag or the like. 264 // Hyatt wants to fix that some day with a "has visible content" flag or the like.
265 return layoutObject() && layoutObject()->style()->visibility() == VISIBLE; 265 return layoutObject() && layoutObject()->style()->visibility() == VISIBLE;
266 } 266 }
267 267
268 PassRefPtrWillBeRawPtr<Node> Element::cloneNode(bool deep) 268 RawPtr<Node> Element::cloneNode(bool deep)
269 { 269 {
270 return deep ? cloneElementWithChildren() : cloneElementWithoutChildren(); 270 return deep ? cloneElementWithChildren() : cloneElementWithoutChildren();
271 } 271 }
272 272
273 PassRefPtrWillBeRawPtr<Element> Element::cloneElementWithChildren() 273 RawPtr<Element> Element::cloneElementWithChildren()
274 { 274 {
275 RefPtrWillBeRawPtr<Element> clone = cloneElementWithoutChildren(); 275 RawPtr<Element> clone = cloneElementWithoutChildren();
276 cloneChildNodes(clone.get()); 276 cloneChildNodes(clone.get());
277 return clone.release(); 277 return clone.release();
278 } 278 }
279 279
280 PassRefPtrWillBeRawPtr<Element> Element::cloneElementWithoutChildren() 280 RawPtr<Element> Element::cloneElementWithoutChildren()
281 { 281 {
282 RefPtrWillBeRawPtr<Element> clone = cloneElementWithoutAttributesAndChildren (); 282 RawPtr<Element> clone = cloneElementWithoutAttributesAndChildren();
283 // This will catch HTML elements in the wrong namespace that are not correct ly copied. 283 // This will catch HTML elements in the wrong namespace that are not correct ly copied.
284 // This is a sanity check as HTML overloads some of the DOM methods. 284 // This is a sanity check as HTML overloads some of the DOM methods.
285 ASSERT(isHTMLElement() == clone->isHTMLElement()); 285 ASSERT(isHTMLElement() == clone->isHTMLElement());
286 286
287 clone->cloneDataFromElement(*this); 287 clone->cloneDataFromElement(*this);
288 return clone.release(); 288 return clone.release();
289 } 289 }
290 290
291 PassRefPtrWillBeRawPtr<Element> Element::cloneElementWithoutAttributesAndChildre n() 291 RawPtr<Element> Element::cloneElementWithoutAttributesAndChildren()
292 { 292 {
293 return document().createElement(tagQName(), false); 293 return document().createElement(tagQName(), false);
294 } 294 }
295 295
296 PassRefPtrWillBeRawPtr<Attr> Element::detachAttribute(size_t index) 296 RawPtr<Attr> Element::detachAttribute(size_t index)
297 { 297 {
298 ASSERT(elementData()); 298 ASSERT(elementData());
299 const Attribute& attribute = elementData()->attributes().at(index); 299 const Attribute& attribute = elementData()->attributes().at(index);
300 RefPtrWillBeRawPtr<Attr> attrNode = attrIfExists(attribute.name()); 300 RawPtr<Attr> attrNode = attrIfExists(attribute.name());
301 if (attrNode) { 301 if (attrNode) {
302 detachAttrNodeAtIndex(attrNode.get(), index); 302 detachAttrNodeAtIndex(attrNode.get(), index);
303 } else { 303 } else {
304 attrNode = Attr::create(document(), attribute.name(), attribute.value()) ; 304 attrNode = Attr::create(document(), attribute.name(), attribute.value()) ;
305 removeAttributeInternal(index, NotInSynchronizationOfLazyAttribute); 305 removeAttributeInternal(index, NotInSynchronizationOfLazyAttribute);
306 } 306 }
307 return attrNode.release(); 307 return attrNode.release();
308 } 308 }
309 309
310 void Element::detachAttrNodeAtIndex(Attr* attr, size_t index) 310 void Element::detachAttrNodeAtIndex(Attr* attr, size_t index)
(...skipping 1563 matching lines...) Expand 10 before | Expand all | Expand 10 after
1874 if (!layoutObject) 1874 if (!layoutObject)
1875 return; 1875 return;
1876 if (!layoutObject->hasLayer()) 1876 if (!layoutObject->hasLayer())
1877 return; 1877 return;
1878 layoutObject->layer()->setNeedsCompositingInputsUpdate(); 1878 layoutObject->layer()->setNeedsCompositingInputsUpdate();
1879 // Changes in the return value of requiresAcceleratedCompositing change if 1879 // Changes in the return value of requiresAcceleratedCompositing change if
1880 // the PaintLayer is self-painting. 1880 // the PaintLayer is self-painting.
1881 layoutObject->layer()->updateSelfPaintingLayer(); 1881 layoutObject->layer()->updateSelfPaintingLayer();
1882 } 1882 }
1883 1883
1884 void Element::setCustomElementDefinition(PassRefPtrWillBeRawPtr<CustomElementDef inition> definition) 1884 void Element::setCustomElementDefinition(RawPtr<CustomElementDefinition> definit ion)
1885 { 1885 {
1886 if (!hasRareData() && !definition) 1886 if (!hasRareData() && !definition)
1887 return; 1887 return;
1888 ASSERT(!customElementDefinition()); 1888 ASSERT(!customElementDefinition());
1889 ensureElementRareData().setCustomElementDefinition(definition); 1889 ensureElementRareData().setCustomElementDefinition(definition);
1890 } 1890 }
1891 1891
1892 CustomElementDefinition* Element::customElementDefinition() const 1892 CustomElementDefinition* Element::customElementDefinition() const
1893 { 1893 {
1894 if (hasRareData()) 1894 if (hasRareData())
1895 return elementRareData()->customElementDefinition(); 1895 return elementRareData()->customElementDefinition();
1896 return nullptr; 1896 return nullptr;
1897 } 1897 }
1898 1898
1899 PassRefPtrWillBeRawPtr<ShadowRoot> Element::createShadowRoot(const ScriptState* scriptState, ExceptionState& exceptionState) 1899 RawPtr<ShadowRoot> Element::createShadowRoot(const ScriptState* scriptState, Exc eptionState& exceptionState)
1900 { 1900 {
1901 OriginsUsingFeatures::countMainWorldOnly(scriptState, document(), OriginsUsi ngFeatures::Feature::ElementCreateShadowRoot); 1901 OriginsUsingFeatures::countMainWorldOnly(scriptState, document(), OriginsUsi ngFeatures::Feature::ElementCreateShadowRoot);
1902 if (ShadowRoot* root = shadowRoot()) { 1902 if (ShadowRoot* root = shadowRoot()) {
1903 if (root->isV1()) { 1903 if (root->isV1()) {
1904 exceptionState.throwDOMException(InvalidStateError, "Shadow root can not be created on a host which already hosts a v1 shadow tree."); 1904 exceptionState.throwDOMException(InvalidStateError, "Shadow root can not be created on a host which already hosts a v1 shadow tree.");
1905 return nullptr; 1905 return nullptr;
1906 } 1906 }
1907 if (root->type() == ShadowRootType::UserAgent) { 1907 if (root->type() == ShadowRootType::UserAgent) {
1908 exceptionState.throwDOMException(InvalidStateError, "Shadow root can not be created on a host which already hosts an user-agent shadow tree."); 1908 exceptionState.throwDOMException(InvalidStateError, "Shadow root can not be created on a host which already hosts an user-agent shadow tree.");
1909 return nullptr; 1909 return nullptr;
1910 } 1910 }
1911 } 1911 }
1912 document().styleEngine().setShadowCascadeOrder(ShadowCascadeOrder::ShadowCas cadeV0); 1912 document().styleEngine().setShadowCascadeOrder(ShadowCascadeOrder::ShadowCas cadeV0);
1913 1913
1914 return createShadowRootInternal(ShadowRootType::V0, exceptionState); 1914 return createShadowRootInternal(ShadowRootType::V0, exceptionState);
1915 } 1915 }
1916 1916
1917 PassRefPtrWillBeRawPtr<ShadowRoot> Element::attachShadow(const ScriptState* scri ptState, const ShadowRootInit& shadowRootInitDict, ExceptionState& exceptionStat e) 1917 RawPtr<ShadowRoot> Element::attachShadow(const ScriptState* scriptState, const S hadowRootInit& shadowRootInitDict, ExceptionState& exceptionState)
1918 { 1918 {
1919 ASSERT(RuntimeEnabledFeatures::shadowDOMV1Enabled()); 1919 ASSERT(RuntimeEnabledFeatures::shadowDOMV1Enabled());
1920 1920
1921 OriginsUsingFeatures::countMainWorldOnly(scriptState, document(), OriginsUsi ngFeatures::Feature::ElementAttachShadow); 1921 OriginsUsingFeatures::countMainWorldOnly(scriptState, document(), OriginsUsi ngFeatures::Feature::ElementAttachShadow);
1922 1922
1923 const AtomicString& tagName = localName(); 1923 const AtomicString& tagName = localName();
1924 bool tagNameIsSupported = isCustomElement() 1924 bool tagNameIsSupported = isCustomElement()
1925 || tagName == HTMLNames::articleTag 1925 || tagName == HTMLNames::articleTag
1926 || tagName == HTMLNames::asideTag 1926 || tagName == HTMLNames::asideTag
1927 || tagName == HTMLNames::blockquoteTag 1927 || tagName == HTMLNames::blockquoteTag
(...skipping 25 matching lines...) Expand all
1953 1953
1954 ShadowRootType type = ShadowRootType::V0; 1954 ShadowRootType type = ShadowRootType::V0;
1955 if (shadowRootInitDict.hasMode()) 1955 if (shadowRootInitDict.hasMode())
1956 type = shadowRootInitDict.mode() == "open" ? ShadowRootType::Open : Shad owRootType::Closed; 1956 type = shadowRootInitDict.mode() == "open" ? ShadowRootType::Open : Shad owRootType::Closed;
1957 1957
1958 if (type == ShadowRootType::Closed) 1958 if (type == ShadowRootType::Closed)
1959 UseCounter::count(document(), UseCounter::ElementAttachShadowClosed); 1959 UseCounter::count(document(), UseCounter::ElementAttachShadowClosed);
1960 else if (type == ShadowRootType::Open) 1960 else if (type == ShadowRootType::Open)
1961 UseCounter::count(document(), UseCounter::ElementAttachShadowOpen); 1961 UseCounter::count(document(), UseCounter::ElementAttachShadowOpen);
1962 1962
1963 RefPtrWillBeRawPtr<ShadowRoot> shadowRoot = createShadowRootInternal(type, e xceptionState); 1963 RawPtr<ShadowRoot> shadowRoot = createShadowRootInternal(type, exceptionStat e);
1964 1964
1965 if (shadowRootInitDict.hasDelegatesFocus()) 1965 if (shadowRootInitDict.hasDelegatesFocus())
1966 shadowRoot->setDelegatesFocus(shadowRootInitDict.delegatesFocus()); 1966 shadowRoot->setDelegatesFocus(shadowRootInitDict.delegatesFocus());
1967 1967
1968 return shadowRoot.release(); 1968 return shadowRoot.release();
1969 } 1969 }
1970 1970
1971 PassRefPtrWillBeRawPtr<ShadowRoot> Element::createShadowRootInternal(ShadowRootT ype type, ExceptionState& exceptionState) 1971 RawPtr<ShadowRoot> Element::createShadowRootInternal(ShadowRootType type, Except ionState& exceptionState)
1972 { 1972 {
1973 ASSERT(!closedShadowRoot()); 1973 ASSERT(!closedShadowRoot());
1974 1974
1975 if (alwaysCreateUserAgentShadowRoot()) 1975 if (alwaysCreateUserAgentShadowRoot())
1976 ensureUserAgentShadowRoot(); 1976 ensureUserAgentShadowRoot();
1977 1977
1978 // Some elements make assumptions about what kind of layoutObjects they allo w 1978 // Some elements make assumptions about what kind of layoutObjects they allo w
1979 // as children so we can't allow author shadows on them for now. 1979 // as children so we can't allow author shadows on them for now.
1980 if (!areAuthorShadowsAllowed()) { 1980 if (!areAuthorShadowsAllowed()) {
1981 exceptionState.throwDOMException(HierarchyRequestError, "Author-created shadow roots are disabled for this element."); 1981 exceptionState.throwDOMException(HierarchyRequestError, "Author-created shadow roots are disabled for this element.");
1982 return nullptr; 1982 return nullptr;
1983 } 1983 }
1984 1984
1985 return PassRefPtrWillBeRawPtr<ShadowRoot>(ensureShadow().addShadowRoot(*this , type)); 1985 return RawPtr<ShadowRoot>(ensureShadow().addShadowRoot(*this, type));
1986 } 1986 }
1987 1987
1988 ShadowRoot* Element::shadowRoot() const 1988 ShadowRoot* Element::shadowRoot() const
1989 { 1989 {
1990 ElementShadow* elementShadow = shadow(); 1990 ElementShadow* elementShadow = shadow();
1991 if (!elementShadow) 1991 if (!elementShadow)
1992 return nullptr; 1992 return nullptr;
1993 return &elementShadow->youngestShadowRoot(); 1993 return &elementShadow->youngestShadowRoot();
1994 } 1994 }
1995 1995
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
2125 return ensureElementRareData().ensureAttrNodeList(); 2125 return ensureElementRareData().ensureAttrNodeList();
2126 } 2126 }
2127 2127
2128 void Element::removeAttrNodeList() 2128 void Element::removeAttrNodeList()
2129 { 2129 {
2130 ASSERT(attrNodeList()); 2130 ASSERT(attrNodeList());
2131 if (hasRareData()) 2131 if (hasRareData())
2132 elementRareData()->removeAttrNodeList(); 2132 elementRareData()->removeAttrNodeList();
2133 } 2133 }
2134 2134
2135 PassRefPtrWillBeRawPtr<Attr> Element::setAttributeNode(Attr* attrNode, Exception State& exceptionState) 2135 RawPtr<Attr> Element::setAttributeNode(Attr* attrNode, ExceptionState& exception State)
2136 { 2136 {
2137 RefPtrWillBeRawPtr<Attr> oldAttrNode = attrIfExists(attrNode->getQualifiedNa me()); 2137 RawPtr<Attr> oldAttrNode = attrIfExists(attrNode->getQualifiedName());
2138 if (oldAttrNode.get() == attrNode) 2138 if (oldAttrNode.get() == attrNode)
2139 return attrNode; // This Attr is already attached to the element. 2139 return attrNode; // This Attr is already attached to the element.
2140 2140
2141 // InUseAttributeError: Raised if node is an Attr that is already an attribu te of another Element object. 2141 // InUseAttributeError: Raised if node is an Attr that is already an attribu te of another Element object.
2142 // The DOM user must explicitly clone Attr nodes to re-use them in other ele ments. 2142 // The DOM user must explicitly clone Attr nodes to re-use them in other ele ments.
2143 if (attrNode->ownerElement()) { 2143 if (attrNode->ownerElement()) {
2144 exceptionState.throwDOMException(InUseAttributeError, "The node provided is an attribute node that is already an attribute of another Element; attribute nodes must be explicitly cloned."); 2144 exceptionState.throwDOMException(InUseAttributeError, "The node provided is an attribute node that is already an attribute of another Element; attribute nodes must be explicitly cloned.");
2145 return nullptr; 2145 return nullptr;
2146 } 2146 }
2147 2147
(...skipping 29 matching lines...) Expand all
2177 2177
2178 setAttributeInternal(index, attrNode->getQualifiedName(), attrNode->value(), NotInSynchronizationOfLazyAttribute); 2178 setAttributeInternal(index, attrNode->getQualifiedName(), attrNode->value(), NotInSynchronizationOfLazyAttribute);
2179 2179
2180 attrNode->attachToElement(this, localName); 2180 attrNode->attachToElement(this, localName);
2181 treeScope().adoptIfNeeded(*attrNode); 2181 treeScope().adoptIfNeeded(*attrNode);
2182 ensureAttrNodeList().append(attrNode); 2182 ensureAttrNodeList().append(attrNode);
2183 2183
2184 return oldAttrNode.release(); 2184 return oldAttrNode.release();
2185 } 2185 }
2186 2186
2187 PassRefPtrWillBeRawPtr<Attr> Element::setAttributeNodeNS(Attr* attr, ExceptionSt ate& exceptionState) 2187 RawPtr<Attr> Element::setAttributeNodeNS(Attr* attr, ExceptionState& exceptionSt ate)
2188 { 2188 {
2189 return setAttributeNode(attr, exceptionState); 2189 return setAttributeNode(attr, exceptionState);
2190 } 2190 }
2191 2191
2192 PassRefPtrWillBeRawPtr<Attr> Element::removeAttributeNode(Attr* attr, ExceptionS tate& exceptionState) 2192 RawPtr<Attr> Element::removeAttributeNode(Attr* attr, ExceptionState& exceptionS tate)
2193 { 2193 {
2194 if (attr->ownerElement() != this) { 2194 if (attr->ownerElement() != this) {
2195 exceptionState.throwDOMException(NotFoundError, "The node provided is ow ned by another element."); 2195 exceptionState.throwDOMException(NotFoundError, "The node provided is ow ned by another element.");
2196 return nullptr; 2196 return nullptr;
2197 } 2197 }
2198 2198
2199 ASSERT(document() == attr->document()); 2199 ASSERT(document() == attr->document());
2200 2200
2201 synchronizeAttribute(attr->getQualifiedName()); 2201 synchronizeAttribute(attr->getQualifiedName());
2202 2202
2203 size_t index = elementData()->attributes().findIndex(attr->getQualifiedName( )); 2203 size_t index = elementData()->attributes().findIndex(attr->getQualifiedName( ));
2204 if (index == kNotFound) { 2204 if (index == kNotFound) {
2205 exceptionState.throwDOMException(NotFoundError, "The attribute was not f ound on this element."); 2205 exceptionState.throwDOMException(NotFoundError, "The attribute was not f ound on this element.");
2206 return nullptr; 2206 return nullptr;
2207 } 2207 }
2208 2208
2209 RefPtrWillBeRawPtr<Attr> guard(attr); 2209 RawPtr<Attr> guard(attr);
2210 detachAttrNodeAtIndex(attr, index); 2210 detachAttrNodeAtIndex(attr, index);
2211 return guard.release(); 2211 return guard.release();
2212 } 2212 }
2213 2213
2214 void Element::parseAttribute(const QualifiedName& name, const AtomicString&, con st AtomicString& value) 2214 void Element::parseAttribute(const QualifiedName& name, const AtomicString&, con st AtomicString& value)
2215 { 2215 {
2216 if (name == tabindexAttr) { 2216 if (name == tabindexAttr) {
2217 int tabindex = 0; 2217 int tabindex = 0;
2218 if (value.isEmpty()) { 2218 if (value.isEmpty()) {
2219 clearTabIndexExplicitlyIfNeeded(); 2219 clearTabIndexExplicitlyIfNeeded();
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
2263 ASSERT_WITH_SECURITY_IMPLICATION(index < attributes.size()); 2263 ASSERT_WITH_SECURITY_IMPLICATION(index < attributes.size());
2264 2264
2265 QualifiedName name = attributes[index].name(); 2265 QualifiedName name = attributes[index].name();
2266 AtomicString valueBeingRemoved = attributes[index].value(); 2266 AtomicString valueBeingRemoved = attributes[index].value();
2267 2267
2268 if (!inSynchronizationOfLazyAttribute) { 2268 if (!inSynchronizationOfLazyAttribute) {
2269 if (!valueBeingRemoved.isNull()) 2269 if (!valueBeingRemoved.isNull())
2270 willModifyAttribute(name, valueBeingRemoved, nullAtom); 2270 willModifyAttribute(name, valueBeingRemoved, nullAtom);
2271 } 2271 }
2272 2272
2273 if (RefPtrWillBeRawPtr<Attr> attrNode = attrIfExists(name)) 2273 if (RawPtr<Attr> attrNode = attrIfExists(name))
2274 detachAttrNodeFromElementWithValue(attrNode.get(), attributes[index].val ue()); 2274 detachAttrNodeFromElementWithValue(attrNode.get(), attributes[index].val ue());
2275 2275
2276 attributes.remove(index); 2276 attributes.remove(index);
2277 2277
2278 if (!inSynchronizationOfLazyAttribute) 2278 if (!inSynchronizationOfLazyAttribute)
2279 didRemoveAttribute(name, valueBeingRemoved); 2279 didRemoveAttribute(name, valueBeingRemoved);
2280 } 2280 }
2281 2281
2282 void Element::appendAttributeInternal(const QualifiedName& name, const AtomicStr ing& value, SynchronizationOfLazyAttribute inSynchronizationOfLazyAttribute) 2282 void Element::appendAttributeInternal(const QualifiedName& name, const AtomicStr ing& value, SynchronizationOfLazyAttribute inSynchronizationOfLazyAttribute)
2283 { 2283 {
(...skipping 18 matching lines...) Expand all
2302 } 2302 }
2303 2303
2304 removeAttributeInternal(index, NotInSynchronizationOfLazyAttribute); 2304 removeAttributeInternal(index, NotInSynchronizationOfLazyAttribute);
2305 } 2305 }
2306 2306
2307 void Element::removeAttributeNS(const AtomicString& namespaceURI, const AtomicSt ring& localName) 2307 void Element::removeAttributeNS(const AtomicString& namespaceURI, const AtomicSt ring& localName)
2308 { 2308 {
2309 removeAttribute(QualifiedName(nullAtom, localName, namespaceURI)); 2309 removeAttribute(QualifiedName(nullAtom, localName, namespaceURI));
2310 } 2310 }
2311 2311
2312 PassRefPtrWillBeRawPtr<Attr> Element::getAttributeNode(const AtomicString& local Name) 2312 RawPtr<Attr> Element::getAttributeNode(const AtomicString& localName)
2313 { 2313 {
2314 if (!elementData()) 2314 if (!elementData())
2315 return nullptr; 2315 return nullptr;
2316 synchronizeAttribute(localName); 2316 synchronizeAttribute(localName);
2317 const Attribute* attribute = elementData()->attributes().find(localName, sho uldIgnoreAttributeCase()); 2317 const Attribute* attribute = elementData()->attributes().find(localName, sho uldIgnoreAttributeCase());
2318 if (!attribute) 2318 if (!attribute)
2319 return nullptr; 2319 return nullptr;
2320 return ensureAttr(attribute->name()); 2320 return ensureAttr(attribute->name());
2321 } 2321 }
2322 2322
2323 PassRefPtrWillBeRawPtr<Attr> Element::getAttributeNodeNS(const AtomicString& nam espaceURI, const AtomicString& localName) 2323 RawPtr<Attr> Element::getAttributeNodeNS(const AtomicString& namespaceURI, const AtomicString& localName)
2324 { 2324 {
2325 if (!elementData()) 2325 if (!elementData())
2326 return nullptr; 2326 return nullptr;
2327 QualifiedName qName(nullAtom, localName, namespaceURI); 2327 QualifiedName qName(nullAtom, localName, namespaceURI);
2328 synchronizeAttribute(qName); 2328 synchronizeAttribute(qName);
2329 const Attribute* attribute = elementData()->attributes().find(qName); 2329 const Attribute* attribute = elementData()->attributes().find(qName);
2330 if (!attribute) 2330 if (!attribute)
2331 return nullptr; 2331 return nullptr;
2332 return ensureAttr(attribute->name()); 2332 return ensureAttr(attribute->name());
2333 } 2333 }
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
2369 return; 2369 return;
2370 2370
2371 // Slide the focus to its inner node. 2371 // Slide the focus to its inner node.
2372 Element* found = document().page()->focusController().findFocusableEleme ntInShadowHost(*this); 2372 Element* found = document().page()->focusController().findFocusableEleme ntInShadowHost(*this);
2373 if (found && containsIncludingShadowDOM(found)) { 2373 if (found && containsIncludingShadowDOM(found)) {
2374 found->focus(FocusParams(SelectionBehaviorOnFocus::Reset, WebFocusTy peForward, nullptr)); 2374 found->focus(FocusParams(SelectionBehaviorOnFocus::Reset, WebFocusTy peForward, nullptr));
2375 return; 2375 return;
2376 } 2376 }
2377 } 2377 }
2378 2378
2379 RefPtrWillBeRawPtr<Node> protect(this); 2379 RawPtr<Node> protect(this);
2380 if (!document().page()->focusController().setFocusedElement(this, document() .frame(), params)) 2380 if (!document().page()->focusController().setFocusedElement(this, document() .frame(), params))
2381 return; 2381 return;
2382 2382
2383 if (document().focusedElement() == this && UserGestureIndicator::processedUs erGestureSinceLoad()) { 2383 if (document().focusedElement() == this && UserGestureIndicator::processedUs erGestureSinceLoad()) {
2384 // Bring up the keyboard in the context of anything triggered by a user 2384 // Bring up the keyboard in the context of anything triggered by a user
2385 // gesture. Since tracking that across arbitrary boundaries (eg. 2385 // gesture. Since tracking that across arbitrary boundaries (eg.
2386 // animations) is difficult, for now we match IE's heuristic and bring 2386 // animations) is difficult, for now we match IE's heuristic and bring
2387 // up the keyboard if there's been any gesture since load. 2387 // up the keyboard if there's been any gesture since load.
2388 document().page()->chromeClient().showImeIfNeeded(); 2388 document().page()->chromeClient().showImeIfNeeded();
2389 } 2389 }
2390 } 2390 }
2391 2391
2392 void Element::updateFocusAppearance(SelectionBehaviorOnFocus selectionBehavior) 2392 void Element::updateFocusAppearance(SelectionBehaviorOnFocus selectionBehavior)
2393 { 2393 {
2394 if (selectionBehavior == SelectionBehaviorOnFocus::None) 2394 if (selectionBehavior == SelectionBehaviorOnFocus::None)
2395 return; 2395 return;
2396 if (isRootEditableElement()) { 2396 if (isRootEditableElement()) {
2397 // Taking the ownership since setSelection() may release the last refere nce to |frame|. 2397 // Taking the ownership since setSelection() may release the last refere nce to |frame|.
2398 RefPtrWillBeRawPtr<LocalFrame> frame(document().frame()); 2398 RawPtr<LocalFrame> frame(document().frame());
2399 if (!frame) 2399 if (!frame)
2400 return; 2400 return;
2401 2401
2402 // When focusing an editable element in an iframe, don't reset the selec tion if it already contains a selection. 2402 // When focusing an editable element in an iframe, don't reset the selec tion if it already contains a selection.
2403 if (this == frame->selection().rootEditableElement()) 2403 if (this == frame->selection().rootEditableElement())
2404 return; 2404 return;
2405 2405
2406 // FIXME: We should restore the previous selection if there is one. 2406 // FIXME: We should restore the previous selection if there is one.
2407 VisibleSelection newSelection = VisibleSelection(firstPositionInOrBefore Node(this), TextAffinity::Downstream); 2407 VisibleSelection newSelection = VisibleSelection(firstPositionInOrBefore Node(this), TextAffinity::Downstream);
2408 // Passing DoNotSetFocus as this function is called after FocusControlle r::setFocusedElement() 2408 // Passing DoNotSetFocus as this function is called after FocusControlle r::setFocusedElement()
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
2515 2515
2516 String Element::outerHTML() const 2516 String Element::outerHTML() const
2517 { 2517 {
2518 return createMarkup(this); 2518 return createMarkup(this);
2519 } 2519 }
2520 2520
2521 void Element::setInnerHTML(const String& html, ExceptionState& exceptionState) 2521 void Element::setInnerHTML(const String& html, ExceptionState& exceptionState)
2522 { 2522 {
2523 InspectorInstrumentation::willSetInnerHTML(this); 2523 InspectorInstrumentation::willSetInnerHTML(this);
2524 2524
2525 if (RefPtrWillBeRawPtr<DocumentFragment> fragment = createFragmentForInnerOu terHTML(html, this, AllowScriptingContent, "innerHTML", exceptionState)) { 2525 if (RawPtr<DocumentFragment> fragment = createFragmentForInnerOuterHTML(html , this, AllowScriptingContent, "innerHTML", exceptionState)) {
2526 ContainerNode* container = this; 2526 ContainerNode* container = this;
2527 if (isHTMLTemplateElement(*this)) 2527 if (isHTMLTemplateElement(*this))
2528 container = toHTMLTemplateElement(this)->content(); 2528 container = toHTMLTemplateElement(this)->content();
2529 replaceChildrenWithFragment(container, fragment.release(), exceptionStat e); 2529 replaceChildrenWithFragment(container, fragment.release(), exceptionStat e);
2530 } 2530 }
2531 } 2531 }
2532 2532
2533 void Element::setOuterHTML(const String& html, ExceptionState& exceptionState) 2533 void Element::setOuterHTML(const String& html, ExceptionState& exceptionState)
2534 { 2534 {
2535 Node* p = parentNode(); 2535 Node* p = parentNode();
2536 if (!p) { 2536 if (!p) {
2537 exceptionState.throwDOMException(NoModificationAllowedError, "This eleme nt has no parent node."); 2537 exceptionState.throwDOMException(NoModificationAllowedError, "This eleme nt has no parent node.");
2538 return; 2538 return;
2539 } 2539 }
2540 if (!p->isElementNode()) { 2540 if (!p->isElementNode()) {
2541 exceptionState.throwDOMException(NoModificationAllowedError, "This eleme nt's parent is of type '" + p->nodeName() + "', which is not an element node."); 2541 exceptionState.throwDOMException(NoModificationAllowedError, "This eleme nt's parent is of type '" + p->nodeName() + "', which is not an element node.");
2542 return; 2542 return;
2543 } 2543 }
2544 2544
2545 RefPtrWillBeRawPtr<Element> parent = toElement(p); 2545 RawPtr<Element> parent = toElement(p);
2546 RefPtrWillBeRawPtr<Node> prev = previousSibling(); 2546 RawPtr<Node> prev = previousSibling();
2547 RefPtrWillBeRawPtr<Node> next = nextSibling(); 2547 RawPtr<Node> next = nextSibling();
2548 2548
2549 RefPtrWillBeRawPtr<DocumentFragment> fragment = createFragmentForInnerOuterH TML(html, parent.get(), AllowScriptingContent, "outerHTML", exceptionState); 2549 RawPtr<DocumentFragment> fragment = createFragmentForInnerOuterHTML(html, pa rent.get(), AllowScriptingContent, "outerHTML", exceptionState);
2550 if (exceptionState.hadException()) 2550 if (exceptionState.hadException())
2551 return; 2551 return;
2552 2552
2553 parent->replaceChild(fragment.release(), this, exceptionState); 2553 parent->replaceChild(fragment.release(), this, exceptionState);
2554 RefPtrWillBeRawPtr<Node> node = next ? next->previousSibling() : nullptr; 2554 RawPtr<Node> node = next ? next->previousSibling() : nullptr;
2555 if (!exceptionState.hadException() && node && node->isTextNode()) 2555 if (!exceptionState.hadException() && node && node->isTextNode())
2556 mergeWithNextTextNode(toText(node.get()), exceptionState); 2556 mergeWithNextTextNode(toText(node.get()), exceptionState);
2557 2557
2558 if (!exceptionState.hadException() && prev && prev->isTextNode()) 2558 if (!exceptionState.hadException() && prev && prev->isTextNode())
2559 mergeWithNextTextNode(toText(prev.get()), exceptionState); 2559 mergeWithNextTextNode(toText(prev.get()), exceptionState);
2560 } 2560 }
2561 2561
2562 Node* Element::insertAdjacent(const String& where, Node* newChild, ExceptionStat e& exceptionState) 2562 Node* Element::insertAdjacent(const String& where, Node* newChild, ExceptionStat e& exceptionState)
2563 { 2563 {
2564 if (equalIgnoringCase(where, "beforeBegin")) { 2564 if (equalIgnoringCase(where, "beforeBegin")) {
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
2628 return toElement(returnValue); 2628 return toElement(returnValue);
2629 } 2629 }
2630 2630
2631 void Element::insertAdjacentText(const String& where, const String& text, Except ionState& exceptionState) 2631 void Element::insertAdjacentText(const String& where, const String& text, Except ionState& exceptionState)
2632 { 2632 {
2633 insertAdjacent(where, document().createTextNode(text).get(), exceptionState) ; 2633 insertAdjacent(where, document().createTextNode(text).get(), exceptionState) ;
2634 } 2634 }
2635 2635
2636 void Element::insertAdjacentHTML(const String& where, const String& markup, Exce ptionState& exceptionState) 2636 void Element::insertAdjacentHTML(const String& where, const String& markup, Exce ptionState& exceptionState)
2637 { 2637 {
2638 RefPtrWillBeRawPtr<Element> contextElement = contextElementForInsertion(wher e, this, exceptionState); 2638 RawPtr<Element> contextElement = contextElementForInsertion(where, this, exc eptionState);
2639 if (!contextElement) 2639 if (!contextElement)
2640 return; 2640 return;
2641 2641
2642 RefPtrWillBeRawPtr<DocumentFragment> fragment = createFragmentForInnerOuterH TML(markup, contextElement.get(), AllowScriptingContent, "insertAdjacentHTML", e xceptionState); 2642 RawPtr<DocumentFragment> fragment = createFragmentForInnerOuterHTML(markup, contextElement.get(), AllowScriptingContent, "insertAdjacentHTML", exceptionStat e);
2643 if (!fragment) 2643 if (!fragment)
2644 return; 2644 return;
2645 insertAdjacent(where, fragment.get(), exceptionState); 2645 insertAdjacent(where, fragment.get(), exceptionState);
2646 } 2646 }
2647 2647
2648 void Element::setPointerCapture(int pointerId, ExceptionState& exceptionState) 2648 void Element::setPointerCapture(int pointerId, ExceptionState& exceptionState)
2649 { 2649 {
2650 if (document().frame()) { 2650 if (document().frame()) {
2651 if (!document().frame()->eventHandler().isPointerEventActive(pointerId)) 2651 if (!document().frame()->eventHandler().isPointerEventActive(pointerId))
2652 exceptionState.throwDOMException(InvalidPointerId, "InvalidPointerId "); 2652 exceptionState.throwDOMException(InvalidPointerId, "InvalidPointerId ");
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
2895 } 2895 }
2896 return false; 2896 return false;
2897 } 2897 }
2898 2898
2899 void Element::createPseudoElementIfNeeded(PseudoId pseudoId) 2899 void Element::createPseudoElementIfNeeded(PseudoId pseudoId)
2900 { 2900 {
2901 if (isPseudoElement()) 2901 if (isPseudoElement())
2902 return; 2902 return;
2903 2903
2904 // Document::ensureStyleResolver is not inlined and shows up on profiles, av oid it here. 2904 // Document::ensureStyleResolver is not inlined and shows up on profiles, av oid it here.
2905 RefPtrWillBeRawPtr<PseudoElement> element = document().styleEngine().ensureR esolver().createPseudoElementIfNeeded(*this, pseudoId); 2905 RawPtr<PseudoElement> element = document().styleEngine().ensureResolver().cr eatePseudoElementIfNeeded(*this, pseudoId);
2906 if (!element) 2906 if (!element)
2907 return; 2907 return;
2908 2908
2909 if (pseudoId == PseudoIdBackdrop) 2909 if (pseudoId == PseudoIdBackdrop)
2910 document().addToTopLayer(element.get(), this); 2910 document().addToTopLayer(element.get(), this);
2911 element->insertedInto(this); 2911 element->insertedInto(this);
2912 element->attach(); 2912 element->attach();
2913 2913
2914 InspectorInstrumentation::pseudoElementCreated(element.get()); 2914 InspectorInstrumentation::pseudoElementCreated(element.get());
2915 2915
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
3153 if (name == HTMLNames::nameAttr) { 3153 if (name == HTMLNames::nameAttr) {
3154 updateName(oldValue, newValue); 3154 updateName(oldValue, newValue);
3155 } 3155 }
3156 3156
3157 if (oldValue != newValue) { 3157 if (oldValue != newValue) {
3158 document().styleEngine().attributeChangedForElement(name, *this); 3158 document().styleEngine().attributeChangedForElement(name, *this);
3159 if (isUpgradedCustomElement()) 3159 if (isUpgradedCustomElement())
3160 CustomElement::attributeDidChange(this, name.localName(), oldValue, newValue); 3160 CustomElement::attributeDidChange(this, name.localName(), oldValue, newValue);
3161 } 3161 }
3162 3162
3163 if (OwnPtrWillBeRawPtr<MutationObserverInterestGroup> recipients = MutationO bserverInterestGroup::createForAttributesMutation(*this, name)) 3163 if (RawPtr<MutationObserverInterestGroup> recipients = MutationObserverInter estGroup::createForAttributesMutation(*this, name))
3164 recipients->enqueueMutationRecord(MutationRecord::createAttributes(this, name, oldValue)); 3164 recipients->enqueueMutationRecord(MutationRecord::createAttributes(this, name, oldValue));
3165 3165
3166 InspectorInstrumentation::willModifyDOMAttr(this, oldValue, newValue); 3166 InspectorInstrumentation::willModifyDOMAttr(this, oldValue, newValue);
3167 } 3167 }
3168 3168
3169 void Element::didAddAttribute(const QualifiedName& name, const AtomicString& val ue) 3169 void Element::didAddAttribute(const QualifiedName& name, const AtomicString& val ue)
3170 { 3170 {
3171 if (name == HTMLNames::idAttr) 3171 if (name == HTMLNames::idAttr)
3172 updateId(nullAtom, value); 3172 updateId(nullAtom, value);
3173 attributeChanged(name, nullAtom, value); 3173 attributeChanged(name, nullAtom, value);
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
3272 return hasRareData() ? elementRareData()->savedLayerScrollOffset() : IntSize (); 3272 return hasRareData() ? elementRareData()->savedLayerScrollOffset() : IntSize ();
3273 } 3273 }
3274 3274
3275 void Element::setSavedLayerScrollOffset(const IntSize& size) 3275 void Element::setSavedLayerScrollOffset(const IntSize& size)
3276 { 3276 {
3277 if (size.isZero() && !hasRareData()) 3277 if (size.isZero() && !hasRareData())
3278 return; 3278 return;
3279 ensureElementRareData().setSavedLayerScrollOffset(size); 3279 ensureElementRareData().setSavedLayerScrollOffset(size);
3280 } 3280 }
3281 3281
3282 PassRefPtrWillBeRawPtr<Attr> Element::attrIfExists(const QualifiedName& name) 3282 RawPtr<Attr> Element::attrIfExists(const QualifiedName& name)
3283 { 3283 {
3284 if (AttrNodeList* attrNodeList = this->attrNodeList()) { 3284 if (AttrNodeList* attrNodeList = this->attrNodeList()) {
3285 bool shouldIgnoreCase = shouldIgnoreAttributeCase(); 3285 bool shouldIgnoreCase = shouldIgnoreAttributeCase();
3286 for (const auto& attr : *attrNodeList) { 3286 for (const auto& attr : *attrNodeList) {
3287 if (attr->getQualifiedName().matchesPossiblyIgnoringCase(name, shoul dIgnoreCase)) 3287 if (attr->getQualifiedName().matchesPossiblyIgnoringCase(name, shoul dIgnoreCase))
3288 return attr.get(); 3288 return attr.get();
3289 } 3289 }
3290 } 3290 }
3291 return nullptr; 3291 return nullptr;
3292 } 3292 }
3293 3293
3294 PassRefPtrWillBeRawPtr<Attr> Element::ensureAttr(const QualifiedName& name) 3294 RawPtr<Attr> Element::ensureAttr(const QualifiedName& name)
3295 { 3295 {
3296 RefPtrWillBeRawPtr<Attr> attrNode = attrIfExists(name); 3296 RawPtr<Attr> attrNode = attrIfExists(name);
3297 if (!attrNode) { 3297 if (!attrNode) {
3298 attrNode = Attr::create(*this, name); 3298 attrNode = Attr::create(*this, name);
3299 treeScope().adoptIfNeeded(*attrNode); 3299 treeScope().adoptIfNeeded(*attrNode);
3300 ensureAttrNodeList().append(attrNode); 3300 ensureAttrNodeList().append(attrNode);
3301 } 3301 }
3302 return attrNode.release(); 3302 return attrNode.release();
3303 } 3303 }
3304 3304
3305 void Element::detachAttrNodeFromElementWithValue(Attr* attrNode, const AtomicStr ing& value) 3305 void Element::detachAttrNodeFromElementWithValue(Attr* attrNode, const AtomicStr ing& value)
3306 { 3306 {
3307 ASSERT(attrNodeList()); 3307 ASSERT(attrNodeList());
3308 attrNode->detachFromElementWithValue(value); 3308 attrNode->detachFromElementWithValue(value);
3309 3309
3310 AttrNodeList* list = attrNodeList(); 3310 AttrNodeList* list = attrNodeList();
3311 size_t index = list->find(attrNode); 3311 size_t index = list->find(attrNode);
3312 ASSERT(index != kNotFound); 3312 ASSERT(index != kNotFound);
3313 list->remove(index); 3313 list->remove(index);
3314 if (list->isEmpty()) 3314 if (list->isEmpty())
3315 removeAttrNodeList(); 3315 removeAttrNodeList();
3316 } 3316 }
3317 3317
3318 void Element::detachAllAttrNodesFromElement() 3318 void Element::detachAllAttrNodesFromElement()
3319 { 3319 {
3320 AttrNodeList* list = this->attrNodeList(); 3320 AttrNodeList* list = this->attrNodeList();
3321 if (!list) 3321 if (!list)
3322 return; 3322 return;
3323 3323
3324 AttributeCollection attributes = elementData()->attributes(); 3324 AttributeCollection attributes = elementData()->attributes();
3325 for (const Attribute& attr : attributes) { 3325 for (const Attribute& attr : attributes) {
3326 if (RefPtrWillBeRawPtr<Attr> attrNode = attrIfExists(attr.name())) 3326 if (RawPtr<Attr> attrNode = attrIfExists(attr.name()))
3327 attrNode->detachFromElementWithValue(attr.value()); 3327 attrNode->detachFromElementWithValue(attr.value());
3328 } 3328 }
3329 3329
3330 removeAttrNodeList(); 3330 removeAttrNodeList();
3331 } 3331 }
3332 3332
3333 void Element::willRecalcStyle(StyleRecalcChange) 3333 void Element::willRecalcStyle(StyleRecalcChange)
3334 { 3334 {
3335 ASSERT(hasCustomStyleCallbacks()); 3335 ASSERT(hasCustomStyleCallbacks());
3336 } 3336 }
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
3423 CSSStyleDeclaration* Element::style() 3423 CSSStyleDeclaration* Element::style()
3424 { 3424 {
3425 if (!isStyledElement()) 3425 if (!isStyledElement())
3426 return nullptr; 3426 return nullptr;
3427 return &ensureElementRareData().ensureInlineCSSStyleDeclaration(this); 3427 return &ensureElementRareData().ensureInlineCSSStyleDeclaration(this);
3428 } 3428 }
3429 3429
3430 MutableStylePropertySet& Element::ensureMutableInlineStyle() 3430 MutableStylePropertySet& Element::ensureMutableInlineStyle()
3431 { 3431 {
3432 ASSERT(isStyledElement()); 3432 ASSERT(isStyledElement());
3433 RefPtrWillBeMember<StylePropertySet>& inlineStyle = ensureUniqueElementData( ).m_inlineStyle; 3433 Member<StylePropertySet>& inlineStyle = ensureUniqueElementData().m_inlineSt yle;
3434 if (!inlineStyle) { 3434 if (!inlineStyle) {
3435 CSSParserMode mode = (!isHTMLElement() || document().inQuirksMode()) ? H TMLQuirksMode : HTMLStandardMode; 3435 CSSParserMode mode = (!isHTMLElement() || document().inQuirksMode()) ? H TMLQuirksMode : HTMLStandardMode;
3436 inlineStyle = MutableStylePropertySet::create(mode); 3436 inlineStyle = MutableStylePropertySet::create(mode);
3437 } else if (!inlineStyle->isMutable()) { 3437 } else if (!inlineStyle->isMutable()) {
3438 inlineStyle = inlineStyle->mutableCopy(); 3438 inlineStyle = inlineStyle->mutableCopy();
3439 } 3439 }
3440 return *toMutableStylePropertySet(inlineStyle); 3440 return *toMutableStylePropertySet(inlineStyle);
3441 } 3441 }
3442 3442
3443 void Element::clearMutableInlineStyleIfEmpty() 3443 void Element::clearMutableInlineStyleIfEmpty()
3444 { 3444 {
3445 if (ensureMutableInlineStyle().isEmpty()) { 3445 if (ensureMutableInlineStyle().isEmpty()) {
3446 ensureUniqueElementData().m_inlineStyle.clear(); 3446 ensureUniqueElementData().m_inlineStyle.clear();
3447 } 3447 }
3448 } 3448 }
3449 3449
3450 inline void Element::setInlineStyleFromString(const AtomicString& newStyleString ) 3450 inline void Element::setInlineStyleFromString(const AtomicString& newStyleString )
3451 { 3451 {
3452 ASSERT(isStyledElement()); 3452 ASSERT(isStyledElement());
3453 RefPtrWillBeMember<StylePropertySet>& inlineStyle = elementData()->m_inlineS tyle; 3453 Member<StylePropertySet>& inlineStyle = elementData()->m_inlineStyle;
3454 3454
3455 // Avoid redundant work if we're using shared attribute data with already pa rsed inline style. 3455 // Avoid redundant work if we're using shared attribute data with already pa rsed inline style.
3456 if (inlineStyle && !elementData()->isUnique()) 3456 if (inlineStyle && !elementData()->isUnique())
3457 return; 3457 return;
3458 3458
3459 // We reconstruct the property set instead of mutating if there is no CSSOM wrapper. 3459 // We reconstruct the property set instead of mutating if there is no CSSOM wrapper.
3460 // This makes wrapperless property sets immutable and so cacheable. 3460 // This makes wrapperless property sets immutable and so cacheable.
3461 if (inlineStyle && !inlineStyle->isMutable()) 3461 if (inlineStyle && !inlineStyle->isMutable())
3462 inlineStyle.clear(); 3462 inlineStyle.clear();
3463 3463
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
3562 ASSERT(isStyledElement()); 3562 ASSERT(isStyledElement());
3563 style->setProperty(propertyID, cssValuePool().createValue(value, unit)); 3563 style->setProperty(propertyID, cssValuePool().createValue(value, unit));
3564 } 3564 }
3565 3565
3566 void Element::addPropertyToPresentationAttributeStyle(MutableStylePropertySet* s tyle, CSSPropertyID propertyID, const String& value) 3566 void Element::addPropertyToPresentationAttributeStyle(MutableStylePropertySet* s tyle, CSSPropertyID propertyID, const String& value)
3567 { 3567 {
3568 ASSERT(isStyledElement()); 3568 ASSERT(isStyledElement());
3569 style->setProperty(propertyID, value, false); 3569 style->setProperty(propertyID, value, false);
3570 } 3570 }
3571 3571
3572 void Element::addPropertyToPresentationAttributeStyle(MutableStylePropertySet* style, CSSPropertyID propertyID, PassRefPtrWillBeRawPtr<CSSValue> value) 3572 void Element::addPropertyToPresentationAttributeStyle(MutableStylePropertySet* style, CSSPropertyID propertyID, RawPtr<CSSValue> value)
3573 { 3573 {
3574 ASSERT(isStyledElement()); 3574 ASSERT(isStyledElement());
3575 style->setProperty(propertyID, value); 3575 style->setProperty(propertyID, value);
3576 } 3576 }
3577 3577
3578 bool Element::supportsStyleSharing() const 3578 bool Element::supportsStyleSharing() const
3579 { 3579 {
3580 if (!isStyledElement() || !parentOrShadowHostElement()) 3580 if (!isStyledElement() || !parentOrShadowHostElement())
3581 return false; 3581 return false;
3582 // If the element has inline style it is probably unique. 3582 // If the element has inline style it is probably unique.
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
3670 { 3670 {
3671 #if ENABLE(OILPAN) 3671 #if ENABLE(OILPAN)
3672 if (hasRareData()) 3672 if (hasRareData())
3673 visitor->trace(elementRareData()); 3673 visitor->trace(elementRareData());
3674 visitor->trace(m_elementData); 3674 visitor->trace(m_elementData);
3675 #endif 3675 #endif
3676 ContainerNode::trace(visitor); 3676 ContainerNode::trace(visitor);
3677 } 3677 }
3678 3678
3679 } // namespace blink 3679 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/Element.h ('k') | third_party/WebKit/Source/core/dom/ElementData.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698