| 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 918 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 929 #endif | 929 #endif |
| 930 | 930 |
| 931 bool ScrollingCoordinator::hasVisibleSlowRepaintViewportConstrainedObjects(Frame
View* frameView) const | 931 bool ScrollingCoordinator::hasVisibleSlowRepaintViewportConstrainedObjects(Frame
View* frameView) const |
| 932 { | 932 { |
| 933 const FrameView::ViewportConstrainedObjectSet* viewportConstrainedObjects =
frameView->viewportConstrainedObjects(); | 933 const FrameView::ViewportConstrainedObjectSet* viewportConstrainedObjects =
frameView->viewportConstrainedObjects(); |
| 934 if (!viewportConstrainedObjects) | 934 if (!viewportConstrainedObjects) |
| 935 return false; | 935 return false; |
| 936 | 936 |
| 937 for (const LayoutObject* layoutObject : *viewportConstrainedObjects) { | 937 for (const LayoutObject* layoutObject : *viewportConstrainedObjects) { |
| 938 ASSERT(layoutObject->isBoxModelObject() && layoutObject->hasLayer()); | 938 ASSERT(layoutObject->isBoxModelObject() && layoutObject->hasLayer()); |
| 939 ASSERT(layoutObject->style()->position() == FixedPosition); | 939 ASSERT(layoutObject->style()->position() == FixedPosition |
| 940 || layoutObject->style()->position() == StickyPosition); |
| 940 PaintLayer* layer = toLayoutBoxModelObject(layoutObject)->layer(); | 941 PaintLayer* layer = toLayoutBoxModelObject(layoutObject)->layer(); |
| 941 | 942 |
| 942 // Whether the Layer scrolls with the viewport is a tree-depenent | 943 // Whether the Layer scrolls with the viewport is a tree-depenent |
| 943 // property and our viewportConstrainedObjects collection is maintained | 944 // property and our viewportConstrainedObjects collection is maintained |
| 944 // with only LayoutObject-level information. | 945 // with only LayoutObject-level information. |
| 945 if (!layer->scrollsWithViewport()) | 946 if (!layer->scrollsWithViewport()) |
| 946 continue; | 947 continue; |
| 947 | 948 |
| 948 // If the whole subtree is invisible, there's no reason to scroll on | 949 // If the whole subtree is invisible, there's no reason to scroll on |
| 949 // the main thread because we don't need to generate invalidations | 950 // the main thread because we don't need to generate invalidations |
| (...skipping 28 matching lines...) Expand all Loading... |
| 978 for (Frame* frame = m_page->mainFrame(); frame; frame = frame->tree().traver
seNext()) { | 979 for (Frame* frame = m_page->mainFrame(); frame; frame = frame->tree().traver
seNext()) { |
| 979 if (!frame->isLocalFrame()) | 980 if (!frame->isLocalFrame()) |
| 980 continue; | 981 continue; |
| 981 | 982 |
| 982 FrameView* frameView = toLocalFrame(frame)->view(); | 983 FrameView* frameView = toLocalFrame(frame)->view(); |
| 983 if (!frameView) | 984 if (!frameView) |
| 984 continue; | 985 continue; |
| 985 | 986 |
| 986 if (frameView->hasBackgroundAttachmentFixedObjects()) | 987 if (frameView->hasBackgroundAttachmentFixedObjects()) |
| 987 reasons |= MainThreadScrollingReason::kHasBackgroundAttachmentFixedO
bjects; | 988 reasons |= MainThreadScrollingReason::kHasBackgroundAttachmentFixedO
bjects; |
| 989 if (frameView->hasStickyPositionObjects()) |
| 990 reasons |= MainThreadScrollingReason::kHasStickyPositionObjects; |
| 988 FrameView::ScrollingReasons scrollingReasons = frameView->getScrollingRe
asons(); | 991 FrameView::ScrollingReasons scrollingReasons = frameView->getScrollingRe
asons(); |
| 989 const bool mayBeScrolledByInput = (scrollingReasons == FrameView::Scroll
able); | 992 const bool mayBeScrolledByInput = (scrollingReasons == FrameView::Scroll
able); |
| 990 const bool mayBeScrolledByScript = mayBeScrolledByInput || (scrollingRea
sons == | 993 const bool mayBeScrolledByScript = mayBeScrolledByInput || (scrollingRea
sons == |
| 991 FrameView::NotScrollableExplicitlyDisabled); | 994 FrameView::NotScrollableExplicitlyDisabled); |
| 992 | 995 |
| 993 // TODO(awoloszyn) Currently crbug.com/304810 will let certain | 996 // TODO(awoloszyn) Currently crbug.com/304810 will let certain |
| 994 // overflow:hidden elements scroll on the compositor thread, so we shoul
d | 997 // overflow:hidden elements scroll on the compositor thread, so we shoul
d |
| 995 // not let this move there path as an optimization, when we have slow-re
paint | 998 // not let this move there path as an optimization, when we have slow-re
paint |
| 996 // elements. | 999 // elements. |
| 997 if (mayBeScrolledByScript && hasVisibleSlowRepaintViewportConstrainedObj
ects(frameView)) { | 1000 if (mayBeScrolledByScript && hasVisibleSlowRepaintViewportConstrainedObj
ects(frameView)) { |
| 998 reasons |= MainThreadScrollingReason::kHasNonLayerViewportConstraine
dObjects; | 1001 reasons |= MainThreadScrollingReason::kHasNonLayerViewportConstraine
dObjects; |
| 999 } | 1002 } |
| 1000 } | 1003 } |
| 1001 | 1004 |
| 1002 return reasons; | 1005 return reasons; |
| 1003 } | 1006 } |
| 1004 | 1007 |
| 1005 String ScrollingCoordinator::mainThreadScrollingReasonsAsText(MainThreadScrollin
gReasons reasons) | 1008 String ScrollingCoordinator::mainThreadScrollingReasonsAsText(MainThreadScrollin
gReasons reasons) |
| 1006 { | 1009 { |
| 1007 StringBuilder stringBuilder; | 1010 StringBuilder stringBuilder; |
| 1008 | 1011 |
| 1009 if (reasons & MainThreadScrollingReason::kHasBackgroundAttachmentFixedObject
s) | 1012 if (reasons & MainThreadScrollingReason::kHasBackgroundAttachmentFixedObject
s) |
| 1010 stringBuilder.appendLiteral("Has background-attachment:fixed, "); | 1013 stringBuilder.appendLiteral("Has background-attachment:fixed, "); |
| 1011 if (reasons & MainThreadScrollingReason::kHasNonLayerViewportConstrainedObje
cts) | 1014 if (reasons & MainThreadScrollingReason::kHasNonLayerViewportConstrainedObje
cts) |
| 1012 stringBuilder.appendLiteral("Has non-layer viewport-constrained objects,
"); | 1015 stringBuilder.appendLiteral("Has non-layer viewport-constrained objects,
"); |
| 1016 if (reasons & MainThreadScrollingReason::kHasStickyPositionObjects) |
| 1017 stringBuilder.appendLiteral("Has sticky position objects, "); |
| 1013 if (reasons & MainThreadScrollingReason::kThreadedScrollingDisabled) | 1018 if (reasons & MainThreadScrollingReason::kThreadedScrollingDisabled) |
| 1014 stringBuilder.appendLiteral("Threaded scrolling is disabled, "); | 1019 stringBuilder.appendLiteral("Threaded scrolling is disabled, "); |
| 1015 if (reasons & MainThreadScrollingReason::kAnimatingScrollOnMainThread) | 1020 if (reasons & MainThreadScrollingReason::kAnimatingScrollOnMainThread) |
| 1016 stringBuilder.appendLiteral("Animating scroll on main thread, "); | 1021 stringBuilder.appendLiteral("Animating scroll on main thread, "); |
| 1017 | 1022 |
| 1018 if (stringBuilder.length()) | 1023 if (stringBuilder.length()) |
| 1019 stringBuilder.resize(stringBuilder.length() - 2); | 1024 stringBuilder.resize(stringBuilder.length() - 2); |
| 1020 return stringBuilder.toString(); | 1025 return stringBuilder.toString(); |
| 1021 } | 1026 } |
| 1022 | 1027 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 1035 bool frameIsScrollable = frameView && frameView->isScrollable(); | 1040 bool frameIsScrollable = frameView && frameView->isScrollable(); |
| 1036 if (frameIsScrollable != m_wasFrameScrollable) | 1041 if (frameIsScrollable != m_wasFrameScrollable) |
| 1037 return true; | 1042 return true; |
| 1038 | 1043 |
| 1039 if (WebLayer* scrollLayer = frameView ? toWebLayer(frameView->layerForScroll
ing()) : nullptr) | 1044 if (WebLayer* scrollLayer = frameView ? toWebLayer(frameView->layerForScroll
ing()) : nullptr) |
| 1040 return WebSize(frameView->contentsSize()) != scrollLayer->bounds(); | 1045 return WebSize(frameView->contentsSize()) != scrollLayer->bounds(); |
| 1041 return false; | 1046 return false; |
| 1042 } | 1047 } |
| 1043 | 1048 |
| 1044 } // namespace blink | 1049 } // namespace blink |
| OLD | NEW |