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

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

Issue 293423002: Refactor srcset parser to align it with spec changes (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fixed ASSERT 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 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 #else 173 #else
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 candidateScaleFactor = candidate.scaleFactor(); 183 float candidateDensity = candidate.density();
184 // FIXME: Make this ">0" part match the spec, once it settles. 184 // FIXME: Make this ">0" part match the spec, once it settles.
185 if (candidateScaleFactor > 0) 185 if (candidateDensity > 0)
186 m_imageDevicePixelRatio = 1 / candidateScaleFactor; 186 m_imageDevicePixelRatio = 1 / candidateDensity;
187 if (renderer() && renderer()->isImage()) 187 if (renderer() && renderer()->isImage())
188 toRenderImage(renderer())->setImageDevicePixelRatio(m_imageDevicePixelRa tio); 188 toRenderImage(renderer())->setImageDevicePixelRatio(m_imageDevicePixelRa tio);
189 } 189 }
190 190
191 void HTMLImageElement::parseAttribute(const QualifiedName& name, const AtomicStr ing& value) 191 void HTMLImageElement::parseAttribute(const QualifiedName& name, const AtomicStr ing& value)
192 { 192 {
193 if (name == altAttr) { 193 if (name == altAttr) {
194 if (renderer() && renderer()->isImage()) 194 if (renderer() && renderer()->isImage())
195 toRenderImage(renderer())->updateAltText(); 195 toRenderImage(renderer())->updateAltText();
196 } 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
583 else 583 else
584 m_imageLoader.updateFromElement(); 584 m_imageLoader.updateFromElement();
585 } 585 }
586 586
587 const KURL& HTMLImageElement::sourceURL() const 587 const KURL& HTMLImageElement::sourceURL() const
588 { 588 {
589 return cachedImage()->response().url(); 589 return cachedImage()->response().url();
590 } 590 }
591 591
592 } 592 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698