| 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 |
| 11 * modify it under the terms of the GNU Library General Public | 11 * modify it under the terms of the GNU Library General Public |
| 12 * License as published by the Free Software Foundation; either | 12 * License as published by the Free Software Foundation; either |
| 13 * version 2 of the License, or (at your option) any later version. | 13 * version 2 of the License, or (at your option) any later version. |
| 14 * | 14 * |
| 15 * This library is distributed in the hope that it will be useful, | 15 * This library is distributed in the hope that it will be useful, |
| 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 18 * Library General Public License for more details. | 18 * Library General Public License for more details. |
| 19 * | 19 * |
| 20 * You should have received a copy of the GNU Library General Public License | 20 * You should have received a copy of the GNU Library General Public License |
| 21 * along with this library; see the file COPYING.LIB. If not, write to | 21 * along with this library; see the file COPYING.LIB. If not, write to |
| 22 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 22 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 23 * Boston, MA 02110-1301, USA. | 23 * Boston, MA 02110-1301, USA. |
| 24 */ | 24 */ |
| 25 | 25 |
| 26 #include "config.h" | 26 #include "config.h" |
| 27 #include "core/dom/Element.h" | 27 #include "core/dom/Element.h" |
| 28 | 28 |
| 29 #include "bindings/core/v8/Dictionary.h" | 29 #include "bindings/core/v8/Dictionary.h" |
| 30 #include "bindings/core/v8/DictionaryHelper.h" |
| 30 #include "bindings/core/v8/ExceptionMessages.h" | 31 #include "bindings/core/v8/ExceptionMessages.h" |
| 31 #include "bindings/core/v8/ExceptionState.h" | 32 #include "bindings/core/v8/ExceptionState.h" |
| 32 #include "core/CSSValueKeywords.h" | 33 #include "core/CSSValueKeywords.h" |
| 33 #include "core/SVGNames.h" | 34 #include "core/SVGNames.h" |
| 34 #include "core/XMLNames.h" | 35 #include "core/XMLNames.h" |
| 35 #include "core/accessibility/AXObjectCache.h" | 36 #include "core/accessibility/AXObjectCache.h" |
| 36 #include "core/animation/AnimationTimeline.h" | 37 #include "core/animation/AnimationTimeline.h" |
| 37 #include "core/animation/css/CSSAnimations.h" | 38 #include "core/animation/css/CSSAnimations.h" |
| 38 #include "core/css/CSSImageValue.h" | 39 #include "core/css/CSSImageValue.h" |
| 39 #include "core/css/CSSStyleSheet.h" | 40 #include "core/css/CSSStyleSheet.h" |
| (...skipping 664 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 704 return; | 705 return; |
| 705 | 706 |
| 706 view->setScrollPosition(IntPoint(roundf(newLeft * frame->pageZoomFactor(
)), view->scrollY())); | 707 view->setScrollPosition(IntPoint(roundf(newLeft * frame->pageZoomFactor(
)), view->scrollY())); |
| 707 } | 708 } |
| 708 } | 709 } |
| 709 | 710 |
| 710 void Element::setScrollLeft(const Dictionary& scrollOptionsHorizontal, Exception
State& exceptionState) | 711 void Element::setScrollLeft(const Dictionary& scrollOptionsHorizontal, Exception
State& exceptionState) |
| 711 { | 712 { |
| 712 String scrollBehaviorString; | 713 String scrollBehaviorString; |
| 713 ScrollBehavior scrollBehavior = ScrollBehaviorAuto; | 714 ScrollBehavior scrollBehavior = ScrollBehaviorAuto; |
| 714 if (scrollOptionsHorizontal.get("behavior", scrollBehaviorString)) { | 715 if (DictionaryHelper::get(scrollOptionsHorizontal, "behavior", scrollBehavio
rString)) { |
| 715 if (!ScrollableArea::scrollBehaviorFromString(scrollBehaviorString, scro
llBehavior)) { | 716 if (!ScrollableArea::scrollBehaviorFromString(scrollBehaviorString, scro
llBehavior)) { |
| 716 exceptionState.throwTypeError("The ScrollBehavior provided is invali
d."); | 717 exceptionState.throwTypeError("The ScrollBehavior provided is invali
d."); |
| 717 return; | 718 return; |
| 718 } | 719 } |
| 719 } | 720 } |
| 720 | 721 |
| 721 int position; | 722 int position; |
| 722 if (!scrollOptionsHorizontal.get("x", position)) { | 723 if (!DictionaryHelper::get(scrollOptionsHorizontal, "x", position)) { |
| 723 exceptionState.throwTypeError("ScrollOptionsHorizontal must include an '
x' member."); | 724 exceptionState.throwTypeError("ScrollOptionsHorizontal must include an '
x' member."); |
| 724 return; | 725 return; |
| 725 } | 726 } |
| 726 | 727 |
| 727 // 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. |
| 728 setScrollLeft(position); | 729 setScrollLeft(position); |
| 729 } | 730 } |
| 730 | 731 |
| 731 void Element::setScrollTop(int newTop) | 732 void Element::setScrollTop(int newTop) |
| 732 { | 733 { |
| (...skipping 17 matching lines...) Expand all Loading... |
| 750 return; | 751 return; |
| 751 | 752 |
| 752 view->setScrollPosition(IntPoint(view->scrollX(), roundf(newTop * frame-
>pageZoomFactor()))); | 753 view->setScrollPosition(IntPoint(view->scrollX(), roundf(newTop * frame-
>pageZoomFactor()))); |
| 753 } | 754 } |
| 754 } | 755 } |
| 755 | 756 |
| 756 void Element::setScrollTop(const Dictionary& scrollOptionsVertical, ExceptionSta
te& exceptionState) | 757 void Element::setScrollTop(const Dictionary& scrollOptionsVertical, ExceptionSta
te& exceptionState) |
| 757 { | 758 { |
| 758 String scrollBehaviorString; | 759 String scrollBehaviorString; |
| 759 ScrollBehavior scrollBehavior = ScrollBehaviorAuto; | 760 ScrollBehavior scrollBehavior = ScrollBehaviorAuto; |
| 760 if (scrollOptionsVertical.get("behavior", scrollBehaviorString)) { | 761 if (DictionaryHelper::get(scrollOptionsVertical, "behavior", scrollBehaviorS
tring)) { |
| 761 if (!ScrollableArea::scrollBehaviorFromString(scrollBehaviorString, scro
llBehavior)) { | 762 if (!ScrollableArea::scrollBehaviorFromString(scrollBehaviorString, scro
llBehavior)) { |
| 762 exceptionState.throwTypeError("The ScrollBehavior provided is invali
d."); | 763 exceptionState.throwTypeError("The ScrollBehavior provided is invali
d."); |
| 763 return; | 764 return; |
| 764 } | 765 } |
| 765 } | 766 } |
| 766 | 767 |
| 767 int position; | 768 int position; |
| 768 if (!scrollOptionsVertical.get("y", position)) { | 769 if (!DictionaryHelper::get(scrollOptionsVertical, "y", position)) { |
| 769 exceptionState.throwTypeError("ScrollOptionsVertical must include a 'y'
member."); | 770 exceptionState.throwTypeError("ScrollOptionsVertical must include a 'y'
member."); |
| 770 return; | 771 return; |
| 771 } | 772 } |
| 772 | 773 |
| 773 // FIXME: Use scrollBehavior to decide whether to scroll smoothly or instant
ly. | 774 // FIXME: Use scrollBehavior to decide whether to scroll smoothly or instant
ly. |
| 774 setScrollTop(position); | 775 setScrollTop(position); |
| 775 } | 776 } |
| 776 | 777 |
| 777 int Element::scrollWidth() | 778 int Element::scrollWidth() |
| 778 { | 779 { |
| (...skipping 2566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3345 | 3346 |
| 3346 void Element::trace(Visitor* visitor) | 3347 void Element::trace(Visitor* visitor) |
| 3347 { | 3348 { |
| 3348 if (hasRareData()) | 3349 if (hasRareData()) |
| 3349 visitor->trace(elementRareData()); | 3350 visitor->trace(elementRareData()); |
| 3350 visitor->trace(m_elementData); | 3351 visitor->trace(m_elementData); |
| 3351 ContainerNode::trace(visitor); | 3352 ContainerNode::trace(visitor); |
| 3352 } | 3353 } |
| 3353 | 3354 |
| 3354 } // namespace WebCore | 3355 } // namespace WebCore |
| OLD | NEW |