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