OLD | NEW |
---|---|
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 1545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1556 frame().loader().saveScrollState(); | 1556 frame().loader().saveScrollState(); |
1557 } | 1557 } |
1558 | 1558 |
1559 void FrameView::didScrollTimerFired(Timer<FrameView>*) | 1559 void FrameView::didScrollTimerFired(Timer<FrameView>*) |
1560 { | 1560 { |
1561 if (m_frame->document() && m_frame->document()->layoutView()) { | 1561 if (m_frame->document() && m_frame->document()->layoutView()) { |
1562 ResourceLoadPriorityOptimizer::resourceLoadPriorityOptimizer()->updateAl lImageResourcePriorities(); | 1562 ResourceLoadPriorityOptimizer::resourceLoadPriorityOptimizer()->updateAl lImageResourcePriorities(); |
1563 } | 1563 } |
1564 } | 1564 } |
1565 | 1565 |
1566 void FrameView::updateLayersAndCompositingAfterScrollIfNeeded() | 1566 void FrameView::updateLayersAndCompositingAfterScrollIfNeeded(const DoubleSize& scrollDelta) |
1567 { | 1567 { |
1568 // Nothing to do after scrolling if there are no fixed position elements. | 1568 // Nothing to do after scrolling if there are no fixed position elements. |
1569 if (!hasViewportConstrainedObjects()) | 1569 if (!hasViewportConstrainedObjects()) |
1570 return; | 1570 return; |
1571 | 1571 |
1572 RefPtrWillBeRawPtr<FrameView> protect(this); | 1572 RefPtrWillBeRawPtr<FrameView> protect(this); |
1573 | 1573 |
1574 // Update sticky positioned elements which scroll with the viewport. | |
1575 for (const auto& viewportConstrainedObject : *m_viewportConstrainedObjects) { | |
1576 LayoutObject* layoutObject = viewportConstrainedObject; | |
1577 DeprecatedPaintLayer* layer = toLayoutBoxModelObject(layoutObject)->laye r(); | |
1578 if (layoutObject->style()->position() == StickyPosition && layer->scroll sWithViewport()) | |
1579 layer->updateLayerPositionsAfterOverflowScroll(scrollDelta); | |
flackr
2015/09/15 21:13:11
+skobes, does this seem like the right way / place
skobes
2015/09/16 00:07:57
Possibly, but keep in mind that FrameView scrolls
chrishtr
2015/09/17 01:18:56
This method of implementation is not performant en
flackr
2015/09/22 22:25:32
Agreed, my intention is to only add those sticky o
| |
1580 } | |
1581 | |
1574 // If there fixed position elements, scrolling may cause compositing layers to change. | 1582 // If there fixed position elements, scrolling may cause compositing layers to change. |
1575 // Update widget and layer positions after scrolling, but only if we're not inside of | 1583 // Update widget and layer positions after scrolling, but only if we're not inside of |
1576 // layout. | 1584 // layout. |
1577 if (!m_nestedLayoutCount) { | 1585 if (!m_nestedLayoutCount) { |
1578 updateWidgetPositions(); | 1586 updateWidgetPositions(); |
1579 if (LayoutView* layoutView = this->layoutView()) | 1587 if (LayoutView* layoutView = this->layoutView()) |
1580 layoutView->layer()->setNeedsCompositingInputsUpdate(); | 1588 layoutView->layer()->setNeedsCompositingInputsUpdate(); |
1581 } | 1589 } |
1582 } | 1590 } |
1583 | 1591 |
(...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2122 // Don't scroll the FrameView! | 2130 // Don't scroll the FrameView! |
2123 ASSERT_NOT_REACHED(); | 2131 ASSERT_NOT_REACHED(); |
2124 } | 2132 } |
2125 | 2133 |
2126 m_scrollPosition = newPosition; | 2134 m_scrollPosition = newPosition; |
2127 | 2135 |
2128 if (!scrollbarsSuppressed()) | 2136 if (!scrollbarsSuppressed()) |
2129 m_pendingScrollDelta += scrollDelta; | 2137 m_pendingScrollDelta += scrollDelta; |
2130 | 2138 |
2131 clearScrollAnchor(); | 2139 clearScrollAnchor(); |
2132 updateLayersAndCompositingAfterScrollIfNeeded(); | 2140 updateLayersAndCompositingAfterScrollIfNeeded(scrollDelta); |
2133 scrollPositionChanged(); | 2141 scrollPositionChanged(); |
2134 frame().loader().client()->didChangeScrollOffset(); | 2142 frame().loader().client()->didChangeScrollOffset(); |
2135 } | 2143 } |
2136 | 2144 |
2137 void FrameView::invalidatePaintForTickmarks() const | 2145 void FrameView::invalidatePaintForTickmarks() const |
2138 { | 2146 { |
2139 if (Scrollbar* scrollbar = verticalScrollbar()) | 2147 if (Scrollbar* scrollbar = verticalScrollbar()) |
2140 scrollbar->invalidate(); | 2148 scrollbar->invalidate(); |
2141 } | 2149 } |
2142 | 2150 |
(...skipping 1007 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3150 // If no scrollbars are present, the content may still be scrollable. | 3158 // If no scrollbars are present, the content may still be scrollable. |
3151 if (!scrollbar) { | 3159 if (!scrollbar) { |
3152 IntSize scrollSize = m_contentsSize - visibleContentRect().size(); | 3160 IntSize scrollSize = m_contentsSize - visibleContentRect().size(); |
3153 scrollSize.clampNegativeToZero(); | 3161 scrollSize.clampNegativeToZero(); |
3154 return orientation == HorizontalScrollbar ? scrollSize.width() : scrollS ize.height(); | 3162 return orientation == HorizontalScrollbar ? scrollSize.width() : scrollS ize.height(); |
3155 } | 3163 } |
3156 | 3164 |
3157 return scrollbar->totalSize() - scrollbar->visibleSize(); | 3165 return scrollbar->totalSize() - scrollbar->visibleSize(); |
3158 } | 3166 } |
3159 | 3167 |
3160 void FrameView::setScrollOffset(const IntPoint& offset, ScrollType) | 3168 void FrameView::setScrollOffset(const IntPoint& offset, ScrollType type) |
3161 { | 3169 { |
3162 scrollTo(clampScrollPosition(offset)); | 3170 if (type != CompositorScroll) { |
3171 // Scrolling is triggered directly in response to scrollbar thumb moveme nt, | |
3172 // but should be processed after compositing update. http://crbug.com/42 0741 | |
3173 DisableCompositingQueryAsserts disabler; | |
3174 scrollTo(clampScrollPosition(offset)); | |
3175 } else { | |
3176 scrollTo(clampScrollPosition(offset)); | |
3177 } | |
3163 } | 3178 } |
3164 | 3179 |
3165 void FrameView::setScrollOffset(const DoublePoint& offset, ScrollType) | 3180 void FrameView::setScrollOffset(const DoublePoint& offset, ScrollType type) |
3166 { | 3181 { |
3167 scrollTo(clampScrollPosition(offset)); | 3182 if (type != CompositorScroll) { |
3183 // Scrolling is triggered directly in response to scrollbar thumb moveme nt, | |
3184 // but should be processed after compositing update. http://crbug.com/42 0741 | |
3185 DisableCompositingQueryAsserts disabler; | |
3186 scrollTo(clampScrollPosition(offset)); | |
3187 } else { | |
3188 scrollTo(clampScrollPosition(offset)); | |
3189 } | |
3168 } | 3190 } |
3169 | 3191 |
3170 void FrameView::windowResizerRectChanged() | 3192 void FrameView::windowResizerRectChanged() |
3171 { | 3193 { |
3172 updateScrollbars(scrollOffsetDouble()); | 3194 updateScrollbars(scrollOffsetDouble()); |
3173 } | 3195 } |
3174 | 3196 |
3175 bool FrameView::hasOverlayScrollbars() const | 3197 bool FrameView::hasOverlayScrollbars() const |
3176 { | 3198 { |
3177 | 3199 |
(...skipping 756 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3934 | 3956 |
3935 if (!graphicsLayer) | 3957 if (!graphicsLayer) |
3936 return; | 3958 return; |
3937 | 3959 |
3938 DeprecatedPaintLayer::mapRectToPaintInvalidationBacking(localFrame->contentL ayoutObject(), paintInvalidationContainer, viewRect); | 3960 DeprecatedPaintLayer::mapRectToPaintInvalidationBacking(localFrame->contentL ayoutObject(), paintInvalidationContainer, viewRect); |
3939 | 3961 |
3940 graphicsLayerTimingRequests.add(graphicsLayer, Vector<std::pair<int64_t, Web Rect>>()).storedValue->value.append(std::make_pair(m_frame->frameID(), enclosing IntRect(viewRect))); | 3962 graphicsLayerTimingRequests.add(graphicsLayer, Vector<std::pair<int64_t, Web Rect>>()).storedValue->value.append(std::make_pair(m_frame->frameID(), enclosing IntRect(viewRect))); |
3941 } | 3963 } |
3942 | 3964 |
3943 } // namespace blink | 3965 } // namespace blink |
OLD | NEW |