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

Unified Diff: Source/core/html/parser/HTMLSrcsetParser.h

Issue 236593003: Align srcset parsing with spec changes (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Added some more tests Created 6 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | Source/core/html/parser/HTMLSrcsetParser.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/parser/HTMLSrcsetParser.h
diff --git a/Source/core/html/parser/HTMLSrcsetParser.h b/Source/core/html/parser/HTMLSrcsetParser.h
index 318992142e7dfeea3553b27819a39fd91a7d73ee..8cb28a5c315705003d7e62cb0b91caffa1e9e167 100644
--- a/Source/core/html/parser/HTMLSrcsetParser.h
+++ b/Source/core/html/parser/HTMLSrcsetParser.h
@@ -53,15 +53,21 @@ struct DescriptorParsingResult {
class ImageCandidate {
public:
+ enum OriginAttribute {
+ SrcsetOrigin,
+ SrcOrigin
+ };
+
ImageCandidate()
: m_scaleFactor(1.0)
{
}
- ImageCandidate(const String& source, unsigned start, unsigned length, const DescriptorParsingResult& result)
+ ImageCandidate(const String& source, unsigned start, unsigned length, const DescriptorParsingResult& result, OriginAttribute originAttribute)
: m_string(source.createView(start, length))
, m_scaleFactor(result.scaleFactor)
, m_resourceWidth(result.resourceWidth)
+ , m_originAttribute(originAttribute)
{
}
@@ -90,6 +96,11 @@ public:
return m_resourceWidth;
}
+ bool srcOrigin() const
+ {
+ return (m_originAttribute == SrcOrigin);
+ }
+
inline bool isEmpty() const
{
return m_string.isEmpty();
@@ -99,6 +110,7 @@ private:
StringView m_string;
float m_scaleFactor;
int m_resourceWidth;
+ OriginAttribute m_originAttribute;
};
ImageCandidate bestFitSourceForSrcsetAttribute(float deviceScaleFactor, int effectiveSize, const String& srcsetAttribute);
« no previous file with comments | « no previous file | Source/core/html/parser/HTMLSrcsetParser.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698