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

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

Issue 2628683003: Add DidSaveScrollOrScaleState flag to prevent restoreScrollPositionAndViewState restore from default (Closed)
Patch Set: Nate's Comment addressed Created 3 years, 10 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 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 m_visuallyNonEmptyPixelCount = 0; 266 m_visuallyNonEmptyPixelCount = 0;
267 m_isVisuallyNonEmpty = false; 267 m_isVisuallyNonEmpty = false;
268 m_mainThreadScrollingReasons = 0; 268 m_mainThreadScrollingReasons = 0;
269 m_layoutObjectCounter.reset(); 269 m_layoutObjectCounter.reset();
270 clearFragmentAnchor(); 270 clearFragmentAnchor();
271 m_viewportConstrainedObjects.reset(); 271 m_viewportConstrainedObjects.reset();
272 m_layoutSubtreeRootList.clear(); 272 m_layoutSubtreeRootList.clear();
273 m_orthogonalWritingModeRootList.clear(); 273 m_orthogonalWritingModeRootList.clear();
274 } 274 }
275 275
276 void FrameView::setScrollFromNavigation() {
majidvp 2017/01/24 21:53:52 nit: please match the declaration order in header
277 scrollToFragmentAnchor();
majidvp 2017/01/24 21:53:52 In this case, scrollToFragment does not honor his
chaopeng 2017/01/25 15:22:38 No, in this case m_fragmentAnchor is null and scro
majidvp 2017/01/25 20:31:59 Are you sure? If the fragmentAnchor is always nil
278 frame().loader().restoreScrollPositionAndViewState();
279 }
280
276 // Call function for each non-throttled frame view in pre tree order. 281 // Call function for each non-throttled frame view in pre tree order.
277 // Note it needs a null check of the frame's layoutView to access it in case of 282 // Note it needs a null check of the frame's layoutView to access it in case of
278 // detached frames. 283 // detached frames.
279 template <typename Function> 284 template <typename Function>
280 void FrameView::forAllNonThrottledFrameViews(const Function& function) { 285 void FrameView::forAllNonThrottledFrameViews(const Function& function) {
281 if (shouldThrottleRendering()) 286 if (shouldThrottleRendering())
282 return; 287 return;
283 288
284 function(*this); 289 function(*this);
285 290
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
540 545
541 updateParentScrollableAreaSet(); 546 updateParentScrollableAreaSet();
542 547
543 if (frameSizeChanged) { 548 if (frameSizeChanged) {
544 viewportSizeChanged(newRect.width() != oldRect.width(), 549 viewportSizeChanged(newRect.width() != oldRect.width(),
545 newRect.height() != oldRect.height()); 550 newRect.height() != oldRect.height());
546 551
547 if (m_frame->isMainFrame()) 552 if (m_frame->isMainFrame())
548 m_frame->host()->visualViewport().mainFrameDidChangeSize(); 553 m_frame->host()->visualViewport().mainFrameDidChangeSize();
549 554
550 frame().loader().restoreScrollPositionAndViewState(); 555 setScrollFromNavigation();
551 } 556 }
552 } 557 }
553 558
554 Page* FrameView::page() const { 559 Page* FrameView::page() const {
555 return frame().page(); 560 return frame().page();
556 } 561 }
557 562
558 LayoutView* FrameView::layoutView() const { 563 LayoutView* FrameView::layoutView() const {
559 return frame().contentLayoutObject(); 564 return frame().contentLayoutObject();
560 } 565 }
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
661 ScrollableArea::contentsResized(); 666 ScrollableArea::contentsResized();
662 667
663 Page* page = frame().page(); 668 Page* page = frame().page();
664 if (!page) 669 if (!page)
665 return; 670 return;
666 671
667 updateParentScrollableAreaSet(); 672 updateParentScrollableAreaSet();
668 673
669 page->chromeClient().contentsSizeChanged(m_frame.get(), size); 674 page->chromeClient().contentsSizeChanged(m_frame.get(), size);
670 675
671 // Ensure the scrollToFragmentAnchor is called before 676 setScrollFromNavigation();
672 // restoreScrollPositionAndViewState when reload
673 scrollToFragmentAnchor();
674 frame().loader().restoreScrollPositionAndViewState();
675 } 677 }
676 678
677 void FrameView::adjustViewSize() { 679 void FrameView::adjustViewSize() {
678 if (m_suppressAdjustViewSize) 680 if (m_suppressAdjustViewSize)
679 return; 681 return;
680 682
681 LayoutViewItem layoutViewItem = this->layoutViewItem(); 683 LayoutViewItem layoutViewItem = this->layoutViewItem();
682 if (layoutViewItem.isNull()) 684 if (layoutViewItem.isNull())
683 return; 685 return;
684 686
(...skipping 4312 matching lines...) Expand 10 before | Expand all | Expand 10 after
4997 // This is the top-level frame, so no mapping necessary. 4999 // This is the top-level frame, so no mapping necessary.
4998 if (m_frame->isMainFrame()) 5000 if (m_frame->isMainFrame())
4999 return; 5001 return;
5000 5002
5001 LayoutRect viewportIntersectionRect(remoteViewportIntersection()); 5003 LayoutRect viewportIntersectionRect(remoteViewportIntersection());
5002 transformState.move( 5004 transformState.move(
5003 LayoutSize(-viewportIntersectionRect.x(), -viewportIntersectionRect.y())); 5005 LayoutSize(-viewportIntersectionRect.x(), -viewportIntersectionRect.y()));
5004 } 5006 }
5005 5007
5006 } // namespace blink 5008 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698