| 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.
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 664 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 675 | 675 |
| 676 if (FrameView* view = document().view()) { | 676 if (FrameView* view = document().view()) { |
| 677 if (RenderView* renderView = document().renderView()) | 677 if (RenderView* renderView = document().renderView()) |
| 678 return adjustDoubleForAbsoluteZoom(view->scrollY(), *renderView)
; | 678 return adjustDoubleForAbsoluteZoom(view->scrollY(), *renderView)
; |
| 679 } | 679 } |
| 680 } | 680 } |
| 681 | 681 |
| 682 return 0; | 682 return 0; |
| 683 } | 683 } |
| 684 | 684 |
| 685 void Element::setScrollLeft(int newLeft) | 685 void Element::setScrollLeftInternal(int newLeft, ScrollBehavior scrollBehavior) |
| 686 { | 686 { |
| 687 document().updateLayoutIgnorePendingStylesheets(); | 687 document().updateLayoutIgnorePendingStylesheets(); |
| 688 | 688 |
| 689 if (document().documentElement() != this) { | 689 if (document().documentElement() != this) { |
| 690 if (RenderBox* rend = renderBox()) | 690 if (RenderBox* rend = renderBox()) |
| 691 rend->setScrollLeft(roundf(newLeft * rend->style()->effectiveZoom())
); | 691 rend->setScrollLeft(roundf(newLeft * rend->style()->effectiveZoom())
, scrollBehavior); |
| 692 return; | 692 return; |
| 693 } | 693 } |
| 694 | 694 |
| 695 if (RuntimeEnabledFeatures::scrollTopLeftInteropEnabled()) { | 695 if (RuntimeEnabledFeatures::scrollTopLeftInteropEnabled()) { |
| 696 if (document().inQuirksMode()) | 696 if (document().inQuirksMode()) |
| 697 return; | 697 return; |
| 698 | 698 |
| 699 LocalFrame* frame = document().frame(); | 699 LocalFrame* frame = document().frame(); |
| 700 if (!frame) | 700 if (!frame) |
| 701 return; | 701 return; |
| 702 FrameView* view = frame->view(); | 702 FrameView* view = frame->view(); |
| 703 if (!view) | 703 if (!view) |
| 704 return; | 704 return; |
| 705 | 705 |
| 706 view->setScrollPosition(IntPoint(roundf(newLeft * frame->pageZoomFactor(
)), view->scrollY())); | 706 view->setScrollPosition(IntPoint(roundf(newLeft * frame->pageZoomFactor(
)), view->scrollY()), scrollBehavior); |
| 707 } | 707 } |
| 708 } | 708 } |
| 709 | 709 |
| 710 void Element::setScrollLeft(const Dictionary& scrollOptionsHorizontal, Exception
State& exceptionState) | 710 void Element::setScrollLeft(const Dictionary& scrollOptionsHorizontal, Exception
State& exceptionState) |
| 711 { | 711 { |
| 712 String scrollBehaviorString; | 712 String scrollBehaviorString; |
| 713 ScrollBehavior scrollBehavior = ScrollBehaviorAuto; | 713 ScrollBehavior scrollBehavior = ScrollBehaviorAuto; |
| 714 if (DictionaryHelper::get(scrollOptionsHorizontal, "behavior", scrollBehavio
rString)) { | 714 if (DictionaryHelper::get(scrollOptionsHorizontal, "behavior", scrollBehavio
rString)) { |
| 715 if (!ScrollableArea::scrollBehaviorFromString(scrollBehaviorString, scro
llBehavior)) { | 715 if (!ScrollableArea::scrollBehaviorFromString(scrollBehaviorString, scro
llBehavior)) { |
| 716 exceptionState.throwTypeError("The ScrollBehavior provided is invali
d."); | 716 exceptionState.throwTypeError("The ScrollBehavior provided is invali
d."); |
| 717 return; | 717 return; |
| 718 } | 718 } |
| 719 } | 719 } |
| 720 | 720 |
| 721 int position; | 721 int position; |
| 722 if (!DictionaryHelper::get(scrollOptionsHorizontal, "x", position)) { | 722 if (!DictionaryHelper::get(scrollOptionsHorizontal, "x", position)) { |
| 723 exceptionState.throwTypeError("ScrollOptionsHorizontal must include an '
x' member."); | 723 exceptionState.throwTypeError("ScrollOptionsHorizontal must include an '
x' member."); |
| 724 return; | 724 return; |
| 725 } | 725 } |
| 726 | 726 |
| 727 // FIXME: Use scrollBehavior to decide whether to scroll smoothly or instant
ly. | 727 setScrollLeft(position, scrollBehavior); |
| 728 setScrollLeft(position); | |
| 729 } | 728 } |
| 730 | 729 |
| 731 void Element::setScrollTop(int newTop) | 730 void Element::setScrollTopInternal(int newTop, ScrollBehavior scrollBehavior) |
| 732 { | 731 { |
| 733 document().updateLayoutIgnorePendingStylesheets(); | 732 document().updateLayoutIgnorePendingStylesheets(); |
| 734 | 733 |
| 735 if (document().documentElement() != this) { | 734 if (document().documentElement() != this) { |
| 736 if (RenderBox* rend = renderBox()) | 735 if (RenderBox* rend = renderBox()) |
| 737 rend->setScrollTop(roundf(newTop * rend->style()->effectiveZoom())); | 736 rend->setScrollTop(roundf(newTop * rend->style()->effectiveZoom()),
scrollBehavior); |
| 738 return; | 737 return; |
| 739 } | 738 } |
| 740 | 739 |
| 741 if (RuntimeEnabledFeatures::scrollTopLeftInteropEnabled()) { | 740 if (RuntimeEnabledFeatures::scrollTopLeftInteropEnabled()) { |
| 742 if (document().inQuirksMode()) | 741 if (document().inQuirksMode()) |
| 743 return; | 742 return; |
| 744 | 743 |
| 745 LocalFrame* frame = document().frame(); | 744 LocalFrame* frame = document().frame(); |
| 746 if (!frame) | 745 if (!frame) |
| 747 return; | 746 return; |
| 748 FrameView* view = frame->view(); | 747 FrameView* view = frame->view(); |
| 749 if (!view) | 748 if (!view) |
| 750 return; | 749 return; |
| 751 | 750 |
| 752 view->setScrollPosition(IntPoint(view->scrollX(), roundf(newTop * frame-
>pageZoomFactor()))); | 751 view->setScrollPosition(IntPoint(view->scrollX(), roundf(newTop * frame-
>pageZoomFactor())), scrollBehavior); |
| 753 } | 752 } |
| 754 } | 753 } |
| 755 | 754 |
| 756 void Element::setScrollTop(const Dictionary& scrollOptionsVertical, ExceptionSta
te& exceptionState) | 755 void Element::setScrollTop(const Dictionary& scrollOptionsVertical, ExceptionSta
te& exceptionState) |
| 757 { | 756 { |
| 758 String scrollBehaviorString; | 757 String scrollBehaviorString; |
| 759 ScrollBehavior scrollBehavior = ScrollBehaviorAuto; | 758 ScrollBehavior scrollBehavior = ScrollBehaviorAuto; |
| 760 if (DictionaryHelper::get(scrollOptionsVertical, "behavior", scrollBehaviorS
tring)) { | 759 if (DictionaryHelper::get(scrollOptionsVertical, "behavior", scrollBehaviorS
tring)) { |
| 761 if (!ScrollableArea::scrollBehaviorFromString(scrollBehaviorString, scro
llBehavior)) { | 760 if (!ScrollableArea::scrollBehaviorFromString(scrollBehaviorString, scro
llBehavior)) { |
| 762 exceptionState.throwTypeError("The ScrollBehavior provided is invali
d."); | 761 exceptionState.throwTypeError("The ScrollBehavior provided is invali
d."); |
| 763 return; | 762 return; |
| 764 } | 763 } |
| 765 } | 764 } |
| 766 | 765 |
| 767 int position; | 766 int position; |
| 768 if (!DictionaryHelper::get(scrollOptionsVertical, "y", position)) { | 767 if (!DictionaryHelper::get(scrollOptionsVertical, "y", position)) { |
| 769 exceptionState.throwTypeError("ScrollOptionsVertical must include a 'y'
member."); | 768 exceptionState.throwTypeError("ScrollOptionsVertical must include a 'y'
member."); |
| 770 return; | 769 return; |
| 771 } | 770 } |
| 772 | 771 |
| 773 // FIXME: Use scrollBehavior to decide whether to scroll smoothly or instant
ly. | 772 setScrollTop(position, scrollBehavior); |
| 774 setScrollTop(position); | |
| 775 } | 773 } |
| 776 | 774 |
| 777 int Element::scrollWidth() | 775 int Element::scrollWidth() |
| 778 { | 776 { |
| 779 document().updateLayoutIgnorePendingStylesheets(); | 777 document().updateLayoutIgnorePendingStylesheets(); |
| 780 if (RenderBox* rend = renderBox()) | 778 if (RenderBox* rend = renderBox()) |
| 781 return adjustLayoutUnitForAbsoluteZoom(rend->scrollWidth(), *rend).toDou
ble(); | 779 return adjustLayoutUnitForAbsoluteZoom(rend->scrollWidth(), *rend).toDou
ble(); |
| 782 return 0; | 780 return 0; |
| 783 } | 781 } |
| 784 | 782 |
| (...skipping 2568 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3353 | 3351 |
| 3354 void Element::trace(Visitor* visitor) | 3352 void Element::trace(Visitor* visitor) |
| 3355 { | 3353 { |
| 3356 if (hasRareData()) | 3354 if (hasRareData()) |
| 3357 visitor->trace(elementRareData()); | 3355 visitor->trace(elementRareData()); |
| 3358 visitor->trace(m_elementData); | 3356 visitor->trace(m_elementData); |
| 3359 ContainerNode::trace(visitor); | 3357 ContainerNode::trace(visitor); |
| 3360 } | 3358 } |
| 3361 | 3359 |
| 3362 } // namespace WebCore | 3360 } // namespace WebCore |
| OLD | NEW |