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

Side by Side Diff: Source/WebCore/css/StyleResolver.cpp

Issue 13839016: Remove CSS_SHADERS compile-time flag. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 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) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com) 3 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com)
4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com) 4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com)
5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved. 5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved.
6 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> 6 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org>
7 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> 7 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org>
8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
9 * Copyright (c) 2011, Code Aurora Forum. All rights reserved. 9 * Copyright (c) 2011, Code Aurora Forum. All rights reserved.
10 * Copyright (C) Research In Motion Limited 2011. All rights reserved. 10 * Copyright (C) Research In Motion Limited 2011. All rights reserved.
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 #if ENABLE(SVG) 145 #if ENABLE(SVG)
146 #include "CachedSVGDocument.h" 146 #include "CachedSVGDocument.h"
147 #include "CachedSVGDocumentReference.h" 147 #include "CachedSVGDocumentReference.h"
148 #include "SVGDocument.h" 148 #include "SVGDocument.h"
149 #include "SVGElement.h" 149 #include "SVGElement.h"
150 #include "SVGNames.h" 150 #include "SVGNames.h"
151 #include "SVGURIReference.h" 151 #include "SVGURIReference.h"
152 #include "WebKitCSSSVGDocumentValue.h" 152 #include "WebKitCSSSVGDocumentValue.h"
153 #endif 153 #endif
154 154
155 #if ENABLE(CSS_SHADERS)
156 #include "CustomFilterArrayParameter.h" 155 #include "CustomFilterArrayParameter.h"
157 #include "CustomFilterConstants.h" 156 #include "CustomFilterConstants.h"
158 #include "CustomFilterNumberParameter.h" 157 #include "CustomFilterNumberParameter.h"
159 #include "CustomFilterOperation.h" 158 #include "CustomFilterOperation.h"
160 #include "CustomFilterParameter.h" 159 #include "CustomFilterParameter.h"
161 #include "CustomFilterProgramInfo.h" 160 #include "CustomFilterProgramInfo.h"
162 #include "CustomFilterTransformParameter.h" 161 #include "CustomFilterTransformParameter.h"
163 #include "StyleCachedShader.h" 162 #include "StyleCachedShader.h"
164 #include "StyleCustomFilterProgram.h" 163 #include "StyleCustomFilterProgram.h"
165 #include "StyleCustomFilterProgramCache.h" 164 #include "StyleCustomFilterProgramCache.h"
166 #include "StylePendingShader.h" 165 #include "StylePendingShader.h"
167 #include "StyleShader.h" 166 #include "StyleShader.h"
168 #include "WebKitCSSMixFunctionValue.h" 167 #include "WebKitCSSMixFunctionValue.h"
169 #include "WebKitCSSShaderValue.h" 168 #include "WebKitCSSShaderValue.h"
170 #endif
171 169
172 #if ENABLE(CSS_IMAGE_SET) 170 #if ENABLE(CSS_IMAGE_SET)
173 #include "CSSImageSetValue.h" 171 #include "CSSImageSetValue.h"
174 #include "StyleCachedImageSet.h" 172 #include "StyleCachedImageSet.h"
175 #endif 173 #endif
176 174
177 #if ENABLE(VIDEO_TRACK) 175 #if ENABLE(VIDEO_TRACK)
178 #include "WebVTTElement.h" 176 #include "WebVTTElement.h"
179 #endif 177 #endif
180 178
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 } 216 }
219 217
220 inline void StyleResolver::State::clear() 218 inline void StyleResolver::State::clear()
221 { 219 {
222 m_element = 0; 220 m_element = 0;
223 m_styledElement = 0; 221 m_styledElement = 0;
224 m_parentStyle = 0; 222 m_parentStyle = 0;
225 m_parentNode = 0; 223 m_parentNode = 0;
226 m_regionForStyling = 0; 224 m_regionForStyling = 0;
227 m_pendingImageProperties.clear(); 225 m_pendingImageProperties.clear();
228 #if ENABLE(CSS_SHADERS)
229 m_hasPendingShaders = false; 226 m_hasPendingShaders = false;
230 #endif
231 #if ENABLE(CSS_FILTERS) && ENABLE(SVG) 227 #if ENABLE(CSS_FILTERS) && ENABLE(SVG)
232 m_pendingSVGDocuments.clear(); 228 m_pendingSVGDocuments.clear();
233 #endif 229 #endif
234 } 230 }
235 231
236 void StyleResolver::MatchResult::addMatchedProperties(const StylePropertySet* pr operties, StyleRule* rule, unsigned linkMatchType, PropertyWhitelistType propert yWhitelistType) 232 void StyleResolver::MatchResult::addMatchedProperties(const StylePropertySet* pr operties, StyleRule* rule, unsigned linkMatchType, PropertyWhitelistType propert yWhitelistType)
237 { 233 {
238 matchedProperties.grow(matchedProperties.size() + 1); 234 matchedProperties.grow(matchedProperties.size() + 1);
239 StyleResolver::MatchedProperties& newProperties = matchedProperties.last(); 235 StyleResolver::MatchedProperties& newProperties = matchedProperties.last();
240 newProperties.properties = const_cast<StylePropertySet*>(properties); 236 newProperties.properties = const_cast<StylePropertySet*>(properties);
(...skipping 3514 matching lines...) Expand 10 before | Expand all | Expand 10 after
3755 case WebKitCSSFilterValue::OpacityFilterOperation: 3751 case WebKitCSSFilterValue::OpacityFilterOperation:
3756 return FilterOperation::OPACITY; 3752 return FilterOperation::OPACITY;
3757 case WebKitCSSFilterValue::BrightnessFilterOperation: 3753 case WebKitCSSFilterValue::BrightnessFilterOperation:
3758 return FilterOperation::BRIGHTNESS; 3754 return FilterOperation::BRIGHTNESS;
3759 case WebKitCSSFilterValue::ContrastFilterOperation: 3755 case WebKitCSSFilterValue::ContrastFilterOperation:
3760 return FilterOperation::CONTRAST; 3756 return FilterOperation::CONTRAST;
3761 case WebKitCSSFilterValue::BlurFilterOperation: 3757 case WebKitCSSFilterValue::BlurFilterOperation:
3762 return FilterOperation::BLUR; 3758 return FilterOperation::BLUR;
3763 case WebKitCSSFilterValue::DropShadowFilterOperation: 3759 case WebKitCSSFilterValue::DropShadowFilterOperation:
3764 return FilterOperation::DROP_SHADOW; 3760 return FilterOperation::DROP_SHADOW;
3765 #if ENABLE(CSS_SHADERS)
3766 case WebKitCSSFilterValue::CustomFilterOperation: 3761 case WebKitCSSFilterValue::CustomFilterOperation:
3767 return FilterOperation::CUSTOM; 3762 return FilterOperation::CUSTOM;
3768 #endif
3769 case WebKitCSSFilterValue::UnknownFilterOperation: 3763 case WebKitCSSFilterValue::UnknownFilterOperation:
3770 return FilterOperation::NONE; 3764 return FilterOperation::NONE;
3771 } 3765 }
3772 return FilterOperation::NONE; 3766 return FilterOperation::NONE;
3773 } 3767 }
3774 3768
3775 #if ENABLE(CSS_FILTERS) && ENABLE(SVG) 3769 #if ENABLE(CSS_FILTERS) && ENABLE(SVG)
3776 void StyleResolver::loadPendingSVGDocuments() 3770 void StyleResolver::loadPendingSVGDocuments()
3777 { 3771 {
3778 State& state = m_state; 3772 State& state = m_state;
(...skipping 15 matching lines...) Expand all
3794 continue; 3788 continue;
3795 3789
3796 // Stash the CachedSVGDocument on the reference filter. 3790 // Stash the CachedSVGDocument on the reference filter.
3797 referenceFilter->setCachedSVGDocumentReference(adoptPtr(new CachedSV GDocumentReference(cachedDocument))); 3791 referenceFilter->setCachedSVGDocumentReference(adoptPtr(new CachedSV GDocumentReference(cachedDocument)));
3798 } 3792 }
3799 } 3793 }
3800 state.pendingSVGDocuments().clear(); 3794 state.pendingSVGDocuments().clear();
3801 } 3795 }
3802 #endif 3796 #endif
3803 3797
3804 #if ENABLE(CSS_SHADERS)
3805 StyleShader* StyleResolver::styleShader(CSSValue* value) 3798 StyleShader* StyleResolver::styleShader(CSSValue* value)
3806 { 3799 {
3807 if (value->isWebKitCSSShaderValue()) 3800 if (value->isWebKitCSSShaderValue())
3808 return cachedOrPendingStyleShaderFromValue(static_cast<WebKitCSSShaderVa lue*>(value)); 3801 return cachedOrPendingStyleShaderFromValue(static_cast<WebKitCSSShaderVa lue*>(value));
3809 return 0; 3802 return 0;
3810 } 3803 }
3811 3804
3812 StyleShader* StyleResolver::cachedOrPendingStyleShaderFromValue(WebKitCSSShaderV alue* value) 3805 StyleShader* StyleResolver::cachedOrPendingStyleShaderFromValue(WebKitCSSShaderV alue* value)
3813 { 3806 {
3814 StyleShader* shader = value->cachedOrPendingShader(); 3807 StyleShader* shader = value->cachedOrPendingShader();
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
4105 return CustomFilterOperation::create(program.release(), parameterList, meshR ows, meshColumns, meshType); 4098 return CustomFilterOperation::create(program.release(), parameterList, meshR ows, meshColumns, meshType);
4106 } 4099 }
4107 4100
4108 PassRefPtr<CustomFilterOperation> StyleResolver::createCustomFilterOperation(Web KitCSSFilterValue* filterValue) 4101 PassRefPtr<CustomFilterOperation> StyleResolver::createCustomFilterOperation(Web KitCSSFilterValue* filterValue)
4109 { 4102 {
4110 ASSERT(filterValue->length()); 4103 ASSERT(filterValue->length());
4111 bool isAtRuleReferenceSyntax = filterValue->itemWithoutBoundsCheck(0)->isPri mitiveValue(); 4104 bool isAtRuleReferenceSyntax = filterValue->itemWithoutBoundsCheck(0)->isPri mitiveValue();
4112 return isAtRuleReferenceSyntax ? createCustomFilterOperationWithAtRuleRefere nceSyntax(filterValue) : createCustomFilterOperationWithInlineSyntax(filterValue ); 4105 return isAtRuleReferenceSyntax ? createCustomFilterOperationWithAtRuleRefere nceSyntax(filterValue) : createCustomFilterOperationWithInlineSyntax(filterValue );
4113 } 4106 }
4114 4107
4115 #endif
4116 4108
4117 bool StyleResolver::createFilterOperations(CSSValue* inValue, RenderStyle* style , RenderStyle* rootStyle, FilterOperations& outOperations) 4109 bool StyleResolver::createFilterOperations(CSSValue* inValue, RenderStyle* style , RenderStyle* rootStyle, FilterOperations& outOperations)
4118 { 4110 {
4119 ASSERT(outOperations.isEmpty()); 4111 ASSERT(outOperations.isEmpty());
4120 4112
4121 if (!inValue) 4113 if (!inValue)
4122 return false; 4114 return false;
4123 4115
4124 if (inValue->isPrimitiveValue()) { 4116 if (inValue->isPrimitiveValue()) {
4125 CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(inVa lue); 4117 CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(inVa lue);
4126 if (primitiveValue->getIdent() == CSSValueNone) 4118 if (primitiveValue->getIdent() == CSSValueNone)
4127 return true; 4119 return true;
4128 } 4120 }
4129 4121
4130 if (!inValue->isValueList()) 4122 if (!inValue->isValueList())
4131 return false; 4123 return false;
4132 4124
4133 float zoomFactor = style ? style->effectiveZoom() : 1; 4125 float zoomFactor = style ? style->effectiveZoom() : 1;
4134 FilterOperations operations; 4126 FilterOperations operations;
4135 for (CSSValueListIterator i = inValue; i.hasMore(); i.advance()) { 4127 for (CSSValueListIterator i = inValue; i.hasMore(); i.advance()) {
4136 CSSValue* currValue = i.value(); 4128 CSSValue* currValue = i.value();
4137 if (!currValue->isWebKitCSSFilterValue()) 4129 if (!currValue->isWebKitCSSFilterValue())
4138 continue; 4130 continue;
4139 4131
4140 WebKitCSSFilterValue* filterValue = static_cast<WebKitCSSFilterValue*>(i .value()); 4132 WebKitCSSFilterValue* filterValue = static_cast<WebKitCSSFilterValue*>(i .value());
4141 FilterOperation::OperationType operationType = filterOperationForType(fi lterValue->operationType()); 4133 FilterOperation::OperationType operationType = filterOperationForType(fi lterValue->operationType());
4142 4134
4143 #if ENABLE(CSS_SHADERS)
4144 if (operationType == FilterOperation::VALIDATED_CUSTOM) { 4135 if (operationType == FilterOperation::VALIDATED_CUSTOM) {
4145 // ValidatedCustomFilterOperation is not supposed to end up in the R enderStyle. 4136 // ValidatedCustomFilterOperation is not supposed to end up in the R enderStyle.
4146 ASSERT_NOT_REACHED(); 4137 ASSERT_NOT_REACHED();
4147 continue; 4138 continue;
4148 } 4139 }
4149 if (operationType == FilterOperation::CUSTOM) { 4140 if (operationType == FilterOperation::CUSTOM) {
4150 RefPtr<CustomFilterOperation> operation = createCustomFilterOperatio n(filterValue); 4141 RefPtr<CustomFilterOperation> operation = createCustomFilterOperatio n(filterValue);
4151 if (!operation) 4142 if (!operation)
4152 return false; 4143 return false;
4153 4144
4154 operations.operations().append(operation); 4145 operations.operations().append(operation);
4155 continue; 4146 continue;
4156 } 4147 }
4157 #endif
4158 if (operationType == FilterOperation::REFERENCE) { 4148 if (operationType == FilterOperation::REFERENCE) {
4159 #if ENABLE(SVG) 4149 #if ENABLE(SVG)
4160 if (filterValue->length() != 1) 4150 if (filterValue->length() != 1)
4161 continue; 4151 continue;
4162 CSSValue* argument = filterValue->itemWithoutBoundsCheck(0); 4152 CSSValue* argument = filterValue->itemWithoutBoundsCheck(0);
4163 4153
4164 if (!argument->isWebKitCSSSVGDocumentValue()) 4154 if (!argument->isWebKitCSSSVGDocumentValue())
4165 continue; 4155 continue;
4166 4156
4167 WebKitCSSSVGDocumentValue* svgDocumentValue = static_cast<WebKitCSSS VGDocumentValue*>(argument); 4157 WebKitCSSSVGDocumentValue* svgDocumentValue = static_cast<WebKitCSSS VGDocumentValue*>(argument);
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
4382 } 4372 }
4383 4373
4384 m_state.pendingImageProperties().clear(); 4374 m_state.pendingImageProperties().clear();
4385 } 4375 }
4386 4376
4387 void StyleResolver::loadPendingResources() 4377 void StyleResolver::loadPendingResources()
4388 { 4378 {
4389 // Start loading images referenced by this style. 4379 // Start loading images referenced by this style.
4390 loadPendingImages(); 4380 loadPendingImages();
4391 4381
4392 #if ENABLE(CSS_SHADERS)
4393 // Start loading the shaders referenced by this style. 4382 // Start loading the shaders referenced by this style.
4394 loadPendingShaders(); 4383 loadPendingShaders();
4395 #endif
4396 4384
4397 #if ENABLE(CSS_FILTERS) && ENABLE(SVG) 4385 #if ENABLE(CSS_FILTERS) && ENABLE(SVG)
4398 // Start loading the SVG Documents referenced by this style. 4386 // Start loading the SVG Documents referenced by this style.
4399 loadPendingSVGDocuments(); 4387 loadPendingSVGDocuments();
4400 #endif 4388 #endif
4401 } 4389 }
4402 4390
4403 inline StyleResolver::MatchedProperties::MatchedProperties() 4391 inline StyleResolver::MatchedProperties::MatchedProperties()
4404 : possiblyPaddedMember(0) 4392 : possiblyPaddedMember(0)
4405 { 4393 {
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
4451 info.addMember(m_state, "state"); 4439 info.addMember(m_state, "state");
4452 4440
4453 // FIXME: move this to a place where it would be called only once? 4441 // FIXME: move this to a place where it would be called only once?
4454 info.addMember(CSSDefaultStyleSheets::defaultStyle, "defaultStyle"); 4442 info.addMember(CSSDefaultStyleSheets::defaultStyle, "defaultStyle");
4455 info.addMember(CSSDefaultStyleSheets::defaultQuirksStyle, "defaultQuirksStyl e"); 4443 info.addMember(CSSDefaultStyleSheets::defaultQuirksStyle, "defaultQuirksStyl e");
4456 info.addMember(CSSDefaultStyleSheets::defaultPrintStyle,"defaultPrintStyle") ; 4444 info.addMember(CSSDefaultStyleSheets::defaultPrintStyle,"defaultPrintStyle") ;
4457 info.addMember(CSSDefaultStyleSheets::defaultViewSourceStyle, "defaultViewSo urceStyle"); 4445 info.addMember(CSSDefaultStyleSheets::defaultViewSourceStyle, "defaultViewSo urceStyle");
4458 } 4446 }
4459 4447
4460 } // namespace WebCore 4448 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698