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

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

Issue 1501313002: Expose custom property values to getComputedStyle. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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 | « third_party/WebKit/Source/core/css/ComputedStyleCSSValueMapping.h ('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) 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 14 matching lines...) Expand all
25 #include "config.h" 25 #include "config.h"
26 #include "core/css/ComputedStyleCSSValueMapping.h" 26 #include "core/css/ComputedStyleCSSValueMapping.h"
27 27
28 #include "core/StylePropertyShorthand.h" 28 #include "core/StylePropertyShorthand.h"
29 #include "core/css/BasicShapeFunctions.h" 29 #include "core/css/BasicShapeFunctions.h"
30 #include "core/css/CSSBasicShapeValues.h" 30 #include "core/css/CSSBasicShapeValues.h"
31 #include "core/css/CSSBorderImage.h" 31 #include "core/css/CSSBorderImage.h"
32 #include "core/css/CSSBorderImageSliceValue.h" 32 #include "core/css/CSSBorderImageSliceValue.h"
33 #include "core/css/CSSCounterValue.h" 33 #include "core/css/CSSCounterValue.h"
34 #include "core/css/CSSCustomIdentValue.h" 34 #include "core/css/CSSCustomIdentValue.h"
35 #include "core/css/CSSCustomPropertyDeclaration.h"
35 #include "core/css/CSSFontFeatureValue.h" 36 #include "core/css/CSSFontFeatureValue.h"
36 #include "core/css/CSSFunctionValue.h" 37 #include "core/css/CSSFunctionValue.h"
37 #include "core/css/CSSGridLineNamesValue.h" 38 #include "core/css/CSSGridLineNamesValue.h"
38 #include "core/css/CSSGridTemplateAreasValue.h" 39 #include "core/css/CSSGridTemplateAreasValue.h"
39 #include "core/css/CSSPathValue.h" 40 #include "core/css/CSSPathValue.h"
40 #include "core/css/CSSPrimitiveValueMappings.h" 41 #include "core/css/CSSPrimitiveValueMappings.h"
41 #include "core/css/CSSQuadValue.h" 42 #include "core/css/CSSQuadValue.h"
42 #include "core/css/CSSReflectValue.h" 43 #include "core/css/CSSReflectValue.h"
43 #include "core/css/CSSShadowValue.h" 44 #include "core/css/CSSShadowValue.h"
44 #include "core/css/CSSStringValue.h" 45 #include "core/css/CSSStringValue.h"
(...skipping 1301 matching lines...) Expand 10 before | Expand all | Expand 10 after
1346 for (auto& coordinate : coordinates) { 1347 for (auto& coordinate : coordinates) {
1347 auto pair = CSSValueList::createSpaceSeparated(); 1348 auto pair = CSSValueList::createSpaceSeparated();
1348 pair->append(zoomAdjustedPixelValueForLength(coordinate.x(), style)); 1349 pair->append(zoomAdjustedPixelValueForLength(coordinate.x(), style));
1349 pair->append(zoomAdjustedPixelValueForLength(coordinate.y(), style)); 1350 pair->append(zoomAdjustedPixelValueForLength(coordinate.y(), style));
1350 list->append(pair); 1351 list->append(pair);
1351 } 1352 }
1352 1353
1353 return list.release(); 1354 return list.release();
1354 } 1355 }
1355 1356
1357 PassRefPtrWillBeRawPtr<CSSValue> ComputedStyleCSSValueMapping::get(const AtomicS tring customPropertyName, const ComputedStyle& style)
1358 {
1359 return CSSCustomPropertyDeclaration::create(customPropertyName, style.variab les()->getVariable(customPropertyName));
1360 }
1361
1356 PassRefPtrWillBeRawPtr<CSSValue> ComputedStyleCSSValueMapping::get(CSSPropertyID propertyID, const ComputedStyle& style, const LayoutObject* layoutObject, Node* styledNode, bool allowVisitedStyle) 1362 PassRefPtrWillBeRawPtr<CSSValue> ComputedStyleCSSValueMapping::get(CSSPropertyID propertyID, const ComputedStyle& style, const LayoutObject* layoutObject, Node* styledNode, bool allowVisitedStyle)
1357 { 1363 {
1358 const SVGComputedStyle& svgStyle = style.svgStyle(); 1364 const SVGComputedStyle& svgStyle = style.svgStyle();
1359 propertyID = CSSProperty::resolveDirectionAwareProperty(propertyID, style.di rection(), style.writingMode()); 1365 propertyID = CSSProperty::resolveDirectionAwareProperty(propertyID, style.di rection(), style.writingMode());
1360 switch (propertyID) { 1366 switch (propertyID) {
1361 case CSSPropertyInvalid: 1367 case CSSPropertyInvalid:
1362 return nullptr; 1368 return nullptr;
1363 1369
1364 case CSSPropertyBackgroundColor: 1370 case CSSPropertyBackgroundColor:
1365 return allowVisitedStyle ? cssValuePool().createColorValue(style.visited DependentColor(CSSPropertyBackgroundColor).rgb()) : currentColorOrValidColor(sty le, style.backgroundColor()); 1371 return allowVisitedStyle ? cssValuePool().createColorValue(style.visited DependentColor(CSSPropertyBackgroundColor).rgb()) : currentColorOrValidColor(sty le, style.backgroundColor());
(...skipping 1323 matching lines...) Expand 10 before | Expand all | Expand 10 after
2689 if (style.contain() & ContainsStyle) 2695 if (style.contain() & ContainsStyle)
2690 list->append(cssValuePool().createIdentifierValue(CSSValueStyle)); 2696 list->append(cssValuePool().createIdentifierValue(CSSValueStyle));
2691 if (style.contain() & ContainsLayout) 2697 if (style.contain() & ContainsLayout)
2692 list->append(cssValuePool().createIdentifierValue(CSSValueLayout)); 2698 list->append(cssValuePool().createIdentifierValue(CSSValueLayout));
2693 if (style.contain() & ContainsPaint) 2699 if (style.contain() & ContainsPaint)
2694 list->append(cssValuePool().createIdentifierValue(CSSValuePaint)); 2700 list->append(cssValuePool().createIdentifierValue(CSSValuePaint));
2695 ASSERT(list->length()); 2701 ASSERT(list->length());
2696 return list.release(); 2702 return list.release();
2697 } 2703 }
2698 case CSSPropertyVariable: 2704 case CSSPropertyVariable:
2699 // TODO(leviw): We should have a way to retrive variables here. 2705 // Variables are retrieved via get(AtomicString).
2700 ASSERT_NOT_REACHED(); 2706 ASSERT_NOT_REACHED();
2701 return nullptr; 2707 return nullptr;
2702 case CSSPropertyAll: 2708 case CSSPropertyAll:
2703 return nullptr; 2709 return nullptr;
2704 default: 2710 default:
2705 break; 2711 break;
2706 } 2712 }
2707 ASSERT_NOT_REACHED(); 2713 ASSERT_NOT_REACHED();
2708 return nullptr; 2714 return nullptr;
2709 } 2715 }
2710 2716
2711 } 2717 }
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/ComputedStyleCSSValueMapping.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698