Chromium Code Reviews| OLD | NEW |
|---|---|
| 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. | 7 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc. |
| 8 * All rights reserved. | 8 * All rights reserved. |
| 9 * (C) 2007 Eric Seidel (eric@webkit.org) | 9 * (C) 2007 Eric Seidel (eric@webkit.org) |
| 10 * | 10 * |
| (...skipping 758 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 769 return adjustLayoutUnitForAbsoluteZoom( | 769 return adjustLayoutUnitForAbsoluteZoom( |
| 770 LayoutUnit(layoutObject->pixelSnappedClientHeight()), | 770 LayoutUnit(layoutObject->pixelSnappedClientHeight()), |
| 771 layoutObject->styleRef()) | 771 layoutObject->styleRef()) |
| 772 .round(); | 772 .round(); |
| 773 return 0; | 773 return 0; |
| 774 } | 774 } |
| 775 | 775 |
| 776 double Element::scrollLeft() { | 776 double Element::scrollLeft() { |
| 777 document().updateStyleAndLayoutIgnorePendingStylesheetsForNode(this); | 777 document().updateStyleAndLayoutIgnorePendingStylesheetsForNode(this); |
| 778 | 778 |
| 779 if (document().scrollingElement() == this) { | 779 if (document().scrollingElementInternal() == this) { |
| 780 if (document().domWindow()) | 780 if (document().domWindow()) |
| 781 return document().domWindow()->scrollX(); | 781 return document().domWindow()->scrollX(); |
| 782 return 0; | 782 return 0; |
| 783 } | 783 } |
| 784 | 784 |
| 785 if (LayoutBox* box = layoutBox()) | 785 if (LayoutBox* box = layoutBox()) |
| 786 return adjustScrollForAbsoluteZoom(box->scrollLeft(), *box); | 786 return adjustScrollForAbsoluteZoom(box->scrollLeft(), *box); |
| 787 | 787 |
| 788 return 0; | 788 return 0; |
| 789 } | 789 } |
| 790 | 790 |
| 791 double Element::scrollTop() { | 791 double Element::scrollTop() { |
| 792 document().updateStyleAndLayoutIgnorePendingStylesheetsForNode(this); | 792 document().updateStyleAndLayoutIgnorePendingStylesheetsForNode(this); |
| 793 | 793 |
| 794 if (document().scrollingElement() == this) { | 794 if (document().scrollingElementInternal() == this) { |
| 795 if (document().domWindow()) | 795 if (document().domWindow()) |
| 796 return document().domWindow()->scrollY(); | 796 return document().domWindow()->scrollY(); |
| 797 return 0; | 797 return 0; |
| 798 } | 798 } |
| 799 | 799 |
| 800 if (LayoutBox* box = layoutBox()) | 800 if (LayoutBox* box = layoutBox()) |
| 801 return adjustScrollForAbsoluteZoom(box->scrollTop(), *box); | 801 return adjustScrollForAbsoluteZoom(box->scrollTop(), *box); |
| 802 | 802 |
| 803 return 0; | 803 return 0; |
| 804 } | 804 } |
| 805 | 805 |
| 806 void Element::setScrollLeft(double newLeft) { | 806 void Element::setScrollLeft(double newLeft) { |
| 807 document().updateStyleAndLayoutIgnorePendingStylesheetsForNode(this); | 807 document().updateStyleAndLayoutIgnorePendingStylesheetsForNode(this); |
| 808 | 808 |
| 809 newLeft = ScrollableArea::normalizeNonFiniteScroll(newLeft); | 809 newLeft = ScrollableArea::normalizeNonFiniteScroll(newLeft); |
| 810 | 810 |
| 811 if (document().scrollingElement() == this) { | 811 if (document().scrollingElementInternal() == this) { |
| 812 if (LocalDOMWindow* window = document().domWindow()) | 812 if (LocalDOMWindow* window = document().domWindow()) |
| 813 window->scrollTo(newLeft, window->scrollY()); | 813 window->scrollTo(newLeft, window->scrollY()); |
| 814 } else { | 814 } else { |
| 815 LayoutBox* box = layoutBox(); | 815 LayoutBox* box = layoutBox(); |
| 816 if (box) | 816 if (box) |
| 817 box->setScrollLeft( | 817 box->setScrollLeft( |
| 818 LayoutUnit::fromFloatRound(newLeft * box->style()->effectiveZoom())); | 818 LayoutUnit::fromFloatRound(newLeft * box->style()->effectiveZoom())); |
| 819 } | 819 } |
| 820 } | 820 } |
| 821 | 821 |
| 822 void Element::setScrollTop(double newTop) { | 822 void Element::setScrollTop(double newTop) { |
| 823 document().updateStyleAndLayoutIgnorePendingStylesheetsForNode(this); | 823 document().updateStyleAndLayoutIgnorePendingStylesheetsForNode(this); |
| 824 | 824 |
| 825 newTop = ScrollableArea::normalizeNonFiniteScroll(newTop); | 825 newTop = ScrollableArea::normalizeNonFiniteScroll(newTop); |
| 826 | 826 |
| 827 if (document().scrollingElement() == this) { | 827 if (document().scrollingElementInternal() == this) { |
| 828 if (LocalDOMWindow* window = document().domWindow()) | 828 if (LocalDOMWindow* window = document().domWindow()) |
| 829 window->scrollTo(window->scrollX(), newTop); | 829 window->scrollTo(window->scrollX(), newTop); |
| 830 } else { | 830 } else { |
| 831 LayoutBox* box = layoutBox(); | 831 LayoutBox* box = layoutBox(); |
| 832 if (box) | 832 if (box) |
| 833 box->setScrollTop( | 833 box->setScrollTop( |
| 834 LayoutUnit::fromFloatRound(newTop * box->style()->effectiveZoom())); | 834 LayoutUnit::fromFloatRound(newTop * box->style()->effectiveZoom())); |
| 835 } | 835 } |
| 836 } | 836 } |
| 837 | 837 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 885 } | 885 } |
| 886 | 886 |
| 887 void Element::scrollTo(double x, double y) { | 887 void Element::scrollTo(double x, double y) { |
| 888 ScrollToOptions scrollToOptions; | 888 ScrollToOptions scrollToOptions; |
| 889 scrollToOptions.setLeft(x); | 889 scrollToOptions.setLeft(x); |
| 890 scrollToOptions.setTop(y); | 890 scrollToOptions.setTop(y); |
| 891 scrollTo(scrollToOptions); | 891 scrollTo(scrollToOptions); |
| 892 } | 892 } |
| 893 | 893 |
| 894 void Element::scrollTo(const ScrollToOptions& scrollToOptions) { | 894 void Element::scrollTo(const ScrollToOptions& scrollToOptions) { |
| 895 LOG(ERROR) << "scrollto"; | |
|
wkorman
2017/01/11 03:56:39
rm
chrishtr
2017/01/11 04:09:09
argh. I thought I had removed that, sorry.
| |
| 895 // FIXME: This should be removed once scroll updates are processed only after | 896 // FIXME: This should be removed once scroll updates are processed only after |
| 896 // the compositing update. See http://crbug.com/420741. | 897 // the compositing update. See http://crbug.com/420741. |
| 897 document().updateStyleAndLayoutIgnorePendingStylesheetsForNode(this); | 898 document().updateStyleAndLayoutIgnorePendingStylesheetsForNode(this); |
| 898 | 899 |
| 899 if (document().scrollingElement() == this) { | 900 if (document().scrollingElement() == this) { |
| 900 scrollFrameTo(scrollToOptions); | 901 scrollFrameTo(scrollToOptions); |
| 901 } else { | 902 } else { |
| 902 scrollLayoutBoxTo(scrollToOptions); | 903 scrollLayoutBoxTo(scrollToOptions); |
| 903 } | 904 } |
| 904 } | 905 } |
| (...skipping 3205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4110 } | 4111 } |
| 4111 | 4112 |
| 4112 DEFINE_TRACE_WRAPPERS(Element) { | 4113 DEFINE_TRACE_WRAPPERS(Element) { |
| 4113 if (hasRareData()) { | 4114 if (hasRareData()) { |
| 4114 visitor->traceWrappers(elementRareData()); | 4115 visitor->traceWrappers(elementRareData()); |
| 4115 } | 4116 } |
| 4116 ContainerNode::traceWrappers(visitor); | 4117 ContainerNode::traceWrappers(visitor); |
| 4117 } | 4118 } |
| 4118 | 4119 |
| 4119 } // namespace blink | 4120 } // namespace blink |
| OLD | NEW |