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

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, 10 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 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 return *scrollCustomizationCallbacks; 151 return *scrollCustomizationCallbacks;
152 } 152 }
153 153
154 } // namespace 154 } // namespace
155 155
156 using namespace HTMLNames; 156 using namespace HTMLNames;
157 using namespace XMLNames; 157 using namespace XMLNames;
158 158
159 enum class ClassStringContent { Empty, WhiteSpaceOnly, HasClasses }; 159 enum class ClassStringContent { Empty, WhiteSpaceOnly, HasClasses };
160 160
161 PassRefPtrWillBeRawPtr<Element> Element::create(const QualifiedName& tagName, Do cument* document) 161 RawPtr<Element> Element::create(const QualifiedName& tagName, Document* document )
162 { 162 {
163 return adoptRefWillBeNoop(new Element(tagName, document, CreateElement)); 163 return (new Element(tagName, document, CreateElement));
164 } 164 }
165 165
166 Element::Element(const QualifiedName& tagName, Document* document, ConstructionT ype type) 166 Element::Element(const QualifiedName& tagName, Document* document, ConstructionT ype type)
167 : ContainerNode(document, type) 167 : ContainerNode(document, type)
168 , m_tagName(tagName) 168 , m_tagName(tagName)
169 { 169 {
170 } 170 }
171 171
172 Element::~Element() 172 Element::~Element()
173 { 173 {
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 const HTMLCanvasElement* canvas = Traversal<HTMLCanvasElement>::firstAnc estorOrSelf(*this); 256 const HTMLCanvasElement* canvas = Traversal<HTMLCanvasElement>::firstAnc estorOrSelf(*this);
257 ASSERT(canvas); 257 ASSERT(canvas);
258 return canvas->layoutObject() && canvas->layoutObject()->style()->visibi lity() == VISIBLE; 258 return canvas->layoutObject() && canvas->layoutObject()->style()->visibi lity() == VISIBLE;
259 } 259 }
260 260
261 // FIXME: Even if we are not visible, we might have a child that is visible. 261 // FIXME: Even if we are not visible, we might have a child that is visible.
262 // Hyatt wants to fix that some day with a "has visible content" flag or the like. 262 // Hyatt wants to fix that some day with a "has visible content" flag or the like.
263 return layoutObject() && layoutObject()->style()->visibility() == VISIBLE; 263 return layoutObject() && layoutObject()->style()->visibility() == VISIBLE;
264 } 264 }
265 265
266 PassRefPtrWillBeRawPtr<Node> Element::cloneNode(bool deep) 266 RawPtr<Node> Element::cloneNode(bool deep)
267 { 267 {
268 return deep ? cloneElementWithChildren() : cloneElementWithoutChildren(); 268 return deep ? cloneElementWithChildren() : cloneElementWithoutChildren();
269 } 269 }
270 270
271 PassRefPtrWillBeRawPtr<Element> Element::cloneElementWithChildren() 271 RawPtr<Element> Element::cloneElementWithChildren()
272 { 272 {
273 RefPtrWillBeRawPtr<Element> clone = cloneElementWithoutChildren(); 273 RawPtr<Element> clone = cloneElementWithoutChildren();
274 cloneChildNodes(clone.get()); 274 cloneChildNodes(clone.get());
275 return clone.release(); 275 return clone.release();
276 } 276 }
277 277
278 PassRefPtrWillBeRawPtr<Element> Element::cloneElementWithoutChildren() 278 RawPtr<Element> Element::cloneElementWithoutChildren()
279 { 279 {
280 RefPtrWillBeRawPtr<Element> clone = cloneElementWithoutAttributesAndChildren (); 280 RawPtr<Element> clone = cloneElementWithoutAttributesAndChildren();
281 // This will catch HTML elements in the wrong namespace that are not correct ly copied. 281 // This will catch HTML elements in the wrong namespace that are not correct ly copied.
282 // This is a sanity check as HTML overloads some of the DOM methods. 282 // This is a sanity check as HTML overloads some of the DOM methods.
283 ASSERT(isHTMLElement() == clone->isHTMLElement()); 283 ASSERT(isHTMLElement() == clone->isHTMLElement());
284 284
285 clone->cloneDataFromElement(*this); 285 clone->cloneDataFromElement(*this);
286 return clone.release(); 286 return clone.release();
287 } 287 }
288 288
289 PassRefPtrWillBeRawPtr<Element> Element::cloneElementWithoutAttributesAndChildre n() 289 RawPtr<Element> Element::cloneElementWithoutAttributesAndChildren()
290 { 290 {
291 return document().createElement(tagQName(), false); 291 return document().createElement(tagQName(), false);
292 } 292 }
293 293
294 PassRefPtrWillBeRawPtr<Attr> Element::detachAttribute(size_t index) 294 RawPtr<Attr> Element::detachAttribute(size_t index)
295 { 295 {
296 ASSERT(elementData()); 296 ASSERT(elementData());
297 const Attribute& attribute = elementData()->attributes().at(index); 297 const Attribute& attribute = elementData()->attributes().at(index);
298 RefPtrWillBeRawPtr<Attr> attrNode = attrIfExists(attribute.name()); 298 RawPtr<Attr> attrNode = attrIfExists(attribute.name());
299 if (attrNode) { 299 if (attrNode) {
300 detachAttrNodeAtIndex(attrNode.get(), index); 300 detachAttrNodeAtIndex(attrNode.get(), index);
301 } else { 301 } else {
302 attrNode = Attr::create(document(), attribute.name(), attribute.value()) ; 302 attrNode = Attr::create(document(), attribute.name(), attribute.value()) ;
303 removeAttributeInternal(index, NotInSynchronizationOfLazyAttribute); 303 removeAttributeInternal(index, NotInSynchronizationOfLazyAttribute);
304 } 304 }
305 return attrNode.release(); 305 return attrNode.release();
306 } 306 }
307 307
308 void Element::detachAttrNodeAtIndex(Attr* attr, size_t index) 308 void Element::detachAttrNodeAtIndex(Attr* attr, size_t index)
(...skipping 1565 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 ShadowRoot* root = shadowRoot(); 1902 ShadowRoot* root = shadowRoot();
1903 if (root && (root->type() == ShadowRootType::Open || root->type() == ShadowR ootType::Closed)) { 1903 if (root && (root->type() == ShadowRootType::Open || root->type() == ShadowR ootType::Closed)) {
1904 exceptionState.throwDOMException(InvalidStateError, "Shadow root cannot be created on a host which already hosts this type of shadow tree."); 1904 exceptionState.throwDOMException(InvalidStateError, "Shadow root cannot be created on a host which already hosts this type of shadow tree.");
1905 return nullptr; 1905 return nullptr;
1906 } 1906 }
1907 return createShadowRootInternal(ShadowRootType::V0, exceptionState); 1907 return createShadowRootInternal(ShadowRootType::V0, exceptionState);
1908 } 1908 }
1909 1909
1910 PassRefPtrWillBeRawPtr<ShadowRoot> Element::attachShadow(const ScriptState* scri ptState, const ShadowRootInit& shadowRootInitDict, ExceptionState& exceptionStat e) 1910 RawPtr<ShadowRoot> Element::attachShadow(const ScriptState* scriptState, const S hadowRootInit& shadowRootInitDict, ExceptionState& exceptionState)
1911 { 1911 {
1912 ASSERT(RuntimeEnabledFeatures::shadowDOMV1Enabled()); 1912 ASSERT(RuntimeEnabledFeatures::shadowDOMV1Enabled());
1913 1913
1914 OriginsUsingFeatures::countMainWorldOnly(scriptState, document(), OriginsUsi ngFeatures::Feature::ElementAttachShadow); 1914 OriginsUsingFeatures::countMainWorldOnly(scriptState, document(), OriginsUsi ngFeatures::Feature::ElementAttachShadow);
1915 1915
1916 if (shadowRootInitDict.hasMode() && shadowRoot()) { 1916 if (shadowRootInitDict.hasMode() && shadowRoot()) {
1917 exceptionState.throwDOMException(InvalidStateError, "Shadow root cannot be created on a host which already hosts a shadow tree."); 1917 exceptionState.throwDOMException(InvalidStateError, "Shadow root cannot be created on a host which already hosts a shadow tree.");
1918 return nullptr; 1918 return nullptr;
1919 } 1919 }
1920 1920
1921 ShadowRootType type = ShadowRootType::V0; 1921 ShadowRootType type = ShadowRootType::V0;
1922 if (shadowRootInitDict.hasMode()) 1922 if (shadowRootInitDict.hasMode())
1923 type = shadowRootInitDict.mode() == "open" ? ShadowRootType::Open : Shad owRootType::Closed; 1923 type = shadowRootInitDict.mode() == "open" ? ShadowRootType::Open : Shad owRootType::Closed;
1924 1924
1925 if (type == ShadowRootType::Closed) 1925 if (type == ShadowRootType::Closed)
1926 UseCounter::count(document(), UseCounter::ElementAttachShadowClosed); 1926 UseCounter::count(document(), UseCounter::ElementAttachShadowClosed);
1927 else if (type == ShadowRootType::Open) 1927 else if (type == ShadowRootType::Open)
1928 UseCounter::count(document(), UseCounter::ElementAttachShadowOpen); 1928 UseCounter::count(document(), UseCounter::ElementAttachShadowOpen);
1929 1929
1930 RefPtrWillBeRawPtr<ShadowRoot> shadowRoot = createShadowRootInternal(type, e xceptionState); 1930 RawPtr<ShadowRoot> shadowRoot = createShadowRootInternal(type, exceptionStat e);
1931 1931
1932 if (shadowRootInitDict.hasDelegatesFocus()) 1932 if (shadowRootInitDict.hasDelegatesFocus())
1933 shadowRoot->setDelegatesFocus(shadowRootInitDict.delegatesFocus()); 1933 shadowRoot->setDelegatesFocus(shadowRootInitDict.delegatesFocus());
1934 1934
1935 return shadowRoot.release(); 1935 return shadowRoot.release();
1936 } 1936 }
1937 1937
1938 PassRefPtrWillBeRawPtr<ShadowRoot> Element::createShadowRootInternal(ShadowRootT ype type, ExceptionState& exceptionState) 1938 RawPtr<ShadowRoot> Element::createShadowRootInternal(ShadowRootType type, Except ionState& exceptionState)
1939 { 1939 {
1940 ASSERT(!closedShadowRoot()); 1940 ASSERT(!closedShadowRoot());
1941 1941
1942 if (alwaysCreateUserAgentShadowRoot()) 1942 if (alwaysCreateUserAgentShadowRoot())
1943 ensureUserAgentShadowRoot(); 1943 ensureUserAgentShadowRoot();
1944 1944
1945 // Some elements make assumptions about what kind of layoutObjects they allo w 1945 // Some elements make assumptions about what kind of layoutObjects they allo w
1946 // as children so we can't allow author shadows on them for now. An override 1946 // as children so we can't allow author shadows on them for now. An override
1947 // flag is provided for testing how author shadows interact on these element s. 1947 // flag is provided for testing how author shadows interact on these element s.
1948 if (!areAuthorShadowsAllowed() && !RuntimeEnabledFeatures::authorShadowDOMFo rAnyElementEnabled()) { 1948 if (!areAuthorShadowsAllowed() && !RuntimeEnabledFeatures::authorShadowDOMFo rAnyElementEnabled()) {
1949 exceptionState.throwDOMException(HierarchyRequestError, "Author-created shadow roots are disabled for this element."); 1949 exceptionState.throwDOMException(HierarchyRequestError, "Author-created shadow roots are disabled for this element.");
1950 return nullptr; 1950 return nullptr;
1951 } 1951 }
1952 1952
1953 return PassRefPtrWillBeRawPtr<ShadowRoot>(ensureShadow().addShadowRoot(*this , type)); 1953 return RawPtr<ShadowRoot>(ensureShadow().addShadowRoot(*this, type));
1954 } 1954 }
1955 1955
1956 ShadowRoot* Element::shadowRoot() const 1956 ShadowRoot* Element::shadowRoot() const
1957 { 1957 {
1958 ElementShadow* elementShadow = shadow(); 1958 ElementShadow* elementShadow = shadow();
1959 if (!elementShadow) 1959 if (!elementShadow)
1960 return nullptr; 1960 return nullptr;
1961 return &elementShadow->youngestShadowRoot(); 1961 return &elementShadow->youngestShadowRoot();
1962 } 1962 }
1963 1963
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
2093 return ensureElementRareData().ensureAttrNodeList(); 2093 return ensureElementRareData().ensureAttrNodeList();
2094 } 2094 }
2095 2095
2096 void Element::removeAttrNodeList() 2096 void Element::removeAttrNodeList()
2097 { 2097 {
2098 ASSERT(attrNodeList()); 2098 ASSERT(attrNodeList());
2099 if (hasRareData()) 2099 if (hasRareData())
2100 elementRareData()->removeAttrNodeList(); 2100 elementRareData()->removeAttrNodeList();
2101 } 2101 }
2102 2102
2103 PassRefPtrWillBeRawPtr<Attr> Element::setAttributeNode(Attr* attrNode, Exception State& exceptionState) 2103 RawPtr<Attr> Element::setAttributeNode(Attr* attrNode, ExceptionState& exception State)
2104 { 2104 {
2105 RefPtrWillBeRawPtr<Attr> oldAttrNode = attrIfExists(attrNode->qualifiedName( )); 2105 RawPtr<Attr> oldAttrNode = attrIfExists(attrNode->qualifiedName());
2106 if (oldAttrNode.get() == attrNode) 2106 if (oldAttrNode.get() == attrNode)
2107 return attrNode; // This Attr is already attached to the element. 2107 return attrNode; // This Attr is already attached to the element.
2108 2108
2109 // InUseAttributeError: Raised if node is an Attr that is already an attribu te of another Element object. 2109 // InUseAttributeError: Raised if node is an Attr that is already an attribu te of another Element object.
2110 // The DOM user must explicitly clone Attr nodes to re-use them in other ele ments. 2110 // The DOM user must explicitly clone Attr nodes to re-use them in other ele ments.
2111 if (attrNode->ownerElement()) { 2111 if (attrNode->ownerElement()) {
2112 exceptionState.throwDOMException(InUseAttributeError, "The node provided is an attribute node that is already an attribute of another Element; attribute nodes must be explicitly cloned."); 2112 exceptionState.throwDOMException(InUseAttributeError, "The node provided is an attribute node that is already an attribute of another Element; attribute nodes must be explicitly cloned.");
2113 return nullptr; 2113 return nullptr;
2114 } 2114 }
2115 2115
(...skipping 29 matching lines...) Expand all
2145 2145
2146 setAttributeInternal(index, attrNode->qualifiedName(), attrNode->value(), No tInSynchronizationOfLazyAttribute); 2146 setAttributeInternal(index, attrNode->qualifiedName(), attrNode->value(), No tInSynchronizationOfLazyAttribute);
2147 2147
2148 attrNode->attachToElement(this, localName); 2148 attrNode->attachToElement(this, localName);
2149 treeScope().adoptIfNeeded(*attrNode); 2149 treeScope().adoptIfNeeded(*attrNode);
2150 ensureAttrNodeList().append(attrNode); 2150 ensureAttrNodeList().append(attrNode);
2151 2151
2152 return oldAttrNode.release(); 2152 return oldAttrNode.release();
2153 } 2153 }
2154 2154
2155 PassRefPtrWillBeRawPtr<Attr> Element::setAttributeNodeNS(Attr* attr, ExceptionSt ate& exceptionState) 2155 RawPtr<Attr> Element::setAttributeNodeNS(Attr* attr, ExceptionState& exceptionSt ate)
2156 { 2156 {
2157 return setAttributeNode(attr, exceptionState); 2157 return setAttributeNode(attr, exceptionState);
2158 } 2158 }
2159 2159
2160 PassRefPtrWillBeRawPtr<Attr> Element::removeAttributeNode(Attr* attr, ExceptionS tate& exceptionState) 2160 RawPtr<Attr> Element::removeAttributeNode(Attr* attr, ExceptionState& exceptionS tate)
2161 { 2161 {
2162 if (attr->ownerElement() != this) { 2162 if (attr->ownerElement() != this) {
2163 exceptionState.throwDOMException(NotFoundError, "The node provided is ow ned by another element."); 2163 exceptionState.throwDOMException(NotFoundError, "The node provided is ow ned by another element.");
2164 return nullptr; 2164 return nullptr;
2165 } 2165 }
2166 2166
2167 ASSERT(document() == attr->document()); 2167 ASSERT(document() == attr->document());
2168 2168
2169 synchronizeAttribute(attr->qualifiedName()); 2169 synchronizeAttribute(attr->qualifiedName());
2170 2170
2171 size_t index = elementData()->attributes().findIndex(attr->qualifiedName()); 2171 size_t index = elementData()->attributes().findIndex(attr->qualifiedName());
2172 if (index == kNotFound) { 2172 if (index == kNotFound) {
2173 exceptionState.throwDOMException(NotFoundError, "The attribute was not f ound on this element."); 2173 exceptionState.throwDOMException(NotFoundError, "The attribute was not f ound on this element.");
2174 return nullptr; 2174 return nullptr;
2175 } 2175 }
2176 2176
2177 RefPtrWillBeRawPtr<Attr> guard(attr); 2177 RawPtr<Attr> guard(attr);
2178 detachAttrNodeAtIndex(attr, index); 2178 detachAttrNodeAtIndex(attr, index);
2179 return guard.release(); 2179 return guard.release();
2180 } 2180 }
2181 2181
2182 void Element::parseAttribute(const QualifiedName& name, const AtomicString&, con st AtomicString& value) 2182 void Element::parseAttribute(const QualifiedName& name, const AtomicString&, con st AtomicString& value)
2183 { 2183 {
2184 if (name == tabindexAttr) { 2184 if (name == tabindexAttr) {
2185 int tabindex = 0; 2185 int tabindex = 0;
2186 if (value.isEmpty()) { 2186 if (value.isEmpty()) {
2187 clearTabIndexExplicitlyIfNeeded(); 2187 clearTabIndexExplicitlyIfNeeded();
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
2231 ASSERT_WITH_SECURITY_IMPLICATION(index < attributes.size()); 2231 ASSERT_WITH_SECURITY_IMPLICATION(index < attributes.size());
2232 2232
2233 QualifiedName name = attributes[index].name(); 2233 QualifiedName name = attributes[index].name();
2234 AtomicString valueBeingRemoved = attributes[index].value(); 2234 AtomicString valueBeingRemoved = attributes[index].value();
2235 2235
2236 if (!inSynchronizationOfLazyAttribute) { 2236 if (!inSynchronizationOfLazyAttribute) {
2237 if (!valueBeingRemoved.isNull()) 2237 if (!valueBeingRemoved.isNull())
2238 willModifyAttribute(name, valueBeingRemoved, nullAtom); 2238 willModifyAttribute(name, valueBeingRemoved, nullAtom);
2239 } 2239 }
2240 2240
2241 if (RefPtrWillBeRawPtr<Attr> attrNode = attrIfExists(name)) 2241 if (RawPtr<Attr> attrNode = attrIfExists(name))
2242 detachAttrNodeFromElementWithValue(attrNode.get(), attributes[index].val ue()); 2242 detachAttrNodeFromElementWithValue(attrNode.get(), attributes[index].val ue());
2243 2243
2244 attributes.remove(index); 2244 attributes.remove(index);
2245 2245
2246 if (!inSynchronizationOfLazyAttribute) 2246 if (!inSynchronizationOfLazyAttribute)
2247 didRemoveAttribute(name, valueBeingRemoved); 2247 didRemoveAttribute(name, valueBeingRemoved);
2248 } 2248 }
2249 2249
2250 void Element::appendAttributeInternal(const QualifiedName& name, const AtomicStr ing& value, SynchronizationOfLazyAttribute inSynchronizationOfLazyAttribute) 2250 void Element::appendAttributeInternal(const QualifiedName& name, const AtomicStr ing& value, SynchronizationOfLazyAttribute inSynchronizationOfLazyAttribute)
2251 { 2251 {
(...skipping 18 matching lines...) Expand all
2270 } 2270 }
2271 2271
2272 removeAttributeInternal(index, NotInSynchronizationOfLazyAttribute); 2272 removeAttributeInternal(index, NotInSynchronizationOfLazyAttribute);
2273 } 2273 }
2274 2274
2275 void Element::removeAttributeNS(const AtomicString& namespaceURI, const AtomicSt ring& localName) 2275 void Element::removeAttributeNS(const AtomicString& namespaceURI, const AtomicSt ring& localName)
2276 { 2276 {
2277 removeAttribute(QualifiedName(nullAtom, localName, namespaceURI)); 2277 removeAttribute(QualifiedName(nullAtom, localName, namespaceURI));
2278 } 2278 }
2279 2279
2280 PassRefPtrWillBeRawPtr<Attr> Element::getAttributeNode(const AtomicString& local Name) 2280 RawPtr<Attr> Element::getAttributeNode(const AtomicString& localName)
2281 { 2281 {
2282 if (!elementData()) 2282 if (!elementData())
2283 return nullptr; 2283 return nullptr;
2284 synchronizeAttribute(localName); 2284 synchronizeAttribute(localName);
2285 const Attribute* attribute = elementData()->attributes().find(localName, sho uldIgnoreAttributeCase()); 2285 const Attribute* attribute = elementData()->attributes().find(localName, sho uldIgnoreAttributeCase());
2286 if (!attribute) 2286 if (!attribute)
2287 return nullptr; 2287 return nullptr;
2288 return ensureAttr(attribute->name()); 2288 return ensureAttr(attribute->name());
2289 } 2289 }
2290 2290
2291 PassRefPtrWillBeRawPtr<Attr> Element::getAttributeNodeNS(const AtomicString& nam espaceURI, const AtomicString& localName) 2291 RawPtr<Attr> Element::getAttributeNodeNS(const AtomicString& namespaceURI, const AtomicString& localName)
2292 { 2292 {
2293 if (!elementData()) 2293 if (!elementData())
2294 return nullptr; 2294 return nullptr;
2295 QualifiedName qName(nullAtom, localName, namespaceURI); 2295 QualifiedName qName(nullAtom, localName, namespaceURI);
2296 synchronizeAttribute(qName); 2296 synchronizeAttribute(qName);
2297 const Attribute* attribute = elementData()->attributes().find(qName); 2297 const Attribute* attribute = elementData()->attributes().find(qName);
2298 if (!attribute) 2298 if (!attribute)
2299 return nullptr; 2299 return nullptr;
2300 return ensureAttr(attribute->name()); 2300 return ensureAttr(attribute->name());
2301 } 2301 }
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
2337 return; 2337 return;
2338 2338
2339 // Slide the focus to its inner node. 2339 // Slide the focus to its inner node.
2340 Element* next = document().page()->focusController().findFocusableElemen t(WebFocusTypeForward, *this); 2340 Element* next = document().page()->focusController().findFocusableElemen t(WebFocusTypeForward, *this);
2341 if (next && containsIncludingShadowDOM(next)) { 2341 if (next && containsIncludingShadowDOM(next)) {
2342 next->focus(FocusParams(SelectionBehaviorOnFocus::Reset, WebFocusTyp eForward, nullptr)); 2342 next->focus(FocusParams(SelectionBehaviorOnFocus::Reset, WebFocusTyp eForward, nullptr));
2343 return; 2343 return;
2344 } 2344 }
2345 } 2345 }
2346 2346
2347 RefPtrWillBeRawPtr<Node> protect(this); 2347 RawPtr<Node> protect(this);
2348 if (!document().page()->focusController().setFocusedElement(this, document() .frame(), params)) 2348 if (!document().page()->focusController().setFocusedElement(this, document() .frame(), params))
2349 return; 2349 return;
2350 2350
2351 if (document().focusedElement() == this && UserGestureIndicator::processedUs erGestureSinceLoad()) { 2351 if (document().focusedElement() == this && UserGestureIndicator::processedUs erGestureSinceLoad()) {
2352 // Bring up the keyboard in the context of anything triggered by a user 2352 // Bring up the keyboard in the context of anything triggered by a user
2353 // gesture. Since tracking that across arbitrary boundaries (eg. 2353 // gesture. Since tracking that across arbitrary boundaries (eg.
2354 // animations) is difficult, for now we match IE's heuristic and bring 2354 // animations) is difficult, for now we match IE's heuristic and bring
2355 // up the keyboard if there's been any gesture since load. 2355 // up the keyboard if there's been any gesture since load.
2356 document().page()->chromeClient().showImeIfNeeded(); 2356 document().page()->chromeClient().showImeIfNeeded();
2357 } 2357 }
2358 } 2358 }
2359 2359
2360 void Element::updateFocusAppearance(SelectionBehaviorOnFocus selectionBehavior) 2360 void Element::updateFocusAppearance(SelectionBehaviorOnFocus selectionBehavior)
2361 { 2361 {
2362 if (selectionBehavior == SelectionBehaviorOnFocus::None) 2362 if (selectionBehavior == SelectionBehaviorOnFocus::None)
2363 return; 2363 return;
2364 if (isRootEditableElement()) { 2364 if (isRootEditableElement()) {
2365 // Taking the ownership since setSelection() may release the last refere nce to |frame|. 2365 // Taking the ownership since setSelection() may release the last refere nce to |frame|.
2366 RefPtrWillBeRawPtr<LocalFrame> frame(document().frame()); 2366 RawPtr<LocalFrame> frame(document().frame());
2367 if (!frame) 2367 if (!frame)
2368 return; 2368 return;
2369 2369
2370 // When focusing an editable element in an iframe, don't reset the selec tion if it already contains a selection. 2370 // When focusing an editable element in an iframe, don't reset the selec tion if it already contains a selection.
2371 if (this == frame->selection().rootEditableElement()) 2371 if (this == frame->selection().rootEditableElement())
2372 return; 2372 return;
2373 2373
2374 // FIXME: We should restore the previous selection if there is one. 2374 // FIXME: We should restore the previous selection if there is one.
2375 VisibleSelection newSelection = VisibleSelection(firstPositionInOrBefore Node(this), TextAffinity::Downstream); 2375 VisibleSelection newSelection = VisibleSelection(firstPositionInOrBefore Node(this), TextAffinity::Downstream);
2376 // Passing DoNotSetFocus as this function is called after FocusControlle r::setFocusedElement() 2376 // Passing DoNotSetFocus as this function is called after FocusControlle r::setFocusedElement()
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
2486 2486
2487 String Element::outerHTML() const 2487 String Element::outerHTML() const
2488 { 2488 {
2489 return createMarkup(this); 2489 return createMarkup(this);
2490 } 2490 }
2491 2491
2492 void Element::setInnerHTML(const String& html, ExceptionState& exceptionState) 2492 void Element::setInnerHTML(const String& html, ExceptionState& exceptionState)
2493 { 2493 {
2494 InspectorInstrumentation::willSetInnerHTML(this); 2494 InspectorInstrumentation::willSetInnerHTML(this);
2495 2495
2496 if (RefPtrWillBeRawPtr<DocumentFragment> fragment = createFragmentForInnerOu terHTML(html, this, AllowScriptingContent, "innerHTML", exceptionState)) { 2496 if (RawPtr<DocumentFragment> fragment = createFragmentForInnerOuterHTML(html , this, AllowScriptingContent, "innerHTML", exceptionState)) {
2497 ContainerNode* container = this; 2497 ContainerNode* container = this;
2498 if (isHTMLTemplateElement(*this)) 2498 if (isHTMLTemplateElement(*this))
2499 container = toHTMLTemplateElement(this)->content(); 2499 container = toHTMLTemplateElement(this)->content();
2500 replaceChildrenWithFragment(container, fragment.release(), exceptionStat e); 2500 replaceChildrenWithFragment(container, fragment.release(), exceptionStat e);
2501 } 2501 }
2502 } 2502 }
2503 2503
2504 void Element::setOuterHTML(const String& html, ExceptionState& exceptionState) 2504 void Element::setOuterHTML(const String& html, ExceptionState& exceptionState)
2505 { 2505 {
2506 Node* p = parentNode(); 2506 Node* p = parentNode();
2507 if (!p) { 2507 if (!p) {
2508 exceptionState.throwDOMException(NoModificationAllowedError, "This eleme nt has no parent node."); 2508 exceptionState.throwDOMException(NoModificationAllowedError, "This eleme nt has no parent node.");
2509 return; 2509 return;
2510 } 2510 }
2511 if (!p->isElementNode()) { 2511 if (!p->isElementNode()) {
2512 exceptionState.throwDOMException(NoModificationAllowedError, "This eleme nt's parent is of type '" + p->nodeName() + "', which is not an element node."); 2512 exceptionState.throwDOMException(NoModificationAllowedError, "This eleme nt's parent is of type '" + p->nodeName() + "', which is not an element node.");
2513 return; 2513 return;
2514 } 2514 }
2515 2515
2516 RefPtrWillBeRawPtr<Element> parent = toElement(p); 2516 RawPtr<Element> parent = toElement(p);
2517 RefPtrWillBeRawPtr<Node> prev = previousSibling(); 2517 RawPtr<Node> prev = previousSibling();
2518 RefPtrWillBeRawPtr<Node> next = nextSibling(); 2518 RawPtr<Node> next = nextSibling();
2519 2519
2520 RefPtrWillBeRawPtr<DocumentFragment> fragment = createFragmentForInnerOuterH TML(html, parent.get(), AllowScriptingContent, "outerHTML", exceptionState); 2520 RawPtr<DocumentFragment> fragment = createFragmentForInnerOuterHTML(html, pa rent.get(), AllowScriptingContent, "outerHTML", exceptionState);
2521 if (exceptionState.hadException()) 2521 if (exceptionState.hadException())
2522 return; 2522 return;
2523 2523
2524 parent->replaceChild(fragment.release(), this, exceptionState); 2524 parent->replaceChild(fragment.release(), this, exceptionState);
2525 RefPtrWillBeRawPtr<Node> node = next ? next->previousSibling() : nullptr; 2525 RawPtr<Node> node = next ? next->previousSibling() : nullptr;
2526 if (!exceptionState.hadException() && node && node->isTextNode()) 2526 if (!exceptionState.hadException() && node && node->isTextNode())
2527 mergeWithNextTextNode(toText(node.get()), exceptionState); 2527 mergeWithNextTextNode(toText(node.get()), exceptionState);
2528 2528
2529 if (!exceptionState.hadException() && prev && prev->isTextNode()) 2529 if (!exceptionState.hadException() && prev && prev->isTextNode())
2530 mergeWithNextTextNode(toText(prev.get()), exceptionState); 2530 mergeWithNextTextNode(toText(prev.get()), exceptionState);
2531 } 2531 }
2532 2532
2533 Node* Element::insertAdjacent(const String& where, Node* newChild, ExceptionStat e& exceptionState) 2533 Node* Element::insertAdjacent(const String& where, Node* newChild, ExceptionStat e& exceptionState)
2534 { 2534 {
2535 if (equalIgnoringCase(where, "beforeBegin")) { 2535 if (equalIgnoringCase(where, "beforeBegin")) {
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
2599 return toElement(returnValue); 2599 return toElement(returnValue);
2600 } 2600 }
2601 2601
2602 void Element::insertAdjacentText(const String& where, const String& text, Except ionState& exceptionState) 2602 void Element::insertAdjacentText(const String& where, const String& text, Except ionState& exceptionState)
2603 { 2603 {
2604 insertAdjacent(where, document().createTextNode(text).get(), exceptionState) ; 2604 insertAdjacent(where, document().createTextNode(text).get(), exceptionState) ;
2605 } 2605 }
2606 2606
2607 void Element::insertAdjacentHTML(const String& where, const String& markup, Exce ptionState& exceptionState) 2607 void Element::insertAdjacentHTML(const String& where, const String& markup, Exce ptionState& exceptionState)
2608 { 2608 {
2609 RefPtrWillBeRawPtr<Element> contextElement = contextElementForInsertion(wher e, this, exceptionState); 2609 RawPtr<Element> contextElement = contextElementForInsertion(where, this, exc eptionState);
2610 if (!contextElement) 2610 if (!contextElement)
2611 return; 2611 return;
2612 2612
2613 RefPtrWillBeRawPtr<DocumentFragment> fragment = createFragmentForInnerOuterH TML(markup, contextElement.get(), AllowScriptingContent, "insertAdjacentHTML", e xceptionState); 2613 RawPtr<DocumentFragment> fragment = createFragmentForInnerOuterHTML(markup, contextElement.get(), AllowScriptingContent, "insertAdjacentHTML", exceptionStat e);
2614 if (!fragment) 2614 if (!fragment)
2615 return; 2615 return;
2616 insertAdjacent(where, fragment.get(), exceptionState); 2616 insertAdjacent(where, fragment.get(), exceptionState);
2617 } 2617 }
2618 2618
2619 String Element::innerText() 2619 String Element::innerText()
2620 { 2620 {
2621 // We need to update layout, since plainText uses line boxes in the layout t ree. 2621 // We need to update layout, since plainText uses line boxes in the layout t ree.
2622 document().updateLayoutIgnorePendingStylesheets(); 2622 document().updateLayoutIgnorePendingStylesheets();
2623 2623
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
2844 } 2844 }
2845 return false; 2845 return false;
2846 } 2846 }
2847 2847
2848 void Element::createPseudoElementIfNeeded(PseudoId pseudoId) 2848 void Element::createPseudoElementIfNeeded(PseudoId pseudoId)
2849 { 2849 {
2850 if (isPseudoElement()) 2850 if (isPseudoElement())
2851 return; 2851 return;
2852 2852
2853 // Document::ensureStyleResolver is not inlined and shows up on profiles, av oid it here. 2853 // Document::ensureStyleResolver is not inlined and shows up on profiles, av oid it here.
2854 RefPtrWillBeRawPtr<PseudoElement> element = document().styleEngine().ensureR esolver().createPseudoElementIfNeeded(*this, pseudoId); 2854 RawPtr<PseudoElement> element = document().styleEngine().ensureResolver().cr eatePseudoElementIfNeeded(*this, pseudoId);
2855 if (!element) 2855 if (!element)
2856 return; 2856 return;
2857 2857
2858 if (pseudoId == BACKDROP) 2858 if (pseudoId == BACKDROP)
2859 document().addToTopLayer(element.get(), this); 2859 document().addToTopLayer(element.get(), this);
2860 element->insertedInto(this); 2860 element->insertedInto(this);
2861 element->attach(); 2861 element->attach();
2862 2862
2863 InspectorInstrumentation::pseudoElementCreated(element.get()); 2863 InspectorInstrumentation::pseudoElementCreated(element.get());
2864 2864
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
3101 if (name == HTMLNames::nameAttr) { 3101 if (name == HTMLNames::nameAttr) {
3102 updateName(oldValue, newValue); 3102 updateName(oldValue, newValue);
3103 } 3103 }
3104 3104
3105 if (oldValue != newValue) { 3105 if (oldValue != newValue) {
3106 document().styleEngine().attributeChangedForElement(name, *this); 3106 document().styleEngine().attributeChangedForElement(name, *this);
3107 if (isUpgradedCustomElement()) 3107 if (isUpgradedCustomElement())
3108 CustomElement::attributeDidChange(this, name.localName(), oldValue, newValue); 3108 CustomElement::attributeDidChange(this, name.localName(), oldValue, newValue);
3109 } 3109 }
3110 3110
3111 if (OwnPtrWillBeRawPtr<MutationObserverInterestGroup> recipients = MutationO bserverInterestGroup::createForAttributesMutation(*this, name)) 3111 if (RawPtr<MutationObserverInterestGroup> recipients = MutationObserverInter estGroup::createForAttributesMutation(*this, name))
3112 recipients->enqueueMutationRecord(MutationRecord::createAttributes(this, name, oldValue)); 3112 recipients->enqueueMutationRecord(MutationRecord::createAttributes(this, name, oldValue));
3113 3113
3114 InspectorInstrumentation::willModifyDOMAttr(this, oldValue, newValue); 3114 InspectorInstrumentation::willModifyDOMAttr(this, oldValue, newValue);
3115 } 3115 }
3116 3116
3117 void Element::didAddAttribute(const QualifiedName& name, const AtomicString& val ue) 3117 void Element::didAddAttribute(const QualifiedName& name, const AtomicString& val ue)
3118 { 3118 {
3119 if (name == HTMLNames::idAttr) 3119 if (name == HTMLNames::idAttr)
3120 updateId(nullAtom, value); 3120 updateId(nullAtom, value);
3121 attributeChanged(name, nullAtom, value); 3121 attributeChanged(name, nullAtom, value);
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
3220 return hasRareData() ? elementRareData()->savedLayerScrollOffset() : IntSize (); 3220 return hasRareData() ? elementRareData()->savedLayerScrollOffset() : IntSize ();
3221 } 3221 }
3222 3222
3223 void Element::setSavedLayerScrollOffset(const IntSize& size) 3223 void Element::setSavedLayerScrollOffset(const IntSize& size)
3224 { 3224 {
3225 if (size.isZero() && !hasRareData()) 3225 if (size.isZero() && !hasRareData())
3226 return; 3226 return;
3227 ensureElementRareData().setSavedLayerScrollOffset(size); 3227 ensureElementRareData().setSavedLayerScrollOffset(size);
3228 } 3228 }
3229 3229
3230 PassRefPtrWillBeRawPtr<Attr> Element::attrIfExists(const QualifiedName& name) 3230 RawPtr<Attr> Element::attrIfExists(const QualifiedName& name)
3231 { 3231 {
3232 if (AttrNodeList* attrNodeList = this->attrNodeList()) { 3232 if (AttrNodeList* attrNodeList = this->attrNodeList()) {
3233 bool shouldIgnoreCase = shouldIgnoreAttributeCase(); 3233 bool shouldIgnoreCase = shouldIgnoreAttributeCase();
3234 for (const auto& attr : *attrNodeList) { 3234 for (const auto& attr : *attrNodeList) {
3235 if (attr->qualifiedName().matchesPossiblyIgnoringCase(name, shouldIg noreCase)) 3235 if (attr->qualifiedName().matchesPossiblyIgnoringCase(name, shouldIg noreCase))
3236 return attr.get(); 3236 return attr.get();
3237 } 3237 }
3238 } 3238 }
3239 return nullptr; 3239 return nullptr;
3240 } 3240 }
3241 3241
3242 PassRefPtrWillBeRawPtr<Attr> Element::ensureAttr(const QualifiedName& name) 3242 RawPtr<Attr> Element::ensureAttr(const QualifiedName& name)
3243 { 3243 {
3244 RefPtrWillBeRawPtr<Attr> attrNode = attrIfExists(name); 3244 RawPtr<Attr> attrNode = attrIfExists(name);
3245 if (!attrNode) { 3245 if (!attrNode) {
3246 attrNode = Attr::create(*this, name); 3246 attrNode = Attr::create(*this, name);
3247 treeScope().adoptIfNeeded(*attrNode); 3247 treeScope().adoptIfNeeded(*attrNode);
3248 ensureAttrNodeList().append(attrNode); 3248 ensureAttrNodeList().append(attrNode);
3249 } 3249 }
3250 return attrNode.release(); 3250 return attrNode.release();
3251 } 3251 }
3252 3252
3253 void Element::detachAttrNodeFromElementWithValue(Attr* attrNode, const AtomicStr ing& value) 3253 void Element::detachAttrNodeFromElementWithValue(Attr* attrNode, const AtomicStr ing& value)
3254 { 3254 {
3255 ASSERT(attrNodeList()); 3255 ASSERT(attrNodeList());
3256 attrNode->detachFromElementWithValue(value); 3256 attrNode->detachFromElementWithValue(value);
3257 3257
3258 AttrNodeList* list = attrNodeList(); 3258 AttrNodeList* list = attrNodeList();
3259 size_t index = list->find(attrNode); 3259 size_t index = list->find(attrNode);
3260 ASSERT(index != kNotFound); 3260 ASSERT(index != kNotFound);
3261 list->remove(index); 3261 list->remove(index);
3262 if (list->isEmpty()) 3262 if (list->isEmpty())
3263 removeAttrNodeList(); 3263 removeAttrNodeList();
3264 } 3264 }
3265 3265
3266 void Element::detachAllAttrNodesFromElement() 3266 void Element::detachAllAttrNodesFromElement()
3267 { 3267 {
3268 AttrNodeList* list = this->attrNodeList(); 3268 AttrNodeList* list = this->attrNodeList();
3269 if (!list) 3269 if (!list)
3270 return; 3270 return;
3271 3271
3272 AttributeCollection attributes = elementData()->attributes(); 3272 AttributeCollection attributes = elementData()->attributes();
3273 for (const Attribute& attr : attributes) { 3273 for (const Attribute& attr : attributes) {
3274 if (RefPtrWillBeRawPtr<Attr> attrNode = attrIfExists(attr.name())) 3274 if (RawPtr<Attr> attrNode = attrIfExists(attr.name()))
3275 attrNode->detachFromElementWithValue(attr.value()); 3275 attrNode->detachFromElementWithValue(attr.value());
3276 } 3276 }
3277 3277
3278 removeAttrNodeList(); 3278 removeAttrNodeList();
3279 } 3279 }
3280 3280
3281 void Element::willRecalcStyle(StyleRecalcChange) 3281 void Element::willRecalcStyle(StyleRecalcChange)
3282 { 3282 {
3283 ASSERT(hasCustomStyleCallbacks()); 3283 ASSERT(hasCustomStyleCallbacks());
3284 } 3284 }
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
3371 CSSStyleDeclaration* Element::style() 3371 CSSStyleDeclaration* Element::style()
3372 { 3372 {
3373 if (!isStyledElement()) 3373 if (!isStyledElement())
3374 return nullptr; 3374 return nullptr;
3375 return &ensureElementRareData().ensureInlineCSSStyleDeclaration(this); 3375 return &ensureElementRareData().ensureInlineCSSStyleDeclaration(this);
3376 } 3376 }
3377 3377
3378 MutableStylePropertySet& Element::ensureMutableInlineStyle() 3378 MutableStylePropertySet& Element::ensureMutableInlineStyle()
3379 { 3379 {
3380 ASSERT(isStyledElement()); 3380 ASSERT(isStyledElement());
3381 RefPtrWillBeMember<StylePropertySet>& inlineStyle = ensureUniqueElementData( ).m_inlineStyle; 3381 Member<StylePropertySet>& inlineStyle = ensureUniqueElementData().m_inlineSt yle;
3382 if (!inlineStyle) { 3382 if (!inlineStyle) {
3383 CSSParserMode mode = (!isHTMLElement() || document().inQuirksMode()) ? H TMLQuirksMode : HTMLStandardMode; 3383 CSSParserMode mode = (!isHTMLElement() || document().inQuirksMode()) ? H TMLQuirksMode : HTMLStandardMode;
3384 inlineStyle = MutableStylePropertySet::create(mode); 3384 inlineStyle = MutableStylePropertySet::create(mode);
3385 } else if (!inlineStyle->isMutable()) { 3385 } else if (!inlineStyle->isMutable()) {
3386 inlineStyle = inlineStyle->mutableCopy(); 3386 inlineStyle = inlineStyle->mutableCopy();
3387 } 3387 }
3388 return *toMutableStylePropertySet(inlineStyle); 3388 return *toMutableStylePropertySet(inlineStyle);
3389 } 3389 }
3390 3390
3391 void Element::clearMutableInlineStyleIfEmpty() 3391 void Element::clearMutableInlineStyleIfEmpty()
3392 { 3392 {
3393 if (ensureMutableInlineStyle().isEmpty()) { 3393 if (ensureMutableInlineStyle().isEmpty()) {
3394 ensureUniqueElementData().m_inlineStyle.clear(); 3394 ensureUniqueElementData().m_inlineStyle.clear();
3395 } 3395 }
3396 } 3396 }
3397 3397
3398 inline void Element::setInlineStyleFromString(const AtomicString& newStyleString ) 3398 inline void Element::setInlineStyleFromString(const AtomicString& newStyleString )
3399 { 3399 {
3400 ASSERT(isStyledElement()); 3400 ASSERT(isStyledElement());
3401 RefPtrWillBeMember<StylePropertySet>& inlineStyle = elementData()->m_inlineS tyle; 3401 Member<StylePropertySet>& inlineStyle = elementData()->m_inlineStyle;
3402 3402
3403 // Avoid redundant work if we're using shared attribute data with already pa rsed inline style. 3403 // Avoid redundant work if we're using shared attribute data with already pa rsed inline style.
3404 if (inlineStyle && !elementData()->isUnique()) 3404 if (inlineStyle && !elementData()->isUnique())
3405 return; 3405 return;
3406 3406
3407 // We reconstruct the property set instead of mutating if there is no CSSOM wrapper. 3407 // We reconstruct the property set instead of mutating if there is no CSSOM wrapper.
3408 // This makes wrapperless property sets immutable and so cacheable. 3408 // This makes wrapperless property sets immutable and so cacheable.
3409 if (inlineStyle && !inlineStyle->isMutable()) 3409 if (inlineStyle && !inlineStyle->isMutable())
3410 inlineStyle.clear(); 3410 inlineStyle.clear();
3411 3411
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
3510 ASSERT(isStyledElement()); 3510 ASSERT(isStyledElement());
3511 style->setProperty(propertyID, cssValuePool().createValue(value, unit)); 3511 style->setProperty(propertyID, cssValuePool().createValue(value, unit));
3512 } 3512 }
3513 3513
3514 void Element::addPropertyToPresentationAttributeStyle(MutableStylePropertySet* s tyle, CSSPropertyID propertyID, const String& value) 3514 void Element::addPropertyToPresentationAttributeStyle(MutableStylePropertySet* s tyle, CSSPropertyID propertyID, const String& value)
3515 { 3515 {
3516 ASSERT(isStyledElement()); 3516 ASSERT(isStyledElement());
3517 style->setProperty(propertyID, value, false); 3517 style->setProperty(propertyID, value, false);
3518 } 3518 }
3519 3519
3520 void Element::addPropertyToPresentationAttributeStyle(MutableStylePropertySet* style, CSSPropertyID propertyID, PassRefPtrWillBeRawPtr<CSSValue> value) 3520 void Element::addPropertyToPresentationAttributeStyle(MutableStylePropertySet* style, CSSPropertyID propertyID, RawPtr<CSSValue> value)
3521 { 3521 {
3522 ASSERT(isStyledElement()); 3522 ASSERT(isStyledElement());
3523 style->setProperty(propertyID, value); 3523 style->setProperty(propertyID, value);
3524 } 3524 }
3525 3525
3526 bool Element::supportsStyleSharing() const 3526 bool Element::supportsStyleSharing() const
3527 { 3527 {
3528 if (!isStyledElement() || !parentOrShadowHostElement()) 3528 if (!isStyledElement() || !parentOrShadowHostElement())
3529 return false; 3529 return false;
3530 // If the element has inline style it is probably unique. 3530 // If the element has inline style it is probably unique.
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
3618 { 3618 {
3619 #if ENABLE(OILPAN) 3619 #if ENABLE(OILPAN)
3620 if (hasRareData()) 3620 if (hasRareData())
3621 visitor->trace(elementRareData()); 3621 visitor->trace(elementRareData());
3622 visitor->trace(m_elementData); 3622 visitor->trace(m_elementData);
3623 #endif 3623 #endif
3624 ContainerNode::trace(visitor); 3624 ContainerNode::trace(visitor);
3625 } 3625 }
3626 3626
3627 } // namespace blink 3627 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698