OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Apple Inc. All rights reserved. | 2 * Copyright (C) 2013 Apple Inc. All rights reserved. |
3 * Copyright (C) 2013 Google Inc. All rights reserved. | 3 * Copyright (C) 2013 Google Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
7 * met: | 7 * met: |
8 * | 8 * |
9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 , m_resourceWidth(UninitializedDescriptor) | 50 , m_resourceWidth(UninitializedDescriptor) |
51 , m_resourceHeight(UninitializedDescriptor) | 51 , m_resourceHeight(UninitializedDescriptor) |
52 { | 52 { |
53 } | 53 } |
54 | 54 |
55 bool hasDensity() const { return m_density >= 0; } | 55 bool hasDensity() const { return m_density >= 0; } |
56 bool hasWidth() const { return m_resourceWidth >= 0; } | 56 bool hasWidth() const { return m_resourceWidth >= 0; } |
57 bool hasHeight() const { return m_resourceHeight >= 0; } | 57 bool hasHeight() const { return m_resourceHeight >= 0; } |
58 | 58 |
59 float density() const { ASSERT(hasDensity()); return m_density; } | 59 float density() const { ASSERT(hasDensity()); return m_density; } |
60 unsigned resourceWidth() const { ASSERT(hasWidth()); return m_resourceWidth;
} | 60 unsigned getResourceWidth() const { ASSERT(hasWidth()); return m_resourceWid
th; } |
61 unsigned resourceHeight() const { ASSERT(hasHeight()); return m_resourceHeig
ht; } | 61 unsigned resourceHeight() const { ASSERT(hasHeight()); return m_resourceHeig
ht; } |
62 | 62 |
63 void setResourceWidth(int width) { ASSERT(width >= 0); m_resourceWidth = (un
signed)width; } | 63 void setResourceWidth(int width) { ASSERT(width >= 0); m_resourceWidth = (un
signed)width; } |
64 void setResourceHeight(int height) { ASSERT(height >= 0); m_resourceHeight =
(unsigned)height; } | 64 void setResourceHeight(int height) { ASSERT(height >= 0); m_resourceHeight =
(unsigned)height; } |
65 void setDensity(float densityToSet) { ASSERT(densityToSet >= 0); m_density =
densityToSet; } | 65 void setDensity(float densityToSet) { ASSERT(densityToSet >= 0); m_density =
densityToSet; } |
66 | 66 |
67 private: | 67 private: |
68 float m_density; | 68 float m_density; |
69 int m_resourceWidth; | 69 int m_resourceWidth; |
70 int m_resourceHeight; | 70 int m_resourceHeight; |
(...skipping 10 matching lines...) Expand all Loading... |
81 ImageCandidate() | 81 ImageCandidate() |
82 : m_density(1.0) | 82 : m_density(1.0) |
83 , m_resourceWidth(UninitializedDescriptor) | 83 , m_resourceWidth(UninitializedDescriptor) |
84 , m_originAttribute(SrcsetOrigin) | 84 , m_originAttribute(SrcsetOrigin) |
85 { | 85 { |
86 } | 86 } |
87 | 87 |
88 ImageCandidate(const String& source, unsigned start, unsigned length, const
DescriptorParsingResult& result, OriginAttribute originAttribute) | 88 ImageCandidate(const String& source, unsigned start, unsigned length, const
DescriptorParsingResult& result, OriginAttribute originAttribute) |
89 : m_string(source.createView(start, length)) | 89 : m_string(source.createView(start, length)) |
90 , m_density(result.hasDensity()?result.density():UninitializedDescriptor
) | 90 , m_density(result.hasDensity()?result.density():UninitializedDescriptor
) |
91 , m_resourceWidth(result.hasWidth()?result.resourceWidth():Uninitialized
Descriptor) | 91 , m_resourceWidth(result.hasWidth()?result.getResourceWidth():Uninitiali
zedDescriptor) |
92 , m_originAttribute(originAttribute) | 92 , m_originAttribute(originAttribute) |
93 { | 93 { |
94 } | 94 } |
95 | 95 |
96 String toString() const | 96 String toString() const |
97 { | 97 { |
98 return String(m_string.toString()); | 98 return String(m_string.toString()); |
99 } | 99 } |
100 | 100 |
101 AtomicString url() const | 101 AtomicString url() const |
102 { | 102 { |
103 return AtomicString(m_string.toString()); | 103 return AtomicString(m_string.toString()); |
104 } | 104 } |
105 | 105 |
106 void setDensity(float factor) | 106 void setDensity(float factor) |
107 { | 107 { |
108 m_density = factor; | 108 m_density = factor; |
109 } | 109 } |
110 | 110 |
111 float density() const | 111 float density() const |
112 { | 112 { |
113 return m_density; | 113 return m_density; |
114 } | 114 } |
115 | 115 |
116 int resourceWidth() const | 116 int getResourceWidth() const |
117 { | 117 { |
118 return m_resourceWidth; | 118 return m_resourceWidth; |
119 } | 119 } |
120 | 120 |
121 bool srcOrigin() const | 121 bool srcOrigin() const |
122 { | 122 { |
123 return (m_originAttribute == SrcOrigin); | 123 return (m_originAttribute == SrcOrigin); |
124 } | 124 } |
125 | 125 |
126 inline bool isEmpty() const | 126 inline bool isEmpty() const |
(...skipping 10 matching lines...) Expand all Loading... |
137 | 137 |
138 ImageCandidate bestFitSourceForSrcsetAttribute(float deviceScaleFactor, float so
urceSize, const String& srcsetAttribute, Document* = nullptr); | 138 ImageCandidate bestFitSourceForSrcsetAttribute(float deviceScaleFactor, float so
urceSize, const String& srcsetAttribute, Document* = nullptr); |
139 | 139 |
140 CORE_EXPORT ImageCandidate bestFitSourceForImageAttributes(float deviceScaleFact
or, float sourceSize, const String& srcAttribute, const String& srcsetAttribute,
Document* = nullptr); | 140 CORE_EXPORT ImageCandidate bestFitSourceForImageAttributes(float deviceScaleFact
or, float sourceSize, const String& srcAttribute, const String& srcsetAttribute,
Document* = nullptr); |
141 | 141 |
142 String bestFitSourceForImageAttributes(float deviceScaleFactor, float sourceSize
, const String& srcAttribute, ImageCandidate& srcsetImageCandidate); | 142 String bestFitSourceForImageAttributes(float deviceScaleFactor, float sourceSize
, const String& srcAttribute, ImageCandidate& srcsetImageCandidate); |
143 | 143 |
144 } // namespace blink | 144 } // namespace blink |
145 | 145 |
146 #endif | 146 #endif |
OLD | NEW |