Make some improvements in CSSImageGeneratorValue code
https://bugs.webkit.org/show_bug.cgi?id=125676

Reviewed by Simon Fraser.

* css/CSSCrossfadeValue.cpp:
(WebCore::subimageKnownToBeOpaque): Take a reference to the CSSValue, since
it's known not to be null. Used checked cast.
(WebCore::CSSCrossfadeValue::knownToBeOpaque): Updated to pass a reference.

* css/CSSImageGeneratorValue.cpp:
(WebCore::CSSImageGeneratorValue::saveCachedImageForSize): Use
make_unique instead of adoptPtr.
(WebCore::CSSImageGeneratorValue::subimageIsPending): Use checked cast.
(WebCore::CSSImageGeneratorValue::cachedImageForCSSValue): Ditto, also
use nullptr.

* css/CSSImageGeneratorValue.h: Removed unneeded includes, added some forward
declarations, used unique_ptr instead of OwnPtr, and used CSS_VALUE_TYPE_CASTS
macro to create cast functions.

* css/CSSValue.cpp: Removed unneeded include of CSSImageGeneratorValue.h.

* css/StyleResolver.cpp:
(WebCore::StyleResolver::State::clear): Use nullptr instead of 0.
(WebCore::StyleResolver::applyProperty): Use checked cast and pass references
instead of pointers to StyleGeneratedImage::create.
(WebCore::StyleResolver::styleImage): Use checked cast and pass references
instead of pointers to generatedOrPendingFromValue.
(WebCore::StyleResolver::generatedOrPendingFromValue): Take the value as a
reference instead of a pointer.
(WebCore::StyleResolver::loadPendingImage): Pass a refernece instead of a
pointer to StyleGeneratedImage::create.
(WebCore::StyleResolver::loadPendingImages): Use auto for iteration instead of
a lot type name.

* css/StyleResolver.h: Changed generatedOrPendingFromValue to take the value
as a reference instead of a pointer.

* page/animation/CSSPropertyAnimation.cpp:
(WebCore::blendFilter): Pass a reference insted of a pointer to
StyleGeneratedImage::create.
(WebCore::crossfadeBlend): Ditto.
(WebCore::blendFunc): Ditto. Also use references for local variables.

* rendering/style/StyleGeneratedImage.cpp:
(WebCore::StyleGeneratedImage::StyleGeneratedImage): Use PassRef instead of
PassRefPtr for the argument type.
(WebCore::StyleGeneratedImage::cssValue): Updated since m_imageGeneratorValue
is now a Ref instead of a RefPtr. Sadly this requires a const_cast that we can
come back and get rid of later.
(WebCore::StyleGeneratedImage::imageSize): Ditto.
(WebCore::StyleGeneratedImage::image): Ditto.

* rendering/style/StyleGeneratedImage.h: Changed create function and constructor
to take a PassRef. Made imageValue non-const since it returns a non-const value,
to be consistent with "conceptual const". Changed m_imageGeneratorValue to be a
Ref instead of a RefPtr.

* rendering/style/StyleImage.h: Made WrappedImagePtr be const void*, since it's
a pointer used only for equality checks. Not a great idiom, but fine to use a
const pointer instead of non-const, and avoids the const_cast we'd otherwise
need in StyleGeneratedImage::data.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@160528 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Fix unsafe memory load/store from the argument encoder/decoder affecting ARM
https://bugs.webkit.org/show_bug.cgi?id=125674

Patch by Benjamin Poulain <bpoulain@apple.com> on 2013-12-12
Reviewed by Darin Adler.

Depending on the CPU and CPU config, load and store may have to be aligned.
The argument buffer has no particular alignment which can cause problems.

In this case, on ARMv7, strd and ldrd can have alignment restriction on 16 bytes.
The code encoding double and 64 bits integers was causing bugs.

To avoid problems, the encoders/decoders are modified to just use memcpy. The compiler optimizes
it away for the right instructions (clang uses two ldr/str in the case of 64bits values on ARMv7).

* Platform/CoreIPC/ArgumentDecoder.cpp:
(CoreIPC::decodeValueFromBuffer):
(CoreIPC::ArgumentDecoder::decode):
* Platform/CoreIPC/ArgumentEncoder.cpp:
(CoreIPC::copyValueToBuffer):
(CoreIPC::ArgumentEncoder::encode):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@160529 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Need ObjC APIs for some InjectedBundle classes.
https://bugs.webkit.org/show_bug.cgi?id=125600

Add ObjC API classes for WebFrame, InjectedBundleScriptWorld, InjectedBundleHitTestResult and InjectedBundleNodeHandle.

Patch by Yongjun Zhang <yongjun_zhang@apple.com> on 2013-12-12
Reviewed by Dan Bernstein.

* Shared/Cocoa/APIObject.mm: creates API wrapper for WebFrame, InjectedBundleScriptWorld, InjectedBundleHitTestResult
     and InjectedBundleNodeHandle.
(API::Object::newObject):
* WebKit2.xcodeproj/project.pbxproj:
* WebProcess/InjectedBundle/API/Cocoa: Added.
* WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFrame.h: Added.
* WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFrame.mm: Added.
(-[WKWebProcessPlugInFrame dealloc]):
(-[WKWebProcessPlugInFrame jsContextForWorld:]): returns the JSContextRef for a ScriptWorld in frame.
(-[WKWebProcessPlugInFrame hitTest:]): returns hitTestResult (with API type) from a hitTest.
(-[WKWebProcessPlugInFrame jsWrapperForNodeHandle:inWorld:]):
(-[WKWebProcessPlugInFrame API::]):
* WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFrameInternal.h: Added.
(WebKit::wrapper):
* WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInHitTestResult.h: Added.
* WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInHitTestResult.mm: Added.
(-[WKWebProcessPlugInHitTestResult dealloc]):
(-[WKWebProcessPlugInHitTestResult nodeHandle]):
(-[WKWebProcessPlugInHitTestResult API::]):
* WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInHitTestResultInternal.h: Added.
(WebKit::wrapper):
* WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandle.h: Added.
* WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandle.mm: Added.
(-[WKWebProcessPlugInNodeHandle dealloc]):
(-[WKWebProcessPlugInNodeHandle API::]):
* WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandleInternal.h: Added.
(WebKit::wrapper):
* WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInScriptWorld.h: Added.
* WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInScriptWorld.mm: Added.
(+[WKWebProcessPlugInScriptWorld world]): returns a new isolated world.
(+[WKWebProcessPlugInScriptWorld normalWorld]): returns the mainThread normal world.
(-[WKWebProcessPlugInScriptWorld dealloc]):
(-[WKWebProcessPlugInScriptWorld API::]):
* WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInScriptWorldInternal.h: Added.
(WebKit::wrapper):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@160530 268f45cc-cd09-0410-ab3c-d52691b4dbfc