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

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

Issue 1812763002: Pseudo and non pseudo elements should return correct computed content value (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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) 2004 Zack Rusin <zack@kde.org> 2 * Copyright (C) 2004 Zack Rusin <zack@kde.org>
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved. 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved.
4 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> 4 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org>
5 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> 5 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com>
6 * Copyright (C) 2011 Sencha, Inc. All rights reserved. 6 * Copyright (C) 2011 Sencha, Inc. All rights reserved.
7 * Copyright (C) 2015 Google Inc. All rights reserved. 7 * Copyright (C) 2015 Google Inc. All rights reserved.
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public 10 * modify it under the terms of the GNU Lesser General Public
(...skipping 957 matching lines...) Expand 10 before | Expand all | Expand 10 after
968 return CSSValueNoCloseQuote; 968 return CSSValueNoCloseQuote;
969 case CLOSE_QUOTE: 969 case CLOSE_QUOTE:
970 return CSSValueCloseQuote; 970 return CSSValueCloseQuote;
971 case OPEN_QUOTE: 971 case OPEN_QUOTE:
972 return CSSValueOpenQuote; 972 return CSSValueOpenQuote;
973 } 973 }
974 ASSERT_NOT_REACHED(); 974 ASSERT_NOT_REACHED();
975 return CSSValueInvalid; 975 return CSSValueInvalid;
976 } 976 }
977 977
978 CSSValueID valueForElementContent(const ElementContent elementContent)
nainar 2016/03/21 00:12:08 Added the mapping here as QuoteType the other enum
979 {
980 switch (elementContent) {
981 case ContentDataNone:
982 return CSSValueNone;
983 case ContentDataNormal:
984 return CSSValueNormal;
985 }
986 ASSERT_NOT_REACHED();
987 return CSSValueInvalid;
988 }
989
978 static PassRefPtrWillBeRawPtr<CSSValue> valueForContentData(const ComputedStyle& style) 990 static PassRefPtrWillBeRawPtr<CSSValue> valueForContentData(const ComputedStyle& style)
979 { 991 {
980 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated() ; 992 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated() ;
993 if (!style.contentData() && style.hasPseudoElementStyle()) {
994 list->append(cssValuePool().createIdentifierValue(CSSValueNormal));
995 }
981 for (const ContentData* contentData = style.contentData(); contentData; cont entData = contentData->next()) { 996 for (const ContentData* contentData = style.contentData(); contentData; cont entData = contentData->next()) {
982 if (contentData->isCounter()) { 997 if (contentData->isCounter()) {
983 const CounterContent* counter = toCounterContentData(contentData)->c ounter(); 998 const CounterContent* counter = toCounterContentData(contentData)->c ounter();
984 ASSERT(counter); 999 ASSERT(counter);
985 RefPtrWillBeRawPtr<CSSCustomIdentValue> identifier = CSSCustomIdentV alue::create(counter->identifier()); 1000 RefPtrWillBeRawPtr<CSSCustomIdentValue> identifier = CSSCustomIdentV alue::create(counter->identifier());
986 RefPtrWillBeRawPtr<CSSCustomIdentValue> separator = CSSCustomIdentVa lue::create(counter->separator()); 1001 RefPtrWillBeRawPtr<CSSCustomIdentValue> separator = CSSCustomIdentVa lue::create(counter->separator());
987 CSSValueID listStyleIdent = CSSValueNone; 1002 CSSValueID listStyleIdent = CSSValueNone;
988 if (counter->listStyle() != NoneListStyle) 1003 if (counter->listStyle() != NoneListStyle)
989 listStyleIdent = static_cast<CSSValueID>(CSSValueDisc + counter- >listStyle()); 1004 listStyleIdent = static_cast<CSSValueID>(CSSValueDisc + counter- >listStyle());
990 RefPtrWillBeRawPtr<CSSPrimitiveValue> listStyle = cssValuePool().cre ateIdentifierValue(listStyleIdent); 1005 RefPtrWillBeRawPtr<CSSPrimitiveValue> listStyle = cssValuePool().cre ateIdentifierValue(listStyleIdent);
991 list->append(CSSCounterValue::create(identifier.release(), listStyle .release(), separator.release())); 1006 list->append(CSSCounterValue::create(identifier.release(), listStyle .release(), separator.release()));
992 } else if (contentData->isImage()) { 1007 } else if (contentData->isImage()) {
993 const StyleImage* image = toImageContentData(contentData)->image(); 1008 const StyleImage* image = toImageContentData(contentData)->image();
994 ASSERT(image); 1009 ASSERT(image);
995 list->append(image->computedCSSValue()); 1010 list->append(image->computedCSSValue());
996 } else if (contentData->isText()) { 1011 } else if (contentData->isText()) {
997 list->append(CSSStringValue::create(toTextContentData(contentData)-> text())); 1012 list->append(CSSStringValue::create(toTextContentData(contentData)-> text()));
998 } else if (contentData->isQuote()) { 1013 } else if (contentData->isQuote()) {
999 const QuoteType quoteType = toQuoteContentData(contentData)->quote() ; 1014 const QuoteType quoteType = toQuoteContentData(contentData)->quote() ;
1000 list->append(cssValuePool().createIdentifierValue(valueForQuoteType( quoteType))); 1015 list->append(cssValuePool().createIdentifierValue(valueForQuoteType( quoteType)));
1016 } else if (contentData->isElementContent()) {
1017 ElementContent elementContent = toElementContentContentData(contentD ata)->elementContent();
1018 list->append(cssValuePool().createIdentifierValue(valueForElementCon tent(elementContent)));
1001 } else { 1019 } else {
1002 ASSERT_NOT_REACHED(); 1020 ASSERT_NOT_REACHED();
1003 } 1021 }
1004 } 1022 }
1005 return list.release(); 1023 return list.release();
1006 } 1024 }
1007 1025
1008 static PassRefPtrWillBeRawPtr<CSSValue> valueForCounterDirectives(const Computed Style& style, CSSPropertyID propertyID) 1026 static PassRefPtrWillBeRawPtr<CSSValue> valueForCounterDirectives(const Computed Style& style, CSSPropertyID propertyID)
1009 { 1027 {
1010 const CounterDirectiveMap* map = style.counterDirectives(); 1028 const CounterDirectiveMap* map = style.counterDirectives();
(...skipping 1743 matching lines...) Expand 10 before | Expand all | Expand 10 after
2754 case CSSPropertyAll: 2772 case CSSPropertyAll:
2755 return nullptr; 2773 return nullptr;
2756 default: 2774 default:
2757 break; 2775 break;
2758 } 2776 }
2759 ASSERT_NOT_REACHED(); 2777 ASSERT_NOT_REACHED();
2760 return nullptr; 2778 return nullptr;
2761 } 2779 }
2762 2780
2763 } // namespace blink 2781 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698