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

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

Issue 108653006: Assert that convertToLength succeeds instead of returning Length(Undefined) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebased Created 7 years 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 521 matching lines...) Expand 10 before | Expand all | Expand 10 after
532 if (!value->isValueList()) 532 if (!value->isValueList())
533 return; 533 return;
534 534
535 // [ <length> | <percentage> ] each-line 535 // [ <length> | <percentage> ] each-line
536 // The order is guaranteed. See CSSParser::parseTextIndent. 536 // The order is guaranteed. See CSSParser::parseTextIndent.
537 // The second value, each-line is handled only when css3TextEnabled() return s true. 537 // The second value, each-line is handled only when css3TextEnabled() return s true.
538 538
539 CSSValueList* valueList = toCSSValueList(value); 539 CSSValueList* valueList = toCSSValueList(value);
540 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(valueList->itemWitho utBoundsCheck(0)); 540 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(valueList->itemWitho utBoundsCheck(0));
541 Length lengthOrPercentageValue = primitiveValue->convertToLength<FixedConver sion | PercentConversion>(state.cssToLengthConversionData()); 541 Length lengthOrPercentageValue = primitiveValue->convertToLength<FixedConver sion | PercentConversion>(state.cssToLengthConversionData());
542 ASSERT(!lengthOrPercentageValue.isUndefined());
543 state.style()->setTextIndent(lengthOrPercentageValue); 542 state.style()->setTextIndent(lengthOrPercentageValue);
544 543
545 ASSERT(valueList->length() <= 2); 544 ASSERT(valueList->length() <= 2);
546 CSSPrimitiveValue* eachLineValue = toCSSPrimitiveValue(valueList->item(1)); 545 CSSPrimitiveValue* eachLineValue = toCSSPrimitiveValue(valueList->item(1));
547 if (eachLineValue) { 546 if (eachLineValue) {
548 ASSERT(eachLineValue->getValueID() == CSSValueEachLine); 547 ASSERT(eachLineValue->getValueID() == CSSValueEachLine);
549 state.style()->setTextIndentLine(TextIndentEachLine); 548 state.style()->setTextIndentLine(TextIndentEachLine);
550 } else 549 } else
551 state.style()->setTextIndentLine(TextIndentFirstLine); 550 state.style()->setTextIndentLine(TextIndentFirstLine);
552 } 551 }
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
698 case CSSValueNormal: 697 case CSSValueNormal:
699 state.style()->setMarqueeIncrement(Length(6, Fixed)); // 6px. The Wi nIE default. 698 state.style()->setMarqueeIncrement(Length(6, Fixed)); // 6px. The Wi nIE default.
700 break; 699 break;
701 case CSSValueLarge: 700 case CSSValueLarge:
702 state.style()->setMarqueeIncrement(Length(36, Fixed)); // 36px. 701 state.style()->setMarqueeIncrement(Length(36, Fixed)); // 36px.
703 break; 702 break;
704 default: 703 default:
705 break; 704 break;
706 } 705 }
707 } else { 706 } else {
708 Length marqueeLength = primitiveValue ? primitiveValue->convertToLength< FixedConversion | PercentConversion>(state.cssToLengthConversionData()) : Length (Undefined); 707 Length marqueeLength = primitiveValue->convertToLength<FixedConversion | PercentConversion>(state.cssToLengthConversionData());
709 if (!marqueeLength.isUndefined()) 708 state.style()->setMarqueeIncrement(marqueeLength);
710 state.style()->setMarqueeIncrement(marqueeLength);
711 } 709 }
712 } 710 }
713 711
714 void StyleBuilderFunctions::applyValueCSSPropertyInternalMarqueeSpeed(StyleResol verState& state, CSSValue* value) 712 void StyleBuilderFunctions::applyValueCSSPropertyInternalMarqueeSpeed(StyleResol verState& state, CSSValue* value)
715 { 713 {
716 if (!value->isPrimitiveValue()) 714 if (!value->isPrimitiveValue())
717 return; 715 return;
718 716
719 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); 717 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
720 if (CSSValueID valueID = primitiveValue->getValueID()) { 718 if (CSSValueID valueID = primitiveValue->getValueID()) {
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
874 return true; 872 return true;
875 } 873 }
876 874
877 if (primitiveValue->isFlex()) { 875 if (primitiveValue->isFlex()) {
878 // Fractional unit. 876 // Fractional unit.
879 workingLength.setFlex(primitiveValue->getDoubleValue()); 877 workingLength.setFlex(primitiveValue->getDoubleValue());
880 return true; 878 return true;
881 } 879 }
882 880
883 workingLength = primitiveValue->convertToLength<FixedConversion | PercentCon version | AutoConversion>(state.cssToLengthConversionData()); 881 workingLength = primitiveValue->convertToLength<FixedConversion | PercentCon version | AutoConversion>(state.cssToLengthConversionData());
884 if (workingLength.length().isUndefined())
885 return false;
886
887 if (primitiveValue->isLength()) 882 if (primitiveValue->isLength())
888 workingLength.length().setQuirk(primitiveValue->isQuirkValue()); 883 workingLength.length().setQuirk(primitiveValue->isQuirkValue());
889 884
890 return true; 885 return true;
891 } 886 }
892 887
893 static bool createGridTrackSize(CSSValue* value, GridTrackSize& trackSize, const StyleResolverState& state) 888 static bool createGridTrackSize(CSSValue* value, GridTrackSize& trackSize, const StyleResolverState& state)
894 { 889 {
895 if (value->isPrimitiveValue()) { 890 if (value->isPrimitiveValue()) {
896 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); 891 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
(...skipping 1282 matching lines...) Expand 10 before | Expand all | Expand 10 after
2179 break; 2174 break;
2180 } 2175 }
2181 case CSSPropertyEnableBackground: 2176 case CSSPropertyEnableBackground:
2182 // Silently ignoring this property for now 2177 // Silently ignoring this property for now
2183 // http://bugs.webkit.org/show_bug.cgi?id=6022 2178 // http://bugs.webkit.org/show_bug.cgi?id=6022
2184 break; 2179 break;
2185 } 2180 }
2186 } 2181 }
2187 2182
2188 } // namespace WebCore 2183 } // 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