OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2009, 2010 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 |
11 * documentation and/or other materials provided with the distribution. | 11 * documentation and/or other materials provided with the distribution. |
12 * | 12 * |
13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY | 13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY |
14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR | 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR |
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
24 */ | 24 */ |
25 | 25 |
26 #include "config.h" | 26 #include "config.h" |
27 | 27 |
28 #include "core/layout/compositing/DeprecatedPaintLayerCompositor.h" | 28 #include "core/layout/compositing/DeprecatedPaintLayerCompositor.h" |
29 | 29 |
| 30 #include "core/animation/AnimationTimeline.h" |
30 #include "core/animation/DocumentAnimations.h" | 31 #include "core/animation/DocumentAnimations.h" |
31 #include "core/dom/DOMNodeIds.h" | 32 #include "core/dom/DOMNodeIds.h" |
32 #include "core/dom/Fullscreen.h" | 33 #include "core/dom/Fullscreen.h" |
33 #include "core/editing/FrameSelection.h" | 34 #include "core/editing/FrameSelection.h" |
34 #include "core/frame/FrameHost.h" | 35 #include "core/frame/FrameHost.h" |
35 #include "core/frame/FrameView.h" | 36 #include "core/frame/FrameView.h" |
36 #include "core/frame/LocalFrame.h" | 37 #include "core/frame/LocalFrame.h" |
37 #include "core/frame/Settings.h" | 38 #include "core/frame/Settings.h" |
38 #include "core/html/HTMLIFrameElement.h" | 39 #include "core/html/HTMLIFrameElement.h" |
39 #include "core/inspector/InspectorInstrumentation.h" | 40 #include "core/inspector/InspectorInstrumentation.h" |
(...skipping 670 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
710 void DeprecatedPaintLayerCompositor::setIsInWindow(bool isInWindow) | 711 void DeprecatedPaintLayerCompositor::setIsInWindow(bool isInWindow) |
711 { | 712 { |
712 if (!staleInCompositingMode()) | 713 if (!staleInCompositingMode()) |
713 return; | 714 return; |
714 | 715 |
715 if (isInWindow) { | 716 if (isInWindow) { |
716 if (m_rootLayerAttachment != RootLayerUnattached) | 717 if (m_rootLayerAttachment != RootLayerUnattached) |
717 return; | 718 return; |
718 | 719 |
719 RootLayerAttachment attachment = m_layoutView.frame()->isLocalRoot() ? R
ootLayerAttachedViaChromeClient : RootLayerAttachedViaEnclosingFrame; | 720 RootLayerAttachment attachment = m_layoutView.frame()->isLocalRoot() ? R
ootLayerAttachedViaChromeClient : RootLayerAttachedViaEnclosingFrame; |
| 721 attachCompositorTimeline(); |
720 attachRootLayer(attachment); | 722 attachRootLayer(attachment); |
721 } else { | 723 } else { |
722 if (m_rootLayerAttachment == RootLayerUnattached) | 724 if (m_rootLayerAttachment == RootLayerUnattached) |
723 return; | 725 return; |
724 | 726 |
725 detachRootLayer(); | 727 detachRootLayer(); |
| 728 detachCompositorTimeline(); |
726 } | 729 } |
727 } | 730 } |
728 | 731 |
729 void DeprecatedPaintLayerCompositor::updateRootLayerPosition() | 732 void DeprecatedPaintLayerCompositor::updateRootLayerPosition() |
730 { | 733 { |
731 if (m_rootContentLayer) { | 734 if (m_rootContentLayer) { |
732 const IntRect& documentRect = m_layoutView.documentRect(); | 735 const IntRect& documentRect = m_layoutView.documentRect(); |
733 m_rootContentLayer->setSize(documentRect.size()); | 736 m_rootContentLayer->setSize(documentRect.size()); |
734 m_rootContentLayer->setPosition(documentRect.location()); | 737 m_rootContentLayer->setPosition(documentRect.location()); |
735 } | 738 } |
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
993 | 996 |
994 // Hook them up | 997 // Hook them up |
995 m_overflowControlsHostLayer->addChild(m_containerLayer.get()); | 998 m_overflowControlsHostLayer->addChild(m_containerLayer.get()); |
996 m_containerLayer->addChild(m_scrollLayer.get()); | 999 m_containerLayer->addChild(m_scrollLayer.get()); |
997 m_scrollLayer->addChild(m_rootContentLayer.get()); | 1000 m_scrollLayer->addChild(m_rootContentLayer.get()); |
998 | 1001 |
999 frameViewDidChangeSize(); | 1002 frameViewDidChangeSize(); |
1000 } | 1003 } |
1001 | 1004 |
1002 // Check to see if we have to change the attachment | 1005 // Check to see if we have to change the attachment |
1003 if (m_rootLayerAttachment != RootLayerUnattached) | 1006 if (m_rootLayerAttachment != RootLayerUnattached) { |
1004 detachRootLayer(); | 1007 detachRootLayer(); |
| 1008 detachCompositorTimeline(); |
| 1009 } |
1005 | 1010 |
| 1011 attachCompositorTimeline(); |
1006 attachRootLayer(expectedAttachment); | 1012 attachRootLayer(expectedAttachment); |
1007 } | 1013 } |
1008 | 1014 |
1009 void DeprecatedPaintLayerCompositor::destroyRootLayer() | 1015 void DeprecatedPaintLayerCompositor::destroyRootLayer() |
1010 { | 1016 { |
1011 if (!m_rootContentLayer) | 1017 if (!m_rootContentLayer) |
1012 return; | 1018 return; |
1013 | 1019 |
1014 detachRootLayer(); | 1020 detachRootLayer(); |
1015 | 1021 |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1107 } | 1113 } |
1108 | 1114 |
1109 m_rootLayerAttachment = RootLayerUnattached; | 1115 m_rootLayerAttachment = RootLayerUnattached; |
1110 } | 1116 } |
1111 | 1117 |
1112 void DeprecatedPaintLayerCompositor::updateRootLayerAttachment() | 1118 void DeprecatedPaintLayerCompositor::updateRootLayerAttachment() |
1113 { | 1119 { |
1114 ensureRootLayer(); | 1120 ensureRootLayer(); |
1115 } | 1121 } |
1116 | 1122 |
| 1123 void DeprecatedPaintLayerCompositor::attachCompositorTimeline() |
| 1124 { |
| 1125 LocalFrame& frame = m_layoutView.frameView()->frame(); |
| 1126 Page* page = frame.page(); |
| 1127 if (!page) |
| 1128 return; |
| 1129 |
| 1130 WebCompositorAnimationTimeline* compositorTimeline = frame.document() ? fram
e.document()->timeline().compositorTimeline() : nullptr; |
| 1131 if (compositorTimeline) |
| 1132 page->chrome().client().attachCompositorAnimationTimeline(compositorTime
line, &frame); |
| 1133 } |
| 1134 |
| 1135 void DeprecatedPaintLayerCompositor::detachCompositorTimeline() |
| 1136 { |
| 1137 LocalFrame& frame = m_layoutView.frameView()->frame(); |
| 1138 Page* page = frame.page(); |
| 1139 if (!page) |
| 1140 return; |
| 1141 |
| 1142 WebCompositorAnimationTimeline* compositorTimeline = frame.document() ? fram
e.document()->timeline().compositorTimeline() : nullptr; |
| 1143 if (compositorTimeline) |
| 1144 page->chrome().client().detachCompositorAnimationTimeline(compositorTime
line, &frame); |
| 1145 } |
| 1146 |
1117 ScrollingCoordinator* DeprecatedPaintLayerCompositor::scrollingCoordinator() con
st | 1147 ScrollingCoordinator* DeprecatedPaintLayerCompositor::scrollingCoordinator() con
st |
1118 { | 1148 { |
1119 if (Page* page = this->page()) | 1149 if (Page* page = this->page()) |
1120 return page->scrollingCoordinator(); | 1150 return page->scrollingCoordinator(); |
1121 | 1151 |
1122 return 0; | 1152 return 0; |
1123 } | 1153 } |
1124 | 1154 |
1125 GraphicsLayerFactory* DeprecatedPaintLayerCompositor::graphicsLayerFactory() con
st | 1155 GraphicsLayerFactory* DeprecatedPaintLayerCompositor::graphicsLayerFactory() con
st |
1126 { | 1156 { |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1159 } else if (graphicsLayer == m_scrollLayer.get()) { | 1189 } else if (graphicsLayer == m_scrollLayer.get()) { |
1160 name = "LocalFrame Scrolling Layer"; | 1190 name = "LocalFrame Scrolling Layer"; |
1161 } else { | 1191 } else { |
1162 ASSERT_NOT_REACHED(); | 1192 ASSERT_NOT_REACHED(); |
1163 } | 1193 } |
1164 | 1194 |
1165 return name; | 1195 return name; |
1166 } | 1196 } |
1167 | 1197 |
1168 } // namespace blink | 1198 } // namespace blink |
OLD | NEW |