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

Side by Side Diff: Source/core/html/HTMLImageElement.cpp

Issue 236753003: Remove the srcset Runtime Enabled Flag (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 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 unified diff | Download patch
« no previous file with comments | « no previous file | Source/core/html/HTMLImageElement.idl » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2010 Apple Inc. All rights reserv ed. 4 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2010 Apple Inc. All rights reserv ed.
5 * Copyright (C) 2010 Google Inc. All rights reserved. 5 * Copyright (C) 2010 Google Inc. All rights reserved.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 m_form = WeakPtr<HTMLFormElement>(); 147 m_form = WeakPtr<HTMLFormElement>();
148 } 148 }
149 } 149 }
150 150
151 void HTMLImageElement::parseAttribute(const QualifiedName& name, const AtomicStr ing& value) 151 void HTMLImageElement::parseAttribute(const QualifiedName& name, const AtomicStr ing& value)
152 { 152 {
153 if (name == altAttr) { 153 if (name == altAttr) {
154 if (renderer() && renderer()->isImage()) 154 if (renderer() && renderer()->isImage())
155 toRenderImage(renderer())->updateAltText(); 155 toRenderImage(renderer())->updateAltText();
156 } else if (name == srcAttr || name == srcsetAttr) { 156 } else if (name == srcAttr || name == srcsetAttr) {
157 if (RuntimeEnabledFeatures::srcsetEnabled()) { 157 int effectiveSize = -1; // FIXME - hook up the real value from `sizes`
158 int effectiveSize = -1; // FIXME - hook up the real value from `size s` 158 ImageCandidate candidate = bestFitSourceForImageAttributes(document().de vicePixelRatio(), effectiveSize, fastGetAttribute(srcAttr), fastGetAttribute(src setAttr));
159 ImageCandidate candidate = bestFitSourceForImageAttributes(document( ).devicePixelRatio(), effectiveSize, fastGetAttribute(srcAttr), fastGetAttribute (srcsetAttr)); 159 m_bestFitImageURL = candidate.toAtomicString();
160 m_bestFitImageURL = candidate.toAtomicString(); 160 float candidateScaleFactor = candidate.scaleFactor();
161 float candidateScaleFactor = candidate.scaleFactor(); 161 if (candidateScaleFactor > 0)
162 if (candidateScaleFactor > 0) 162 m_imageDevicePixelRatio = 1 / candidateScaleFactor;
163 m_imageDevicePixelRatio = 1 / candidateScaleFactor; 163 if (renderer() && renderer()->isImage())
164 if (renderer() && renderer()->isImage()) 164 toRenderImage(renderer())->setImageDevicePixelRatio(m_imageDevicePix elRatio);
165 toRenderImage(renderer())->setImageDevicePixelRatio(m_imageDevic ePixelRatio);
166 }
167 m_imageLoader.updateFromElementIgnoringPreviousError(); 165 m_imageLoader.updateFromElementIgnoringPreviousError();
168 } else if (name == usemapAttr) { 166 } else if (name == usemapAttr) {
169 setIsLink(!value.isNull()); 167 setIsLink(!value.isNull());
170 } else if (name == compositeAttr) { 168 } else if (name == compositeAttr) {
171 // FIXME: images don't support blend modes in their compositing attribut e. 169 // FIXME: images don't support blend modes in their compositing attribut e.
172 blink::WebBlendMode blendOp = blink::WebBlendModeNormal; 170 blink::WebBlendMode blendOp = blink::WebBlendModeNormal;
173 if (!parseCompositeAndBlendOperator(value, m_compositeOperator, blendOp) ) 171 if (!parseCompositeAndBlendOperator(value, m_compositeOperator, blendOp) )
174 m_compositeOperator = CompositeSourceOver; 172 m_compositeOperator = CompositeSourceOver;
175 } else { 173 } else {
176 HTMLElement::parseAttribute(name, value); 174 HTMLElement::parseAttribute(name, value);
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
467 if (!image) 465 if (!image)
468 return FloatSize(); 466 return FloatSize();
469 LayoutSize size; 467 LayoutSize size;
470 size = image->imageSizeForRenderer(renderer(), 1.0f); // FIXME: Not sure abo ut this. 468 size = image->imageSizeForRenderer(renderer(), 1.0f); // FIXME: Not sure abo ut this.
471 if (renderer() && renderer()->isRenderImage() && image->image() && !image->i mage()->hasRelativeWidth()) 469 if (renderer() && renderer()->isRenderImage() && image->image() && !image->i mage()->hasRelativeWidth())
472 size.scale(toRenderImage(renderer())->imageDevicePixelRatio()); 470 size.scale(toRenderImage(renderer())->imageDevicePixelRatio());
473 return size; 471 return size;
474 } 472 }
475 473
476 } 474 }
OLDNEW
« no previous file with comments | « no previous file | Source/core/html/HTMLImageElement.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698