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

Side by Side Diff: Source/core/dom/Element.cpp

Issue 400633005: Use LayoutUnit::fromFloatRound for setting scroll values (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « LayoutTests/fast/scrolling/scroll-max-value-expected.txt ('k') | 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) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Peter Kelly (pmk@post.com) 4 * (C) 2001 Peter Kelly (pmk@post.com)
5 * (C) 2001 Dirk Mueller (mueller@kde.org) 5 * (C) 2001 Dirk Mueller (mueller@kde.org)
6 * (C) 2007 David Smith (catfish.man@gmail.com) 6 * (C) 2007 David Smith (catfish.man@gmail.com)
7 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc. All rights reserved. 7 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc. All rights reserved.
8 * (C) 2007 Eric Seidel (eric@webkit.org) 8 * (C) 2007 Eric Seidel (eric@webkit.org)
9 * 9 *
10 * This library is free software; you can redistribute it and/or 10 * This library is free software; you can redistribute it and/or
(...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after
682 682
683 return 0; 683 return 0;
684 } 684 }
685 685
686 void Element::setScrollLeft(int newLeft) 686 void Element::setScrollLeft(int newLeft)
687 { 687 {
688 document().updateLayoutIgnorePendingStylesheets(); 688 document().updateLayoutIgnorePendingStylesheets();
689 689
690 if (document().documentElement() != this) { 690 if (document().documentElement() != this) {
691 if (RenderBox* rend = renderBox()) 691 if (RenderBox* rend = renderBox())
692 rend->setScrollLeft(roundf(newLeft * rend->style()->effectiveZoom()) ); 692 rend->setScrollLeft(LayoutUnit::fromFloatRound(newLeft * rend->style ()->effectiveZoom()));
693 return; 693 return;
694 } 694 }
695 695
696 if (RuntimeEnabledFeatures::scrollTopLeftInteropEnabled()) { 696 if (RuntimeEnabledFeatures::scrollTopLeftInteropEnabled()) {
697 if (document().inQuirksMode()) 697 if (document().inQuirksMode())
698 return; 698 return;
699 699
700 LocalFrame* frame = document().frame(); 700 LocalFrame* frame = document().frame();
701 if (!frame) 701 if (!frame)
702 return; 702 return;
(...skipping 25 matching lines...) Expand all
728 // FIXME: Use scrollBehavior to decide whether to scroll smoothly or instant ly. 728 // FIXME: Use scrollBehavior to decide whether to scroll smoothly or instant ly.
729 setScrollLeft(position); 729 setScrollLeft(position);
730 } 730 }
731 731
732 void Element::setScrollTop(int newTop) 732 void Element::setScrollTop(int newTop)
733 { 733 {
734 document().updateLayoutIgnorePendingStylesheets(); 734 document().updateLayoutIgnorePendingStylesheets();
735 735
736 if (document().documentElement() != this) { 736 if (document().documentElement() != this) {
737 if (RenderBox* rend = renderBox()) 737 if (RenderBox* rend = renderBox())
738 rend->setScrollTop(roundf(newTop * rend->style()->effectiveZoom())); 738 rend->setScrollTop(LayoutUnit::fromFloatRound(newTop * rend->style() ->effectiveZoom()));
739 return; 739 return;
740 } 740 }
741 741
742 if (RuntimeEnabledFeatures::scrollTopLeftInteropEnabled()) { 742 if (RuntimeEnabledFeatures::scrollTopLeftInteropEnabled()) {
743 if (document().inQuirksMode()) 743 if (document().inQuirksMode())
744 return; 744 return;
745 745
746 LocalFrame* frame = document().frame(); 746 LocalFrame* frame = document().frame();
747 if (!frame) 747 if (!frame)
748 return; 748 return;
(...skipping 2619 matching lines...) Expand 10 before | Expand all | Expand 10 after
3368 { 3368 {
3369 #if ENABLE(OILPAN) 3369 #if ENABLE(OILPAN)
3370 if (hasRareData()) 3370 if (hasRareData())
3371 visitor->trace(elementRareData()); 3371 visitor->trace(elementRareData());
3372 visitor->trace(m_elementData); 3372 visitor->trace(m_elementData);
3373 #endif 3373 #endif
3374 ContainerNode::trace(visitor); 3374 ContainerNode::trace(visitor);
3375 } 3375 }
3376 3376
3377 } // namespace WebCore 3377 } // namespace WebCore
OLDNEW
« no previous file with comments | « LayoutTests/fast/scrolling/scroll-max-value-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698