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

Side by Side Diff: sky/engine/core/dom/ElementData.h

Issue 714393002: Remove support for MSVC (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month 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) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * Copyright (C) 2014 Apple Inc. All rights reserved. 3 * Copyright (C) 2014 Apple Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 void destroy(); 97 void destroy();
98 #endif 98 #endif
99 99
100 PassRefPtr<UniqueElementData> makeUniqueCopy() const; 100 PassRefPtr<UniqueElementData> makeUniqueCopy() const;
101 }; 101 };
102 102
103 #define DEFINE_ELEMENT_DATA_TYPE_CASTS(thisType, pointerPredicate, referencePre dicate) \ 103 #define DEFINE_ELEMENT_DATA_TYPE_CASTS(thisType, pointerPredicate, referencePre dicate) \
104 template<typename T> inline thisType* to##thisType(const RefPtr<T>& data) { return to##thisType(data.get()); } \ 104 template<typename T> inline thisType* to##thisType(const RefPtr<T>& data) { return to##thisType(data.get()); } \
105 DEFINE_TYPE_CASTS(thisType, ElementData, data, pointerPredicate, referencePr edicate) 105 DEFINE_TYPE_CASTS(thisType, ElementData, data, pointerPredicate, referencePr edicate)
106 106
107 #if COMPILER(MSVC)
108 #pragma warning(push)
109 #pragma warning(disable: 4200) // Disable "zero-sized array in struct/union" war ning
110 #endif
111
112 // SharableElementData is managed by ElementDataCache and is produced by 107 // SharableElementData is managed by ElementDataCache and is produced by
113 // the parser during page load for elements that have identical attributes. This 108 // the parser during page load for elements that have identical attributes. This
114 // is a memory optimization since it's very common for many elements to have 109 // is a memory optimization since it's very common for many elements to have
115 // duplicate sets of attributes (ex. the same classes). 110 // duplicate sets of attributes (ex. the same classes).
116 class ShareableElementData final : public ElementData { 111 class ShareableElementData final : public ElementData {
117 public: 112 public:
118 static PassRefPtr<ShareableElementData> createWithAttributes(const Vector<At tribute>&); 113 static PassRefPtr<ShareableElementData> createWithAttributes(const Vector<At tribute>&);
119 114
120 explicit ShareableElementData(const Vector<Attribute>&); 115 explicit ShareableElementData(const Vector<Attribute>&);
121 explicit ShareableElementData(const UniqueElementData&); 116 explicit ShareableElementData(const UniqueElementData&);
(...skipping 11 matching lines...) Expand all
133 return location; 128 return location;
134 } 129 }
135 130
136 AttributeCollection attributes() const; 131 AttributeCollection attributes() const;
137 132
138 Attribute m_attributeArray[0]; 133 Attribute m_attributeArray[0];
139 }; 134 };
140 135
141 DEFINE_ELEMENT_DATA_TYPE_CASTS(ShareableElementData, !data->isUnique(), !data.is Unique()); 136 DEFINE_ELEMENT_DATA_TYPE_CASTS(ShareableElementData, !data->isUnique(), !data.is Unique());
142 137
143 #if COMPILER(MSVC)
144 #pragma warning(pop)
145 #endif
146
147 // UniqueElementData is created when an element needs to mutate its attributes 138 // UniqueElementData is created when an element needs to mutate its attributes
148 // or gains presentation attribute style (ex. width="10"). It does not need to 139 // or gains presentation attribute style (ex. width="10"). It does not need to
149 // be created to fill in values in the ElementData that are derived from 140 // be created to fill in values in the ElementData that are derived from
150 // attributes. For example populating the m_inlineStyle from the style attribute 141 // attributes. For example populating the m_inlineStyle from the style attribute
151 // doesn't require a UniqueElementData as all elements with the same style 142 // doesn't require a UniqueElementData as all elements with the same style
152 // attribute will have the same inline style. 143 // attribute will have the same inline style.
153 class UniqueElementData final : public ElementData { 144 class UniqueElementData final : public ElementData {
154 public: 145 public:
155 static PassRefPtr<UniqueElementData> create(); 146 static PassRefPtr<UniqueElementData> create();
156 PassRefPtr<ShareableElementData> makeShareableCopy() const; 147 PassRefPtr<ShareableElementData> makeShareableCopy() const;
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 } 187 }
197 188
198 inline MutableAttributeCollection UniqueElementData::attributes() 189 inline MutableAttributeCollection UniqueElementData::attributes()
199 { 190 {
200 return MutableAttributeCollection(m_attributeVector); 191 return MutableAttributeCollection(m_attributeVector);
201 } 192 }
202 193
203 } // namespace blink 194 } // namespace blink
204 195
205 #endif // ElementData_h 196 #endif // ElementData_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698