Index: Source/core/html/parser/HTMLSrcsetParser.h |
diff --git a/Source/core/testing/LayerRect.h b/Source/core/html/parser/HTMLSrcsetParser.h |
similarity index 63% |
copy from Source/core/testing/LayerRect.h |
copy to Source/core/html/parser/HTMLSrcsetParser.h |
index 4827feee4f2476d200f0a986a73c81ca9cb4d020..bb53cb893c90f0ed051243083120043e7ec5994d 100644 |
--- a/Source/core/testing/LayerRect.h |
+++ b/Source/core/html/parser/HTMLSrcsetParser.h |
@@ -28,44 +28,52 @@ |
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
-#ifndef LayerRect_h |
-#define LayerRect_h |
+#ifndef HTMLSrcsetParser_h |
+#define HTMLSrcsetParser_h |
-#include "core/dom/ClientRect.h" |
- |
-#include "wtf/PassRefPtr.h" |
-#include "wtf/RefCounted.h" |
-#include "wtf/RefPtr.h" |
#include "wtf/text/WTFString.h" |
namespace WebCore { |
-class Node; |
- |
-class LayerRect : public RefCounted<LayerRect> { |
+class ImageCandidate { |
public: |
- static PassRefPtr<LayerRect> create(PassRefPtr<Node> node, const String& layerType, PassRefPtr<ClientRect> rect) |
+ ImageCandidate() |
+ : m_scaleFactor(1.0) |
+ { |
+ } |
+ |
+ ImageCandidate(const String& source, unsigned start, unsigned length, float scaleFactor) |
+ : m_string(source.createView(start, length)) |
+ , m_scaleFactor(scaleFactor) |
{ |
- return adoptRef(new LayerRect(node, layerType, rect)); |
} |
- Node* layerRootNode() const { return m_layerRootNode.get(); } |
- String layerType() const { return m_layerType; } |
- ClientRect* layerRelativeRect() const { return m_rect.get(); } |
+ String toString() const |
+ { |
+ return m_string.toString(); |
+ } |
-private: |
- LayerRect(PassRefPtr<Node> node, const String& layerName, PassRefPtr<ClientRect> rect) |
- : m_layerRootNode(node) |
- , m_layerType(layerName) |
- , m_rect(rect) |
+ inline float scaleFactor() const |
{ |
+ return m_scaleFactor; |
} |
- RefPtr<Node> m_layerRootNode; |
- String m_layerType; |
- RefPtr<ClientRect> m_rect; |
+ inline bool isEmpty() const |
+ { |
+ return m_string.isEmpty(); |
+ } |
+ |
+private: |
+ StringView m_string; |
+ float m_scaleFactor; |
}; |
-} // namespace WebCore |
+ImageCandidate bestFitSourceForSrcsetAttribute(float deviceScaleFactor, const String& srcsetAttribute); |
+ |
+String bestFitSourceForImageAttributes(float deviceScaleFactor, const String& srcAttribute, const String& srcsetAttribute); |
+ |
+String bestFitSourceForImageAttributes(float deviceScaleFactor, const String& srcAttribute, ImageCandidate& srcsetImageCandidate); |
+ |
+} |
#endif |