Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Pass the right color space over to the web process so we can set it o…
…n our CA context https://bugs.webkit.org/show_bug.cgi?id=88819 <rdar://problem/11629050> Reviewed by John Sullivan. Source/WebKit2: * Platform/mac/LayerHostingContext.h: (LayerHostingContext): * Platform/mac/LayerHostingContext.mm: (WebKit::LayerHostingContext::createForPort): (WebKit::LayerHostingContext::createForWindowServer): Use a single constructor and explicitly set up the parameters of the constructed object. (WebKit::LayerHostingContext::setColorSpace): (WebKit::LayerHostingContext::colorSpace): Add getter and setter. * Scripts/webkit2/messages.py: (struct_or_class): WebKit::ColorSpaceData is a struct. * Shared/WebPageCreationParameters.cpp: Encode and decode the color space parameter. * Shared/WebPageCreationParameters.h: Add the color space. * Shared/mac/ColorSpaceData.h: Added. * Shared/mac/ColorSpaceData.mm: Added. Add a new class that represents a color space that can be sent over the wire. * UIProcess/API/mac/PageClientImpl.h: * UIProcess/API/mac/PageClientImpl.mm: (WebKit::PageClientImpl::colorSpace): Call through to the WKView. * UIProcess/API/mac/WKView.mm: (-[WKView _windowDidChangeBackingProperties:]): Fix whitespace. (-[WKView viewDidChangeBackingProperties]): Check if our new color space is different from the current one and null the current one out if that is the case, it will be reinitialized by the next call to -[WKView _colorSpace]. (-[WKView _colorSpace:]): Compute the color space. If we're not in a window we'll get the main screen's color space. * UIProcess/DrawingAreaProxy.h: (WebKit::DrawingAreaProxy::colorSpaceDidChange): Add empty stub. * UIProcess/PageClient.h: Add colorSpace getter. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::creationParameters): Initialize the color space. * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.h: * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm: (WebKit::TiledCoreAnimationDrawingAreaProxy::colorSpaceDidChange): Send the new color space over to the web process. * UIProcess/mac/WebPageProxyMac.mm: (WebKit::WebPageProxy::colorSpace): Call through to the page client. * WebKit2.xcodeproj/project.pbxproj: Add ColorSpaceData.h and ColorSpaceData.mm. * WebProcess/WebPage/DrawingArea.h: * WebProcess/WebPage/DrawingArea.messages.in: Add SetColorSpace message. * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm: (WebKit::TiledCoreAnimationDrawingArea::TiledCoreAnimationDrawingArea): Set the color space from the creation parameters. (WebKit::TiledCoreAnimationDrawingArea::setColorSpace): Set the color space on the layer hosting context. (WebKit::TiledCoreAnimationDrawingArea::updateLayerHostingContext): Make sure we apply the color space from the previous layer hosting context if one exists. WebKitLibraries: Add WKCAContextSetColorSpace and WKCAContextGetColorSpace. * WebKitSystemInterface.h: * libWebKitSystemInterfaceLion.a: * libWebKitSystemInterfaceSnowLeopard.a: Canonical link: https://commits.webkit.org/106654@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@120021 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information
Anders Carlsson
committed
Jun 12, 2012
1 parent
9298ae1
commit 8078050
Showing
28 changed files
with
378 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* | ||
* Copyright (C) 2012 Apple Inc. All rights reserved. | ||
* | ||
* Redistribution and use in source and binary forms, with or without | ||
* modification, are permitted provided that the following conditions | ||
* are met: | ||
* 1. Redistributions of source code must retain the above copyright | ||
* notice, this list of conditions and the following disclaimer. | ||
* 2. Redistributions in binary form must reproduce the above copyright | ||
* notice, this list of conditions and the following disclaimer in the | ||
* documentation and/or other materials provided with the distribution. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' | ||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | ||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS | ||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF | ||
* THE POSSIBILITY OF SUCH DAMAGE. | ||
*/ | ||
|
||
#ifndef ColorSpaceData_h | ||
#define ColorSpaceData_h | ||
|
||
#include <wtf/RetainPtr.h> | ||
|
||
namespace CoreIPC { | ||
class ArgumentDecoder; | ||
class ArgumentEncoder; | ||
} | ||
|
||
namespace WebKit { | ||
|
||
struct ColorSpaceData { | ||
void encode(CoreIPC::ArgumentEncoder*) const; | ||
static bool decode(CoreIPC::ArgumentDecoder*, ColorSpaceData&); | ||
|
||
RetainPtr<CGColorSpaceRef> cgColorSpace; | ||
}; | ||
|
||
} // namespace WebKit | ||
|
||
#endif // ColorSpaceData_h |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
/* | ||
* Copyright (C) 2012 Apple Inc. All rights reserved. | ||
* | ||
* Redistribution and use in source and binary forms, with or without | ||
* modification, are permitted provided that the following conditions | ||
* are met: | ||
* 1. Redistributions of source code must retain the above copyright | ||
* notice, this list of conditions and the following disclaimer. | ||
* 2. Redistributions in binary form must reproduce the above copyright | ||
* notice, this list of conditions and the following disclaimer in the | ||
* documentation and/or other materials provided with the distribution. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' | ||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | ||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS | ||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF | ||
* THE POSSIBILITY OF SUCH DAMAGE. | ||
*/ | ||
|
||
#include "config.h" | ||
#include "ColorSpaceData.h" | ||
|
||
#include "ArgumentCodersCF.h" | ||
#include "ArgumentDecoder.h" | ||
#include "ArgumentEncoder.h" | ||
|
||
namespace WebKit { | ||
|
||
enum EncodedDataType { | ||
Null, | ||
Name, | ||
Data, | ||
}; | ||
|
||
void ColorSpaceData::encode(CoreIPC::ArgumentEncoder* encoder) const | ||
{ | ||
if (cgColorSpace) { | ||
// Try to encode the name. | ||
if (RetainPtr<CFStringRef> name = adoptCF(CGColorSpaceCopyName(cgColorSpace.get()))) { | ||
encoder->encodeEnum(Name); | ||
CoreIPC::encode(encoder, name.get()); | ||
return; | ||
} | ||
|
||
// Failing that, just encode the ICC data. | ||
if (RetainPtr<CFDataRef> profileData = adoptCF(CGColorSpaceCopyICCProfile(cgColorSpace.get()))) { | ||
encoder->encodeEnum(Data); | ||
CoreIPC::encode(encoder, profileData.get()); | ||
return; | ||
} | ||
} | ||
|
||
// The color space was null or failed to be encoded. | ||
encoder->encodeEnum(Null); | ||
} | ||
|
||
bool ColorSpaceData::decode(CoreIPC::ArgumentDecoder* decoder, ColorSpaceData& colorSpaceData) | ||
{ | ||
EncodedDataType dataType; | ||
if (!decoder->decodeEnum(dataType)) | ||
return false; | ||
|
||
switch (dataType) { | ||
case Null: | ||
colorSpaceData.cgColorSpace = nullptr; | ||
return true; | ||
case Name: { | ||
RetainPtr<CFStringRef> name; | ||
if (!CoreIPC::decode(decoder, name)) | ||
return false; | ||
|
||
colorSpaceData.cgColorSpace = adoptCF(CGColorSpaceCreateWithName(name.get())); | ||
return true; | ||
} | ||
case Data: { | ||
RetainPtr<CFDataRef> data; | ||
if (!CoreIPC::decode(decoder, data)) | ||
return false; | ||
|
||
colorSpaceData.cgColorSpace = adoptCF(CGColorSpaceCreateWithICCProfile(data.get())); | ||
return true; | ||
} | ||
|
||
default: | ||
return false; | ||
} | ||
} | ||
|
||
} // namespace WebKit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.