OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2011 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 868 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
879 } | 879 } |
880 #endif | 880 #endif |
881 | 881 |
882 bool ScrollingCoordinator::hasVisibleSlowRepaintViewportConstrainedObjects(Frame
View* frameView) const | 882 bool ScrollingCoordinator::hasVisibleSlowRepaintViewportConstrainedObjects(Frame
View* frameView) const |
883 { | 883 { |
884 const FrameView::ViewportConstrainedObjectSet* viewportConstrainedObjects =
frameView->viewportConstrainedObjects(); | 884 const FrameView::ViewportConstrainedObjectSet* viewportConstrainedObjects =
frameView->viewportConstrainedObjects(); |
885 if (!viewportConstrainedObjects) | 885 if (!viewportConstrainedObjects) |
886 return false; | 886 return false; |
887 | 887 |
888 for (FrameView::ViewportConstrainedObjectSet::const_iterator it = viewportCo
nstrainedObjects->begin(), end = viewportConstrainedObjects->end(); it != end; +
+it) { | 888 for (FrameView::ViewportConstrainedObjectSet::const_iterator it = viewportCo
nstrainedObjects->begin(), end = viewportConstrainedObjects->end(); it != end; +
+it) { |
889 RenderObject* viewportConstrainedObject = *it; | 889 RenderObject* renderer = *it; |
890 if (!viewportConstrainedObject->isBoxModelObject() || !viewportConstrain
edObject->hasLayer()) | 890 ASSERT(renderer->isBoxModelObject() && renderer->hasLayer()); |
891 return true; | 891 ASSERT(renderer->style()->position() == FixedPosition); |
892 RenderLayer* layer = toRenderBoxModelObject(viewportConstrainedObject)->
layer(); | 892 RenderLayer* layer = toRenderBoxModelObject(renderer)->layer(); |
893 // Composited layers that actually paint into their enclosing ancestor | 893 |
894 // must also force main thread scrolling. | 894 // Whether the RenderLayer scrolls with the viewport is a tree-depenent |
895 if (layer->compositingState() == HasOwnBackingButPaintsIntoAncestor) | 895 // property and our viewportConstrainedObjects collection is maintained |
| 896 // with only RenderObject-level information. |
| 897 if (!layer->scrollsWithViewport()) |
| 898 continue; |
| 899 |
| 900 // We're only smart enough to scroll viewport-constrainted objects |
| 901 // in the compositor if they have their own backing or they paint |
| 902 // into a grouped back (which necessarily all have the same viewport |
| 903 // constraints). |
| 904 CompositingState compositingState = layer->compositingState(); |
| 905 if (compositingState != PaintsIntoOwnBacking && compositingState != Pain
tsIntoGroupedBacking) |
896 return true; | 906 return true; |
897 } | 907 } |
898 return false; | 908 return false; |
899 } | 909 } |
900 | 910 |
901 MainThreadScrollingReasons ScrollingCoordinator::mainThreadScrollingReasons() co
nst | 911 MainThreadScrollingReasons ScrollingCoordinator::mainThreadScrollingReasons() co
nst |
902 { | 912 { |
903 // The main thread scrolling reasons are applicable to scrolls of the main | 913 // The main thread scrolling reasons are applicable to scrolls of the main |
904 // frame. If it does not exist or if it is not scrollable, there is no | 914 // frame. If it does not exist or if it is not scrollable, there is no |
905 // reason to force main thread scrolling. | 915 // reason to force main thread scrolling. |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
947 bool frameIsScrollable = frameView && frameView->isScrollable(); | 957 bool frameIsScrollable = frameView && frameView->isScrollable(); |
948 if (frameIsScrollable != m_wasFrameScrollable) | 958 if (frameIsScrollable != m_wasFrameScrollable) |
949 return true; | 959 return true; |
950 | 960 |
951 if (WebLayer* scrollLayer = frameView ? toWebLayer(frameView->layerForScroll
ing()) : 0) | 961 if (WebLayer* scrollLayer = frameView ? toWebLayer(frameView->layerForScroll
ing()) : 0) |
952 return blink::WebSize(frameView->contentsSize()) != scrollLayer->bounds(
); | 962 return blink::WebSize(frameView->contentsSize()) != scrollLayer->bounds(
); |
953 return false; | 963 return false; |
954 } | 964 } |
955 | 965 |
956 } // namespace blink | 966 } // namespace blink |
OLD | NEW |