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

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: Fixed rebase 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 | « Source/core/html/HTMLImageElement.h ('k') | Source/core/html/HTMLImageElement.idl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/HTMLImageElement.cpp
diff --git a/Source/core/html/HTMLImageElement.cpp b/Source/core/html/HTMLImageElement.cpp
index f7bd98a18f95fb54b6e865414260d07a5ac7c274..0ce1d2ce4697f23f46611c0923a13139762f5957 100644
--- a/Source/core/html/HTMLImageElement.cpp
+++ b/Source/core/html/HTMLImageElement.cpp
@@ -27,6 +27,8 @@
#include "HTMLNames.h"
#include "RuntimeEnabledFeatures.h"
#include "bindings/v8/ScriptEventListener.h"
+#include "core/css/MediaValuesDynamic.h"
+#include "core/css/parser/SizesAttributeParser.h"
#include "core/dom/Attribute.h"
#include "core/fetch/ImageResource.h"
#include "core/html/HTMLAnchorElement.h"
@@ -49,6 +51,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()) {
@@ -163,6 +166,8 @@ void HTMLImageElement::parseAttribute(const QualifiedName& name, const AtomicStr
if (renderer() && renderer()->isImage())
toRenderImage(renderer())->setImageDevicePixelRatio(m_imageDevicePixelRatio);
m_imageLoader.updateFromElementIgnoringPreviousError();
+ } else if (RuntimeEnabledFeatures::pictureSizesEnabled() && name == sizesAttr) {
+ m_effectiveSize = SizesAttributeParser::findEffectiveSize(value, MediaValuesDynamic::create(document()));
} else if (name == usemapAttr) {
setIsLink(!value.isNull());
} else if (name == compositeAttr) {
« no previous file with comments | « Source/core/html/HTMLImageElement.h ('k') | Source/core/html/HTMLImageElement.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698