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

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

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

Powered by Google App Engine
This is Rietveld 408576698