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

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: Fix windows maybe 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 407 matching lines...) Expand 10 before | Expand all | Expand 10 after
702 ElementRareData& ensureElementRareData(); 706 ElementRareData& ensureElementRareData();
703 707
704 AttrNodeList& ensureAttrNodeList(); 708 AttrNodeList& ensureAttrNodeList();
705 void removeAttrNodeList(); 709 void removeAttrNodeList();
706 void detachAllAttrNodesFromElement(); 710 void detachAllAttrNodesFromElement();
707 void detachAttrNodeFromElementWithValue(Attr*, const AtomicString& value); 711 void detachAttrNodeFromElementWithValue(Attr*, const AtomicString& value);
708 void detachAttrNodeAtIndex(Attr*, size_t index); 712 void detachAttrNodeAtIndex(Attr*, size_t index);
709 713
710 v8::Local<v8::Object> wrapCustomElement(v8::Isolate*, v8::Local<v8::Object> creationContext); 714 v8::Local<v8::Object> wrapCustomElement(v8::Isolate*, v8::Local<v8::Object> creationContext);
711 715
716 void invalidateInlineStylePropertyMap();
717
712 RefPtrWillBeMember<ElementData> m_elementData; 718 RefPtrWillBeMember<ElementData> m_elementData;
713 }; 719 };
714 720
715 DEFINE_NODE_TYPE_CASTS(Element, isElementNode()); 721 DEFINE_NODE_TYPE_CASTS(Element, isElementNode());
716 template <typename T> bool isElementOfType(const Node&); 722 template <typename T> bool isElementOfType(const Node&);
717 template <> inline bool isElementOfType<const Element>(const Node& node) { retur n node.isElementNode(); } 723 template <> inline bool isElementOfType<const Element>(const Node& node) { retur n node.isElementNode(); }
718 template <typename T> inline bool isElementOfType(const Element& element) { retu rn isElementOfType<T>(static_cast<const Node&>(element)); } 724 template <typename T> inline bool isElementOfType(const Element& element) { retu rn isElementOfType<T>(static_cast<const Node&>(element)); }
719 template <> inline bool isElementOfType<const Element>(const Element&) { return true; } 725 template <> inline bool isElementOfType<const Element>(const Element&) { return true; }
720 726
721 // Type casting. 727 // Type casting.
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
868 if (isInShadowTree() && !treeScope().rootNode().isShadowRoot()) 874 if (isInShadowTree() && !treeScope().rootNode().isShadowRoot())
869 clearFlag(IsInShadowTreeFlag); 875 clearFlag(IsInShadowTreeFlag);
870 if (AXObjectCache* cache = document().existingAXObjectCache()) 876 if (AXObjectCache* cache = document().existingAXObjectCache())
871 cache->remove(this); 877 cache->remove(this);
872 } 878 }
873 879
874 inline void Element::invalidateStyleAttribute() 880 inline void Element::invalidateStyleAttribute()
875 { 881 {
876 ASSERT(elementData()); 882 ASSERT(elementData());
877 elementData()->m_styleAttributeIsDirty = true; 883 elementData()->m_styleAttributeIsDirty = true;
884 invalidateInlineStylePropertyMap();
878 } 885 }
879 886
880 inline const StylePropertySet* Element::presentationAttributeStyle() 887 inline const StylePropertySet* Element::presentationAttributeStyle()
881 { 888 {
882 if (!elementData()) 889 if (!elementData())
883 return nullptr; 890 return nullptr;
884 if (elementData()->m_presentationAttributeStyleIsDirty) 891 if (elementData()->m_presentationAttributeStyleIsDirty)
885 updatePresentationAttributeStyle(); 892 updatePresentationAttributeStyle();
886 // Need to call elementData() again since updatePresentationAttributeStyle() 893 // Need to call elementData() again since updatePresentationAttributeStyle()
887 // might swap it with a UniqueElementData. 894 // might swap it with a UniqueElementData.
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
945 static PassRefPtrWillBeRawPtr<T> create(const QualifiedName&, Document&) 952 static PassRefPtrWillBeRawPtr<T> create(const QualifiedName&, Document&)
946 #define DEFINE_ELEMENT_FACTORY_WITH_TAGNAME(T) \ 953 #define DEFINE_ELEMENT_FACTORY_WITH_TAGNAME(T) \
947 PassRefPtrWillBeRawPtr<T> T::create(const QualifiedName& tagName, Document& document) \ 954 PassRefPtrWillBeRawPtr<T> T::create(const QualifiedName& tagName, Document& document) \
948 { \ 955 { \
949 return adoptRefWillBeNoop(new T(tagName, document)); \ 956 return adoptRefWillBeNoop(new T(tagName, document)); \
950 } 957 }
951 958
952 } // namespace blink 959 } // namespace blink
953 960
954 #endif // Element_h 961 #endif // Element_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698