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 901 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
912 double top = | 912 double top = |
913 scrollToOptions.hasTop() | 913 scrollToOptions.hasTop() |
914 ? ScrollableArea::normalizeNonFiniteScroll(scrollToOptions.top()) | 914 ? ScrollableArea::normalizeNonFiniteScroll(scrollToOptions.top()) |
915 : 0.0; | 915 : 0.0; |
916 | 916 |
917 ScrollBehavior scrollBehavior = ScrollBehaviorAuto; | 917 ScrollBehavior scrollBehavior = ScrollBehaviorAuto; |
918 ScrollableArea::scrollBehaviorFromString(scrollToOptions.behavior(), | 918 ScrollableArea::scrollBehaviorFromString(scrollToOptions.behavior(), |
919 scrollBehavior); | 919 scrollBehavior); |
920 LayoutBox* box = layoutBox(); | 920 LayoutBox* box = layoutBox(); |
921 if (box) { | 921 if (box) { |
922 double currentScaledLeft = box->scrollLeft(); | 922 float currentScaledLeft = box->scrollLeft().toFloat(); |
923 double currentScaledTop = box->scrollTop(); | 923 float currentScaledTop = box->scrollTop().toFloat(); |
924 double newScaledLeft = | 924 float newScaledLeft = |
925 left * box->style()->effectiveZoom() + currentScaledLeft; | 925 left * box->style()->effectiveZoom() + currentScaledLeft; |
926 double newScaledTop = | 926 float newScaledTop = top * box->style()->effectiveZoom() + currentScaledTop; |
927 top * box->style()->effectiveZoom() + currentScaledTop; | 927 box->scrollToPosition(FloatPoint(newScaledLeft, newScaledTop), |
928 box->scrollToOffset(DoubleSize(newScaledLeft, newScaledTop), | 928 scrollBehavior); |
929 scrollBehavior); | |
930 } | 929 } |
931 } | 930 } |
932 | 931 |
933 void Element::scrollLayoutBoxTo(const ScrollToOptions& scrollToOptions) { | 932 void Element::scrollLayoutBoxTo(const ScrollToOptions& scrollToOptions) { |
934 ScrollBehavior scrollBehavior = ScrollBehaviorAuto; | 933 ScrollBehavior scrollBehavior = ScrollBehaviorAuto; |
935 ScrollableArea::scrollBehaviorFromString(scrollToOptions.behavior(), | 934 ScrollableArea::scrollBehaviorFromString(scrollToOptions.behavior(), |
936 scrollBehavior); | 935 scrollBehavior); |
937 | 936 |
938 LayoutBox* box = layoutBox(); | 937 LayoutBox* box = layoutBox(); |
939 if (box) { | 938 if (box) { |
940 double scaledLeft = box->scrollLeft(); | 939 float scaledLeft = box->scrollLeft().toFloat(); |
941 double scaledTop = box->scrollTop(); | 940 float scaledTop = box->scrollTop().toFloat(); |
942 if (scrollToOptions.hasLeft()) | 941 if (scrollToOptions.hasLeft()) |
943 scaledLeft = | 942 scaledLeft = |
944 ScrollableArea::normalizeNonFiniteScroll(scrollToOptions.left()) * | 943 ScrollableArea::normalizeNonFiniteScroll(scrollToOptions.left()) * |
945 box->style()->effectiveZoom(); | 944 box->style()->effectiveZoom(); |
946 if (scrollToOptions.hasTop()) | 945 if (scrollToOptions.hasTop()) |
947 scaledTop = | 946 scaledTop = |
948 ScrollableArea::normalizeNonFiniteScroll(scrollToOptions.top()) * | 947 ScrollableArea::normalizeNonFiniteScroll(scrollToOptions.top()) * |
949 box->style()->effectiveZoom(); | 948 box->style()->effectiveZoom(); |
950 box->scrollToOffset(DoubleSize(scaledLeft, scaledTop), scrollBehavior); | 949 box->scrollToPosition(FloatPoint(scaledLeft, scaledTop), scrollBehavior); |
951 } | 950 } |
952 } | 951 } |
953 | 952 |
954 void Element::scrollFrameBy(const ScrollToOptions& scrollToOptions) { | 953 void Element::scrollFrameBy(const ScrollToOptions& scrollToOptions) { |
955 double left = | 954 double left = |
956 scrollToOptions.hasLeft() | 955 scrollToOptions.hasLeft() |
957 ? ScrollableArea::normalizeNonFiniteScroll(scrollToOptions.left()) | 956 ? ScrollableArea::normalizeNonFiniteScroll(scrollToOptions.left()) |
958 : 0.0; | 957 : 0.0; |
959 double top = | 958 double top = |
960 scrollToOptions.hasTop() | 959 scrollToOptions.hasTop() |
961 ? ScrollableArea::normalizeNonFiniteScroll(scrollToOptions.top()) | 960 ? ScrollableArea::normalizeNonFiniteScroll(scrollToOptions.top()) |
962 : 0.0; | 961 : 0.0; |
963 | 962 |
964 ScrollBehavior scrollBehavior = ScrollBehaviorAuto; | 963 ScrollBehavior scrollBehavior = ScrollBehaviorAuto; |
965 ScrollableArea::scrollBehaviorFromString(scrollToOptions.behavior(), | 964 ScrollableArea::scrollBehaviorFromString(scrollToOptions.behavior(), |
966 scrollBehavior); | 965 scrollBehavior); |
967 LocalFrame* frame = document().frame(); | 966 LocalFrame* frame = document().frame(); |
968 if (!frame) | 967 if (!frame) |
969 return; | 968 return; |
970 ScrollableArea* viewport = | 969 ScrollableArea* viewport = |
971 frame->view() ? frame->view()->getScrollableArea() : 0; | 970 frame->view() ? frame->view()->getScrollableArea() : 0; |
972 if (!viewport) | 971 if (!viewport) |
973 return; | 972 return; |
974 | 973 |
975 double newScaledLeft = | 974 float newScaledLeft = |
976 left * frame->pageZoomFactor() + viewport->scrollPositionDouble().x(); | 975 left * frame->pageZoomFactor() + viewport->scrollOffset().width(); |
977 double newScaledTop = | 976 float newScaledTop = |
978 top * frame->pageZoomFactor() + viewport->scrollPositionDouble().y(); | 977 top * frame->pageZoomFactor() + viewport->scrollOffset().height(); |
979 viewport->setScrollPosition(DoublePoint(newScaledLeft, newScaledTop), | 978 viewport->setScrollOffset(ScrollOffset(newScaledLeft, newScaledTop), |
980 ProgrammaticScroll, scrollBehavior); | 979 ProgrammaticScroll, scrollBehavior); |
981 } | 980 } |
982 | 981 |
983 void Element::scrollFrameTo(const ScrollToOptions& scrollToOptions) { | 982 void Element::scrollFrameTo(const ScrollToOptions& scrollToOptions) { |
984 ScrollBehavior scrollBehavior = ScrollBehaviorAuto; | 983 ScrollBehavior scrollBehavior = ScrollBehaviorAuto; |
985 ScrollableArea::scrollBehaviorFromString(scrollToOptions.behavior(), | 984 ScrollableArea::scrollBehaviorFromString(scrollToOptions.behavior(), |
986 scrollBehavior); | 985 scrollBehavior); |
987 LocalFrame* frame = document().frame(); | 986 LocalFrame* frame = document().frame(); |
988 if (!frame) | 987 if (!frame) |
989 return; | 988 return; |
990 ScrollableArea* viewport = | 989 ScrollableArea* viewport = |
991 frame->view() ? frame->view()->getScrollableArea() : 0; | 990 frame->view() ? frame->view()->getScrollableArea() : 0; |
992 if (!viewport) | 991 if (!viewport) |
993 return; | 992 return; |
994 | 993 |
995 double scaledLeft = viewport->scrollPositionDouble().x(); | 994 float scaledLeft = viewport->scrollOffset().width(); |
996 double scaledTop = viewport->scrollPositionDouble().y(); | 995 float scaledTop = viewport->scrollOffset().height(); |
997 if (scrollToOptions.hasLeft()) | 996 if (scrollToOptions.hasLeft()) |
998 scaledLeft = | 997 scaledLeft = |
999 ScrollableArea::normalizeNonFiniteScroll(scrollToOptions.left()) * | 998 ScrollableArea::normalizeNonFiniteScroll(scrollToOptions.left()) * |
1000 frame->pageZoomFactor(); | 999 frame->pageZoomFactor(); |
1001 if (scrollToOptions.hasTop()) | 1000 if (scrollToOptions.hasTop()) |
1002 scaledTop = | 1001 scaledTop = |
1003 ScrollableArea::normalizeNonFiniteScroll(scrollToOptions.top()) * | 1002 ScrollableArea::normalizeNonFiniteScroll(scrollToOptions.top()) * |
1004 frame->pageZoomFactor(); | 1003 frame->pageZoomFactor(); |
1005 viewport->setScrollPosition(DoublePoint(scaledLeft, scaledTop), | 1004 viewport->setScrollOffset(ScrollOffset(scaledLeft, scaledTop), |
1006 ProgrammaticScroll, scrollBehavior); | 1005 ProgrammaticScroll, scrollBehavior); |
1007 } | 1006 } |
1008 | 1007 |
1009 bool Element::hasCompositorProxy() const { | 1008 bool Element::hasCompositorProxy() const { |
1010 return hasRareData() && elementRareData()->proxiedPropertyCounts(); | 1009 return hasRareData() && elementRareData()->proxiedPropertyCounts(); |
1011 } | 1010 } |
1012 | 1011 |
1013 void Element::incrementCompositorProxiedProperties(uint32_t mutableProperties) { | 1012 void Element::incrementCompositorProxiedProperties(uint32_t mutableProperties) { |
1014 ElementRareData& rareData = ensureElementRareData(); | 1013 ElementRareData& rareData = ensureElementRareData(); |
1015 if (!rareData.proxiedPropertyCounts()) | 1014 if (!rareData.proxiedPropertyCounts()) |
1016 setNeedsStyleRecalc(LocalStyleChange, | 1015 setNeedsStyleRecalc(LocalStyleChange, |
(...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1602 false); | 1601 false); |
1603 } | 1602 } |
1604 } | 1603 } |
1605 | 1604 |
1606 if (Fullscreen* fullscreen = Fullscreen::fromIfExists(document())) | 1605 if (Fullscreen* fullscreen = Fullscreen::fromIfExists(document())) |
1607 fullscreen->elementRemoved(*this); | 1606 fullscreen->elementRemoved(*this); |
1608 | 1607 |
1609 if (document().page()) | 1608 if (document().page()) |
1610 document().page()->pointerLockController().elementRemoved(this); | 1609 document().page()->pointerLockController().elementRemoved(this); |
1611 | 1610 |
1612 setSavedLayerScrollOffset(IntSize()); | 1611 setSavedLayerScrollOffset(ScrollOffset()); |
1613 | 1612 |
1614 if (insertionPoint->isInTreeScope() && treeScope() == document()) { | 1613 if (insertionPoint->isInTreeScope() && treeScope() == document()) { |
1615 const AtomicString& idValue = getIdAttribute(); | 1614 const AtomicString& idValue = getIdAttribute(); |
1616 if (!idValue.isNull()) | 1615 if (!idValue.isNull()) |
1617 updateId(insertionPoint->treeScope(), idValue, nullAtom); | 1616 updateId(insertionPoint->treeScope(), idValue, nullAtom); |
1618 | 1617 |
1619 const AtomicString& nameValue = getNameAttribute(); | 1618 const AtomicString& nameValue = getNameAttribute(); |
1620 if (!nameValue.isNull()) | 1619 if (!nameValue.isNull()) |
1621 updateName(nameValue, nullAtom); | 1620 updateName(nameValue, nullAtom); |
1622 } | 1621 } |
(...skipping 1986 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3609 toHTMLDocument(document()).removeExtraNamedItem(oldId); | 3608 toHTMLDocument(document()).removeExtraNamedItem(oldId); |
3610 | 3609 |
3611 if (!newId.isEmpty()) | 3610 if (!newId.isEmpty()) |
3612 toHTMLDocument(document()).addExtraNamedItem(newId); | 3611 toHTMLDocument(document()).addExtraNamedItem(newId); |
3613 } | 3612 } |
3614 | 3613 |
3615 void Element::scheduleSVGFilterLayerUpdateHack() { | 3614 void Element::scheduleSVGFilterLayerUpdateHack() { |
3616 document().scheduleSVGFilterLayerUpdateHack(*this); | 3615 document().scheduleSVGFilterLayerUpdateHack(*this); |
3617 } | 3616 } |
3618 | 3617 |
3619 IntSize Element::savedLayerScrollOffset() const { | 3618 ScrollOffset Element::savedLayerScrollOffset() const { |
3620 return hasRareData() ? elementRareData()->savedLayerScrollOffset() | 3619 return hasRareData() ? elementRareData()->savedLayerScrollOffset() |
3621 : IntSize(); | 3620 : ScrollOffset(); |
3622 } | 3621 } |
3623 | 3622 |
3624 void Element::setSavedLayerScrollOffset(const IntSize& size) { | 3623 void Element::setSavedLayerScrollOffset(const ScrollOffset& size) { |
3625 if (size.isZero() && !hasRareData()) | 3624 if (size.isZero() && !hasRareData()) |
3626 return; | 3625 return; |
3627 ensureElementRareData().setSavedLayerScrollOffset(size); | 3626 ensureElementRareData().setSavedLayerScrollOffset(size); |
3628 } | 3627 } |
3629 | 3628 |
3630 Attr* Element::attrIfExists(const QualifiedName& name) { | 3629 Attr* Element::attrIfExists(const QualifiedName& name) { |
3631 if (AttrNodeList* attrNodeList = this->attrNodeList()) { | 3630 if (AttrNodeList* attrNodeList = this->attrNodeList()) { |
3632 bool shouldIgnoreCase = shouldIgnoreAttributeCase(); | 3631 bool shouldIgnoreCase = shouldIgnoreAttributeCase(); |
3633 for (const auto& attr : *attrNodeList) { | 3632 for (const auto& attr : *attrNodeList) { |
3634 if (attr->getQualifiedName().matchesPossiblyIgnoringCase( | 3633 if (attr->getQualifiedName().matchesPossiblyIgnoringCase( |
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4083 } | 4082 } |
4084 | 4083 |
4085 DEFINE_TRACE_WRAPPERS(Element) { | 4084 DEFINE_TRACE_WRAPPERS(Element) { |
4086 if (hasRareData()) { | 4085 if (hasRareData()) { |
4087 visitor->traceWrappers(elementRareData()); | 4086 visitor->traceWrappers(elementRareData()); |
4088 } | 4087 } |
4089 ContainerNode::traceWrappers(visitor); | 4088 ContainerNode::traceWrappers(visitor); |
4090 } | 4089 } |
4091 | 4090 |
4092 } // namespace blink | 4091 } // namespace blink |
OLD | NEW |