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

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

Issue 680703002: 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/core/frame/FrameView.h ('k') | sky/engine/core/frame/LocalFrame.cpp » ('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 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 Page* FrameView::page() const 216 Page* FrameView::page() const
217 { 217 {
218 return frame().page(); 218 return frame().page();
219 } 219 }
220 220
221 RenderView* FrameView::renderView() const 221 RenderView* FrameView::renderView() const
222 { 222 {
223 return frame().contentRenderer(); 223 return frame().contentRenderer();
224 } 224 }
225 225
226 void FrameView::setCanHaveScrollbars(bool canHaveScrollbars)
227 {
228 // FIXME(sky): Remove
229 }
230
231 void FrameView::setContentsSize(const IntSize&)
232 {
233 // FIXME(sky): Remove
234 }
235
236 IntPoint FrameView::clampOffsetAtScale(const IntPoint& offset, float scale) cons t 226 IntPoint FrameView::clampOffsetAtScale(const IntPoint& offset, float scale) cons t
237 { 227 {
238 FloatSize scaledSize = unscaledVisibleContentSize(); 228 FloatSize scaledSize = unscaledVisibleContentSize();
239 if (scale) 229 if (scale)
240 scaledSize.scale(1 / scale); 230 scaledSize.scale(1 / scale);
241 231
242 IntPoint clampedOffset = offset; 232 IntPoint clampedOffset = offset;
243 clampedOffset = clampedOffset.shrunkTo( 233 clampedOffset = clampedOffset.shrunkTo(
244 IntPoint(size()) - expandedIntSize(scaledSize)); 234 IntPoint(size()) - expandedIntSize(scaledSize));
245 clampedOffset = clampedOffset.expandedTo(-scrollOrigin()); 235 clampedOffset = clampedOffset.expandedTo(-scrollOrigin());
246 236
247 return clampedOffset; 237 return clampedOffset;
248 } 238 }
249 239
250 void FrameView::adjustViewSize()
251 {
252 RenderView* renderView = this->renderView();
253 if (!renderView)
254 return;
255
256 ASSERT(m_frame->view() == this);
257
258 const IntRect rect = renderView->documentRect();
259 const IntSize& size = rect.size();
260 setContentsSize(size);
261 }
262
263 void FrameView::applyOverflowToViewportAndSetRenderer(RenderObject* o, Scrollbar Mode& hMode, ScrollbarMode& vMode) 240 void FrameView::applyOverflowToViewportAndSetRenderer(RenderObject* o, Scrollbar Mode& hMode, ScrollbarMode& vMode)
264 { 241 {
265 // Handle the overflow:hidden/scroll case for the body/html elements. WinIE treats 242 // Handle the overflow:hidden/scroll case for the body/html elements. WinIE treats
266 // overflow:hidden and overflow:scroll on <body> as applying to the document 's 243 // overflow:hidden and overflow:scroll on <body> as applying to the document 's
267 // scrollbars. The CSS2.1 draft states that HTML UAs should use the <html> or <body> element and XML/XHTML UAs should 244 // scrollbars. The CSS2.1 draft states that HTML UAs should use the <html> or <body> element and XML/XHTML UAs should
268 // use the root element. 245 // use the root element.
269 246
270 EOverflow overflowX = o->style()->overflowX(); 247 EOverflow overflowX = o->style()->overflowX();
271 EOverflow overflowY = o->style()->overflowY(); 248 EOverflow overflowY = o->style()->overflowY();
272 249
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 } 310 }
334 311
335 void FrameView::recalcOverflowAfterStyleChange() 312 void FrameView::recalcOverflowAfterStyleChange()
336 { 313 {
337 RenderView* renderView = this->renderView(); 314 RenderView* renderView = this->renderView();
338 RELEASE_ASSERT(renderView); 315 RELEASE_ASSERT(renderView);
339 if (!renderView->needsOverflowRecalcAfterStyleChange()) 316 if (!renderView->needsOverflowRecalcAfterStyleChange())
340 return; 317 return;
341 318
342 renderView->recalcOverflowAfterStyleChange(); 319 renderView->recalcOverflowAfterStyleChange();
343
344 IntRect documentRect = renderView->documentRect();
345 if (size() == documentRect.size())
346 return;
347
348 if (needsLayout())
349 return;
350
351 adjustViewSize();
352 } 320 }
353 321
354 bool FrameView::usesCompositedScrolling() const 322 bool FrameView::usesCompositedScrolling() const
355 { 323 {
356 RenderView* renderView = this->renderView(); 324 RenderView* renderView = this->renderView();
357 if (!renderView) 325 if (!renderView)
358 return false; 326 return false;
359 if (m_frame->settings() && m_frame->settings()->preferCompositingToLCDTextEn abled()) 327 if (m_frame->settings() && m_frame->settings()->preferCompositingToLCDTextEn abled())
360 return renderView->compositor()->inCompositingMode(); 328 return renderView->compositor()->inCompositingMode();
361 return false; 329 return false;
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
578 performLayout(rootForThisLayout, inSubtreeLayout); 546 performLayout(rootForThisLayout, inSubtreeLayout);
579 547
580 m_layoutSubtreeRoot = 0; 548 m_layoutSubtreeRoot = 0;
581 // We need to ensure that we mark up all renderers up to the RenderView 549 // We need to ensure that we mark up all renderers up to the RenderView
582 // for paint invalidation. This simplifies our code as we just always 550 // for paint invalidation. This simplifies our code as we just always
583 // do a full tree walk. 551 // do a full tree walk.
584 if (RenderObject* container = rootForThisLayout->container()) 552 if (RenderObject* container = rootForThisLayout->container())
585 container->setMayNeedPaintInvalidation(true); 553 container->setMayNeedPaintInvalidation(true);
586 } // Reset m_layoutSchedulingEnabled to its previous value. 554 } // Reset m_layoutSchedulingEnabled to its previous value.
587 555
588 if (!inSubtreeLayout)
589 adjustViewSize();
590
591 layer->updateLayerPositionsAfterLayout(); 556 layer->updateLayerPositionsAfterLayout();
592 557
593 if (m_doFullPaintInvalidation) 558 if (m_doFullPaintInvalidation)
594 renderView()->compositor()->fullyInvalidatePaint(); 559 renderView()->compositor()->fullyInvalidatePaint();
595 renderView()->compositor()->didLayout(); 560 renderView()->compositor()->didLayout();
596 561
597 m_layoutCount++; 562 m_layoutCount++;
598 563
599 ASSERT(!rootForThisLayout->needsLayout()); 564 ASSERT(!rootForThisLayout->needsLayout());
600 565
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
940 } 905 }
941 906
942 LayoutRect bounds = element->boundingBox(); 907 LayoutRect bounds = element->boundingBox();
943 int centeringOffsetX = (targetRect.width() - bounds.width()) / 2; 908 int centeringOffsetX = (targetRect.width() - bounds.width()) / 2;
944 int centeringOffsetY = (targetRect.height() - bounds.height()) / 2; 909 int centeringOffsetY = (targetRect.height() - bounds.height()) / 2;
945 910
946 IntPoint targetOffset( 911 IntPoint targetOffset(
947 bounds.x() - centeringOffsetX - targetRect.x(), 912 bounds.x() - centeringOffsetX - targetRect.x(),
948 bounds.y() - centeringOffsetY - targetRect.y()); 913 bounds.y() - centeringOffsetY - targetRect.y());
949 914
950 setScrollPosition(targetOffset);
951
952 if (pinchVirtualViewportEnabled) { 915 if (pinchVirtualViewportEnabled) {
953 IntPoint remainder = IntPoint(targetOffset - scrollPosition()); 916 IntPoint remainder = IntPoint(targetOffset - scrollPosition());
954 m_frame->page()->frameHost().pinchViewport().move(remainder); 917 m_frame->page()->frameHost().pinchViewport().move(remainder);
955 } 918 }
956 } 919 }
957 920
958 void FrameView::setScrollPosition(const IntPoint& scrollPoint, ScrollBehavior sc rollBehavior)
959 {
960 // FIXME(sky): Remove
961 }
962
963 void FrameView::setScrollPositionNonProgrammatically(const IntPoint&)
964 {
965 // FIXME(sky): Remove
966 }
967
968 // FIXME(sky): remove 921 // FIXME(sky): remove
969 IntSize FrameView::layoutSize(IncludeScrollbarsInRect) const 922 IntSize FrameView::layoutSize(IncludeScrollbarsInRect) const
970 { 923 {
971 return m_layoutSize; 924 return m_layoutSize;
972 } 925 }
973 926
974 void FrameView::setLayoutSize(const IntSize& size) 927 void FrameView::setLayoutSize(const IntSize& size)
975 { 928 {
976 ASSERT(!layoutSizeFixedToFrameSize()); 929 ASSERT(!layoutSizeFixedToFrameSize());
977 930
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
1058 1011
1059 LocalFrame* frame = page->focusController().focusedOrMainFrame(); 1012 LocalFrame* frame = page->focusController().focusedOrMainFrame();
1060 if (!frame || !frame->selection().isCaretOrRange()) { 1013 if (!frame || !frame->selection().isCaretOrRange()) {
1061 page->chrome().client().clearCompositedSelectionBounds(); 1014 page->chrome().client().clearCompositedSelectionBounds();
1062 return; 1015 return;
1063 } 1016 }
1064 1017
1065 // TODO(jdduke): Compute and route selection bounds through ChromeClient. 1018 // TODO(jdduke): Compute and route selection bounds through ChromeClient.
1066 } 1019 }
1067 1020
1068 bool FrameView::isRubberBandInProgress() const
1069 {
1070 // FIXME(sky): Remove
1071 return false;
1072 }
1073
1074 HostWindow* FrameView::hostWindow() const 1021 HostWindow* FrameView::hostWindow() const
1075 { 1022 {
1076 Page* page = frame().page(); 1023 Page* page = frame().page();
1077 if (!page) 1024 if (!page)
1078 return 0; 1025 return 0;
1079 return &page->chrome(); 1026 return &page->chrome();
1080 } 1027 }
1081 1028
1082 void FrameView::contentRectangleForPaintInvalidation(const IntRect& r) 1029 void FrameView::contentRectangleForPaintInvalidation(const IntRect& r)
1083 { 1030 {
(...skipping 774 matching lines...) Expand 10 before | Expand all | Expand 10 after
1858 void FrameView::setLayoutSizeInternal(const IntSize& size) 1805 void FrameView::setLayoutSizeInternal(const IntSize& size)
1859 { 1806 {
1860 if (m_layoutSize == size) 1807 if (m_layoutSize == size)
1861 return; 1808 return;
1862 1809
1863 m_layoutSize = size; 1810 m_layoutSize = size;
1864 contentsResized(); 1811 contentsResized();
1865 } 1812 }
1866 1813
1867 } // namespace blink 1814 } // namespace blink
OLDNEW
« no previous file with comments | « sky/engine/core/frame/FrameView.h ('k') | sky/engine/core/frame/LocalFrame.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698