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

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

Issue 1312543003: Split out Attribute from CSSPrimitiveValue (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@clean_up_get_string_value
Patch Set: Rebase Created 5 years, 3 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
« no previous file with comments | « Source/core/css/parser/CSSPropertyParser.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 27 matching lines...) Expand all
38 38
39 #include "config.h" 39 #include "config.h"
40 40
41 #include "core/CSSPropertyNames.h" 41 #include "core/CSSPropertyNames.h"
42 #include "core/CSSValueKeywords.h" 42 #include "core/CSSValueKeywords.h"
43 #include "core/StyleBuilderFunctions.h" 43 #include "core/StyleBuilderFunctions.h"
44 #include "core/StylePropertyShorthand.h" 44 #include "core/StylePropertyShorthand.h"
45 #include "core/css/BasicShapeFunctions.h" 45 #include "core/css/BasicShapeFunctions.h"
46 #include "core/css/CSSCounterValue.h" 46 #include "core/css/CSSCounterValue.h"
47 #include "core/css/CSSCursorImageValue.h" 47 #include "core/css/CSSCursorImageValue.h"
48 #include "core/css/CSSFunctionValue.h"
48 #include "core/css/CSSGradientValue.h" 49 #include "core/css/CSSGradientValue.h"
49 #include "core/css/CSSGridTemplateAreasValue.h" 50 #include "core/css/CSSGridTemplateAreasValue.h"
50 #include "core/css/CSSHelper.h" 51 #include "core/css/CSSHelper.h"
51 #include "core/css/CSSImageSetValue.h" 52 #include "core/css/CSSImageSetValue.h"
52 #include "core/css/CSSLineBoxContainValue.h" 53 #include "core/css/CSSLineBoxContainValue.h"
53 #include "core/css/CSSPathValue.h" 54 #include "core/css/CSSPathValue.h"
54 #include "core/css/CSSPrimitiveValueMappings.h" 55 #include "core/css/CSSPrimitiveValueMappings.h"
55 #include "core/css/CSSPropertyMetadata.h" 56 #include "core/css/CSSPropertyMetadata.h"
56 #include "core/css/CSSValuePair.h" 57 #include "core/css/CSSValuePair.h"
57 #include "core/css/StylePropertySet.h" 58 #include "core/css/StylePropertySet.h"
(...skipping 663 matching lines...) Expand 10 before | Expand all | Expand 10 after
721 CSSCounterValue* counterValue = toCSSCounterValue(item.get()); 722 CSSCounterValue* counterValue = toCSSCounterValue(item.get());
722 EListStyleType listStyleType = NoneListStyle; 723 EListStyleType listStyleType = NoneListStyle;
723 CSSValueID listStyleIdent = counterValue->listStyleIdent(); 724 CSSValueID listStyleIdent = counterValue->listStyleIdent();
724 if (listStyleIdent != CSSValueNone) 725 if (listStyleIdent != CSSValueNone)
725 listStyleType = static_cast<EListStyleType>(listStyleIdent - CSS ValueDisc); 726 listStyleType = static_cast<EListStyleType>(listStyleIdent - CSS ValueDisc);
726 OwnPtr<CounterContent> counter = adoptPtr(new CounterContent(AtomicS tring(counterValue->identifier()), listStyleType, AtomicString(counterValue->sep arator()))); 727 OwnPtr<CounterContent> counter = adoptPtr(new CounterContent(AtomicS tring(counterValue->identifier()), listStyleType, AtomicString(counterValue->sep arator())));
727 state.style()->setContent(counter.release(), didSet); 728 state.style()->setContent(counter.release(), didSet);
728 didSet = true; 729 didSet = true;
729 } 730 }
730 731
732 if (item->isFunctionValue()) {
733 CSSFunctionValue* functionValue = toCSSFunctionValue(item.get());
734 ASSERT(functionValue->functionType() == CSSValueAttr);
735 // FIXME: Can a namespace be specified for an attr(foo)?
736 if (state.style()->styleType() == NOPSEUDO)
737 state.style()->setUnique();
738 else
739 state.parentStyle()->setUnique();
740 QualifiedName attr(nullAtom, AtomicString(toCSSPrimitiveValue(functi onValue->item(0))->getStringValue()), nullAtom);
741 const AtomicString& value = state.element()->getAttribute(attr);
742 state.style()->setContent(value.isNull() ? emptyString() : value.str ing(), didSet);
743 didSet = true;
744 }
745
731 if (!item->isPrimitiveValue()) 746 if (!item->isPrimitiveValue())
732 continue; 747 continue;
733 748
734 CSSPrimitiveValue* contentValue = toCSSPrimitiveValue(item.get()); 749 CSSPrimitiveValue* contentValue = toCSSPrimitiveValue(item.get());
735 750
736 if (contentValue->isString()) { 751 if (contentValue->isString()) {
737 state.style()->setContent(contentValue->getStringValue().impl(), did Set); 752 state.style()->setContent(contentValue->getStringValue().impl(), did Set);
738 didSet = true; 753 didSet = true;
739 } else if (contentValue->isAttr()) {
740 // FIXME: Can a namespace be specified for an attr(foo)?
741 if (state.style()->styleType() == NOPSEUDO)
742 state.style()->setUnique();
743 else
744 state.parentStyle()->setUnique();
745 QualifiedName attr(nullAtom, AtomicString(contentValue->getStringVal ue()), nullAtom);
746 const AtomicString& value = state.element()->getAttribute(attr);
747 state.style()->setContent(value.isNull() ? emptyString() : value.str ing(), didSet);
748 didSet = true;
749 } else { 754 } else {
750 switch (contentValue->getValueID()) { 755 switch (contentValue->getValueID()) {
751 case CSSValueOpenQuote: 756 case CSSValueOpenQuote:
752 state.style()->setContent(OPEN_QUOTE, didSet); 757 state.style()->setContent(OPEN_QUOTE, didSet);
753 didSet = true; 758 didSet = true;
754 break; 759 break;
755 case CSSValueCloseQuote: 760 case CSSValueCloseQuote:
756 state.style()->setContent(CLOSE_QUOTE, didSet); 761 state.style()->setContent(CLOSE_QUOTE, didSet);
757 didSet = true; 762 didSet = true;
758 break; 763 break;
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
840 return; 845 return;
841 case CSSValueSuper: 846 case CSSValueSuper:
842 svgStyle.setBaselineShift(BS_SUPER); 847 svgStyle.setBaselineShift(BS_SUPER);
843 return; 848 return;
844 default: 849 default:
845 ASSERT_NOT_REACHED(); 850 ASSERT_NOT_REACHED();
846 } 851 }
847 } 852 }
848 853
849 } // namespace blink 854 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/css/parser/CSSPropertyParser.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698