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

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

Issue 200023002: Making LayoutUnit conversions to Float type explicit (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebase to trunk Created 6 years, 9 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/frame/FrameView.cpp ('k') | Source/core/page/SpatialNavigation.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) 2006, 2007, 2008, 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008, 2010 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 if (!m_imageElement || m_imageElement->document() != this) 220 if (!m_imageElement || m_imageElement->document() != this)
221 return 1.0f; 221 return 1.0f;
222 222
223 FrameView* view = frame()->view(); 223 FrameView* view = frame()->view();
224 if (!view) 224 if (!view)
225 return 1; 225 return 1;
226 226
227 LayoutSize imageSize = m_imageElement->cachedImage()->imageSizeForRenderer(m _imageElement->renderer(), pageZoomFactor(this)); 227 LayoutSize imageSize = m_imageElement->cachedImage()->imageSizeForRenderer(m _imageElement->renderer(), pageZoomFactor(this));
228 LayoutSize windowSize = LayoutSize(view->width(), view->height()); 228 LayoutSize windowSize = LayoutSize(view->width(), view->height());
229 229
230 float widthScale = (float)windowSize.width() / imageSize.width(); 230 float widthScale = windowSize.width().toFloat() / imageSize.width().toFloat( );
231 float heightScale = (float)windowSize.height() / imageSize.height(); 231 float heightScale = windowSize.height().toFloat() / imageSize.height().toFlo at();
232 232
233 return min(widthScale, heightScale); 233 return min(widthScale, heightScale);
234 } 234 }
235 235
236 void ImageDocument::resizeImageToFit() 236 void ImageDocument::resizeImageToFit()
237 { 237 {
238 if (!m_imageElement || m_imageElement->document() != this || pageZoomFactor( this) > 1) 238 if (!m_imageElement || m_imageElement->document() != this || pageZoomFactor( this) > 1)
239 return; 239 return;
240 240
241 LayoutSize imageSize = m_imageElement->cachedImage()->imageSizeForRenderer(m _imageElement->renderer(), pageZoomFactor(this)); 241 LayoutSize imageSize = m_imageElement->cachedImage()->imageSizeForRenderer(m _imageElement->renderer(), pageZoomFactor(this));
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 } 385 }
386 386
387 bool ImageEventListener::operator==(const EventListener& listener) 387 bool ImageEventListener::operator==(const EventListener& listener)
388 { 388 {
389 if (const ImageEventListener* imageEventListener = ImageEventListener::cast( &listener)) 389 if (const ImageEventListener* imageEventListener = ImageEventListener::cast( &listener))
390 return m_doc == imageEventListener->m_doc; 390 return m_doc == imageEventListener->m_doc;
391 return false; 391 return false;
392 } 392 }
393 393
394 } 394 }
OLDNEW
« no previous file with comments | « Source/core/frame/FrameView.cpp ('k') | Source/core/page/SpatialNavigation.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698