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

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

Issue 233213003: Extend srcset's syntax to include 'w' descriptors (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fixed nits and modified multiple descriptor layout test 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 | « Source/core/core.gypi ('k') | Source/core/html/parser/HTMLPreloadScanner.cpp » ('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 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 if (RuntimeEnabledFeatures::srcsetEnabled()) {
158 ImageCandidate candidate = bestFitSourceForImageAttributes(document( ).devicePixelRatio(), fastGetAttribute(srcAttr), fastGetAttribute(srcsetAttr)); 158 int effectiveSize = -1; // FIXME - hook up the real value from `size s`
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_imageDevic ePixelRatio); 165 toRenderImage(renderer())->setImageDevicePixelRatio(m_imageDevic ePixelRatio);
165 } 166 }
166 m_imageLoader.updateFromElementIgnoringPreviousError(); 167 m_imageLoader.updateFromElementIgnoringPreviousError();
167 } else if (name == usemapAttr) { 168 } else if (name == usemapAttr) {
168 setIsLink(!value.isNull()); 169 setIsLink(!value.isNull());
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 if (!image) 467 if (!image)
467 return FloatSize(); 468 return FloatSize();
468 LayoutSize size; 469 LayoutSize size;
469 size = image->imageSizeForRenderer(renderer(), 1.0f); // FIXME: Not sure abo ut this. 470 size = image->imageSizeForRenderer(renderer(), 1.0f); // FIXME: Not sure abo ut this.
470 if (renderer() && renderer()->isRenderImage() && image->image() && !image->i mage()->hasRelativeWidth()) 471 if (renderer() && renderer()->isRenderImage() && image->image() && !image->i mage()->hasRelativeWidth())
471 size.scale(toRenderImage(renderer())->imageDevicePixelRatio()); 472 size.scale(toRenderImage(renderer())->imageDevicePixelRatio());
472 return size; 473 return size;
473 } 474 }
474 475
475 } 476 }
OLDNEW
« no previous file with comments | « Source/core/core.gypi ('k') | Source/core/html/parser/HTMLPreloadScanner.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698