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

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

Issue 645743003: Use C++11 range-based loop for core/css (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: better variable names Created 6 years, 2 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/CSSCanvasValue.cpp ('k') | Source/core/css/CSSCrossfadeValue.cpp » ('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 * Copyright (C) 2004 Zack Rusin <zack@kde.org> 2 * Copyright (C) 2004 Zack Rusin <zack@kde.org>
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved. 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved.
4 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> 4 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org>
5 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> 5 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com>
6 * Copyright (C) 2011 Sencha, Inc. All rights reserved. 6 * Copyright (C) 2011 Sencha, 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 Lesser General Public 9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 764 matching lines...) Expand 10 before | Expand all | Expand 10 after
775 775
776 PassRefPtrWillBeRawPtr<CSSValue> CSSComputedStyleDeclaration::valueForFilter(con st RenderObject* renderer, const RenderStyle& style) const 776 PassRefPtrWillBeRawPtr<CSSValue> CSSComputedStyleDeclaration::valueForFilter(con st RenderObject* renderer, const RenderStyle& style) const
777 { 777 {
778 if (style.filter().operations().isEmpty()) 778 if (style.filter().operations().isEmpty())
779 return cssValuePool().createIdentifierValue(CSSValueNone); 779 return cssValuePool().createIdentifierValue(CSSValueNone);
780 780
781 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated() ; 781 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated() ;
782 782
783 RefPtrWillBeRawPtr<CSSFilterValue> filterValue = nullptr; 783 RefPtrWillBeRawPtr<CSSFilterValue> filterValue = nullptr;
784 784
785 Vector<RefPtr<FilterOperation> >::const_iterator end = style.filter().operat ions().end(); 785 for (const auto& operation : style.filter().operations()) {
786 for (Vector<RefPtr<FilterOperation> >::const_iterator it = style.filter().op erations().begin(); it != end; ++it) { 786 FilterOperation* filterOperation = operation.get();
787 FilterOperation* filterOperation = it->get();
788 switch (filterOperation->type()) { 787 switch (filterOperation->type()) {
789 case FilterOperation::REFERENCE: 788 case FilterOperation::REFERENCE:
790 filterValue = CSSFilterValue::create(CSSFilterValue::ReferenceFilter Operation); 789 filterValue = CSSFilterValue::create(CSSFilterValue::ReferenceFilter Operation);
791 filterValue->append(cssValuePool().createValue(toReferenceFilterOper ation(filterOperation)->url(), CSSPrimitiveValue::CSS_STRING)); 790 filterValue->append(cssValuePool().createValue(toReferenceFilterOper ation(filterOperation)->url(), CSSPrimitiveValue::CSS_STRING));
792 break; 791 break;
793 case FilterOperation::GRAYSCALE: 792 case FilterOperation::GRAYSCALE:
794 filterValue = CSSFilterValue::create(CSSFilterValue::GrayscaleFilter Operation); 793 filterValue = CSSFilterValue::create(CSSFilterValue::GrayscaleFilter Operation);
795 filterValue->append(cssValuePool().createValue(toBasicColorMatrixFil terOperation(filterOperation)->amount(), CSSPrimitiveValue::CSS_NUMBER)); 794 filterValue->append(cssValuePool().createValue(toBasicColorMatrixFil terOperation(filterOperation)->amount(), CSSPrimitiveValue::CSS_NUMBER));
796 break; 795 break;
797 case FilterOperation::SEPIA: 796 case FilterOperation::SEPIA:
(...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after
1360 return list.release(); 1359 return list.release();
1361 } 1360 }
1362 1361
1363 static PassRefPtrWillBeRawPtr<CSSValue> valueForCounterDirectives(const RenderSt yle& style, CSSPropertyID propertyID) 1362 static PassRefPtrWillBeRawPtr<CSSValue> valueForCounterDirectives(const RenderSt yle& style, CSSPropertyID propertyID)
1364 { 1363 {
1365 const CounterDirectiveMap* map = style.counterDirectives(); 1364 const CounterDirectiveMap* map = style.counterDirectives();
1366 if (!map) 1365 if (!map)
1367 return nullptr; 1366 return nullptr;
1368 1367
1369 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated() ; 1368 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated() ;
1370 for (CounterDirectiveMap::const_iterator it = map->begin(); it != map->end() ; ++it) { 1369 for (const auto& item : *map) {
1371 list->append(cssValuePool().createValue(it->key, CSSPrimitiveValue::CSS_ STRING)); 1370 list->append(cssValuePool().createValue(item.key, CSSPrimitiveValue::CSS _STRING));
1372 short number = propertyID == CSSPropertyCounterIncrement ? it->value.inc rementValue() : it->value.resetValue(); 1371 short number = propertyID == CSSPropertyCounterIncrement ? item.value.in crementValue() : item.value.resetValue();
1373 list->append(cssValuePool().createValue((double)number, CSSPrimitiveValu e::CSS_NUMBER)); 1372 list->append(cssValuePool().createValue((double)number, CSSPrimitiveValu e::CSS_NUMBER));
1374 } 1373 }
1375 return list.release(); 1374 return list.release();
1376 } 1375 }
1377 1376
1378 static void logUnimplementedPropertyID(CSSPropertyID propertyID) 1377 static void logUnimplementedPropertyID(CSSPropertyID propertyID)
1379 { 1378 {
1380 DEFINE_STATIC_LOCAL(HashSet<CSSPropertyID>, propertyIDSet, ()); 1379 DEFINE_STATIC_LOCAL(HashSet<CSSPropertyID>, propertyIDSet, ());
1381 if (!propertyIDSet.add(propertyID).isNewEntry) 1380 if (!propertyIDSet.add(propertyID).isNewEntry)
1382 return; 1381 return;
(...skipping 1615 matching lines...) Expand 10 before | Expand all | Expand 10 after
2998 return list.release(); 2997 return list.release();
2999 } 2998 }
3000 2999
3001 void CSSComputedStyleDeclaration::trace(Visitor* visitor) 3000 void CSSComputedStyleDeclaration::trace(Visitor* visitor)
3002 { 3001 {
3003 visitor->trace(m_node); 3002 visitor->trace(m_node);
3004 CSSStyleDeclaration::trace(visitor); 3003 CSSStyleDeclaration::trace(visitor);
3005 } 3004 }
3006 3005
3007 } // namespace blink 3006 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/css/CSSCanvasValue.cpp ('k') | Source/core/css/CSSCrossfadeValue.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698