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

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

Issue 2145823002: Implement the overflow-anchor CSS property as an opt-out for ScrollAnchoring (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Put opt-out behind RuntimeEnabledFeature and update tests Created 4 years, 5 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 805 matching lines...) Expand 10 before | Expand all | Expand 10 after
816 if (m_frame->isMainFrame() && !m_viewportScrollableArea) { 816 if (m_frame->isMainFrame() && !m_viewportScrollableArea) {
817 ScrollableArea& visualViewport = m_frame->host()->visualViewport(); 817 ScrollableArea& visualViewport = m_frame->host()->visualViewport();
818 ScrollableArea* layoutViewport = layoutViewportScrollableArea(); 818 ScrollableArea* layoutViewport = layoutViewportScrollableArea();
819 DCHECK(layoutViewport); 819 DCHECK(layoutViewport);
820 m_viewportScrollableArea = RootFrameViewport::create(visualViewport, *la youtViewport); 820 m_viewportScrollableArea = RootFrameViewport::create(visualViewport, *la youtViewport);
821 } 821 }
822 822
823 if (!m_scrollAnchor.hasScroller()) 823 if (!m_scrollAnchor.hasScroller())
824 m_scrollAnchor.setScroller(m_viewportScrollableArea ? m_viewportScrollab leArea : this); 824 m_scrollAnchor.setScroller(m_viewportScrollableArea ? m_viewportScrollab leArea : this);
825 825
826 if (RuntimeEnabledFeatures::scrollAnchoringEnabled()) 826 if (shouldPerformScrollAnchoring())
827 m_scrollAnchor.save(); 827 m_scrollAnchor.save();
828 } 828 }
829 829
830 static inline void layoutFromRootObject(LayoutObject& root) 830 static inline void layoutFromRootObject(LayoutObject& root)
831 { 831 {
832 LayoutState layoutState(root); 832 LayoutState layoutState(root);
833 root.layout(); 833 root.layout();
834 } 834 }
835 835
836 void FrameView::prepareLayoutAnalyzer() 836 void FrameView::prepareLayoutAnalyzer()
(...skipping 1278 matching lines...) Expand 10 before | Expand all | Expand 10 after
2115 if (layoutViewItem().isNull()) 2115 if (layoutViewItem().isNull())
2116 return; 2116 return;
2117 2117
2118 scheduleUpdateWidgetsIfNecessary(); 2118 scheduleUpdateWidgetsIfNecessary();
2119 2119
2120 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator( )) 2120 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator( ))
2121 scrollingCoordinator->notifyGeometryChanged(); 2121 scrollingCoordinator->notifyGeometryChanged();
2122 2122
2123 scrollToFragmentAnchor(); 2123 scrollToFragmentAnchor();
2124 // TODO(skobes): Figure out interactions between scroll anchor, fragment anc hor, and history restoration. 2124 // TODO(skobes): Figure out interactions between scroll anchor, fragment anc hor, and history restoration.
2125 if (RuntimeEnabledFeatures::scrollAnchoringEnabled()) 2125 if (shouldPerformScrollAnchoring())
2126 m_scrollAnchor.restore(); 2126 m_scrollAnchor.restore();
2127 2127
2128 sendResizeEventIfNeeded(); 2128 sendResizeEventIfNeeded();
2129 } 2129 }
2130 2130
2131 bool FrameView::wasViewportResized() 2131 bool FrameView::wasViewportResized()
2132 { 2132 {
2133 ASSERT(m_frame); 2133 ASSERT(m_frame);
2134 LayoutViewItem layoutViewItem = this->layoutViewItem(); 2134 LayoutViewItem layoutViewItem = this->layoutViewItem();
2135 if (layoutViewItem.isNull()) 2135 if (layoutViewItem.isNull())
(...skipping 1954 matching lines...) Expand 10 before | Expand all | Expand 10 after
4090 ScrollableArea* FrameView::layoutViewportScrollableArea() 4090 ScrollableArea* FrameView::layoutViewportScrollableArea()
4091 { 4091 {
4092 Settings* settings = frame().settings(); 4092 Settings* settings = frame().settings();
4093 if (!settings || !settings->rootLayerScrolls()) 4093 if (!settings || !settings->rootLayerScrolls())
4094 return this; 4094 return this;
4095 4095
4096 LayoutViewItem layoutViewItem = this->layoutViewItem(); 4096 LayoutViewItem layoutViewItem = this->layoutViewItem();
4097 return layoutViewItem.isNull() ? nullptr : layoutViewItem.getScrollableArea( ); 4097 return layoutViewItem.isNull() ? nullptr : layoutViewItem.getScrollableArea( );
4098 } 4098 }
4099 4099
4100 LayoutObject* FrameView::viewportLayoutObject() 4100 LayoutObject* FrameView::viewportLayoutObject() const
4101 { 4101 {
4102 if (Document* document = frame().document()) { 4102 if (Document* document = frame().document()) {
4103 if (Element* element = document->viewportDefiningElement()) 4103 if (Element* element = document->viewportDefiningElement())
4104 return element->layoutObject(); 4104 return element->layoutObject();
4105 } 4105 }
4106 return nullptr; 4106 return nullptr;
4107 } 4107 }
4108 4108
4109 void FrameView::collectAnnotatedRegions(LayoutObject& layoutObject, Vector<Annot atedRegionValue>& regions) const 4109 void FrameView::collectAnnotatedRegions(LayoutObject& layoutObject, Vector<Annot atedRegionValue>& regions) const
4110 { 4110 {
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
4273 } 4273 }
4274 4274
4275 bool FrameView::canThrottleRendering() const 4275 bool FrameView::canThrottleRendering() const
4276 { 4276 {
4277 if (!RuntimeEnabledFeatures::renderingPipelineThrottlingEnabled()) 4277 if (!RuntimeEnabledFeatures::renderingPipelineThrottlingEnabled())
4278 return false; 4278 return false;
4279 return m_subtreeThrottled || (m_hiddenForThrottling && m_crossOriginForThrot tling); 4279 return m_subtreeThrottled || (m_hiddenForThrottling && m_crossOriginForThrot tling);
4280 } 4280 }
4281 4281
4282 } // namespace blink 4282 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/frame/FrameView.h ('k') | third_party/WebKit/Source/core/frame/UseCounter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698