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

Unified Diff: Source/core/html/HTMLImageElement.cpp

Issue 224733011: A sizes attribute parser (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Added invalid length layout test 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
Index: Source/core/html/HTMLImageElement.cpp
diff --git a/Source/core/html/HTMLImageElement.cpp b/Source/core/html/HTMLImageElement.cpp
index 398e78e63dd32c4cae4e7b5d529cc97d90653f20..3ee95ca248673f595dbf653ca55f25e108092de3 100644
--- a/Source/core/html/HTMLImageElement.cpp
+++ b/Source/core/html/HTMLImageElement.cpp
@@ -27,6 +27,7 @@
#include "HTMLNames.h"
#include "RuntimeEnabledFeatures.h"
#include "bindings/v8/ScriptEventListener.h"
+#include "core/css/parser/SizesAttributeParser.h"
#include "core/dom/Attribute.h"
#include "core/fetch/ImageResource.h"
#include "core/html/HTMLAnchorElement.h"
@@ -49,6 +50,7 @@ HTMLImageElement::HTMLImageElement(Document& document, HTMLFormElement* form)
, m_compositeOperator(CompositeSourceOver)
, m_imageDevicePixelRatio(1.0f)
, m_formWasSetByParser(false)
+ , m_effectiveSize(0)
{
ScriptWrappable::init(this);
if (form && form->inDocument()) {
@@ -165,6 +167,8 @@ void HTMLImageElement::parseAttribute(const QualifiedName& name, const AtomicStr
toRenderImage(renderer())->setImageDevicePixelRatio(m_imageDevicePixelRatio);
}
m_imageLoader.updateFromElementIgnoringPreviousError();
+ } else if (RuntimeEnabledFeatures::pictureSizesEnabled() && name == sizesAttr) {
+ m_effectiveSize = SizesAttributeParser::findEffectiveSize(value, MediaValues::create(document(), MediaValues::DynamicMode));
} else if (name == usemapAttr) {
setIsLink(!value.isNull());
} else if (name == compositeAttr) {

Powered by Google App Engine
This is Rietveld 408576698