Changeset 192418 in webkit


Ignore:
Timestamp:
Nov 13, 2015 9:02:44 AM (8 years ago)
Author:
matthew_hanson@apple.com
Message:

Merge r189635. rdar://problem/22846841

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  
     12015-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
    1382015-11-12  Matthew Hanson  <matthew_hanson@apple.com>
    239
  • branches/safari-601.1.46-branch/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm

    r192417 r192418  
    11101110
    11111111    CATransform3D transform = CATransform3DMakeScale(deviceScale, deviceScale, 1);
     1112
     1113#if USE(IOSURFACE)
    11121114    auto surface = WebCore::IOSurface::create(WebCore::expandedIntSize(snapshotSize), WebCore::ColorSpaceDeviceRGB);
    11131115    CARenderServerRenderLayerWithTransform(MACH_PORT_NULL, self.layer.context.contextId, reinterpret_cast<uint64_t>(self.layer), surface->surface(), 0, 0, &transform);
    11141116
    11151117    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
    11161128}
    11171129
  • branches/safari-601.1.46-branch/Source/WebKit2/UIProcess/mac/ViewSnapshotStore.h

    r192417 r192418  
    5454class ViewSnapshot : public RefCounted<ViewSnapshot> {
    5555public:
     56#if USE(IOSURFACE)
    5657    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
    5761
    5862    ~ViewSnapshot();
     
    7175    float deviceScaleFactor() const { return m_deviceScaleFactor; }
    7276
     77#if USE(IOSURFACE)
    7378    WebCore::IOSurface* surface() const { return m_surface.get(); }
    7479
     
    7782
    7883    void setSurface(std::unique_ptr<WebCore::IOSurface>);
     84#else
     85    WebCore::IntSize size() const { return m_size; }
     86#endif
    7987
    8088private:
     89#if USE(IOSURFACE)
    8190    explicit ViewSnapshot(std::unique_ptr<WebCore::IOSurface>);
    8291
    8392    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
    84100
    85101    uint64_t m_renderTreeSize;
     
    101117    void discardSnapshotImages();
    102118
     119#if !USE(IOSURFACE)
     120    static CAContext *snapshottingContext();
     121#endif
     122
    103123private:
    104124    void didAddImageToSnapshot(ViewSnapshot&);
  • branches/safari-601.1.46-branch/Source/WebKit2/UIProcess/mac/ViewSnapshotStore.mm

    r192417 r192418  
    6262}
    6363
     64#if !USE(IOSURFACE)
     65CAContext *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
    6482void ViewSnapshotStore::didAddImageToSnapshot(ViewSnapshot& snapshot)
    6583{
     
    114132}
    115133
     134#if USE(IOSURFACE)
    116135Ref<ViewSnapshot> ViewSnapshot::create(std::unique_ptr<IOSurface> surface)
    117136{
    118137    return adoptRef(*new ViewSnapshot(WTF::move(surface)));
    119138}
    120 
     139#else
     140Ref<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)
    121147ViewSnapshot::ViewSnapshot(std::unique_ptr<IOSurface> surface)
    122148    : m_surface(WTF::move(surface))
     149#else
     150ViewSnapshot::ViewSnapshot(uint32_t slotID, IntSize size, size_t imageSizeInBytes)
     151    : m_slotID(slotID)
     152    , m_imageSizeInBytes(imageSizeInBytes)
     153    , m_size(size)
     154#endif
    123155{
    124156    if (hasImage())
     
    131163}
    132164
     165#if USE(IOSURFACE)
    133166void ViewSnapshot::setSurface(std::unique_ptr<WebCore::IOSurface> surface)
    134167{
     
    142175    ViewSnapshotStore::singleton().didAddImageToSnapshot(*this);
    143176}
     177#endif
    144178
    145179bool ViewSnapshot::hasImage() const
    146180{
     181#if USE(IOSURFACE)
    147182    return !!m_surface;
     183#else
     184    return m_slotID;
     185#endif
    148186}
    149187
     
    155193    ViewSnapshotStore::singleton().willRemoveImageFromSnapshot(*this);
    156194
     195#if USE(IOSURFACE)
    157196    m_surface = nullptr;
     197#else
     198    [ViewSnapshotStore::snapshottingContext() deleteSlot:m_slotID];
     199    m_slotID = 0;
     200    m_imageSizeInBytes = 0;
     201#endif
    158202}
    159203
    160204id ViewSnapshot::asLayerContents()
    161205{
     206#if USE(IOSURFACE)
    162207    if (!m_surface)
    163208        return nullptr;
     
    169214
    170215    return (id)m_surface->surface();
     216#else
     217    return [CAContext objectForSlot:m_slotID];
     218#endif
    171219}
    172220
Note: See TracChangeset for help on using the changeset viewer.