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 887 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
898 TRACE_EVENT0("input", "ScrollingCoordinator::computeTouchEventTargetRects"); | 898 TRACE_EVENT0("input", "ScrollingCoordinator::computeTouchEventTargetRects"); |
899 ASSERT(RuntimeEnabledFeatures::touchEnabled()); | 899 ASSERT(RuntimeEnabledFeatures::touchEnabled()); |
900 | 900 |
901 Document* document = m_page->deprecatedLocalMainFrame()->document(); | 901 Document* document = m_page->deprecatedLocalMainFrame()->document(); |
902 if (!document || !document->view()) | 902 if (!document || !document->view()) |
903 return; | 903 return; |
904 | 904 |
905 accumulateDocumentTouchEventTargetRects(rects, document); | 905 accumulateDocumentTouchEventTargetRects(rects, document); |
906 } | 906 } |
907 | 907 |
908 void ScrollingCoordinator::frameViewHasSlowRepaintObjectsDidChange(FrameView* fr
ameView) | 908 void ScrollingCoordinator::frameViewHasBackgroundAttachmentFixedObjectsDidChange
(FrameView* frameView) |
909 { | 909 { |
910 ASSERT(isMainThread()); | 910 ASSERT(isMainThread()); |
911 ASSERT(m_page); | 911 ASSERT(m_page); |
912 | 912 |
913 if (!coordinatesScrollingForFrameView(frameView)) | 913 if (!coordinatesScrollingForFrameView(frameView)) |
914 return; | 914 return; |
915 | 915 |
916 m_shouldScrollOnMainThreadDirty = true; | 916 m_shouldScrollOnMainThreadDirty = true; |
917 } | 917 } |
918 | 918 |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1024 | 1024 |
1025 if (!m_page->settings().threadedScrollingEnabled()) | 1025 if (!m_page->settings().threadedScrollingEnabled()) |
1026 reasons |= ThreadedScrollingDisabled; | 1026 reasons |= ThreadedScrollingDisabled; |
1027 | 1027 |
1028 if (!m_page->mainFrame()->isLocalFrame()) | 1028 if (!m_page->mainFrame()->isLocalFrame()) |
1029 return reasons; | 1029 return reasons; |
1030 FrameView* frameView = m_page->deprecatedLocalMainFrame()->view(); | 1030 FrameView* frameView = m_page->deprecatedLocalMainFrame()->view(); |
1031 if (!frameView) | 1031 if (!frameView) |
1032 return reasons; | 1032 return reasons; |
1033 | 1033 |
1034 if (frameView->hasSlowRepaintObjects()) | 1034 if (frameView->hasBackgroundAttachmentFixedObjects()) |
1035 reasons |= HasSlowRepaintObjects; | 1035 reasons |= HasBackgroundAttachmentFixedObjects; |
1036 FrameView::ScrollingReasons scrollingReasons = frameView->scrollingReasons()
; | 1036 FrameView::ScrollingReasons scrollingReasons = frameView->scrollingReasons()
; |
1037 const bool mayBeScrolledByInput = (scrollingReasons == FrameView::Scrollable
); | 1037 const bool mayBeScrolledByInput = (scrollingReasons == FrameView::Scrollable
); |
1038 const bool mayBeScrolledByScript = mayBeScrolledByInput || (scrollingReasons
== | 1038 const bool mayBeScrolledByScript = mayBeScrolledByInput || (scrollingReasons
== |
1039 FrameView::NotScrollableExplicitlyDisabled); | 1039 FrameView::NotScrollableExplicitlyDisabled); |
1040 | 1040 |
1041 // TODO(awoloszyn) Currently crbug.com/304810 will let certain | 1041 // TODO(awoloszyn) Currently crbug.com/304810 will let certain |
1042 // overflow:hidden elements scroll on the compositor thread, so we should | 1042 // overflow:hidden elements scroll on the compositor thread, so we should |
1043 // not let this move there path as an optimization, when we have slow-repain
t | 1043 // not let this move there path as an optimization, when we have slow-repain
t |
1044 // elements. | 1044 // elements. |
1045 if (mayBeScrolledByScript && hasVisibleSlowRepaintViewportConstrainedObjects
(frameView)) { | 1045 if (mayBeScrolledByScript && hasVisibleSlowRepaintViewportConstrainedObjects
(frameView)) { |
1046 reasons |= HasNonLayerViewportConstrainedObjects; | 1046 reasons |= HasNonLayerViewportConstrainedObjects; |
1047 } | 1047 } |
1048 | 1048 |
1049 return reasons; | 1049 return reasons; |
1050 } | 1050 } |
1051 | 1051 |
1052 String ScrollingCoordinator::mainThreadScrollingReasonsAsText(MainThreadScrollin
gReasons reasons) | 1052 String ScrollingCoordinator::mainThreadScrollingReasonsAsText(MainThreadScrollin
gReasons reasons) |
1053 { | 1053 { |
1054 StringBuilder stringBuilder; | 1054 StringBuilder stringBuilder; |
1055 | 1055 |
1056 if (reasons & ScrollingCoordinator::HasSlowRepaintObjects) | 1056 if (reasons & ScrollingCoordinator::HasBackgroundAttachmentFixedObjects) |
1057 stringBuilder.appendLiteral("Has slow repaint objects, "); | 1057 stringBuilder.appendLiteral("Has background-attachment:fixed, "); |
1058 if (reasons & ScrollingCoordinator::HasNonLayerViewportConstrainedObjects) | 1058 if (reasons & ScrollingCoordinator::HasNonLayerViewportConstrainedObjects) |
1059 stringBuilder.appendLiteral("Has non-layer viewport-constrained objects,
"); | 1059 stringBuilder.appendLiteral("Has non-layer viewport-constrained objects,
"); |
1060 if (reasons & ScrollingCoordinator::ThreadedScrollingDisabled) | 1060 if (reasons & ScrollingCoordinator::ThreadedScrollingDisabled) |
1061 stringBuilder.appendLiteral("Threaded scrolling is disabled, "); | 1061 stringBuilder.appendLiteral("Threaded scrolling is disabled, "); |
1062 | 1062 |
1063 if (stringBuilder.length()) | 1063 if (stringBuilder.length()) |
1064 stringBuilder.resize(stringBuilder.length() - 2); | 1064 stringBuilder.resize(stringBuilder.length() - 2); |
1065 return stringBuilder.toString(); | 1065 return stringBuilder.toString(); |
1066 } | 1066 } |
1067 | 1067 |
1068 String ScrollingCoordinator::mainThreadScrollingReasonsAsText() const | 1068 String ScrollingCoordinator::mainThreadScrollingReasonsAsText() const |
1069 { | 1069 { |
1070 ASSERT(m_page->deprecatedLocalMainFrame()->document()->lifecycle().state() >
= DocumentLifecycle::CompositingClean); | 1070 ASSERT(m_page->deprecatedLocalMainFrame()->document()->lifecycle().state() >
= DocumentLifecycle::CompositingClean); |
1071 return mainThreadScrollingReasonsAsText(m_lastMainThreadScrollingReasons); | 1071 return mainThreadScrollingReasonsAsText(m_lastMainThreadScrollingReasons); |
1072 } | 1072 } |
1073 | 1073 |
1074 bool ScrollingCoordinator::frameViewIsDirty() const | 1074 bool ScrollingCoordinator::frameViewIsDirty() const |
1075 { | 1075 { |
1076 FrameView* frameView = m_page->mainFrame()->isLocalFrame() ? m_page->depreca
tedLocalMainFrame()->view() : nullptr; | 1076 FrameView* frameView = m_page->mainFrame()->isLocalFrame() ? m_page->depreca
tedLocalMainFrame()->view() : nullptr; |
1077 bool frameIsScrollable = frameView && frameView->isScrollable(); | 1077 bool frameIsScrollable = frameView && frameView->isScrollable(); |
1078 if (frameIsScrollable != m_wasFrameScrollable) | 1078 if (frameIsScrollable != m_wasFrameScrollable) |
1079 return true; | 1079 return true; |
1080 | 1080 |
1081 if (WebLayer* scrollLayer = frameView ? toWebLayer(frameView->layerForScroll
ing()) : nullptr) | 1081 if (WebLayer* scrollLayer = frameView ? toWebLayer(frameView->layerForScroll
ing()) : nullptr) |
1082 return WebSize(frameView->contentsSize()) != scrollLayer->bounds(); | 1082 return WebSize(frameView->contentsSize()) != scrollLayer->bounds(); |
1083 return false; | 1083 return false; |
1084 } | 1084 } |
1085 | 1085 |
1086 } // namespace blink | 1086 } // namespace blink |
OLD | NEW |