Chromium Code Reviews

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

Issue 606023003: Don't bubble scrolls across boundary when scrolling to anchor (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Now with test. Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | | Annotate | Revision Log
« no previous file with comments | « LayoutTests/http/tests/navigation/resources/focus-shifting-frame-with-anchor.html ('k') | no next file » | 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 1797 matching lines...)
1808 if (!anchorNode) 1808 if (!anchorNode)
1809 return; 1809 return;
1810 1810
1811 if (!anchorNode->renderer()) 1811 if (!anchorNode->renderer())
1812 return; 1812 return;
1813 1813
1814 LayoutRect rect; 1814 LayoutRect rect;
1815 if (anchorNode != m_frame->document()) 1815 if (anchorNode != m_frame->document())
1816 rect = anchorNode->boundingBox(); 1816 rect = anchorNode->boundingBox();
1817 1817
1818 RefPtrWillBeRawPtr<LocalFrame> boundaryFrame = m_frame->document()->findUnsa feParentScrollPropagationBoundary();
1819
1820 if (boundaryFrame)
1821 boundaryFrame->view()->setSafeToPropagateScrollToParent(false);
1822
1818 // Scroll nested layers and frames to reveal the anchor. 1823 // Scroll nested layers and frames to reveal the anchor.
1819 // Align to the top and to the closest side (this matches other browsers). 1824 // Align to the top and to the closest side (this matches other browsers).
1820 anchorNode->renderer()->scrollRectToVisible(rect, ScrollAlignment::alignToEd geIfNeeded, ScrollAlignment::alignTopAlways); 1825 anchorNode->renderer()->scrollRectToVisible(rect, ScrollAlignment::alignToEd geIfNeeded, ScrollAlignment::alignTopAlways);
1821 1826
1827 if (boundaryFrame)
1828 boundaryFrame->view()->setSafeToPropagateScrollToParent(true);
1829
1822 if (AXObjectCache* cache = m_frame->document()->existingAXObjectCache()) 1830 if (AXObjectCache* cache = m_frame->document()->existingAXObjectCache())
1823 cache->handleScrolledToAnchor(anchorNode.get()); 1831 cache->handleScrolledToAnchor(anchorNode.get());
1824 1832
1825 // scrollRectToVisible can call into setScrollPosition(), which resets m_mai ntainScrollPositionAnchor. 1833 // scrollRectToVisible can call into setScrollPosition(), which resets m_mai ntainScrollPositionAnchor.
1826 m_maintainScrollPositionAnchor = anchorNode; 1834 m_maintainScrollPositionAnchor = anchorNode;
1827 } 1835 }
1828 1836
1829 bool FrameView::updateWidgets() 1837 bool FrameView::updateWidgets()
1830 { 1838 {
1831 // This is always called from updateWidgetsTimerFired. 1839 // This is always called from updateWidgetsTimerFired.
(...skipping 1187 matching lines...)
3019 IntSize visibleSize = expandedIntSize(visibleContentSizeF); 3027 IntSize visibleSize = expandedIntSize(visibleContentSizeF);
3020 3028
3021 IntPoint maximumOffset( 3029 IntPoint maximumOffset(
3022 contentsWidth() - visibleSize.width() - scrollOrigin().x(), 3030 contentsWidth() - visibleSize.width() - scrollOrigin().x(),
3023 contentsHeight() - visibleSize.height() - scrollOrigin().y()); 3031 contentsHeight() - visibleSize.height() - scrollOrigin().y());
3024 maximumOffset.clampNegativeToZero(); 3032 maximumOffset.clampNegativeToZero();
3025 return maximumOffset; 3033 return maximumOffset;
3026 } 3034 }
3027 3035
3028 } // namespace blink 3036 } // namespace blink
OLDNEW
« no previous file with comments | « LayoutTests/http/tests/navigation/resources/focus-shifting-frame-with-anchor.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine