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

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

Issue 719063002: Revert "Remove support for MSVC" (Closed) Base URL: https://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
107 // SharableElementData is managed by ElementDataCache and is produced by 112 // SharableElementData is managed by ElementDataCache and is produced by
108 // the parser during page load for elements that have identical attributes. This 113 // the parser during page load for elements that have identical attributes. This
109 // is a memory optimization since it's very common for many elements to have 114 // is a memory optimization since it's very common for many elements to have
110 // duplicate sets of attributes (ex. the same classes). 115 // duplicate sets of attributes (ex. the same classes).
111 class ShareableElementData final : public ElementData { 116 class ShareableElementData final : public ElementData {
112 public: 117 public:
113 static PassRefPtr<ShareableElementData> createWithAttributes(const Vector<At tribute>&); 118 static PassRefPtr<ShareableElementData> createWithAttributes(const Vector<At tribute>&);
114 119
115 explicit ShareableElementData(const Vector<Attribute>&); 120 explicit ShareableElementData(const Vector<Attribute>&);
116 explicit ShareableElementData(const UniqueElementData&); 121 explicit ShareableElementData(const UniqueElementData&);
(...skipping 11 matching lines...) Expand all
128 return location; 133 return location;
129 } 134 }
130 135
131 AttributeCollection attributes() const; 136 AttributeCollection attributes() const;
132 137
133 Attribute m_attributeArray[0]; 138 Attribute m_attributeArray[0];
134 }; 139 };
135 140
136 DEFINE_ELEMENT_DATA_TYPE_CASTS(ShareableElementData, !data->isUnique(), !data.is Unique()); 141 DEFINE_ELEMENT_DATA_TYPE_CASTS(ShareableElementData, !data->isUnique(), !data.is Unique());
137 142
143 #if COMPILER(MSVC)
144 #pragma warning(pop)
145 #endif
146
138 // UniqueElementData is created when an element needs to mutate its attributes 147 // UniqueElementData is created when an element needs to mutate its attributes
139 // or gains presentation attribute style (ex. width="10"). It does not need to 148 // or gains presentation attribute style (ex. width="10"). It does not need to
140 // be created to fill in values in the ElementData that are derived from 149 // be created to fill in values in the ElementData that are derived from
141 // attributes. For example populating the m_inlineStyle from the style attribute 150 // attributes. For example populating the m_inlineStyle from the style attribute
142 // doesn't require a UniqueElementData as all elements with the same style 151 // doesn't require a UniqueElementData as all elements with the same style
143 // attribute will have the same inline style. 152 // attribute will have the same inline style.
144 class UniqueElementData final : public ElementData { 153 class UniqueElementData final : public ElementData {
145 public: 154 public:
146 static PassRefPtr<UniqueElementData> create(); 155 static PassRefPtr<UniqueElementData> create();
147 PassRefPtr<ShareableElementData> makeShareableCopy() const; 156 PassRefPtr<ShareableElementData> makeShareableCopy() const;
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 } 196 }
188 197
189 inline MutableAttributeCollection UniqueElementData::attributes() 198 inline MutableAttributeCollection UniqueElementData::attributes()
190 { 199 {
191 return MutableAttributeCollection(m_attributeVector); 200 return MutableAttributeCollection(m_attributeVector);
192 } 201 }
193 202
194 } // namespace blink 203 } // namespace blink
195 204
196 #endif // ElementData_h 205 #endif // ElementData_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698