Changeset 192418 in webkit
- Timestamp:
- Nov 13, 2015 9:02:44 AM (8 years ago)
- Location:
- branches/safari-601.1.46-branch/Source/WebKit2
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/safari-601.1.46-branch/Source/WebKit2/ChangeLog
r192417 r192418 1 2015-11-12 Matthew Hanson <matthew_hanson@apple.com> 2 3 Merge r189635. rdar://problem/22846841 4 5 2015-09-11 Beth Dakin <bdakin@apple.com> 6 7 Still need view snapshotting code for non-IOSurface for the sim 8 https://bugs.webkit.org/show_bug.cgi?id=149077 9 10 Reviewed by Tim Horton. 11 12 This fixes the simulator build. 13 * UIProcess/API/Cocoa/WKWebView.mm: 14 (-[WKWebView _takeViewSnapshot]): 15 (-[WKWebView _zoomToPoint:atScale:animated:]): 16 * UIProcess/mac/ViewGestureControllerMac.mm: 17 (WebKit::ViewGestureController::beginSwipeGesture): 18 (WebKit::ViewGestureController::removeSwipeSnapshot): 19 * UIProcess/mac/ViewSnapshotStore.h: 20 (WebKit::ViewSnapshot::setDeviceScaleFactor): 21 (WebKit::ViewSnapshot::deviceScaleFactor): 22 (WebKit::ViewSnapshot::surface): 23 (WebKit::ViewSnapshot::imageSizeInBytes): 24 (WebKit::ViewSnapshot::size): 25 * UIProcess/mac/ViewSnapshotStore.mm: 26 (WebKit::ViewSnapshotStore::singleton): 27 (WebKit::ViewSnapshotStore::snapshottingContext): 28 (WebKit::ViewSnapshotStore::didAddImageToSnapshot): 29 (WebKit::ViewSnapshotStore::discardSnapshotImages): 30 (WebKit::ViewSnapshot::create): 31 (WebKit::ViewSnapshot::ViewSnapshot): 32 (WebKit::ViewSnapshot::~ViewSnapshot): 33 (WebKit::ViewSnapshot::setSurface): 34 (WebKit::ViewSnapshot::hasImage): 35 (WebKit::ViewSnapshot::clearImage): 36 (WebKit::ViewSnapshot::asLayerContents): 37 1 38 2015-11-12 Matthew Hanson <matthew_hanson@apple.com> 2 39 -
branches/safari-601.1.46-branch/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm
r192417 r192418 1110 1110 1111 1111 CATransform3D transform = CATransform3DMakeScale(deviceScale, deviceScale, 1); 1112 1113 #if USE(IOSURFACE) 1112 1114 auto surface = WebCore::IOSurface::create(WebCore::expandedIntSize(snapshotSize), WebCore::ColorSpaceDeviceRGB); 1113 1115 CARenderServerRenderLayerWithTransform(MACH_PORT_NULL, self.layer.context.contextId, reinterpret_cast<uint64_t>(self.layer), surface->surface(), 0, 0, &transform); 1114 1116 1115 1117 return WebKit::ViewSnapshot::create(nullptr); 1118 #else 1119 uint32_t slotID = [WebKit::ViewSnapshotStore::snapshottingContext() createImageSlot:snapshotSize hasAlpha:YES]; 1120 1121 if (!slotID) 1122 return nullptr; 1123 1124 CARenderServerCaptureLayerWithTransform(MACH_PORT_NULL, self.layer.context.contextId, (uint64_t)self.layer, slotID, 0, 0, &transform); 1125 WebCore::IntSize imageSize = WebCore::expandedIntSize(WebCore::FloatSize(snapshotSize)); 1126 return WebKit::ViewSnapshot::create(slotID, imageSize, imageSize.width() * imageSize.height() * 4); 1127 #endif 1116 1128 } 1117 1129 -
branches/safari-601.1.46-branch/Source/WebKit2/UIProcess/mac/ViewSnapshotStore.h
r192417 r192418 54 54 class ViewSnapshot : public RefCounted<ViewSnapshot> { 55 55 public: 56 #if USE(IOSURFACE) 56 57 static Ref<ViewSnapshot> create(std::unique_ptr<WebCore::IOSurface>); 58 #else 59 static Ref<ViewSnapshot> create(uint32_t slotID, WebCore::IntSize, size_t imageSizeInBytes); 60 #endif 57 61 58 62 ~ViewSnapshot(); … … 71 75 float deviceScaleFactor() const { return m_deviceScaleFactor; } 72 76 77 #if USE(IOSURFACE) 73 78 WebCore::IOSurface* surface() const { return m_surface.get(); } 74 79 … … 77 82 78 83 void setSurface(std::unique_ptr<WebCore::IOSurface>); 84 #else 85 WebCore::IntSize size() const { return m_size; } 86 #endif 79 87 80 88 private: 89 #if USE(IOSURFACE) 81 90 explicit ViewSnapshot(std::unique_ptr<WebCore::IOSurface>); 82 91 83 92 std::unique_ptr<WebCore::IOSurface> m_surface; 93 #else 94 explicit ViewSnapshot(uint32_t slotID, WebCore::IntSize, size_t imageSizeInBytes); 95 96 uint32_t m_slotID; 97 size_t m_imageSizeInBytes; 98 WebCore::IntSize m_size; 99 #endif 84 100 85 101 uint64_t m_renderTreeSize; … … 101 117 void discardSnapshotImages(); 102 118 119 #if !USE(IOSURFACE) 120 static CAContext *snapshottingContext(); 121 #endif 122 103 123 private: 104 124 void didAddImageToSnapshot(ViewSnapshot&); -
branches/safari-601.1.46-branch/Source/WebKit2/UIProcess/mac/ViewSnapshotStore.mm
r192417 r192418 62 62 } 63 63 64 #if !USE(IOSURFACE) 65 CAContext *ViewSnapshotStore::snapshottingContext() 66 { 67 static CAContext *context; 68 static dispatch_once_t onceToken; 69 dispatch_once(&onceToken, ^{ 70 NSDictionary *options = @{ 71 kCAContextDisplayName: @"WebKitSnapshotting", 72 kCAContextIgnoresHitTest: @YES, 73 kCAContextDisplayId : @20000 74 }; 75 context = [[CAContext remoteContextWithOptions:options] retain]; 76 }); 77 78 return context; 79 } 80 #endif 81 64 82 void ViewSnapshotStore::didAddImageToSnapshot(ViewSnapshot& snapshot) 65 83 { … … 114 132 } 115 133 134 #if USE(IOSURFACE) 116 135 Ref<ViewSnapshot> ViewSnapshot::create(std::unique_ptr<IOSurface> surface) 117 136 { 118 137 return adoptRef(*new ViewSnapshot(WTF::move(surface))); 119 138 } 120 139 #else 140 Ref<ViewSnapshot> ViewSnapshot::create(uint32_t slotID, IntSize size, size_t imageSizeInBytes) 141 { 142 return adoptRef(*new ViewSnapshot(slotID, size, imageSizeInBytes)); 143 } 144 #endif 145 146 #if USE(IOSURFACE) 121 147 ViewSnapshot::ViewSnapshot(std::unique_ptr<IOSurface> surface) 122 148 : m_surface(WTF::move(surface)) 149 #else 150 ViewSnapshot::ViewSnapshot(uint32_t slotID, IntSize size, size_t imageSizeInBytes) 151 : m_slotID(slotID) 152 , m_imageSizeInBytes(imageSizeInBytes) 153 , m_size(size) 154 #endif 123 155 { 124 156 if (hasImage()) … … 131 163 } 132 164 165 #if USE(IOSURFACE) 133 166 void ViewSnapshot::setSurface(std::unique_ptr<WebCore::IOSurface> surface) 134 167 { … … 142 175 ViewSnapshotStore::singleton().didAddImageToSnapshot(*this); 143 176 } 177 #endif 144 178 145 179 bool ViewSnapshot::hasImage() const 146 180 { 181 #if USE(IOSURFACE) 147 182 return !!m_surface; 183 #else 184 return m_slotID; 185 #endif 148 186 } 149 187 … … 155 193 ViewSnapshotStore::singleton().willRemoveImageFromSnapshot(*this); 156 194 195 #if USE(IOSURFACE) 157 196 m_surface = nullptr; 197 #else 198 [ViewSnapshotStore::snapshottingContext() deleteSlot:m_slotID]; 199 m_slotID = 0; 200 m_imageSizeInBytes = 0; 201 #endif 158 202 } 159 203 160 204 id ViewSnapshot::asLayerContents() 161 205 { 206 #if USE(IOSURFACE) 162 207 if (!m_surface) 163 208 return nullptr; … … 169 214 170 215 return (id)m_surface->surface(); 216 #else 217 return [CAContext objectForSlot:m_slotID]; 218 #endif 171 219 } 172 220
Note: See TracChangeset
for help on using the changeset viewer.