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

Side by Side Diff: Source/core/css/resolver/FontBuilder.cpp

Issue 333163004: Remove explicit bounds check from CSSValueList::item (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: address comment Created 6 years, 6 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 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. 3 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
4 * Copyright (C) 2013 Google Inc. All rights reserved. 4 * Copyright (C) 2013 Google Inc. All rights reserved.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 FontDescriptionChangeScope scope(this); 396 FontDescriptionChangeScope scope(this);
397 397
398 FontDescription::LigaturesState commonLigaturesState = FontDescription::Norm alLigaturesState; 398 FontDescription::LigaturesState commonLigaturesState = FontDescription::Norm alLigaturesState;
399 FontDescription::LigaturesState discretionaryLigaturesState = FontDescriptio n::NormalLigaturesState; 399 FontDescription::LigaturesState discretionaryLigaturesState = FontDescriptio n::NormalLigaturesState;
400 FontDescription::LigaturesState historicalLigaturesState = FontDescription:: NormalLigaturesState; 400 FontDescription::LigaturesState historicalLigaturesState = FontDescription:: NormalLigaturesState;
401 FontDescription::LigaturesState contextualLigaturesState = FontDescription:: NormalLigaturesState; 401 FontDescription::LigaturesState contextualLigaturesState = FontDescription:: NormalLigaturesState;
402 402
403 if (value->isValueList()) { 403 if (value->isValueList()) {
404 CSSValueList* valueList = toCSSValueList(value); 404 CSSValueList* valueList = toCSSValueList(value);
405 for (size_t i = 0; i < valueList->length(); ++i) { 405 for (size_t i = 0; i < valueList->length(); ++i) {
406 CSSValue* item = valueList->itemWithoutBoundsCheck(i); 406 CSSValue* item = valueList->item(i);
407 ASSERT(item->isPrimitiveValue()); 407 ASSERT(item->isPrimitiveValue());
408 if (item->isPrimitiveValue()) { 408 if (item->isPrimitiveValue()) {
409 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(item); 409 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(item);
410 switch (primitiveValue->getValueID()) { 410 switch (primitiveValue->getValueID()) {
411 case CSSValueNoCommonLigatures: 411 case CSSValueNoCommonLigatures:
412 commonLigaturesState = FontDescription::DisabledLigaturesSta te; 412 commonLigaturesState = FontDescription::DisabledLigaturesSta te;
413 break; 413 break;
414 case CSSValueCommonLigatures: 414 case CSSValueCommonLigatures:
415 commonLigaturesState = FontDescription::EnabledLigaturesStat e; 415 commonLigaturesState = FontDescription::EnabledLigaturesStat e;
416 break; 416 break;
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
504 } 504 }
505 505
506 void FontBuilder::setFeatureSettingsValue(CSSValue* value) 506 void FontBuilder::setFeatureSettingsValue(CSSValue* value)
507 { 507 {
508 FontDescriptionChangeScope scope(this); 508 FontDescriptionChangeScope scope(this);
509 509
510 CSSValueList* list = toCSSValueList(value); 510 CSSValueList* list = toCSSValueList(value);
511 RefPtr<FontFeatureSettings> settings = FontFeatureSettings::create(); 511 RefPtr<FontFeatureSettings> settings = FontFeatureSettings::create();
512 int len = list->length(); 512 int len = list->length();
513 for (int i = 0; i < len; ++i) { 513 for (int i = 0; i < len; ++i) {
514 CSSValue* item = list->itemWithoutBoundsCheck(i); 514 CSSValue* item = list->item(i);
515 if (!item->isFontFeatureValue()) 515 if (!item->isFontFeatureValue())
516 continue; 516 continue;
517 CSSFontFeatureValue* feature = toCSSFontFeatureValue(item); 517 CSSFontFeatureValue* feature = toCSSFontFeatureValue(item);
518 settings->append(FontFeature(feature->tag(), feature->value())); 518 settings->append(FontFeature(feature->tag(), feature->value()));
519 } 519 }
520 scope.fontDescription().setFeatureSettings(settings.release()); 520 scope.fontDescription().setFeatureSettings(settings.release());
521 } 521 }
522 522
523 void FontBuilder::setSize(FontDescription& fontDescription, float effectiveZoom, float size) 523 void FontBuilder::setSize(FontDescription& fontDescription, float effectiveZoom, float size)
524 { 524 {
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
660 FontOrientation fontOrientation; 660 FontOrientation fontOrientation;
661 NonCJKGlyphOrientation glyphOrientation; 661 NonCJKGlyphOrientation glyphOrientation;
662 getFontAndGlyphOrientation(documentStyle, fontOrientation, glyphOrientation) ; 662 getFontAndGlyphOrientation(documentStyle, fontOrientation, glyphOrientation) ;
663 fontDescription.setOrientation(fontOrientation); 663 fontDescription.setOrientation(fontOrientation);
664 fontDescription.setNonCJKGlyphOrientation(glyphOrientation); 664 fontDescription.setNonCJKGlyphOrientation(glyphOrientation);
665 documentStyle->setFontDescription(fontDescription); 665 documentStyle->setFontDescription(fontDescription);
666 documentStyle->font().update(fontSelector); 666 documentStyle->font().update(fontSelector);
667 } 667 }
668 668
669 } 669 }
OLDNEW
« no previous file with comments | « Source/core/css/resolver/FilterOperationResolver.cpp ('k') | Source/core/css/resolver/StyleBuilderConverter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698