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

Side by Side Diff: Source/core/css/resolver/CSSToStyleMap.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, 5 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 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com) 3 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com)
4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com) 4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com)
5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All r ights reserved. 5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All r ights reserved.
6 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> 6 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org>
7 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> 7 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org>
8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
9 * Copyright (c) 2011, Code Aurora Forum. All rights reserved. 9 * Copyright (c) 2011, Code Aurora Forum. All rights reserved.
10 * Copyright (C) Research In Motion Limited 2011. All rights reserved. 10 * Copyright (C) Research In Motion Limited 2011. All rights reserved.
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after
456 456
457 for (unsigned i = 0 ; i < borderImage->length() ; ++i) { 457 for (unsigned i = 0 ; i < borderImage->length() ; ++i) {
458 CSSValue* current = borderImage->item(i); 458 CSSValue* current = borderImage->item(i);
459 459
460 if (current->isImageValue() || current->isImageGeneratorValue() || curre nt->isImageSetValue()) 460 if (current->isImageValue() || current->isImageGeneratorValue() || curre nt->isImageSetValue())
461 image.setImage(styleImage(imageProperty, current)); 461 image.setImage(styleImage(imageProperty, current));
462 else if (current->isBorderImageSliceValue()) 462 else if (current->isBorderImageSliceValue())
463 mapNinePieceImageSlice(current, image); 463 mapNinePieceImageSlice(current, image);
464 else if (current->isValueList()) { 464 else if (current->isValueList()) {
465 CSSValueList* slashList = toCSSValueList(current); 465 CSSValueList* slashList = toCSSValueList(current);
466 size_t length = slashList->length();
466 // Map in the image slices. 467 // Map in the image slices.
467 if (slashList->item(0) && slashList->item(0)->isBorderImageSliceValu e()) 468 if (length && slashList->item(0)->isBorderImageSliceValue())
468 mapNinePieceImageSlice(slashList->item(0), image); 469 mapNinePieceImageSlice(slashList->item(0), image);
469 470
470 // Map in the border slices. 471 // Map in the border slices.
471 if (slashList->item(1)) 472 if (length > 1)
472 image.setBorderSlices(mapNinePieceImageQuad(slashList->item(1))) ; 473 image.setBorderSlices(mapNinePieceImageQuad(slashList->item(1))) ;
473 474
474 // Map in the outset. 475 // Map in the outset.
475 if (slashList->item(2)) 476 if (length > 2)
476 image.setOutset(mapNinePieceImageQuad(slashList->item(2))); 477 image.setOutset(mapNinePieceImageQuad(slashList->item(2)));
477 } else if (current->isPrimitiveValue()) { 478 } else if (current->isPrimitiveValue()) {
478 // Set the appropriate rules for stretch/round/repeat of the slices. 479 // Set the appropriate rules for stretch/round/repeat of the slices.
479 mapNinePieceImageRepeat(current, image); 480 mapNinePieceImageRepeat(current, image);
480 } 481 }
481 } 482 }
482 483
483 if (property == CSSPropertyWebkitBorderImage) { 484 if (property == CSSPropertyWebkitBorderImage) {
484 // We have to preserve the legacy behavior of -webkit-border-image and m ake the border slices 485 // We have to preserve the legacy behavior of -webkit-border-image and m ake the border slices
485 // also set the border widths. We don't need to worry about percentages, since we don't even support 486 // also set the border widths. We don't need to worry about percentages, since we don't even support
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
596 verticalRule = SpaceImageRule; 597 verticalRule = SpaceImageRule;
597 break; 598 break;
598 default: // CSSValueRepeat 599 default: // CSSValueRepeat
599 verticalRule = RepeatImageRule; 600 verticalRule = RepeatImageRule;
600 break; 601 break;
601 } 602 }
602 image.setVerticalRule(verticalRule); 603 image.setVerticalRule(verticalRule);
603 } 604 }
604 605
605 }; 606 };
OLDNEW
« no previous file with comments | « Source/core/css/parser/CSSPropertyParser.cpp ('k') | Source/core/css/resolver/FilterOperationResolver.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698