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

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

Issue 2351363002: Make CSSStyleImageValue a member of CanvasImageSource. (Closed)
Patch Set: Created 4 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/css/cssom/CSSStyleImageValue.h" 5 #include "core/css/cssom/CSSStyleImageValue.h"
6 6
7 namespace blink { 7 namespace blink {
8 8
9 double CSSStyleImageValue::intrinsicWidth(bool& isNull) 9 double CSSStyleImageValue::intrinsicWidth(bool& isNull) const
10 { 10 {
11 isNull = isCachePending(); 11 isNull = isCachePending();
12 if (isNull) 12 if (isNull)
13 return 0; 13 return 0;
14 return imageLayoutSize().width().toDouble(); 14 return imageLayoutSize().width().toDouble();
15 } 15 }
16 16
17 double CSSStyleImageValue::intrinsicHeight(bool& isNull) 17 double CSSStyleImageValue::intrinsicHeight(bool& isNull) const
18 { 18 {
19 isNull = isCachePending(); 19 isNull = isCachePending();
20 if (isNull) 20 if (isNull)
21 return 0; 21 return 0;
22 return imageLayoutSize().height().toDouble(); 22 return imageLayoutSize().height().toDouble();
23 } 23 }
24 24
25 double CSSStyleImageValue::intrinsicRatio(bool& isNull) 25 double CSSStyleImageValue::intrinsicRatio(bool& isNull)
26 { 26 {
27 isNull = isCachePending(); 27 isNull = isCachePending();
28 if (isNull) { 28 if (isNull) {
29 return 0; 29 return 0;
30 } 30 }
31 if (intrinsicHeight(isNull) == 0) { 31 if (intrinsicHeight(isNull) == 0) {
32 isNull = true; 32 isNull = true;
33 return 0; 33 return 0;
34 } 34 }
35 return intrinsicWidth(isNull) / intrinsicHeight(isNull); 35 return intrinsicWidth(isNull) / intrinsicHeight(isNull);
36 } 36 }
37 37
38 FloatSize CSSStyleImageValue::elementSize(const FloatSize& defaultObjectSize) co nst
39 {
40 bool notUsed;
41 return FloatSize(intrinsicWidth(notUsed), intrinsicHeight(notUsed));
42 }
43
44 int CSSStyleImageValue::sourceHeight()
45 {
46 bool notUsed;
47 return intrinsicHeight(notUsed);
48 }
49
50 int CSSStyleImageValue::sourceWidth()
51 {
52 bool notUsed;
53 return intrinsicWidth(notUsed);
54 }
55
56 PassRefPtr<Image> CSSStyleImageValue::getSourceImageForCanvas(SourceImageStatus* status, AccelerationHint, SnapshotReason,
ikilpatrick 2016/09/27 18:06:00 would it be better to change this method to accept
Gleb Lanbin 2016/09/27 19:37:18 probably, but this method is not defined here. It'
57 const FloatSize&) const
58 {
59 if (isCachePending())
60 return nullptr;
61 return m_imageValue->cachedImage()->cachedImage()->getImage()->imageForDefau ltFrame();
Justin Novosad 2016/09/28 15:41:58 Confident you don't need any nullptr checks anywhe
Gleb Lanbin 2016/09/28 16:58:22 Done.
62 }
63
38 } // namespace blink 64 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698