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

Side by Side Diff: sky/engine/core/frame/LocalDOMWindow.cpp

Issue 677223002: Remove some more frame-level scrolling machinery. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 2 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
« no previous file with comments | « sky/engine/core/frame/LocalDOMWindow.h ('k') | sky/engine/core/frame/Window.idl » ('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) 2006, 2007, 2008, 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008, 2010 Apple Inc. All rights reserved.
3 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) 3 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 #include "core/inspector/ConsoleMessage.h" 67 #include "core/inspector/ConsoleMessage.h"
68 #include "core/inspector/ConsoleMessageStorage.h" 68 #include "core/inspector/ConsoleMessageStorage.h"
69 #include "core/inspector/InspectorTraceEvents.h" 69 #include "core/inspector/InspectorTraceEvents.h"
70 #include "core/inspector/ScriptCallStack.h" 70 #include "core/inspector/ScriptCallStack.h"
71 #include "core/loader/FrameLoaderClient.h" 71 #include "core/loader/FrameLoaderClient.h"
72 #include "core/page/Chrome.h" 72 #include "core/page/Chrome.h"
73 #include "core/page/ChromeClient.h" 73 #include "core/page/ChromeClient.h"
74 #include "core/page/EventHandler.h" 74 #include "core/page/EventHandler.h"
75 #include "core/page/Page.h" 75 #include "core/page/Page.h"
76 #include "core/page/WindowFocusAllowedIndicator.h" 76 #include "core/page/WindowFocusAllowedIndicator.h"
77 #include "core/page/scrolling/ScrollingCoordinator.h" 77 #include "core/rendering/style/RenderStyle.h"
78 #include "platform/EventDispatchForbiddenScope.h" 78 #include "platform/EventDispatchForbiddenScope.h"
79 #include "platform/PlatformScreen.h" 79 #include "platform/PlatformScreen.h"
80 #include "platform/RuntimeEnabledFeatures.h" 80 #include "platform/RuntimeEnabledFeatures.h"
81 #include "platform/UserGestureIndicator.h" 81 #include "platform/UserGestureIndicator.h"
82 #include "platform/geometry/FloatRect.h" 82 #include "platform/geometry/FloatRect.h"
83 #include "platform/graphics/media/MediaPlayer.h" 83 #include "platform/graphics/media/MediaPlayer.h"
84 #include "platform/weborigin/KURL.h" 84 #include "platform/weborigin/KURL.h"
85 #include "platform/weborigin/SecurityPolicy.h" 85 #include "platform/weborigin/SecurityPolicy.h"
86 #include "public/platform/Platform.h" 86 #include "public/platform/Platform.h"
87 #include "wtf/MainThread.h" 87 #include "wtf/MainThread.h"
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after
566 if (!m_frame) 566 if (!m_frame)
567 return 0; 567 return 0;
568 568
569 FrameHost* host = m_frame->host(); 569 FrameHost* host = m_frame->host();
570 if (!host) 570 if (!host)
571 return 0; 571 return 0;
572 572
573 return static_cast<int>(host->chrome().windowRect().y()); 573 return static_cast<int>(host->chrome().windowRect().y());
574 } 574 }
575 575
576 int LocalDOMWindow::scrollX() const
577 {
578 if (!m_frame)
579 return 0;
580
581 FrameView* view = m_frame->view();
582 if (!view)
583 return 0;
584
585 m_frame->document()->updateLayoutIgnorePendingStylesheets();
586
587 return adjustForAbsoluteZoom(view->scrollX(), m_frame->pageZoomFactor());
588 }
589
590 int LocalDOMWindow::scrollY() const
591 {
592 if (!m_frame)
593 return 0;
594
595 FrameView* view = m_frame->view();
596 if (!view)
597 return 0;
598
599 m_frame->document()->updateLayoutIgnorePendingStylesheets();
600
601 return adjustForAbsoluteZoom(view->scrollY(), m_frame->pageZoomFactor());
602 }
603
604 LocalDOMWindow* LocalDOMWindow::window() const 576 LocalDOMWindow* LocalDOMWindow::window() const
605 { 577 {
606 if (!m_frame) 578 if (!m_frame)
607 return 0; 579 return 0;
608 580
609 return m_frame->domWindow(); 581 return m_frame->domWindow();
610 } 582 }
611 583
612 Document* LocalDOMWindow::document() const 584 Document* LocalDOMWindow::document() const
613 { 585 {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
645 } 617 }
646 618
647 double LocalDOMWindow::devicePixelRatio() const 619 double LocalDOMWindow::devicePixelRatio() const
648 { 620 {
649 if (!m_frame) 621 if (!m_frame)
650 return 0.0; 622 return 0.0;
651 623
652 return m_frame->devicePixelRatio(); 624 return m_frame->devicePixelRatio();
653 } 625 }
654 626
655 static bool scrollBehaviorFromScrollOptions(const Dictionary& scrollOptions, Scr ollBehavior& scrollBehavior, ExceptionState& exceptionState)
656 {
657 String scrollBehaviorString;
658 if (!DictionaryHelper::get(scrollOptions, "behavior", scrollBehaviorString)) {
659 scrollBehavior = ScrollBehaviorAuto;
660 return true;
661 }
662
663 if (ScrollableArea::scrollBehaviorFromString(scrollBehaviorString, scrollBeh avior))
664 return true;
665
666 exceptionState.throwTypeError("The ScrollBehavior provided is invalid.");
667 return false;
668 }
669
670 void LocalDOMWindow::scrollBy(int x, int y, ScrollBehavior scrollBehavior) const
671 {
672 // FIXME(sky): Remove
673 }
674
675 void LocalDOMWindow::scrollBy(int x, int y, const Dictionary& scrollOptions, Exc eptionState &exceptionState) const
676 {
677 ScrollBehavior scrollBehavior = ScrollBehaviorAuto;
678 if (!scrollBehaviorFromScrollOptions(scrollOptions, scrollBehavior, exceptio nState))
679 return;
680 scrollBy(x, y, scrollBehavior);
681 }
682
683 void LocalDOMWindow::scrollTo(int x, int y, ScrollBehavior scrollBehavior) const
684 {
685 document()->updateLayoutIgnorePendingStylesheets();
686
687 RefPtr<FrameView> view = m_frame->view();
688 if (!view)
689 return;
690
691 IntPoint layoutPos(x * m_frame->pageZoomFactor(), y * m_frame->pageZoomFacto r());
692 view->setScrollPosition(layoutPos, scrollBehavior);
693 }
694
695 void LocalDOMWindow::scrollTo(int x, int y, const Dictionary& scrollOptions, Exc eptionState& exceptionState) const
696 {
697 ScrollBehavior scrollBehavior = ScrollBehaviorAuto;
698 if (!scrollBehaviorFromScrollOptions(scrollOptions, scrollBehavior, exceptio nState))
699 return;
700 scrollTo(x, y, scrollBehavior);
701 }
702
703 void LocalDOMWindow::moveBy(float x, float y) const 627 void LocalDOMWindow::moveBy(float x, float y) const
704 { 628 {
705 if (!m_frame) 629 if (!m_frame)
706 return; 630 return;
707 631
708 FrameHost* host = m_frame->host(); 632 FrameHost* host = m_frame->host();
709 if (!host) 633 if (!host)
710 return; 634 return;
711 635
712 FloatRect windowRect = host->chrome().windowRect(); 636 FloatRect windowRect = host->chrome().windowRect();
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
902 visitor->trace(m_location); 826 visitor->trace(m_location);
903 visitor->trace(m_media); 827 visitor->trace(m_media);
904 visitor->trace(m_css); 828 visitor->trace(m_css);
905 visitor->trace(m_eventQueue); 829 visitor->trace(m_eventQueue);
906 WillBeHeapSupplementable<LocalDOMWindow>::trace(visitor); 830 WillBeHeapSupplementable<LocalDOMWindow>::trace(visitor);
907 EventTargetWithInlineData::trace(visitor); 831 EventTargetWithInlineData::trace(visitor);
908 LifecycleContext<LocalDOMWindow>::trace(visitor); 832 LifecycleContext<LocalDOMWindow>::trace(visitor);
909 } 833 }
910 834
911 } // namespace blink 835 } // namespace blink
OLDNEW
« no previous file with comments | « sky/engine/core/frame/LocalDOMWindow.h ('k') | sky/engine/core/frame/Window.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698