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

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

Issue 2523553002: Consolidate how ImageDocument sets image styling (Closed)
Patch Set: DCHECK_EQ Created 4 years, 1 month 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 | « no previous file | no next file » | 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 380 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 // page is currently being scaled. 391 // page is currently being scaled.
392 scale = frame()->host()->visualViewport().scale(); 392 scale = frame()->host()->visualViewport().scale();
393 } else { 393 } else {
394 // The checker pattern is initialized based on how large the image is 394 // The checker pattern is initialized based on how large the image is
395 // relative to the viewport. 395 // relative to the viewport.
396 int viewportWidth = frame()->host()->visualViewport().size().width(); 396 int viewportWidth = frame()->host()->visualViewport().size().width();
397 scale = viewportWidth / static_cast<double>(calculateDivWidth()); 397 scale = viewportWidth / static_cast<double>(calculateDivWidth());
398 } 398 }
399 399
400 newCheckerSize = round(std::max(1.0, newCheckerSize / scale)); 400 newCheckerSize = round(std::max(1.0, newCheckerSize / scale));
401 } else if (!imageFitsInWindow()) {
402 // In desktop mode, the user can click on the image to zoom in or out.
403 DCHECK_EQ(m_shrinkToFitMode, Desktop);
404 imageStyle.append(m_shouldShrinkImage ? "cursor: zoom-in; "
pdr. 2016/11/21 23:26:47 I see we're using "m_imageElement->setInlineStyleP
gone 2016/11/21 23:43:26 Yeah, on desktop this is called during ::imageLoad
405 : "cursor: zoom-out; ");
401 } 406 }
402 407
403 // The only thing that can differ between updates is the checker size. 408 // The only thing that can differ between updates is the checker size.
404 if (newCheckerSize == m_checkerSize) 409 if (newCheckerSize == m_checkerSize)
405 return; 410 return;
406 m_checkerSize = newCheckerSize; 411 m_checkerSize = newCheckerSize;
407 412
408 imageStyle.append("background-position: 0px 0px, "); 413 imageStyle.append("background-position: 0px 0px, ");
409 imageStyle.append(AtomicString::number(m_checkerSize)); 414 imageStyle.append(AtomicString::number(m_checkerSize));
410 imageStyle.append("px "); 415 imageStyle.append("px ");
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
587 } 592 }
588 593
589 bool ImageEventListener::operator==(const EventListener& listener) const { 594 bool ImageEventListener::operator==(const EventListener& listener) const {
590 if (const ImageEventListener* imageEventListener = 595 if (const ImageEventListener* imageEventListener =
591 ImageEventListener::cast(&listener)) 596 ImageEventListener::cast(&listener))
592 return m_doc == imageEventListener->m_doc; 597 return m_doc == imageEventListener->m_doc;
593 return false; 598 return false;
594 } 599 }
595 600
596 } // namespace blink 601 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698