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

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

Issue 1300393003: Attempt scroll restoration anytime viewport size changes (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix minor bug Created 5 years, 4 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 388 matching lines...) Expand 10 before | Expand all | Expand 10 after
399 399
400 updateScrollableAreaSet(); 400 updateScrollableAreaSet();
401 401
402 if (LayoutView* layoutView = this->layoutView()) { 402 if (LayoutView* layoutView = this->layoutView()) {
403 if (layoutView->usesCompositing()) 403 if (layoutView->usesCompositing())
404 layoutView->compositor()->frameViewDidChangeSize(); 404 layoutView->compositor()->frameViewDidChangeSize();
405 } 405 }
406 406
407 viewportSizeChanged(newRect.width() != oldRect.width(), newRect.height() != oldRect.height()); 407 viewportSizeChanged(newRect.width() != oldRect.width(), newRect.height() != oldRect.height());
408 408
409 if (oldRect.size() != newRect.size() && m_frame->isMainFrame()) 409 if (oldRect.size() != newRect.size()) {
410 page()->frameHost().visualViewport().mainFrameDidChangeSize(); 410 if (m_frame->isMainFrame())
411 page()->frameHost().visualViewport().mainFrameDidChangeSize();
Nate Chapin 2015/08/24 17:18:18 Nit: this line should be m_frame->host() instead o
majidvp 2015/08/25 19:12:42 Done.
412 frame().loader().restoreScrollPositionAndViewState();
413 }
411 } 414 }
412 415
413 Page* FrameView::page() const 416 Page* FrameView::page() const
414 { 417 {
415 return frame().page(); 418 return frame().page();
416 } 419 }
417 420
418 LayoutView* FrameView::layoutView() const 421 LayoutView* FrameView::layoutView() const
419 { 422 {
420 return frame().contentLayoutObject(); 423 return frame().contentLayoutObject();
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
502 updateScrollbars(scrollOffsetDouble()); 505 updateScrollbars(scrollOffsetDouble());
503 ScrollableArea::contentsResized(); 506 ScrollableArea::contentsResized();
504 507
505 Page* page = frame().page(); 508 Page* page = frame().page();
506 if (!page) 509 if (!page)
507 return; 510 return;
508 511
509 updateScrollableAreaSet(); 512 updateScrollableAreaSet();
510 513
511 page->chromeClient().contentsSizeChanged(m_frame.get(), size); 514 page->chromeClient().contentsSizeChanged(m_frame.get(), size);
512 } 515 frame().loader().restoreScrollPositionAndViewState();
513
514 IntPoint FrameView::clampOffsetAtScale(const IntPoint& offset, float scale) cons t
515 {
516 IntPoint maxScrollExtent(contentsSize().width() - scrollOrigin().x(), conten tsSize().height() - scrollOrigin().y());
517 FloatSize scaledSize = visibleContentSize();
518 if (scale)
519 scaledSize.scale(1 / scale);
520
521 IntPoint clampedOffset = offset;
522 clampedOffset = clampedOffset.shrunkTo(maxScrollExtent - expandedIntSize(sca ledSize));
523 clampedOffset = clampedOffset.expandedTo(-scrollOrigin());
524
525 return clampedOffset;
526 } 516 }
527 517
528 void FrameView::adjustViewSize() 518 void FrameView::adjustViewSize()
529 { 519 {
530 LayoutView* layoutView = this->layoutView(); 520 LayoutView* layoutView = this->layoutView();
531 if (!layoutView) 521 if (!layoutView)
532 return; 522 return;
533 523
534 ASSERT(m_frame->view() == this); 524 ASSERT(m_frame->view() == this);
535 525
(...skipping 3442 matching lines...) Expand 10 before | Expand all | Expand 10 after
3978 3968
3979 if (!graphicsLayer) 3969 if (!graphicsLayer)
3980 return; 3970 return;
3981 3971
3982 DeprecatedPaintLayer::mapRectToPaintInvalidationBacking(localFrame->contentL ayoutObject(), paintInvalidationContainer, viewRect); 3972 DeprecatedPaintLayer::mapRectToPaintInvalidationBacking(localFrame->contentL ayoutObject(), paintInvalidationContainer, viewRect);
3983 3973
3984 graphicsLayerTimingRequests.add(graphicsLayer, Vector<std::pair<int64_t, Web Rect>>()).storedValue->value.append(std::make_pair(m_frame->frameID(), enclosing IntRect(viewRect))); 3974 graphicsLayerTimingRequests.add(graphicsLayer, Vector<std::pair<int64_t, Web Rect>>()).storedValue->value.append(std::make_pair(m_frame->frameID(), enclosing IntRect(viewRect)));
3985 } 3975 }
3986 3976
3987 } // namespace blink 3977 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698