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

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

Issue 610423004: Preserve fractional scroll offset for JS scrolling API (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: address comments Created 6 years, 2 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 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 257
258 m_shouldShrinkImage = !m_shouldShrinkImage; 258 m_shouldShrinkImage = !m_shouldShrinkImage;
259 259
260 if (m_shouldShrinkImage) 260 if (m_shouldShrinkImage)
261 windowSizeChanged(ScaleZoomedDocument); 261 windowSizeChanged(ScaleZoomedDocument);
262 else { 262 else {
263 restoreImageSize(ScaleZoomedDocument); 263 restoreImageSize(ScaleZoomedDocument);
264 264
265 updateLayout(); 265 updateLayout();
266 266
267 float scale = this->scale(); 267 double scale = this->scale();
268 268
269 int scrollX = static_cast<int>(x / scale - (float)frame()->view()->width () / 2); 269 double scrollX = x / scale - (double)frame()->view()->width() / 2;
eae 2014/10/08 16:19:36 Use c++ style static_cast please
Yufeng Shen (Slow to review) 2014/10/08 18:12:08 Done.
270 int scrollY = static_cast<int>(y / scale - (float)frame()->view()->heigh t() / 2); 270 double scrollY = y / scale - (double)frame()->view()->height() / 2;
271 271
272 frame()->view()->setScrollPosition(IntPoint(scrollX, scrollY)); 272 frame()->view()->setScrollPosition(DoublePoint(scrollX, scrollY));
273 } 273 }
274 } 274 }
275 275
276 void ImageDocument::imageUpdated() 276 void ImageDocument::imageUpdated()
277 { 277 {
278 ASSERT(m_imageElement); 278 ASSERT(m_imageElement);
279 279
280 if (m_imageSizeIsKnown) 280 if (m_imageSizeIsKnown)
281 return; 281 return;
282 282
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 } 396 }
397 397
398 bool ImageEventListener::operator==(const EventListener& listener) 398 bool ImageEventListener::operator==(const EventListener& listener)
399 { 399 {
400 if (const ImageEventListener* imageEventListener = ImageEventListener::cast( &listener)) 400 if (const ImageEventListener* imageEventListener = ImageEventListener::cast( &listener))
401 return m_doc == imageEventListener->m_doc; 401 return m_doc == imageEventListener->m_doc;
402 return false; 402 return false;
403 } 403 }
404 404
405 } 405 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698