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

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

Issue 2694333003: Remove enum ordering dependency in StyleBuilderCustom. (Closed)
Patch Set: Rebase Created 3 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
« no previous file with comments | « no previous file | 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. 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc.
7 * All rights reserved. 7 * All rights reserved.
8 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> 8 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org>
9 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> 9 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org>
10 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. 10 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved.
(...skipping 20 matching lines...) Expand all
31 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 31 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
32 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 32 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
33 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 33 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
34 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 34 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
35 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 35 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
36 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 36 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
37 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 37 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
38 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 38 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
39 */ 39 */
40 40
41 #include <memory>
41 #include "core/CSSPropertyNames.h" 42 #include "core/CSSPropertyNames.h"
42 #include "core/CSSValueKeywords.h" 43 #include "core/CSSValueKeywords.h"
43 #include "core/StyleBuilderFunctions.h" 44 #include "core/StyleBuilderFunctions.h"
44 #include "core/StylePropertyShorthand.h" 45 #include "core/StylePropertyShorthand.h"
45 #include "core/animation/css/CSSAnimations.h" 46 #include "core/animation/css/CSSAnimations.h"
46 #include "core/css/CSSCounterValue.h" 47 #include "core/css/CSSCounterValue.h"
47 #include "core/css/CSSCursorImageValue.h" 48 #include "core/css/CSSCursorImageValue.h"
48 #include "core/css/CSSCustomPropertyDeclaration.h" 49 #include "core/css/CSSCustomPropertyDeclaration.h"
49 #include "core/css/CSSFunctionValue.h" 50 #include "core/css/CSSFunctionValue.h"
50 #include "core/css/CSSGridTemplateAreasValue.h" 51 #include "core/css/CSSGridTemplateAreasValue.h"
51 #include "core/css/CSSHelper.h" 52 #include "core/css/CSSHelper.h"
52 #include "core/css/CSSImageSetValue.h" 53 #include "core/css/CSSImageSetValue.h"
53 #include "core/css/CSSPendingSubstitutionValue.h" 54 #include "core/css/CSSPendingSubstitutionValue.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"
57 #include "core/css/CSSValueIDMappings.h"
56 #include "core/css/CSSVariableReferenceValue.h" 58 #include "core/css/CSSVariableReferenceValue.h"
57 #include "core/css/PropertyRegistration.h" 59 #include "core/css/PropertyRegistration.h"
58 #include "core/css/PropertyRegistry.h" 60 #include "core/css/PropertyRegistry.h"
59 #include "core/css/StylePropertySet.h" 61 #include "core/css/StylePropertySet.h"
60 #include "core/css/StyleRule.h" 62 #include "core/css/StyleRule.h"
61 #include "core/css/resolver/CSSVariableResolver.h" 63 #include "core/css/resolver/CSSVariableResolver.h"
62 #include "core/css/resolver/ElementStyleResources.h" 64 #include "core/css/resolver/ElementStyleResources.h"
63 #include "core/css/resolver/FilterOperationResolver.h" 65 #include "core/css/resolver/FilterOperationResolver.h"
64 #include "core/css/resolver/FontBuilder.h" 66 #include "core/css/resolver/FontBuilder.h"
65 #include "core/css/resolver/StyleBuilder.h" 67 #include "core/css/resolver/StyleBuilder.h"
66 #include "core/frame/LocalFrame.h" 68 #include "core/frame/LocalFrame.h"
67 #include "core/frame/Settings.h" 69 #include "core/frame/Settings.h"
68 #include "core/style/ComputedStyle.h" 70 #include "core/style/ComputedStyle.h"
69 #include "core/style/ComputedStyleConstants.h" 71 #include "core/style/ComputedStyleConstants.h"
70 #include "core/style/ContentData.h" 72 #include "core/style/ContentData.h"
71 #include "core/style/CounterContent.h" 73 #include "core/style/CounterContent.h"
72 #include "core/style/QuotesData.h" 74 #include "core/style/QuotesData.h"
73 #include "core/style/SVGComputedStyle.h" 75 #include "core/style/SVGComputedStyle.h"
74 #include "core/style/StyleGeneratedImage.h" 76 #include "core/style/StyleGeneratedImage.h"
75 #include "core/style/StyleInheritedVariables.h" 77 #include "core/style/StyleInheritedVariables.h"
76 #include "core/style/StyleNonInheritedVariables.h" 78 #include "core/style/StyleNonInheritedVariables.h"
77 #include "platform/fonts/FontDescription.h" 79 #include "platform/fonts/FontDescription.h"
78 #include "wtf/MathExtras.h" 80 #include "wtf/MathExtras.h"
79 #include "wtf/PtrUtil.h" 81 #include "wtf/PtrUtil.h"
80 #include "wtf/StdLibExtras.h" 82 #include "wtf/StdLibExtras.h"
81 #include "wtf/Vector.h" 83 #include "wtf/Vector.h"
82 #include <memory>
83 84
84 namespace blink { 85 namespace blink {
85 86
86 namespace { 87 namespace {
87 88
88 static inline bool isValidVisitedLinkProperty(CSSPropertyID id) { 89 static inline bool isValidVisitedLinkProperty(CSSPropertyID id) {
89 switch (id) { 90 switch (id) {
90 case CSSPropertyBackgroundColor: 91 case CSSPropertyBackgroundColor:
91 case CSSPropertyBorderLeftColor: 92 case CSSPropertyBorderLeftColor:
92 case CSSPropertyBorderRightColor: 93 case CSSPropertyBorderRightColor:
(...skipping 658 matching lines...) Expand 10 before | Expand all | Expand 10 after
751 ContentData* firstContent = nullptr; 752 ContentData* firstContent = nullptr;
752 ContentData* prevContent = nullptr; 753 ContentData* prevContent = nullptr;
753 for (auto& item : toCSSValueList(value)) { 754 for (auto& item : toCSSValueList(value)) {
754 ContentData* nextContent = nullptr; 755 ContentData* nextContent = nullptr;
755 if (item->isImageGeneratorValue() || item->isImageSetValue() || 756 if (item->isImageGeneratorValue() || item->isImageSetValue() ||
756 item->isImageValue()) { 757 item->isImageValue()) {
757 nextContent = 758 nextContent =
758 ContentData::create(state.styleImage(CSSPropertyContent, *item)); 759 ContentData::create(state.styleImage(CSSPropertyContent, *item));
759 } else if (item->isCounterValue()) { 760 } else if (item->isCounterValue()) {
760 const CSSCounterValue* counterValue = toCSSCounterValue(item.get()); 761 const CSSCounterValue* counterValue = toCSSCounterValue(item.get());
761 EListStyleType listStyleType = EListStyleType::kNone; 762 const auto listStyleType =
762 CSSValueID listStyleIdent = counterValue->listStyle(); 763 cssValueIDToPlatformEnum<EListStyleType>(counterValue->listStyle());
763 if (listStyleIdent != CSSValueNone)
764 listStyleType =
765 static_cast<EListStyleType>(listStyleIdent - CSSValueDisc);
766 std::unique_ptr<CounterContent> counter = 764 std::unique_ptr<CounterContent> counter =
767 WTF::wrapUnique(new CounterContent( 765 WTF::wrapUnique(new CounterContent(
768 AtomicString(counterValue->identifier()), listStyleType, 766 AtomicString(counterValue->identifier()), listStyleType,
769 AtomicString(counterValue->separator()))); 767 AtomicString(counterValue->separator())));
770 nextContent = ContentData::create(std::move(counter)); 768 nextContent = ContentData::create(std::move(counter));
771 } else if (item->isIdentifierValue()) { 769 } else if (item->isIdentifierValue()) {
772 QuoteType quoteType; 770 QuoteType quoteType;
773 switch (toCSSIdentifierValue(*item).getValueID()) { 771 switch (toCSSIdentifierValue(*item).getValueID()) {
774 default: 772 default:
775 NOTREACHED(); 773 NOTREACHED();
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
1029 state.style()->setCaretColor( 1027 state.style()->setCaretColor(
1030 StyleBuilderConverter::convertStyleAutoColor(state, value)); 1028 StyleBuilderConverter::convertStyleAutoColor(state, value));
1031 } 1029 }
1032 if (state.applyPropertyToVisitedLinkStyle()) { 1030 if (state.applyPropertyToVisitedLinkStyle()) {
1033 state.style()->setVisitedLinkCaretColor( 1031 state.style()->setVisitedLinkCaretColor(
1034 StyleBuilderConverter::convertStyleAutoColor(state, value, true)); 1032 StyleBuilderConverter::convertStyleAutoColor(state, value, true));
1035 } 1033 }
1036 } 1034 }
1037 1035
1038 } // namespace blink 1036 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698