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

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

Issue 302083009: Revert of Enable a srcset 0x descriptor (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 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
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 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 m_form = WeakPtr<HTMLFormElement>(); 174 m_form = WeakPtr<HTMLFormElement>();
175 #endif 175 #endif
176 } 176 }
177 } 177 }
178 178
179 void HTMLImageElement::setBestFitURLAndDPRFromImageCandidate(const ImageCandidat e& candidate) 179 void HTMLImageElement::setBestFitURLAndDPRFromImageCandidate(const ImageCandidat e& candidate)
180 { 180 {
181 m_bestFitImageURL = candidate.url(); 181 m_bestFitImageURL = candidate.url();
182 m_currentSrc = AtomicString(document().completeURL(imageSourceURL()).string( )); 182 m_currentSrc = AtomicString(document().completeURL(imageSourceURL()).string( ));
183 float candidateDensity = candidate.density(); 183 float candidateDensity = candidate.density();
184 if (candidateDensity >= 0) 184 // FIXME: Make this ">0" part match the spec, once it settles.
185 m_imageDevicePixelRatio = 1.0 / candidateDensity; 185 if (candidateDensity > 0)
186 m_imageDevicePixelRatio = 1 / candidateDensity;
186 if (renderer() && renderer()->isImage()) 187 if (renderer() && renderer()->isImage())
187 toRenderImage(renderer())->setImageDevicePixelRatio(m_imageDevicePixelRa tio); 188 toRenderImage(renderer())->setImageDevicePixelRatio(m_imageDevicePixelRa tio);
188 } 189 }
189 190
190 void HTMLImageElement::parseAttribute(const QualifiedName& name, const AtomicStr ing& value) 191 void HTMLImageElement::parseAttribute(const QualifiedName& name, const AtomicStr ing& value)
191 { 192 {
192 if (name == altAttr) { 193 if (name == altAttr) {
193 if (renderer() && renderer()->isImage()) 194 if (renderer() && renderer()->isImage())
194 toRenderImage(renderer())->updateAltText(); 195 toRenderImage(renderer())->updateAltText();
195 } else if (name == srcAttr || name == srcsetAttr || name == sizesAttr) { 196 } else if (name == srcAttr || name == srcsetAttr || name == sizesAttr) {
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after
582 else 583 else
583 m_imageLoader.updateFromElement(); 584 m_imageLoader.updateFromElement();
584 } 585 }
585 586
586 const KURL& HTMLImageElement::sourceURL() const 587 const KURL& HTMLImageElement::sourceURL() const
587 { 588 {
588 return cachedImage()->response().url(); 589 return cachedImage()->response().url();
589 } 590 }
590 591
591 } 592 }
OLDNEW
« no previous file with comments | « LayoutTests/fast/hidpi/image-srcset-intrinsic-size-zero-expected.txt ('k') | Source/core/html/parser/HTMLSrcsetParser.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698