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

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

Issue 2261663002: Disallow cast/implicit conversion from LayoutUnit to int/unsigned (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: - Created 4 years, 4 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) 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 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 323
324 void ImageDocument::restoreImageSize(ScaleType type) 324 void ImageDocument::restoreImageSize(ScaleType type)
325 { 325 {
326 DCHECK_EQ(m_shrinkToFitMode, Desktop); 326 DCHECK_EQ(m_shrinkToFitMode, Desktop);
327 327
328 if (!m_imageElement || !m_imageSizeIsKnown || m_imageElement->document() != this || (pageZoomFactor(this) < 1 && type == ScaleOnlyUnzoomedDocument)) 328 if (!m_imageElement || !m_imageSizeIsKnown || m_imageElement->document() != this || (pageZoomFactor(this) < 1 && type == ScaleOnlyUnzoomedDocument))
329 return; 329 return;
330 330
331 DCHECK(m_imageElement->cachedImage()); 331 DCHECK(m_imageElement->cachedImage());
332 LayoutSize imageSize = m_imageElement->cachedImage()->imageSize(LayoutObject ::shouldRespectImageOrientation(m_imageElement->layoutObject()), 1.0f); 332 LayoutSize imageSize = m_imageElement->cachedImage()->imageSize(LayoutObject ::shouldRespectImageOrientation(m_imageElement->layoutObject()), 1.0f);
333 m_imageElement->setWidth(imageSize.width()); 333 m_imageElement->setWidth(imageSize.width().toInt());
334 m_imageElement->setHeight(imageSize.height()); 334 m_imageElement->setHeight(imageSize.height().toInt());
335 335
336 if (imageFitsInWindow()) 336 if (imageFitsInWindow())
337 m_imageElement->removeInlineStyleProperty(CSSPropertyCursor); 337 m_imageElement->removeInlineStyleProperty(CSSPropertyCursor);
338 else 338 else
339 m_imageElement->setInlineStyleProperty(CSSPropertyCursor, CSSValueZoomOu t); 339 m_imageElement->setInlineStyleProperty(CSSPropertyCursor, CSSValueZoomOu t);
340 340
341 m_didShrinkImage = false; 341 m_didShrinkImage = false;
342 } 342 }
343 343
344 bool ImageDocument::imageFitsInWindow() const 344 bool ImageDocument::imageFitsInWindow() const
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
440 } 440 }
441 441
442 bool ImageEventListener::operator==(const EventListener& listener) const 442 bool ImageEventListener::operator==(const EventListener& listener) const
443 { 443 {
444 if (const ImageEventListener* imageEventListener = ImageEventListener::cast( &listener)) 444 if (const ImageEventListener* imageEventListener = ImageEventListener::cast( &listener))
445 return m_doc == imageEventListener->m_doc; 445 return m_doc == imageEventListener->m_doc;
446 return false; 446 return false;
447 } 447 }
448 448
449 } // namespace blink 449 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLImageElement.cpp ('k') | third_party/WebKit/Source/core/html/forms/ImageInputType.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698