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

Side by Side Diff: Source/core/rendering/RenderImage.cpp

Issue 46313002: Support the DPR header for client hints. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: with cache tests Created 7 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/fetch/ImageResource.cpp ('k') | Source/platform/RuntimeEnabledFeatures.in » ('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 * (C) 2000 Dirk Mueller (mueller@kde.org) 4 * (C) 2000 Dirk Mueller (mueller@kde.org)
5 * (C) 2006 Allan Sandfeld Jensen (kde@carewolf.com) 5 * (C) 2006 Allan Sandfeld Jensen (kde@carewolf.com)
6 * (C) 2006 Samuel Weinig (sam.weinig@gmail.com) 6 * (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
7 * Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved. 7 * Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved.
8 * Copyright (C) 2010 Google Inc. All rights reserved. 8 * Copyright (C) 2010 Google Inc. All rights reserved.
9 * Copyright (C) Research In Motion Limited 2011-2012. All rights reserved. 9 * Copyright (C) Research In Motion Limited 2011-2012. All rights reserved.
10 * 10 *
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 157
158 if (hasBoxDecorations() || hasMask()) 158 if (hasBoxDecorations() || hasMask())
159 RenderReplaced::imageChanged(newImage, rect); 159 RenderReplaced::imageChanged(newImage, rect);
160 160
161 if (!m_imageResource) 161 if (!m_imageResource)
162 return; 162 return;
163 163
164 if (newImage != m_imageResource->imagePtr()) 164 if (newImage != m_imageResource->imagePtr())
165 return; 165 return;
166 166
167 // Per the spec, we let the server-sent header override srcset/other sources of dpr.
168 // https://github.com/igrigorik/http-client-hints/blob/master/draft-grigorik -http-client-hints-01.txt#L255
169 if (m_imageResource->cachedImage() && m_imageResource->cachedImage()->hasDev icePixelRatioHeaderValue())
170 m_imageDevicePixelRatio = 1 / m_imageResource->cachedImage()->devicePixe lRatioHeaderValue();
171
167 if (!m_didIncrementVisuallyNonEmptyPixelCount) { 172 if (!m_didIncrementVisuallyNonEmptyPixelCount) {
168 // At a zoom level of 1 the image is guaranteed to have an integer size. 173 // At a zoom level of 1 the image is guaranteed to have an integer size.
169 view()->frameView()->incrementVisuallyNonEmptyPixelCount(flooredIntSize( m_imageResource->imageSize(1.0f))); 174 view()->frameView()->incrementVisuallyNonEmptyPixelCount(flooredIntSize( m_imageResource->imageSize(1.0f)));
170 m_didIncrementVisuallyNonEmptyPixelCount = true; 175 m_didIncrementVisuallyNonEmptyPixelCount = true;
171 } 176 }
172 177
173 bool imageSizeChanged = false; 178 bool imageSizeChanged = false;
174 179
175 // Set image dimensions, taking into account the size of the alt text. 180 // Set image dimensions, taking into account the size of the alt text.
176 if (m_imageResource->errorOccurred() || !newImage) { 181 if (m_imageResource->errorOccurred() || !newImage) {
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after
604 return 0; 609 return 0;
605 610
606 ImageResource* cachedImage = m_imageResource->cachedImage(); 611 ImageResource* cachedImage = m_imageResource->cachedImage();
607 if (cachedImage && cachedImage->image() && cachedImage->image()->isSVGImage( )) 612 if (cachedImage && cachedImage->image() && cachedImage->image()->isSVGImage( ))
608 return toSVGImage(cachedImage->image())->embeddedContentBox(); 613 return toSVGImage(cachedImage->image())->embeddedContentBox();
609 614
610 return 0; 615 return 0;
611 } 616 }
612 617
613 } // namespace WebCore 618 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/fetch/ImageResource.cpp ('k') | Source/platform/RuntimeEnabledFeatures.in » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698