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

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

Issue 305643006: Enable a srcset 0x descriptor (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase and unflake the layout test Created 6 years, 6 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 | « LayoutTests/fast/hidpi/image-srcset-intrinsic-size-zero-expected.txt ('k') | no next file » | 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 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 178
179 void HTMLImageElement::updateCurrentSrc() 179 void HTMLImageElement::updateCurrentSrc()
180 { 180 {
181 m_currentSrc = AtomicString(document().completeURL(imageSourceURL()).string( )); 181 m_currentSrc = AtomicString(document().completeURL(imageSourceURL()).string( ));
182 } 182 }
183 183
184 void HTMLImageElement::setBestFitURLAndDPRFromImageCandidate(const ImageCandidat e& candidate) 184 void HTMLImageElement::setBestFitURLAndDPRFromImageCandidate(const ImageCandidat e& candidate)
185 { 185 {
186 m_bestFitImageURL = candidate.url(); 186 m_bestFitImageURL = candidate.url();
187 float candidateDensity = candidate.density(); 187 float candidateDensity = candidate.density();
188 // FIXME: Make this ">0" part match the spec, once it settles. 188 if (candidateDensity >= 0)
189 if (candidateDensity > 0) 189 m_imageDevicePixelRatio = 1.0 / candidateDensity;
190 m_imageDevicePixelRatio = 1 / candidateDensity;
191 if (renderer() && renderer()->isImage()) 190 if (renderer() && renderer()->isImage())
192 toRenderImage(renderer())->setImageDevicePixelRatio(m_imageDevicePixelRa tio); 191 toRenderImage(renderer())->setImageDevicePixelRatio(m_imageDevicePixelRa tio);
193 } 192 }
194 193
195 void HTMLImageElement::parseAttribute(const QualifiedName& name, const AtomicStr ing& value) 194 void HTMLImageElement::parseAttribute(const QualifiedName& name, const AtomicStr ing& value)
196 { 195 {
197 if (name == altAttr) { 196 if (name == altAttr) {
198 if (renderer() && renderer()->isImage()) 197 if (renderer() && renderer()->isImage())
199 toRenderImage(renderer())->updateAltText(); 198 toRenderImage(renderer())->updateAltText();
200 } else if (name == srcAttr || name == srcsetAttr || name == sizesAttr) { 199 } else if (name == srcAttr || name == srcsetAttr || name == sizesAttr) {
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after
587 else 586 else
588 m_imageLoader.updateFromElement(); 587 m_imageLoader.updateFromElement();
589 } 588 }
590 589
591 const KURL& HTMLImageElement::sourceURL() const 590 const KURL& HTMLImageElement::sourceURL() const
592 { 591 {
593 return cachedImage()->response().url(); 592 return cachedImage()->response().url();
594 } 593 }
595 594
596 } 595 }
OLDNEW
« no previous file with comments | « LayoutTests/fast/hidpi/image-srcset-intrinsic-size-zero-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698