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

Side by Side Diff: third_party/WebKit/Source/core/css/StylePropertySet.cpp

Issue 2329463004: ABANDONED CL: Changes needed to make things compile after running rewrite_to_chrome_style tool. (Closed)
Patch Set: More fixes - things build fine at this point. Created 3 years, 8 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 * (C) 1999-2003 Lars Knoll (knoll@kde.org) 2 * (C) 1999-2003 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc. 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc.
4 * All rights reserved. 4 * All rights reserved.
5 * Copyright (C) 2011 Research In Motion Limited. All rights reserved. 5 * Copyright (C) 2011 Research In Motion Limited. All rights reserved.
6 * Copyright (C) 2013 Intel Corporation. All rights reserved. 6 * Copyright (C) 2013 Intel Corporation. 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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 template <typename T> 129 template <typename T>
130 int ImmutableStylePropertySet::findPropertyIndex(T property) const { 130 int ImmutableStylePropertySet::findPropertyIndex(T property) const {
131 uint16_t id = getConvertedCSSPropertyID(property); 131 uint16_t id = getConvertedCSSPropertyID(property);
132 for (int n = m_arraySize - 1; n >= 0; --n) { 132 for (int n = m_arraySize - 1; n >= 0; --n) {
133 if (isPropertyMatch(metadataArray()[n], *valueArray()[n], id, property)) 133 if (isPropertyMatch(metadataArray()[n], *valueArray()[n], id, property))
134 return n; 134 return n;
135 } 135 }
136 136
137 return -1; 137 return -1;
138 } 138 }
139 template CORE_EXPORT int ImmutableStylePropertySet::findPropertyIndex( 139 template CORE_EXPORT int ImmutableStylePropertySet::FindPropertyIndex(
140 CSSPropertyID) const; 140 CSSPropertyID) const;
141 template CORE_EXPORT int ImmutableStylePropertySet::findPropertyIndex( 141 template CORE_EXPORT int ImmutableStylePropertySet::FindPropertyIndex(
142 AtomicString) const; 142 AtomicString) const;
143 143
144 DEFINE_TRACE_AFTER_DISPATCH(ImmutableStylePropertySet) { 144 DEFINE_TRACE_AFTER_DISPATCH(ImmutableStylePropertySet) {
145 const Member<const CSSValue>* values = valueArray(); 145 const Member<const CSSValue>* values = valueArray();
146 for (unsigned i = 0; i < m_arraySize; i++) 146 for (unsigned i = 0; i < m_arraySize; i++)
147 visitor->trace(values[i]); 147 visitor->trace(values[i]);
148 StylePropertySet::traceAfterDispatch(visitor); 148 StylePropertySet::traceAfterDispatch(visitor);
149 } 149 }
150 150
151 MutableStylePropertySet::MutableStylePropertySet(const StylePropertySet& other) 151 MutableStylePropertySet::MutableStylePropertySet(const StylePropertySet& other)
(...skipping 19 matching lines...) Expand all
171 } 171 }
172 172
173 template <typename T> 173 template <typename T>
174 String StylePropertySet::getPropertyValue(T property) const { 174 String StylePropertySet::getPropertyValue(T property) const {
175 const CSSValue* value = getPropertyCSSValue(property); 175 const CSSValue* value = getPropertyCSSValue(property);
176 if (value) 176 if (value)
177 return value->cssText(); 177 return value->cssText();
178 return serializeShorthand(*this, property); 178 return serializeShorthand(*this, property);
179 } 179 }
180 template CORE_EXPORT String 180 template CORE_EXPORT String
181 StylePropertySet::getPropertyValue<CSSPropertyID>(CSSPropertyID) const; 181 StylePropertySet::GetPropertyValue<CSSPropertyID>(CSSPropertyID) const;
182 template CORE_EXPORT String 182 template CORE_EXPORT String
183 StylePropertySet::getPropertyValue<AtomicString>(AtomicString) const; 183 StylePropertySet::GetPropertyValue<AtomicString>(AtomicString) const;
184 184
185 template <typename T> 185 template <typename T>
186 const CSSValue* StylePropertySet::getPropertyCSSValue(T property) const { 186 const CSSValue* StylePropertySet::getPropertyCSSValue(T property) const {
187 int foundPropertyIndex = findPropertyIndex(property); 187 int foundPropertyIndex = findPropertyIndex(property);
188 if (foundPropertyIndex == -1) 188 if (foundPropertyIndex == -1)
189 return nullptr; 189 return nullptr;
190 return &propertyAt(foundPropertyIndex).value(); 190 return &propertyAt(foundPropertyIndex).value();
191 } 191 }
192 template CORE_EXPORT const CSSValue* 192 template CORE_EXPORT const CSSValue*
193 StylePropertySet::getPropertyCSSValue<CSSPropertyID>(CSSPropertyID) const; 193 StylePropertySet::GetPropertyCSSValue<CSSPropertyID>(CSSPropertyID) const;
194 template CORE_EXPORT const CSSValue* 194 template CORE_EXPORT const CSSValue*
195 StylePropertySet::getPropertyCSSValue<AtomicString>(AtomicString) const; 195 StylePropertySet::GetPropertyCSSValue<AtomicString>(AtomicString) const;
196 196
197 DEFINE_TRACE(StylePropertySet) { 197 DEFINE_TRACE(StylePropertySet) {
198 if (m_isMutable) 198 if (m_isMutable)
199 toMutableStylePropertySet(this)->traceAfterDispatch(visitor); 199 toMutableStylePropertySet(this)->traceAfterDispatch(visitor);
200 else 200 else
201 toImmutableStylePropertySet(this)->traceAfterDispatch(visitor); 201 toImmutableStylePropertySet(this)->traceAfterDispatch(visitor);
202 } 202 }
203 203
204 void StylePropertySet::finalizeGarbageCollectedObject() { 204 void StylePropertySet::finalizeGarbageCollectedObject() {
205 if (m_isMutable) 205 if (m_isMutable)
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 if (removeShorthandProperty(property)) { 240 if (removeShorthandProperty(property)) {
241 // FIXME: Return an equivalent shorthand when possible. 241 // FIXME: Return an equivalent shorthand when possible.
242 if (returnText) 242 if (returnText)
243 *returnText = ""; 243 *returnText = "";
244 return true; 244 return true;
245 } 245 }
246 246
247 int foundPropertyIndex = findPropertyIndex(property); 247 int foundPropertyIndex = findPropertyIndex(property);
248 return removePropertyAtIndex(foundPropertyIndex, returnText); 248 return removePropertyAtIndex(foundPropertyIndex, returnText);
249 } 249 }
250 template CORE_EXPORT bool MutableStylePropertySet::removeProperty(CSSPropertyID, 250 template CORE_EXPORT bool MutableStylePropertySet::RemoveProperty(CSSPropertyID,
251 String*); 251 String*);
252 template CORE_EXPORT bool MutableStylePropertySet::removeProperty(AtomicString, 252 template CORE_EXPORT bool MutableStylePropertySet::RemoveProperty(AtomicString,
253 String*); 253 String*);
254 254
255 template <typename T> 255 template <typename T>
256 bool StylePropertySet::propertyIsImportant(T property) const { 256 bool StylePropertySet::propertyIsImportant(T property) const {
257 int foundPropertyIndex = findPropertyIndex(property); 257 int foundPropertyIndex = findPropertyIndex(property);
258 if (foundPropertyIndex != -1) 258 if (foundPropertyIndex != -1)
259 return propertyAt(foundPropertyIndex).isImportant(); 259 return propertyAt(foundPropertyIndex).isImportant();
260 return shorthandIsImportant(property); 260 return shorthandIsImportant(property);
261 } 261 }
262 template bool StylePropertySet::propertyIsImportant<CSSPropertyID>( 262 template bool StylePropertySet::PropertyIsImportant<CSSPropertyID>(
263 CSSPropertyID) const; 263 CSSPropertyID) const;
264 template bool StylePropertySet::propertyIsImportant<AtomicString>( 264 template bool StylePropertySet::PropertyIsImportant<AtomicString>(
265 AtomicString) const; 265 AtomicString) const;
266 266
267 bool StylePropertySet::shorthandIsImportant(CSSPropertyID propertyID) const { 267 bool StylePropertySet::shorthandIsImportant(CSSPropertyID propertyID) const {
268 StylePropertyShorthand shorthand = shorthandForProperty(propertyID); 268 StylePropertyShorthand shorthand = shorthandForProperty(propertyID);
269 if (!shorthand.length()) 269 if (!shorthand.length())
270 return false; 270 return false;
271 271
272 for (unsigned i = 0; i < shorthand.length(); ++i) { 272 for (unsigned i = 0; i < shorthand.length(); ++i) {
273 if (!propertyIsImportant(shorthand.properties()[i])) 273 if (!propertyIsImportant(shorthand.properties()[i]))
274 return false; 274 return false;
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
567 uint16_t id = getConvertedCSSPropertyID(property); 567 uint16_t id = getConvertedCSSPropertyID(property);
568 568
569 const CSSProperty* it = std::find_if( 569 const CSSProperty* it = std::find_if(
570 begin, end, [property, id](const CSSProperty& cssProperty) -> bool { 570 begin, end, [property, id](const CSSProperty& cssProperty) -> bool {
571 return isPropertyMatch(cssProperty.metadata(), *cssProperty.value(), id, 571 return isPropertyMatch(cssProperty.metadata(), *cssProperty.value(), id,
572 property); 572 property);
573 }); 573 });
574 574
575 return (it == end) ? -1 : it - begin; 575 return (it == end) ? -1 : it - begin;
576 } 576 }
577 template CORE_EXPORT int MutableStylePropertySet::findPropertyIndex( 577 template CORE_EXPORT int MutableStylePropertySet::FindPropertyIndex(
578 CSSPropertyID) const; 578 CSSPropertyID) const;
579 template CORE_EXPORT int MutableStylePropertySet::findPropertyIndex( 579 template CORE_EXPORT int MutableStylePropertySet::FindPropertyIndex(
580 AtomicString) const; 580 AtomicString) const;
581 581
582 DEFINE_TRACE_AFTER_DISPATCH(MutableStylePropertySet) { 582 DEFINE_TRACE_AFTER_DISPATCH(MutableStylePropertySet) {
583 visitor->trace(m_cssomWrapper); 583 visitor->trace(m_cssomWrapper);
584 visitor->trace(m_propertyVector); 584 visitor->trace(m_propertyVector);
585 StylePropertySet::traceAfterDispatch(visitor); 585 StylePropertySet::traceAfterDispatch(visitor);
586 } 586 }
587 587
588 unsigned StylePropertySet::averageSizeInBytes() { 588 unsigned StylePropertySet::averageSizeInBytes() {
589 // Please update this if the storage scheme changes so that this longer 589 // Please update this if the storage scheme changes so that this longer
(...skipping 22 matching lines...) Expand all
612 612
613 MutableStylePropertySet* MutableStylePropertySet::create( 613 MutableStylePropertySet* MutableStylePropertySet::create(
614 const CSSProperty* properties, 614 const CSSProperty* properties,
615 unsigned count) { 615 unsigned count) {
616 return new MutableStylePropertySet(properties, count); 616 return new MutableStylePropertySet(properties, count);
617 } 617 }
618 618
619 DEFINE_TRACE(CSSLazyPropertyParser) {} 619 DEFINE_TRACE(CSSLazyPropertyParser) {}
620 620
621 } // namespace blink 621 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/MediaQueryEvaluator.cpp ('k') | third_party/WebKit/Source/core/css/StyleRule.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698