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

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

Issue 1158673006: Replace various ScrollableArea scroll methods with setScrollPosition (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 5 years, 6 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
« no previous file with comments | « no previous file | Source/core/frame/FrameView.h » ('j') | Source/core/frame/LocalFrame.cpp » ('J')
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 863 matching lines...) Expand 10 before | Expand all | Expand 10 after
874 ScrollableArea::scrollBehaviorFromString(scrollToOptions.behavior(), scrollB ehavior); 874 ScrollableArea::scrollBehaviorFromString(scrollToOptions.behavior(), scrollB ehavior);
875 LocalFrame* frame = document().frame(); 875 LocalFrame* frame = document().frame();
876 if (!frame) 876 if (!frame)
877 return; 877 return;
878 FrameView* view = frame->view(); 878 FrameView* view = frame->view();
879 if (!view) 879 if (!view)
880 return; 880 return;
881 881
882 double newScaledLeft = left * frame->pageZoomFactor() + view->scrollPosition Double().x(); 882 double newScaledLeft = left * frame->pageZoomFactor() + view->scrollPosition Double().x();
883 double newScaledTop = top * frame->pageZoomFactor() + view->scrollPositionDo uble().y(); 883 double newScaledTop = top * frame->pageZoomFactor() + view->scrollPositionDo uble().y();
884 view->setScrollPosition(DoublePoint(newScaledLeft, newScaledTop), scrollBeha vior); 884 view->setScrollPosition(DoublePoint(newScaledLeft, newScaledTop), Programmat icScroll, scrollBehavior);
885 } 885 }
886 886
887 void Element::scrollFrameTo(const ScrollToOptions& scrollToOptions) 887 void Element::scrollFrameTo(const ScrollToOptions& scrollToOptions)
888 { 888 {
889 ScrollBehavior scrollBehavior = ScrollBehaviorAuto; 889 ScrollBehavior scrollBehavior = ScrollBehaviorAuto;
890 ScrollableArea::scrollBehaviorFromString(scrollToOptions.behavior(), scrollB ehavior); 890 ScrollableArea::scrollBehaviorFromString(scrollToOptions.behavior(), scrollB ehavior);
891 LocalFrame* frame = document().frame(); 891 LocalFrame* frame = document().frame();
892 if (!frame) 892 if (!frame)
893 return; 893 return;
894 FrameView* view = frame->view(); 894 FrameView* view = frame->view();
895 if (!view) 895 if (!view)
896 return; 896 return;
897 897
898 double scaledLeft = view->scrollPositionDouble().x(); 898 double scaledLeft = view->scrollPositionDouble().x();
899 double scaledTop = view->scrollPositionDouble().y(); 899 double scaledTop = view->scrollPositionDouble().y();
900 if (scrollToOptions.hasLeft()) 900 if (scrollToOptions.hasLeft())
901 scaledLeft = ScrollableArea::normalizeNonFiniteScroll(scrollToOptions.le ft()) * frame->pageZoomFactor(); 901 scaledLeft = ScrollableArea::normalizeNonFiniteScroll(scrollToOptions.le ft()) * frame->pageZoomFactor();
902 if (scrollToOptions.hasTop()) 902 if (scrollToOptions.hasTop())
903 scaledTop = ScrollableArea::normalizeNonFiniteScroll(scrollToOptions.top ()) * frame->pageZoomFactor(); 903 scaledTop = ScrollableArea::normalizeNonFiniteScroll(scrollToOptions.top ()) * frame->pageZoomFactor();
904 view->setScrollPosition(DoublePoint(scaledLeft, scaledTop), scrollBehavior); 904 view->setScrollPosition(DoublePoint(scaledLeft, scaledTop), ProgrammaticScro ll, scrollBehavior);
905 } 905 }
906 906
907 void Element::incrementProxyCount() 907 void Element::incrementProxyCount()
908 { 908 {
909 if (ensureElementRareData().incrementProxyCount() == 1) 909 if (ensureElementRareData().incrementProxyCount() == 1)
910 setNeedsStyleRecalc(LocalStyleChange, StyleChangeReasonForTracing::creat e(StyleChangeReason::CompositorProxy)); 910 setNeedsStyleRecalc(LocalStyleChange, StyleChangeReasonForTracing::creat e(StyleChangeReason::CompositorProxy));
911 } 911 }
912 912
913 void Element::decrementProxyCount() 913 void Element::decrementProxyCount()
914 { 914 {
(...skipping 2536 matching lines...) Expand 10 before | Expand all | Expand 10 after
3451 { 3451 {
3452 #if ENABLE(OILPAN) 3452 #if ENABLE(OILPAN)
3453 if (hasRareData()) 3453 if (hasRareData())
3454 visitor->trace(elementRareData()); 3454 visitor->trace(elementRareData());
3455 visitor->trace(m_elementData); 3455 visitor->trace(m_elementData);
3456 #endif 3456 #endif
3457 ContainerNode::trace(visitor); 3457 ContainerNode::trace(visitor);
3458 } 3458 }
3459 3459
3460 } // namespace blink 3460 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | Source/core/frame/FrameView.h » ('j') | Source/core/frame/LocalFrame.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698