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

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

Issue 184853009: Revert of Move all RefPtr's to CSSValue to oilpan transition types (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/css/StylePropertySet.h ('k') | Source/core/css/parser/BisonCSSParser.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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. All rights reserved. 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc. All rights reserved.
4 * Copyright (C) 2011 Research In Motion Limited. All rights reserved. 4 * Copyright (C) 2011 Research In Motion Limited. All rights reserved.
5 * Copyright (C) 2013 Intel Corporation. All rights reserved. 5 * Copyright (C) 2013 Intel Corporation. All rights reserved.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 CSSParserContext context(cssParserMode(), UseCounter::getFrom(contextStyleSh eet)); 312 CSSParserContext context(cssParserMode(), UseCounter::getFrom(contextStyleSh eet));
313 if (contextStyleSheet) { 313 if (contextStyleSheet) {
314 context = contextStyleSheet->parserContext(); 314 context = contextStyleSheet->parserContext();
315 context.setMode(cssParserMode()); 315 context.setMode(cssParserMode());
316 } 316 }
317 317
318 BisonCSSParser parser(context); 318 BisonCSSParser parser(context);
319 parser.parseDeclaration(this, styleDeclaration, 0, contextStyleSheet); 319 parser.parseDeclaration(this, styleDeclaration, 0, contextStyleSheet);
320 } 320 }
321 321
322 void MutableStylePropertySet::addParsedProperties(const WillBeHeapVector<CSSProp erty, 256>& properties) 322 void MutableStylePropertySet::addParsedProperties(const Vector<CSSProperty, 256> & properties)
323 { 323 {
324 m_propertyVector.reserveCapacity(m_propertyVector.size() + properties.size() ); 324 m_propertyVector.reserveCapacity(m_propertyVector.size() + properties.size() );
325 for (unsigned i = 0; i < properties.size(); ++i) 325 for (unsigned i = 0; i < properties.size(); ++i)
326 addParsedProperty(properties[i]); 326 addParsedProperty(properties[i]);
327 } 327 }
328 328
329 void MutableStylePropertySet::addParsedProperty(const CSSProperty& property) 329 void MutableStylePropertySet::addParsedProperty(const CSSProperty& property)
330 { 330 {
331 // Only add properties that have no !important counterpart present 331 // Only add properties that have no !important counterpart present
332 if (!propertyIsImportant(property.id()) || property.isImportant()) 332 if (!propertyIsImportant(property.id()) || property.isImportant())
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 bool MutableStylePropertySet::removePropertiesInSet(const CSSPropertyID* set, un signed length) 412 bool MutableStylePropertySet::removePropertiesInSet(const CSSPropertyID* set, un signed length)
413 { 413 {
414 if (m_propertyVector.isEmpty()) 414 if (m_propertyVector.isEmpty())
415 return false; 415 return false;
416 416
417 // FIXME: This is always used with static sets and in that case constructing the hash repeatedly is pretty pointless. 417 // FIXME: This is always used with static sets and in that case constructing the hash repeatedly is pretty pointless.
418 HashSet<CSSPropertyID> toRemove; 418 HashSet<CSSPropertyID> toRemove;
419 for (unsigned i = 0; i < length; ++i) 419 for (unsigned i = 0; i < length; ++i)
420 toRemove.add(set[i]); 420 toRemove.add(set[i]);
421 421
422 WillBeHeapVector<CSSProperty> newProperties; 422 Vector<CSSProperty> newProperties;
423 newProperties.reserveInitialCapacity(m_propertyVector.size()); 423 newProperties.reserveInitialCapacity(m_propertyVector.size());
424 424
425 unsigned size = m_propertyVector.size(); 425 unsigned size = m_propertyVector.size();
426 for (unsigned n = 0; n < size; ++n) { 426 for (unsigned n = 0; n < size; ++n) {
427 const CSSProperty& property = m_propertyVector.at(n); 427 const CSSProperty& property = m_propertyVector.at(n);
428 // Not quite sure if the isImportant test is needed but it matches the e xisting behavior. 428 // Not quite sure if the isImportant test is needed but it matches the e xisting behavior.
429 if (!property.isImportant()) { 429 if (!property.isImportant()) {
430 if (toRemove.contains(property.id())) 430 if (toRemove.contains(property.id()))
431 continue; 431 continue;
432 } 432 }
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
482 removeProperty(propertiesToRemove[i]); 482 removeProperty(propertiesToRemove[i]);
483 } 483 }
484 484
485 PassRefPtr<MutableStylePropertySet> StylePropertySet::mutableCopy() const 485 PassRefPtr<MutableStylePropertySet> StylePropertySet::mutableCopy() const
486 { 486 {
487 return adoptRef(new MutableStylePropertySet(*this)); 487 return adoptRef(new MutableStylePropertySet(*this));
488 } 488 }
489 489
490 PassRefPtr<MutableStylePropertySet> StylePropertySet::copyPropertiesInSet(const Vector<CSSPropertyID>& properties) const 490 PassRefPtr<MutableStylePropertySet> StylePropertySet::copyPropertiesInSet(const Vector<CSSPropertyID>& properties) const
491 { 491 {
492 WillBeHeapVector<CSSProperty, 256> list; 492 Vector<CSSProperty, 256> list;
493 list.reserveInitialCapacity(properties.size()); 493 list.reserveInitialCapacity(properties.size());
494 for (unsigned i = 0; i < properties.size(); ++i) { 494 for (unsigned i = 0; i < properties.size(); ++i) {
495 RefPtrWillBeRawPtr<CSSValue> value = getPropertyCSSValue(properties[i]); 495 RefPtrWillBeRawPtr<CSSValue> value = getPropertyCSSValue(properties[i]);
496 if (value) 496 if (value)
497 list.append(CSSProperty(properties[i], value.release(), false)); 497 list.append(CSSProperty(properties[i], value.release(), false));
498 } 498 }
499 return MutableStylePropertySet::create(list.data(), list.size()); 499 return MutableStylePropertySet::create(list.data(), list.size());
500 } 500 }
501 501
502 CSSStyleDeclaration* MutableStylePropertySet::ensureCSSStyleDeclaration() 502 CSSStyleDeclaration* MutableStylePropertySet::ensureCSSStyleDeclaration()
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
569 result.appendLiteral(": "); 569 result.appendLiteral(": ");
570 result.append(propertyValue()->cssText()); 570 result.append(propertyValue()->cssText());
571 if (isImportant()) 571 if (isImportant())
572 result.appendLiteral(" !important"); 572 result.appendLiteral(" !important");
573 result.append(';'); 573 result.append(';');
574 return result.toString(); 574 return result.toString();
575 } 575 }
576 576
577 577
578 } // namespace WebCore 578 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/css/StylePropertySet.h ('k') | Source/core/css/parser/BisonCSSParser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698