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

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

Issue 1837413002: Ensure that we don't allow 'none' alongside other values in content property (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 640 matching lines...) Expand 10 before | Expand all | Expand 10 after
651 651
652 void StyleBuilderFunctions::applyInheritCSSPropertyContent(StyleResolverState&) 652 void StyleBuilderFunctions::applyInheritCSSPropertyContent(StyleResolverState&)
653 { 653 {
654 // FIXME: In CSS3, it will be possible to inherit content. In CSS2 it is not . This 654 // FIXME: In CSS3, it will be possible to inherit content. In CSS2 it is not . This
655 // note is a reminder that eventually "inherit" needs to be supported. 655 // note is a reminder that eventually "inherit" needs to be supported.
656 } 656 }
657 657
658 void StyleBuilderFunctions::applyValueCSSPropertyContent(StyleResolverState& sta te, CSSValue* value) 658 void StyleBuilderFunctions::applyValueCSSPropertyContent(StyleResolverState& sta te, CSSValue* value)
659 { 659 {
660 if (value->isPrimitiveValue()) { 660 if (value->isPrimitiveValue()) {
661 ASSERT(toCSSPrimitiveValue(*value).getValueID() == CSSValueNormal); 661 CSSValueID cssValueID = toCSSPrimitiveValue(*value).getValueID();
662 state.style()->clearContent(); 662 if (cssValueID == CSSValueNormal || cssValueID == CSSValueNone) {
Timothy Loh 2016/03/30 02:53:28 why did the assert become an if?
nainar 2016/03/30 03:27:36 Switched back.
663 return; 663 state.style()->clearContent();
664 return;
665 };
664 } 666 }
665 // list of string, uri, counter, attr, i 667 // list of string, uri, counter, attr, i
666 668
667 bool didSet = false; 669 bool didSet = false;
668 for (auto& item : toCSSValueList(*value)) { 670 for (auto& item : toCSSValueList(*value)) {
669 if (item->isImageGeneratorValue()) { 671 if (item->isImageGeneratorValue()) {
670 state.style()->setContent(StyleGeneratedImage::create(toCSSImageGene ratorValue(*item)), didSet); 672 state.style()->setContent(StyleGeneratedImage::create(toCSSImageGene ratorValue(*item)), didSet);
671 didSet = true; 673 didSet = true;
672 } else if (item->isImageSetValue()) { 674 } else if (item->isImageSetValue()) {
673 state.style()->setContent(state.elementStyleResources().setOrPending FromValue(CSSPropertyContent, toCSSImageSetValue(*item)), didSet); 675 state.style()->setContent(state.elementStyleResources().setOrPending FromValue(CSSPropertyContent, toCSSImageSetValue(*item)), didSet);
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
723 break; 725 break;
724 case CSSValueNoOpenQuote: 726 case CSSValueNoOpenQuote:
725 state.style()->setContent(NO_OPEN_QUOTE, didSet); 727 state.style()->setContent(NO_OPEN_QUOTE, didSet);
726 didSet = true; 728 didSet = true;
727 break; 729 break;
728 case CSSValueNoCloseQuote: 730 case CSSValueNoCloseQuote:
729 state.style()->setContent(NO_CLOSE_QUOTE, didSet); 731 state.style()->setContent(NO_CLOSE_QUOTE, didSet);
730 didSet = true; 732 didSet = true;
731 break; 733 break;
732 default: 734 default:
733 // none does not have any effect. 735 ASSERT_NOT_REACHED();
734 { }
735 } 736 }
736 } 737 }
737 } 738 }
738 if (!didSet) 739 ASSERT(didSet);
739 state.style()->clearContent();
740 } 740 }
741 741
742 void StyleBuilderFunctions::applyValueCSSPropertyWebkitLocale(StyleResolverState & state, CSSValue* value) 742 void StyleBuilderFunctions::applyValueCSSPropertyWebkitLocale(StyleResolverState & state, CSSValue* value)
743 { 743 {
744 if (value->isPrimitiveValue()) { 744 if (value->isPrimitiveValue()) {
745 ASSERT(toCSSPrimitiveValue(value)->getValueID() == CSSValueAuto); 745 ASSERT(toCSSPrimitiveValue(value)->getValueID() == CSSValueAuto);
746 state.fontBuilder().setLocale(nullAtom); 746 state.fontBuilder().setLocale(nullAtom);
747 } else { 747 } else {
748 state.fontBuilder().setLocale(AtomicString(toCSSStringValue(value)->valu e())); 748 state.fontBuilder().setLocale(AtomicString(toCSSStringValue(value)->valu e()));
749 } 749 }
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
847 } 847 }
848 } 848 }
849 849
850 void StyleBuilderFunctions::applyInheritCSSPropertyPosition(StyleResolverState& state) 850 void StyleBuilderFunctions::applyInheritCSSPropertyPosition(StyleResolverState& state)
851 { 851 {
852 if (!state.parentNode()->isDocumentNode()) 852 if (!state.parentNode()->isDocumentNode())
853 state.style()->setPosition(state.parentStyle()->position()); 853 state.style()->setPosition(state.parentStyle()->position());
854 } 854 }
855 855
856 } // namespace blink 856 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698