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

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

Issue 1387113002: Change StyleResolverState.styleImage() to take a const CSSValue& (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added TODOs to replace the members with const members Created 5 years, 2 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 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. 3 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
4 * Copyright (C) 2013 Google Inc. All rights reserved. 4 * Copyright (C) 2013 Google Inc. All rights reserved.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 21 matching lines...) Expand all
32 #include "core/style/StylePendingImage.h" 32 #include "core/style/StylePendingImage.h"
33 #include "platform/graphics/filters/FilterOperation.h" 33 #include "platform/graphics/filters/FilterOperation.h"
34 34
35 namespace blink { 35 namespace blink {
36 36
37 ElementStyleResources::ElementStyleResources() 37 ElementStyleResources::ElementStyleResources()
38 : m_deviceScaleFactor(1) 38 : m_deviceScaleFactor(1)
39 { 39 {
40 } 40 }
41 41
42 PassRefPtrWillBeRawPtr<StyleImage> ElementStyleResources::styleImage(Document& d ocument, CSSPropertyID property, CSSValue* value) 42 PassRefPtrWillBeRawPtr<StyleImage> ElementStyleResources::styleImage(Document& d ocument, CSSPropertyID property, const CSSValue& value)
43 { 43 {
44 if (value->isImageValue()) 44 if (value.isImageValue())
45 return cachedOrPendingFromValue(document, property, toCSSImageValue(valu e)); 45 return cachedOrPendingFromValue(document, property, toCSSImageValue(valu e));
46 46
47 if (value->isImageGeneratorValue()) 47 if (value.isImageGeneratorValue())
48 return generatedOrPendingFromValue(property, toCSSImageGeneratorValue(va lue)); 48 return generatedOrPendingFromValue(property, toCSSImageGeneratorValue(va lue));
49 49
50 if (value->isImageSetValue()) 50 if (value.isImageSetValue())
51 return setOrPendingFromValue(property, toCSSImageSetValue(value)); 51 return setOrPendingFromValue(property, toCSSImageSetValue(value));
52 52
53 if (value->isCursorImageValue()) 53 if (value.isCursorImageValue())
54 return cursorOrPendingFromValue(property, toCSSCursorImageValue(value)); 54 return cursorOrPendingFromValue(property, toCSSCursorImageValue(value));
55 55
56 return nullptr; 56 return nullptr;
57 } 57 }
58 58
59 PassRefPtrWillBeRawPtr<StyleImage> ElementStyleResources::generatedOrPendingFrom Value(CSSPropertyID property, CSSImageGeneratorValue* value) 59 PassRefPtrWillBeRawPtr<StyleImage> ElementStyleResources::generatedOrPendingFrom Value(CSSPropertyID property, const CSSImageGeneratorValue& value)
60 { 60 {
61 if (value->isPending()) { 61 if (value.isPending()) {
62 m_pendingImageProperties.add(property); 62 m_pendingImageProperties.add(property);
63 return StylePendingImage::create(value); 63 return StylePendingImage::create(value);
64 } 64 }
65 return StyleGeneratedImage::create(value); 65 return StyleGeneratedImage::create(value);
66 } 66 }
67 67
68 PassRefPtrWillBeRawPtr<StyleImage> ElementStyleResources::setOrPendingFromValue( CSSPropertyID property, CSSImageSetValue* value) 68 PassRefPtrWillBeRawPtr<StyleImage> ElementStyleResources::setOrPendingFromValue( CSSPropertyID property, const CSSImageSetValue& value)
69 { 69 {
70 if (value->isCachePending(m_deviceScaleFactor)) { 70 if (value.isCachePending(m_deviceScaleFactor)) {
71 m_pendingImageProperties.add(property); 71 m_pendingImageProperties.add(property);
72 return StylePendingImage::create(value); 72 return StylePendingImage::create(value);
73 } 73 }
74 return value->cachedImageSet(m_deviceScaleFactor); 74 return value.cachedImageSet(m_deviceScaleFactor);
75 } 75 }
76 76
77 PassRefPtrWillBeRawPtr<StyleImage> ElementStyleResources::cachedOrPendingFromVal ue(Document& document, CSSPropertyID property, CSSImageValue* value) 77 PassRefPtrWillBeRawPtr<StyleImage> ElementStyleResources::cachedOrPendingFromVal ue(Document& document, CSSPropertyID property, const CSSImageValue& value)
78 { 78 {
79 if (value->isCachePending()) { 79 if (value.isCachePending()) {
80 m_pendingImageProperties.add(property); 80 m_pendingImageProperties.add(property);
81 return StylePendingImage::create(value); 81 return StylePendingImage::create(value);
82 } 82 }
83 value->restoreCachedResourceIfNeeded(document); 83 value.restoreCachedResourceIfNeeded(document);
84 return value->cachedImage(); 84 return value.cachedImage();
85 } 85 }
86 86
87 PassRefPtrWillBeRawPtr<StyleImage> ElementStyleResources::cursorOrPendingFromVal ue(CSSPropertyID property, CSSCursorImageValue* value) 87 PassRefPtrWillBeRawPtr<StyleImage> ElementStyleResources::cursorOrPendingFromVal ue(CSSPropertyID property, const CSSCursorImageValue& value)
88 { 88 {
89 if (value->isCachePending(m_deviceScaleFactor)) { 89 if (value.isCachePending(m_deviceScaleFactor)) {
90 m_pendingImageProperties.add(property); 90 m_pendingImageProperties.add(property);
91 return StylePendingImage::create(value); 91 return StylePendingImage::create(value);
92 } 92 }
93 return value->cachedImage(m_deviceScaleFactor); 93 return value.cachedImage(m_deviceScaleFactor);
94 } 94 }
95 95
96 void ElementStyleResources::clearPendingImageProperties() 96 void ElementStyleResources::clearPendingImageProperties()
97 { 97 {
98 m_pendingImageProperties.clear(); 98 m_pendingImageProperties.clear();
99 } 99 }
100 100
101 void ElementStyleResources::clearPendingSVGDocuments() 101 void ElementStyleResources::clearPendingSVGDocuments()
102 { 102 {
103 m_pendingSVGDocuments.clear(); 103 m_pendingSVGDocuments.clear();
104 } 104 }
105 105
106 void ElementStyleResources::addPendingSVGDocument(FilterOperation* filterOperati on, CSSSVGDocumentValue* cssSVGDocumentValue) 106 void ElementStyleResources::addPendingSVGDocument(FilterOperation* filterOperati on, CSSSVGDocumentValue* cssSVGDocumentValue)
107 { 107 {
108 m_pendingSVGDocuments.set(filterOperation, cssSVGDocumentValue); 108 m_pendingSVGDocuments.set(filterOperation, cssSVGDocumentValue);
109 } 109 }
110 110
111 } 111 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698