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

Side by Side Diff: sky/engine/core/frame/FrameView.cpp

Issue 686633002: First pass at removing position:fixed. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month 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 753 matching lines...) Expand 10 before | Expand all | Expand 10 after
764 // FIXME(sky): Remove 764 // FIXME(sky): Remove
765 } 765 }
766 766
767 void FrameView::scrollContentsIfNeeded() 767 void FrameView::scrollContentsIfNeeded()
768 { 768 {
769 // FIXME(sky): Remove 769 // FIXME(sky): Remove
770 } 770 }
771 771
772 bool FrameView::scrollContentsFastPath(const IntSize& scrollDelta) 772 bool FrameView::scrollContentsFastPath(const IntSize& scrollDelta)
773 { 773 {
774 if (!contentsInCompositedLayer() || hasSlowRepaintObjects()) 774 // FIXME(sky): Remove
775 return false; 775 return false;
776
777 if (!m_viewportConstrainedObjects || m_viewportConstrainedObjects->isEmpty() )
778 return true;
779
780 Region regionToUpdate;
781 ViewportConstrainedObjectSet::const_iterator end = m_viewportConstrainedObje cts->end();
782 for (ViewportConstrainedObjectSet::const_iterator it = m_viewportConstrained Objects->begin(); it != end; ++it) {
783 RenderObject* renderer = *it;
784 ASSERT(renderer->style()->hasViewportConstrainedPosition());
785 ASSERT(renderer->hasLayer());
786 RenderLayer* layer = toRenderBoxModelObject(renderer)->layer();
787
788 CompositingState state = layer->compositingState();
789 if (state == PaintsIntoOwnBacking || state == PaintsIntoGroupedBacking)
790 continue;
791
792 // If the fixed layer has a blur/drop-shadow filter applied on at least one of its parents, we cannot
793 // scroll using the fast path, otherwise the outsets of the filter will be moved around the page.
794 if (layer->hasAncestorWithFilterOutsets())
795 return false;
796
797 IntRect updateRect = pixelSnappedIntRect(layer->paintInvalidator().paint InvalidationRectIncludingNonCompositingDescendants());
798
799 const RenderLayerModelObject* repaintContainer = layer->renderer()->cont ainerForPaintInvalidation();
800 if (repaintContainer && !repaintContainer->isRenderView()) {
801 // Invalidate the old and new locations of fixed position elements t hat are not drawn into the RenderView.
802 updateRect.moveBy(scrollPosition());
803 IntRect previousRect = updateRect;
804 previousRect.move(scrollDelta);
805 // FIXME: Rather than uniting the rects, we should just issue both i nvalidations.
806 updateRect.unite(previousRect);
807 layer->renderer()->invalidatePaintUsingContainer(repaintContainer, u pdateRect, InvalidationScroll);
808 } else {
809 // Coalesce the paint invalidations that will be issued to the rende rView.
810 updateRect = contentsToRootView(updateRect);
811 if (!updateRect.isEmpty())
812 regionToUpdate.unite(updateRect);
813 }
814 }
815
816 // Invalidate the old and new locations of fixed position elements that are drawn into the RenderView.
817 Vector<IntRect> subRectsToUpdate = regionToUpdate.rects();
818 size_t viewportConstrainedObjectsCount = subRectsToUpdate.size();
819 for (size_t i = 0; i < viewportConstrainedObjectsCount; ++i) {
820 IntRect updateRect = subRectsToUpdate[i];
821 IntRect scrolledRect = updateRect;
822 scrolledRect.move(-scrollDelta);
823 updateRect.unite(scrolledRect);
824 // FIXME: We should be able to issue these invalidations separately and before we actually scroll.
825 renderView()->layer()->paintInvalidator().setBackingNeedsPaintInvalidati onInRect(rootViewToContents(updateRect));
826 }
827
828 return true;
829 } 776 }
830 777
831 void FrameView::scrollContentsSlowPath(const IntRect& updateRect) 778 void FrameView::scrollContentsSlowPath(const IntRect& updateRect)
832 { 779 {
833 // FIXME(sky): Remove 780 // FIXME(sky): Remove
834 } 781 }
835 782
836 void FrameView::restoreScrollbar() 783 void FrameView::restoreScrollbar()
837 { 784 {
838 // FIXME(sky): Remove 785 // FIXME(sky): Remove
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
890 // layout. 837 // layout.
891 if (!m_nestedLayoutCount) { 838 if (!m_nestedLayoutCount) {
892 updateWidgetPositions(); 839 updateWidgetPositions();
893 if (RenderView* renderView = this->renderView()) 840 if (RenderView* renderView = this->renderView())
894 renderView->layer()->setNeedsCompositingInputsUpdate(); 841 renderView->layer()->setNeedsCompositingInputsUpdate();
895 } 842 }
896 } 843 }
897 844
898 void FrameView::updateFixedElementPaintInvalidationRectsAfterScroll() 845 void FrameView::updateFixedElementPaintInvalidationRectsAfterScroll()
899 { 846 {
900 if (!hasViewportConstrainedObjects()) 847 // FIXME(sky): Remove
901 return;
902
903 // Update the paint invalidation rects for fixed elements after scrolling an d invalidation to reflect
904 // the new scroll position.
905 ViewportConstrainedObjectSet::const_iterator end = m_viewportConstrainedObje cts->end();
906 for (ViewportConstrainedObjectSet::const_iterator it = m_viewportConstrained Objects->begin(); it != end; ++it) {
907 RenderObject* renderer = *it;
908 // m_viewportConstrainedObjects should not contain non-viewport constrai ned objects.
909 ASSERT(renderer->style()->hasViewportConstrainedPosition());
910
911 // Fixed items should always have layers.
912 ASSERT(renderer->hasLayer());
913
914 RenderLayer* layer = toRenderBoxModelObject(renderer)->layer();
915
916 // Don't need to do this for composited fixed items.
917 if (layer->compositingState() == PaintsIntoOwnBacking)
918 continue;
919
920 layer->paintInvalidator().computePaintInvalidationRectsIncludingNonCompo sitingDescendants();
921 }
922 } 848 }
923 849
924 void FrameView::updateCompositedSelectionBoundsIfNeeded() 850 void FrameView::updateCompositedSelectionBoundsIfNeeded()
925 { 851 {
926 if (!RuntimeEnabledFeatures::compositedSelectionUpdatesEnabled()) 852 if (!RuntimeEnabledFeatures::compositedSelectionUpdatesEnabled())
927 return; 853 return;
928 854
929 Page* page = frame().page(); 855 Page* page = frame().page();
930 ASSERT(page); 856 ASSERT(page);
931 857
(...skipping 758 matching lines...) Expand 10 before | Expand all | Expand 10 after
1690 void FrameView::setLayoutSizeInternal(const IntSize& size) 1616 void FrameView::setLayoutSizeInternal(const IntSize& size)
1691 { 1617 {
1692 if (m_layoutSize == size) 1618 if (m_layoutSize == size)
1693 return; 1619 return;
1694 1620
1695 m_layoutSize = size; 1621 m_layoutSize = size;
1696 contentsResized(); 1622 contentsResized();
1697 } 1623 }
1698 1624
1699 } // namespace blink 1625 } // namespace blink
OLDNEW
« no previous file with comments | « sky/engine/core/css/resolver/StyleAdjuster.cpp ('k') | sky/engine/core/page/scrolling/ScrollingCoordinator.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698