OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org> | 2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org> |
3 * 1999 Lars Knoll <knoll@kde.org> | 3 * 1999 Lars Knoll <knoll@kde.org> |
4 * 1999 Antti Koivisto <koivisto@kde.org> | 4 * 1999 Antti Koivisto <koivisto@kde.org> |
5 * 2000 Dirk Mueller <mueller@kde.org> | 5 * 2000 Dirk Mueller <mueller@kde.org> |
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. |
7 * (C) 2006 Graham Dennis (graham.dennis@gmail.com) | 7 * (C) 2006 Graham Dennis (graham.dennis@gmail.com) |
8 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) | 8 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) |
9 * Copyright (C) 2009 Google Inc. All rights reserved. | 9 * Copyright (C) 2009 Google Inc. All rights reserved. |
10 * | 10 * |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 #include "core/rendering/TextAutosizer.h" | 69 #include "core/rendering/TextAutosizer.h" |
70 #include "core/rendering/style/RenderStyle.h" | 70 #include "core/rendering/style/RenderStyle.h" |
71 #include "core/rendering/svg/RenderSVGRoot.h" | 71 #include "core/rendering/svg/RenderSVGRoot.h" |
72 #include "core/svg/SVGDocument.h" | 72 #include "core/svg/SVGDocument.h" |
73 #include "core/svg/SVGSVGElement.h" | 73 #include "core/svg/SVGSVGElement.h" |
74 #include "platform/TraceEvent.h" | 74 #include "platform/TraceEvent.h" |
75 #include "platform/fonts/FontCache.h" | 75 #include "platform/fonts/FontCache.h" |
76 #include "platform/geometry/FloatRect.h" | 76 #include "platform/geometry/FloatRect.h" |
77 #include "platform/graphics/GraphicsContext.h" | 77 #include "platform/graphics/GraphicsContext.h" |
78 #include "platform/graphics/GraphicsLayerDebugInfo.h" | 78 #include "platform/graphics/GraphicsLayerDebugInfo.h" |
| 79 #include "platform/scroll/ProgrammaticScrollAnimator.h" |
79 #include "platform/scroll/ScrollAnimator.h" | 80 #include "platform/scroll/ScrollAnimator.h" |
80 #include "platform/scroll/ScrollbarTheme.h" | 81 #include "platform/scroll/ScrollbarTheme.h" |
81 #include "platform/text/TextStream.h" | 82 #include "platform/text/TextStream.h" |
82 #include "wtf/CurrentTime.h" | 83 #include "wtf/CurrentTime.h" |
83 #include "wtf/TemporaryChange.h" | 84 #include "wtf/TemporaryChange.h" |
84 | 85 |
85 namespace WebCore { | 86 namespace WebCore { |
86 | 87 |
87 using namespace HTMLNames; | 88 using namespace HTMLNames; |
88 | 89 |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 setCanHaveScrollbars(false); | 287 setCanHaveScrollbars(false); |
287 } | 288 } |
288 } | 289 } |
289 | 290 |
290 void FrameView::prepareForDetach() | 291 void FrameView::prepareForDetach() |
291 { | 292 { |
292 RELEASE_ASSERT(!isInPerformLayout()); | 293 RELEASE_ASSERT(!isInPerformLayout()); |
293 | 294 |
294 if (ScrollAnimator* scrollAnimator = existingScrollAnimator()) | 295 if (ScrollAnimator* scrollAnimator = existingScrollAnimator()) |
295 scrollAnimator->cancelAnimations(); | 296 scrollAnimator->cancelAnimations(); |
| 297 cancelProgrammaticScrollAnimation(); |
296 | 298 |
297 detachCustomScrollbars(); | 299 detachCustomScrollbars(); |
298 // When the view is no longer associated with a frame, it needs to be remove
d from the ax object cache | 300 // When the view is no longer associated with a frame, it needs to be remove
d from the ax object cache |
299 // right now, otherwise it won't be able to reach the topDocument()'s axObje
ct cache later. | 301 // right now, otherwise it won't be able to reach the topDocument()'s axObje
ct cache later. |
300 removeFromAXObjectCache(); | 302 removeFromAXObjectCache(); |
301 | 303 |
302 if (m_frame->page()) { | 304 if (m_frame->page()) { |
303 if (ScrollingCoordinator* scrollingCoordinator = m_frame->page()->scroll
ingCoordinator()) | 305 if (ScrollingCoordinator* scrollingCoordinator = m_frame->page()->scroll
ingCoordinator()) |
304 scrollingCoordinator->willDestroyScrollableArea(this); | 306 scrollingCoordinator->willDestroyScrollableArea(this); |
305 } | 307 } |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
393 ScrollView::setFrameRect(newRect); | 395 ScrollView::setFrameRect(newRect); |
394 | 396 |
395 updateScrollableAreaSet(); | 397 updateScrollableAreaSet(); |
396 | 398 |
397 if (RenderView* renderView = this->renderView()) { | 399 if (RenderView* renderView = this->renderView()) { |
398 if (renderView->usesCompositing()) | 400 if (renderView->usesCompositing()) |
399 renderView->compositor()->frameViewDidChangeSize(); | 401 renderView->compositor()->frameViewDidChangeSize(); |
400 } | 402 } |
401 } | 403 } |
402 | 404 |
| 405 bool FrameView::registerForAnimation() |
| 406 { |
| 407 return true; |
| 408 } |
| 409 |
403 bool FrameView::scheduleAnimation() | 410 bool FrameView::scheduleAnimation() |
404 { | 411 { |
405 if (HostWindow* window = hostWindow()) { | 412 if (HostWindow* window = hostWindow()) { |
406 window->scheduleAnimation(); | 413 window->scheduleAnimation(); |
407 return true; | 414 return true; |
408 } | 415 } |
409 return false; | 416 return false; |
410 } | 417 } |
411 | 418 |
| 419 void FrameView::serviceScrollAnimations(double monotonicTime) |
| 420 { |
| 421 ScrollableArea::serviceScrollAnimations(monotonicTime); |
| 422 |
| 423 if (!m_animatingScrollableAreas) |
| 424 return; |
| 425 |
| 426 for (HashSet<ScrollableArea*>::iterator it = m_animatingScrollableAreas->beg
in(), end = m_animatingScrollableAreas->end(); it != end; ++it) { |
| 427 ScrollableArea* scrollableArea = *it; |
| 428 scrollableArea->serviceScrollAnimations(monotonicTime); |
| 429 } |
| 430 } |
| 431 |
| 432 bool FrameView::compositedScrollAnimationsEnabled() const |
| 433 { |
| 434 if (Settings* settings = m_frame->settings()) |
| 435 return settings->compositorDrivenScrollAnimationsEnabled(); |
| 436 return false; |
| 437 } |
| 438 |
412 RenderView* FrameView::renderView() const | 439 RenderView* FrameView::renderView() const |
413 { | 440 { |
414 return frame().contentRenderer(); | 441 return frame().contentRenderer(); |
415 } | 442 } |
416 | 443 |
417 void FrameView::setCanHaveScrollbars(bool canHaveScrollbars) | 444 void FrameView::setCanHaveScrollbars(bool canHaveScrollbars) |
418 { | 445 { |
419 m_canHaveScrollbars = canHaveScrollbars; | 446 m_canHaveScrollbars = canHaveScrollbars; |
420 ScrollView::setCanHaveScrollbars(canHaveScrollbars); | 447 ScrollView::setCanHaveScrollbars(canHaveScrollbars); |
421 } | 448 } |
(...skipping 1196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1618 void FrameView::scrollElementToRect(Element* element, const IntRect& rect) | 1645 void FrameView::scrollElementToRect(Element* element, const IntRect& rect) |
1619 { | 1646 { |
1620 m_frame->document()->updateLayoutIgnorePendingStylesheets(); | 1647 m_frame->document()->updateLayoutIgnorePendingStylesheets(); |
1621 | 1648 |
1622 LayoutRect bounds = element->boundingBox(); | 1649 LayoutRect bounds = element->boundingBox(); |
1623 int centeringOffsetX = (rect.width() - bounds.width()) / 2; | 1650 int centeringOffsetX = (rect.width() - bounds.width()) / 2; |
1624 int centeringOffsetY = (rect.height() - bounds.height()) / 2; | 1651 int centeringOffsetY = (rect.height() - bounds.height()) / 2; |
1625 setScrollPosition(IntPoint(bounds.x() - centeringOffsetX - rect.x(), bounds.
y() - centeringOffsetY - rect.y())); | 1652 setScrollPosition(IntPoint(bounds.x() - centeringOffsetX - rect.x(), bounds.
y() - centeringOffsetY - rect.y())); |
1626 } | 1653 } |
1627 | 1654 |
1628 void FrameView::setScrollPosition(const IntPoint& scrollPoint) | 1655 void FrameView::setScrollPosition(const IntPoint& scrollPoint, ScrollBehavior sc
rollBehavior) |
1629 { | 1656 { |
| 1657 cancelProgrammaticScrollAnimation(); |
1630 TemporaryChange<bool> changeInProgrammaticScroll(m_inProgrammaticScroll, tru
e); | 1658 TemporaryChange<bool> changeInProgrammaticScroll(m_inProgrammaticScroll, tru
e); |
1631 m_maintainScrollPositionAnchor = 0; | 1659 m_maintainScrollPositionAnchor = 0; |
1632 | 1660 |
1633 IntPoint newScrollPosition = adjustScrollPositionWithinRange(scrollPoint); | 1661 IntPoint newScrollPosition = adjustScrollPositionWithinRange(scrollPoint); |
1634 | 1662 |
1635 if (newScrollPosition == scrollPosition()) | 1663 if (newScrollPosition == scrollPosition()) |
1636 return; | 1664 return; |
1637 | 1665 |
1638 ScrollView::setScrollPosition(newScrollPosition); | 1666 if (scrollBehavior == ScrollBehaviorAuto) |
| 1667 scrollBehavior = m_frame->document()->documentElement()->renderer()->sty
le()->scrollBehavior(); |
| 1668 ScrollView::setScrollPosition(newScrollPosition, scrollBehavior); |
1639 } | 1669 } |
1640 | 1670 |
1641 void FrameView::setScrollPositionNonProgrammatically(const IntPoint& scrollPoint
) | 1671 void FrameView::setScrollPositionNonProgrammatically(const IntPoint& scrollPoint
) |
1642 { | 1672 { |
1643 IntPoint newScrollPosition = adjustScrollPositionWithinRange(scrollPoint); | 1673 IntPoint newScrollPosition = adjustScrollPositionWithinRange(scrollPoint); |
1644 | 1674 |
1645 if (newScrollPosition == scrollPosition()) | 1675 if (newScrollPosition == scrollPosition()) |
1646 return; | 1676 return; |
1647 | 1677 |
1648 TemporaryChange<bool> changeInProgrammaticScroll(m_inProgrammaticScroll, fal
se); | 1678 TemporaryChange<bool> changeInProgrammaticScroll(m_inProgrammaticScroll, fal
se); |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1912 if (!m_layoutTimer.isActive()) | 1942 if (!m_layoutTimer.isActive()) |
1913 return; | 1943 return; |
1914 | 1944 |
1915 m_layoutTimer.stop(); | 1945 m_layoutTimer.stop(); |
1916 m_delayedLayout = false; | 1946 m_delayedLayout = false; |
1917 } | 1947 } |
1918 | 1948 |
1919 void FrameView::serviceScriptedAnimations(double monotonicAnimationStartTime) | 1949 void FrameView::serviceScriptedAnimations(double monotonicAnimationStartTime) |
1920 { | 1950 { |
1921 for (RefPtr<Frame> frame = m_frame; frame; frame = frame->tree().traverseNex
t()) { | 1951 for (RefPtr<Frame> frame = m_frame; frame; frame = frame->tree().traverseNex
t()) { |
1922 frame->view()->serviceScrollAnimations(); | 1952 frame->view()->serviceScrollAnimations(monotonicAnimationStartTime); |
1923 if (!RuntimeEnabledFeatures::webAnimationsCSSEnabled()) | 1953 if (!RuntimeEnabledFeatures::webAnimationsCSSEnabled()) |
1924 frame->animation().serviceAnimations(); | 1954 frame->animation().serviceAnimations(); |
1925 | 1955 |
1926 DocumentAnimations::serviceOnAnimationFrame(*frame->document(), monotoni
cAnimationStartTime); | 1956 DocumentAnimations::serviceOnAnimationFrame(*frame->document(), monotoni
cAnimationStartTime); |
1927 } | 1957 } |
1928 | 1958 |
1929 Vector<RefPtr<Document> > documents; | 1959 Vector<RefPtr<Document> > documents; |
1930 for (Frame* frame = m_frame.get(); frame; frame = frame->tree().traverseNext
()) | 1960 for (Frame* frame = m_frame.get(); frame; frame = frame->tree().traverseNext
()) |
1931 documents.append(frame->document()); | 1961 documents.append(frame->document()); |
1932 | 1962 |
(...skipping 1210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3143 return false; | 3173 return false; |
3144 | 3174 |
3145 ScrollableAreaSet::iterator it = m_scrollableAreas->find(scrollableArea); | 3175 ScrollableAreaSet::iterator it = m_scrollableAreas->find(scrollableArea); |
3146 if (it == m_scrollableAreas->end()) | 3176 if (it == m_scrollableAreas->end()) |
3147 return false; | 3177 return false; |
3148 | 3178 |
3149 m_scrollableAreas->remove(it); | 3179 m_scrollableAreas->remove(it); |
3150 return true; | 3180 return true; |
3151 } | 3181 } |
3152 | 3182 |
| 3183 bool FrameView::addAnimatingScrollableArea(ScrollableArea* scrollableArea) |
| 3184 { |
| 3185 ASSERT(scrollableArea); |
| 3186 if (!m_animatingScrollableAreas) |
| 3187 m_animatingScrollableAreas = adoptPtr(new ScrollableAreaSet); |
| 3188 return m_animatingScrollableAreas->add(scrollableArea).isNewEntry; |
| 3189 } |
| 3190 |
| 3191 bool FrameView::removeAnimatingScrollableArea(ScrollableArea* scrollableArea) |
| 3192 { |
| 3193 if (!m_animatingScrollableAreas) |
| 3194 return false; |
| 3195 |
| 3196 ScrollableAreaSet::iterator it = m_animatingScrollableAreas->find(scrollable
Area); |
| 3197 if (it == m_animatingScrollableAreas->end()) |
| 3198 return false; |
| 3199 |
| 3200 m_animatingScrollableAreas->remove(it); |
| 3201 return true; |
| 3202 } |
| 3203 |
3153 bool FrameView::containsScrollableArea(const ScrollableArea* scrollableArea) con
st | 3204 bool FrameView::containsScrollableArea(const ScrollableArea* scrollableArea) con
st |
3154 { | 3205 { |
3155 ASSERT(scrollableArea); | 3206 ASSERT(scrollableArea); |
3156 if (!m_scrollableAreas || !scrollableArea) | 3207 if (!m_scrollableAreas || !scrollableArea) |
3157 return false; | 3208 return false; |
3158 return m_scrollableAreas->contains(const_cast<ScrollableArea*>(scrollableAre
a)); | 3209 return m_scrollableAreas->contains(const_cast<ScrollableArea*>(scrollableAre
a)); |
3159 } | 3210 } |
3160 | 3211 |
3161 void FrameView::removeChild(Widget* widget) | 3212 void FrameView::removeChild(Widget* widget) |
3162 { | 3213 { |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3247 void FrameView::willRemoveScrollbar(Scrollbar* scrollbar, ScrollbarOrientation o
rientation) | 3298 void FrameView::willRemoveScrollbar(Scrollbar* scrollbar, ScrollbarOrientation o
rientation) |
3248 { | 3299 { |
3249 ScrollableArea::willRemoveScrollbar(scrollbar, orientation); | 3300 ScrollableArea::willRemoveScrollbar(scrollbar, orientation); |
3250 if (AXObjectCache* cache = axObjectCache()) { | 3301 if (AXObjectCache* cache = axObjectCache()) { |
3251 cache->remove(scrollbar); | 3302 cache->remove(scrollbar); |
3252 cache->handleScrollbarUpdate(this); | 3303 cache->handleScrollbarUpdate(this); |
3253 } | 3304 } |
3254 } | 3305 } |
3255 | 3306 |
3256 } // namespace WebCore | 3307 } // namespace WebCore |
OLD | NEW |