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

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

Issue 681583002: Remove pinch viewports. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: upload synced patch 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/core/frame/FrameView.h ('k') | sky/engine/core/frame/PinchViewport.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 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 return; 200 return;
201 201
202 Widget::setFrameRect(newRect); 202 Widget::setFrameRect(newRect);
203 203
204 if (RenderView* renderView = this->renderView()) { 204 if (RenderView* renderView = this->renderView()) {
205 if (renderView->usesCompositing()) 205 if (renderView->usesCompositing())
206 renderView->compositor()->frameViewDidChangeSize(); 206 renderView->compositor()->frameViewDidChangeSize();
207 } 207 }
208 208
209 viewportConstrainedVisibleContentSizeChanged(newRect.width() != oldRect.widt h(), newRect.height() != oldRect.height()); 209 viewportConstrainedVisibleContentSizeChanged(newRect.width() != oldRect.widt h(), newRect.height() != oldRect.height());
210
211 if (oldRect.size() != newRect.size()
212 && m_frame->settings()->pinchVirtualViewportEnabled())
213 page()->frameHost().pinchViewport().mainFrameDidChangeSize();
214 } 210 }
215 211
216 Page* FrameView::page() const 212 Page* FrameView::page() const
217 { 213 {
218 return frame().page(); 214 return frame().page();
219 } 215 }
220 216
221 RenderView* FrameView::renderView() const 217 RenderView* FrameView::renderView() const
222 { 218 {
223 return frame().contentRenderer(); 219 return frame().contentRenderer();
(...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after
752 LayoutRect FrameView::viewportConstrainedVisibleContentRect() const 748 LayoutRect FrameView::viewportConstrainedVisibleContentRect() const
753 { 749 {
754 LayoutRect viewportRect = visibleContentRect(); 750 LayoutRect viewportRect = visibleContentRect();
755 // Ignore overhang. No-op when not using rubber banding. 751 // Ignore overhang. No-op when not using rubber banding.
756 viewportRect.setLocation(clampScrollPosition(scrollPosition())); 752 viewportRect.setLocation(clampScrollPosition(scrollPosition()));
757 return viewportRect; 753 return viewportRect;
758 } 754 }
759 755
760 void FrameView::viewportConstrainedVisibleContentSizeChanged(bool widthChanged, bool heightChanged) 756 void FrameView::viewportConstrainedVisibleContentSizeChanged(bool widthChanged, bool heightChanged)
761 { 757 {
762 if (!hasViewportConstrainedObjects()) 758 // FIXME(sky): Remove
esprehn 2014/10/25 07:33:27 This is okay to remove because we got rid of posit
ojan 2014/10/25 17:11:06 I wasn't explicitly trying to break position:fixed
763 return;
764
765 // If viewport is not enabled, frameRect change will cause layout size chang e and then layout.
766 // Otherwise, viewport constrained objects need their layout flags set separ ately to ensure
767 // they are positioned correctly. In the virtual-viewport pinch mode frame r ect changes wont
768 // necessarily cause a layout size change so only take this early-out if we' re in old-style
769 // pinch.
770 if (m_frame->settings()
771 && !m_frame->settings()->viewportEnabled()
772 && !m_frame->settings()->pinchVirtualViewportEnabled())
773 return;
774
775 ViewportConstrainedObjectSet::const_iterator end = m_viewportConstrainedObje cts->end();
776 for (ViewportConstrainedObjectSet::const_iterator it = m_viewportConstrained Objects->begin(); it != end; ++it) {
777 RenderObject* renderer = *it;
778 RenderStyle* style = renderer->style();
779 if (widthChanged) {
780 if (style->width().isFixed() && (style->left().isAuto() || style->ri ght().isAuto()))
781 renderer->setNeedsPositionedMovementLayout();
782 else
783 renderer->setNeedsLayoutAndFullPaintInvalidation();
784 }
785 if (heightChanged) {
786 if (style->height().isFixed() && (style->top().isAuto() || style->bo ttom().isAuto()))
787 renderer->setNeedsPositionedMovementLayout();
788 else
789 renderer->setNeedsLayoutAndFullPaintInvalidation();
790 }
791 }
792 } 759 }
793 760
794 IntSize FrameView::scrollOffsetForFixedPosition() const 761 IntSize FrameView::scrollOffsetForFixedPosition() const
795 { 762 {
796 return toIntSize(clampScrollPosition(scrollPosition())); 763 return toIntSize(clampScrollPosition(scrollPosition()));
797 } 764 }
798 765
799 IntPoint FrameView::lastKnownMousePosition() const 766 IntPoint FrameView::lastKnownMousePosition() const
800 { 767 {
801 return m_frame->eventHandler().lastKnownMousePosition(); 768 return m_frame->eventHandler().lastKnownMousePosition();
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
879 void FrameView::scrollContentsSlowPath(const IntRect& updateRect) 846 void FrameView::scrollContentsSlowPath(const IntRect& updateRect)
880 { 847 {
881 // FIXME(sky): Remove 848 // FIXME(sky): Remove
882 } 849 }
883 850
884 void FrameView::restoreScrollbar() 851 void FrameView::restoreScrollbar()
885 { 852 {
886 // FIXME(sky): Remove 853 // FIXME(sky): Remove
887 } 854 }
888 855
889 void FrameView::scrollElementToRect(Element* element, const IntRect& rect)
890 {
891 // FIXME(http://crbug.com/371896) - This method shouldn't be manually doing
892 // coordinate transformations to the PinchViewport.
893 IntRect targetRect(rect);
894
895 m_frame->document()->updateLayoutIgnorePendingStylesheets();
896
897 bool pinchVirtualViewportEnabled = m_frame->settings()->pinchVirtualViewport Enabled();
898
899 if (pinchVirtualViewportEnabled) {
900 PinchViewport& pinchViewport = m_frame->page()->frameHost().pinchViewpor t();
901
902 IntSize pinchViewportSize = expandedIntSize(pinchViewport.visibleRect(). size());
903 targetRect.moveBy(ceiledIntPoint(pinchViewport.visibleRect().location()) );
904 targetRect.setSize(pinchViewportSize.shrunkTo(targetRect.size()));
905 }
906
907 LayoutRect bounds = element->boundingBox();
908 int centeringOffsetX = (targetRect.width() - bounds.width()) / 2;
909 int centeringOffsetY = (targetRect.height() - bounds.height()) / 2;
910
911 IntPoint targetOffset(
912 bounds.x() - centeringOffsetX - targetRect.x(),
913 bounds.y() - centeringOffsetY - targetRect.y());
914
915 if (pinchVirtualViewportEnabled) {
916 IntPoint remainder = IntPoint(targetOffset - scrollPosition());
917 m_frame->page()->frameHost().pinchViewport().move(remainder);
918 }
919 }
920
921 // FIXME(sky): remove 856 // FIXME(sky): remove
922 IntSize FrameView::layoutSize(IncludeScrollbarsInRect) const 857 IntSize FrameView::layoutSize(IncludeScrollbarsInRect) const
923 { 858 {
924 return m_layoutSize; 859 return m_layoutSize;
925 } 860 }
926 861
927 void FrameView::setLayoutSize(const IntSize& size) 862 void FrameView::setLayoutSize(const IntSize& size)
928 { 863 {
929 ASSERT(!layoutSizeFixedToFrameSize()); 864 ASSERT(!layoutSizeFixedToFrameSize());
930 865
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after
1358 m_inputEventsScaleFactorForEmulation = contentScaleFactor; 1293 m_inputEventsScaleFactorForEmulation = contentScaleFactor;
1359 } 1294 }
1360 1295
1361 IntSize FrameView::inputEventsOffsetForEmulation() const 1296 IntSize FrameView::inputEventsOffsetForEmulation() const
1362 { 1297 {
1363 return m_inputEventsOffsetForEmulation; 1298 return m_inputEventsOffsetForEmulation;
1364 } 1299 }
1365 1300
1366 float FrameView::inputEventsScaleFactor() const 1301 float FrameView::inputEventsScaleFactor() const
1367 { 1302 {
1368 float pageScale = m_frame->settings()->pinchVirtualViewportEnabled() 1303 float pageScale = visibleContentScaleFactor();
1369 ? m_frame->page()->frameHost().pinchViewport().scale()
1370 : visibleContentScaleFactor();
1371 return pageScale * m_inputEventsScaleFactorForEmulation; 1304 return pageScale * m_inputEventsScaleFactorForEmulation;
1372 } 1305 }
1373 1306
1374 bool FrameView::scrollbarsCanBeActive() const 1307 bool FrameView::scrollbarsCanBeActive() const
1375 { 1308 {
1376 if (m_frame->view() != this) 1309 if (m_frame->view() != this)
1377 return false; 1310 return false;
1378 1311
1379 return !!m_frame->document(); 1312 return !!m_frame->document();
1380 } 1313 }
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after
1805 void FrameView::setLayoutSizeInternal(const IntSize& size) 1738 void FrameView::setLayoutSizeInternal(const IntSize& size)
1806 { 1739 {
1807 if (m_layoutSize == size) 1740 if (m_layoutSize == size)
1808 return; 1741 return;
1809 1742
1810 m_layoutSize = size; 1743 m_layoutSize = size;
1811 contentsResized(); 1744 contentsResized();
1812 } 1745 }
1813 1746
1814 } // namespace blink 1747 } // namespace blink
OLDNEW
« no previous file with comments | « sky/engine/core/frame/FrameView.h ('k') | sky/engine/core/frame/PinchViewport.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698