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

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

Issue 967213004: Removed FrameView's windowToContents and contentsToWindow methods. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 5 years, 9 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 | « Source/core/frame/PinchViewport.h ('k') | Source/core/frame/SmartClip.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) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 } 157 }
158 158
159 FloatRect PinchViewport::mainViewToViewportCSSPixels(const FloatRect& rect) cons t 159 FloatRect PinchViewport::mainViewToViewportCSSPixels(const FloatRect& rect) cons t
160 { 160 {
161 // Note, this is in CSS Pixels so we don't apply scale. 161 // Note, this is in CSS Pixels so we don't apply scale.
162 FloatRect rectInViewport = rect; 162 FloatRect rectInViewport = rect;
163 rectInViewport.moveBy(-location()); 163 rectInViewport.moveBy(-location());
164 return rectInViewport; 164 return rectInViewport;
165 } 165 }
166 166
167 FloatPoint PinchViewport::viewportCSSPixelsToRootFrame(const FloatPoint& point) const
168 {
169 // Note, this is in CSS Pixels so we don't apply scale.
170 FloatPoint pointInRootFrame = point;
171 pointInRootFrame.moveBy(location());
172 return pointInRootFrame;
173 }
174
167 void PinchViewport::scrollIntoView(const LayoutRect& rect) 175 void PinchViewport::scrollIntoView(const LayoutRect& rect)
168 { 176 {
169 if (!mainFrame() || !mainFrame()->view()) 177 if (!mainFrame() || !mainFrame()->view())
170 return; 178 return;
171 179
172 FrameView* view = mainFrame()->view(); 180 FrameView* view = mainFrame()->view();
173 181
174 // Snap the visible rect to layout units to match the input rect. 182 // Snap the visible rect to layout units to match the input rect.
175 FloatRect visible = LayoutRect(visibleRect()); 183 FloatRect visible = LayoutRect(visibleRect());
176 184
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after
609 clampedOffset = clampedOffset.shrunkTo(FloatPoint(maximumScrollPositionDoubl e())); 617 clampedOffset = clampedOffset.shrunkTo(FloatPoint(maximumScrollPositionDoubl e()));
610 clampedOffset = clampedOffset.expandedTo(FloatPoint(minimumScrollPositionDou ble())); 618 clampedOffset = clampedOffset.expandedTo(FloatPoint(minimumScrollPositionDou ble()));
611 return clampedOffset; 619 return clampedOffset;
612 } 620 }
613 621
614 void PinchViewport::clampToBoundaries() 622 void PinchViewport::clampToBoundaries()
615 { 623 {
616 setLocation(m_offset); 624 setLocation(m_offset);
617 } 625 }
618 626
627 FloatRect PinchViewport::viewportToRootFrame(const FloatRect& rectInViewport) co nst
628 {
629 FloatRect rectInRootFrame = rectInViewport;
630 rectInRootFrame.scale(1 / scale());
631 rectInRootFrame.moveBy(location());
632 return rectInRootFrame;
633 }
634
635 IntRect PinchViewport::viewportToRootFrame(const IntRect& rectInViewport) const
636 {
637 // FIXME: How to snap to pixels?
638 return enclosingIntRect(viewportToRootFrame(FloatRect(rectInViewport)));
639 }
640
641 FloatRect PinchViewport::rootFrameToViewport(const FloatRect& rectInRootFrame) c onst
642 {
643 FloatRect rectInViewport = rectInRootFrame;
644 rectInViewport.moveBy(-location());
645 rectInViewport.scale(scale());
646 return rectInViewport;
647 }
648
649 IntRect PinchViewport::rootFrameToViewport(const IntRect& rectInRootFrame) const
650 {
651 // FIXME: How to snap to pixels?
652 return enclosingIntRect(rootFrameToViewport(FloatRect(rectInRootFrame)));
653 }
654
655 FloatPoint PinchViewport::viewportToRootFrame(const FloatPoint& pointInViewport) const
656 {
657 FloatPoint pointInRootFrame = pointInViewport;
658 pointInRootFrame.scale(1 / scale(), 1 / scale());
659 pointInRootFrame.moveBy(location());
660 return pointInRootFrame;
661 }
662
663 FloatPoint PinchViewport::rootFrameToViewport(const FloatPoint& pointInRootFrame ) const
664 {
665 FloatPoint pointInViewport = pointInRootFrame;
666 pointInViewport.moveBy(-location());
667 pointInViewport.scale(scale(), scale());
668 return pointInViewport;
669 }
670
671 IntPoint PinchViewport::viewportToRootFrame(const IntPoint& pointInViewport) con st
672 {
673 // FIXME: How to snap to pixels?
674 return flooredIntPoint(FloatPoint(viewportToRootFrame(FloatPoint(pointInView port))));
675 }
676
677 IntPoint PinchViewport::rootFrameToViewport(const IntPoint& pointInRootFrame) co nst
678 {
679 // FIXME: How to snap to pixels?
680 return flooredIntPoint(FloatPoint(rootFrameToViewport(FloatPoint(pointInRoot Frame))));
681 }
682
619 String PinchViewport::debugName(const GraphicsLayer* graphicsLayer) 683 String PinchViewport::debugName(const GraphicsLayer* graphicsLayer)
620 { 684 {
621 String name; 685 String name;
622 if (graphicsLayer == m_innerViewportContainerLayer.get()) { 686 if (graphicsLayer == m_innerViewportContainerLayer.get()) {
623 name = "Inner Viewport Container Layer"; 687 name = "Inner Viewport Container Layer";
624 } else if (graphicsLayer == m_overscrollElasticityLayer.get()) { 688 } else if (graphicsLayer == m_overscrollElasticityLayer.get()) {
625 name = "Overscroll Elasticity Layer"; 689 name = "Overscroll Elasticity Layer";
626 } else if (graphicsLayer == m_pageScaleLayer.get()) { 690 } else if (graphicsLayer == m_pageScaleLayer.get()) {
627 name = "Page Scale Layer"; 691 name = "Page Scale Layer";
628 } else if (graphicsLayer == m_innerViewportScrollLayer.get()) { 692 } else if (graphicsLayer == m_innerViewportScrollLayer.get()) {
629 name = "Inner Viewport Scroll Layer"; 693 name = "Inner Viewport Scroll Layer";
630 } else if (graphicsLayer == m_overlayScrollbarHorizontal.get()) { 694 } else if (graphicsLayer == m_overlayScrollbarHorizontal.get()) {
631 name = "Overlay Scrollbar Horizontal Layer"; 695 name = "Overlay Scrollbar Horizontal Layer";
632 } else if (graphicsLayer == m_overlayScrollbarVertical.get()) { 696 } else if (graphicsLayer == m_overlayScrollbarVertical.get()) {
633 name = "Overlay Scrollbar Vertical Layer"; 697 name = "Overlay Scrollbar Vertical Layer";
634 } else if (graphicsLayer == m_rootTransformLayer) { 698 } else if (graphicsLayer == m_rootTransformLayer) {
635 name = "Root Transform Layer"; 699 name = "Root Transform Layer";
636 } else { 700 } else {
637 ASSERT_NOT_REACHED(); 701 ASSERT_NOT_REACHED();
638 } 702 }
639 703
640 return name; 704 return name;
641 } 705 }
642 706
643 } // namespace blink 707 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/frame/PinchViewport.h ('k') | Source/core/frame/SmartClip.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698