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

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

Issue 2096633002: Adds scroll position/scale emulation to DevTools. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add missing file, fix forbidden include. Created 4 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
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 25 matching lines...) Expand all
36 #include "core/editing/EditingUtilities.h" 36 #include "core/editing/EditingUtilities.h"
37 #include "core/editing/FrameSelection.h" 37 #include "core/editing/FrameSelection.h"
38 #include "core/editing/RenderedPosition.h" 38 #include "core/editing/RenderedPosition.h"
39 #include "core/editing/markers/DocumentMarkerController.h" 39 #include "core/editing/markers/DocumentMarkerController.h"
40 #include "core/fetch/ResourceFetcher.h" 40 #include "core/fetch/ResourceFetcher.h"
41 #include "core/frame/EventHandlerRegistry.h" 41 #include "core/frame/EventHandlerRegistry.h"
42 #include "core/frame/FrameHost.h" 42 #include "core/frame/FrameHost.h"
43 #include "core/frame/LocalFrame.h" 43 #include "core/frame/LocalFrame.h"
44 #include "core/frame/Location.h" 44 #include "core/frame/Location.h"
45 #include "core/frame/PageScaleConstraintsSet.h" 45 #include "core/frame/PageScaleConstraintsSet.h"
46 #include "core/frame/ScrollAndScaleEmulator.h"
46 #include "core/frame/Settings.h" 47 #include "core/frame/Settings.h"
47 #include "core/frame/TopControls.h" 48 #include "core/frame/TopControls.h"
48 #include "core/frame/VisualViewport.h" 49 #include "core/frame/VisualViewport.h"
49 #include "core/html/HTMLFrameElement.h" 50 #include "core/html/HTMLFrameElement.h"
50 #include "core/html/HTMLPlugInElement.h" 51 #include "core/html/HTMLPlugInElement.h"
51 #include "core/html/HTMLTextFormControlElement.h" 52 #include "core/html/HTMLTextFormControlElement.h"
52 #include "core/html/parser/TextResourceDecoder.h" 53 #include "core/html/parser/TextResourceDecoder.h"
53 #include "core/input/EventHandler.h" 54 #include "core/input/EventHandler.h"
54 #include "core/inspector/InspectorInstrumentation.h" 55 #include "core/inspector/InspectorInstrumentation.h"
55 #include "core/inspector/InspectorTraceEvents.h" 56 #include "core/inspector/InspectorTraceEvents.h"
(...skipping 1523 matching lines...) Expand 10 before | Expand all | Expand 10 after
1579 DoublePoint newScrollPosition = clampScrollPosition(scrollPoint); 1580 DoublePoint newScrollPosition = clampScrollPosition(scrollPoint);
1580 if (newScrollPosition == scrollPositionDouble()) 1581 if (newScrollPosition == scrollPositionDouble())
1581 return; 1582 return;
1582 1583
1583 if (scrollBehavior == ScrollBehaviorAuto) 1584 if (scrollBehavior == ScrollBehaviorAuto)
1584 scrollBehavior = scrollBehaviorStyle(); 1585 scrollBehavior = scrollBehaviorStyle();
1585 1586
1586 ScrollableArea::setScrollPosition(newScrollPosition, scrollType, scrollBehav ior); 1587 ScrollableArea::setScrollPosition(newScrollPosition, scrollType, scrollBehav ior);
1587 } 1588 }
1588 1589
1590 void FrameView::setScrollAndScaleEmulator(const RefPtr<ScrollAndScaleEmulator>& emulator)
1591 {
1592 m_scrollAndScaleEmulator = emulator;
1593 setScrollPosition(scrollPosition(), ProgrammaticScroll, ScrollBehaviorInstan t);
1594 }
1595
1589 void FrameView::didUpdateElasticOverscroll() 1596 void FrameView::didUpdateElasticOverscroll()
1590 { 1597 {
1591 Page* page = frame().page(); 1598 Page* page = frame().page();
1592 if (!page) 1599 if (!page)
1593 return; 1600 return;
1594 FloatSize elasticOverscroll = page->chromeClient().elasticOverscroll(); 1601 FloatSize elasticOverscroll = page->chromeClient().elasticOverscroll();
1595 if (m_horizontalScrollbar) { 1602 if (m_horizontalScrollbar) {
1596 float delta = elasticOverscroll.width() - m_horizontalScrollbar->elastic Overscroll(); 1603 float delta = elasticOverscroll.width() - m_horizontalScrollbar->elastic Overscroll();
1597 if (delta != 0) { 1604 if (delta != 0) {
1598 m_horizontalScrollbar->setElasticOverscroll(elasticOverscroll.width( )); 1605 m_horizontalScrollbar->setElasticOverscroll(elasticOverscroll.width( ));
(...skipping 1562 matching lines...) Expand 10 before | Expand all | Expand 10 after
3161 m_topControlsViewportAdjustment = adjustment; 3168 m_topControlsViewportAdjustment = adjustment;
3162 } 3169 }
3163 3170
3164 IntPoint FrameView::maximumScrollPosition() const 3171 IntPoint FrameView::maximumScrollPosition() const
3165 { 3172 {
3166 // Make the same calculation as in CC's LayerImpl::MaxScrollOffset() 3173 // Make the same calculation as in CC's LayerImpl::MaxScrollOffset()
3167 // FIXME: We probably shouldn't be storing the bounds in a float. crbug.com/ 422331. 3174 // FIXME: We probably shouldn't be storing the bounds in a float. crbug.com/ 422331.
3168 IntSize visibleSize = visibleContentSize(ExcludeScrollbars) + topControlsSiz e(); 3175 IntSize visibleSize = visibleContentSize(ExcludeScrollbars) + topControlsSiz e();
3169 IntSize contentBounds = contentsSize(); 3176 IntSize contentBounds = contentsSize();
3170 IntPoint maximumPosition = -scrollOrigin() + (contentBounds - visibleSize); 3177 IntPoint maximumPosition = -scrollOrigin() + (contentBounds - visibleSize);
3178
3179 if (m_scrollAndScaleEmulator)
3180 maximumPosition = m_scrollAndScaleEmulator->applyFramePositionOverride(m aximumPosition);
3181
3171 return maximumPosition.expandedTo(minimumScrollPosition()); 3182 return maximumPosition.expandedTo(minimumScrollPosition());
3172 } 3183 }
3173 3184
3174 void FrameView::addChild(Widget* child) 3185 void FrameView::addChild(Widget* child)
3175 { 3186 {
3176 ASSERT(child != this && !child->parent()); 3187 ASSERT(child != this && !child->parent());
3177 child->setParent(this); 3188 child->setParent(this);
3178 m_children.add(child); 3189 m_children.add(child);
3179 } 3190 }
3180 3191
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
3280 return IntRect(flooredIntPoint(m_scrollPosition), visibleContentSize(scrollb arInclusion)); 3291 return IntRect(flooredIntPoint(m_scrollPosition), visibleContentSize(scrollb arInclusion));
3281 } 3292 }
3282 3293
3283 IntSize FrameView::contentsSize() const 3294 IntSize FrameView::contentsSize() const
3284 { 3295 {
3285 return m_contentsSize; 3296 return m_contentsSize;
3286 } 3297 }
3287 3298
3288 IntPoint FrameView::minimumScrollPosition() const 3299 IntPoint FrameView::minimumScrollPosition() const
3289 { 3300 {
3290 return IntPoint(-scrollOrigin().x(), -scrollOrigin().y()); 3301 IntPoint minimumPosition(-scrollOrigin().x(), -scrollOrigin().y());
3302
3303 if (m_scrollAndScaleEmulator)
3304 minimumPosition = m_scrollAndScaleEmulator->applyFramePositionOverride(m inimumPosition);
3305
3306 return minimumPosition;
3291 } 3307 }
3292 3308
3293 void FrameView::adjustScrollbarOpacity() 3309 void FrameView::adjustScrollbarOpacity()
3294 { 3310 {
3295 if (m_horizontalScrollbar && layerForHorizontalScrollbar()) { 3311 if (m_horizontalScrollbar && layerForHorizontalScrollbar()) {
3296 bool isOpaqueScrollbar = !m_horizontalScrollbar->isOverlayScrollbar(); 3312 bool isOpaqueScrollbar = !m_horizontalScrollbar->isOverlayScrollbar();
3297 layerForHorizontalScrollbar()->setContentsOpaque(isOpaqueScrollbar); 3313 layerForHorizontalScrollbar()->setContentsOpaque(isOpaqueScrollbar);
3298 } 3314 }
3299 if (m_verticalScrollbar && layerForVerticalScrollbar()) { 3315 if (m_verticalScrollbar && layerForVerticalScrollbar()) {
3300 bool isOpaqueScrollbar = !m_verticalScrollbar->isOverlayScrollbar(); 3316 bool isOpaqueScrollbar = !m_verticalScrollbar->isOverlayScrollbar();
(...skipping 929 matching lines...) Expand 10 before | Expand all | Expand 10 after
4230 return m_subtreeThrottled || (m_hiddenForThrottling && m_crossOriginForThrot tling); 4246 return m_subtreeThrottled || (m_hiddenForThrottling && m_crossOriginForThrot tling);
4231 } 4247 }
4232 4248
4233 LayoutBox& FrameView::boxForScrollControlPaintInvalidation() const 4249 LayoutBox& FrameView::boxForScrollControlPaintInvalidation() const
4234 { 4250 {
4235 ASSERT(!layoutViewItem().isNull()); 4251 ASSERT(!layoutViewItem().isNull());
4236 return *layoutView(); 4252 return *layoutView();
4237 } 4253 }
4238 4254
4239 } // namespace blink 4255 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698