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

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

Issue 242883002: Remove MediaValues' dependency on RenderStyle (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Modified minimal recalc tests to represent reduced recalc. 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
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.
11 * 11 *
12 * This library is distributed in the hope that it will be useful, 12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Library General Public License for more details. 15 * Library General Public License for more details.
16 * 16 *
17 * You should have received a copy of the GNU Library General Public License 17 * You should have received a copy of the GNU Library General Public License
18 * along with this library; see the file COPYING.LIB. If not, write to 18 * along with this library; see the file COPYING.LIB. If not, write to
19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 * Boston, MA 02110-1301, USA. 20 * Boston, MA 02110-1301, USA.
21 */ 21 */
22 22
23 #include "config.h" 23 #include "config.h"
24 #include "core/html/HTMLImageElement.h" 24 #include "core/html/HTMLImageElement.h"
25 25
26 #include "CSSPropertyNames.h" 26 #include "CSSPropertyNames.h"
27 #include "HTMLNames.h" 27 #include "HTMLNames.h"
28 #include "RuntimeEnabledFeatures.h" 28 #include "RuntimeEnabledFeatures.h"
29 #include "bindings/v8/ScriptEventListener.h" 29 #include "bindings/v8/ScriptEventListener.h"
30 #include "core/css/MediaValuesDynamic.h" 30 #include "core/css/MediaValuesCached.h"
31 #include "core/css/parser/SizesAttributeParser.h" 31 #include "core/css/parser/SizesAttributeParser.h"
32 #include "core/dom/Attribute.h" 32 #include "core/dom/Attribute.h"
33 #include "core/fetch/ImageResource.h" 33 #include "core/fetch/ImageResource.h"
34 #include "core/html/HTMLAnchorElement.h" 34 #include "core/html/HTMLAnchorElement.h"
35 #include "core/html/HTMLCanvasElement.h" 35 #include "core/html/HTMLCanvasElement.h"
36 #include "core/html/HTMLFormElement.h" 36 #include "core/html/HTMLFormElement.h"
37 #include "core/html/canvas/CanvasRenderingContext.h" 37 #include "core/html/canvas/CanvasRenderingContext.h"
38 #include "core/html/parser/HTMLParserIdioms.h" 38 #include "core/html/parser/HTMLParserIdioms.h"
39 #include "core/html/parser/HTMLSrcsetParser.h" 39 #include "core/html/parser/HTMLSrcsetParser.h"
40 #include "core/rendering/RenderImage.h" 40 #include "core/rendering/RenderImage.h"
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 int effectiveSize = -1; // FIXME - hook up the real value from `sizes` 160 int effectiveSize = -1; // FIXME - hook up the real value from `sizes`
161 ImageCandidate candidate = bestFitSourceForImageAttributes(document().de vicePixelRatio(), effectiveSize, fastGetAttribute(srcAttr), fastGetAttribute(src setAttr)); 161 ImageCandidate candidate = bestFitSourceForImageAttributes(document().de vicePixelRatio(), effectiveSize, fastGetAttribute(srcAttr), fastGetAttribute(src setAttr));
162 m_bestFitImageURL = candidate.toAtomicString(); 162 m_bestFitImageURL = candidate.toAtomicString();
163 float candidateScaleFactor = candidate.scaleFactor(); 163 float candidateScaleFactor = candidate.scaleFactor();
164 if (candidateScaleFactor > 0) 164 if (candidateScaleFactor > 0)
165 m_imageDevicePixelRatio = 1 / candidateScaleFactor; 165 m_imageDevicePixelRatio = 1 / candidateScaleFactor;
166 if (renderer() && renderer()->isImage()) 166 if (renderer() && renderer()->isImage())
167 toRenderImage(renderer())->setImageDevicePixelRatio(m_imageDevicePix elRatio); 167 toRenderImage(renderer())->setImageDevicePixelRatio(m_imageDevicePix elRatio);
168 m_imageLoader.updateFromElementIgnoringPreviousError(); 168 m_imageLoader.updateFromElementIgnoringPreviousError();
169 } else if (RuntimeEnabledFeatures::pictureSizesEnabled() && name == sizesAtt r) { 169 } else if (RuntimeEnabledFeatures::pictureSizesEnabled() && name == sizesAtt r) {
170 m_effectiveSize = SizesAttributeParser::findEffectiveSize(value, MediaVa luesDynamic::create(document())); 170 m_effectiveSize = SizesAttributeParser::findEffectiveSize(value, MediaVa luesCached::create(document()));
171 } else if (name == usemapAttr) { 171 } else if (name == usemapAttr) {
172 setIsLink(!value.isNull()); 172 setIsLink(!value.isNull());
173 } else if (name == compositeAttr) { 173 } else if (name == compositeAttr) {
174 // FIXME: images don't support blend modes in their compositing attribut e. 174 // FIXME: images don't support blend modes in their compositing attribut e.
175 blink::WebBlendMode blendOp = blink::WebBlendModeNormal; 175 blink::WebBlendMode blendOp = blink::WebBlendModeNormal;
176 if (!parseCompositeAndBlendOperator(value, m_compositeOperator, blendOp) ) 176 if (!parseCompositeAndBlendOperator(value, m_compositeOperator, blendOp) )
177 m_compositeOperator = CompositeSourceOver; 177 m_compositeOperator = CompositeSourceOver;
178 } else { 178 } else {
179 HTMLElement::parseAttribute(name, value); 179 HTMLElement::parseAttribute(name, value);
180 } 180 }
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
470 if (!image) 470 if (!image)
471 return FloatSize(); 471 return FloatSize();
472 LayoutSize size; 472 LayoutSize size;
473 size = image->imageSizeForRenderer(renderer(), 1.0f); // FIXME: Not sure abo ut this. 473 size = image->imageSizeForRenderer(renderer(), 1.0f); // FIXME: Not sure abo ut this.
474 if (renderer() && renderer()->isRenderImage() && image->image() && !image->i mage()->hasRelativeWidth()) 474 if (renderer() && renderer()->isRenderImage() && image->image() && !image->i mage()->hasRelativeWidth())
475 size.scale(toRenderImage(renderer())->imageDevicePixelRatio()); 475 size.scale(toRenderImage(renderer())->imageDevicePixelRatio());
476 return size; 476 return size;
477 } 477 }
478 478
479 } 479 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698