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

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

Issue 1590193002: Partial implementation of inline StylePropertyMap. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@maps
Patch Set: Update tests 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 * Copyright (C) 2003-2011, 2013, 2014 Apple Inc. All rights reserved. 6 * Copyright (C) 2003-2011, 2013, 2014 Apple Inc. All rights reserved.
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 class MutableStylePropertySet; 61 class MutableStylePropertySet;
62 class NodeIntersectionObserverData; 62 class NodeIntersectionObserverData;
63 class PropertySetCSSStyleDeclaration; 63 class PropertySetCSSStyleDeclaration;
64 class PseudoElement; 64 class PseudoElement;
65 class ScrollState; 65 class ScrollState;
66 class ScrollStateCallback; 66 class ScrollStateCallback;
67 class ScrollToOptions; 67 class ScrollToOptions;
68 class ShadowRoot; 68 class ShadowRoot;
69 class ShadowRootInit; 69 class ShadowRootInit;
70 class StylePropertySet; 70 class StylePropertySet;
71 class StylePropertyMap;
71 72
72 enum SpellcheckAttributeState { 73 enum SpellcheckAttributeState {
73 SpellcheckAttributeTrue, 74 SpellcheckAttributeTrue,
74 SpellcheckAttributeFalse, 75 SpellcheckAttributeFalse,
75 SpellcheckAttributeDefault 76 SpellcheckAttributeDefault
76 }; 77 };
77 78
78 enum ElementFlags { 79 enum ElementFlags {
79 TabIndexWasSetExplicitly = 1 << 0, 80 TabIndexWasSetExplicitly = 1 << 0,
80 StyleAffectedByEmpty = 1 << 1, 81 StyleAffectedByEmpty = 1 << 1,
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 PassRefPtrWillBeRawPtr<Attr> setAttributeNode(Attr*, ExceptionState&); 238 PassRefPtrWillBeRawPtr<Attr> setAttributeNode(Attr*, ExceptionState&);
238 PassRefPtrWillBeRawPtr<Attr> setAttributeNodeNS(Attr*, ExceptionState&); 239 PassRefPtrWillBeRawPtr<Attr> setAttributeNodeNS(Attr*, ExceptionState&);
239 PassRefPtrWillBeRawPtr<Attr> removeAttributeNode(Attr*, ExceptionState&); 240 PassRefPtrWillBeRawPtr<Attr> removeAttributeNode(Attr*, ExceptionState&);
240 241
241 PassRefPtrWillBeRawPtr<Attr> attrIfExists(const QualifiedName&); 242 PassRefPtrWillBeRawPtr<Attr> attrIfExists(const QualifiedName&);
242 PassRefPtrWillBeRawPtr<Attr> ensureAttr(const QualifiedName&); 243 PassRefPtrWillBeRawPtr<Attr> ensureAttr(const QualifiedName&);
243 244
244 AttrNodeList* attrNodeList(); 245 AttrNodeList* attrNodeList();
245 246
246 CSSStyleDeclaration* style(); 247 CSSStyleDeclaration* style();
248 StylePropertyMap* styleMap();
247 249
248 const QualifiedName& tagQName() const { return m_tagName; } 250 const QualifiedName& tagQName() const { return m_tagName; }
249 String tagName() const { return nodeName(); } 251 String tagName() const { return nodeName(); }
250 252
251 bool hasTagName(const QualifiedName& tagName) const { return m_tagName.match es(tagName); } 253 bool hasTagName(const QualifiedName& tagName) const { return m_tagName.match es(tagName); }
252 bool hasTagName(const HTMLQualifiedName& tagName) const { return ContainerNo de::hasTagName(tagName); } 254 bool hasTagName(const HTMLQualifiedName& tagName) const { return ContainerNo de::hasTagName(tagName); }
253 bool hasTagName(const SVGQualifiedName& tagName) const { return ContainerNod e::hasTagName(tagName); } 255 bool hasTagName(const SVGQualifiedName& tagName) const { return ContainerNod e::hasTagName(tagName); }
254 256
255 // Should be called only by Document::createElementNS to fix up m_tagName im mediately after construction. 257 // Should be called only by Document::createElementNS to fix up m_tagName im mediately after construction.
256 void setTagNameForCreateElementNS(const QualifiedName&); 258 void setTagNameForCreateElementNS(const QualifiedName&);
(...skipping 18 matching lines...) Expand all
275 void setBooleanAttribute(const QualifiedName&, bool); 277 void setBooleanAttribute(const QualifiedName&, bool);
276 278
277 virtual const StylePropertySet* additionalPresentationAttributeStyle() { ret urn nullptr; } 279 virtual const StylePropertySet* additionalPresentationAttributeStyle() { ret urn nullptr; }
278 void invalidateStyleAttribute(); 280 void invalidateStyleAttribute();
279 281
280 const StylePropertySet* inlineStyle() const { return elementData() ? element Data()->m_inlineStyle.get() : nullptr; } 282 const StylePropertySet* inlineStyle() const { return elementData() ? element Data()->m_inlineStyle.get() : nullptr; }
281 283
282 bool setInlineStyleProperty(CSSPropertyID, CSSValueID identifier, bool impor tant = false); 284 bool setInlineStyleProperty(CSSPropertyID, CSSValueID identifier, bool impor tant = false);
283 bool setInlineStyleProperty(CSSPropertyID, double value, CSSPrimitiveValue:: UnitType, bool important = false); 285 bool setInlineStyleProperty(CSSPropertyID, double value, CSSPrimitiveValue:: UnitType, bool important = false);
284 bool setInlineStyleProperty(CSSPropertyID, const String& value, bool importa nt = false); 286 bool setInlineStyleProperty(CSSPropertyID, const String& value, bool importa nt = false);
287 bool setInlineStyleProperty(CSSPropertyID, const PassRefPtrWillBeRawPtr<CSSV alue>, bool important = false);
288
285 bool removeInlineStyleProperty(CSSPropertyID); 289 bool removeInlineStyleProperty(CSSPropertyID);
286 void removeAllInlineStyleProperties(); 290 void removeAllInlineStyleProperties();
287 291
288 void synchronizeStyleAttributeInternal() const; 292 void synchronizeStyleAttributeInternal() const;
289 293
290 const StylePropertySet* presentationAttributeStyle(); 294 const StylePropertySet* presentationAttributeStyle();
291 virtual bool isPresentationAttribute(const QualifiedName&) const { return fa lse; } 295 virtual bool isPresentationAttribute(const QualifiedName&) const { return fa lse; }
292 virtual void collectStyleForPresentationAttribute(const QualifiedName&, cons t AtomicString&, MutableStylePropertySet*) { } 296 virtual void collectStyleForPresentationAttribute(const QualifiedName&, cons t AtomicString&, MutableStylePropertySet*) { }
293 297
294 // For exposing to DOM only. 298 // For exposing to DOM only.
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after
696 ElementRareData& ensureElementRareData(); 700 ElementRareData& ensureElementRareData();
697 701
698 AttrNodeList& ensureAttrNodeList(); 702 AttrNodeList& ensureAttrNodeList();
699 void removeAttrNodeList(); 703 void removeAttrNodeList();
700 void detachAllAttrNodesFromElement(); 704 void detachAllAttrNodesFromElement();
701 void detachAttrNodeFromElementWithValue(Attr*, const AtomicString& value); 705 void detachAttrNodeFromElementWithValue(Attr*, const AtomicString& value);
702 void detachAttrNodeAtIndex(Attr*, size_t index); 706 void detachAttrNodeAtIndex(Attr*, size_t index);
703 707
704 v8::Local<v8::Object> wrapCustomElement(v8::Isolate*, v8::Local<v8::Object> creationContext); 708 v8::Local<v8::Object> wrapCustomElement(v8::Isolate*, v8::Local<v8::Object> creationContext);
705 709
710 void invalidateInlineStylePropertyMap();
711
706 RefPtrWillBeMember<ElementData> m_elementData; 712 RefPtrWillBeMember<ElementData> m_elementData;
707 }; 713 };
708 714
709 DEFINE_NODE_TYPE_CASTS(Element, isElementNode()); 715 DEFINE_NODE_TYPE_CASTS(Element, isElementNode());
710 template <typename T> bool isElementOfType(const Node&); 716 template <typename T> bool isElementOfType(const Node&);
711 template <> inline bool isElementOfType<const Element>(const Node& node) { retur n node.isElementNode(); } 717 template <> inline bool isElementOfType<const Element>(const Node& node) { retur n node.isElementNode(); }
712 template <typename T> inline bool isElementOfType(const Element& element) { retu rn isElementOfType<T>(static_cast<const Node&>(element)); } 718 template <typename T> inline bool isElementOfType(const Element& element) { retu rn isElementOfType<T>(static_cast<const Node&>(element)); }
713 template <> inline bool isElementOfType<const Element>(const Element&) { return true; } 719 template <> inline bool isElementOfType<const Element>(const Element&) { return true; }
714 720
715 // Type casting. 721 // Type casting.
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
862 if (isInShadowTree() && !treeScope().rootNode().isShadowRoot()) 868 if (isInShadowTree() && !treeScope().rootNode().isShadowRoot())
863 clearFlag(IsInShadowTreeFlag); 869 clearFlag(IsInShadowTreeFlag);
864 if (AXObjectCache* cache = document().existingAXObjectCache()) 870 if (AXObjectCache* cache = document().existingAXObjectCache())
865 cache->remove(this); 871 cache->remove(this);
866 } 872 }
867 873
868 inline void Element::invalidateStyleAttribute() 874 inline void Element::invalidateStyleAttribute()
869 { 875 {
870 ASSERT(elementData()); 876 ASSERT(elementData());
871 elementData()->m_styleAttributeIsDirty = true; 877 elementData()->m_styleAttributeIsDirty = true;
878 invalidateInlineStylePropertyMap();
872 } 879 }
873 880
874 inline const StylePropertySet* Element::presentationAttributeStyle() 881 inline const StylePropertySet* Element::presentationAttributeStyle()
875 { 882 {
876 if (!elementData()) 883 if (!elementData())
877 return nullptr; 884 return nullptr;
878 if (elementData()->m_presentationAttributeStyleIsDirty) 885 if (elementData()->m_presentationAttributeStyleIsDirty)
879 updatePresentationAttributeStyle(); 886 updatePresentationAttributeStyle();
880 // Need to call elementData() again since updatePresentationAttributeStyle() 887 // Need to call elementData() again since updatePresentationAttributeStyle()
881 // might swap it with a UniqueElementData. 888 // might swap it with a UniqueElementData.
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
939 static PassRefPtrWillBeRawPtr<T> create(const QualifiedName&, Document&) 946 static PassRefPtrWillBeRawPtr<T> create(const QualifiedName&, Document&)
940 #define DEFINE_ELEMENT_FACTORY_WITH_TAGNAME(T) \ 947 #define DEFINE_ELEMENT_FACTORY_WITH_TAGNAME(T) \
941 PassRefPtrWillBeRawPtr<T> T::create(const QualifiedName& tagName, Document& document) \ 948 PassRefPtrWillBeRawPtr<T> T::create(const QualifiedName& tagName, Document& document) \
942 { \ 949 { \
943 return adoptRefWillBeNoop(new T(tagName, document)); \ 950 return adoptRefWillBeNoop(new T(tagName, document)); \
944 } 951 }
945 952
946 } // namespace blink 953 } // namespace blink
947 954
948 #endif // Element_h 955 #endif // Element_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698