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

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

Issue 2387883002: Use float for scroll offset. (Closed)
Patch Set: tweaks and docs Created 4 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 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 291
292 if (m_shouldShrinkImage) { 292 if (m_shouldShrinkImage) {
293 windowSizeChanged(); 293 windowSizeChanged();
294 } else { 294 } else {
295 restoreImageSize(); 295 restoreImageSize();
296 296
297 updateStyleAndLayout(); 297 updateStyleAndLayout();
298 298
299 double scale = this->scale(); 299 double scale = this->scale();
300 300
301 double scrollX = 301 float scrollX =
302 x / scale - static_cast<double>(frame()->view()->width()) / 2; 302 x / scale - static_cast<float>(frame()->view()->width()) / 2;
303 double scrollY = 303 float scrollY =
304 y / scale - static_cast<double>(frame()->view()->height()) / 2; 304 y / scale - static_cast<float>(frame()->view()->height()) / 2;
305 305
306 frame()->view()->setScrollPosition(DoublePoint(scrollX, scrollY), 306 frame()->view()->setScrollOffset(ScrollOffset(scrollX, scrollY),
307 ProgrammaticScroll); 307 ProgrammaticScroll);
308 } 308 }
309 } 309 }
310 310
311 void ImageDocument::imageUpdated() { 311 void ImageDocument::imageUpdated() {
312 DCHECK(m_imageElement); 312 DCHECK(m_imageElement);
313 313
314 if (m_imageSizeIsKnown) 314 if (m_imageSizeIsKnown)
315 return; 315 return;
316 316
317 updateStyleAndLayoutTree(); 317 updateStyleAndLayoutTree();
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 } 439 }
440 440
441 bool ImageEventListener::operator==(const EventListener& listener) const { 441 bool ImageEventListener::operator==(const EventListener& listener) const {
442 if (const ImageEventListener* imageEventListener = 442 if (const ImageEventListener* imageEventListener =
443 ImageEventListener::cast(&listener)) 443 ImageEventListener::cast(&listener))
444 return m_doc == imageEventListener->m_doc; 444 return m_doc == imageEventListener->m_doc;
445 return false; 445 return false;
446 } 446 }
447 447
448 } // namespace blink 448 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698