Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(541)

Side by Side Diff: Source/core/frame/FrameView.cpp

Issue 134443003: Implement CSSOM Smooth Scroll API (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/frame/FrameView.h ('k') | Source/core/frame/LocalDOMWindow.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 #include "core/rendering/svg/RenderSVGRoot.h" 71 #include "core/rendering/svg/RenderSVGRoot.h"
72 #include "core/svg/SVGDocumentExtensions.h" 72 #include "core/svg/SVGDocumentExtensions.h"
73 #include "core/svg/SVGSVGElement.h" 73 #include "core/svg/SVGSVGElement.h"
74 #include "platform/RuntimeEnabledFeatures.h" 74 #include "platform/RuntimeEnabledFeatures.h"
75 #include "platform/ScriptForbiddenScope.h" 75 #include "platform/ScriptForbiddenScope.h"
76 #include "platform/TraceEvent.h" 76 #include "platform/TraceEvent.h"
77 #include "platform/fonts/FontCache.h" 77 #include "platform/fonts/FontCache.h"
78 #include "platform/geometry/FloatRect.h" 78 #include "platform/geometry/FloatRect.h"
79 #include "platform/graphics/GraphicsContext.h" 79 #include "platform/graphics/GraphicsContext.h"
80 #include "platform/graphics/GraphicsLayerDebugInfo.h" 80 #include "platform/graphics/GraphicsLayerDebugInfo.h"
81 #include "platform/scroll/ProgrammaticScrollAnimator.h"
81 #include "platform/scroll/ScrollAnimator.h" 82 #include "platform/scroll/ScrollAnimator.h"
82 #include "platform/scroll/ScrollbarTheme.h" 83 #include "platform/scroll/ScrollbarTheme.h"
83 #include "platform/text/TextStream.h" 84 #include "platform/text/TextStream.h"
84 #include "wtf/CurrentTime.h" 85 #include "wtf/CurrentTime.h"
85 #include "wtf/TemporaryChange.h" 86 #include "wtf/TemporaryChange.h"
86 87
87 namespace WebCore { 88 namespace WebCore {
88 89
89 using namespace HTMLNames; 90 using namespace HTMLNames;
90 91
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 setCanHaveScrollbars(false); 257 setCanHaveScrollbars(false);
257 } 258 }
258 } 259 }
259 260
260 void FrameView::prepareForDetach() 261 void FrameView::prepareForDetach()
261 { 262 {
262 RELEASE_ASSERT(!isInPerformLayout()); 263 RELEASE_ASSERT(!isInPerformLayout());
263 264
264 if (ScrollAnimator* scrollAnimator = existingScrollAnimator()) 265 if (ScrollAnimator* scrollAnimator = existingScrollAnimator())
265 scrollAnimator->cancelAnimations(); 266 scrollAnimator->cancelAnimations();
267 cancelProgrammaticScrollAnimation();
266 268
267 detachCustomScrollbars(); 269 detachCustomScrollbars();
268 // When the view is no longer associated with a frame, it needs to be remove d from the ax object cache 270 // When the view is no longer associated with a frame, it needs to be remove d from the ax object cache
269 // right now, otherwise it won't be able to reach the topDocument()'s axObje ct cache later. 271 // right now, otherwise it won't be able to reach the topDocument()'s axObje ct cache later.
270 removeFromAXObjectCache(); 272 removeFromAXObjectCache();
271 273
272 if (m_frame->page()) { 274 if (m_frame->page()) {
273 if (ScrollingCoordinator* scrollingCoordinator = m_frame->page()->scroll ingCoordinator()) 275 if (ScrollingCoordinator* scrollingCoordinator = m_frame->page()->scroll ingCoordinator())
274 scrollingCoordinator->willDestroyScrollableArea(this); 276 scrollingCoordinator->willDestroyScrollableArea(this);
275 } 277 }
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 385
384 bool FrameView::scheduleAnimation() 386 bool FrameView::scheduleAnimation()
385 { 387 {
386 if (HostWindow* window = hostWindow()) { 388 if (HostWindow* window = hostWindow()) {
387 window->scheduleAnimation(); 389 window->scheduleAnimation();
388 return true; 390 return true;
389 } 391 }
390 return false; 392 return false;
391 } 393 }
392 394
395 void FrameView::serviceScrollAnimations(double monotonicTime)
396 {
397 ScrollableArea::serviceScrollAnimations(monotonicTime);
398
399 if (!m_animatingScrollableAreas || m_animatingScrollableAreas->isEmpty())
400 return;
401
402 // We need to iterate over a copy of m_animatingScrollableAreas, since Scrol lableAreas
403 // may deregister themselves during the iteration.
404 Vector<ScrollableArea*> animatingScrollableAreas;
405 copyToVector(*m_animatingScrollableAreas, animatingScrollableAreas);
406 for (size_t i = 0; i < animatingScrollableAreas.size(); ++i)
407 animatingScrollableAreas[i]->serviceScrollAnimations(monotonicTime);
408 }
409
393 Page* FrameView::page() const 410 Page* FrameView::page() const
394 { 411 {
395 return frame().page(); 412 return frame().page();
396 } 413 }
397 414
398 RenderView* FrameView::renderView() const 415 RenderView* FrameView::renderView() const
399 { 416 {
400 return frame().contentRenderer(); 417 return frame().contentRenderer();
401 } 418 }
402 419
(...skipping 1159 matching lines...) Expand 10 before | Expand all | Expand 10 after
1562 bounds.y() - centeringOffsetY - targetRect.y()); 1579 bounds.y() - centeringOffsetY - targetRect.y());
1563 1580
1564 setScrollPosition(targetOffset); 1581 setScrollPosition(targetOffset);
1565 1582
1566 if (pinchVirtualViewportEnabled) { 1583 if (pinchVirtualViewportEnabled) {
1567 IntPoint remainder = IntPoint(targetOffset - scrollPosition()); 1584 IntPoint remainder = IntPoint(targetOffset - scrollPosition());
1568 m_frame->page()->frameHost().pinchViewport().move(remainder); 1585 m_frame->page()->frameHost().pinchViewport().move(remainder);
1569 } 1586 }
1570 } 1587 }
1571 1588
1572 void FrameView::setScrollPosition(const IntPoint& scrollPoint) 1589 void FrameView::setScrollPosition(const IntPoint& scrollPoint, ScrollBehavior sc rollBehavior)
1573 { 1590 {
1591 cancelProgrammaticScrollAnimation();
1574 TemporaryChange<bool> changeInProgrammaticScroll(m_inProgrammaticScroll, tru e); 1592 TemporaryChange<bool> changeInProgrammaticScroll(m_inProgrammaticScroll, tru e);
1575 m_maintainScrollPositionAnchor = nullptr; 1593 m_maintainScrollPositionAnchor = nullptr;
1576 1594
1577 IntPoint newScrollPosition = adjustScrollPositionWithinRange(scrollPoint); 1595 IntPoint newScrollPosition = adjustScrollPositionWithinRange(scrollPoint);
1578 1596
1579 if (newScrollPosition == scrollPosition()) 1597 if (newScrollPosition == scrollPosition())
1580 return; 1598 return;
1581 1599
1582 ScrollView::setScrollPosition(newScrollPosition); 1600 if (scrollBehavior == ScrollBehaviorAuto)
1601 scrollBehavior = m_frame->document()->documentElement()->renderer()->sty le()->scrollBehavior();
1602 ScrollView::setScrollPosition(newScrollPosition, scrollBehavior);
1583 } 1603 }
1584 1604
1585 void FrameView::setScrollPositionNonProgrammatically(const IntPoint& scrollPoint ) 1605 void FrameView::setScrollPositionNonProgrammatically(const IntPoint& scrollPoint )
1586 { 1606 {
1587 IntPoint newScrollPosition = adjustScrollPositionWithinRange(scrollPoint); 1607 IntPoint newScrollPosition = adjustScrollPositionWithinRange(scrollPoint);
1588 1608
1589 if (newScrollPosition == scrollPosition()) 1609 if (newScrollPosition == scrollPosition())
1590 return; 1610 return;
1591 1611
1592 TemporaryChange<bool> changeInProgrammaticScroll(m_inProgrammaticScroll, fal se); 1612 TemporaryChange<bool> changeInProgrammaticScroll(m_inProgrammaticScroll, fal se);
(...skipping 1586 matching lines...) Expand 10 before | Expand all | Expand 10 after
3179 m_scrollableAreas->add(scrollableArea); 3199 m_scrollableAreas->add(scrollableArea);
3180 } 3200 }
3181 3201
3182 void FrameView::removeScrollableArea(ScrollableArea* scrollableArea) 3202 void FrameView::removeScrollableArea(ScrollableArea* scrollableArea)
3183 { 3203 {
3184 if (!m_scrollableAreas) 3204 if (!m_scrollableAreas)
3185 return; 3205 return;
3186 m_scrollableAreas->remove(scrollableArea); 3206 m_scrollableAreas->remove(scrollableArea);
3187 } 3207 }
3188 3208
3209 bool FrameView::addAnimatingScrollableArea(ScrollableArea* scrollableArea)
3210 {
3211 ASSERT(scrollableArea);
3212 if (!m_animatingScrollableAreas)
3213 m_animatingScrollableAreas = adoptPtr(new ScrollableAreaSet);
3214 return m_animatingScrollableAreas->add(scrollableArea).isNewEntry;
3215 }
3216
3217 bool FrameView::removeAnimatingScrollableArea(ScrollableArea* scrollableArea)
3218 {
3219 if (!m_animatingScrollableAreas)
3220 return false;
3221
3222 ScrollableAreaSet::iterator it = m_animatingScrollableAreas->find(scrollable Area);
3223 if (it == m_animatingScrollableAreas->end())
3224 return false;
3225
3226 m_animatingScrollableAreas->remove(it);
3227 return true;
3228 }
3229
3189 void FrameView::removeChild(Widget* widget) 3230 void FrameView::removeChild(Widget* widget)
3190 { 3231 {
3191 if (widget->isFrameView()) 3232 if (widget->isFrameView())
3192 removeScrollableArea(toFrameView(widget)); 3233 removeScrollableArea(toFrameView(widget));
3193 3234
3194 ScrollView::removeChild(widget); 3235 ScrollView::removeChild(widget);
3195 } 3236 }
3196 3237
3197 bool FrameView::wheelEvent(const PlatformWheelEvent& wheelEvent) 3238 bool FrameView::wheelEvent(const PlatformWheelEvent& wheelEvent)
3198 { 3239 {
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
3276 void FrameView::willRemoveScrollbar(Scrollbar* scrollbar, ScrollbarOrientation o rientation) 3317 void FrameView::willRemoveScrollbar(Scrollbar* scrollbar, ScrollbarOrientation o rientation)
3277 { 3318 {
3278 ScrollableArea::willRemoveScrollbar(scrollbar, orientation); 3319 ScrollableArea::willRemoveScrollbar(scrollbar, orientation);
3279 if (AXObjectCache* cache = axObjectCache()) { 3320 if (AXObjectCache* cache = axObjectCache()) {
3280 cache->remove(scrollbar); 3321 cache->remove(scrollbar);
3281 cache->handleScrollbarUpdate(this); 3322 cache->handleScrollbarUpdate(this);
3282 } 3323 }
3283 } 3324 }
3284 3325
3285 } // namespace WebCore 3326 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/frame/FrameView.h ('k') | Source/core/frame/LocalDOMWindow.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698