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

Side by Side Diff: sky/engine/web/WebViewImpl.cpp

Issue 678193005: Remove more frame-level scrolling machinery. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month 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/web/WebViewImpl.h ('k') | no next file » | 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) 2011, 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * 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 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after
612 return frame->view()->contentsToWindow(rect); 612 return frame->view()->contentsToWindow(rect);
613 } 613 }
614 return WebRect(); 614 return WebRect();
615 } 615 }
616 616
617 WebRect WebViewImpl::widenRectWithinPageBounds(const WebRect& source, int target Margin, int minimumMargin) 617 WebRect WebViewImpl::widenRectWithinPageBounds(const WebRect& source, int target Margin, int minimumMargin)
618 { 618 {
619 WebSize maxSize; 619 WebSize maxSize;
620 if (mainFrame()) 620 if (mainFrame())
621 maxSize = mainFrame()->contentsSize(); 621 maxSize = mainFrame()->contentsSize();
622 IntSize scrollOffset;
623 if (mainFrame())
624 scrollOffset = mainFrame()->scrollOffset();
625 int leftMargin = targetMargin; 622 int leftMargin = targetMargin;
626 int rightMargin = targetMargin; 623 int rightMargin = targetMargin;
627 624
628 const int absoluteSourceX = source.x + scrollOffset.width(); 625 const int absoluteSourceX = source.x;
629 if (leftMargin > absoluteSourceX) { 626 if (leftMargin > absoluteSourceX) {
630 leftMargin = absoluteSourceX; 627 leftMargin = absoluteSourceX;
631 rightMargin = std::max(leftMargin, minimumMargin); 628 rightMargin = std::max(leftMargin, minimumMargin);
632 } 629 }
633 630
634 const int maximumRightMargin = maxSize.width - (source.width + absoluteSourc eX); 631 const int maximumRightMargin = maxSize.width - (source.width + absoluteSourc eX);
635 if (rightMargin > maximumRightMargin) { 632 if (rightMargin > maximumRightMargin) {
636 rightMargin = maximumRightMargin; 633 rightMargin = maximumRightMargin;
637 leftMargin = std::min(leftMargin, std::max(rightMargin, minimumMargin)); 634 leftMargin = std::min(leftMargin, std::max(rightMargin, minimumMargin));
638 } 635 }
639 636
640 const int newWidth = source.width + leftMargin + rightMargin; 637 const int newWidth = source.width + leftMargin + rightMargin;
641 const int newX = source.x - leftMargin; 638 const int newX = source.x - leftMargin;
642 639
643 ASSERT(newWidth >= 0); 640 ASSERT(newWidth >= 0);
644 ASSERT(scrollOffset.width() + newX + newWidth <= maxSize.width); 641 ASSERT(newX + newWidth <= maxSize.width);
645 642
646 return WebRect(newX, source.y, newWidth, source.height); 643 return WebRect(newX, source.y, newWidth, source.height);
647 } 644 }
648 645
649 void WebViewImpl::computeScaleAndScrollForBlockRect(const WebPoint& hitPoint, co nst WebRect& blockRect, float padding, float defaultScaleWhenAlreadyLegible, flo at& scale, WebPoint& scroll) 646 void WebViewImpl::computeScaleAndScrollForBlockRect(const WebPoint& hitPoint, co nst WebRect& blockRect, float padding, float defaultScaleWhenAlreadyLegible, flo at& scale, WebPoint& scroll)
650 { 647 {
651 //FIXME(sky) 648 //FIXME(sky)
652 } 649 }
653 650
654 static Node* findCursorDefiningAncestor(Node* node, LocalFrame* frame) 651 static Node* findCursorDefiningAncestor(Node* node, LocalFrame* frame)
(...skipping 1671 matching lines...) Expand 10 before | Expand all | Expand 10 after
2326 m_layerTreeView->setShowScrollBottleneckRects(m_showScrollBottleneckRect s); 2323 m_layerTreeView->setShowScrollBottleneckRects(m_showScrollBottleneckRect s);
2327 m_layerTreeView->heuristicsForGpuRasterizationUpdated(m_matchesHeuristic sForGpuRasterization); 2324 m_layerTreeView->heuristicsForGpuRasterizationUpdated(m_matchesHeuristic sForGpuRasterization);
2328 } 2325 }
2329 } 2326 }
2330 2327
2331 void WebViewImpl::updateMainFrameScrollPosition(const IntPoint& scrollPosition, bool programmaticScroll) 2328 void WebViewImpl::updateMainFrameScrollPosition(const IntPoint& scrollPosition, bool programmaticScroll)
2332 { 2329 {
2333 // FIXME(sky): Remove 2330 // FIXME(sky): Remove
2334 } 2331 }
2335 2332
2336 void WebViewImpl::applyScrollAndScale(const WebSize& scrollDelta, float pageScal eDelta)
2337 {
2338 if (!mainFrameImpl() || !mainFrameImpl()->frameView())
2339 return;
2340
2341 // TODO(bokan): Old pinch path only - virtual viewport pinch scrolls are aut omatically updated via GraphicsLayer::DidScroll.
2342 // this should be removed once old pinch is removed.
2343 TRACE_EVENT_INSTANT2("blink", "WebViewImpl::applyScrollAndScale::scrollB y", "x", scrollDelta.width, "y", scrollDelta.height);
2344 WebSize webScrollOffset = mainFrame()->scrollOffset();
2345 IntPoint scrollOffset(webScrollOffset.width + scrollDelta.width, webScro llOffset.height + scrollDelta.height);
2346 updateMainFrameScrollPosition(scrollOffset, false);
2347 }
2348
2349 void WebViewImpl::updateLayerTreeBackgroundColor() 2333 void WebViewImpl::updateLayerTreeBackgroundColor()
2350 { 2334 {
2351 if (!m_layerTreeView) 2335 if (!m_layerTreeView)
2352 return; 2336 return;
2353 2337
2354 m_layerTreeView->setBackgroundColor(alphaChannel(m_backgroundColorOverride) ? m_backgroundColorOverride : backgroundColor()); 2338 m_layerTreeView->setBackgroundColor(alphaChannel(m_backgroundColorOverride) ? m_backgroundColorOverride : backgroundColor());
2355 } 2339 }
2356 2340
2357 void WebViewImpl::updateLayerTreeDeviceScaleFactor() 2341 void WebViewImpl::updateLayerTreeDeviceScaleFactor()
2358 { 2342 {
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
2421 m_layerTreeView->setVisible(visible); 2405 m_layerTreeView->setVisible(visible);
2422 } 2406 }
2423 } 2407 }
2424 2408
2425 bool WebViewImpl::shouldDisableDesktopWorkarounds() 2409 bool WebViewImpl::shouldDisableDesktopWorkarounds()
2426 { 2410 {
2427 return true; 2411 return true;
2428 } 2412 }
2429 2413
2430 } // namespace blink 2414 } // namespace blink
OLDNEW
« no previous file with comments | « sky/engine/web/WebViewImpl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698