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

Side by Side Diff: Source/core/css/resolver/StyleBuilderCustom.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) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 3 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
4 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com) 4 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com)
5 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com) 5 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com)
6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved. 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved.
7 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> 7 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org>
8 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> 8 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org>
9 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 9 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
10 * Copyright (c) 2011, Code Aurora Forum. All rights reserved. 10 * Copyright (c) 2011, Code Aurora Forum. All rights reserved.
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 } 216 }
217 217
218 void StyleBuilderFunctions::applyValueCSSPropertyCursor(StyleResolverState& stat e, CSSValue* value) 218 void StyleBuilderFunctions::applyValueCSSPropertyCursor(StyleResolverState& stat e, CSSValue* value)
219 { 219 {
220 state.style()->clearCursorList(); 220 state.style()->clearCursorList();
221 if (value->isValueList()) { 221 if (value->isValueList()) {
222 CSSValueList* list = toCSSValueList(value); 222 CSSValueList* list = toCSSValueList(value);
223 int len = list->length(); 223 int len = list->length();
224 state.style()->setCursor(CURSOR_AUTO); 224 state.style()->setCursor(CURSOR_AUTO);
225 for (int i = 0; i < len; i++) { 225 for (int i = 0; i < len; i++) {
226 CSSValue* item = list->itemWithoutBoundsCheck(i); 226 CSSValue* item = list->item(i);
227 if (item->isCursorImageValue()) { 227 if (item->isCursorImageValue()) {
228 CSSCursorImageValue* image = toCSSCursorImageValue(item); 228 CSSCursorImageValue* image = toCSSCursorImageValue(item);
229 if (image->updateIfSVGCursorIsUsed(state.element())) // Elements with SVG cursors are not allowed to share style. 229 if (image->updateIfSVGCursorIsUsed(state.element())) // Elements with SVG cursors are not allowed to share style.
230 state.style()->setUnique(); 230 state.style()->setUnique();
231 state.style()->addCursor(state.styleImage(CSSPropertyCursor, ima ge), image->hotSpot()); 231 state.style()->addCursor(state.styleImage(CSSPropertyCursor, ima ge), image->hotSpot());
232 } else { 232 } else {
233 state.style()->setCursor(*toCSSPrimitiveValue(item)); 233 state.style()->setCursor(*toCSSPrimitiveValue(item));
234 } 234 }
235 } 235 }
236 } else { 236 } else {
(...skipping 786 matching lines...) Expand 10 before | Expand all | Expand 10 after
1023 } 1023 }
1024 1024
1025 void StyleBuilderFunctions::applyValueCSSPropertyWebkitTextEmphasisStyle(StyleRe solverState& state, CSSValue* value) 1025 void StyleBuilderFunctions::applyValueCSSPropertyWebkitTextEmphasisStyle(StyleRe solverState& state, CSSValue* value)
1026 { 1026 {
1027 if (value->isValueList()) { 1027 if (value->isValueList()) {
1028 CSSValueList* list = toCSSValueList(value); 1028 CSSValueList* list = toCSSValueList(value);
1029 ASSERT(list->length() == 2); 1029 ASSERT(list->length() == 2);
1030 if (list->length() != 2) 1030 if (list->length() != 2)
1031 return; 1031 return;
1032 for (unsigned i = 0; i < 2; ++i) { 1032 for (unsigned i = 0; i < 2; ++i) {
1033 CSSValue* item = list->itemWithoutBoundsCheck(i); 1033 CSSValue* item = list->item(i);
1034 if (!item->isPrimitiveValue()) 1034 if (!item->isPrimitiveValue())
1035 continue; 1035 continue;
1036 1036
1037 CSSPrimitiveValue* value = toCSSPrimitiveValue(item); 1037 CSSPrimitiveValue* value = toCSSPrimitiveValue(item);
1038 if (value->getValueID() == CSSValueFilled || value->getValueID() == CSSValueOpen) 1038 if (value->getValueID() == CSSValueFilled || value->getValueID() == CSSValueOpen)
1039 state.style()->setTextEmphasisFill(*value); 1039 state.style()->setTextEmphasisFill(*value);
1040 else 1040 else
1041 state.style()->setTextEmphasisMark(*value); 1041 state.style()->setTextEmphasisMark(*value);
1042 } 1042 }
1043 state.style()->setTextEmphasisCustomMark(nullAtom); 1043 state.style()->setTextEmphasisCustomMark(nullAtom);
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after
1394 default: 1394 default:
1395 break; 1395 break;
1396 } 1396 }
1397 } else { 1397 } else {
1398 svgStyle->setBaselineShift(BS_LENGTH); 1398 svgStyle->setBaselineShift(BS_LENGTH);
1399 svgStyle->setBaselineShiftValue(SVGLength::fromCSSPrimitiveValue(primiti veValue)); 1399 svgStyle->setBaselineShiftValue(SVGLength::fromCSSPrimitiveValue(primiti veValue));
1400 } 1400 }
1401 } 1401 }
1402 1402
1403 } // namespace WebCore 1403 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/css/resolver/StyleBuilderConverter.cpp ('k') | Source/core/css/resolver/TransformBuilder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698