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

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: remove checkComplete call in loadInSameDocument 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 502 matching lines...) Expand 10 before | Expand all | Expand 10 after
513 IntRect paintInvalidationRect = rect; 513 IntRect paintInvalidationRect = rect;
514 paintInvalidationRect.move( 514 paintInvalidationRect.move(
515 (layoutItem.borderLeft() + layoutItem.paddingLeft()).toInt(), 515 (layoutItem.borderLeft() + layoutItem.paddingLeft()).toInt(),
516 (layoutItem.borderTop() + layoutItem.paddingTop()).toInt()); 516 (layoutItem.borderTop() + layoutItem.paddingTop()).toInt());
517 // FIXME: We should not allow paint invalidation out of paint invalidation 517 // FIXME: We should not allow paint invalidation out of paint invalidation
518 // state. crbug.com/457415 518 // state. crbug.com/457415
519 DisablePaintInvalidationStateAsserts paintInvalidationAssertDisabler; 519 DisablePaintInvalidationStateAsserts paintInvalidationAssertDisabler;
520 layoutItem.invalidatePaintRectangle(LayoutRect(paintInvalidationRect)); 520 layoutItem.invalidatePaintRectangle(LayoutRect(paintInvalidationRect));
521 } 521 }
522 522
523 void FrameView::setScrollAfterSizeChange() {
524 scrollToFragmentAnchor();
525 frame().loader().restoreScrollPositionAndViewState();
526 }
527
523 void FrameView::setFrameRect(const IntRect& newRect) { 528 void FrameView::setFrameRect(const IntRect& newRect) {
524 IntRect oldRect = frameRect(); 529 IntRect oldRect = frameRect();
525 if (newRect == oldRect) 530 if (newRect == oldRect)
526 return; 531 return;
527 532
528 Widget::setFrameRect(newRect); 533 Widget::setFrameRect(newRect);
529 534
530 const bool frameSizeChanged = oldRect.size() != newRect.size(); 535 const bool frameSizeChanged = oldRect.size() != newRect.size();
531 536
532 m_needsScrollbarsUpdate = frameSizeChanged; 537 m_needsScrollbarsUpdate = frameSizeChanged;
533 // TODO(wjmaclean): find out why scrollbars fail to resize for complex 538 // TODO(wjmaclean): find out why scrollbars fail to resize for complex
534 // subframes after changing the zoom level. For now always calling 539 // subframes after changing the zoom level. For now always calling
535 // updateScrollbarsIfNeeded() here fixes the issue, but it would be good to 540 // updateScrollbarsIfNeeded() here fixes the issue, but it would be good to
536 // discover the deeper cause of this. http://crbug.com/607987. 541 // discover the deeper cause of this. http://crbug.com/607987.
537 updateScrollbarsIfNeeded(); 542 updateScrollbarsIfNeeded();
538 543
539 frameRectsChanged(); 544 frameRectsChanged();
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 setScrollAfterSizeChange();
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 setScrollAfterSizeChange();
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