diff options
author | Simon Hausmann <simon.hausmann@nokia.com> | 2012-06-01 10:36:58 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@nokia.com> | 2012-06-01 10:36:58 +0200 |
commit | b1e9e47fa11f608ae16bc07f97a2acf95bf80272 (patch) | |
tree | c88c45e80c9c44506e7cdf9a3bb39ebf82a8cd5b /Source/WebKit | |
parent | be01689f43cf6882cf670d33df49ead1f570c53a (diff) | |
download | qtwebkit-b1e9e47fa11f608ae16bc07f97a2acf95bf80272.tar.gz |
Imported WebKit commit 499c84c99aa98e9870fa7eaa57db476c6d160d46 (http://svn.webkit.org/repository/webkit/trunk@119200)
Weekly update :). Particularly relevant changes for Qt are the use of the WebCore image decoders and direct usage
of libpng/libjpeg if available in the system.
Diffstat (limited to 'Source/WebKit')
168 files changed, 7794 insertions, 1144 deletions
diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog index ec3627150..ae67e33ef 100644 --- a/Source/WebKit/ChangeLog +++ b/Source/WebKit/ChangeLog @@ -1,3 +1,68 @@ +2012-05-31 Gyuyoung Kim <gyuyoung.kim@samsung.com> + + [CMAKE][EFL] Remove unneeded include path + https://bugs.webkit.org/show_bug.cgi?id=87927 + + Reviewed by Kenneth Rohde Christiansen. + + Though *wtf* directory was moved to Source/WTF, PlatformEfl.cmake is still including the previous + path. In addition, files on EFL port are using <wtf/gobject/XXX> directly in #include line. + So, EFL port doesn't need to include ${JAVASCRIPTCORE_DIR}/wtf/gobject path anymore. + + * PlatformEfl.cmake: Remove '${JAVASCRIPTCORE_DIR}/wtf/gobject' path from include path list. + +2012-05-30 Konrad Piascik <kpiascik@rim.com> + + [BlackBerry] Add an Accelerated Compositing layer for Web Inspector DOM highlight. + https://bugs.webkit.org/show_bug.cgi?id=81001 + + Reviewed by Antonio Gomes + + Added new InspectorOverlay class + + * PlatformBlackBerry.cmake: + +2012-05-29 Arvid Nilsson <anilsson@rim.com> + + [BlackBerry] WebKit-side implementation of SelectionOverlay + https://bugs.webkit.org/show_bug.cgi?id=87605 + + Reviewed by Rob Buis. + + Add SelectionOverlay to the build system. + + PR #160263 + + * PlatformBlackBerry.cmake: + +2012-05-29 Arvid Nilsson <anilsson@rim.com> + + [BlackBerry] WebOverlay API + https://bugs.webkit.org/show_bug.cgi?id=87603 + + Reviewed by Rob Buis. + + Add WebOverlay related files to the build system. + + PR #156812 + + * PlatformBlackBerry.cmake: + +2012-05-28 Arvid Nilsson <anilsson@rim.com> + + [BlackBerry] Add a default tap highlight + https://bugs.webkit.org/show_bug.cgi?id=87569 + + Reviewed by Rob Buis. + + Add DefaultTapHighlight to the build system + + Reviewed internally by Mike Lattanzio and Mike Fenton. + + PR #154329 + + * PlatformBlackBerry.cmake: + 2012-05-24 Crystal Zhang <haizhang@rim.com> [BlackBerry] Implement select popup and remove old hook to air popup diff --git a/Source/WebKit/PlatformBlackBerry.cmake b/Source/WebKit/PlatformBlackBerry.cmake index ef935212d..b5620273a 100644 --- a/Source/WebKit/PlatformBlackBerry.cmake +++ b/Source/WebKit/PlatformBlackBerry.cmake @@ -47,13 +47,16 @@ ADD_DEFINITIONS(-DUSER_PROCESSES) LIST(APPEND WebKit_SOURCES blackberry/Api/BackingStore.cpp blackberry/Api/BlackBerryGlobal.cpp - blackberry/Api/WebString.cpp + blackberry/Api/WebAnimation.cpp blackberry/Api/WebKitMIMETypeConverter.cpp blackberry/Api/WebKitTextCodec.cpp + blackberry/Api/WebOverlay.cpp + blackberry/Api/WebOverlayOverride.cpp blackberry/Api/WebPage.cpp blackberry/Api/WebPageCompositor.cpp blackberry/Api/WebPageGroupLoadDeferrer.cpp blackberry/Api/WebSettings.cpp + blackberry/Api/WebString.cpp blackberry/Api/WebViewportArguments.cpp blackberry/WebCoreSupport/AboutData.cpp blackberry/WebCoreSupport/AutofillManager.cpp @@ -72,6 +75,7 @@ LIST(APPEND WebKit_SOURCES blackberry/WebCoreSupport/GeolocationControllerClientBlackBerry.cpp blackberry/WebCoreSupport/IconDatabaseClientBlackBerry.cpp blackberry/WebCoreSupport/InspectorClientBlackBerry.cpp + blackberry/WebCoreSupport/InspectorOverlay.cpp blackberry/WebCoreSupport/JavaScriptDebuggerBlackBerry.cpp blackberry/WebCoreSupport/NotificationPresenterImpl.cpp blackberry/WebCoreSupport/VibrationClientBlackBerry.cpp @@ -80,12 +84,14 @@ LIST(APPEND WebKit_SOURCES blackberry/WebKitSupport/BackingStoreCompositingSurface.cpp blackberry/WebKitSupport/BackingStoreTile.cpp blackberry/WebKitSupport/BackingStoreClient.cpp + blackberry/WebKitSupport/DefaultTapHighlight.cpp blackberry/WebKitSupport/DOMSupport.cpp blackberry/WebKitSupport/FrameLayers.cpp blackberry/WebKitSupport/InPageSearchManager.cpp blackberry/WebKitSupport/InputHandler.cpp blackberry/WebKitSupport/RenderQueue.cpp blackberry/WebKitSupport/SelectionHandler.cpp + blackberry/WebKitSupport/SelectionOverlay.cpp blackberry/WebKitSupport/SurfacePool.cpp blackberry/WebKitSupport/TouchEventHandler.cpp blackberry/WebKitSupport/FatFingers.cpp diff --git a/Source/WebKit/PlatformEfl.cmake b/Source/WebKit/PlatformEfl.cmake index a630bacc5..54663cd47 100644 --- a/Source/WebKit/PlatformEfl.cmake +++ b/Source/WebKit/PlatformEfl.cmake @@ -10,7 +10,6 @@ LIST(APPEND WebKit_INCLUDE_DIRECTORIES "${WEBKIT_DIR}/efl/ewk" "${WEBKIT_DIR}/efl/WebCoreSupport" "${JAVASCRIPTCORE_DIR}/ForwardingHeaders" - "${JAVASCRIPTCORE_DIR}/wtf/gobject" "${WEBCORE_DIR}/platform/efl" "${WEBCORE_DIR}/platform/graphics/cairo" "${WEBCORE_DIR}/platform/graphics/efl" diff --git a/Source/WebKit/blackberry/Api/BackingStore.cpp b/Source/WebKit/blackberry/Api/BackingStore.cpp index 929cd9921..619c43968 100644 --- a/Source/WebKit/blackberry/Api/BackingStore.cpp +++ b/Source/WebKit/blackberry/Api/BackingStore.cpp @@ -1028,8 +1028,6 @@ bool BackingStorePrivate::render(const Platform::IntRect& rect) m_suspendBackingStoreUpdates ? "true" : "false"); #endif - bool blittingDirectlyToCompositingWindow = isOpenGLCompositing(); - BackingStoreGeometry* currentState = frontState(); TileMap currentMap = currentState->tileMap(); @@ -1078,7 +1076,11 @@ bool BackingStorePrivate::render(const Platform::IntRect& rect) BlackBerry::Platform::Graphics::Buffer* nativeBuffer = tile->backBuffer()->nativeBuffer(); - if (blittingDirectlyToCompositingWindow) { + // This code is only needed for EGLImage code path, and only effective if we are swapping the render target. + // This combination is only true if there's a GLES2Usage window. + // FIXME: Use an EGL fence instead, PR152132 + Window* window = m_webPage->client()->window(); + if (window && window->windowUsage() == Window::GLES2Usage) { pthread_mutex_lock(&m_blitGenerationLock); while (m_blitGeneration == tile->backBuffer()->blitGeneration()) { int err = pthread_cond_timedwait(&m_blitGenerationCond, &m_blitGenerationLock, &m_currentBlitEnd); @@ -1532,8 +1534,6 @@ void BackingStorePrivate::blitContents(const Platform::IntRect& dstRect, } } - bool blittingDirectlyToCompositingWindow = isOpenGLCompositing(); - #if USE(ACCELERATED_COMPOSITING) if (WebPageCompositorPrivate* compositor = m_webPage->d->compositor()) { WebCore::FloatRect contentsRect = m_webPage->d->mapFromTransformedFloatRect(WebCore::FloatRect(WebCore::IntRect(contents))); @@ -1542,7 +1542,7 @@ void BackingStorePrivate::blitContents(const Platform::IntRect& dstRect, paintDefaultBackground(contents, transformation, false /*flush*/); } - if (!blittingDirectlyToCompositingWindow) + if (!isOpenGLCompositing()) blendCompositingSurface(dstRect); #endif @@ -1604,7 +1604,11 @@ void BackingStorePrivate::blitContents(const Platform::IntRect& dstRect, invalidateWindow(dstRect); - if (blittingDirectlyToCompositingWindow && !blittedTiles.isEmpty()) { + // This code is only needed for EGLImage code path, and only effective if we are swapping the render target. + // This combination is only true if there's a GLES2Usage window. + // FIXME: Use an EGL fence instead + Window* window = m_webPage->client()->window(); + if (window && window->windowUsage() == Window::GLES2Usage && !blittedTiles.isEmpty()) { pthread_mutex_lock(&m_blitGenerationLock); ++m_blitGeneration; @@ -1623,6 +1627,73 @@ void BackingStorePrivate::blitContents(const Platform::IntRect& dstRect, } } +#if USE(ACCELERATED_COMPOSITING) +void BackingStorePrivate::compositeContents(WebCore::LayerRenderer* layerRenderer, const WebCore::TransformationMatrix& transform, const WebCore::FloatRect& contents) +{ + const Platform::IntRect transformedContentsRect = Platform::IntRect(Platform::IntPoint(0, 0), m_client->transformedContentsSize()); + Platform::IntRect transformedContents = enclosingIntRect(m_webPage->d->m_transformationMatrix->mapRect(contents)); + transformedContents.intersect(transformedContentsRect); + if (transformedContents.isEmpty()) + return; + + if (!isActive()) + return; + + if (m_webPage->d->compositorDrawsRootLayer()) + return; + + BackingStoreGeometry* currentState = frontState(); + TileMap currentMap = currentState->tileMap(); + + Platform::IntRectRegion transformedContentsRegion = transformedContents; + Platform::IntRectRegion backingStoreRegion = currentState->backingStoreRect(); + Platform::IntRectRegion checkeredRegion + = Platform::IntRectRegion::subtractRegions(transformedContentsRegion, backingStoreRegion); + + // Blit checkered to those parts that are not covered by the backingStoreRect. + IntRectList checkeredRects = checkeredRegion.rects(); + for (size_t i = 0; i < checkeredRects.size(); ++i) + layerRenderer->drawCheckerboardPattern(transform, m_webPage->d->mapFromTransformedFloatRect(WebCore::IntRect(checkeredRects.at(i)))); + + // Get the list of tile rects that makeup the content. + TileRectList tileRectList = mapFromTransformedContentsToTiles(transformedContents, currentState); + for (size_t i = 0; i < tileRectList.size(); ++i) { + TileRect tileRect = tileRectList[i]; + TileIndex index = tileRect.first; + Platform::IntRect dirtyTileRect = tileRect.second; + BackingStoreTile* tile = currentMap.get(index); + TileBuffer* tileBuffer = tile->frontBuffer(); + + // This dirty rect is in tile coordinates, but it needs to be in + // transformed contents coordinates. + Platform::IntRect dirtyRect = mapFromTilesToTransformedContents(tileRect, currentState->backingStoreRect()); + + if (!dirtyRect.intersects(transformedContents)) + continue; + + TileRect wholeTileRect; + wholeTileRect.first = index; + wholeTileRect.second = this->tileRect(); + + Platform::IntRect wholeRect = mapFromTilesToTransformedContents(wholeTileRect, currentState->backingStoreRect()); + + bool committed = tile->isCommitted(); + + if (!committed) + layerRenderer->drawCheckerboardPattern(transform, m_webPage->d->mapFromTransformedFloatRect(Platform::FloatRect(dirtyRect))); + else { + layerRenderer->compositeBuffer(transform, m_webPage->d->mapFromTransformedFloatRect(Platform::FloatRect(wholeRect)), tileBuffer->nativeBuffer(), 1.0f); + + // Intersect the rendered region. + Platform::IntRectRegion notRenderedRegion = Platform::IntRectRegion::subtractRegions(dirtyTileRect, tileBuffer->renderedRegion()); + IntRectList notRenderedRects = notRenderedRegion.rects(); + for (size_t i = 0; i < notRenderedRects.size(); ++i) + layerRenderer->drawCheckerboardPattern(transform, m_webPage->d->mapFromTransformedFloatRect(Platform::FloatRect(notRenderedRects.at(i)))); + } + } +} +#endif + Platform::IntRect BackingStorePrivate::blitTileRect(TileBuffer* tileBuffer, const TileRect& tileRect, const Platform::IntPoint& origin, @@ -2372,7 +2443,8 @@ void BackingStorePrivate::renderContents(BlackBerry::Platform::Graphics::Buffer* if (m_webPage->d->m_page->inspectorController()->enabled()) { WebCore::IntPoint scrollPosition = m_client->frame()->view()->scrollPosition(); graphicsContext.translate(scrollPosition.x(), scrollPosition.y()); - m_webPage->d->m_page->inspectorController()->drawHighlight(graphicsContext); + if (m_webPage->d->m_inspectorOverlay) + m_webPage->d->m_inspectorOverlay->paintWebFrame(graphicsContext); } #endif diff --git a/Source/WebKit/blackberry/Api/BackingStore_p.h b/Source/WebKit/blackberry/Api/BackingStore_p.h index fa80a319a..36c2f638b 100644 --- a/Source/WebKit/blackberry/Api/BackingStore_p.h +++ b/Source/WebKit/blackberry/Api/BackingStore_p.h @@ -32,6 +32,8 @@ namespace WebCore { class IntRect; +class FloatRect; +class LayerRenderer; class TransformationMatrix; } @@ -196,8 +198,15 @@ public: Platform::IntRect blitTileRect(TileBuffer*, const TileRect&, const Platform::IntPoint&, const WebCore::TransformationMatrix&, BackingStoreGeometry*); #if USE(ACCELERATED_COMPOSITING) + // Use instead of blitContents if you need more control over OpenGL state. + // Note that contents is expressed in untransformed content coordinates. + // Preconditions: You have to call prepareFrame and setViewport on the LayerRenderer before + // calling this. + void compositeContents(WebCore::LayerRenderer*, const WebCore::TransformationMatrix&, const WebCore::FloatRect& contents); + void blendCompositingSurface(const Platform::IntRect& dstRect); void clearCompositingSurface(); + bool drawLayersOnCommitIfNeeded(); void drawAndBlendLayersForDirectRendering(const Platform::IntRect& dirtyRect); // WebPage will call this when drawing layers to tell us we don't need to diff --git a/Source/WebKit/blackberry/Api/DumpRenderTreeClient.h b/Source/WebKit/blackberry/Api/DumpRenderTreeClient.h index 03eb5bbc5..ce6dd2743 100644 --- a/Source/WebKit/blackberry/Api/DumpRenderTreeClient.h +++ b/Source/WebKit/blackberry/Api/DumpRenderTreeClient.h @@ -25,6 +25,7 @@ #include <JavaScriptCore/JSObjectRef.h> namespace WebCore { +class Credential; class Frame; class DOMWrapperWorld; class NavigationAction; @@ -81,6 +82,7 @@ public: virtual bool shouldInsertNode(WebCore::Node*, WebCore::Range*, int insertAction) = 0; virtual bool shouldInsertText(const WTF::String&, WebCore::Range*, int insertAction) = 0; virtual bool isSelectTrailingWhitespaceEnabled() const = 0; + virtual bool didReceiveAuthenticationChallenge(WebCore::Credential&) = 0; }; } diff --git a/Source/WebKit/blackberry/Api/WebAnimation.cpp b/Source/WebKit/blackberry/Api/WebAnimation.cpp new file mode 100644 index 000000000..11b0ddd56 --- /dev/null +++ b/Source/WebKit/blackberry/Api/WebAnimation.cpp @@ -0,0 +1,80 @@ +/* + * Copyright (C) 2012 Research In Motion Limited. All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "config.h" + +#include "WebAnimation.h" + +#if USE(ACCELERATED_COMPOSITING) +#include "GraphicsLayer.h" +#include "LayerCompositingThread.h" +#include "LayerWebKitThread.h" +#include "WebAnimation_p.h" +#include "WebString.h" + +#include <BlackBerryPlatformMessageClient.h> + +namespace BlackBerry { +namespace WebKit { + +using namespace WebCore; + +WebAnimation WebAnimation::fadeAnimation(const WebString& name, float from, float to, double duration) +{ + WebAnimation tmp; + tmp.d->name = String(name.impl()); + tmp.d->animation = Animation::create(); + tmp.d->animation->setDuration(duration); + tmp.d->keyframes = KeyframeValueList(AnimatedPropertyOpacity); + tmp.d->keyframes.insert(new FloatAnimationValue(0, from)); + tmp.d->keyframes.insert(new FloatAnimationValue(1.0, to)); + + return tmp; +} + +WebString WebAnimation::name() const +{ + return d->name.impl(); +} + +WebAnimation::WebAnimation() + : d(new WebAnimationPrivate) +{ +} + +WebAnimation::WebAnimation(const WebAnimation& o) +: d(new WebAnimationPrivate) +{ + *d = *o.d; +} + +WebAnimation::~WebAnimation() +{ + delete d; +} + +WebAnimation& WebAnimation::operator=(const WebAnimation& o) +{ + *d = *o.d; + return *this; +} + +} // namespace WebKit +} // namespace BlackBerry + +#endif // USE(ACCELERATED_COMPOSITING) diff --git a/Source/WebKit/blackberry/Api/WebAnimation.h b/Source/WebKit/blackberry/Api/WebAnimation.h new file mode 100644 index 000000000..7e9297db5 --- /dev/null +++ b/Source/WebKit/blackberry/Api/WebAnimation.h @@ -0,0 +1,61 @@ +/* + * Copyright (C) 2012 Research In Motion Limited. All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef WebAnimation_h +#define WebAnimation_h + +#include "BlackBerryGlobal.h" + +#include <BlackBerryPlatformPrimitives.h> + +namespace BlackBerry { +namespace WebKit { + +class WebAnimationPrivate; + +/** + * Represents an animation running on an overlay. + * + * WebAnimation is not thread safe, but it is reentrant. This means that + * instances can be created on different threads, but must be used on the + * thread where they were created. + */ +class BLACKBERRY_EXPORT WebAnimation { +public: + static WebAnimation fadeAnimation(const WebString& name, float from, float to, double duration); + + WebAnimation(); + WebAnimation(const WebAnimation&); + ~WebAnimation(); + + WebAnimation& operator=(const WebAnimation&); + + WebString name() const; + +protected: + friend class WebOverlay; + friend class WebOverlayOverride; + friend class WebOverlayPrivate; + + WebAnimationPrivate* d; +}; + +} +} + +#endif // WebAnimation_h diff --git a/Source/WebKit/blackberry/Api/WebAnimation_p.h b/Source/WebKit/blackberry/Api/WebAnimation_p.h new file mode 100644 index 000000000..08ca9aff3 --- /dev/null +++ b/Source/WebKit/blackberry/Api/WebAnimation_p.h @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2012 Research In Motion Limited. All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef WebAnimation_p_h +#define WebAnimation_p_h + +#if USE(ACCELERATED_COMPOSITING) + +#include "Animation.h" +#include "GraphicsLayer.h" +#include "GraphicsLayerClient.h" +#include "IntSize.h" +#include "LayerAnimation.h" + +#include <wtf/text/WTFString.h> + +namespace BlackBerry { +namespace WebKit { + +class WebAnimation; + +class WebAnimationPrivate { +public: + WebAnimationPrivate() + : keyframes(WebCore::AnimatedPropertyInvalid) + { + } + + String name; + RefPtr<WebCore::Animation> animation; + WebCore::KeyframeValueList keyframes; +}; + +} +} + +#endif // USE(ACCELERATED_COMPOSITING) + +#endif // WebAnimation_p_h diff --git a/Source/WebKit/blackberry/Api/WebOverlay.cpp b/Source/WebKit/blackberry/Api/WebOverlay.cpp new file mode 100644 index 000000000..f8bdbead4 --- /dev/null +++ b/Source/WebKit/blackberry/Api/WebOverlay.cpp @@ -0,0 +1,786 @@ +/* + * Copyright (C) 2012 Research In Motion Limited. All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "config.h" + +#include "WebOverlay.h" + +#if USE(ACCELERATED_COMPOSITING) + +#include "LayerWebKitThread.h" +#include "NotImplemented.h" +#include "PlatformContextSkia.h" +#include "TextureCacheCompositingThread.h" +#include "WebAnimation.h" +#include "WebAnimation_p.h" +#include "WebOverlayClient.h" +#include "WebOverlayOverride.h" +#include "WebOverlay_p.h" +#include "WebPageCompositorClient.h" +#include "WebPageCompositor_p.h" +#include "WebPage_p.h" +#include "WebString.h" + +#include <BlackBerryPlatformMessageClient.h> +#include <GLES2/gl2.h> +#include <SkDevice.h> + +namespace BlackBerry { +namespace WebKit { + +using namespace WebCore; + +WebOverlay::WebOverlay() + : d(0) +{ + if (Platform::webKitThreadMessageClient()->isCurrentThread()) { + d = new WebOverlayPrivateWebKitThread; + d->q = this; + } else if (Platform::userInterfaceThreadMessageClient()->isCurrentThread()) { + d = new WebOverlayPrivateCompositingThread; + d->q = this; + } +} + +WebOverlay::WebOverlay(GraphicsLayerClient* client) + : d(0) +{ + d = new WebOverlayPrivateWebKitThread(client); + d->q = this; +} + +WebOverlay::~WebOverlay() +{ + delete d; +} + +Platform::FloatPoint WebOverlay::position() const +{ + return d->position(); +} + +void WebOverlay::setPosition(const Platform::FloatPoint& position) +{ + d->setPosition(position); +} + +Platform::FloatPoint WebOverlay::anchorPoint() const +{ + return d->anchorPoint(); +} + +void WebOverlay::setAnchorPoint(const Platform::FloatPoint& anchor) +{ + d->setAnchorPoint(anchor); +} + +Platform::FloatSize WebOverlay::size() const +{ + return d->size(); +} + +void WebOverlay::setSize(const Platform::FloatSize& size) +{ + d->setSize(size); +} + +bool WebOverlay::sizeIsScaleInvariant() const +{ + return d->sizeIsScaleInvariant(); +} + +void WebOverlay::setSizeIsScaleInvariant(bool invariant) +{ + d->setSizeIsScaleInvariant(invariant); +} + +Platform::TransformationMatrix WebOverlay::transform() const +{ + // FIXME: There is no WebCore::TranformationMatrix interoperability + // with Platform::TransformationMatrix + TransformationMatrix transform = d->transform(); + return reinterpret_cast<const Platform::TransformationMatrix&>(transform); +} + +void WebOverlay::setTransform(const Platform::TransformationMatrix& transform) +{ + d->setTransform(reinterpret_cast<const TransformationMatrix&>(transform)); +} + +float WebOverlay::opacity() const +{ + return d->opacity(); +} + +void WebOverlay::setOpacity(float opacity) +{ + d->setOpacity(opacity); +} + +void WebOverlay::addAnimation(const WebAnimation& animation) +{ + d->addAnimation(animation.d->name, animation.d->animation.get(), animation.d->keyframes); +} + +void WebOverlay::removeAnimation(const WebString& name) +{ + d->removeAnimation(String(PassRefPtr<StringImpl>(name.impl()))); +} + +WebOverlay* WebOverlay::parent() const +{ + return d->parent; +} + +bool WebOverlay::addChild(WebOverlay* overlay) +{ + if (overlay->d->nativeThread != d->nativeThread) + return false; + + overlay->d->parent = this; + d->addChild(overlay->d); + return true; +} + +void WebOverlay::removeFromParent() +{ + d->removeFromParent(); + d->parent = 0; +} + +void WebOverlay::setContentsToImage(const unsigned char* data, const Platform::IntSize& imageSize) +{ + d->setContentsToImage(data, imageSize); +} + +void WebOverlay::setContentsToColor(int r, int g, int b, int a) +{ + d->setContentsToColor(Color(r, g, b, a)); +} + +void WebOverlay::setDrawsContent(bool drawsContent) +{ + d->setDrawsContent(drawsContent); +} + +void WebOverlay::invalidate() +{ + d->invalidate(); +} + +void WebOverlay::setClient(WebOverlayClient* client) +{ + d->setClient(client); +} + +WebOverlayOverride* WebOverlay::override() +{ + // Must be called on UI thread + if (!Platform::userInterfaceThreadMessageClient()->isCurrentThread()) + return 0; + + return d->override(); +} + +void WebOverlay::resetOverrides() +{ + d->resetOverrides(); +} + +WebPagePrivate* WebOverlayPrivate::page() const +{ + if (m_page) + return m_page; + + if (parent) + return parent->d->page(); + + return 0; +} + +WebOverlayOverride* WebOverlayPrivate::override() +{ + // Page might have changed if we were removed from the page and added to + // some other page. + if (m_override) + m_override->d->setPage(page()); + return m_override.get(); +} + +void WebOverlayPrivate::drawContents(SkCanvas* canvas) +{ + if (!client) + return; + + client->drawOverlayContents(q, canvas); +} + +void WebOverlayPrivate::scheduleCompositingRun() +{ + if (WebPagePrivate* page = this->page()) { + if (WebPageCompositorClient* compositorClient = page->compositor()->client()) { + double animationTime = compositorClient->requestAnimationFrame(); + compositorClient->invalidate(animationTime); + return; + } + + page->blitVisibleContents(); + } +} + +WebOverlayPrivateWebKitThread::WebOverlayPrivateWebKitThread(GraphicsLayerClient* client) + : m_layer(GraphicsLayer::create(client ? client : this)) +{ + m_layerCompositingThread = m_layer->platformLayer()->layerCompositingThread(); +} + +WebOverlayOverride* WebOverlayPrivateWebKitThread::override() +{ + if (!m_override) { + WebOverlayPrivate* tmp = new WebOverlayPrivateCompositingThread(m_layerCompositingThread.get()); + m_override = adoptPtr(new WebOverlayOverride(tmp, true)); + } + + return WebOverlayPrivate::override(); +} + +FloatPoint WebOverlayPrivateWebKitThread::position() const +{ + return m_layer->position(); +} + +void WebOverlayPrivateWebKitThread::setPosition(const FloatPoint& position) +{ + m_layer->setPosition(position); +} + +FloatPoint WebOverlayPrivateWebKitThread::anchorPoint() const +{ + FloatPoint3D anchor = m_layer->anchorPoint(); + return FloatPoint(anchor.x(), anchor.y()); +} + +void WebOverlayPrivateWebKitThread::setAnchorPoint(const FloatPoint& anchor) +{ + m_layer->setAnchorPoint(FloatPoint3D(anchor.x(), anchor.y(), 0)); +} + +FloatSize WebOverlayPrivateWebKitThread::size() const +{ + return m_layer->size(); +} + +void WebOverlayPrivateWebKitThread::setSize(const FloatSize& size) +{ + m_layer->setSize(size); +} + +bool WebOverlayPrivateWebKitThread::sizeIsScaleInvariant() const +{ + return m_layer->platformLayer()->sizeIsScaleInvariant(); +} + +void WebOverlayPrivateWebKitThread::setSizeIsScaleInvariant(bool invariant) +{ + m_layer->platformLayer()->setSizeIsScaleInvariant(invariant); +} + +TransformationMatrix WebOverlayPrivateWebKitThread::transform() const +{ + return m_layer->transform(); +} + +void WebOverlayPrivateWebKitThread::setTransform(const TransformationMatrix& transform) +{ + m_layer->setTransform(transform); +} + +float WebOverlayPrivateWebKitThread::opacity() const +{ + return m_layer->opacity(); +} + +void WebOverlayPrivateWebKitThread::setOpacity(float opacity) +{ + m_layer->setOpacity(opacity); +} + +void WebOverlayPrivateWebKitThread::addAnimation(const String& name, Animation* animation, const KeyframeValueList& keyframes) +{ + IntSize size(m_layer->size().width(), m_layer->size().height()); + m_layer->addAnimation(keyframes, size, animation, name, 0); +} + +void WebOverlayPrivateWebKitThread::removeAnimation(const String& name) +{ + m_layer->removeAnimation(name); +} + +void WebOverlayPrivateWebKitThread::addChild(WebOverlayPrivate* overlay) +{ + m_layer->addChild(static_cast<WebOverlayPrivateWebKitThread*>(overlay)->m_layer.get()); +} + +void WebOverlayPrivateWebKitThread::removeFromParent() +{ + m_layer->removeFromParent(); +} + +void WebOverlayPrivateWebKitThread::setContentsToImage(const unsigned char* data, const WebCore::IntSize& imageSize) +{ + notImplemented(); +} + +void WebOverlayPrivateWebKitThread::setContentsToColor(const Color&) +{ + notImplemented(); +} + +void WebOverlayPrivateWebKitThread::setDrawsContent(bool drawsContent) +{ + m_layer->setDrawsContent(drawsContent); +} + +void WebOverlayPrivateWebKitThread::clear() +{ + setSize(FloatSize(0, 0)); +} + +void WebOverlayPrivateWebKitThread::invalidate() +{ + m_layer->setNeedsDisplay(); +} + +void WebOverlayPrivateWebKitThread::resetOverrides() +{ + if (Platform::webKitThreadMessageClient()->isCurrentThread()) + m_layer->platformLayer()->clearOverride(); + else if (Platform::userInterfaceThreadMessageClient()->isCurrentThread()) { + m_layerCompositingThread->clearOverride(); + scheduleCompositingRun(); + } +} + +void WebOverlayPrivateWebKitThread::notifySyncRequired(const WebCore::GraphicsLayer*) +{ + if (WebPagePrivate* page = this->page()) + page->scheduleRootLayerCommit(); +} + +void WebOverlayPrivateWebKitThread::paintContents(const WebCore::GraphicsLayer*, WebCore::GraphicsContext& c, WebCore::GraphicsLayerPaintingPhase, const WebCore::IntRect&) +{ + drawContents(c.platformContext()->canvas()); +} + +WebOverlayLayerCompositingThreadClient::WebOverlayLayerCompositingThreadClient() + : m_drawsContent(false) + , m_layerCompositingThread(0) + , m_client(0) +{ +} + +void WebOverlayLayerCompositingThreadClient::setDrawsContent(bool drawsContent) +{ + m_drawsContent = drawsContent; +} + +void WebOverlayLayerCompositingThreadClient::invalidate() +{ + m_texture.clear(); +} + +void WebOverlayLayerCompositingThreadClient::setContents(const SkBitmap& contents) +{ + m_contents = contents; + m_color = Color(); + m_texture.clear(); +} + +void WebOverlayLayerCompositingThreadClient::setContentsToColor(const Color& color) +{ + m_contents = SkBitmap(); + m_color = color; + m_texture.clear(); +} + +void WebOverlayLayerCompositingThreadClient::layerCompositingThreadDestroyed(WebCore::LayerCompositingThread*) +{ + delete this; +} + +void WebOverlayLayerCompositingThreadClient::layerVisibilityChanged(LayerCompositingThread*, bool visible) +{ +} + +void WebOverlayLayerCompositingThreadClient::uploadTexturesIfNeeded(LayerCompositingThread*) +{ + if (m_contents.isNull() && !m_color.isValid() && !m_drawsContent) + return; + + if (m_texture && m_texture->textureId()) + return; + + if (m_color.isValid()) { + m_texture = textureCacheCompositingThread()->textureForColor(m_color); + return; + } + + if (m_drawsContent) { + if (!m_client || !m_owner) + return; + + if (m_contents.isNull()) { + m_contents.setConfig(SkBitmap::kARGB_8888_Config, m_layerCompositingThread->bounds().width(), m_layerCompositingThread->bounds().height()); + m_contents.allocPixels(); + } + + SkDevice device(m_contents); + SkCanvas canvas(&device); + m_client->drawOverlayContents(m_owner, &canvas); + canvas.flush(); + } + + m_texture = Texture::create(); + m_texture->protect(IntSize(m_contents.width(), m_contents.height())); + IntRect bitmapRect(0, 0, m_contents.width(), m_contents.height()); + m_texture->updateContents(m_contents, bitmapRect, bitmapRect, false); +} + +void WebOverlayLayerCompositingThreadClient::drawTextures(LayerCompositingThread* layer, double /*scale*/, int positionLocation, int texCoordLocation) +{ + if (!m_texture || !m_texture->textureId()) + return; + + glBindTexture(GL_TEXTURE_2D, m_texture->textureId()); + glVertexAttribPointer(positionLocation, 2, GL_FLOAT, GL_FALSE, 0, &layer->getTransformedBounds()); + float texcoords[4 * 2] = { 0, 0, 0, 1, 1, 1, 1, 0 }; + glVertexAttribPointer(texCoordLocation, 2, GL_FLOAT, GL_FALSE, 0, texcoords); + glDrawArrays(GL_TRIANGLE_FAN, 0, 4); +} + +void WebOverlayLayerCompositingThreadClient::deleteTextures(LayerCompositingThread*) +{ + m_texture.clear(); +} + +WebOverlayPrivateCompositingThread::WebOverlayPrivateCompositingThread(PassRefPtr<LayerCompositingThread> layerCompositingThread) + : m_layerCompositingThreadClient(0) +{ + m_layerCompositingThread = layerCompositingThread; +} + +WebOverlayPrivateCompositingThread::WebOverlayPrivateCompositingThread() + : m_layerCompositingThreadClient(new WebOverlayLayerCompositingThreadClient) +{ + m_layerCompositingThread = LayerCompositingThread::create(LayerData::CustomLayer, m_layerCompositingThreadClient); + m_layerCompositingThreadClient->setLayer(m_layerCompositingThread.get()); +} + +WebOverlayPrivateCompositingThread::~WebOverlayPrivateCompositingThread() +{ + if (m_layerCompositingThreadClient) + m_layerCompositingThreadClient->setClient(0, 0); +} + +void WebOverlayPrivateCompositingThread::setClient(WebOverlayClient* client) +{ + WebOverlayPrivate::setClient(client); + if (m_layerCompositingThreadClient) + m_layerCompositingThreadClient->setClient(q, client); +} + +WebOverlayOverride* WebOverlayPrivateCompositingThread::override() +{ + if (!m_override) + m_override = adoptPtr(new WebOverlayOverride(this, false)); + + return WebOverlayPrivate::override(); +} + +FloatPoint WebOverlayPrivateCompositingThread::position() const +{ + return m_layerCompositingThread->position(); +} + +void WebOverlayPrivateCompositingThread::setPosition(const FloatPoint& position) +{ + m_layerCompositingThread->setPosition(position); + scheduleCompositingRun(); +} + +FloatPoint WebOverlayPrivateCompositingThread::anchorPoint() const +{ + return m_layerCompositingThread->anchorPoint(); +} + +void WebOverlayPrivateCompositingThread::setAnchorPoint(const FloatPoint& anchor) +{ + m_layerCompositingThread->setAnchorPoint(anchor); + scheduleCompositingRun(); +} + +FloatSize WebOverlayPrivateCompositingThread::size() const +{ + IntSize bounds = m_layerCompositingThread->bounds(); + return FloatSize(bounds.width(), bounds.height()); +} + +void WebOverlayPrivateCompositingThread::setSize(const FloatSize& size) +{ + m_layerCompositingThread->setBounds(IntSize(size.width(), size.height())); + scheduleCompositingRun(); +} + +bool WebOverlayPrivateCompositingThread::sizeIsScaleInvariant() const +{ + return m_layerCompositingThread->sizeIsScaleInvariant(); +} + +void WebOverlayPrivateCompositingThread::setSizeIsScaleInvariant(bool invariant) +{ + m_layerCompositingThread->setSizeIsScaleInvariant(invariant); + scheduleCompositingRun(); +} + +TransformationMatrix WebOverlayPrivateCompositingThread::transform() const +{ + return m_layerCompositingThread->transform(); +} + +void WebOverlayPrivateCompositingThread::setTransform(const TransformationMatrix& transform) +{ + m_layerCompositingThread->setTransform(transform); + scheduleCompositingRun(); +} + +float WebOverlayPrivateCompositingThread::opacity() const +{ + return m_layerCompositingThread->opacity(); +} + +void WebOverlayPrivateCompositingThread::setOpacity(float opacity) +{ + m_layerCompositingThread->setOpacity(opacity); + scheduleCompositingRun(); +} + +void WebOverlayPrivateCompositingThread::addAnimation(const String& name, Animation* animation, const KeyframeValueList& keyframes) +{ + IntSize boxSize = m_layerCompositingThread->bounds(); + RefPtr<LayerAnimation> layerAnimation = LayerAnimation::create(keyframes, boxSize, animation, name, 0.0); + + // FIXME: Unfortunately WebPageCompositorClient::requestAnimationFrame uses a different time coordinate system + // than accelerated animations, so we can't use the time returned by WebPageCompositorClient::requestAnimationFrame() + // for starttime. + layerAnimation->setStartTime(currentTime()); + + m_layerCompositingThread->addAnimation(layerAnimation.get()); + scheduleCompositingRun(); +} + +void WebOverlayPrivateCompositingThread::removeAnimation(const String& name) +{ + m_layerCompositingThread->removeAnimation(name); + scheduleCompositingRun(); +} + +void WebOverlayPrivateCompositingThread::addChild(WebOverlayPrivate* overlay) +{ + m_layerCompositingThread->addSublayer(overlay->layerCompositingThread()); + scheduleCompositingRun(); +} + +void WebOverlayPrivateCompositingThread::removeFromParent() +{ + if (m_layerCompositingThread->superlayer() == page()->m_compositor->compositingThreadOverlayLayer()) + page()->m_compositor->removeOverlay(m_layerCompositingThread.get()); + else + m_layerCompositingThread->removeFromSuperlayer(); + scheduleCompositingRun(); +} + +void WebOverlayPrivateCompositingThread::setContentsToImage(const unsigned char* data, const IntSize& imageSize) +{ + if (!m_layerCompositingThreadClient) + return; + + const SkBitmap& oldContents = m_layerCompositingThreadClient->contents(); + if (!oldContents.isNull()) { + SkAutoLockPixels lock(oldContents); + if (data == oldContents.getPixels()) + return; + } + + SkBitmap contents; + contents.setConfig(SkBitmap::kARGB_8888_Config, imageSize.width(), imageSize.height()); + contents.setPixels(const_cast<unsigned char*>(data)); + + m_layerCompositingThreadClient->setContents(contents); + m_layerCompositingThread->setNeedsTexture(true); +} + +void WebOverlayPrivateCompositingThread::setContentsToColor(const Color& color) +{ + if (!m_layerCompositingThreadClient) + return; + + m_layerCompositingThreadClient->setContentsToColor(color); + m_layerCompositingThread->setNeedsTexture(true); +} + +void WebOverlayPrivateCompositingThread::setDrawsContent(bool drawsContent) +{ + if (!m_layerCompositingThreadClient) + return; + + m_layerCompositingThreadClient->setDrawsContent(drawsContent); + m_layerCompositingThread->setNeedsTexture(true); +} + +void WebOverlayPrivateCompositingThread::clear() +{ + m_layerCompositingThread->deleteTextures(); +} + +void WebOverlayPrivateCompositingThread::invalidate() +{ + if (!m_layerCompositingThreadClient || !m_layerCompositingThreadClient->drawsContent()) + return; + + m_layerCompositingThreadClient->invalidate(); + scheduleCompositingRun(); +} + +void WebOverlayPrivateCompositingThread::resetOverrides() +{ + m_layerCompositingThread->clearOverride(); + scheduleCompositingRun(); +} + +} +} +#else // USE(ACCELERATED_COMPOSITING) +namespace BlackBerry { +namespace WebKit { + +WebOverlay::WebOverlay() +{ +} + +WebOverlay::~WebOverlay() +{ +} + +Platform::FloatPoint WebOverlay::position() const +{ + return Platform::FloatPoint(); +} + +void WebOverlay::setPosition(const Platform::FloatPoint&) +{ +} + +Platform::FloatPoint WebOverlay::anchorPoint() const +{ + return Platform::FloatPoint(); +} + +void WebOverlay::setAnchorPoint(const Platform::FloatPoint&) +{ +} + +Platform::FloatSize WebOverlay::size() const +{ + return Platform::FloatSize(); +} + +void WebOverlay::setSize(const Platform::FloatSize&) +{ +} + +Platform::TransformationMatrix WebOverlay::transform() const +{ + return Platform::TransformationMatrix(); +} + +void WebOverlay::setTransform(const Platform::TransformationMatrix&) +{ +} + +float WebOverlay::opacity() const +{ + return 1.0f; +} + +void WebOverlay::setOpacity(float) +{ +} + +WebOverlay* WebOverlay::parent() const +{ + return 0; +} + +bool WebOverlay::addChild(WebOverlay*) +{ + return false; +} + +void WebOverlay::removeFromParent() +{ +} + +void WebOverlay::addAnimation(const WebAnimation&) +{ +} + +void WebOverlay::removeAnimation(const WebString&) +{ +} + +void WebOverlay::setContentsToImage(const unsigned char*, const Platform::IntSize&) +{ +} + +void WebOverlay::setContentsToColor(int, int, int, int) +{ +} + +void WebOverlay::setDrawsContent(bool) +{ +} + +void WebOverlay::invalidate() +{ +} + +void WebOverlay::setClient(WebOverlayClient*) +{ +} + +WebOverlayOverride* WebOverlay::override() +{ +} + +void WebOverlay::resetOverrides() +{ +} + +} +} +#endif // USE(ACCELERATED_COMPOSITING) diff --git a/Source/WebKit/blackberry/Api/WebOverlay.h b/Source/WebKit/blackberry/Api/WebOverlay.h new file mode 100644 index 000000000..5fe80c423 --- /dev/null +++ b/Source/WebKit/blackberry/Api/WebOverlay.h @@ -0,0 +1,130 @@ +/* + * Copyright (C) 2012 Research In Motion Limited. All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef WebOverlay_h +#define WebOverlay_h + +#include "BlackBerryGlobal.h" +#include "WebOverlayOverride.h" + +#include <BlackBerryPlatformPrimitives.h> + +namespace WebCore { +class GraphicsLayerClient; +} + +namespace BlackBerry { +namespace WebKit { + +class WebAnimation; +class WebOverlayClient; +class WebOverlayOverride; +class WebOverlayPrivate; +class WebPage; +class WebString; + +/** + * Represents an overlay that is rendered superimposed on a web page. + * + * The WebOverlay is not thread safe, but it is reentrant when used on either + * the WebKit or the compositing thread. This means that overlays can be + * on either of these threads, but each instance must only be used on the + * thread where it was created. The only exception is the override mechanism. + * + * The WebOverlayOverride object returned by WebOverlay::override() can be used + * to override the values of specific properties from the UI thread. + * + * They have the following semantics: If they are called for a specific overlay + * on the UI thread, the value set will override any value set on the WK thread + * until you call resetOverrides(). resetOverrides() is thread safe. + */ +class BLACKBERRY_EXPORT WebOverlay { +public: + WebOverlay(); + WebOverlay(WebCore::GraphicsLayerClient*); + virtual ~WebOverlay(); + + // The position of the layer (the location of its top-left corner in its parent). + Platform::FloatPoint position() const; + void setPosition(const Platform::FloatPoint&); + + // Anchor point: (0, 0) is top left, (1, 1) is bottom right. The anchor point + // affects the origin of the transforms. + Platform::FloatPoint anchorPoint() const; + void setAnchorPoint(const Platform::FloatPoint&); + + // The size of the layer. + Platform::FloatSize size() const; + void setSize(const Platform::FloatSize&); + + // Whether the layer is scaled together with the web page. + bool sizeIsScaleInvariant() const; + void setSizeIsScaleInvariant(bool); + + // Transform can be used to rotate the layer, among other things. + Platform::TransformationMatrix transform() const; + void setTransform(const Platform::TransformationMatrix&); + + // Opacity. Can also be used to temporarily hide a layer. + float opacity() const; + void setOpacity(float); + + // Adds/removes an animation + // Note that WebAnimation and WebString are not thread safe and have to be + // created on the thread where they'll be used. + void addAnimation(const WebAnimation&); + void removeAnimation(const WebString& name); + + WebOverlay* parent() const; + bool addChild(WebOverlay*); + void removeFromParent(); + + void setContentsToImage(const unsigned char* data, const Platform::IntSize& imageSize); + void setContentsToColor(int r, int g, int b, int a); + void setDrawsContent(bool); + + // Will result in a future call to WebOverlayClient::drawContents, if the layer draws custom contents. + void invalidate(); + + // The client can be used to draw layer contents using Skia. + void setClient(WebOverlayClient*); + + // Must be called on UI thread. + WebOverlayOverride* override(); + + /** + * Thread safe. Next time the attributes are changed on the WK thread, make + * those values override any set on the UI thread. + */ + void resetOverrides(); + +private: + friend class WebPage; + friend class WebOverlayPrivate; + + // Disable copy constructor and operator=. + WebOverlay(const WebOverlay&); + WebOverlay& operator=(const WebOverlay&); + + WebOverlayPrivate* d; +}; + +} +} + +#endif // WebOverlay_h diff --git a/Source/WebKit/blackberry/Api/WebOverlayClient.h b/Source/WebKit/blackberry/Api/WebOverlayClient.h new file mode 100644 index 000000000..bfeb263cd --- /dev/null +++ b/Source/WebKit/blackberry/Api/WebOverlayClient.h @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2012 Research In Motion Limited. All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef WebOverlayClient_h +#define WebOverlayClient_h + +#include "BlackBerryGlobal.h" + +class SkCanvas; + +namespace BlackBerry { +namespace WebKit { + +class WebOverlay; + +/** + */ +class BLACKBERRY_EXPORT WebOverlayClient { +public: + virtual ~WebOverlayClient() { } + + virtual void drawOverlayContents(WebOverlay*, SkCanvas*) = 0; +}; + +} +} + +#endif // WebOverlayClient_h diff --git a/Source/WebKit/blackberry/Api/WebOverlayOverride.cpp b/Source/WebKit/blackberry/Api/WebOverlayOverride.cpp new file mode 100644 index 000000000..89e2233fb --- /dev/null +++ b/Source/WebKit/blackberry/Api/WebOverlayOverride.cpp @@ -0,0 +1,127 @@ +/* + * Copyright (C) 2012 Research In Motion Limited. All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "config.h" + +#include "WebOverlayOverride.h" + +#if USE(ACCELERATED_COMPOSITING) +#include "WebAnimation.h" +#include "WebAnimation_p.h" +#include "WebOverlay_p.h" +#include "WebString.h" + +#include <BlackBerryPlatformMessageClient.h> + +namespace BlackBerry { +namespace WebKit { + +using namespace WebCore; + +WebOverlayOverride::WebOverlayOverride(WebOverlayPrivate* d, bool owned) + : d(d) + , m_owned(owned) +{ +} + +WebOverlayOverride::~WebOverlayOverride() +{ + if (m_owned) + delete d; +} + +void WebOverlayOverride::setPosition(const Platform::FloatPoint& position) +{ + d->setPosition(position); +} + +void WebOverlayOverride::setAnchorPoint(const Platform::FloatPoint& anchor) +{ + d->setAnchorPoint(anchor); +} + +void WebOverlayOverride::setSize(const Platform::FloatSize& size) +{ + d->setSize(size); +} + +void WebOverlayOverride::setTransform(const Platform::TransformationMatrix& transform) +{ + d->setTransform(reinterpret_cast<const TransformationMatrix&>(transform)); +} + +void WebOverlayOverride::setOpacity(float opacity) +{ + d->setOpacity(opacity); +} + +void WebOverlayOverride::addAnimation(const WebAnimation& animation) +{ + d->addAnimation(animation.d->name, animation.d->animation.get(), animation.d->keyframes); +} + +void WebOverlayOverride::removeAnimation(const WebString& name) +{ + d->removeAnimation(String(PassRefPtr<StringImpl>(name.impl()))); +} + +} +} +#else // USE(ACCELERATED_COMPOSITING) +namespace BlackBerry { +namespace WebKit { + +WebOverlayOverride::WebOverlayOverride(WebOverlayPrivate*, bool) +{ +} + +WebOverlayOverride::~WebOverlayOverride() +{ +} + +void WebOverlayOverride::setPosition(const Platform::FloatPoint&) +{ +} + +void WebOverlayOverride::setAnchorPoint(const Platform::FloatPoint&) +{ +} + +void WebOverlayOverride::setSize(const Platform::FloatSize&) +{ +} + +void WebOverlayOverride::setTransform(const Platform::TransformationMatrix&) +{ +} + +void WebOverlayOverride::setOpacity(float) +{ +} + +void WebOverlayOverride::addAnimation(const WebAnimation&) +{ +} + +void WebOverlayOverride::removeAnimation(const WebString&) +{ +} + +} +} +#endif // USE(ACCELERATED_COMPOSITING) diff --git a/Source/WebKit/blackberry/Api/WebOverlayOverride.h b/Source/WebKit/blackberry/Api/WebOverlayOverride.h new file mode 100644 index 000000000..09c9a3496 --- /dev/null +++ b/Source/WebKit/blackberry/Api/WebOverlayOverride.h @@ -0,0 +1,68 @@ +/* + * Copyright (C) 2012 Research In Motion Limited. All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef WebOverlayOverride_h +#define WebOverlayOverride_h + +#include "BlackBerryGlobal.h" + +#include <BlackBerryPlatformPrimitives.h> + +namespace BlackBerry { +namespace WebKit { + +class WebAnimation; +class WebOverlayPrivate; +class WebString; + +/** + * Compositing thread only + * + * Note that the WebAnimation and WebString classes are not thread safe, but + * reentrant, and have to be created on the thread where they'll be used. + */ +class BLACKBERRY_EXPORT WebOverlayOverride { +public: + // Don't use this, call WebOverlay::override() instead + WebOverlayOverride(WebOverlayPrivate*, bool owned); + ~WebOverlayOverride(); + + void setPosition(const Platform::FloatPoint&); + void setAnchorPoint(const Platform::FloatPoint&); + void setSize(const Platform::FloatSize&); + void setTransform(const Platform::TransformationMatrix&); + void setOpacity(float); + + void addAnimation(const WebAnimation&); + void removeAnimation(const WebString& name); + +private: + friend class WebOverlayPrivate; + + // Disable copy constructor and operator= + WebOverlayOverride(const WebOverlayOverride&); + WebOverlayOverride& operator=(const WebOverlayOverride&); + + WebOverlayPrivate* d; + bool m_owned; +}; + +} +} + +#endif // WebOverlayOverride_h diff --git a/Source/WebKit/blackberry/Api/WebOverlay_p.h b/Source/WebKit/blackberry/Api/WebOverlay_p.h new file mode 100644 index 000000000..35c4a4b20 --- /dev/null +++ b/Source/WebKit/blackberry/Api/WebOverlay_p.h @@ -0,0 +1,267 @@ +/* + * Copyright (C) 2012 Research In Motion Limited. All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef WebOverlay_p_h +#define WebOverlay_p_h + +#if USE(ACCELERATED_COMPOSITING) + +#include "GraphicsLayer.h" +#include "LayerCompositingThread.h" +#include "Texture.h" +#include "WebOverlayOverride.h" + +#include <SkBitmap.h> +#include <pthread.h> +#include <wtf/OwnPtr.h> +#include <wtf/RefPtr.h> + +class SkCanvas; + +namespace WTF { +class String; +} + +namespace WebCore { +class Animation; +class KeyframeValueList; +} + +namespace BlackBerry { +namespace WebKit { + +class WebOverlay; +class WebOverlayClient; +class WebPagePrivate; + +class WebOverlayPrivate { +public: + WebOverlayPrivate() + : q(0) + , parent(0) + , m_page(0) + { + nativeThread = pthread_self(); + } + + virtual ~WebOverlayPrivate() + { + ASSERT(pthread_self() == nativeThread); + } + + WebPagePrivate* page() const; + void setPage(WebPagePrivate* page) { m_page = page; } + + virtual void setClient(WebOverlayClient* c) { client = c; } + + virtual WebOverlayOverride* override(); + + virtual WebCore::FloatPoint position() const = 0; + virtual void setPosition(const WebCore::FloatPoint&) = 0; + + virtual WebCore::FloatPoint anchorPoint() const = 0; + virtual void setAnchorPoint(const WebCore::FloatPoint&) = 0; + + virtual WebCore::FloatSize size() const = 0; + virtual void setSize(const WebCore::FloatSize&) = 0; + + virtual bool sizeIsScaleInvariant() const = 0; + virtual void setSizeIsScaleInvariant(bool) = 0; + + virtual WebCore::TransformationMatrix transform() const = 0; + virtual void setTransform(const WebCore::TransformationMatrix&) = 0; + + virtual float opacity() const = 0; + virtual void setOpacity(float) = 0; + + virtual void addAnimation(const WTF::String& name, WebCore::Animation*, const WebCore::KeyframeValueList&) = 0; + virtual void removeAnimation(const WTF::String&) = 0; + + virtual void addChild(WebOverlayPrivate*) = 0; + virtual void removeFromParent() = 0; + + virtual void setContentsToImage(const unsigned char* data, const WebCore::IntSize& imageSize) = 0; + virtual void setContentsToColor(const WebCore::Color&) = 0; + virtual void setDrawsContent(bool) = 0; + + virtual void clear() = 0; + virtual void invalidate() = 0; + void drawContents(SkCanvas*); + + virtual void resetOverrides() = 0; + + void scheduleCompositingRun(); + + // Never 0 + WebCore::LayerCompositingThread* layerCompositingThread() const { return m_layerCompositingThread.get(); } + + // Can be 0 + virtual WebCore::GraphicsLayer* graphicsLayer() const { return 0; } + + WebOverlay* q; + WebOverlayClient* client; + WebOverlay* parent; + pthread_t nativeThread; + +protected: + RefPtr<WebCore::LayerCompositingThread> m_layerCompositingThread; + OwnPtr<WebOverlayOverride> m_override; + WebPagePrivate* m_page; +}; + +class WebOverlayPrivateWebKitThread : public WebOverlayPrivate, public WebCore::GraphicsLayerClient { +public: + WebOverlayPrivateWebKitThread(WebCore::GraphicsLayerClient* = 0); + + virtual WebOverlayOverride* override(); + + virtual WebCore::FloatPoint position() const; + virtual void setPosition(const WebCore::FloatPoint&); + + virtual WebCore::FloatPoint anchorPoint() const; + virtual void setAnchorPoint(const WebCore::FloatPoint&); + + virtual WebCore::FloatSize size() const; + virtual void setSize(const WebCore::FloatSize&); + + virtual bool sizeIsScaleInvariant() const; + virtual void setSizeIsScaleInvariant(bool); + + virtual WebCore::TransformationMatrix transform() const; + virtual void setTransform(const WebCore::TransformationMatrix&); + + virtual float opacity() const; + virtual void setOpacity(float); + + virtual void addAnimation(const WTF::String& name, WebCore::Animation*, const WebCore::KeyframeValueList&); + virtual void removeAnimation(const WTF::String& name); + + virtual void addChild(WebOverlayPrivate*); + virtual void removeFromParent(); + + virtual void setContentsToImage(const unsigned char* data, const WebCore::IntSize& imageSize); + virtual void setContentsToColor(const WebCore::Color&); + virtual void setDrawsContent(bool); + + virtual void clear(); + virtual void invalidate(); + + virtual void resetOverrides(); + + virtual WebCore::GraphicsLayer* graphicsLayer() const { return m_layer.get(); } + + // GraphicsLayerClient + virtual void notifyAnimationStarted(const WebCore::GraphicsLayer*, double time) { } + virtual void notifySyncRequired(const WebCore::GraphicsLayer*); + virtual void paintContents(const WebCore::GraphicsLayer*, WebCore::GraphicsContext&, WebCore::GraphicsLayerPaintingPhase, const WebCore::IntRect& inClip); + virtual bool showDebugBorders(const WebCore::GraphicsLayer*) const { return false; } + virtual bool showRepaintCounter(const WebCore::GraphicsLayer*) const { return false; } + virtual bool contentsVisible(const WebCore::GraphicsLayer*, const WebCore::IntRect& contentRect) const { return true; } + +private: + OwnPtr<WebCore::GraphicsLayer> m_layer; +}; + +// The LayerCompositingThreadClient's life cycle is tied to the LayerCompositingThread, +// so it needs to be a separate object from the WebOverlayPrivateCompositingThread. +class WebOverlayLayerCompositingThreadClient : public WebCore::LayerCompositingThreadClient { +public: + WebOverlayLayerCompositingThreadClient(); + virtual ~WebOverlayLayerCompositingThreadClient() { } + + void setLayer(WebCore::LayerCompositingThread* layer) { m_layerCompositingThread = layer; } + void setClient(WebOverlay* owner, WebOverlayClient* client) { m_owner = owner; m_client = client; } + + bool drawsContent() const { return m_drawsContent; } + void setDrawsContent(bool); + void invalidate(); + + const SkBitmap& contents() const { return m_contents; } + void setContents(const SkBitmap&); + + void setContentsToColor(const WebCore::Color&); + + // LayerCompositingThreadClient + virtual void layerCompositingThreadDestroyed(WebCore::LayerCompositingThread*); + virtual void layerVisibilityChanged(WebCore::LayerCompositingThread*, bool visible); + virtual void uploadTexturesIfNeeded(WebCore::LayerCompositingThread*); + virtual void drawTextures(WebCore::LayerCompositingThread*, double scale, int positionLocation, int texCoordLocation); + virtual void deleteTextures(WebCore::LayerCompositingThread*); + +private: + RefPtr<WebCore::Texture> m_texture; + bool m_drawsContent; + SkBitmap m_contents; + WebCore::Color m_color; + WebCore::LayerCompositingThread* m_layerCompositingThread; + WebOverlay* m_owner; + WebOverlayClient* m_client; +}; + +class WebOverlayPrivateCompositingThread : public WebOverlayPrivate { +public: + WebOverlayPrivateCompositingThread(PassRefPtr<WebCore::LayerCompositingThread>); + WebOverlayPrivateCompositingThread(); + ~WebOverlayPrivateCompositingThread(); + + virtual void setClient(WebOverlayClient*); + virtual WebOverlayOverride* override(); + + virtual WebCore::FloatPoint position() const; + virtual void setPosition(const WebCore::FloatPoint&); + + virtual WebCore::FloatPoint anchorPoint() const; + virtual void setAnchorPoint(const WebCore::FloatPoint&); + + virtual WebCore::FloatSize size() const; + virtual void setSize(const WebCore::FloatSize&); + + virtual bool sizeIsScaleInvariant() const; + virtual void setSizeIsScaleInvariant(bool); + + virtual WebCore::TransformationMatrix transform() const; + virtual void setTransform(const WebCore::TransformationMatrix&); + + virtual float opacity() const; + virtual void setOpacity(float); + + virtual void addAnimation(const WTF::String& name, WebCore::Animation*, const WebCore::KeyframeValueList&); + virtual void removeAnimation(const WTF::String& name); + + virtual void addChild(WebOverlayPrivate*); + virtual void removeFromParent(); + + virtual void setContentsToImage(const unsigned char* data, const WebCore::IntSize& imageSize); + virtual void setContentsToColor(const WebCore::Color&); + virtual void setDrawsContent(bool); + + virtual void clear(); + virtual void invalidate(); + + virtual void resetOverrides(); + +private: + WebOverlayLayerCompositingThreadClient* m_layerCompositingThreadClient; +}; + +} +} + +#endif // USE(ACCELERATED_COMPOSITING) + +#endif // WebOverlay_p_h diff --git a/Source/WebKit/blackberry/Api/WebPage.cpp b/Source/WebKit/blackberry/Api/WebPage.cpp index 684279e30..c9a6c5bf9 100644 --- a/Source/WebKit/blackberry/Api/WebPage.cpp +++ b/Source/WebKit/blackberry/Api/WebPage.cpp @@ -42,6 +42,7 @@ #include "Database.h" #include "DatabaseSync.h" #include "DatabaseTracker.h" +#include "DefaultTapHighlight.h" #include "DeviceMotionClientBlackBerry.h" #include "DeviceOrientationClientBlackBerry.h" #include "DragClientBlackBerry.h" @@ -74,6 +75,7 @@ #include "InspectorBackendDispatcher.h" #include "InspectorClientBlackBerry.h" #include "InspectorController.h" +#include "InspectorOverlay.h" #include "JavaScriptDebuggerBlackBerry.h" #include "LayerWebKitThread.h" #include "NetworkManager.h" @@ -100,6 +102,7 @@ #include "ScriptValue.h" #include "ScrollTypes.h" #include "SelectionHandler.h" +#include "SelectionOverlay.h" #include "Settings.h" #include "Storage.h" #include "StorageNamespace.h" @@ -116,6 +119,8 @@ #include "WebDOMDocument.h" #endif #include "WebKitVersion.h" +#include "WebOverlay.h" +#include "WebOverlay_p.h" #include "WebPageClient.h" #include "WebSocket.h" #include "WebViewportArguments.h" @@ -155,8 +160,8 @@ #endif #if ENABLE(ACCELERATED_2D_CANVAS) -#include "SharedGraphicsContext3D.h" #include "GrContext.h" +#include "SharedGraphicsContext3D.h" #endif #if ENABLE(REQUEST_ANIMATION_FRAME) @@ -504,6 +509,11 @@ void WebPagePrivate::init(const WebString& pageGroupName) m_webSettings = WebSettings::createFromStandardSettings(); m_webSettings->setUserAgentString(defaultUserAgent()); +#if USE(ACCELERATED_COMPOSITING) + m_tapHighlight = DefaultTapHighlight::create(this); + m_selectionOverlay = SelectionOverlay::create(this); +#endif + // FIXME: We explicitly call setDelegate() instead of passing ourself in createFromStandardSettings() // so that we only get one didChangeSettings() callback when we set the page group name. This causes us // to make a copy of the WebSettings since some WebSettings method make use of the page group name. @@ -551,6 +561,14 @@ void WebPagePrivate::init(const WebString& pageGroupName) #if ENABLE(WEB_TIMING) m_page->settings()->setMemoryInfoEnabled(true); #endif + +#if USE(ACCELERATED_COMPOSITING) + // The compositor will be needed for overlay rendering, so create it + // unconditionally. It will allocate OpenGL objects lazily, so this incurs + // no overhead in the unlikely case where the compositor is not needed. + Platform::userInterfaceThreadMessageClient()->dispatchSyncMessage( + createMethodCallMessage(&WebPagePrivate::createCompositor, this)); +#endif } class DeferredTaskLoadManualScript: public DeferredTask<&WebPagePrivate::m_wouldLoadManualScript> { @@ -879,8 +897,10 @@ void WebPagePrivate::setLoadState(LoadState state) #endif #if USE(ACCELERATED_COMPOSITING) - if (isAcceleratedCompositingActive() && !compositorDrawsRootLayer()) - syncDestroyCompositorOnCompositingThread(); + if (isAcceleratedCompositingActive()) { + Platform::userInterfaceThreadMessageClient()->dispatchSyncMessage( + Platform::createMethodCallMessage(&WebPagePrivate::destroyLayerResources, this)); + } #endif m_previousContentsSize = IntSize(); m_backingStore->d->resetRenderQueue(); @@ -2120,26 +2140,32 @@ bool WebPagePrivate::isActive() const return m_client->isActive(); } -Credential WebPagePrivate::authenticationChallenge(const KURL& url, const ProtectionSpace& protectionSpace) +bool WebPagePrivate::authenticationChallenge(const KURL& url, const ProtectionSpace& protectionSpace, Credential& inputCredential) { WebString username; WebString password; +#if ENABLE_DRT + if (m_dumpRenderTree) + return m_dumpRenderTree->didReceiveAuthenticationChallenge(inputCredential); +#endif + #if ENABLE(BLACKBERRY_CREDENTIAL_PERSIST) if (!m_webSettings->isPrivateBrowsingEnabled()) credentialManager().autofillAuthenticationChallenge(protectionSpace, username, password); #endif - m_client->authenticationChallenge(protectionSpace.realm().characters(), protectionSpace.realm().length(), username, password); + bool isConfirmed = m_client->authenticationChallenge(protectionSpace.realm().characters(), protectionSpace.realm().length(), username, password); #if ENABLE(BLACKBERRY_CREDENTIAL_PERSIST) - Credential inputCredential(username, password, CredentialPersistencePermanent); - if (!m_webSettings->isPrivateBrowsingEnabled()) - credentialManager().saveCredentialIfConfirmed(this, CredentialTransformData(url, protectionSpace, inputCredential)); + Credential credential(username, password, CredentialPersistencePermanent); + if (!m_webSettings->isPrivateBrowsingEnabled() && isConfirmed) + credentialManager().saveCredentialIfConfirmed(this, CredentialTransformData(url, protectionSpace, credential)); #else - Credential inputCredential(username, password, CredentialPersistenceNone); + Credential credential(username, password, CredentialPersistenceNone); #endif - return inputCredential; + inputCredential = credential; + return isConfirmed; } PageClientBlackBerry::SaveCredentialType WebPagePrivate::notifyShouldSaveCredential(bool isNew) @@ -2234,7 +2260,7 @@ Platform::WebContext WebPagePrivate::webContext(TargetDetectionStrategy strategy } if (node->isTextNode()) { - Text* curText = static_cast<Text*>(node.get()); + Text* curText = toText(node.get()); if (!curText->wholeText().isEmpty()) context.setText(curText->wholeText().utf8().data()); } @@ -3192,6 +3218,8 @@ void WebPagePrivate::updateDelegatedOverlays(bool dispatched) // Must be called on the WebKit thread. if (m_selectionHandler->isSelectionActive()) m_selectionHandler->selectionPositionChanged(true /* visualChangeOnly */); + if (m_inspectorOverlay) + m_inspectorOverlay->update(); } else if (m_selectionHandler->isSelectionActive()) { // Don't bother dispatching to webkit thread if selection and tap highlight are not active. @@ -3333,8 +3361,10 @@ void WebPage::resetVirtualViewportOnCommitted(bool reset) IntSize WebPagePrivate::recomputeVirtualViewportFromViewportArguments() { static const ViewportArguments defaultViewportArguments; - if (m_viewportArguments == defaultViewportArguments) + if (m_viewportArguments == defaultViewportArguments) { + m_page->setDeviceScaleFactor(1.0); return IntSize(); + } int desktopWidth = defaultMaxLayoutSize().width(); int deviceWidth = Platform::Graphics::Screen::primaryScreen()->width(); @@ -3372,8 +3402,7 @@ void WebPagePrivate::didReceiveTouchEventMode(TouchEventMode mode) void WebPagePrivate::dispatchViewportPropertiesDidChange(const ViewportArguments& arguments) { - static ViewportArguments defaultViewportArguments; - if (arguments == defaultViewportArguments) + if (arguments == m_viewportArguments) return; m_viewportArguments = arguments; @@ -5453,8 +5482,15 @@ void WebPage::notifyFullScreenVideoExited(bool done) { UNUSED_PARAM(done); #if ENABLE(VIDEO) - if (HTMLMediaElement* mediaElement = static_cast<HTMLMediaElement*>(d->m_fullscreenVideoNode.get())) - mediaElement->exitFullscreen(); + if (d->m_webSettings->fullScreenVideoCapable()) { + if (HTMLMediaElement* mediaElement = static_cast<HTMLMediaElement*>(d->m_fullscreenVideoNode.get())) + mediaElement->exitFullscreen(); + } else { +#if ENABLE(FULLSCREEN_API) + if (Element* element = static_cast<Element*>(d->m_fullscreenVideoNode.get())) + element->document()->webkitCancelFullScreen(); +#endif + } #endif } @@ -5582,7 +5618,7 @@ void WebPagePrivate::drawLayersOnCommit() void WebPagePrivate::scheduleRootLayerCommit() { - if (!m_frameLayers || !m_frameLayers->hasLayer()) + if (!(m_frameLayers && m_frameLayers->hasLayer()) && !m_overlayLayer) return; m_needsCommit = true; @@ -5618,14 +5654,33 @@ LayerRenderingResults WebPagePrivate::lastCompositingResults() const return LayerRenderingResults(); } -void WebPagePrivate::setCompositor(PassRefPtr<WebPageCompositorPrivate> compositor) +GraphicsLayer* WebPagePrivate::overlayLayer() +{ + // The overlay layer has no GraphicsLayerClient, it's just a container + // for various overlays. + if (!m_overlayLayer) + m_overlayLayer = GraphicsLayer::create(0); + + return m_overlayLayer.get(); +} + +void WebPagePrivate::setCompositor(PassRefPtr<WebPageCompositorPrivate> compositor, EGLContext compositingContext) { using namespace BlackBerry::Platform; // The m_compositor member has to be modified during a sync call for thread // safe access to m_compositor and its refcount. if (!userInterfaceThreadMessageClient()->isCurrentThread()) { - userInterfaceThreadMessageClient()->dispatchSyncMessage(createMethodCallMessage(&WebPagePrivate::setCompositor, this, compositor)); + // We depend on the current thread being the WebKit thread when it's not the Compositing thread. + // That seems extremely likely to be the case, but let's assert just to make sure. + ASSERT(webKitThreadMessageClient()->isCurrentThread()); + + // This method call always round-trips on the WebKit thread (see WebPageCompositor::WebPageCompositor() and ~WebPageCompositor()), + // and the compositing context must be set on the WebKit thread. How convenient! + if (compositingContext != EGL_NO_CONTEXT) + BlackBerry::Platform::Graphics::setCompositingContext(compositingContext); + + userInterfaceThreadMessageClient()->dispatchSyncMessage(createMethodCallMessage(&WebPagePrivate::setCompositor, this, compositor, compositingContext)); return; } @@ -5647,16 +5702,34 @@ void WebPagePrivate::commitRootLayer(const IntRect& layoutRectForCompositing, WTF_PRETTY_FUNCTION, m_compositor.get()); #endif - if (!m_frameLayers || !m_compositor) + if (!m_compositor) return; - if (m_frameLayers->rootLayer() && m_frameLayers->rootLayer()->layerCompositingThread() != m_compositor->rootLayer()) - m_compositor->setRootLayer(m_frameLayers->rootLayer()->layerCompositingThread()); + // Frame layers + LayerWebKitThread* rootLayer = 0; + if (m_frameLayers) + rootLayer = m_frameLayers->rootLayer(); + + if (rootLayer && rootLayer->layerCompositingThread() != m_compositor->rootLayer()) + m_compositor->setRootLayer(rootLayer->layerCompositingThread()); + + // Overlay layers + LayerWebKitThread* overlayLayer = 0; + if (m_overlayLayer) + overlayLayer = m_overlayLayer->platformLayer(); + + if (overlayLayer && overlayLayer->layerCompositingThread() != m_compositor->overlayLayer()) + m_compositor->setOverlayLayer(overlayLayer->layerCompositingThread()); m_compositor->setLayoutRectForCompositing(layoutRectForCompositing); m_compositor->setContentsSizeForCompositing(contentsSizeForCompositing); m_compositor->setDrawsRootLayer(drawsRootLayer); - m_compositor->commit(m_frameLayers->rootLayer()); + + if (rootLayer) + rootLayer->commitOnCompositingThread(); + + if (overlayLayer) + overlayLayer->commitOnCompositingThread(); } bool WebPagePrivate::commitRootLayerIfNeeded() @@ -5677,7 +5750,7 @@ bool WebPagePrivate::commitRootLayerIfNeeded() if (!m_needsCommit) return false; - if (!m_frameLayers || !m_frameLayers->hasLayer()) + if (!(m_frameLayers && m_frameLayers->hasLayer()) && !m_overlayLayer) return false; FrameView* view = m_mainFrame->view(); @@ -5702,8 +5775,13 @@ bool WebPagePrivate::commitRootLayerIfNeeded() if (m_rootLayerCommitTimer->isActive()) m_rootLayerCommitTimer->stop(); - m_frameLayers->commitOnWebKitThread(currentScale()); + double scale = currentScale(); + if (m_frameLayers && m_frameLayers->hasLayer()) + m_frameLayers->commitOnWebKitThread(scale); + updateDelegatedOverlays(); + if (m_overlayLayer) + m_overlayLayer->platformLayer()->commitOnWebKitThread(scale); // Stash the visible content rect according to webkit thread // This is the rectangle used to layout fixed positioned elements, @@ -5848,22 +5926,11 @@ bool WebPagePrivate::createCompositor() m_compositor = WebPageCompositorPrivate::create(this, 0); m_compositor->setContext(m_ownedContext.get()); - if (!m_compositor->hardwareCompositing()) { - destroyCompositor(); - return false; - } - return true; } void WebPagePrivate::destroyCompositor() { - // We shouldn't release the compositor unless we created and own the - // context. If the compositor was created from the WebPageCompositor API, - // keep it around and reuse it later. - if (!m_ownedContext) - return; - // m_compositor is a RefPtr, so it may live on beyond this point. // Disconnect the compositor from us m_compositor->setPage(0); @@ -5986,6 +6053,60 @@ void WebPagePrivate::exitFullscreenForNode(Node* node) #endif } +#if ENABLE(FULLSCREEN_API) +// TODO: We should remove this helper class when we decide to support all elements. +static bool containsVideoTags(Element* element) +{ + for (Node* node = element->firstChild(); node; node = node->traverseNextNode(element)) { + if (node->hasTagName(HTMLNames::videoTag)) + return true; + } + return false; +} + +void WebPagePrivate::enterFullScreenForElement(Element* element) +{ +#if ENABLE(VIDEO) + // TODO: We should not check video tag when we decide to support all elements. + if (!element || (!element->hasTagName(HTMLNames::videoTag) && !containsVideoTags(element))) + return; + if (m_webSettings->fullScreenVideoCapable()) { + // The Browser chrome has its own fullscreen video widget it wants to + // use, and this is a video element. The only reason that + // webkitWillEnterFullScreenForElement() and + // webkitDidEnterFullScreenForElement() are still called in this case + // is so that exitFullScreenForElement() gets called later. + enterFullscreenForNode(element); + } else { + // No fullscreen video widget has been made available by the Browser + // chrome, or this is not a video element. The webkitRequestFullScreen + // Javascript call is often made on a div element. + // This is where we would hide the browser's chrome if we wanted to. + client()->fullscreenStart(); + m_fullscreenVideoNode = element; + } +#endif +} + +void WebPagePrivate::exitFullScreenForElement(Element* element) +{ +#if ENABLE(VIDEO) + // TODO: We should not check video tag when we decide to support all elements. + if (!element || !element->hasTagName(HTMLNames::videoTag)) + return; + if (m_webSettings->fullScreenVideoCapable()) { + // The Browser chrome has its own fullscreen video widget. + exitFullscreenForNode(element); + } else { + // This is where we would restore the browser's chrome + // if hidden above. + client()->fullscreenStop(); + m_fullscreenVideoNode = 0; + } +#endif +} +#endif + void WebPagePrivate::didChangeSettings(WebSettings* webSettings) { Settings* coreSettings = m_page->settings(); @@ -6154,6 +6275,66 @@ const String& WebPagePrivate::defaultUserAgent() return *defaultUserAgent; } +WebTapHighlight* WebPage::tapHighlight() const +{ + return d->m_tapHighlight.get(); +} + +void WebPage::setTapHighlight(WebTapHighlight* tapHighlight) +{ + d->m_tapHighlight = adoptPtr(tapHighlight); +} + +WebSelectionOverlay* WebPage::selectionOverlay() const +{ + return d->m_selectionOverlay.get(); +} + +void WebPage::addOverlay(WebOverlay* overlay) +{ +#if USE(ACCELERATED_COMPOSITING) + if (overlay->d->graphicsLayer()) { + overlay->d->setPage(d); + d->overlayLayer()->addChild(overlay->d->graphicsLayer()); + } +#endif +} + +void WebPage::removeOverlay(WebOverlay* overlay) +{ +#if USE(ACCELERATED_COMPOSITING) + if (overlay->d->graphicsLayer()->parent() != d->overlayLayer()) + return; + + overlay->removeFromParent(); + overlay->d->clear(); + overlay->d->setPage(0); +#endif +} + +void WebPage::addCompositingThreadOverlay(WebOverlay* overlay) +{ +#if USE(ACCELERATED_COMPOSITING) + ASSERT(Platform::userInterfaceThreadMessageClient()->isCurrentThread()); + if (!d->compositor()) + return; + + overlay->d->setPage(d); + d->compositor()->addOverlay(overlay->d->layerCompositingThread()); +#endif +} + +void WebPage::removeCompositingThreadOverlay(WebOverlay* overlay) +{ +#if USE(ACCELERATED_COMPOSITING) + ASSERT(Platform::userInterfaceThreadMessageClient()->isCurrentThread()); + if (d->compositor()) + d->compositor()->removeOverlay(overlay->d->layerCompositingThread()); + overlay->d->clear(); + overlay->d->setPage(0); +#endif +} + void WebPage::popupOpened(PagePopupBlackBerry* webPopup) { ASSERT(!d->m_selectPopup); @@ -6181,5 +6362,23 @@ void WebPagePrivate::setParentPopup(PagePopupBlackBerry* webPopup) m_parentPopup = webPopup; } +void WebPagePrivate::setInspectorOverlayClient(WebCore::InspectorOverlay::InspectorOverlayClient* inspectorOverlayClient) +{ + if (inspectorOverlayClient) { + if (!m_inspectorOverlay) + m_inspectorOverlay = WebCore::InspectorOverlay::create(this, inspectorOverlayClient); + else + m_inspectorOverlay->setClient(inspectorOverlayClient); + m_inspectorOverlay->update(); + scheduleRootLayerCommit(); + } else { + if (m_inspectorOverlay) { + m_inspectorOverlay->clear(); + m_inspectorOverlay = nullptr; + scheduleRootLayerCommit(); + } + } +} + } } diff --git a/Source/WebKit/blackberry/Api/WebPage.h b/Source/WebKit/blackberry/Api/WebPage.h index 86f31e46b..bcf387f43 100644 --- a/Source/WebKit/blackberry/Api/WebPage.h +++ b/Source/WebKit/blackberry/Api/WebPage.h @@ -62,11 +62,14 @@ class BackingStore; class BackingStoreClient; class BackingStorePrivate; class RenderQueue; +class WebOverlay; class WebPageClient; class WebPageCompositor; class WebPageGroupLoadDeferrer; class WebPagePrivate; +class WebSelectionOverlay; class WebSettings; +class WebTapHighlight; class WebViewportArguments; enum JavaScriptDataType { JSUndefined = 0, JSNull, JSBoolean, JSNumber, JSString, JSObject, JSException, JSDataTypeMax }; @@ -334,6 +337,20 @@ public: void setUserViewportArguments(const WebViewportArguments&); void resetUserViewportArguments(); + WebTapHighlight* tapHighlight() const; + void setTapHighlight(WebTapHighlight*); + + WebSelectionOverlay* selectionOverlay() const; + + // Adds an overlay that can be modified on the WebKit thread, and + // whose attributes can be overridden on the compositing thread. + void addOverlay(WebOverlay*); + void removeOverlay(WebOverlay*); + + // Adds an overlay that can only be modified on the compositing thread. + void addCompositingThreadOverlay(WebOverlay*); + void removeCompositingThreadOverlay(WebOverlay*); + // Popup client void initPopupWebView(BlackBerry::WebKit::WebPage*); void popupOpened(WebCore::PagePopupBlackBerry* webPopup); @@ -342,6 +359,7 @@ public: WebCore::PagePopupBlackBerry* popup(); void autofillTextField(const std::string&); + private: virtual ~WebPage(); diff --git a/Source/WebKit/blackberry/Api/WebPageClient.h b/Source/WebKit/blackberry/Api/WebPageClient.h index 4c1020563..8ee102852 100644 --- a/Source/WebKit/blackberry/Api/WebPageClient.h +++ b/Source/WebKit/blackberry/Api/WebPageClient.h @@ -132,9 +132,6 @@ public: virtual void notifyContentRendered(const Platform::IntRect&) = 0; virtual void notifyScreenRotated() = 0; - virtual void drawTapHighlight(const Platform::IntRectRegion&, int red, int green, int blue, int alpha, bool hideAfterScroll) = 0; - virtual void hideTapHighlight() = 0; - virtual void inputFocusGained(Platform::BlackBerryInputType, int inputStyle) = 0; virtual void inputFocusLost() = 0; virtual void inputTextChanged() = 0; @@ -210,7 +207,7 @@ public: virtual void animateBlockZoom(const Platform::FloatPoint& finalPoint, double finalScale) = 0; virtual void setPreventsScreenIdleDimming(bool noDimming) = 0; - virtual void authenticationChallenge(const unsigned short* realm, unsigned int realmLength, WebString& username, WebString& password) = 0; + virtual bool authenticationChallenge(const unsigned short* realm, unsigned int realmLength, WebString& username, WebString& password) = 0; virtual SaveCredentialType notifyShouldSaveCredential(bool isNew) = 0; virtual void notifyPopupAutofillDialog(const std::vector<std::string>&, const Platform::IntRect&) = 0; @@ -234,6 +231,7 @@ public: virtual bool downloadAllowed(const char* url) = 0; virtual void downloadRequested(Platform::FilterStream*, const WebString& suggestedFilename) = 0; + virtual int fullscreenStart() = 0; virtual int fullscreenStart(const char* contextName, Platform::Graphics::Window*, unsigned x, unsigned y, unsigned width, unsigned height) = 0; virtual int fullscreenStop() = 0; diff --git a/Source/WebKit/blackberry/Api/WebPageCompositor.cpp b/Source/WebKit/blackberry/Api/WebPageCompositor.cpp index da629adae..22dc1ffc8 100644 --- a/Source/WebKit/blackberry/Api/WebPageCompositor.cpp +++ b/Source/WebKit/blackberry/Api/WebPageCompositor.cpp @@ -32,8 +32,10 @@ #include <BlackBerryPlatformExecutableMessage.h> #include <BlackBerryPlatformMessage.h> #include <BlackBerryPlatformMessageClient.h> +#include <EGL/egl.h> #include <GenericTimerClient.h> #include <ThreadTimerClient.h> +#include <wtf/CurrentTime.h> using namespace WebCore; @@ -59,38 +61,57 @@ void WebPageCompositorPrivate::setContext(Platform::Graphics::GLES2Context* cont return; m_context = context; - if (!m_context) { + if (!m_context) m_layerRenderer.clear(); - return; - } - - m_layerRenderer = LayerRenderer::create(m_context); - m_layerRenderer->setRootLayer(m_rootLayer.get()); -} - -bool WebPageCompositorPrivate::hardwareCompositing() const -{ - return m_layerRenderer && m_layerRenderer->hardwareCompositing(); } void WebPageCompositorPrivate::setRootLayer(LayerCompositingThread* rootLayer) { m_rootLayer = rootLayer; +} - if (m_layerRenderer) - m_layerRenderer->setRootLayer(m_rootLayer.get()); +void WebPageCompositorPrivate::setOverlayLayer(LayerCompositingThread* overlayLayer) +{ + m_overlayLayer = overlayLayer; } -void WebPageCompositorPrivate::commit(LayerWebKitThread* rootLayer) +void WebPageCompositorPrivate::prepareFrame(double animationTime) { - if (!rootLayer) + if (!m_context) return; - rootLayer->commitOnCompositingThread(); + // The LayerRenderer is involved in rendering the BackingStore when + // WebPageCompositor is used to render the web page. The presence of a + // WebPageCompositorClient (m_client) indicates this is the case, so + // create a LayerRenderer if there are layers or if there's a client. + if (!m_rootLayer && !m_overlayLayer && !m_compositingThreadOverlayLayer && !m_client) + return; + + if (!m_layerRenderer) { + m_layerRenderer = LayerRenderer::create(m_context); + if (!m_layerRenderer->hardwareCompositing()) { + m_layerRenderer.clear(); + return; + } + } + + // Unfortunately, we have to use currentTime() because the animations are + // started in that time coordinate system. + animationTime = currentTime(); + if (m_rootLayer) + m_layerRenderer->prepareFrame(animationTime, m_rootLayer.get()); + if (m_overlayLayer) + m_layerRenderer->prepareFrame(animationTime, m_overlayLayer.get()); + if (m_compositingThreadOverlayLayer) + m_layerRenderer->prepareFrame(animationTime, m_compositingThreadOverlayLayer.get()); } -void WebPageCompositorPrivate::render(const IntRect& dstRect, const IntRect& transformedContents) +void WebPageCompositorPrivate::render(const IntRect& targetRect, const IntRect& clipRect, const TransformationMatrix& transformIn, const FloatRect& transformedContents, const FloatRect& /*viewport*/) { + // m_layerRenderer should have been created in prepareFrame + if (!m_layerRenderer) + return; + // It's not safe to call into the BackingStore if the compositor hasn't been set yet. // For thread safety, we have to do it using a round-trip to the WebKit thread, so the // embedder might call this before the round-trip to WebPagePrivate::setCompositor() is @@ -98,12 +119,35 @@ void WebPageCompositorPrivate::render(const IntRect& dstRect, const IntRect& tra if (m_webPage->compositor() != this) return; - // The BackingStore is the root layer - if (BackingStore* backingStore = m_webPage->m_backingStore) - backingStore->d->blitContents(dstRect, transformedContents, true); - else { - FloatRect contents = m_webPage->mapFromTransformedFloatRect(FloatRect(transformedContents)); - drawLayers(dstRect, contents); + m_layerRenderer->setClearSurfaceOnDrawLayers(false); + + FloatRect contents = m_webPage->mapFromTransformedFloatRect(transformedContents); + + m_layerRenderer->setViewport(targetRect, clipRect, contents, m_layoutRectForCompositing, m_contentsSizeForCompositing); + + TransformationMatrix transform(transformIn); + transform *= *m_webPage->m_transformationMatrix; + + if (!drawsRootLayer()) + m_webPage->m_backingStore->d->compositeContents(m_layerRenderer.get(), transform, contents); + + compositeLayers(transform); +} + +void WebPageCompositorPrivate::compositeLayers(const TransformationMatrix& transform) +{ + if (m_rootLayer) + m_layerRenderer->compositeLayers(transform, m_rootLayer.get()); + if (m_overlayLayer) + m_layerRenderer->compositeLayers(transform, m_overlayLayer.get()); + if (m_compositingThreadOverlayLayer) + m_layerRenderer->compositeLayers(transform, m_compositingThreadOverlayLayer.get()); + + m_lastCompositingResults = m_layerRenderer->lastRenderingResults(); + + if (m_lastCompositingResults.needsAnimationFrame) { + Platform::AnimationFrameRateController::instance()->addClient(this); + m_webPage->updateDelegatedOverlays(); } } @@ -114,6 +158,12 @@ bool WebPageCompositorPrivate::drawsRootLayer() const bool WebPageCompositorPrivate::drawLayers(const IntRect& dstRect, const FloatRect& contents) { + // Is there anything to draw? + if (!m_rootLayer && !m_overlayLayer && !m_compositingThreadOverlayLayer) + return false; + + // prepareFrame creates the LayerRenderer if needed + prepareFrame(currentTime()); if (!m_layerRenderer) return false; @@ -122,13 +172,22 @@ bool WebPageCompositorPrivate::drawLayers(const IntRect& dstRect, const FloatRec shouldClear = shouldClear || !backingStore->d->isOpenGLCompositing(); m_layerRenderer->setClearSurfaceOnDrawLayers(shouldClear); - m_layerRenderer->drawLayers(contents, m_layoutRectForCompositing, m_contentsSizeForCompositing, dstRect); - m_lastCompositingResults = m_layerRenderer->lastRenderingResults(); + // OpenGL window coordinates origin is at the lower left corner of the surface while + // WebKit uses upper left as the origin of the window coordinate system. The passed in 'dstRect' + // is in WebKit window coordinate system. Here we setup the viewport to the corresponding value + // in OpenGL window coordinates. + int viewportY = std::max(0, m_context->surfaceSize().height() - dstRect.maxY()); + IntRect viewport = IntRect(dstRect.x(), viewportY, dstRect.width(), dstRect.height()); - if (m_lastCompositingResults.needsAnimationFrame) { - Platform::AnimationFrameRateController::instance()->addClient(this); - m_webPage->updateDelegatedOverlays(); - } + m_layerRenderer->setViewport(viewport, viewport, contents, m_layoutRectForCompositing, m_contentsSizeForCompositing); + + // WebKit uses row vectors which are multiplied by the matrix on the left (i.e. v*M) + // Transformations are composed on the left so that M1.xform(M2) means M2*M1 + // We therefore start with our (othogonal) projection matrix, which will be applied + // as the last transformation. + TransformationMatrix transform = LayerRenderer::orthoMatrix(0, contents.width(), contents.height(), 0, -1000, 1000); + transform.translate3d(-contents.x(), -contents.y(), 0); + compositeLayers(transform); return true; } @@ -169,6 +228,24 @@ void WebPageCompositorPrivate::compositorDestroyed() m_client = 0; } +void WebPageCompositorPrivate::addOverlay(LayerCompositingThread* layer) +{ + if (!m_compositingThreadOverlayLayer) + m_compositingThreadOverlayLayer = LayerCompositingThread::create(LayerData::CustomLayer, 0); + m_compositingThreadOverlayLayer->addSublayer(layer); +} + +void WebPageCompositorPrivate::removeOverlay(LayerCompositingThread* layer) +{ + if (layer->superlayer() != m_compositingThreadOverlayLayer) + return; + + layer->removeFromSuperlayer(); + + if (m_compositingThreadOverlayLayer && m_compositingThreadOverlayLayer->getSublayers().isEmpty()) + m_compositingThreadOverlayLayer.clear(); +} + WebPageCompositor::WebPageCompositor(WebPage* page, WebPageCompositorClient* client) { using namespace BlackBerry::Platform; @@ -183,7 +260,7 @@ WebPageCompositor::WebPageCompositor(WebPage* page, WebPageCompositorClient* cli // This ensures that the compositor will be around for as long as it's // needed. Unfortunately RefPtr<T> is not public, so we have declare to // resort to manual refcounting. - webKitThreadMessageClient()->dispatchMessage(createMethodCallMessage(&WebPagePrivate::setCompositor, d->page(), tmp)); + webKitThreadMessageClient()->dispatchMessage(createMethodCallMessage(&WebPagePrivate::setCompositor, d->page(), tmp, eglGetCurrentContext())); } WebPageCompositor::~WebPageCompositor() @@ -192,7 +269,7 @@ WebPageCompositor::~WebPageCompositor() // If we're being destroyed before the page, send a message to disconnect us if (d->page()) - webKitThreadMessageClient()->dispatchMessage(createMethodCallMessage(&WebPagePrivate::setCompositor, d->page(), PassRefPtr<WebPageCompositorPrivate>(0))); + webKitThreadMessageClient()->dispatchMessage(createMethodCallMessage(&WebPagePrivate::setCompositor, d->page(), PassRefPtr<WebPageCompositorPrivate>(0), EGL_NO_CONTEXT)); d->compositorDestroyed(); d->deref(); } @@ -202,15 +279,21 @@ WebPageCompositorClient* WebPageCompositor::client() const return d->client(); } -void WebPageCompositor::prepareFrame(Platform::Graphics::GLES2Context* context, double timestamp) +void WebPageCompositor::prepareFrame(Platform::Graphics::GLES2Context* context, double animationTime) { d->setContext(context); + d->prepareFrame(animationTime); } -void WebPageCompositor::render(Platform::Graphics::GLES2Context* context, const Platform::IntRect& dstRect, const Platform::IntRect& contents) +void WebPageCompositor::render(Platform::Graphics::GLES2Context* context, + const Platform::IntRect& targetRect, + const Platform::IntRect& clipRect, + const Platform::TransformationMatrix& transform, + const Platform::FloatRect& contents, + const Platform::FloatRect& viewport) { d->setContext(context); - d->render(dstRect, contents); + d->render(targetRect, clipRect, TransformationMatrix(reinterpret_cast<const TransformationMatrix&>(transform)), contents, viewport); } void WebPageCompositor::cleanup(Platform::Graphics::GLES2Context* context) @@ -252,7 +335,12 @@ void WebPageCompositor::prepareFrame(Platform::Graphics::GLES2Context*, double) { } -void WebPageCompositor::render(Platform::Graphics::GLES2Context*, const Platform::IntRect&, const Platform::IntRect&) +void WebPageCompositor::render(Platform::Graphics::GLES2Context*, + const Platform::IntRect&, + const Platform::IntRect&, + const Platform::TransformationMatrix&, + const Platform::FloatRect&, + const Platform::FloatRect&) { } diff --git a/Source/WebKit/blackberry/Api/WebPageCompositor.h b/Source/WebKit/blackberry/Api/WebPageCompositor.h index 11bf2841f..913f506ed 100644 --- a/Source/WebKit/blackberry/Api/WebPageCompositor.h +++ b/Source/WebKit/blackberry/Api/WebPageCompositor.h @@ -39,10 +39,14 @@ public: WebPageCompositorClient* client() const; - void prepareFrame(Platform::Graphics::GLES2Context*, double timestamp); - - // FIXME: dstRect should be a Platform::TransformationMatrix instead. PR142628 - void render(Platform::Graphics::GLES2Context*, const Platform::IntRect& dstRect, const Platform::IntRect& contents); + void prepareFrame(Platform::Graphics::GLES2Context*, double animationTime); + + void render(Platform::Graphics::GLES2Context*, + const Platform::IntRect& targetRect, + const Platform::IntRect& clipRect, + const Platform::TransformationMatrix&, + const Platform::FloatRect& contents, + const Platform::FloatRect& viewport); void cleanup(Platform::Graphics::GLES2Context*); diff --git a/Source/WebKit/blackberry/Api/WebPageCompositorClient.h b/Source/WebKit/blackberry/Api/WebPageCompositorClient.h index 00497ee8a..70dd8289f 100644 --- a/Source/WebKit/blackberry/Api/WebPageCompositorClient.h +++ b/Source/WebKit/blackberry/Api/WebPageCompositorClient.h @@ -32,7 +32,6 @@ public: virtual double requestAnimationFrame() = 0; virtual void invalidate(double animationFrameTimestamp) = 0; - virtual void requestCleanup() = 0; }; } // namespace WebKit diff --git a/Source/WebKit/blackberry/Api/WebPageCompositor_p.h b/Source/WebKit/blackberry/Api/WebPageCompositor_p.h index cb41e1164..4d563c2fe 100644 --- a/Source/WebKit/blackberry/Api/WebPageCompositor_p.h +++ b/Source/WebKit/blackberry/Api/WebPageCompositor_p.h @@ -50,7 +50,13 @@ public: ~WebPageCompositorPrivate(); - bool hardwareCompositing() const; + // Public API + void prepareFrame(double animationTime); + void render(const WebCore::IntRect& targetRect, + const WebCore::IntRect& clipRect, + const WebCore::TransformationMatrix&, + const WebCore::FloatRect& contents, // This is public API, thus takes transformed contents + const WebCore::FloatRect& viewport); Platform::Graphics::GLES2Context* context() const { return m_context; } void setContext(Platform::Graphics::GLES2Context*); @@ -58,12 +64,11 @@ public: WebCore::LayerCompositingThread* rootLayer() const { return m_rootLayer.get(); } void setRootLayer(WebCore::LayerCompositingThread*); - void commit(WebCore::LayerWebKitThread* rootLayerProxy); + WebCore::LayerCompositingThread* overlayLayer() const { return m_overlayLayer.get(); } + void setOverlayLayer(WebCore::LayerCompositingThread*); - // This is mapped from the public API, thus takes transformed contents - void render(const WebCore::IntRect& dstRect, const WebCore::IntRect& transformedContents); + WebCore::LayerCompositingThread* compositingThreadOverlayLayer() const { return m_compositingThreadOverlayLayer.get(); } - // Returns true if the WebPageCompositor draws the root layer, false if the BackingStore draws the root layer bool drawsRootLayer() const; void setDrawsRootLayer(bool drawsRootLayer) { m_drawsRootLayer = drawsRootLayer; } @@ -86,17 +91,23 @@ public: WebPageCompositorClient* client() const { return m_client; } void compositorDestroyed(); + void addOverlay(WebCore::LayerCompositingThread*); + void removeOverlay(WebCore::LayerCompositingThread*); + protected: WebPageCompositorPrivate(WebPagePrivate*, WebPageCompositorClient*); private: void animationFrameChanged(); + void compositeLayers(const WebCore::TransformationMatrix&); WebPageCompositorClient* m_client; WebPagePrivate* m_webPage; Platform::Graphics::GLES2Context* m_context; OwnPtr<WebCore::LayerRenderer> m_layerRenderer; RefPtr<WebCore::LayerCompositingThread> m_rootLayer; + RefPtr<WebCore::LayerCompositingThread> m_overlayLayer; + RefPtr<WebCore::LayerCompositingThread> m_compositingThreadOverlayLayer; WebCore::IntRect m_layoutRectForCompositing; WebCore::IntSize m_contentsSizeForCompositing; WebCore::LayerRenderingResults m_lastCompositingResults; diff --git a/Source/WebKit/blackberry/Api/WebPage_p.h b/Source/WebKit/blackberry/Api/WebPage_p.h index c688c6de6..309bf5323 100644 --- a/Source/WebKit/blackberry/Api/WebPage_p.h +++ b/Source/WebKit/blackberry/Api/WebPage_p.h @@ -20,9 +20,11 @@ #define WebPage_p_h #include "ChromeClient.h" +#include "InspectorOverlay.h" #if USE(ACCELERATED_COMPOSITING) #include "GLES2Context.h" #include "LayerRenderer.h" +#include <EGL/egl.h> #endif #include "KURL.h" #include "PageClientBlackBerry.h" @@ -32,6 +34,7 @@ #include "ViewportArguments.h" #include "WebPage.h" #include "WebSettings.h" +#include "WebTapHighlight.h" #include <BlackBerryPlatformMessage.h> @@ -39,9 +42,12 @@ namespace WebCore { class AutofillManager; class DOMWrapperWorld; class Document; +class Element; class Frame; class GeolocationControllerClientBlackBerry; +class GraphicsLayerBlackBerry; class JavaScriptDebuggerBlackBerry; +class LayerWebKitThread; class Node; class Page; class PluginView; @@ -181,12 +187,16 @@ public: virtual int showAlertDialog(WebPageClient::AlertType atype); virtual bool isActive() const; virtual bool isVisible() const { return m_visible; } - virtual WebCore::Credential authenticationChallenge(const WebCore::KURL&, const WebCore::ProtectionSpace&); + virtual bool authenticationChallenge(const WebCore::KURL&, const WebCore::ProtectionSpace&, WebCore::Credential&); virtual SaveCredentialType notifyShouldSaveCredential(bool); // Called from within WebKit via ChromeClientBlackBerry. void enterFullscreenForNode(WebCore::Node*); void exitFullscreenForNode(WebCore::Node*); +#if ENABLE(FULLSCREEN_API) + void enterFullScreenForElement(WebCore::Element*); + void exitFullScreenForElement(WebCore::Element*); +#endif void contentsSizeChanged(const WebCore::IntSize&); void overflowExceedsContentsSize() { m_overflowExceedsContentsSize = true; } void layoutFinished(); @@ -368,6 +378,7 @@ public: void rootLayerCommitTimerFired(WebCore::Timer<WebPagePrivate>*); bool commitRootLayerIfNeeded(); WebCore::LayerRenderingResults lastCompositingResults() const; + WebCore::GraphicsLayer* overlayLayer(); // WebKit thread, plumbed through from ChromeClientBlackBerry. void setRootLayerWebKitThread(WebCore::Frame*, WebCore::LayerWebKitThread*); @@ -383,7 +394,7 @@ public: void commitRootLayer(const WebCore::IntRect&, const WebCore::IntSize&, bool); bool isAcceleratedCompositingActive() const { return m_compositor; } WebPageCompositorPrivate* compositor() const { return m_compositor.get(); } - void setCompositor(PassRefPtr<WebPageCompositorPrivate>); + void setCompositor(PassRefPtr<WebPageCompositorPrivate>, EGLContext compositingContext); bool createCompositor(); void destroyCompositor(); void syncDestroyCompositorOnCompositingThread(); @@ -422,12 +433,16 @@ public: void deferredTasksTimerFired(WebCore::Timer<WebPagePrivate>*); + void setInspectorOverlayClient(WebCore::InspectorOverlay::InspectorOverlayClient*); + WebPage* m_webPage; WebPageClient* m_client; WebCore::Page* m_page; WebCore::Frame* m_mainFrame; RefPtr<WebCore::Node> m_currentContextNode; WebSettings* m_webSettings; + OwnPtr<WebTapHighlight> m_tapHighlight; + OwnPtr<WebSelectionOverlay> m_selectionOverlay; #if ENABLE(JAVASCRIPT_DEBUGGER) OwnPtr<WebCore::JavaScriptDebuggerBlackBerry> m_scriptDebugger; @@ -516,6 +531,7 @@ public: #if USE(ACCELERATED_COMPOSITING) bool m_isAcceleratedCompositingActive; OwnPtr<FrameLayers> m_frameLayers; // WebKit thread only. + OwnPtr<WebCore::GraphicsLayer> m_overlayLayer; // Compositing thread only, used only when the WebKit layer created the context. // If the API client created the context, this will be null. @@ -542,6 +558,7 @@ public: RefPtr<WebCore::DOMWrapperWorld> m_isolatedWorld; bool m_hasInRegionScrollableAreas; bool m_updateDelegatedOverlaysDispatched; + OwnPtr<WebCore::InspectorOverlay> m_inspectorOverlay; // There is no need to initialize the following members in WebPagePrivate's constructor, // because they are only used by WebPageTasks and the tasks will initialize them when diff --git a/Source/WebKit/blackberry/Api/WebSelectionOverlay.h b/Source/WebKit/blackberry/Api/WebSelectionOverlay.h new file mode 100644 index 000000000..5858edf71 --- /dev/null +++ b/Source/WebKit/blackberry/Api/WebSelectionOverlay.h @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2012 Research In Motion Limited. All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef WebSelectionOverlay_h +#define WebSelectionOverlay_h + +#include "BlackBerryGlobal.h" + +#include <BlackBerryPlatformIntRectRegion.h> + +namespace BlackBerry { +namespace WebKit { + +class BLACKBERRY_EXPORT WebSelectionOverlay { +public: + virtual ~WebSelectionOverlay() { } + + virtual void draw(const Platform::IntRectRegion&) = 0; + virtual void hide() = 0; +}; + +} // namespace WebKit +} // namespace BlackBerry + +#endif // WebSelectionOverlay_h diff --git a/Source/WebKit/blackberry/Api/WebTapHighlight.h b/Source/WebKit/blackberry/Api/WebTapHighlight.h new file mode 100644 index 000000000..4a1183d10 --- /dev/null +++ b/Source/WebKit/blackberry/Api/WebTapHighlight.h @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2012 Research In Motion Limited. All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef WebTapHighlight_h +#define WebTapHighlight_h + +#include "BlackBerryGlobal.h" + +#include <BlackBerryPlatformIntRectRegion.h> + +namespace BlackBerry { +namespace WebKit { + +class BLACKBERRY_EXPORT WebTapHighlight { +public: + virtual ~WebTapHighlight() { } + + virtual void draw(const Platform::IntRectRegion&, int red, int green, int blue, int alpha, bool hideAfterScroll) = 0; + virtual void hide() = 0; + + virtual bool shouldHideAfterScroll() const = 0; +}; + +} // namespace WebKit +} // namespace BlackBerry + +#endif // WebTapHighlight_h diff --git a/Source/WebKit/blackberry/ChangeLog b/Source/WebKit/blackberry/ChangeLog index 93583a78a..4af41fcb1 100644 --- a/Source/WebKit/blackberry/ChangeLog +++ b/Source/WebKit/blackberry/ChangeLog @@ -1,3 +1,767 @@ +2012-05-31 Hajime Morrita <morrita@chromium.org> + + REGRESSION(r117572): editing/spelling/spellcheck-async-remove-frame.html crashes on Mac + https://bugs.webkit.org/show_bug.cgi?id=86859 + + Reviewed by Ryosuke Niwa. + + * WebCoreSupport/EditorClientBlackBerry.cpp: + (WebCore::EditorClientBlackBerry::requestCheckingOfString): + * WebCoreSupport/EditorClientBlackBerry.h: + (EditorClientBlackBerry): + +2012-05-31 Arvid Nilsson <anilsson@rim.com> + + [BlackBerry] WebGL and 2D canvas output not available to WebPageCompositor + https://bugs.webkit.org/show_bug.cgi?id=88012 + + Reviewed by George Staikos. + + Properly set up resource sharing between WebKit thread EGL contexts and + the compositing thread EGL context, so the texture ID produced by WebGL + and 2D canvas makes sense to the compositing context. + + There's no public API to supply an EGLContext yet, so we're lucky that + the embedder never makes its context un-current. Just grab the current + context on the compositing thread and use that as the compositing + context. + + * Api/WebPage.cpp: + (BlackBerry::WebKit::WebPagePrivate::setCompositor): + * Api/WebPageCompositor.cpp: + (BlackBerry::WebKit::WebPageCompositor::WebPageCompositor): + (BlackBerry::WebKit::WebPageCompositor::~WebPageCompositor): + * Api/WebPage_p.h: + (WebPagePrivate): + +2012-05-31 George Staikos <staikos@webkit.org> + + [Blackberry] Initialize the select client and delete the pointer + in the destructor so it doesn't leak. Fixes test crashes. + https://bugs.webkit.org/show_bug.cgi?id=87992 + + Reviewed by Rob Buis. + + * WebKitSupport/InputHandler.cpp: + (BlackBerry::WebKit::InputHandler::InputHandler): + (BlackBerry::WebKit::InputHandler::~InputHandler): + +2012-05-31 Arvid Nilsson <anilsson@rim.com> + + [BlackBerry] Crash when destroying WebOverlay with active WebOverlayOverride + https://bugs.webkit.org/show_bug.cgi?id=87968 + + Reviewed by Rob Buis. + + The override object is using a compositing thread WebOverlayPrivate + object with no client because the layer doesn't delegate drawing to the + WebOverlayPrivate, it's only used to modify the override properties on + the underlying compositing thread layer. + + Since the m_layerCompositingThreadClient is optional, we have to add + null checks. + + * Api/WebOverlay.cpp: + (BlackBerry::WebKit::WebOverlayPrivateCompositingThread::~WebOverlayPrivateCompositingThread): + (BlackBerry::WebKit::WebOverlayPrivateCompositingThread::setClient): + (BlackBerry::WebKit::WebOverlayPrivateCompositingThread::setContentsToImage): + (BlackBerry::WebKit::WebOverlayPrivateCompositingThread::setContentsToColor): + (BlackBerry::WebKit::WebOverlayPrivateCompositingThread::setDrawsContent): + (BlackBerry::WebKit::WebOverlayPrivateCompositingThread::invalidate): + +2012-05-31 Chris Guan <chris.guan@torchmobile.com.cn> + + [Blackberry] WebKit's fullscreen mode needs to notify page client. + https://bugs.webkit.org/show_bug.cgi?id=87337 + + Reviewed by Antonio Gomes. + + Move "fullScreenVideoCapable" into webpagePrivate to make code + clean for "fullScreenForElement/Node" of cromeClientBlackberry, + All Video checks and code path selections are in webpagePrivate now. + For some UX and secure reasons, we could not apply fullscreen capacity + for all elements, So we use client's fullscreenStart/Stop only for + those video elements and those elements containing video tags. + + * Api/WebPage.cpp: + (BlackBerry::WebKit::WebPagePrivate::webContext): + (BlackBerry::WebKit::WebPage::notifyFullScreenVideoExited): + (WebKit): + (BlackBerry::WebKit::containsVideoTags): + (BlackBerry::WebKit::WebPagePrivate::enterFullScreenForElement): + (BlackBerry::WebKit::WebPagePrivate::exitFullScreenForElement): + * Api/WebPageClient.h: + * Api/WebPage_p.h: + (WebCore): + (WebPagePrivate): + * WebCoreSupport/ChromeClientBlackBerry.cpp: + (WebCore::ChromeClientBlackBerry::enterFullScreenForElement): + (WebCore::ChromeClientBlackBerry::exitFullScreenForElement): + +2012-05-31 Arvid Nilsson <anilsson@rim.com> + + [BlackBerry] Crash when closing web page if selection is active + https://bugs.webkit.org/show_bug.cgi?id=87962 + + Reviewed by Antonio Gomes. + + The embedder may try to remove a layer from the compositor at a stage + where the compositor has been set to 0. + + * Api/WebPage.cpp: + (BlackBerry::WebKit::WebPage::addCompositingThreadOverlay): + (BlackBerry::WebKit::WebPage::removeCompositingThreadOverlay): + +2012-05-30 Konrad Piascik <kpiascik@rim.com> + + [BlackBerry] Add an Accelerated Compositing layer for Web Inspector DOM highlight. + https://bugs.webkit.org/show_bug.cgi?id=81001 + + Reviewed by Antonio Gomes. + + Implemented InspectorOverlay using WebOverlayAPI. + + * Api/BackingStore.cpp: + (BlackBerry::WebKit::BackingStorePrivate::renderContents): + * Api/WebPage.cpp: + (BlackBerry::WebKit::WebPagePrivate::updateDelegatedOverlays): + (BlackBerry::WebKit::WebPagePrivate::commitRootLayerIfNeeded): + (BlackBerry::WebKit::WebPagePrivate::setInspectorOverlayClient): + (WebKit): + * Api/WebPage_p.h: + (WebCore): + (WebPagePrivate): + * WebCoreSupport/InspectorClientBlackBerry.cpp: + (WebCore::InspectorClientBlackBerry::highlight): + (WebCore::InspectorClientBlackBerry::hideHighlight): + (WebCore::InspectorClientBlackBerry::paintInspectorOverlay): + (WebCore): + * WebCoreSupport/InspectorClientBlackBerry.h: + (InspectorClientBlackBerry): + * WebCoreSupport/InspectorOverlay.cpp: Added. + (WebCore): + (WebCore::InspectorOverlay::create): + (WebCore::InspectorOverlay::InspectorOverlay): + (WebCore::InspectorOverlay::notifySyncRequired): + (WebCore::InspectorOverlay::paintContents): + (WebCore::InspectorOverlay::showDebugBorders): + (WebCore::InspectorOverlay::showRepaintCounter): + (WebCore::InspectorOverlay::contentsVisible): + (WebCore::InspectorOverlay::~InspectorOverlay): + (WebCore::InspectorOverlay::clear): + (WebCore::InspectorOverlay::update): + (WebCore::InspectorOverlay::paintWebFrame): + (WebCore::InspectorOverlay::invalidateWebFrame): + * WebCoreSupport/InspectorOverlay.h: Added. + (WebKit): + (WebCore): + (InspectorOverlay): + (InspectorOverlayClient): + (WebCore::InspectorOverlay::setClient): + (WebCore::InspectorOverlay::notifyAnimationStarted): + +2012-05-30 Sean Wang <Xuewen.Wang@torchmobile.com.cn> + + [BlackBerry] Browser crashed when selecting in textarea + https://bugs.webkit.org/show_bug.cgi?id=87484 + + The function FatFingers::checkForText() uses host node's whole text + to checkFingerIntersection(). We should not give the text of shadow + nodes to it. + + Reviewed by Antonio Gomes. + + * WebKitSupport/FatFingers.cpp: + (BlackBerry::WebKit::FatFingers::getNodesFromRect): Avoid returning + shadow nodes when the context is Text node. + +2012-05-30 Zoltan Horvath <zoltan@webkit.org> + + [Qt] Set WebCore imagedecoders as default and add fallback to QImageDecoder + https://bugs.webkit.org/show_bug.cgi?id=80400 + + Get rid of QT_IMAGE_DECODER flag. + + Reviewed by Simon Hausmann. + + * WebCoreSupport/AboutDataEnableFeatures.in: + +2012-05-29 Max Feil <mfeil@rim.com> + + [BlackBerry] The Page's deviceScaleFactor() is not being properly maintained + https://bugs.webkit.org/show_bug.cgi?id=87817 + + Reviewed by Antonio Gomes. + + This bug fix in WebKit/blackberry is needed by the changes for + fullscreen media control sizing in WebCore (bug 87551). The sizing + of controls depends on the page's deviceScaleFactor(), which was + not being maintained properly due to errors in logic. Viewport + changes from non-default to default were being erroneously + thrown out. Also, when the viewport did change back to default + the deviceScaleFactor was not being updated. + + * Api/WebPage.cpp: + (BlackBerry::WebKit::WebPagePrivate::recomputeVirtualViewportFromViewportArguments): + (BlackBerry::WebKit::WebPagePrivate::dispatchViewportPropertiesDidChange): + +2012-05-29 Arvid Nilsson <anilsson@rim.com> + + [BlackBerry] WebOverlay build fixes and bug fixes + https://bugs.webkit.org/show_bug.cgi?id=87780 + + Reviewed by Rob Buis. + + Fix build when accelerated compositing disabled, or debug build. + + Also fix a bug where the selection overlay would not disappear properly + because of a typo in WebPage::removeOverlay(). Also convert said method + to early return style. + + Debug build fixes contributed by Ming Xie. + + * Api/WebOverlay.cpp: + (BlackBerry::WebKit::WebOverlay::addAnimation): + (BlackBerry::WebKit::WebOverlay::setContentsToImage): + (WebKit): + (BlackBerry::WebKit::WebOverlay::setContentsToColor): + (BlackBerry::WebKit::WebOverlay::setDrawsContent): + (BlackBerry::WebKit::WebOverlay::invalidate): + (BlackBerry::WebKit::WebOverlay::setClient): + (BlackBerry::WebKit::WebOverlay::override): + (BlackBerry::WebKit::WebOverlay::resetOverrides): + * Api/WebOverlayOverride.cpp: + (BlackBerry::WebKit::WebOverlayOverride::WebOverlayOverride): + * Api/WebOverlay_p.h: + (BlackBerry::WebKit::WebOverlayPrivate::~WebOverlayPrivate): + * Api/WebPage.cpp: + (BlackBerry::WebKit::WebPage::removeOverlay): + (BlackBerry::WebKit::WebPage::addCompositingThreadOverlay): + (BlackBerry::WebKit::WebPage::removeCompositingThreadOverlay): + +2012-05-29 Yong Li <yoli@rim.com> + + [BlackBerry] Add malloc info to about:memory page + https://bugs.webkit.org/show_bug.cgi?id=87676 + + Reviewed by Rob Buis. + + Detailed malloc info can tell us how much memory + in the heaps is being in use. + + * WebCoreSupport/AboutData.cpp: + (WebCore::memoryPage): + +2012-05-29 Arvid Nilsson <anilsson@rim.com> + + [BlackBerry] Make DefaultTapHighlight use the new WebOverlay API + https://bugs.webkit.org/show_bug.cgi?id=87604 + + Reviewed by Antonio Gomes. + + Also add a new method to allow the embedder to use the default tap + highlight instead of replacing it with a custom one just to keep track + of the "shouldHideAfterScroll" flag. + + PR #160262. + + * Api/WebTapHighlight.h: + * WebKitSupport/DefaultTapHighlight.cpp: + (BlackBerry::WebKit::DefaultTapHighlight::DefaultTapHighlight): + (BlackBerry::WebKit::DefaultTapHighlight::draw): + (BlackBerry::WebKit::DefaultTapHighlight::hide): + (BlackBerry::WebKit::DefaultTapHighlight::paintContents): + * WebKitSupport/DefaultTapHighlight.h: + (BlackBerry::WebKit::DefaultTapHighlight::shouldHideAfterScroll): + (DefaultTapHighlight): + +2012-05-29 Arvid Nilsson <anilsson@rim.com> + + [BlackBerry] WebKit-side implementation of SelectionOverlay + https://bugs.webkit.org/show_bug.cgi?id=87605 + + Reviewed by Rob Buis. + + Leverage the new WebOverlay API to move SelectionOverlay to the WebKit + library, so we always draw selection regardless of which embedder is + integrating WebKit. + + PR #160263 + + * Api/WebPage.cpp: + (BlackBerry::WebKit::WebPagePrivate::init): + (BlackBerry::WebKit::WebPage::selectionOverlay): + (WebKit): + * Api/WebPage.h: + (WebKit): + * Api/WebPage_p.h: + (WebPagePrivate): + * Api/WebSelectionOverlay.h: Added. + (WebKit): + * WebKitSupport/SelectionHandler.cpp: + (BlackBerry::WebKit::SelectionHandler::selectionPositionChanged): + * WebKitSupport/SelectionOverlay.cpp: Added. + (WebKit): + (BlackBerry::WebKit::SelectionOverlay::SelectionOverlay): + (BlackBerry::WebKit::SelectionOverlay::~SelectionOverlay): + (BlackBerry::WebKit::SelectionOverlay::draw): + (BlackBerry::WebKit::SelectionOverlay::hide): + (BlackBerry::WebKit::SelectionOverlay::notifySyncRequired): + (BlackBerry::WebKit::SelectionOverlay::paintContents): + * WebKitSupport/SelectionOverlay.h: Added. + (WebKit): + (SelectionOverlay): + (BlackBerry::WebKit::SelectionOverlay::create): + (BlackBerry::WebKit::SelectionOverlay::notifyAnimationStarted): + (BlackBerry::WebKit::SelectionOverlay::showDebugBorders): + (BlackBerry::WebKit::SelectionOverlay::showRepaintCounter): + (BlackBerry::WebKit::SelectionOverlay::contentsVisible): + +2012-05-29 Arvid Nilsson <anilsson@rim.com> + + [BlackBerry] WebOverlay API + https://bugs.webkit.org/show_bug.cgi?id=87603 + + Reviewed by Rob Buis. + + This new API makes it possible to leverage the BlackBerry accelerated + compositing implementation to draw, transform and fluidly animate + overlays in the embedding library or application. + + A WebOverlay has an affinity for the thread where it was created. If + the current thread is the WebKit thread, use WebPage::addOverlay() to + add it to the page, and manipulate it only from the WebKit thread, with + exception of the "override" functionality which can be used from the + compositing thread. If the current thread is the compositing thread, + use WebPage::addCompositingThreadOverlay() to add it to the page, and + only manipulate it on the compositing thread. + + A WebOverlay can be painted using Skia, or its contents can be set to + an image or a solid color. + + PR #156812 + + * Api/WebAnimation.cpp: Added. + (WebKit): + (BlackBerry::WebKit::WebAnimation::fadeAnimation): + (BlackBerry::WebKit::WebAnimation::name): + (BlackBerry::WebKit::WebAnimation::WebAnimation): + (BlackBerry::WebKit::WebAnimation::~WebAnimation): + (BlackBerry::WebKit::WebAnimation::operator=): + * Api/WebAnimation.h: Added. + (WebKit): + * Api/WebAnimation_p.h: Added. + (WebKit): + (WebAnimationPrivate): + (BlackBerry::WebKit::WebAnimationPrivate::WebAnimationPrivate): + * Api/WebOverlay.cpp: Added. + (WebKit): + (BlackBerry::WebKit::WebOverlay::WebOverlay): + (BlackBerry::WebKit::WebOverlay::~WebOverlay): + (BlackBerry::WebKit::WebOverlay::position): + (BlackBerry::WebKit::WebOverlay::setPosition): + (BlackBerry::WebKit::WebOverlay::anchorPoint): + (BlackBerry::WebKit::WebOverlay::setAnchorPoint): + (BlackBerry::WebKit::WebOverlay::size): + (BlackBerry::WebKit::WebOverlay::setSize): + (BlackBerry::WebKit::WebOverlay::sizeIsScaleInvariant): + (BlackBerry::WebKit::WebOverlay::setSizeIsScaleInvariant): + (BlackBerry::WebKit::WebOverlay::transform): + (BlackBerry::WebKit::WebOverlay::setTransform): + (BlackBerry::WebKit::WebOverlay::opacity): + (BlackBerry::WebKit::WebOverlay::setOpacity): + (BlackBerry::WebKit::WebOverlay::addAnimation): + (BlackBerry::WebKit::WebOverlay::removeAnimation): + (BlackBerry::WebKit::WebOverlay::parent): + (BlackBerry::WebKit::WebOverlay::addChild): + (BlackBerry::WebKit::WebOverlay::removeFromParent): + (BlackBerry::WebKit::WebOverlay::setContentsToImage): + (BlackBerry::WebKit::WebOverlay::setContentsToColor): + (BlackBerry::WebKit::WebOverlay::setDrawsContent): + (BlackBerry::WebKit::WebOverlay::invalidate): + (BlackBerry::WebKit::WebOverlay::setClient): + (BlackBerry::WebKit::WebOverlay::override): + (BlackBerry::WebKit::WebOverlay::resetOverrides): + (BlackBerry::WebKit::WebOverlayPrivate::page): + (BlackBerry::WebKit::WebOverlayPrivate::override): + (BlackBerry::WebKit::WebOverlayPrivate::drawContents): + (BlackBerry::WebKit::WebOverlayPrivate::scheduleCompositingRun): + (BlackBerry::WebKit::WebOverlayPrivateWebKitThread::WebOverlayPrivateWebKitThread): + (BlackBerry::WebKit::WebOverlayPrivateWebKitThread::override): + (BlackBerry::WebKit::WebOverlayPrivateWebKitThread::position): + (BlackBerry::WebKit::WebOverlayPrivateWebKitThread::setPosition): + (BlackBerry::WebKit::WebOverlayPrivateWebKitThread::anchorPoint): + (BlackBerry::WebKit::WebOverlayPrivateWebKitThread::setAnchorPoint): + (BlackBerry::WebKit::WebOverlayPrivateWebKitThread::size): + (BlackBerry::WebKit::WebOverlayPrivateWebKitThread::setSize): + (BlackBerry::WebKit::WebOverlayPrivateWebKitThread::sizeIsScaleInvariant): + (BlackBerry::WebKit::WebOverlayPrivateWebKitThread::setSizeIsScaleInvariant): + (BlackBerry::WebKit::WebOverlayPrivateWebKitThread::transform): + (BlackBerry::WebKit::WebOverlayPrivateWebKitThread::setTransform): + (BlackBerry::WebKit::WebOverlayPrivateWebKitThread::opacity): + (BlackBerry::WebKit::WebOverlayPrivateWebKitThread::setOpacity): + (BlackBerry::WebKit::WebOverlayPrivateWebKitThread::addAnimation): + (BlackBerry::WebKit::WebOverlayPrivateWebKitThread::removeAnimation): + (BlackBerry::WebKit::WebOverlayPrivateWebKitThread::addChild): + (BlackBerry::WebKit::WebOverlayPrivateWebKitThread::removeFromParent): + (BlackBerry::WebKit::WebOverlayPrivateWebKitThread::setContentsToImage): + (BlackBerry::WebKit::WebOverlayPrivateWebKitThread::setContentsToColor): + (BlackBerry::WebKit::WebOverlayPrivateWebKitThread::setDrawsContent): + (BlackBerry::WebKit::WebOverlayPrivateWebKitThread::clear): + (BlackBerry::WebKit::WebOverlayPrivateWebKitThread::invalidate): + (BlackBerry::WebKit::WebOverlayPrivateWebKitThread::resetOverrides): + (BlackBerry::WebKit::WebOverlayPrivateWebKitThread::notifySyncRequired): + (BlackBerry::WebKit::WebOverlayPrivateWebKitThread::paintContents): + (BlackBerry::WebKit::WebOverlayLayerCompositingThreadClient::WebOverlayLayerCompositingThreadClient): + (BlackBerry::WebKit::WebOverlayLayerCompositingThreadClient::~WebOverlayLayerCompositingThreadClient): + (BlackBerry::WebKit::WebOverlayLayerCompositingThreadClient::setDrawsContent): + (BlackBerry::WebKit::WebOverlayLayerCompositingThreadClient::invalidate): + (BlackBerry::WebKit::WebOverlayLayerCompositingThreadClient::setContents): + (BlackBerry::WebKit::WebOverlayLayerCompositingThreadClient::setContentsToColor): + (BlackBerry::WebKit::WebOverlayLayerCompositingThreadClient::layerCompositingThreadDestroyed): + (BlackBerry::WebKit::WebOverlayLayerCompositingThreadClient::layerVisibilityChanged): + (BlackBerry::WebKit::WebOverlayLayerCompositingThreadClient::uploadTexturesIfNeeded): + (BlackBerry::WebKit::WebOverlayLayerCompositingThreadClient::drawTextures): + (BlackBerry::WebKit::WebOverlayLayerCompositingThreadClient::deleteTextures): + (BlackBerry::WebKit::WebOverlayPrivateCompositingThread::WebOverlayPrivateCompositingThread): + (BlackBerry::WebKit::WebOverlayPrivateCompositingThread::~WebOverlayPrivateCompositingThread): + (BlackBerry::WebKit::WebOverlayPrivateCompositingThread::setClient): + (BlackBerry::WebKit::WebOverlayPrivateCompositingThread::override): + (BlackBerry::WebKit::WebOverlayPrivateCompositingThread::position): + (BlackBerry::WebKit::WebOverlayPrivateCompositingThread::setPosition): + (BlackBerry::WebKit::WebOverlayPrivateCompositingThread::anchorPoint): + (BlackBerry::WebKit::WebOverlayPrivateCompositingThread::setAnchorPoint): + (BlackBerry::WebKit::WebOverlayPrivateCompositingThread::size): + (BlackBerry::WebKit::WebOverlayPrivateCompositingThread::setSize): + (BlackBerry::WebKit::WebOverlayPrivateCompositingThread::sizeIsScaleInvariant): + (BlackBerry::WebKit::WebOverlayPrivateCompositingThread::setSizeIsScaleInvariant): + (BlackBerry::WebKit::WebOverlayPrivateCompositingThread::transform): + (BlackBerry::WebKit::WebOverlayPrivateCompositingThread::setTransform): + (BlackBerry::WebKit::WebOverlayPrivateCompositingThread::opacity): + (BlackBerry::WebKit::WebOverlayPrivateCompositingThread::setOpacity): + (BlackBerry::WebKit::WebOverlayPrivateCompositingThread::addAnimation): + (BlackBerry::WebKit::WebOverlayPrivateCompositingThread::removeAnimation): + (BlackBerry::WebKit::WebOverlayPrivateCompositingThread::addChild): + (BlackBerry::WebKit::WebOverlayPrivateCompositingThread::removeFromParent): + (BlackBerry::WebKit::WebOverlayPrivateCompositingThread::setContentsToImage): + (BlackBerry::WebKit::WebOverlayPrivateCompositingThread::setContentsToColor): + (BlackBerry::WebKit::WebOverlayPrivateCompositingThread::setDrawsContent): + (BlackBerry::WebKit::WebOverlayPrivateCompositingThread::clear): + (BlackBerry::WebKit::WebOverlayPrivateCompositingThread::invalidate): + (BlackBerry::WebKit::WebOverlayPrivateCompositingThread::resetOverrides): + * Api/WebOverlay.h: Added. + (WebCore): + (WebKit): + * Api/WebOverlayClient.h: Added. + (WebKit): + * Api/WebOverlayOverride.cpp: Added. + (WebKit): + (BlackBerry::WebKit::WebOverlayOverride::WebOverlayOverride): + (BlackBerry::WebKit::WebOverlayOverride::~WebOverlayOverride): + (BlackBerry::WebKit::WebOverlayOverride::setPosition): + (BlackBerry::WebKit::WebOverlayOverride::setAnchorPoint): + (BlackBerry::WebKit::WebOverlayOverride::setSize): + (BlackBerry::WebKit::WebOverlayOverride::setTransform): + (BlackBerry::WebKit::WebOverlayOverride::setOpacity): + (BlackBerry::WebKit::WebOverlayOverride::addAnimation): + (BlackBerry::WebKit::WebOverlayOverride::removeAnimation): + * Api/WebOverlayOverride.h: Added. + (WebKit): + * Api/WebOverlay_p.h: Added. + (WTF): + (WebCore): + (WebKit): + (WebOverlayPrivate): + (BlackBerry::WebKit::WebOverlayPrivate::WebOverlayPrivate): + (BlackBerry::WebKit::WebOverlayPrivate::~WebOverlayPrivate): + (BlackBerry::WebKit::WebOverlayPrivate::setPage): + (BlackBerry::WebKit::WebOverlayPrivate::setClient): + (BlackBerry::WebKit::WebOverlayPrivate::layerCompositingThread): + (BlackBerry::WebKit::WebOverlayPrivate::graphicsLayer): + (WebOverlayPrivateWebKitThread): + (BlackBerry::WebKit::WebOverlayPrivateWebKitThread::graphicsLayer): + (BlackBerry::WebKit::WebOverlayPrivateWebKitThread::notifyAnimationStarted): + (BlackBerry::WebKit::WebOverlayPrivateWebKitThread::showDebugBorders): + (BlackBerry::WebKit::WebOverlayPrivateWebKitThread::showRepaintCounter): + (BlackBerry::WebKit::WebOverlayPrivateWebKitThread::contentsVisible): + (WebOverlayLayerCompositingThreadClient): + (BlackBerry::WebKit::WebOverlayLayerCompositingThreadClient::setLayer): + (BlackBerry::WebKit::WebOverlayLayerCompositingThreadClient::setClient): + (BlackBerry::WebKit::WebOverlayLayerCompositingThreadClient::drawsContent): + (BlackBerry::WebKit::WebOverlayLayerCompositingThreadClient::contents): + (WebOverlayPrivateCompositingThread): + * Api/WebPage.cpp: + (BlackBerry::WebKit::WebPage::addOverlay): + (WebKit): + (BlackBerry::WebKit::WebPage::removeOverlay): + (BlackBerry::WebKit::WebPage::addCompositingThreadOverlay): + (BlackBerry::WebKit::WebPage::removeCompositingThreadOverlay): + * Api/WebPage.h: + (WebKit): + * Api/WebPageCompositor.cpp: + (BlackBerry::WebKit::WebPageCompositorPrivate::prepareFrame): + (BlackBerry::WebKit::WebPageCompositorPrivate::render): + (WebKit): + (BlackBerry::WebKit::WebPageCompositorPrivate::compositeLayers): + (BlackBerry::WebKit::WebPageCompositorPrivate::drawLayers): + (BlackBerry::WebKit::WebPageCompositorPrivate::addOverlay): + (BlackBerry::WebKit::WebPageCompositorPrivate::removeOverlay): + * Api/WebPageCompositor_p.h: + (BlackBerry::WebKit::WebPageCompositorPrivate::compositingThreadOverlayLayer): + (WebPageCompositorPrivate): + +2012-05-28 Jonathan Dong <jonathan.dong@torchmobile.com.cn> + + [BlackBerry] http authenticate dialog popup only once no matter authentication pass or fail + https://bugs.webkit.org/show_bug.cgi?id=80135 + + Reviewed by Rob Buis. + + RIM PR: 145660 + Fixed a regression introduced by r111810, which used the wrong + credential object. + + Added the interface function didReceivedAuthenticaitonChallenge() + in interface class DumpRenderTreeClient; + Called m_dumpRenderTree->didReceiveAuthenticationChallenge() in + WebPagePrivate::authenticationChallenge() when DRT is enabled. + + Test: reuse existing test cases: + http/tests/loading/basic-credentials-sent-automatically.html + http/tests/loading/basic-auth-resend-wrong-credentials.html + + Resubmit the patch reverted by r115104 after the digest infinite loop + issue for BlackBerry porting get identified and fixed. + + Internally reviewed by Joe Mason <jmason@rim.com> + + * Api/DumpRenderTreeClient.h: + (WebCore): + * Api/WebPage.cpp: + (BlackBerry::WebKit::WebPagePrivate::authenticationChallenge): + * Api/WebPageClient.h: + * Api/WebPage_p.h: + (WebPagePrivate): + +2012-05-28 Arvid Nilsson <anilsson@rim.com> + + [BlackBerry] Always create a compositor + https://bugs.webkit.org/show_bug.cgi?id=87598 + + Reviewed by Rob Buis. + + There will likely be compositing layers either due to web content or + due to overlays. + + Defer initialization of OpenGL objects (i.e., delay creation of the + LayerRenderer object) until we actually need to draw and there are such + layers, to avoid initializing OpenGL in the unlikely case that there + are no compositing layers or overlay layers. + + PR #156811 + + * Api/WebPage.cpp: + (BlackBerry::WebKit::WebPagePrivate::init): + (BlackBerry::WebKit::WebPagePrivate::createCompositor): + * Api/WebPageCompositor.cpp: + (BlackBerry::WebKit::WebPageCompositorPrivate::setContext): + (BlackBerry::WebKit::WebPageCompositorPrivate::prepareFrame): + (BlackBerry::WebKit::WebPageCompositorPrivate::render): + (BlackBerry::WebKit::WebPageCompositorPrivate::drawLayers): + * Api/WebPageCompositor_p.h: + (WebPageCompositorPrivate): + +2012-05-28 Arvid Nilsson <anilsson@rim.com> + + [BlackBerry] Dangling pointer in WebPagePrivate::setCompositor() message + https://bugs.webkit.org/show_bug.cgi?id=87590 + + Reviewed by Rob Buis. + + A crash would be seen in GuardedPointerBase::getWithGuardLocked when + attempting to unpickle and execute serialized call to setCompositor. + + The problem was that the message had been created with a dangling + pointer as the target. The web page failed to inform its compositor + that it was being destroyed due to an early return in + WebPagePrivate::destroyCompositor. + + The root cause was that a method called "destroyCompositor" was being + called in two situations, when navigating to a new page as well as when + actually deleting the web page. And in one case, we really only wanted + to free up some memory by clearing textures, while in the other case we + really did want to destroy the compositor. + + Fixed by calling a method to release textures when that's what we want + to do, and calling a method to destroy the compositor when that's what + we want to do, and making that latter method unconditional. + + Reviewed internally by Jeff Rogers. + + PR #156765 + + * Api/WebPage.cpp: + (BlackBerry::WebKit::WebPagePrivate::setLoadState): + (BlackBerry::WebKit::WebPagePrivate::destroyCompositor): + +2012-05-28 Arvid Nilsson <anilsson@rim.com> + + [BlackBerry] Add a default tap highlight + https://bugs.webkit.org/show_bug.cgi?id=87569 + + Reviewed by Rob Buis. + + We used to require the embedder to implement tap highlight drawing. + Now, a default tap highlight, implemented using the recently added + accelerated compositing overlay layer support, can be used instead. + + The tap highlight appears instantly but fades out when hidden. + + The default tap highlight can be overridden using the new + WebPage::setTapHighlight() method. + + Reviewed internally by Mike Lattanzio and Mike Fenton. + + PR #154329 + + * Api/WebPage.cpp: + (BlackBerry::WebKit::WebPagePrivate::init): + (BlackBerry::WebKit::WebPage::tapHighlight): + (WebKit): + (BlackBerry::WebKit::WebPage::setTapHighlight): + * Api/WebPage.h: + (WebKit): + * Api/WebPageClient.h: + * Api/WebPage_p.h: + (WebCore): + (WebPagePrivate): + * Api/WebTapHighlight.h: Added. + (WebKit): + * WebKitSupport/DefaultTapHighlight.cpp: Added. + (WebKit): + (BlackBerry::WebKit::fadeAnimationName): + (BlackBerry::WebKit::DefaultTapHighlight::DefaultTapHighlight): + (BlackBerry::WebKit::DefaultTapHighlight::~DefaultTapHighlight): + (BlackBerry::WebKit::DefaultTapHighlight::draw): + (BlackBerry::WebKit::DefaultTapHighlight::hide): + (BlackBerry::WebKit::DefaultTapHighlight::notifySyncRequired): + (BlackBerry::WebKit::DefaultTapHighlight::paintContents): + * WebKitSupport/DefaultTapHighlight.h: Added. + (WebKit): + (DefaultTapHighlight): + (BlackBerry::WebKit::DefaultTapHighlight::create): + (BlackBerry::WebKit::DefaultTapHighlight::notifyAnimationStarted): + (BlackBerry::WebKit::DefaultTapHighlight::showDebugBorders): + (BlackBerry::WebKit::DefaultTapHighlight::showRepaintCounter): + (BlackBerry::WebKit::DefaultTapHighlight::contentsVisible): + * WebKitSupport/TouchEventHandler.cpp: + (BlackBerry::WebKit::TouchEventHandler::drawTapHighlight): + +2012-05-28 Arvid Nilsson <anilsson@rim.com> + + [BlackBerry] Add an overlay layer + https://bugs.webkit.org/show_bug.cgi?id=87567 + + Reviewed by Antonio Gomes. + + The overlay layer allows us to have compositing layers even though the + web page is not currently using accelerated compositing. + + These layers can be used to implement tap highlight, inspector overlay + and more. + + Reviewed internally by Filip Spacek. + + PR #154335 + + * Api/WebPage.cpp: + (BlackBerry::WebKit::WebPagePrivate::scheduleRootLayerCommit): + (BlackBerry::WebKit::WebPagePrivate::overlayLayer): + (WebKit): + (BlackBerry::WebKit::WebPagePrivate::commitRootLayer): + (BlackBerry::WebKit::WebPagePrivate::commitRootLayerIfNeeded): + * Api/WebPageCompositor.cpp: + (BlackBerry::WebKit::WebPageCompositorPrivate::setOverlayLayer): + (WebKit): + (BlackBerry::WebKit::WebPageCompositorPrivate::prepareFrame): + (BlackBerry::WebKit::WebPageCompositorPrivate::render): + (BlackBerry::WebKit::WebPageCompositorPrivate::drawLayers): + * Api/WebPageCompositor_p.h: + (BlackBerry::WebKit::WebPageCompositorPrivate::overlayLayer): + (WebPageCompositorPrivate): + * Api/WebPage_p.h: + (WebPagePrivate): + +2012-05-28 Arvid Nilsson <anilsson@rim.com> + + [BlackBerry] Update WebPageCompositor::render() API + https://bugs.webkit.org/show_bug.cgi?id=87565 + + Reviewed by Rob Buis. + + The new API allows the embedder to specify the root transform and many + OpenGL related parameters to be used when rendering the web page. + + To honor the transform, we have to implement a way to composite the + BackingStore output using a generic transform. This method, + BackingStorePrivate::compositeContents(), uses a strategy that differs + from blitContents(), because that one is optimized for software + blitting, while this one is optimized for GPU rendering. Specifically, + instead of drawing the checkerboard first, and the rendered subregions + of the tile afterward, we draw the whole tile in one call, and then + draw checkered regions on top, if any. + + Removed the blit generation condvar from the new code paths for drawing + BackingStore output using a transform, since the condvar is ineffective + in preventing flicker when we're not in charge of swapping the window. + Instead, another synchronization solution will be implemented in the + future. + + Reviewed internally by Filip Spacek. + Some parts reviewed internally by Jacky Jiang and others by + Mike Lattanzio. + + PR #151887, #154334 + + * Api/BackingStore.cpp: + (BlackBerry::WebKit::BackingStorePrivate::render): + (BlackBerry::WebKit::BackingStorePrivate::blitContents): + (WebKit): + (BlackBerry::WebKit::BackingStorePrivate::compositeContents): + * Api/BackingStore_p.h: + (WebCore): + (BackingStorePrivate): + * Api/WebPageCompositor.cpp: + (BlackBerry::WebKit::WebPageCompositorPrivate::setContext): + (BlackBerry::WebKit::WebPageCompositorPrivate::setRootLayer): + (BlackBerry::WebKit::WebPageCompositorPrivate::prepareFrame): + (BlackBerry::WebKit::WebPageCompositorPrivate::render): + (BlackBerry::WebKit::WebPageCompositorPrivate::drawLayers): + (BlackBerry::WebKit::WebPageCompositor::prepareFrame): + (BlackBerry::WebKit::WebPageCompositor::render): + * Api/WebPageCompositor.h: + * Api/WebPageCompositorClient.h: + * Api/WebPageCompositor_p.h: + (WebPageCompositorPrivate): + * WebCoreSupport/ChromeClientBlackBerry.cpp: + +2012-05-28 Arvid Nilsson <anilsson@rim.com> + + [BlackBerry] Plumb through the return value of makeCurrent to caller + https://bugs.webkit.org/show_bug.cgi?id=87564 + + Reviewed by Rob Buis. + + This way the caller can take appropriate action if makeCurrent fails, + for example because we're running out of memory. + + Reviewed internally by George Staikos. + + PR #149721 + + * WebKitSupport/GLES2Context.cpp: + (BlackBerry::WebKit::GLES2Context::makeCurrent): + 2012-05-27 Arvid Nilsson <anilsson@rim.com> [BlackBerry] Crash when deleting WebPageCompositor diff --git a/Source/WebKit/blackberry/WebCoreSupport/AboutData.cpp b/Source/WebKit/blackberry/WebCoreSupport/AboutData.cpp index 6c79d54f9..e217742da 100644 --- a/Source/WebKit/blackberry/WebCoreSupport/AboutData.cpp +++ b/Source/WebKit/blackberry/WebCoreSupport/AboutData.cpp @@ -19,13 +19,15 @@ #include "config.h" #include "AboutData.h" +#include "CString.h" #include "MemoryCache.h" #include "SurfacePool.h" #include "WebKitVersion.h" +#include <process.h> #include <BlackBerryPlatformSettings.h> +#include <sys/stat.h> #include <sys/utsname.h> -#include <wtf/Platform.h> namespace WebCore { @@ -195,31 +197,57 @@ String memoryPage() // generate cache information MemoryCache* cacheInc = memoryCache(); - MemoryCache::Statistics stat = cacheInc->getStatistics(); + MemoryCache::Statistics cacheStat = cacheInc->getStatistics(); page += String("<h2>Cache Information</h2>") + "<table align=\"center\" rules=\"all\"><tr> <th>Item</th> <th>Count</th> <th>Size<br>KB</th> <th>Living<br>KB</th> <th>Decoded<br>KB</th></tr>"; MemoryCache::TypeStatistic total; - total.count = stat.images.count + stat.cssStyleSheets.count - + stat.scripts.count + stat.xslStyleSheets.count + stat.fonts.count; + total.count = cacheStat.images.count + cacheStat.cssStyleSheets.count + + cacheStat.scripts.count + cacheStat.xslStyleSheets.count + cacheStat.fonts.count; total.size = cacheInc->totalSize(); - total.liveSize = stat.images.liveSize + stat.cssStyleSheets.liveSize - + stat.scripts.liveSize + stat.xslStyleSheets.liveSize + stat.fonts.liveSize; - total.decodedSize = stat.images.decodedSize - + stat.cssStyleSheets.decodedSize + stat.scripts.decodedSize - + stat.xslStyleSheets.decodedSize + stat.fonts.decodedSize; + total.liveSize = cacheStat.images.liveSize + cacheStat.cssStyleSheets.liveSize + + cacheStat.scripts.liveSize + cacheStat.xslStyleSheets.liveSize + cacheStat.fonts.liveSize; + total.decodedSize = cacheStat.images.decodedSize + + cacheStat.cssStyleSheets.decodedSize + cacheStat.scripts.decodedSize + + cacheStat.xslStyleSheets.decodedSize + cacheStat.fonts.decodedSize; page += cacheTypeStatisticToHTMLTr("Total", total); - page += cacheTypeStatisticToHTMLTr("Images", stat.images); - page += cacheTypeStatisticToHTMLTr("CSS Style Sheets", stat.cssStyleSheets); - page += cacheTypeStatisticToHTMLTr("Scripts", stat.scripts); + page += cacheTypeStatisticToHTMLTr("Images", cacheStat.images); + page += cacheTypeStatisticToHTMLTr("CSS Style Sheets", cacheStat.cssStyleSheets); + page += cacheTypeStatisticToHTMLTr("Scripts", cacheStat.scripts); #if ENABLE(XSLT) - page += cacheTypeStatisticToHTMLTr("XSL Style Sheets", stat.xslStyleSheets); + page += cacheTypeStatisticToHTMLTr("XSL Style Sheets", cacheStat.xslStyleSheets); #endif - page += cacheTypeStatisticToHTMLTr("Fonts", stat.fonts); + page += cacheTypeStatisticToHTMLTr("Fonts", cacheStat.fonts); - page += "</table></body></html>"; + page += "</table>"; + +#if !defined(PUBLIC_BUILD) || !PUBLIC_BUILD + struct mallinfo mallocInfo = mallinfo(); + + page += String("<h2>Malloc Information</h2>") + "<table align=\"center\" rules=\"all\">"; + + page += numberToHTMLTr("Total space in use", mallocInfo.usmblks + mallocInfo.uordblks); + page += numberToHTMLTr("Total space in free blocks", mallocInfo.fsmblks + mallocInfo.fordblks); + page += numberToHTMLTr("Size of the arena", mallocInfo.arena); + page += numberToHTMLTr("Number of big blocks in use", mallocInfo.ordblks); + page += numberToHTMLTr("Number of small blocks in use", mallocInfo.smblks); + page += numberToHTMLTr("Number of header blocks in use", mallocInfo.hblks); + page += numberToHTMLTr("Space in header block headers", mallocInfo.hblkhd); + page += numberToHTMLTr("Space in small blocks in use", mallocInfo.usmblks); + page += numberToHTMLTr("Memory in free small blocks", mallocInfo.fsmblks); + page += numberToHTMLTr("Space in big blocks in use", mallocInfo.uordblks); + page += numberToHTMLTr("Memory in free big blocks", mallocInfo.fordblks); + + struct stat processInfo; + if (!stat(String::format("/proc/%u/as", getpid()).latin1().data(), &processInfo)) + page += numberToHTMLTr("Process total mapped memory", processInfo.st_size); + + page += "</table>"; +#endif + + page += "</body></html>"; return page; } diff --git a/Source/WebKit/blackberry/WebCoreSupport/AboutDataEnableFeatures.in b/Source/WebKit/blackberry/WebCoreSupport/AboutDataEnableFeatures.in index 32e973868..8a0adf79d 100644 --- a/Source/WebKit/blackberry/WebCoreSupport/AboutDataEnableFeatures.in +++ b/Source/WebKit/blackberry/WebCoreSupport/AboutDataEnableFeatures.in @@ -107,7 +107,6 @@ PLUGIN_PROXY_FOR_VIDEO POINTER_LOCK PROGRESS_TAG PURGEABLE_MEMORY -QT_IMAGE_DECODER QUOTA REGEXP_TRACING REGISTER_PROTOCOL_HANDLER diff --git a/Source/WebKit/blackberry/WebCoreSupport/ChromeClientBlackBerry.cpp b/Source/WebKit/blackberry/WebCoreSupport/ChromeClientBlackBerry.cpp index d2340879d..4199639d4 100644 --- a/Source/WebKit/blackberry/WebCoreSupport/ChromeClientBlackBerry.cpp +++ b/Source/WebKit/blackberry/WebCoreSupport/ChromeClientBlackBerry.cpp @@ -36,6 +36,7 @@ #include "FrameLoader.h" #include "Geolocation.h" #include "GeolocationControllerClientBlackBerry.h" +#include "GraphicsLayer.h" #include "HTMLInputElement.h" #include "HTMLNames.h" #include "HitTestResult.h" @@ -726,32 +727,14 @@ bool ChromeClientBlackBerry::supportsFullScreenForElement(const WebCore::Element void ChromeClientBlackBerry::enterFullScreenForElement(WebCore::Element* element) { element->document()->webkitWillEnterFullScreenForElement(element); - if (supportsFullscreenForNode(element) && m_webPagePrivate->m_webSettings->fullScreenVideoCapable()) { - // The Browser chrome has its own fullscreen video widget it wants to - // use, and this is a video element. The only reason that - // webkitWillEnterFullScreenForElement() and - // webkitDidEnterFullScreenForElement() are still called in this case - // is so that exitFullScreenForElement() gets called later. - enterFullscreenForNode(element); - } else { - // No fullscreen video widget has been made available by the Browser - // chrome, or this is not a video element. The webkitRequestFullScreen - // Javascript call is often made on a div element. - // This is where we would hide the browser's chrome if we wanted to. - } + m_webPagePrivate->enterFullScreenForElement(element); element->document()->webkitDidEnterFullScreenForElement(element); } void ChromeClientBlackBerry::exitFullScreenForElement(WebCore::Element* element) { element->document()->webkitWillExitFullScreenForElement(element); - if (supportsFullscreenForNode(element) && m_webPagePrivate->m_webSettings->fullScreenVideoCapable()) { - // The Browser chrome has its own fullscreen video widget. - exitFullscreenForNode(element); - } else { - // This is where we would restore the browser's chrome - // if hidden above. - } + m_webPagePrivate->exitFullScreenForElement(element); element->document()->webkitDidExitFullScreenForElement(element); } #endif diff --git a/Source/WebKit/blackberry/WebCoreSupport/EditorClientBlackBerry.cpp b/Source/WebKit/blackberry/WebCoreSupport/EditorClientBlackBerry.cpp index ee314c933..d1ed4f4df 100644 --- a/Source/WebKit/blackberry/WebCoreSupport/EditorClientBlackBerry.cpp +++ b/Source/WebKit/blackberry/WebCoreSupport/EditorClientBlackBerry.cpp @@ -565,7 +565,7 @@ void EditorClientBlackBerry::checkGrammarOfString(const UChar*, int, WTF::Vector notImplemented(); } -void EditorClientBlackBerry::requestCheckingOfString(SpellChecker*, const TextCheckingRequest&) +void EditorClientBlackBerry::requestCheckingOfString(WTF::PassRefPtr<WebCore::TextCheckingRequest>) { notImplemented(); } diff --git a/Source/WebKit/blackberry/WebCoreSupport/EditorClientBlackBerry.h b/Source/WebKit/blackberry/WebCoreSupport/EditorClientBlackBerry.h index 70c62959b..25a8728f5 100644 --- a/Source/WebKit/blackberry/WebCoreSupport/EditorClientBlackBerry.h +++ b/Source/WebKit/blackberry/WebCoreSupport/EditorClientBlackBerry.h @@ -86,7 +86,7 @@ public: virtual String getAutoCorrectSuggestionForMisspelledWord(const String& misspelledWord); virtual void checkGrammarOfString(const UChar*, int, Vector<GrammarDetail, 0u>&, int*, int*); virtual void getGuessesForWord(const String&, const String&, Vector<String>&); - virtual void requestCheckingOfString(SpellChecker*, const TextCheckingRequest&); + virtual void requestCheckingOfString(WTF::PassRefPtr<WebCore::TextCheckingRequest>); virtual TextCheckerClient* textChecker(); virtual void updateSpellingUIWithGrammarString(const String&, const GrammarDetail&); diff --git a/Source/WebKit/blackberry/WebCoreSupport/InspectorClientBlackBerry.cpp b/Source/WebKit/blackberry/WebCoreSupport/InspectorClientBlackBerry.cpp index d9688ff6a..1df776462 100644 --- a/Source/WebKit/blackberry/WebCoreSupport/InspectorClientBlackBerry.cpp +++ b/Source/WebKit/blackberry/WebCoreSupport/InspectorClientBlackBerry.cpp @@ -22,7 +22,10 @@ #include "BackingStore.h" #include "Frame.h" +#include "GraphicsContext.h" +#include "InspectorController.h" #include "NotImplemented.h" +#include "Page.h" #include "RenderObject.h" #include "WebPageClient.h" #include "WebPage_p.h" @@ -42,17 +45,16 @@ void InspectorClientBlackBerry::inspectorDestroyed() void InspectorClientBlackBerry::highlight() { - hideHighlight(); + m_webPagePrivate->setInspectorOverlayClient(this); + if (!m_webPagePrivate->isAcceleratedCompositingActive()) + m_webPagePrivate->mainFrame()->document()->documentElement()->renderer()->repaint(true); } void InspectorClientBlackBerry::hideHighlight() { - if (!m_webPagePrivate->mainFrame() || !m_webPagePrivate->mainFrame()->document() || !m_webPagePrivate->mainFrame()->document()->documentElement() - || !m_webPagePrivate->mainFrame()->document()->documentElement()->renderer()) - return; - - // FIXME: Potentially slow hack, but invalidating everything should work since the actual highlight is drawn by BackingStorePrivate::renderContents(). - m_webPagePrivate->mainFrame()->document()->documentElement()->renderer()->repaint(true); + m_webPagePrivate->setInspectorOverlayClient(0); + if (!m_webPagePrivate->isAcceleratedCompositingActive()) + m_webPagePrivate->mainFrame()->document()->documentElement()->renderer()->repaint(true); } void InspectorClientBlackBerry::openInspectorFrontend(InspectorController*) @@ -92,4 +94,11 @@ void InspectorClientBlackBerry::updateInspectorStateCookie(const String& cookie) notImplemented(); }; +void InspectorClientBlackBerry::paintInspectorOverlay(GraphicsContext& gc) +{ + InspectorController* inspectorController = m_webPagePrivate->m_page->inspectorController(); + if (inspectorController) + inspectorController->drawHighlight(gc); +} + } // namespace WebCore diff --git a/Source/WebKit/blackberry/WebCoreSupport/InspectorClientBlackBerry.h b/Source/WebKit/blackberry/WebCoreSupport/InspectorClientBlackBerry.h index a6a404a7a..3f6f207dd 100644 --- a/Source/WebKit/blackberry/WebCoreSupport/InspectorClientBlackBerry.h +++ b/Source/WebKit/blackberry/WebCoreSupport/InspectorClientBlackBerry.h @@ -21,6 +21,7 @@ #define InspectorClientBlackBerry_h #include "InspectorClient.h" +#include "InspectorOverlay.h" #include "PlatformString.h" #include <wtf/HashMap.h> @@ -32,7 +33,7 @@ class WebPagePrivate; namespace WebCore { -class InspectorClientBlackBerry : public InspectorClient { +class InspectorClientBlackBerry : public InspectorClient, public InspectorOverlay::InspectorOverlayClient { public: InspectorClientBlackBerry(BlackBerry::WebKit::WebPagePrivate*); virtual void inspectorDestroyed(); @@ -50,6 +51,7 @@ public: virtual bool canClearBrowserCache() { return true; } virtual void clearBrowserCookies(); virtual bool canClearBrowserCookies() { return true; } + virtual void paintInspectorOverlay(WebCore::GraphicsContext&); virtual void updateInspectorStateCookie(const String&); diff --git a/Source/WebKit/blackberry/WebCoreSupport/InspectorOverlay.cpp b/Source/WebKit/blackberry/WebCoreSupport/InspectorOverlay.cpp new file mode 100644 index 000000000..c568f1341 --- /dev/null +++ b/Source/WebKit/blackberry/WebCoreSupport/InspectorOverlay.cpp @@ -0,0 +1,128 @@ +/* + * Copyright (C) 2012 Research In Motion Limited. All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "config.h" + +#include "InspectorOverlay.h" + +#include "Frame.h" +#include "FrameView.h" +#include "GraphicsContext.h" +#include "GraphicsLayer.h" +#include "Page.h" +#include "Settings.h" +#include "WebPage_p.h" + + +namespace WebCore { + +PassOwnPtr<InspectorOverlay> InspectorOverlay::create(BlackBerry::WebKit::WebPagePrivate* page, InspectorOverlayClient* client) +{ + return adoptPtr(new InspectorOverlay(page, client)); +} + +InspectorOverlay::InspectorOverlay(BlackBerry::WebKit::WebPagePrivate* page, InspectorOverlayClient* client) + : m_webPage(page) + , m_client(client) +{ +} + +#if USE(ACCELERATED_COMPOSITING) +void InspectorOverlay::notifySyncRequired(const GraphicsLayer*) +{ + m_webPage->scheduleRootLayerCommit(); +} + +void InspectorOverlay::paintContents(const GraphicsLayer*, GraphicsContext& context, GraphicsLayerPaintingPhase, const IntRect& inClip) +{ + context.save(); + IntPoint scrollPosition = m_webPage->focusedOrMainFrame()->view()->scrollPosition(); + context.translate(scrollPosition.x(), scrollPosition.y()); + m_client->paintInspectorOverlay(context); + context.restore(); +} + +bool InspectorOverlay::showDebugBorders(const GraphicsLayer*) const +{ + return m_webPage->m_page->settings()->showDebugBorders(); +} + +bool InspectorOverlay::showRepaintCounter(const GraphicsLayer*) const +{ + return m_webPage->m_page->settings()->showRepaintCounter(); +} + +bool InspectorOverlay::contentsVisible(const GraphicsLayer*, const IntRect& contentRect) const +{ + return true; +} +#endif + +InspectorOverlay::~InspectorOverlay() { } + +void InspectorOverlay::clear() +{ + invalidateWebFrame(); + +#if USE(ACCELERATED_COMPOSITING) + if (m_overlay) { + m_overlay->removeFromParent(); + m_overlay = nullptr; + } +#endif +} + +void InspectorOverlay::update() +{ + invalidateWebFrame(); + +#if USE(ACCELERATED_COMPOSITING) + if (!m_overlay) { + m_overlay = adoptPtr(new BlackBerry::WebKit::WebOverlay(this)); + const IntSize size = m_webPage->viewportSize(); + m_overlay->setSize(FloatSize(size.width(), size.height())); + m_webPage->m_webPage->addOverlay(m_overlay.get()); + } + + m_overlay->setDrawsContent(true); + m_overlay->setOpacity(1.0); + m_overlay->invalidate(); +#endif +} + +void InspectorOverlay::paintWebFrame(GraphicsContext& gc) +{ + if (!m_webPage->isAcceleratedCompositingActive()) + m_client->paintInspectorOverlay(gc); +} + +void InspectorOverlay::invalidateWebFrame() +{ + // InspectorOverlayClient does the actual painting of the overlay. + // Here we just make sure to invalidate. + if (!m_webPage->isAcceleratedCompositingActive()) { + // FIXME: able to invalidate a smaller rect. + // FIXME: Is it important to just invalidate a smaller rect given that + // this is not on a critical codepath? In order to do so, we'd + // have to take scrolling into account. + const IntSize size = m_webPage->viewportSize(); + IntRect damagedRect(0, 0, size.width(), size.height()); + } +} + +} diff --git a/Source/WebKit/blackberry/WebCoreSupport/InspectorOverlay.h b/Source/WebKit/blackberry/WebCoreSupport/InspectorOverlay.h new file mode 100644 index 000000000..7f91e3541 --- /dev/null +++ b/Source/WebKit/blackberry/WebCoreSupport/InspectorOverlay.h @@ -0,0 +1,77 @@ +/* + * Copyright (C) 2012 Research In Motion Limited. All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef InspectorOverlay_h +#define InspectorOverlay_h + +#include "WebOverlay.h" +#include <GraphicsLayerClient.h> +#include <wtf/OwnPtr.h> +#include <wtf/PassOwnPtr.h> + +namespace BlackBerry { +namespace WebKit { +class WebPagePrivate; +} +} + +namespace WebCore { +class GraphicsContext; +class GraphicsLayer; + + +class InspectorOverlay : public WebCore::GraphicsLayerClient { +public: + class InspectorOverlayClient { + public: + virtual void paintInspectorOverlay(GraphicsContext&) = 0; + }; + + static PassOwnPtr<InspectorOverlay> create(BlackBerry::WebKit::WebPagePrivate*, InspectorOverlayClient*); + + ~InspectorOverlay(); + + void setClient(InspectorOverlayClient* client) { m_client = client; } + + void clear(); + void update(); + void paintWebFrame(GraphicsContext&); + +#if USE(ACCELERATED_COMPOSITING) + virtual void notifyAnimationStarted(const GraphicsLayer*, double time) { } + virtual void notifySyncRequired(const GraphicsLayer*); + virtual void paintContents(const GraphicsLayer*, GraphicsContext&, GraphicsLayerPaintingPhase, const IntRect& inClip); + virtual bool showDebugBorders(const GraphicsLayer*) const; + virtual bool showRepaintCounter(const GraphicsLayer*) const; + + virtual bool contentsVisible(const WebCore::GraphicsLayer*, const WebCore::IntRect& contentRect) const; +#endif + +private: + InspectorOverlay(BlackBerry::WebKit::WebPagePrivate*, InspectorOverlayClient*); + void invalidateWebFrame(); + + BlackBerry::WebKit::WebPagePrivate* m_webPage; + InspectorOverlayClient* m_client; + OwnPtr<BlackBerry::WebKit::WebOverlay> m_overlay; +}; + +} // namespace WebCore + + +#endif /* InspectorOverlay_h */ diff --git a/Source/WebKit/blackberry/WebKitSupport/DefaultTapHighlight.cpp b/Source/WebKit/blackberry/WebKitSupport/DefaultTapHighlight.cpp new file mode 100644 index 000000000..4cc565e63 --- /dev/null +++ b/Source/WebKit/blackberry/WebKitSupport/DefaultTapHighlight.cpp @@ -0,0 +1,141 @@ +/* + * Copyright (C) 2012 Research In Motion Limited. All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "config.h" + +#if USE(ACCELERATED_COMPOSITING) + +#include "DefaultTapHighlight.h" + +#include "GraphicsContext.h" +#include "Path.h" +#include "PlatformContextSkia.h" +#include "WebAnimation.h" +#include "WebPage_p.h" + +#include <BlackBerryPlatformMessageClient.h> + +using namespace WebCore; + +namespace BlackBerry { +namespace WebKit { + +const double ActiveTextFadeAnimationDuration = 0.3; + +static const char* fadeAnimationName() { return "fade"; } + +DefaultTapHighlight::DefaultTapHighlight(WebPagePrivate* page) + : m_page(page) + , m_visible(false) + , m_shouldHideAfterScroll(false) +{ +} + +DefaultTapHighlight::~DefaultTapHighlight() +{ +} + +void DefaultTapHighlight::draw(const Platform::IntRectRegion& region, int red, int green, int blue, int alpha, bool hideAfterScroll) +{ + ASSERT(BlackBerry::Platform::webKitThreadMessageClient()->isCurrentThread()); + + m_region = region; + m_color = Color(red, green, blue, std::min(128, alpha)); + m_shouldHideAfterScroll = hideAfterScroll; + FloatRect rect = IntRect(m_region.extents()); + if (rect.isEmpty()) + return; + + m_visible = true; + + if (!m_overlay) { + m_overlay = adoptPtr(new WebOverlay(this)); + m_page->m_webPage->addOverlay(m_overlay.get()); + } + + m_overlay->resetOverrides(); + m_overlay->setPosition(rect.location()); + m_overlay->setSize(rect.size()); + m_overlay->setDrawsContent(true); + m_overlay->removeAnimation(fadeAnimationName()); + m_overlay->setOpacity(1.0); + m_overlay->invalidate(); +} + +void DefaultTapHighlight::hide() +{ + if (!m_overlay) + return; + + // Since WebAnimation is not thread safe, we create a new one each time instead of reusing the same object on different + // threads (that would introduce race conditions). + WebAnimation fadeAnimation = WebAnimation::fadeAnimation(fadeAnimationName(), 1.0, 0.0, ActiveTextFadeAnimationDuration); + + // Normally, this method is called on the WebKit thread, but it can also be + // called from the compositing thread. + if (BlackBerry::Platform::webKitThreadMessageClient()->isCurrentThread()) { + if (!m_visible) + return; + m_visible = false; + m_overlay->addAnimation(fadeAnimation); + } else if (BlackBerry::Platform::userInterfaceThreadMessageClient()->isCurrentThread()) + m_overlay->override()->addAnimation(fadeAnimation); +} + +void DefaultTapHighlight::notifySyncRequired(const GraphicsLayer*) +{ + m_page->scheduleRootLayerCommit(); +} + +void DefaultTapHighlight::paintContents(const GraphicsLayer*, GraphicsContext& c, GraphicsLayerPaintingPhase, const IntRect& /*inClip*/) +{ + std::vector<Platform::IntRect> rects = m_region.rects(); + Platform::IntRect rect = m_region.extents(); + SkRegion overlayRegion; + + unsigned rectCount = m_region.numRects(); + if (!rectCount) + return; + + for (unsigned i = 0; i < rectCount; ++i) { + Platform::IntRect rectToPaint = rects[i]; + SkIRect r = SkIRect::MakeXYWH(rectToPaint.x(), rectToPaint.y(), rectToPaint.width(), rectToPaint.height()); + overlayRegion.op(r, SkRegion::kUnion_Op); + } + + SkPath pathToPaint; + overlayRegion.getBoundaryPath(&pathToPaint); + + Path path(pathToPaint); + c.save(); + c.translate(-rect.x(), -rect.y()); + + // Draw tap highlight + c.setFillColor(m_color, ColorSpaceDeviceRGB); + c.fillPath(path); + Color darker = Color(m_color.red(), m_color.green(), m_color.blue()); // Get rid of alpha. + c.setStrokeColor(darker, ColorSpaceDeviceRGB); + c.setStrokeThickness(1); + c.strokePath(path); + c.restore(); +} + +} // namespace WebKit +} // namespace BlackBerry + +#endif // USE(ACCELERATED_COMPOSITING) diff --git a/Source/WebKit/blackberry/WebKitSupport/DefaultTapHighlight.h b/Source/WebKit/blackberry/WebKitSupport/DefaultTapHighlight.h new file mode 100644 index 000000000..fdf632a50 --- /dev/null +++ b/Source/WebKit/blackberry/WebKitSupport/DefaultTapHighlight.h @@ -0,0 +1,79 @@ +/* + * Copyright (C) 2011, 2012 Research In Motion Limited. All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef DefaultTapHighlight_h +#define DefaultTapHighlight_h + +#include "BlackBerryGlobal.h" + +#if USE(ACCELERATED_COMPOSITING) + +#include "Color.h" +#include "GraphicsLayerClient.h" +#include "WebOverlay.h" +#include "WebTapHighlight.h" + +#include <BlackBerryPlatformIntRectRegion.h> +#include <wtf/OwnPtr.h> +#include <wtf/PassOwnPtr.h> + +namespace BlackBerry { +namespace WebKit { + +class WebPagePrivate; + +class DefaultTapHighlight : public WebTapHighlight, public WebCore::GraphicsLayerClient { +public: + static PassOwnPtr<DefaultTapHighlight> create(WebPagePrivate* page) + { + return adoptPtr(new DefaultTapHighlight(page)); + } + + virtual ~DefaultTapHighlight(); + + virtual void draw(const Platform::IntRectRegion&, int red, int green, int blue, int alpha, bool hideAfterScroll); + virtual void hide(); + + virtual bool shouldHideAfterScroll() const { return m_shouldHideAfterScroll; } + + // GraphicsLayerClient + virtual void notifyAnimationStarted(const WebCore::GraphicsLayer*, double time) { } + virtual void notifySyncRequired(const WebCore::GraphicsLayer*); + virtual void paintContents(const WebCore::GraphicsLayer*, WebCore::GraphicsContext&, WebCore::GraphicsLayerPaintingPhase, const WebCore::IntRect& inClip); + virtual bool showDebugBorders(const WebCore::GraphicsLayer*) const { return false; } + virtual bool showRepaintCounter(const WebCore::GraphicsLayer*) const { return false; } + virtual bool contentsVisible(const WebCore::GraphicsLayer*, const WebCore::IntRect& contentRect) const { return true; } + + +private: + DefaultTapHighlight(WebPagePrivate*); + + WebPagePrivate* m_page; + OwnPtr<WebOverlay> m_overlay; + BlackBerry::Platform::IntRectRegion m_region; + WebCore::Color m_color; + bool m_visible; + bool m_shouldHideAfterScroll; +}; + +} // namespace WebKit +} // namespace BlackBerry + +#endif // USE(ACCELERATED_COMPOSITING) + +#endif // DefaultTapHighlight_h diff --git a/Source/WebKit/blackberry/WebKitSupport/FatFingers.cpp b/Source/WebKit/blackberry/WebKitSupport/FatFingers.cpp index fe7f848d7..d9fa43b1e 100644 --- a/Source/WebKit/blackberry/WebKitSupport/FatFingers.cpp +++ b/Source/WebKit/blackberry/WebKitSupport/FatFingers.cpp @@ -492,7 +492,10 @@ void FatFingers::getNodesFromRect(Document* document, const IntPoint& contentPos getPaddings(topPadding, rightPadding, bottomPadding, leftPadding); HitTestRequest request(HitTestRequest::ReadOnly | HitTestRequest::Active | HitTestRequest::IgnoreClipping); - HitTestResult result(contentPos, topPadding, rightPadding, bottomPadding, leftPadding, HitTestShadowDOM); + // The user functions checkForText() and findIntersectingRegions() uses the Node.wholeText() to checkFingerIntersection() + // not the text in its shadow tree. + ShadowContentFilterPolicy allowShadow = m_targetType == Text ? DoNotAllowShadowContent : AllowShadowContent; + HitTestResult result(contentPos, topPadding, rightPadding, bottomPadding, leftPadding, allowShadow); document->renderView()->layer()->hitTest(request, result); intersectedNodes = result.rectBasedTestResult(); diff --git a/Source/WebKit/blackberry/WebKitSupport/GLES2Context.cpp b/Source/WebKit/blackberry/WebKitSupport/GLES2Context.cpp index 06507acac..7812da8df 100644 --- a/Source/WebKit/blackberry/WebKitSupport/GLES2Context.cpp +++ b/Source/WebKit/blackberry/WebKitSupport/GLES2Context.cpp @@ -100,8 +100,7 @@ Platform::IntSize GLES2Context::surfaceSize() const bool GLES2Context::makeCurrent() { - Platform::Graphics::makeBufferCurrent(buffer(), Platform::Graphics::GLES2); - return true; + return Platform::Graphics::makeBufferCurrent(buffer(), Platform::Graphics::GLES2); } bool GLES2Context::swapBuffers() diff --git a/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp b/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp index af2db171f..5d5906c76 100644 --- a/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp +++ b/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp @@ -120,11 +120,13 @@ InputHandler::InputHandler(WebPagePrivate* page) , m_composingTextEnd(0) , m_pendingKeyboardVisibilityChange(NoChange) , m_delayKeyboardVisibilityChange(false) + , m_selectClient(0) { } InputHandler::~InputHandler() { + delete m_selectClient; } static BlackBerryInputType convertInputType(const HTMLInputElement* inputElement) diff --git a/Source/WebKit/blackberry/WebKitSupport/SelectionHandler.cpp b/Source/WebKit/blackberry/WebKitSupport/SelectionHandler.cpp index da43f2ca4..51c9b72c3 100644 --- a/Source/WebKit/blackberry/WebKitSupport/SelectionHandler.cpp +++ b/Source/WebKit/blackberry/WebKitSupport/SelectionHandler.cpp @@ -32,6 +32,7 @@ #include "TouchEventHandler.h" #include "WebPageClient.h" #include "WebPage_p.h" +#include "WebSelectionOverlay.h" #include "htmlediting.h" #include "visible_units.h" @@ -924,6 +925,8 @@ void SelectionHandler::selectionPositionChanged(bool visualChangeOnly) DEBUG_SELECTION(BlackBerry::Platform::LogLevelInfo, "SelectionHandler::selectionPositionChanged Start Rect=(%d, %d) (%d x %d) End Rect=(%d, %d) (%d x %d)", startCaret.x(), startCaret.y(), startCaret.width(), startCaret.height(), endCaret.x(), endCaret.y(), endCaret.width(), endCaret.height()); + if (m_webPage->m_selectionOverlay) + m_webPage->m_selectionOverlay->draw(visibleSelectionRegion); m_webPage->m_client->notifySelectionDetailsChanged(startCaret, endCaret, visibleSelectionRegion, inputNodeOverridesTouch()); } diff --git a/Source/WebKit/blackberry/WebKitSupport/SelectionOverlay.cpp b/Source/WebKit/blackberry/WebKitSupport/SelectionOverlay.cpp new file mode 100644 index 000000000..9480e8415 --- /dev/null +++ b/Source/WebKit/blackberry/WebKitSupport/SelectionOverlay.cpp @@ -0,0 +1,125 @@ +/* + * Copyright (C) 2012 Research In Motion Limited. All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "config.h" + +#if USE(ACCELERATED_COMPOSITING) + +#include "SelectionOverlay.h" + +#include "GraphicsContext.h" +#include "Path.h" +#include "PlatformContextSkia.h" +#include "RenderTheme.h" +#include "WebPage_p.h" + +#include <BlackBerryPlatformMessageClient.h> + +using namespace WebCore; + +namespace BlackBerry { +namespace WebKit { + +SelectionOverlay::SelectionOverlay(WebPagePrivate* page) + : m_page(page) +{ +} + +SelectionOverlay::~SelectionOverlay() +{ +} + +void SelectionOverlay::draw(const Platform::IntRectRegion& region) +{ + ASSERT(BlackBerry::Platform::webKitThreadMessageClient()->isCurrentThread()); + + m_region = region; + FloatRect rect = IntRect(m_region.extents()); + if (rect.isEmpty()) { + hide(); + return; + } + + if (!m_overlay) + m_overlay = adoptPtr(new WebOverlay(this)); + + m_page->m_webPage->addOverlay(m_overlay.get()); + m_overlay->resetOverrides(); + m_overlay->setPosition(rect.location()); + m_overlay->setSize(rect.size()); + m_overlay->setDrawsContent(true); + m_overlay->setOpacity(1.0); + m_overlay->invalidate(); +} + +void SelectionOverlay::hide() +{ + if (!m_overlay) + return; + + // Normally, this method is called on the WebKit thread, but it can also be + // called from the compositing thread. + if (BlackBerry::Platform::webKitThreadMessageClient()->isCurrentThread()) + m_page->m_webPage->removeOverlay(m_overlay.get()); + else if (BlackBerry::Platform::userInterfaceThreadMessageClient()->isCurrentThread()) + m_overlay->override()->setOpacity(0); +} + +void SelectionOverlay::notifySyncRequired(const GraphicsLayer*) +{ + m_page->scheduleRootLayerCommit(); +} + +void SelectionOverlay::paintContents(const GraphicsLayer*, GraphicsContext& c, GraphicsLayerPaintingPhase, const IntRect& inClip) +{ + std::vector<Platform::IntRect> rects = m_region.rects(); + Platform::IntRect rect = m_region.extents(); + SkRegion windowRegion; + + unsigned rectCount = m_region.numRects(); + if (!rectCount) + return; + + IntRect clip(inClip); + clip.move(rect.x(), rect.y()); + for (unsigned i = 0; i < rectCount; ++i) { + IntRect rectToPaint = rects[i]; + rectToPaint.intersect(clip); + SkIRect r = SkIRect::MakeXYWH(rectToPaint.x(), rectToPaint.y(), rectToPaint.width(), rectToPaint.height()); + windowRegion.op(r, SkRegion::kUnion_Op); + } + + SkPath pathToPaint; + windowRegion.getBoundaryPath(&pathToPaint); + + Path path(pathToPaint); + c.save(); + c.translate(-rect.x(), -rect.y()); + + // Draw selection overlay + Color color = RenderTheme::defaultTheme()->activeSelectionBackgroundColor(); + c.setFillColor(color, ColorSpaceDeviceRGB); + c.fillPath(path); + + c.restore(); +} + +} // namespace WebKit +} // namespace BlackBerry + +#endif // USE(ACCELERATED_COMPOSITING) diff --git a/Source/WebKit/blackberry/WebKitSupport/SelectionOverlay.h b/Source/WebKit/blackberry/WebKitSupport/SelectionOverlay.h new file mode 100644 index 000000000..aad159f10 --- /dev/null +++ b/Source/WebKit/blackberry/WebKitSupport/SelectionOverlay.h @@ -0,0 +1,74 @@ +/* + * Copyright (C) 2012 Research In Motion Limited. All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef SelectionOverlay_h +#define SelectionOverlay_h + +#include "BlackBerryGlobal.h" + +#if USE(ACCELERATED_COMPOSITING) + +#include "Color.h" +#include "GraphicsLayerClient.h" +#include "WebOverlay.h" +#include "WebSelectionOverlay.h" + +#include <BlackBerryPlatformIntRectRegion.h> +#include <wtf/OwnPtr.h> +#include <wtf/PassOwnPtr.h> + +namespace BlackBerry { +namespace WebKit { + +class WebPagePrivate; + +class SelectionOverlay : public WebSelectionOverlay, public WebCore::GraphicsLayerClient { +public: + static PassOwnPtr<SelectionOverlay> create(WebPagePrivate* page) + { + return adoptPtr(new SelectionOverlay(page)); + } + + virtual ~SelectionOverlay(); + + virtual void draw(const Platform::IntRectRegion&); + virtual void hide(); + + // GraphicsLayerClient + virtual void notifyAnimationStarted(const WebCore::GraphicsLayer*, double time) { } + virtual void notifySyncRequired(const WebCore::GraphicsLayer*); + virtual void paintContents(const WebCore::GraphicsLayer*, WebCore::GraphicsContext&, WebCore::GraphicsLayerPaintingPhase, const WebCore::IntRect& inClip); + virtual bool showDebugBorders(const WebCore::GraphicsLayer*) const { return false; } + virtual bool showRepaintCounter(const WebCore::GraphicsLayer*) const { return false; } + virtual bool contentsVisible(const WebCore::GraphicsLayer*, const WebCore::IntRect& contentRect) const { return true; } + + +private: + SelectionOverlay(WebPagePrivate*); + + WebPagePrivate* m_page; + OwnPtr<WebOverlay> m_overlay; + BlackBerry::Platform::IntRectRegion m_region; +}; + +} // namespace WebKit +} // namespace BlackBerry + +#endif // USE(ACCELERATED_COMPOSITING) + +#endif // SelectionOverlay_h diff --git a/Source/WebKit/blackberry/WebKitSupport/TouchEventHandler.cpp b/Source/WebKit/blackberry/WebKitSupport/TouchEventHandler.cpp index f468464ed..32952356f 100644 --- a/Source/WebKit/blackberry/WebKitSupport/TouchEventHandler.cpp +++ b/Source/WebKit/blackberry/WebKitSupport/TouchEventHandler.cpp @@ -44,6 +44,7 @@ #include "RenderedDocumentMarker.h" #include "SelectionHandler.h" #include "WebPage_p.h" +#include "WebTapHighlight.h" #include <wtf/MathExtras.h> @@ -389,12 +390,9 @@ void TouchEventHandler::drawTapHighlight() Color highlightColor = element->renderStyle()->tapHighlightColor(); - m_webPage->m_client->drawTapHighlight(region, - highlightColor.red(), - highlightColor.green(), - highlightColor.blue(), - highlightColor.alpha(), - shouldHideTapHighlightRightAfterScrolling); + m_webPage->m_tapHighlight->draw(region, + highlightColor.red(), highlightColor.green(), highlightColor.blue(), highlightColor.alpha(), + shouldHideTapHighlightRightAfterScrolling); } } diff --git a/Source/WebKit/chromium/ChangeLog b/Source/WebKit/chromium/ChangeLog index 2baa8ecc1..09ed0651b 100644 --- a/Source/WebKit/chromium/ChangeLog +++ b/Source/WebKit/chromium/ChangeLog @@ -1,3 +1,790 @@ +2012-05-31 Hajime Morrita <morrita@chromium.org> + + REGRESSION(r117572): editing/spelling/spellcheck-async-remove-frame.html crashes on Mac + https://bugs.webkit.org/show_bug.cgi?id=86859 + + Removed a port specific fix which was introduced at r117572. + + Reviewed by Ryosuke Niwa. + + * src/EditorClientImpl.cpp: + (WebKit::EditorClientImpl::frameWillDetachPage): + (WebKit::EditorClientImpl::requestCheckingOfString): + * src/EditorClientImpl.h: + (WebCore): + (EditorClientImpl): + * src/WebTextCheckingCompletionImpl.cpp: + (WebKit::WebTextCheckingCompletionImpl::didFinishCheckingText): + (WebKit::WebTextCheckingCompletionImpl::didCancelCheckingText): + * src/WebTextCheckingCompletionImpl.h: + (WebKit::WebTextCheckingCompletionImpl::WebTextCheckingCompletionImpl): + (WebTextCheckingCompletionImpl): + +2012-05-31 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r119146. + http://trac.webkit.org/changeset/119146 + https://bugs.webkit.org/show_bug.cgi?id=88035 + + android breakage fixed in http://crrev.com/139945 (Requested + by fischman on #webkit). + + * public/WebMediaPlayer.h: + (WebMediaPlayer): + * src/WebMediaPlayerClientImpl.cpp: + (WebKit::WebMediaPlayerClientImpl::didLoadingProgress): + * src/WebMediaPlayerClientImpl.h: + (WebMediaPlayerClientImpl): + +2012-05-31 Shawn Singh <shawnsingh@chromium.org> + + [chromium] Migrate to WebTransformationMatrix + https://bugs.webkit.org/show_bug.cgi?id=87788 + + Reviewed by James Robinson. + + * src/WebLayer.cpp: + (WebKit::WebLayer::setSublayerTransform): + (WebKit::WebLayer::setTransform): + * tests/CCAnimationTestCommon.cpp: + (WebKitTests::FakeTransformTransition::getValue): + * tests/CCAnimationTestCommon.h: + * tests/CCDamageTrackerTest.cpp: + (WebKitTests::executeCalculateDrawTransformsAndVisibility): + (WebKitTests::TEST_F): + * tests/CCKeyframedAnimationCurveTest.cpp: + * tests/CCLayerAnimationControllerTest.cpp: + * tests/CCLayerImplTest.cpp: + (WebCore::TEST): + * tests/CCLayerIteratorTest.cpp: + * tests/CCLayerSorterTest.cpp: + * tests/CCLayerTreeHostCommonTest.cpp: + * tests/CCLayerTreeHostTest.cpp: + (WTF::CCLayerTreeHostTestDeviceScaleFactorScalesViewportAndLayers::commitCompleteOnCCThread): + (WTF::setLayerPropertiesForTesting): + (WTF::CCLayerTreeHostTestAtomicCommitWithPartialUpdate::beginTest): + (WTF::setTestLayerPropertiesForTesting): + (WTF::CCLayerTreeHostTestLayerOcclusion::beginTest): + (WTF::CCLayerTreeHostTestLayerOcclusionWithFilters::beginTest): + (WTF::CCLayerTreeHostTestManySurfaces::beginTest): + * tests/CCLayerTreeTestCommon.h: + (WebKitTests): + * tests/CCMathUtilTest.cpp: + * tests/CCOcclusionTrackerTest.cpp: + (WebKitTests::CCOcclusionTrackerTest::createRoot): + (WebKitTests::CCOcclusionTrackerTest::createLayer): + (WebKitTests::CCOcclusionTrackerTest::createSurface): + (WebKitTests::CCOcclusionTrackerTest::createDrawingLayer): + (WebKitTests::CCOcclusionTrackerTest::createReplicaLayer): + (WebKitTests::CCOcclusionTrackerTest::createDrawingSurface): + (CCOcclusionTrackerTest): + (WebKitTests::CCOcclusionTrackerTest::setBaseProperties): + (WebKitTests::CCOcclusionTrackerTest::setProperties): + (WebKitTests::CCOcclusionTrackerTestRotatedChild::runMyTest): + (WebKitTests::CCOcclusionTrackerTestTranslatedChild::runMyTest): + (WebKitTests::CCOcclusionTrackerTestChildInRotatedChild::runMyTest): + (WebKitTests::CCOcclusionTrackerTestVisitTargetTwoTimes::runMyTest): + (WebKitTests::CCOcclusionTrackerTestSurfaceRotatedOffAxis::runMyTest): + (WebKitTests::CCOcclusionTrackerTestSurfaceWithTwoOpaqueChildren::runMyTest): + (WebKitTests::CCOcclusionTrackerTestOverlappingSurfaceSiblings::runMyTest): + (WebKitTests::CCOcclusionTrackerTestOverlappingSurfaceSiblingsWithTwoTransforms::runMyTest): + (WebKitTests::CCOcclusionTrackerTestFilters::runMyTest): + (WebKitTests::CCOcclusionTrackerTest3dTransform::runMyTest): + (WebKitTests::CCOcclusionTrackerTestPerspectiveTransform::runMyTest): + (WebKitTests::CCOcclusionTrackerTestPerspectiveTransformBehindCamera::runMyTest): + (WebKitTests::CCOcclusionTrackerTestLayerBehindCameraDoesNotOcclude::runMyTest): + (WebKitTests::CCOcclusionTrackerTestLargePixelsOccludeInsideClipRect::runMyTest): + (WebKitTests::CCOcclusionTrackerTestSurfaceOcclusionTranslatesToParent::runMyTest): + (WebKitTests::CCOcclusionTrackerTestDontOccludePixelsNeededForBackgroundFilter::runMyTest): + (WebKitTests::CCOcclusionTrackerTestTwoBackgroundFiltersReduceOcclusionTwice::runMyTest): + (WebKitTests::CCOcclusionTrackerTestDontReduceOcclusionBelowBackgroundFilter::runMyTest): + (WebKitTests::CCOcclusionTrackerTestDontReduceOcclusionIfBackgroundFilterIsOccluded::runMyTest): + (WebKitTests::CCOcclusionTrackerTestReduceOcclusionWhenBackgroundFilterIsPartiallyOccluded::runMyTest): + * tests/CCQuadCullerTest.cpp: + * tests/CCRenderSurfaceTest.cpp: + * tests/FloatQuadTest.cpp: + * tests/LayerChromiumTest.cpp: + * tests/LinkHighlightTest.cpp: + * tests/TiledLayerChromiumTest.cpp: + * tests/WebTransformationMatrixTest.cpp: + (WebKit::TEST): + (WebKit): + +2012-05-31 Ian Vollick <vollick@chromium.org> + + [chromium] Single thread proxy should not tick animations unless the layer renderer has been initialized + https://bugs.webkit.org/show_bug.cgi?id=87873 + + Reviewed by James Robinson. + + When the layer renderer fails to initialize, be sure to stop the animation timer. + + * tests/CCLayerTreeHostTest.cpp: + (CompositorFakeWebGraphicsContext3DWithTextureTracking): + (WTF::CompositorFakeWebGraphicsContext3DWithTextureTracking::create): + (WTF::CompositorFakeWebGraphicsContext3DWithTextureTracking::createTexture): + (WTF::CompositorFakeWebGraphicsContext3DWithTextureTracking::deleteTexture): + (WTF::CompositorFakeWebGraphicsContext3DWithTextureTracking::bindTexture): + (WTF::CompositorFakeWebGraphicsContext3DWithTextureTracking::numTextures): + (WTF::CompositorFakeWebGraphicsContext3DWithTextureTracking::texture): + (WTF::CompositorFakeWebGraphicsContext3DWithTextureTracking::resetTextures): + (WTF::CompositorFakeWebGraphicsContext3DWithTextureTracking::numUsedTextures): + (WTF::CompositorFakeWebGraphicsContext3DWithTextureTracking::usedTexture): + (WTF::CompositorFakeWebGraphicsContext3DWithTextureTracking::resetUsedTextures): + (WTF::CompositorFakeWebGraphicsContext3DWithTextureTracking::CompositorFakeWebGraphicsContext3DWithTextureTracking): + (WTF): + (WTF::TestHooks::didRecreateContext): + (TestHooks): + (WTF::TestHooks::createContext): + (CCLayerTreeHostTest): + (WTF::CCLayerTreeHostTest::clearEndTestTask): + (WTF::CCLayerTreeHostTest::CCLayerTreeHostTest): + (EndTestTask): + (WTF::CCLayerTreeHostTest::EndTestTask::EndTestTask): + (WTF::CCLayerTreeHostTest::EndTestTask::~EndTestTask): + (WTF::CCLayerTreeHostTest::EndTestTask::clearTest): + (WTF::CCLayerTreeHostTest::EndTestTask::run): + (WTF::CCLayerTreeHostTest::runTest): + (WTF::CCLayerTreeHostTest::endTestAfterDelay): + (FakeWebGraphicsContext3DMakeCurrentFails): + (WTF::FakeWebGraphicsContext3DMakeCurrentFails::makeContextCurrent): + (CCLayerTreeHostTestInitializeLayerRendererFailsAfterAddAnimation): + (WTF::CCLayerTreeHostTestInitializeLayerRendererFailsAfterAddAnimation::CCLayerTreeHostTestInitializeLayerRendererFailsAfterAddAnimation): + (WTF::CCLayerTreeHostTestInitializeLayerRendererFailsAfterAddAnimation::beginTest): + (WTF::CCLayerTreeHostTestInitializeLayerRendererFailsAfterAddAnimation::animateLayers): + (WTF::CCLayerTreeHostTestInitializeLayerRendererFailsAfterAddAnimation::didRecreateContext): + (WTF::CCLayerTreeHostTestInitializeLayerRendererFailsAfterAddAnimation::afterTest): + (WTF::TEST_F): + +2012-05-15 Brett Wilson <brettw@chromium.org> + + Hook up GTK IsKeyPad flag for keyboard events, and preserve this flag + on all platforms when converting back to a WebKeyboardEvent. + + https://bugs.webkit.org/show_bug.cgi?id=86514 + + Reviewed by Dimitri Glazkov. + + * src/WebInputEventConversion.cpp: + (WebKit::WebKeyboardEventBuilder::WebKeyboardEventBuilder): + * src/gtk/WebInputEventFactory.cpp: + (WebKit::WebInputEventFactory::keyboardEvent): + * tests/WebInputEventFactoryTestGtk.cpp: + +2012-05-31 Alec Flett <alecflett@chromium.org> + + IndexedDB: Implement IDBTransaction.error and IDBRequest.error + https://bugs.webkit.org/show_bug.cgi?id=87865 + + Reviewed by Tony Chang. + + IDBDatabaseError now honors IDB-specific DOMException codes, + so make sure that's how they are passed to/from chromium. + + * src/WebIDBDatabaseError.cpp: + (WebKit::WebIDBDatabaseError::assign): + +2012-05-31 James Robinson <jamesr@chromium.org> + + [chromium] Assertion failures during compositor startup in lost context situations + https://bugs.webkit.org/show_bug.cgi?id=87912 + + Reviewed by Adrienne Walker. + + Adds a unit test verifying that even if we lose our context during or before initialization we get through the + rest of the path without failing ASSERT()s. + + * tests/LayerRendererChromiumTest.cpp: + (LoseContextOnFirstGetContext): + (LoseContextOnFirstGetContext::LoseContextOnFirstGetContext): + (TEST): + +2012-05-31 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r119125. + http://trac.webkit.org/changeset/119125 + https://bugs.webkit.org/show_bug.cgi?id=88007 + + Will break android build if rolled (Requested by rafaelw_ on + #webkit). + + * public/WebMediaPlayer.h: + (WebMediaPlayer): + * src/WebMediaPlayerClientImpl.cpp: + (WebKit::WebMediaPlayerClientImpl::bytesLoaded): + * src/WebMediaPlayerClientImpl.h: + (WebMediaPlayerClientImpl): + +2012-05-31 Dana Jansens <danakj@chromium.org> + + [chromium] Move drawing code for RenderSurfaces into LayerRendererChromium + https://bugs.webkit.org/show_bug.cgi?id=87877 + + Reviewed by James Robinson. + + * tests/CCRenderSurfaceTest.cpp: + (WebCore::TEST): + +2012-05-31 Ami Fischman <fischman@chromium.org> + + Replace WebMediaPlayer::bytesLoaded() with an explicit didLoadingProgress() + https://bugs.webkit.org/show_bug.cgi?id=86113 + + Reviewed by Eric Carlson. + + * public/WebMediaPlayer.h: + (WebMediaPlayer): + * src/WebMediaPlayerClientImpl.cpp: + (WebKit::WebMediaPlayerClientImpl::didLoadingProgress): + * src/WebMediaPlayerClientImpl.h: + (WebMediaPlayerClientImpl): + +2012-05-31 Ian Vollick <vollick@chromium.org> + + [chromium] create WebTransformOperation interface for chromium platform + https://bugs.webkit.org/show_bug.cgi?id=87510 + + Reviewed by James Robinson. + + * WebKit.gypi: + * tests/WebTransformOperationsTest.cpp: Added. + (TEST): + (checkProgress): + +2012-05-31 Alexander Pavlov <apavlov@chromium.org> + + Web Inspector: [Chromium] Cannot bring Inspector to front when paused on breakpoint + https://bugs.webkit.org/show_bug.cgi?id=87871 + + Reviewed by Yury Semikhatsky. + + When input events handling is suppressed (due to the JS being paused on a breakpoint), we should report + these events as NOT handled by the WebKit, so that the browser can handle them appropriately + (on MacOS, switching between the application windows is done through the default key event handler, so if you run + event.preventDefault() for all keydown events in a handler, the Chromium window switch will not occur on Cmd+`). + + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::handleInputEvent): + +2012-05-31 Peter Beverloo <peter@chromium.org> + + Unreviewed. Rolled DEPS. + + * DEPS: + +2012-05-30 Peter Beverloo <peter@chromium.org> + + [Chromium] Automatically install 64-bit linker for Android + https://bugs.webkit.org/show_bug.cgi?id=79780 + + Reviewed by Adam Barth. + + Change the Android-specific dependencies to inherit their revision from + Chromium's DEPS file, like many other dependencies do, solving the + versioning problem that we're running in to right now. These are listed + in Chromium's main DEPS file starting Chromium r139529. + + * DEPS: + +2012-05-31 Yoshifumi Inoue <yosin@chromium.org> + + Build fix for Chromium Linux (Tests) after r119073. + + * tests/DecimalTest.cpp: + (TEST_F): + +2012-05-31 Yoshifumi Inoue <yosin@chromium.org> + + [Platform] Introduce Decimal class for Number/Range input type. + https://bugs.webkit.org/show_bug.cgi?id=87360 + + Reviewed by Kent Tamura. + + This patch added unit test for Decimal class. + + * WebKit.gypi: + * tests/DecimalTest.cpp: Added. + (WebCore): + (WebCore::operator<<): Output Decimal for unit test debugging + (DecimalStepRange): + (DecimalStepRange::DecimalStepRange): + (DecimalStepRange::clampValue): + (DecimalTest): + (DecimalTest::encode): + (DecimalTest::fromString): + (DecimalTest::stepDown): + (DecimalTest::stepUp): + (TEST_F): + +2012-05-30 Yury Semikhatsky <yurys@chromium.org> + + Web Inspector: add MemoryUsageSupport::processMemorySizesInBytes + https://bugs.webkit.org/show_bug.cgi?id=87830 + + Reviewed by James Robinson. + + * public/platform/WebKitPlatformSupport.h: pulled getProcessMemorySize up + to the Source/Platform/chromium/public/Platform.h + * src/PlatformSupport.cpp: + +2012-05-31 Kent Tamura <tkent@chromium.org> + + Unreviewed, rolling out r119062 and r119064. + http://trac.webkit.org/changeset/119062 + http://trac.webkit.org/changeset/119064 + https://bugs.webkit.org/show_bug.cgi?id=87360 + + Broke build on Lion, SnowLoepard, Chromium Windows, and + Chromium Linux 32 + + * WebKit.gypi: + * tests/DecimalTest.cpp: Removed. + +2012-05-30 Yoshifumi Inoue <yosin@chromium.org> + + [Platform] Introduce Decimal class for Number/Range input type. + https://bugs.webkit.org/show_bug.cgi?id=87360 + + Reviewed by Kent Tamura. + + This patch added unit test for Decimal class. + + * WebKit.gypi: + * tests/DecimalTest.cpp: Added. + (WebCore): + (WebCore::operator<<): Output Decimal for unit test debugging + (DecimalStepRange): + (DecimalStepRange::DecimalStepRange): + (DecimalStepRange::clampValue): + (DecimalTest): + (DecimalTest::encode): + (DecimalTest::fromString): + (DecimalTest::stepDown): + (DecimalTest::stepUp): + (TEST_F): + +2012-05-30 Shawn Singh <shawnsingh@chromium.org> + + [chromium] Fix min/max bounds error in CCMathUtil.cpp + https://bugs.webkit.org/show_bug.cgi?id=87915 + + Reviewed by James Robinson. + + * tests/CCMathUtilTest.cpp: + (WebCore::TEST): + (WebCore): + +2012-05-30 Ami Fischman <fischman@chromium.org> + + Roll chromium DEPS from r139300 to r139542. Unreviewed. + https://bugs.webkit.org/show_bug.cgi?id=87868 + + * DEPS: + +2012-05-30 Mark Pilgrim <pilgrim@chromium.org> + + [Chromium] Call fileUtilities methods directly + https://bugs.webkit.org/show_bug.cgi?id=87852 + + Reviewed by Adam Barth. + + Part of a refactoring series. See tracking bug 82948. + + * src/PlatformSupport.cpp: + (WebCore): + +2012-05-30 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r118986. + http://trac.webkit.org/changeset/118986 + https://bugs.webkit.org/show_bug.cgi?id=87914 + + Caused several IndexedDB browser_test failures on Chromium + canary builders (Requested by rafaelw_ on #webkit). + + * src/WebIDBDatabaseError.cpp: + (WebKit::WebIDBDatabaseError::assign): + +2012-05-30 Dominic Mazzoni <dmazzoni@google.com> + + AX: Chromium WebAccessibilityObject should check if an AccessibilityObject is detached + https://bugs.webkit.org/show_bug.cgi?id=87778 + + Reviewed by Adam Barth. + + Pretty simple - all places that previously just checked for null + now also check if the wrapped AccessibilityObject is detached. + + * public/WebAccessibilityObject.h: + (WebAccessibilityObject): + * src/WebAccessibilityObject.cpp: + (WebKit::WebAccessibilityObject::isDetached): + (WebKit): + (WebKit::WebAccessibilityObject::axID): + (WebKit::WebAccessibilityObject::accessibilityDescription): + (WebKit::WebAccessibilityObject::actionVerb): + (WebKit::WebAccessibilityObject::canSetFocusAttribute): + (WebKit::WebAccessibilityObject::canSetValueAttribute): + (WebKit::WebAccessibilityObject::isValid): + (WebKit::WebAccessibilityObject::childCount): + (WebKit::WebAccessibilityObject::childAt): + (WebKit::WebAccessibilityObject::firstChild): + (WebKit::WebAccessibilityObject::focusedChild): + (WebKit::WebAccessibilityObject::lastChild): + (WebKit::WebAccessibilityObject::nextSibling): + (WebKit::WebAccessibilityObject::parentObject): + (WebKit::WebAccessibilityObject::previousSibling): + (WebKit::WebAccessibilityObject::canSetSelectedAttribute): + (WebKit::WebAccessibilityObject::isAnchor): + (WebKit::WebAccessibilityObject::isAriaReadOnly): + (WebKit::WebAccessibilityObject::isButtonStateMixed): + (WebKit::WebAccessibilityObject::isChecked): + (WebKit::WebAccessibilityObject::isCollapsed): + (WebKit::WebAccessibilityObject::isControl): + (WebKit::WebAccessibilityObject::isEnabled): + (WebKit::WebAccessibilityObject::isFocused): + (WebKit::WebAccessibilityObject::isHovered): + (WebKit::WebAccessibilityObject::isIndeterminate): + (WebKit::WebAccessibilityObject::isLinked): + (WebKit::WebAccessibilityObject::isLoaded): + (WebKit::WebAccessibilityObject::isMultiSelectable): + (WebKit::WebAccessibilityObject::isOffScreen): + (WebKit::WebAccessibilityObject::isPasswordField): + (WebKit::WebAccessibilityObject::isPressed): + (WebKit::WebAccessibilityObject::isReadOnly): + (WebKit::WebAccessibilityObject::isRequired): + (WebKit::WebAccessibilityObject::isSelected): + (WebKit::WebAccessibilityObject::isSelectedOptionActive): + (WebKit::WebAccessibilityObject::isVertical): + (WebKit::WebAccessibilityObject::isVisible): + (WebKit::WebAccessibilityObject::isVisited): + (WebKit::WebAccessibilityObject::accessKey): + (WebKit::WebAccessibilityObject::ariaHasPopup): + (WebKit::WebAccessibilityObject::ariaLiveRegionAtomic): + (WebKit::WebAccessibilityObject::ariaLiveRegionBusy): + (WebKit::WebAccessibilityObject::ariaLiveRegionRelevant): + (WebKit::WebAccessibilityObject::ariaLiveRegionStatus): + (WebKit::WebAccessibilityObject::boundingBoxRect): + (WebKit::WebAccessibilityObject::estimatedLoadingProgress): + (WebKit::WebAccessibilityObject::helpText): + (WebKit::WebAccessibilityObject::headingLevel): + (WebKit::WebAccessibilityObject::hierarchicalLevel): + (WebKit::WebAccessibilityObject::hitTest): + (WebKit::WebAccessibilityObject::keyboardShortcut): + (WebKit::WebAccessibilityObject::performDefaultAction): + (WebKit::WebAccessibilityObject::roleValue): + (WebKit::WebAccessibilityObject::selectionEnd): + (WebKit::WebAccessibilityObject::selectionStart): + (WebKit::WebAccessibilityObject::setFocused): + (WebKit::WebAccessibilityObject::stringValue): + (WebKit::WebAccessibilityObject::title): + (WebKit::WebAccessibilityObject::titleUIElement): + (WebKit::WebAccessibilityObject::url): + (WebKit::WebAccessibilityObject::valueDescription): + (WebKit::WebAccessibilityObject::valueForRange): + (WebKit::WebAccessibilityObject::maxValueForRange): + (WebKit::WebAccessibilityObject::minValueForRange): + (WebKit::WebAccessibilityObject::node): + (WebKit::WebAccessibilityObject::document): + (WebKit::WebAccessibilityObject::hasComputedStyle): + (WebKit::WebAccessibilityObject::computedStyleDisplay): + (WebKit::WebAccessibilityObject::accessibilityIsIgnored): + (WebKit::WebAccessibilityObject::lineBreaks): + (WebKit::WebAccessibilityObject::columnCount): + (WebKit::WebAccessibilityObject::rowCount): + +2012-05-30 Shawn Singh <shawnsingh@chromium.org> + + Simplify TransformationMatrix rotation code to improve precision + https://bugs.webkit.org/show_bug.cgi?id=86666 + + Reviewed by Adrienne Walker. + + * tests/CCLayerTreeHostCommonTest.cpp: + (WebKitTests::TEST): + * tests/WebTransformationMatrixTest.cpp: + (WebKit::TEST): + (WebKit): + +2012-05-30 Alec Flett <alecflett@chromium.org> + + IndexedDB: Implement IDBTransaction.error and IDBRequest.error + https://bugs.webkit.org/show_bug.cgi?id=87865 + + Reviewed by Tony Chang. + + IDBDatabaseError now honors IDB-specific DOMException codes, + so make sure that's how they are passed to/from chromium. + + * src/WebIDBDatabaseError.cpp: + (WebKit::WebIDBDatabaseError::assign): + +2012-05-30 Shawn Singh <shawnsingh@chromium.org> + + [chromium] Merge shared code in CCOcclusionTrackerTest + https://bugs.webkit.org/show_bug.cgi?id=87798 + + Reviewed by Adrienne Walker. + + This patch simple uses a different existing macro function so that + the same thing doesn't exist in multiple places, and so that the + naming is more consistent with gtest's conventions. + + * tests/CCOcclusionTrackerTest.cpp: + (WebKitTests::CCOcclusionTrackerTestIdentityTransforms::runMyTest): + (WebKitTests::CCOcclusionTrackerTestRotatedChild::runMyTest): + (WebKitTests::CCOcclusionTrackerTestTranslatedChild::runMyTest): + (WebKitTests::CCOcclusionTrackerTestChildInRotatedChild::runMyTest): + (WebKitTests::CCOcclusionTrackerTestVisitTargetTwoTimes::runMyTest): + (WebKitTests::CCOcclusionTrackerTestSurfaceRotatedOffAxis::runMyTest): + (WebKitTests::CCOcclusionTrackerTestSurfaceWithTwoOpaqueChildren::runMyTest): + (WebKitTests::CCOcclusionTrackerTestOverlappingSurfaceSiblings::runMyTest): + (WebKitTests::CCOcclusionTrackerTestOverlappingSurfaceSiblingsWithTwoTransforms::runMyTest): + (WebKitTests::CCOcclusionTrackerTestFilters::runMyTest): + (WebKitTests::CCOcclusionTrackerTestReplicaDoesOcclude::runMyTest): + (WebKitTests::CCOcclusionTrackerTestReplicaWithClipping::runMyTest): + (WebKitTests::CCOcclusionTrackerTestReplicaWithMask::runMyTest): + (WebKitTests::CCOcclusionTrackerTestLayerScissorRectOutsideChild::runMyTest): + (WebKitTests::CCOcclusionTrackerTestScreenScissorRectOutsideChild::runMyTest): + (WebKitTests::CCOcclusionTrackerTestLayerScissorRectPartlyOverChild::runMyTest): + (WebKitTests::CCOcclusionTrackerTestScreenScissorRectPartlyOverChild::runMyTest): + (WebKitTests::CCOcclusionTrackerTestOpaqueContentsRegionNonEmpty::runMyTest): + (WebKitTests::CCOcclusionTrackerTest3dTransform::runMyTest): + (WebKitTests::CCOcclusionTrackerTestPerspectiveTransform::runMyTest): + (WebKitTests::CCOcclusionTrackerTestAnimationOpacity1OnMainThread::runMyTest): + (WebKitTests::CCOcclusionTrackerTestAnimationOpacity0OnMainThread::runMyTest): + (WebKitTests::CCOcclusionTrackerTestAnimationTranslateOnMainThread::runMyTest): + (WebKitTests::CCOcclusionTrackerTestSurfaceOcclusionTranslatesToParent::runMyTest): + (WebKitTests::CCOcclusionTrackerTestSurfaceOcclusionTranslatesWithClipping::runMyTest): + (WebKitTests::CCOcclusionTrackerTestReplicaOccluded::runMyTest): + (WebKitTests::CCOcclusionTrackerTestSurfaceWithReplicaUnoccluded::runMyTest): + (WebKitTests::CCOcclusionTrackerTestSurfaceAndReplicaOccludedDifferently::runMyTest): + (WebKitTests::CCOcclusionTrackerTestSurfaceChildOfSurface::runMyTest): + (WebKitTests::CCOcclusionTrackerTestTopmostSurfaceIsClippedToScissor::runMyTest): + (WebKitTests::CCOcclusionTrackerTestSurfaceChildOfClippingSurface::runMyTest): + (WebKitTests::CCOcclusionTrackerTestDontOccludePixelsNeededForBackgroundFilter::runMyTest): + (WebKitTests::CCOcclusionTrackerTestTwoBackgroundFiltersReduceOcclusionTwice::runMyTest): + (WebKitTests::CCOcclusionTrackerTestDontOccludePixelsNeededForBackgroundFilterWithClip::runMyTest): + (WebKitTests::CCOcclusionTrackerTestDontReduceOcclusionBelowBackgroundFilter::runMyTest): + (WebKitTests::CCOcclusionTrackerTestDontReduceOcclusionIfBackgroundFilterIsOccluded::runMyTest): + (WebKitTests::CCOcclusionTrackerTestMinimumTrackingSize::runMyTest): + +2012-05-30 Tony Chang <tony@chromium.org> + + [chromium] port webframe_unittest.cc to webkit_unit_tests + https://bugs.webkit.org/show_bug.cgi?id=87796 + + Reviewed by James Robinson. + + Move WebFrameTest.GetContentAsPlainText and WebFrameTest.GetFullHtmlOfPage to webkit_unit_tests. + + * tests/WebFrameTest.cpp: + (WebKit::TEST_F): + (WebKit): Add tests. + +2012-05-30 Jochen Eisinger <jochen@chromium.org> + + Match Firefox restrictions to window.blur and window.focus + https://bugs.webkit.org/show_bug.cgi?id=86969 + + Reviewed by Adam Barth. + + Allow window.focus() during the dispatch of the click event on + notifications. + + * src/WebNotification.cpp: + (WebKit::WebNotification::dispatchClickEvent): + +2012-05-29 Mark Pilgrim <pilgrim@chromium.org> + + [Chromium] Move fileExists to Platform.h + https://bugs.webkit.org/show_bug.cgi?id=87531 + + Reviewed by Adam Barth. + + Part of a refactoring series. See tracking bug 82948. + + * src/PlatformSupport.cpp: + (WebCore): + +2012-05-29 Alec Flett <alecflett@chromium.org> + + IndexedDB: Align codes and names for IDB-specific and DOM-specific errors/exceptions + https://bugs.webkit.org/show_bug.cgi?id=87276 + + Reviewed by Tony Chang. + + * public/WebIDBDatabaseException.h: + * src/AssertMatchingEnums.cpp: + +2012-05-29 Rafael Weinstein <rafaelw@chromium.org> + + Unreviewed. Rolled DEPS. + + * DEPS: + +2012-05-29 Dana Jansens <danakj@chromium.org> + + [chromium] Unoccluded area in surfaces should always be clipped to the rootScissorRect + https://bugs.webkit.org/show_bug.cgi?id=87677 + + Reviewed by Adrienne Walker. + + * tests/CCOcclusionTrackerTest.cpp: + (CCOcclusionTrackerTestTopmostSurfaceIsClippedToScissor): + (WebKitTests::CCOcclusionTrackerTestTopmostSurfaceIsClippedToScissor::runMyTest): + (WebKitTests): + +2012-05-29 David Barr <davidbarr@chromium.org> + + Introduce ENABLE_CSS_IMAGE_RESOLUTION compile flag + https://bugs.webkit.org/show_bug.cgi?id=87685 + + Reviewed by Eric Seidel. + + Add a configuration option for CSS image-resolution support, disabling it by default. + + * features.gypi: + +2012-05-29 Peter Beverloo <peter@chromium.org> + + Unreviewed. Rolled DEPS. + + * DEPS: + +2012-05-29 Hironori Bono <hbono@chromium.org> + + Use WebSpellCheckClient::spellcheck to retrieve suggestions. + https://bugs.webkit.org/show_bug.cgi?id=87690 + + Reviewed by Hajime Morita. + + This change uses WebSpellCheckClient::spellcheck as a fallback method to + retrieve suggestions when a marker does not have any suggestions. (It consumes + lots of CPU power to get suggestions for misspelled word, i.e. Chromium cannot + afford to attach suggestions to all spelling markers.) + + * src/ContextMenuClientImpl.cpp: + (WebKit::ContextMenuClientImpl::getCustomMenuFromDefaultItems): Retrieve suggestions if markers do not have any. + +2012-05-28 Takashi Toyoshima <toyoshim@chromium.org> + + [WebSocket] Receiving reserved close codes, 1005, 1006, and 1015 must appear as code=1006 and wasClean=false + https://bugs.webkit.org/show_bug.cgi?id=87084 + + Reviewed by Kent Tamura. + + Update close event codes corresponding to WebSocketChannel::CloseEventCode. + + * public/WebSocket.h: Update on newly defined close event codes + +2012-05-28 MORITA Hajime <morrita@google.com> + + Rename FrameLoaderClient::shadowDOMAllowed() to allowShadowDOM() + https://bugs.webkit.org/show_bug.cgi?id=87101 + + Reviewed by Kentaro Hara. + + * src/FrameLoaderClientImpl.cpp: + (WebKit::FrameLoaderClientImpl::allowShadowDOM): + * src/FrameLoaderClientImpl.h: + (FrameLoaderClientImpl): + +2012-05-28 Rob Flack <flackr@chromium.org> + + [chromium] Only increase size of Combo Box Options when displayed on touch screen + https://bugs.webkit.org/show_bug.cgi?id=85921 + + Reviewed by Adam Barth. + + Adds a flag to set whether the current device is a touch screen, independent of whether touch events are supported and use this for the combo box sizing. + + * public/WebSettings.h: + * src/WebSettingsImpl.cpp: + (WebKit::WebSettingsImpl::defaultDeviceScaleFactor): + (WebKit): + (WebKit::WebSettingsImpl::setDeviceSupportsTouch): + (WebKit::WebSettingsImpl::deviceSupportsTouch): + * src/WebSettingsImpl.h: + (WebSettingsImpl): + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::applyAutofillSuggestions): + * tests/PopupMenuTest.cpp: + (WebKit::SelectPopupMenuTest::SetUp): + (WebKit::SelectPopupMenuTest::TearDown): + (SelectPopupMenuTest): + (WebKit::TEST_F): + +2012-05-25 Jesus Sanchez-Palencia <jesus.palencia@openbossa.org> + + WebKitTestRunner needs to support layoutTestController.setJavaScriptProfilingEnabled + https://bugs.webkit.org/show_bug.cgi?id=42328 + + Reviewed by Eric Seidel. + + Removed private APIs that were only being used by DRT. + + * public/WebDevToolsAgent.h: + (WebDevToolsAgent): + * src/WebDevToolsAgentImpl.cpp: + * src/WebDevToolsAgentImpl.h: + (WebDevToolsAgentImpl): + +2012-05-28 Peter Beverloo <peter@chromium.org> + + Unreviewed. Rolled DEPS. + + * DEPS: + +2012-05-28 Peter Beverloo <peter@chromium.org> + + [Chromium] Build fix for the Android bot, set CXX_target at gyp generation-time + https://bugs.webkit.org/show_bug.cgi?id=87649 + + Unreviewed build fix. + + Chromium Android builds were broken because v8 tried to compile files + for target with the "-m32" flag. This was caused by a v8 check falling + back to using "which g++" to find the right compiler, whereas it should + have used the $CXX_target environment variable. This isn't being set + for Android builds. + + * gyp_webkit: Set the CXX_target environment variable. Annotate the fix + with a FIXME comment too. + +2012-05-28 Keishi Hattori <keishi@webkit.org> + + Expose value localization function of HTMLInputElement + https://bugs.webkit.org/show_bug.cgi?id=84356 + + Reviewed by Kent Tamura. + + * public/WebInputElement.h: + (WebInputElement): + * src/WebInputElement.cpp: + (WebKit::WebInputElement::localizeValue): + (WebKit): + +2012-05-28 MORITA Hajime <morrita@google.com> + + Unreviewed Mac Chromium build fix. + + * src/FrameLoaderClientImpl.cpp: + (WebKit::FrameLoaderClientImpl::allowStyleScoped): + +2012-05-28 MORITA Hajime <morrita@google.com> + + https://bugs.webkit.org/show_bug.cgi?id=87609 + [Chromium] FrameLoaderClient::allowStyleScoped() should be implemented interms of WebPermissionClient + + Reviewed by Kent Tamura. + + Added allowStyleScoped() implementation which is essentially same as shadowDOMAllowed(). + + * src/FrameLoaderClientImpl.cpp: + * src/FrameLoaderClientImpl.h: + (FrameLoaderClientImpl): + 2012-05-25 Ryosuke Niwa <rniwa@webkit.org> Roll chromium DEPS from r139156 to r139184. diff --git a/Source/WebKit/chromium/DEPS b/Source/WebKit/chromium/DEPS index e12c78f59..67371f99f 100644 --- a/Source/WebKit/chromium/DEPS +++ b/Source/WebKit/chromium/DEPS @@ -32,7 +32,7 @@ vars = { 'chromium_svn': 'http://src.chromium.org/svn/trunk/src', - 'chromium_rev': '139184' + 'chromium_rev': '139747' } deps = { @@ -167,10 +167,12 @@ deps_os = { From('chromium_deps', 'src/third_party/openssl'), }, 'android': { - 'third_party/freetype': - 'https://git.chromium.org/chromium/src/third_party/freetype.git', 'tools/android': - Var('chromium_svn')+'/tools/android@'+Var('chromium_rev'), + Var('chromium_svn') + '/tools/android@' + Var('chromium_rev'), + 'third_party/freetype': + From('chromium_deps', 'src/third_party/freetype'), + 'third_party/aosp': + From('chromium_deps', 'src/third_party/aosp'), }, } diff --git a/Source/WebKit/chromium/WebKit.gypi b/Source/WebKit/chromium/WebKit.gypi index 1a688bbcc..1c11f2d79 100644 --- a/Source/WebKit/chromium/WebKit.gypi +++ b/Source/WebKit/chromium/WebKit.gypi @@ -95,6 +95,7 @@ 'tests/ClipboardChromiumTest.cpp', 'tests/CompositorFakeGraphicsContext3D.h', 'tests/CompositorFakeWebGraphicsContext3D.h', + 'tests/DecimalTest.cpp', 'tests/DragImageTest.cpp', 'tests/DrawingBufferChromiumTest.cpp', 'tests/EventListenerTest.cpp', @@ -152,6 +153,7 @@ 'tests/WebSocketDeflaterTest.cpp', 'tests/WebSocketExtensionDispatcherTest.cpp', 'tests/WebTransformationMatrixTest.cpp', + 'tests/WebTransformOperationsTest.cpp', 'tests/WebURLRequestTest.cpp', 'tests/WebURLResponseTest.cpp', 'tests/WebViewTest.cpp', diff --git a/Source/WebKit/chromium/features.gypi b/Source/WebKit/chromium/features.gypi index a0d6329c6..f773cc4bc 100644 --- a/Source/WebKit/chromium/features.gypi +++ b/Source/WebKit/chromium/features.gypi @@ -41,6 +41,7 @@ 'ENABLE_CSS_EXCLUSIONS=1', 'ENABLE_CSS_FILTERS=1', 'ENABLE_CSS_IMAGE_SET=1', + 'ENABLE_CSS_IMAGE_RESOLUTION=0', 'ENABLE_CSS_REGIONS=1', 'ENABLE_CSS_SHADERS=1', 'ENABLE_CSS_VARIABLES=0', diff --git a/Source/WebKit/chromium/gyp_webkit b/Source/WebKit/chromium/gyp_webkit index 36f0f431b..fb720d97a 100755 --- a/Source/WebKit/chromium/gyp_webkit +++ b/Source/WebKit/chromium/gyp_webkit @@ -87,6 +87,9 @@ if __name__ == '__main__': envsetup_location = os.path.join(chrome_src, 'build', 'android', 'envsetup.sh') exit(subprocess.call(['bash', '-c', 'source %s && python gyp_webkit --no-envsetup-recursion %s' % (envsetup_location, ' '.join(args))])) else: + # FIXME: v8 requires the CXX_target variable to determine whether -m32 should be + # set. The current Android build set-up is not sustainable and breaks too often. + os.environ['CXX_target'] = glob.glob('%s/*-g++' % os.environ.get('ANDROID_TOOLCHAIN'))[0] args.remove('--no-envsetup-recursion') # Add includes. diff --git a/Source/WebKit/chromium/public/WebAccessibilityObject.h b/Source/WebKit/chromium/public/WebAccessibilityObject.h index c52b830a9..029f43872 100644 --- a/Source/WebKit/chromium/public/WebAccessibilityObject.h +++ b/Source/WebKit/chromium/public/WebAccessibilityObject.h @@ -69,6 +69,7 @@ public: WEBKIT_EXPORT bool equals(const WebAccessibilityObject&) const; bool isNull() const { return m_private.isNull(); } + WEBKIT_EXPORT bool isDetached() const; // Static methods for enabling accessibility. WEBKIT_EXPORT static void enableAccessibility(); diff --git a/Source/WebKit/chromium/public/WebDevToolsAgent.h b/Source/WebKit/chromium/public/WebDevToolsAgent.h index 0a66db362..9f1d53f1b 100644 --- a/Source/WebKit/chromium/public/WebDevToolsAgent.h +++ b/Source/WebKit/chromium/public/WebDevToolsAgent.h @@ -68,7 +68,6 @@ public: // Exposed for LayoutTestController. virtual void evaluateInWebInspector(long callId, const WebString& script) = 0; - virtual void setJavaScriptProfilingEnabled(bool) = 0; class MessageDescriptor { public: diff --git a/Source/WebKit/chromium/public/WebIDBDatabaseException.h b/Source/WebKit/chromium/public/WebIDBDatabaseException.h index 81b838667..b0e63d426 100644 --- a/Source/WebKit/chromium/public/WebIDBDatabaseException.h +++ b/Source/WebKit/chromium/public/WebIDBDatabaseException.h @@ -35,7 +35,7 @@ namespace WebKit { enum WebIDBDatabaseException { WebIDBDatabaseExceptionDataError = 1205, - WebIDBDatabaseExceptionQuotaError = 1211, + WebIDBDatabaseExceptionQuotaError = 1218, }; } // namespace WebKit diff --git a/Source/WebKit/chromium/public/WebInputElement.h b/Source/WebKit/chromium/public/WebInputElement.h index 913740d66..fbc350012 100644 --- a/Source/WebKit/chromium/public/WebInputElement.h +++ b/Source/WebKit/chromium/public/WebInputElement.h @@ -96,6 +96,9 @@ namespace WebKit { WEBKIT_EXPORT WebNodeCollection dataListOptions() const; + // Return the localized value for this input type. + WEBKIT_EXPORT WebString localizeValue(const WebString&) const; + WEBKIT_EXPORT bool isSpeechInputEnabled() const; WEBKIT_EXPORT SpeechInputState getSpeechInputState() const; WEBKIT_EXPORT void startSpeechInput(); diff --git a/Source/WebKit/chromium/public/WebMediaPlayer.h b/Source/WebKit/chromium/public/WebMediaPlayer.h index 3312f5f21..444a2cc90 100644 --- a/Source/WebKit/chromium/public/WebMediaPlayer.h +++ b/Source/WebKit/chromium/public/WebMediaPlayer.h @@ -144,7 +144,7 @@ public: virtual NetworkState networkState() const = 0; virtual ReadyState readyState() const = 0; - virtual unsigned long long bytesLoaded() const = 0; + virtual bool didLoadingProgress() const = 0; virtual unsigned long long totalBytes() const = 0; virtual bool hasSingleSecurityOrigin() const = 0; diff --git a/Source/WebKit/chromium/public/WebSettings.h b/Source/WebKit/chromium/public/WebSettings.h index d9016847a..ccf3303c7 100644 --- a/Source/WebKit/chromium/public/WebSettings.h +++ b/Source/WebKit/chromium/public/WebSettings.h @@ -67,6 +67,7 @@ public: virtual void setApplyDefaultDeviceScaleFactorInCompositor(bool) = 0; virtual void setFontBoostingEnabled(bool) = 0; virtual void setDefaultTextEncodingName(const WebString&) = 0; + virtual void setDeviceSupportsTouch(bool) = 0; virtual void setJavaScriptEnabled(bool) = 0; virtual void setWebSecurityEnabled(bool) = 0; virtual void setJavaScriptCanOpenWindowsAutomatically(bool) = 0; diff --git a/Source/WebKit/chromium/public/WebSocket.h b/Source/WebKit/chromium/public/WebSocket.h index f2a140cfa..e3db32427 100644 --- a/Source/WebKit/chromium/public/WebSocket.h +++ b/Source/WebKit/chromium/public/WebSocket.h @@ -55,7 +55,12 @@ public: CloseEventCodeFrameTooLarge = 1004, CloseEventCodeNoStatusRcvd = 1005, CloseEventCodeAbnormalClosure = 1006, - CloseEventCodeInvalidUTF8 = 1007, + CloseEventCodeInvalidFramePayloadData = 1007, + CloseEventCodePolicyViolation = 1008, + CloseEventCodeMessageTooBig = 1009, + CloseEventCodeMandatoryExt = 1010, + CloseEventCodeInternalError = 1011, + CloseEventCodeTLSHandshake = 1015, CloseEventCodeMinimumUserDefined = 3000, CloseEventCodeMaximumUserDefined = 4999 }; diff --git a/Source/WebKit/chromium/public/platform/WebKitPlatformSupport.h b/Source/WebKit/chromium/public/platform/WebKitPlatformSupport.h index 908152149..f69c62ff2 100644 --- a/Source/WebKit/chromium/public/platform/WebKitPlatformSupport.h +++ b/Source/WebKit/chromium/public/platform/WebKitPlatformSupport.h @@ -115,11 +115,6 @@ public: virtual WebSharedWorkerRepository* sharedWorkerRepository() { return 0; } - // Returns private and shared usage, in bytes. Private bytes is the amount of - // memory currently allocated to this process that cannot be shared. Returns - // false on platform specific error conditions. - virtual bool getProcessMemorySize(size_t* privateBytes, size_t* sharedBytes) { return false; } - protected: ~WebKitPlatformSupport() { } }; diff --git a/Source/WebKit/chromium/src/AssertMatchingEnums.cpp b/Source/WebKit/chromium/src/AssertMatchingEnums.cpp index 375428923..94985b20c 100644 --- a/Source/WebKit/chromium/src/AssertMatchingEnums.cpp +++ b/Source/WebKit/chromium/src/AssertMatchingEnums.cpp @@ -458,7 +458,7 @@ COMPILE_ASSERT_MATCHING_ENUM(WebView::UserStyleInjectInExistingDocuments, Inject COMPILE_ASSERT_MATCHING_ENUM(WebView::UserStyleInjectInSubsequentDocuments, InjectInSubsequentDocuments); COMPILE_ASSERT_MATCHING_ENUM(WebIDBDatabaseExceptionDataError, IDBDatabaseException::DATA_ERR); -COMPILE_ASSERT_MATCHING_ENUM(WebIDBDatabaseExceptionQuotaError, IDBDatabaseException::QUOTA_ERR); +COMPILE_ASSERT_MATCHING_ENUM(WebIDBDatabaseExceptionQuotaError, IDBDatabaseException::IDB_QUOTA_EXCEEDED_ERR); #if ENABLE(INDEXED_DATABASE) COMPILE_ASSERT_MATCHING_ENUM(WebIDBKey::InvalidType, IDBKey::InvalidType); diff --git a/Source/WebKit/chromium/src/ContextMenuClientImpl.cpp b/Source/WebKit/chromium/src/ContextMenuClientImpl.cpp index 5871f44e1..d400e7c2b 100644 --- a/Source/WebKit/chromium/src/ContextMenuClientImpl.cpp +++ b/Source/WebKit/chromium/src/ContextMenuClientImpl.cpp @@ -290,8 +290,13 @@ PlatformMenuDescription ContextMenuClientImpl::getCustomMenuFromDefaultItems( suggestions.append(descriptions); } } - data.dictionarySuggestions = suggestions; data.misspelledWord = selectMisspelledWord(defaultMenu, selectedFrame); + if (!suggestions.isEmpty()) + data.dictionarySuggestions = suggestions; + else if (m_webView->spellCheckClient()) { + int misspelledOffset, misspelledLength; + m_webView->spellCheckClient()->spellCheck(data.misspelledWord, misspelledOffset, misspelledLength, &data.dictionarySuggestions); + } } } } else if (m_webView->focusedWebCoreFrame()->editor()->isContinuousSpellCheckingEnabled()) { diff --git a/Source/WebKit/chromium/src/EditorClientImpl.cpp b/Source/WebKit/chromium/src/EditorClientImpl.cpp index c004c3fc3..417fe9429 100644 --- a/Source/WebKit/chromium/src/EditorClientImpl.cpp +++ b/Source/WebKit/chromium/src/EditorClientImpl.cpp @@ -90,17 +90,6 @@ void EditorClientImpl::pageDestroyed() void EditorClientImpl::frameWillDetachPage(WebCore::Frame* frame) { - HashSet<WebTextCheckingCompletionImpl*> validRequests; - - for (HashSet<WebTextCheckingCompletionImpl*>::iterator i = m_pendingTextChecks.begin(); - i != m_pendingTextChecks.end(); ++i) { - if (frame->editor()->spellChecker() == (*i)->spellChecker()) - (*i)->invalidate(); - else - validRequests.add(*i); - } - - m_pendingTextChecks.swap(validRequests); } bool EditorClientImpl::shouldShowDeleteInterface(HTMLElement* elem) @@ -752,19 +741,12 @@ void EditorClientImpl::checkSpellingOfString(const UChar* text, int length, *misspellingLength = spellLength; } -void EditorClientImpl::requestCheckingOfString(SpellChecker* sender, const WebCore::TextCheckingRequest& request) +void EditorClientImpl::requestCheckingOfString(WTF::PassRefPtr<WebCore::TextCheckingRequest> request) { - if (!m_webView->spellCheckClient()) - return; - - WebTextCheckingCompletionImpl* completion = new WebTextCheckingCompletionImpl(request.sequence(), sender, this); - m_pendingTextChecks.add(completion); - m_webView->spellCheckClient()->requestCheckingOfText(request.text(), completion); -} - -void EditorClientImpl::didCheckString(WebTextCheckingCompletionImpl* completion) -{ - m_pendingTextChecks.remove(completion); + if (m_webView->spellCheckClient()) { + String text = request->text(); + m_webView->spellCheckClient()->requestCheckingOfText(text, new WebTextCheckingCompletionImpl(request)); + } } String EditorClientImpl::getAutoCorrectSuggestionForMisspelledWord(const String& misspelledWord) diff --git a/Source/WebKit/chromium/src/EditorClientImpl.h b/Source/WebKit/chromium/src/EditorClientImpl.h index 47e8c508f..3ee9ebaaa 100644 --- a/Source/WebKit/chromium/src/EditorClientImpl.h +++ b/Source/WebKit/chromium/src/EditorClientImpl.h @@ -40,7 +40,6 @@ namespace WebCore { class Frame; class HTMLInputElement; -class SpellChecker; } namespace WebKit { @@ -113,12 +112,10 @@ public: virtual void getGuessesForWord(const WTF::String& word, const WTF::String& context, WTF::Vector<WTF::String>& guesses); virtual void willSetInputMethodState(); virtual void setInputMethodState(bool enabled); - virtual void requestCheckingOfString(WebCore::SpellChecker*, const WebCore::TextCheckingRequest&); + virtual void requestCheckingOfString(WTF::PassRefPtr<WebCore::TextCheckingRequest>); virtual WebCore::TextCheckerClient* textChecker() { return this; } - void didCheckString(WebTextCheckingCompletionImpl*); - private: void modifySelection(WebCore::Frame*, WebCore::KeyboardEvent*); @@ -146,8 +143,6 @@ private: SpellCheckForcedOff }; int m_spellCheckThisFieldStatus; - - WTF::HashSet<WebTextCheckingCompletionImpl*> m_pendingTextChecks; }; } // namespace WebKit diff --git a/Source/WebKit/chromium/src/FrameLoaderClientImpl.cpp b/Source/WebKit/chromium/src/FrameLoaderClientImpl.cpp index c42979ca3..de3f22789 100644 --- a/Source/WebKit/chromium/src/FrameLoaderClientImpl.cpp +++ b/Source/WebKit/chromium/src/FrameLoaderClientImpl.cpp @@ -239,7 +239,16 @@ bool FrameLoaderClientImpl::allowRunningInsecureContent(bool enabledPerSettings, return enabledPerSettings; } -bool FrameLoaderClientImpl::shadowDOMAllowed(bool enabledAsRuntimeFeature) +bool FrameLoaderClientImpl::allowShadowDOM(bool enabledAsRuntimeFeature) +{ + WebViewImpl* webview = m_webFrame->viewImpl(); + if (webview && webview->permissionClient()) + return webview->permissionClient()->allowWebComponents(m_webFrame, enabledAsRuntimeFeature); + + return enabledAsRuntimeFeature; +} + +bool FrameLoaderClientImpl::allowStyleScoped(bool enabledAsRuntimeFeature) { WebViewImpl* webview = m_webFrame->viewImpl(); if (webview && webview->permissionClient()) diff --git a/Source/WebKit/chromium/src/FrameLoaderClientImpl.h b/Source/WebKit/chromium/src/FrameLoaderClientImpl.h index f798ac2ef..236a01b65 100644 --- a/Source/WebKit/chromium/src/FrameLoaderClientImpl.h +++ b/Source/WebKit/chromium/src/FrameLoaderClientImpl.h @@ -199,7 +199,8 @@ public: virtual bool allowImage(bool enabledPerSettings, const WebCore::KURL& imageURL); virtual bool allowDisplayingInsecureContent(bool enabledPerSettings, WebCore::SecurityOrigin*, const WebCore::KURL&); virtual bool allowRunningInsecureContent(bool enabledPerSettings, WebCore::SecurityOrigin*, const WebCore::KURL&); - virtual bool shadowDOMAllowed(bool enabledAsRuntimeFeature) OVERRIDE; + virtual bool allowShadowDOM(bool enabledAsRuntimeFeature) OVERRIDE; + virtual bool allowStyleScoped(bool enabledAsRuntimeFeature) OVERRIDE; virtual void didNotAllowScript(); virtual void didNotAllowPlugins(); diff --git a/Source/WebKit/chromium/src/PlatformSupport.cpp b/Source/WebKit/chromium/src/PlatformSupport.cpp index 7cc7f5a6e..b6266fea1 100644 --- a/Source/WebKit/chromium/src/PlatformSupport.cpp +++ b/Source/WebKit/chromium/src/PlatformSupport.cpp @@ -302,92 +302,6 @@ bool PlatformSupport::cookiesEnabled(const Document* document) // File ------------------------------------------------------------------------ -bool PlatformSupport::fileExists(const String& path) -{ - return WebKit::Platform::current()->fileUtilities()->fileExists(path); -} - -bool PlatformSupport::deleteFile(const String& path) -{ - return WebKit::Platform::current()->fileUtilities()->deleteFile(path); -} - -bool PlatformSupport::deleteEmptyDirectory(const String& path) -{ - return WebKit::Platform::current()->fileUtilities()->deleteEmptyDirectory(path); -} - -bool PlatformSupport::getFileMetadata(const String& path, FileMetadata& result) -{ - WebFileInfo webFileInfo; - if (!webKitPlatformSupport()->fileUtilities()->getFileInfo(path, webFileInfo)) - return false; - result.modificationTime = webFileInfo.modificationTime; - result.length = webFileInfo.length; - result.type = static_cast<FileMetadata::Type>(webFileInfo.type); - return true; -} - -String PlatformSupport::directoryName(const String& path) -{ - return WebKit::Platform::current()->fileUtilities()->directoryName(path); -} - -String PlatformSupport::pathByAppendingComponent(const String& path, const String& component) -{ - return WebKit::Platform::current()->fileUtilities()->pathByAppendingComponent(path, component); -} - -bool PlatformSupport::makeAllDirectories(const String& path) -{ - return WebKit::Platform::current()->fileUtilities()->makeAllDirectories(path); -} - -String PlatformSupport::getAbsolutePath(const String& path) -{ - return WebKit::Platform::current()->fileUtilities()->getAbsolutePath(path); -} - -bool PlatformSupport::isDirectory(const String& path) -{ - return WebKit::Platform::current()->fileUtilities()->isDirectory(path); -} - -KURL PlatformSupport::filePathToURL(const String& path) -{ - return WebKit::Platform::current()->fileUtilities()->filePathToURL(path); -} - -PlatformFileHandle PlatformSupport::openFile(const String& path, FileOpenMode mode) -{ - return WebKit::Platform::current()->fileUtilities()->openFile(path, mode); -} - -void PlatformSupport::closeFile(PlatformFileHandle& handle) -{ - WebKit::Platform::current()->fileUtilities()->closeFile(handle); -} - -long long PlatformSupport::seekFile(PlatformFileHandle handle, long long offset, FileSeekOrigin origin) -{ - return WebKit::Platform::current()->fileUtilities()->seekFile(handle, offset, origin); -} - -bool PlatformSupport::truncateFile(PlatformFileHandle handle, long long offset) -{ - return WebKit::Platform::current()->fileUtilities()->truncateFile(handle, offset); -} - -int PlatformSupport::readFromFile(PlatformFileHandle handle, char* data, int length) -{ - return WebKit::Platform::current()->fileUtilities()->readFromFile(handle, data, length); -} - -int PlatformSupport::writeToFile(PlatformFileHandle handle, const char* data, int length) -{ - return WebKit::Platform::current()->fileUtilities()->writeToFile(handle, data, length); -} - #if ENABLE(FILE_SYSTEM) PassOwnPtr<AsyncFileSystem> PlatformSupport::createAsyncFileSystem() { @@ -836,11 +750,6 @@ void PlatformSupport::notifyJSOutOfMemory(Frame* frame) webFrame->client()->didExhaustMemoryAvailableForScript(webFrame); } -bool PlatformSupport::getProcessMemorySize(size_t* privateBytes, size_t* sharedBytes) -{ - return webKitPlatformSupport()->getProcessMemorySize(privateBytes, sharedBytes); -} - int PlatformSupport::screenHorizontalDPI(Widget* widget) { WebWidgetClient* client = toWebWidgetClient(widget); diff --git a/Source/WebKit/chromium/src/WebAccessibilityObject.cpp b/Source/WebKit/chromium/src/WebAccessibilityObject.cpp index f556dbdf4..1eb69d28f 100644 --- a/Source/WebKit/chromium/src/WebAccessibilityObject.cpp +++ b/Source/WebKit/chromium/src/WebAccessibilityObject.cpp @@ -82,9 +82,17 @@ bool WebAccessibilityObject::accessibilityEnabled() return AXObjectCache::accessibilityEnabled(); } -int WebAccessibilityObject::axID() const +bool WebAccessibilityObject::isDetached() const { if (m_private.isNull()) + return true; + + return m_private->isDetached(); +} + +int WebAccessibilityObject::axID() const +{ + if (isDetached()) return -1; m_private->updateBackingStore(); @@ -93,7 +101,7 @@ int WebAccessibilityObject::axID() const WebString WebAccessibilityObject::accessibilityDescription() const { - if (m_private.isNull()) + if (isDetached()) return WebString(); m_private->updateBackingStore(); @@ -102,7 +110,7 @@ WebString WebAccessibilityObject::accessibilityDescription() const WebString WebAccessibilityObject::actionVerb() const { - if (m_private.isNull()) + if (isDetached()) return WebString(); m_private->updateBackingStore(); @@ -111,7 +119,7 @@ WebString WebAccessibilityObject::actionVerb() const bool WebAccessibilityObject::canSetFocusAttribute() const { - if (m_private.isNull()) + if (isDetached()) return false; m_private->updateBackingStore(); @@ -120,7 +128,7 @@ bool WebAccessibilityObject::canSetFocusAttribute() const bool WebAccessibilityObject::canSetValueAttribute() const { - if (m_private.isNull()) + if (isDetached()) return false; m_private->updateBackingStore(); @@ -129,7 +137,7 @@ bool WebAccessibilityObject::canSetValueAttribute() const bool WebAccessibilityObject::isValid() const { - if (m_private.isNull()) + if (isDetached()) return false; m_private->updateBackingStore(); @@ -138,7 +146,7 @@ bool WebAccessibilityObject::isValid() const unsigned WebAccessibilityObject::childCount() const { - if (m_private.isNull()) + if (isDetached()) return 0; m_private->updateBackingStore(); @@ -147,7 +155,7 @@ unsigned WebAccessibilityObject::childCount() const WebAccessibilityObject WebAccessibilityObject::childAt(unsigned index) const { - if (m_private.isNull()) + if (isDetached()) return WebAccessibilityObject(); m_private->updateBackingStore(); @@ -159,7 +167,7 @@ WebAccessibilityObject WebAccessibilityObject::childAt(unsigned index) const WebAccessibilityObject WebAccessibilityObject::firstChild() const { - if (m_private.isNull()) + if (isDetached()) return WebAccessibilityObject(); m_private->updateBackingStore(); @@ -168,7 +176,7 @@ WebAccessibilityObject WebAccessibilityObject::firstChild() const WebAccessibilityObject WebAccessibilityObject::focusedChild() const { - if (m_private.isNull()) + if (isDetached()) return WebAccessibilityObject(); m_private->updateBackingStore(); @@ -181,7 +189,7 @@ WebAccessibilityObject WebAccessibilityObject::focusedChild() const WebAccessibilityObject WebAccessibilityObject::lastChild() const { - if (m_private.isNull()) + if (isDetached()) return WebAccessibilityObject(); m_private->updateBackingStore(); @@ -191,7 +199,7 @@ WebAccessibilityObject WebAccessibilityObject::lastChild() const WebAccessibilityObject WebAccessibilityObject::nextSibling() const { - if (m_private.isNull()) + if (isDetached()) return WebAccessibilityObject(); m_private->updateBackingStore(); @@ -200,7 +208,7 @@ WebAccessibilityObject WebAccessibilityObject::nextSibling() const WebAccessibilityObject WebAccessibilityObject::parentObject() const { - if (m_private.isNull()) + if (isDetached()) return WebAccessibilityObject(); m_private->updateBackingStore(); @@ -210,7 +218,7 @@ WebAccessibilityObject WebAccessibilityObject::parentObject() const WebAccessibilityObject WebAccessibilityObject::previousSibling() const { - if (m_private.isNull()) + if (isDetached()) return WebAccessibilityObject(); m_private->updateBackingStore(); @@ -219,7 +227,7 @@ WebAccessibilityObject WebAccessibilityObject::previousSibling() const bool WebAccessibilityObject::canSetSelectedAttribute() const { - if (m_private.isNull()) + if (isDetached()) return 0; m_private->updateBackingStore(); @@ -228,7 +236,7 @@ bool WebAccessibilityObject::canSetSelectedAttribute() const bool WebAccessibilityObject::isAnchor() const { - if (m_private.isNull()) + if (isDetached()) return 0; m_private->updateBackingStore(); @@ -237,7 +245,7 @@ bool WebAccessibilityObject::isAnchor() const bool WebAccessibilityObject::isAriaReadOnly() const { - if (m_private.isNull()) + if (isDetached()) return 0; m_private->updateBackingStore(); @@ -246,7 +254,7 @@ bool WebAccessibilityObject::isAriaReadOnly() const bool WebAccessibilityObject::isButtonStateMixed() const { - if (m_private.isNull()) + if (isDetached()) return 0; m_private->updateBackingStore(); @@ -255,7 +263,7 @@ bool WebAccessibilityObject::isButtonStateMixed() const bool WebAccessibilityObject::isChecked() const { - if (m_private.isNull()) + if (isDetached()) return 0; m_private->updateBackingStore(); @@ -264,7 +272,7 @@ bool WebAccessibilityObject::isChecked() const bool WebAccessibilityObject::isCollapsed() const { - if (m_private.isNull()) + if (isDetached()) return 0; m_private->updateBackingStore(); @@ -273,7 +281,7 @@ bool WebAccessibilityObject::isCollapsed() const bool WebAccessibilityObject::isControl() const { - if (m_private.isNull()) + if (isDetached()) return 0; m_private->updateBackingStore(); @@ -282,7 +290,7 @@ bool WebAccessibilityObject::isControl() const bool WebAccessibilityObject::isEnabled() const { - if (m_private.isNull()) + if (isDetached()) return 0; m_private->updateBackingStore(); @@ -291,7 +299,7 @@ bool WebAccessibilityObject::isEnabled() const bool WebAccessibilityObject::isFocused() const { - if (m_private.isNull()) + if (isDetached()) return 0; m_private->updateBackingStore(); @@ -300,7 +308,7 @@ bool WebAccessibilityObject::isFocused() const bool WebAccessibilityObject::isHovered() const { - if (m_private.isNull()) + if (isDetached()) return 0; m_private->updateBackingStore(); @@ -309,7 +317,7 @@ bool WebAccessibilityObject::isHovered() const bool WebAccessibilityObject::isIndeterminate() const { - if (m_private.isNull()) + if (isDetached()) return 0; m_private->updateBackingStore(); @@ -318,7 +326,7 @@ bool WebAccessibilityObject::isIndeterminate() const bool WebAccessibilityObject::isLinked() const { - if (m_private.isNull()) + if (isDetached()) return 0; m_private->updateBackingStore(); @@ -327,7 +335,7 @@ bool WebAccessibilityObject::isLinked() const bool WebAccessibilityObject::isLoaded() const { - if (m_private.isNull()) + if (isDetached()) return 0; m_private->updateBackingStore(); @@ -336,7 +344,7 @@ bool WebAccessibilityObject::isLoaded() const bool WebAccessibilityObject::isMultiSelectable() const { - if (m_private.isNull()) + if (isDetached()) return 0; m_private->updateBackingStore(); @@ -345,7 +353,7 @@ bool WebAccessibilityObject::isMultiSelectable() const bool WebAccessibilityObject::isOffScreen() const { - if (m_private.isNull()) + if (isDetached()) return 0; m_private->updateBackingStore(); @@ -354,7 +362,7 @@ bool WebAccessibilityObject::isOffScreen() const bool WebAccessibilityObject::isPasswordField() const { - if (m_private.isNull()) + if (isDetached()) return 0; m_private->updateBackingStore(); @@ -363,7 +371,7 @@ bool WebAccessibilityObject::isPasswordField() const bool WebAccessibilityObject::isPressed() const { - if (m_private.isNull()) + if (isDetached()) return 0; m_private->updateBackingStore(); @@ -372,7 +380,7 @@ bool WebAccessibilityObject::isPressed() const bool WebAccessibilityObject::isReadOnly() const { - if (m_private.isNull()) + if (isDetached()) return 0; m_private->updateBackingStore(); @@ -381,7 +389,7 @@ bool WebAccessibilityObject::isReadOnly() const bool WebAccessibilityObject::isRequired() const { - if (m_private.isNull()) + if (isDetached()) return 0; m_private->updateBackingStore(); @@ -390,7 +398,7 @@ bool WebAccessibilityObject::isRequired() const bool WebAccessibilityObject::isSelected() const { - if (m_private.isNull()) + if (isDetached()) return 0; m_private->updateBackingStore(); @@ -399,7 +407,7 @@ bool WebAccessibilityObject::isSelected() const bool WebAccessibilityObject::isSelectedOptionActive() const { - if (m_private.isNull()) + if (isDetached()) return false; m_private->updateBackingStore(); @@ -408,7 +416,7 @@ bool WebAccessibilityObject::isSelectedOptionActive() const bool WebAccessibilityObject::isVertical() const { - if (m_private.isNull()) + if (isDetached()) return 0; m_private->updateBackingStore(); @@ -417,7 +425,7 @@ bool WebAccessibilityObject::isVertical() const bool WebAccessibilityObject::isVisible() const { - if (m_private.isNull()) + if (isDetached()) return 0; m_private->updateBackingStore(); @@ -426,7 +434,7 @@ bool WebAccessibilityObject::isVisible() const bool WebAccessibilityObject::isVisited() const { - if (m_private.isNull()) + if (isDetached()) return 0; m_private->updateBackingStore(); @@ -435,7 +443,7 @@ bool WebAccessibilityObject::isVisited() const WebString WebAccessibilityObject::accessKey() const { - if (m_private.isNull()) + if (isDetached()) return WebString(); m_private->updateBackingStore(); @@ -444,7 +452,7 @@ WebString WebAccessibilityObject::accessKey() const bool WebAccessibilityObject::ariaHasPopup() const { - if (m_private.isNull()) + if (isDetached()) return 0; m_private->updateBackingStore(); @@ -453,7 +461,7 @@ bool WebAccessibilityObject::ariaHasPopup() const bool WebAccessibilityObject::ariaLiveRegionAtomic() const { - if (m_private.isNull()) + if (isDetached()) return 0; m_private->updateBackingStore(); @@ -462,7 +470,7 @@ bool WebAccessibilityObject::ariaLiveRegionAtomic() const bool WebAccessibilityObject::ariaLiveRegionBusy() const { - if (m_private.isNull()) + if (isDetached()) return 0; m_private->updateBackingStore(); @@ -471,7 +479,7 @@ bool WebAccessibilityObject::ariaLiveRegionBusy() const WebString WebAccessibilityObject::ariaLiveRegionRelevant() const { - if (m_private.isNull()) + if (isDetached()) return WebString(); m_private->updateBackingStore(); @@ -480,7 +488,7 @@ WebString WebAccessibilityObject::ariaLiveRegionRelevant() const WebString WebAccessibilityObject::ariaLiveRegionStatus() const { - if (m_private.isNull()) + if (isDetached()) return WebString(); m_private->updateBackingStore(); @@ -489,7 +497,7 @@ WebString WebAccessibilityObject::ariaLiveRegionStatus() const WebRect WebAccessibilityObject::boundingBoxRect() const { - if (m_private.isNull()) + if (isDetached()) return WebRect(); m_private->updateBackingStore(); @@ -498,7 +506,7 @@ WebRect WebAccessibilityObject::boundingBoxRect() const double WebAccessibilityObject::estimatedLoadingProgress() const { - if (m_private.isNull()) + if (isDetached()) return 0.0; m_private->updateBackingStore(); @@ -507,7 +515,7 @@ double WebAccessibilityObject::estimatedLoadingProgress() const WebString WebAccessibilityObject::helpText() const { - if (m_private.isNull()) + if (isDetached()) return WebString(); m_private->updateBackingStore(); @@ -516,7 +524,7 @@ WebString WebAccessibilityObject::helpText() const int WebAccessibilityObject::headingLevel() const { - if (m_private.isNull()) + if (isDetached()) return 0; m_private->updateBackingStore(); @@ -525,7 +533,7 @@ int WebAccessibilityObject::headingLevel() const int WebAccessibilityObject::hierarchicalLevel() const { - if (m_private.isNull()) + if (isDetached()) return 0; m_private->updateBackingStore(); @@ -534,7 +542,7 @@ int WebAccessibilityObject::hierarchicalLevel() const WebAccessibilityObject WebAccessibilityObject::hitTest(const WebPoint& point) const { - if (m_private.isNull()) + if (isDetached()) return WebAccessibilityObject(); m_private->updateBackingStore(); @@ -552,7 +560,7 @@ WebAccessibilityObject WebAccessibilityObject::hitTest(const WebPoint& point) co WebString WebAccessibilityObject::keyboardShortcut() const { - if (m_private.isNull()) + if (isDetached()) return WebString(); m_private->updateBackingStore(); @@ -581,7 +589,7 @@ WebString WebAccessibilityObject::keyboardShortcut() const bool WebAccessibilityObject::performDefaultAction() const { - if (m_private.isNull()) + if (isDetached()) return false; UserGestureIndicator gestureIndicator(DefinitelyProcessingUserGesture); @@ -592,7 +600,7 @@ bool WebAccessibilityObject::performDefaultAction() const WebAccessibilityRole WebAccessibilityObject::roleValue() const { - if (m_private.isNull()) + if (isDetached()) return WebKit::WebAccessibilityRoleUnknown; m_private->updateBackingStore(); @@ -601,7 +609,7 @@ WebAccessibilityRole WebAccessibilityObject::roleValue() const unsigned WebAccessibilityObject::selectionEnd() const { - if (m_private.isNull()) + if (isDetached()) return 0; m_private->updateBackingStore(); @@ -610,7 +618,7 @@ unsigned WebAccessibilityObject::selectionEnd() const unsigned WebAccessibilityObject::selectionStart() const { - if (m_private.isNull()) + if (isDetached()) return 0; m_private->updateBackingStore(); @@ -619,13 +627,13 @@ unsigned WebAccessibilityObject::selectionStart() const void WebAccessibilityObject::setFocused(bool on) const { - if (!m_private.isNull()) + if (!isDetached()) m_private->setFocused(on); } WebString WebAccessibilityObject::stringValue() const { - if (m_private.isNull()) + if (isDetached()) return WebString(); m_private->updateBackingStore(); @@ -634,7 +642,7 @@ WebString WebAccessibilityObject::stringValue() const WebString WebAccessibilityObject::title() const { - if (m_private.isNull()) + if (isDetached()) return WebString(); m_private->updateBackingStore(); @@ -643,7 +651,7 @@ WebString WebAccessibilityObject::title() const WebAccessibilityObject WebAccessibilityObject::titleUIElement() const { - if (m_private.isNull()) + if (isDetached()) return WebAccessibilityObject(); m_private->updateBackingStore(); @@ -652,7 +660,7 @@ WebAccessibilityObject WebAccessibilityObject::titleUIElement() const WebURL WebAccessibilityObject::url() const { - if (m_private.isNull()) + if (isDetached()) return WebURL(); m_private->updateBackingStore(); @@ -661,7 +669,7 @@ WebURL WebAccessibilityObject::url() const WebString WebAccessibilityObject::valueDescription() const { - if (m_private.isNull()) + if (isDetached()) return WebString(); m_private->updateBackingStore(); @@ -670,7 +678,7 @@ WebString WebAccessibilityObject::valueDescription() const float WebAccessibilityObject::valueForRange() const { - if (m_private.isNull()) + if (isDetached()) return 0.0; m_private->updateBackingStore(); @@ -679,7 +687,7 @@ float WebAccessibilityObject::valueForRange() const float WebAccessibilityObject::maxValueForRange() const { - if (m_private.isNull()) + if (isDetached()) return 0.0; m_private->updateBackingStore(); @@ -688,7 +696,7 @@ float WebAccessibilityObject::maxValueForRange() const float WebAccessibilityObject::minValueForRange() const { - if (m_private.isNull()) + if (isDetached()) return 0.0; m_private->updateBackingStore(); @@ -697,7 +705,7 @@ float WebAccessibilityObject::minValueForRange() const WebNode WebAccessibilityObject::node() const { - if (m_private.isNull()) + if (isDetached()) return WebNode(); m_private->updateBackingStore(); @@ -711,7 +719,7 @@ WebNode WebAccessibilityObject::node() const WebDocument WebAccessibilityObject::document() const { - if (m_private.isNull()) + if (isDetached()) return WebDocument(); m_private->updateBackingStore(); @@ -725,7 +733,7 @@ WebDocument WebAccessibilityObject::document() const bool WebAccessibilityObject::hasComputedStyle() const { - if (m_private.isNull()) + if (isDetached()) return false; Document* document = m_private->document(); @@ -741,7 +749,7 @@ bool WebAccessibilityObject::hasComputedStyle() const WebString WebAccessibilityObject::computedStyleDisplay() const { - if (m_private.isNull()) + if (isDetached()) return WebString(); Document* document = m_private->document(); @@ -761,7 +769,7 @@ WebString WebAccessibilityObject::computedStyleDisplay() const bool WebAccessibilityObject::accessibilityIsIgnored() const { - if (m_private.isNull()) + if (isDetached()) return false; m_private->updateBackingStore(); @@ -770,7 +778,7 @@ bool WebAccessibilityObject::accessibilityIsIgnored() const bool WebAccessibilityObject::lineBreaks(WebVector<int>& result) const { - if (m_private.isNull()) + if (isDetached()) return false; m_private->updateBackingStore(); @@ -794,7 +802,7 @@ bool WebAccessibilityObject::lineBreaks(WebVector<int>& result) const unsigned WebAccessibilityObject::columnCount() const { - if (m_private.isNull()) + if (isDetached()) return false; m_private->updateBackingStore(); @@ -806,7 +814,7 @@ unsigned WebAccessibilityObject::columnCount() const unsigned WebAccessibilityObject::rowCount() const { - if (m_private.isNull()) + if (isDetached()) return false; m_private->updateBackingStore(); diff --git a/Source/WebKit/chromium/src/WebDevToolsAgentImpl.cpp b/Source/WebKit/chromium/src/WebDevToolsAgentImpl.cpp index d39ff8af9..6f72f13fd 100644 --- a/Source/WebKit/chromium/src/WebDevToolsAgentImpl.cpp +++ b/Source/WebKit/chromium/src/WebDevToolsAgentImpl.cpp @@ -560,15 +560,6 @@ void WebDevToolsAgentImpl::evaluateInWebInspector(long callId, const WebString& ic->evaluateForTestInFrontend(callId, script); } -void WebDevToolsAgentImpl::setJavaScriptProfilingEnabled(bool enabled) -{ - InspectorController* ic = inspectorController(); - if (enabled) - ic->enableProfiler(); - else - ic->disableProfiler(); -} - WebString WebDevToolsAgent::inspectorProtocolVersion() { return WebCore::inspectorProtocolVersion(); diff --git a/Source/WebKit/chromium/src/WebDevToolsAgentImpl.h b/Source/WebKit/chromium/src/WebDevToolsAgentImpl.h index 1c8e025e8..edbee1471 100644 --- a/Source/WebKit/chromium/src/WebDevToolsAgentImpl.h +++ b/Source/WebKit/chromium/src/WebDevToolsAgentImpl.h @@ -84,7 +84,6 @@ public: virtual void dispatchOnInspectorBackend(const WebString& message); virtual void inspectElementAt(const WebPoint& point); virtual void evaluateInWebInspector(long callId, const WebString& script); - virtual void setJavaScriptProfilingEnabled(bool); virtual void setProcessId(long); // InspectorClient implementation. diff --git a/Source/WebKit/chromium/src/WebIDBDatabaseError.cpp b/Source/WebKit/chromium/src/WebIDBDatabaseError.cpp index c454b485d..ea580b4dc 100644 --- a/Source/WebKit/chromium/src/WebIDBDatabaseError.cpp +++ b/Source/WebKit/chromium/src/WebIDBDatabaseError.cpp @@ -47,7 +47,7 @@ void WebIDBDatabaseError::assign(const WebIDBDatabaseError& value) void WebIDBDatabaseError::assign(unsigned short code, const WebString& message) { - m_private = IDBDatabaseError::createWithoutOffset(code, message); + m_private = IDBDatabaseError::create(code, message); } void WebIDBDatabaseError::reset() @@ -57,7 +57,7 @@ void WebIDBDatabaseError::reset() unsigned short WebIDBDatabaseError::code() const { - return m_private->code(); + return m_private->idbCode(); } WebString WebIDBDatabaseError::message() const diff --git a/Source/WebKit/chromium/src/WebInputElement.cpp b/Source/WebKit/chromium/src/WebInputElement.cpp index c58e90704..c1453de66 100644 --- a/Source/WebKit/chromium/src/WebInputElement.cpp +++ b/Source/WebKit/chromium/src/WebInputElement.cpp @@ -183,6 +183,11 @@ WebNodeCollection WebInputElement::dataListOptions() const return WebNodeCollection(); } +WebString WebInputElement::localizeValue(const WebString& proposedValue) const +{ + return constUnwrap<HTMLInputElement>()->localizeValue(proposedValue); +} + bool WebInputElement::isSpeechInputEnabled() const { #if ENABLE(INPUT_SPEECH) diff --git a/Source/WebKit/chromium/src/WebInputEventConversion.cpp b/Source/WebKit/chromium/src/WebInputEventConversion.cpp index a45cae102..58df5093b 100644 --- a/Source/WebKit/chromium/src/WebInputEventConversion.cpp +++ b/Source/WebKit/chromium/src/WebInputEventConversion.cpp @@ -441,7 +441,11 @@ WebKeyboardEventBuilder::WebKeyboardEventBuilder(const KeyboardEvent& event) type = WebInputEvent::Char; else return; // Skip all other keyboard events. + modifiers = getWebInputModifiers(event); + if (event.keyLocation() & KeyboardEvent::DOM_KEY_LOCATION_NUMPAD) + modifiers |= WebInputEvent::IsKeyPad; + timeStampSeconds = event.timeStamp() / millisPerSecond; windowsKeyCode = event.keyCode(); diff --git a/Source/WebKit/chromium/src/WebLayer.cpp b/Source/WebKit/chromium/src/WebLayer.cpp index bd022b724..6b1029814 100644 --- a/Source/WebKit/chromium/src/WebLayer.cpp +++ b/Source/WebKit/chromium/src/WebLayer.cpp @@ -38,20 +38,21 @@ #include <public/WebTransformationMatrix.h> using namespace WebCore; +using WebKit::WebTransformationMatrix; namespace { -TransformationMatrix transformationMatrixFromSkMatrix44(const SkMatrix44& matrix) +WebTransformationMatrix transformationMatrixFromSkMatrix44(const SkMatrix44& matrix) { double data[16]; matrix.asColMajord(data); - return TransformationMatrix(data[0], data[1], data[2], data[3], - data[4], data[5], data[6], data[7], - data[8], data[9], data[10], data[11], - data[12], data[13], data[14], data[15]); + return WebTransformationMatrix(data[0], data[1], data[2], data[3], + data[4], data[5], data[6], data[7], + data[8], data[9], data[10], data[11], + data[12], data[13], data[14], data[15]); } -SkMatrix44 skMatrix44FromTransformationMatrix(const TransformationMatrix& matrix) +SkMatrix44 skMatrix44FromTransformationMatrix(const WebTransformationMatrix& matrix) { SkMatrix44 skMatrix; skMatrix.set(0, 0, SkDoubleToMScalar(matrix.m11())); @@ -231,7 +232,7 @@ void WebLayer::setSublayerTransform(const SkMatrix44& matrix) void WebLayer::setSublayerTransform(const WebTransformationMatrix& matrix) { - m_private->setSublayerTransform(matrix.toWebCoreTransform()); + m_private->setSublayerTransform(matrix); } SkMatrix44 WebLayer::sublayerTransform() const @@ -246,7 +247,7 @@ void WebLayer::setTransform(const SkMatrix44& matrix) void WebLayer::setTransform(const WebTransformationMatrix& matrix) { - m_private->setTransform(matrix.toWebCoreTransform()); + m_private->setTransform(matrix); } SkMatrix44 WebLayer::transform() const diff --git a/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp b/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp index 2411d9c79..44e51cd87 100644 --- a/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp +++ b/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp @@ -593,11 +593,9 @@ unsigned WebMediaPlayerClientImpl::totalBytes() const return 0; } -unsigned WebMediaPlayerClientImpl::bytesLoaded() const +bool WebMediaPlayerClientImpl::didLoadingProgress() const { - if (m_webMediaPlayer) - return static_cast<unsigned>(m_webMediaPlayer->bytesLoaded()); - return 0; + return m_webMediaPlayer && m_webMediaPlayer->didLoadingProgress(); } void WebMediaPlayerClientImpl::setSize(const IntSize& size) diff --git a/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.h b/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.h index 72170f750..0888d5eee 100644 --- a/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.h +++ b/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.h @@ -122,7 +122,7 @@ public: virtual int dataRate() const; virtual bool totalBytesKnown() const; virtual unsigned totalBytes() const; - virtual unsigned bytesLoaded() const; + virtual bool didLoadingProgress() const; virtual void setSize(const WebCore::IntSize&); virtual void paint(WebCore::GraphicsContext*, const WebCore::IntRect&); virtual void paintCurrentFrameInContext(WebCore::GraphicsContext*, const WebCore::IntRect&); diff --git a/Source/WebKit/chromium/src/WebNotification.cpp b/Source/WebKit/chromium/src/WebNotification.cpp index f6e981d3c..54209fd97 100644 --- a/Source/WebKit/chromium/src/WebNotification.cpp +++ b/Source/WebKit/chromium/src/WebNotification.cpp @@ -36,6 +36,7 @@ #include "Event.h" #include "Notification.h" #include "UserGestureIndicator.h" +#include "WindowFocusAllowedIndicator.h" #include "platform/WebString.h" #include "WebTextDirection.h" @@ -136,8 +137,8 @@ void WebNotification::dispatchCloseEvent(bool /* byUser */) void WebNotification::dispatchClickEvent() { - // Make sure clicks on notifications are treated as user gestures. UserGestureIndicator gestureIndicator(DefinitelyProcessingUserGesture); + WindowFocusAllowedIndicator windowFocusAllowed; dispatchEvent(eventNames().clickEvent); } diff --git a/Source/WebKit/chromium/src/WebSettingsImpl.cpp b/Source/WebKit/chromium/src/WebSettingsImpl.cpp index ffb8c9bfe..c51fffbf7 100644 --- a/Source/WebKit/chromium/src/WebSettingsImpl.cpp +++ b/Source/WebKit/chromium/src/WebSettingsImpl.cpp @@ -118,6 +118,21 @@ void WebSettingsImpl::setDefaultDeviceScaleFactor(int defaultDeviceScaleFactor) m_settings->setDefaultDeviceScaleFactor(defaultDeviceScaleFactor); } +int WebSettingsImpl::defaultDeviceScaleFactor() +{ + return m_settings->defaultDeviceScaleFactor(); +} + +void WebSettingsImpl::setDeviceSupportsTouch(bool deviceSupportsTouch) +{ + m_settings->setDeviceSupportsTouch(deviceSupportsTouch); +} + +bool WebSettingsImpl::deviceSupportsTouch() +{ + return m_settings->deviceSupportsTouch(); +} + void WebSettingsImpl::setApplyDefaultDeviceScaleFactorInCompositor(bool applyDefaultDeviceScaleFactorInCompositor) { m_applyDefaultDeviceScaleFactorInCompositor = applyDefaultDeviceScaleFactorInCompositor; diff --git a/Source/WebKit/chromium/src/WebSettingsImpl.h b/Source/WebKit/chromium/src/WebSettingsImpl.h index 033784039..c28908441 100644 --- a/Source/WebKit/chromium/src/WebSettingsImpl.h +++ b/Source/WebKit/chromium/src/WebSettingsImpl.h @@ -55,9 +55,12 @@ public: virtual void setMinimumFontSize(int); virtual void setMinimumLogicalFontSize(int); virtual void setDefaultDeviceScaleFactor(int); + virtual int defaultDeviceScaleFactor(); virtual void setApplyDefaultDeviceScaleFactorInCompositor(bool); virtual void setFontBoostingEnabled(bool); virtual void setDefaultTextEncodingName(const WebString&); + virtual void setDeviceSupportsTouch(bool); + virtual bool deviceSupportsTouch(); virtual void setJavaScriptEnabled(bool); virtual void setWebSecurityEnabled(bool); virtual void setJavaScriptCanOpenWindowsAutomatically(bool); diff --git a/Source/WebKit/chromium/src/WebTextCheckingCompletionImpl.cpp b/Source/WebKit/chromium/src/WebTextCheckingCompletionImpl.cpp index d7a9be01c..b81ea578b 100644 --- a/Source/WebKit/chromium/src/WebTextCheckingCompletionImpl.cpp +++ b/Source/WebKit/chromium/src/WebTextCheckingCompletionImpl.cpp @@ -52,28 +52,14 @@ static Vector<TextCheckingResult> toCoreResults(const WebVector<WebTextCheckingR void WebTextCheckingCompletionImpl::didFinishCheckingText(const WebVector<WebTextCheckingResult>& results) { - if (m_spellChecker) { - m_spellChecker->didCheckSucceeded(m_identifier, toCoreResults(results)); - m_editorClient->didCheckString(this); - } - + m_request->didSucceed(toCoreResults(results)); delete this; } void WebTextCheckingCompletionImpl::didCancelCheckingText() { - if (m_spellChecker) { - m_spellChecker->didCheckCanceled(m_identifier); - m_editorClient->didCheckString(this); - } - + m_request->didCancel(); delete this; } -void WebTextCheckingCompletionImpl::invalidate() -{ - m_spellChecker = 0; - m_editorClient = 0; -} - } // namespace WebKit diff --git a/Source/WebKit/chromium/src/WebTextCheckingCompletionImpl.h b/Source/WebKit/chromium/src/WebTextCheckingCompletionImpl.h index 06e34addc..cd114132e 100644 --- a/Source/WebKit/chromium/src/WebTextCheckingCompletionImpl.h +++ b/Source/WebKit/chromium/src/WebTextCheckingCompletionImpl.h @@ -31,11 +31,9 @@ #ifndef WebTextCheckingCompletionImpl_h #define WebTextCheckingCompletionImpl_h +#include "TextChecking.h" #include "WebTextCheckingCompletion.h" - -namespace WebCore { -class SpellChecker; -} +#include <wtf/RefPtr.h> namespace WebKit { @@ -43,25 +41,18 @@ class EditorClientImpl; class WebTextCheckingCompletionImpl : public WebTextCheckingCompletion { public: - WebTextCheckingCompletionImpl(int identifier, WebCore::SpellChecker* spellchecker, EditorClientImpl* editorClient) - : m_identifier(identifier) - , m_spellChecker(spellchecker) - , m_editorClient(editorClient) + explicit WebTextCheckingCompletionImpl(WTF::PassRefPtr<WebCore::TextCheckingRequest> request) + : m_request(request) { } - virtual void didFinishCheckingText(const WebVector<WebTextCheckingResult>&); - virtual void didCancelCheckingText(); - - void invalidate(); - WebCore::SpellChecker* spellChecker() const { return m_spellChecker; } + virtual void didFinishCheckingText(const WebVector<WebTextCheckingResult>&) OVERRIDE; + virtual void didCancelCheckingText() OVERRIDE; private: virtual ~WebTextCheckingCompletionImpl() { } - int m_identifier; - WebCore::SpellChecker* m_spellChecker; - EditorClientImpl* m_editorClient; + WTF::RefPtr<WebCore::TextCheckingRequest> m_request; }; } // namespace WebKit diff --git a/Source/WebKit/chromium/src/WebViewImpl.cpp b/Source/WebKit/chromium/src/WebViewImpl.cpp index a8931b120..dacfa152e 100644 --- a/Source/WebKit/chromium/src/WebViewImpl.cpp +++ b/Source/WebKit/chromium/src/WebViewImpl.cpp @@ -1678,8 +1678,9 @@ bool WebViewImpl::handleInputEvent(const WebInputEvent& inputEvent) if (m_doingDragAndDrop) return true; + // Report the event to be NOT processed by WebKit, so that the browser can handle it appropriately. if (m_ignoreInputEvents) - return true; + return false; m_currentInputEvent = &inputEvent; @@ -2955,10 +2956,10 @@ void WebViewImpl::applyAutofillSuggestions( if (!m_autofillPopup) { PopupContainerSettings popupSettings = autofillPopupSettings; - popupSettings.defaultDeviceScaleFactor = - m_page->settings()->defaultDeviceScaleFactor(); + popupSettings.defaultDeviceScaleFactor = settingsImpl()->defaultDeviceScaleFactor(); if (!popupSettings.defaultDeviceScaleFactor) popupSettings.defaultDeviceScaleFactor = 1; + popupSettings.deviceSupportsTouch = settingsImpl()->deviceSupportsTouch(); m_autofillPopup = PopupContainer::create(m_autofillPopupClient.get(), PopupContainer::Suggestion, popupSettings); diff --git a/Source/WebKit/chromium/src/gtk/WebInputEventFactory.cpp b/Source/WebKit/chromium/src/gtk/WebInputEventFactory.cpp index b82ea52b3..72db521d5 100644 --- a/Source/WebKit/chromium/src/gtk/WebInputEventFactory.cpp +++ b/Source/WebKit/chromium/src/gtk/WebInputEventFactory.cpp @@ -79,6 +79,12 @@ void resetClickCountState() gLastClickButton = WebKit::WebMouseEvent::ButtonNone; } +bool isKeyPadKeyval(guint keyval) +{ + // Keypad keyvals all fall into one range. + return keyval >= GDK_KP_Space && keyval <= GDK_KP_9; +} + } // namespace namespace WebKit { @@ -365,7 +371,9 @@ WebKeyboardEvent WebInputEventFactory::keyboardEvent(const GdkEventKey* event) result.setKeyIdentifierFromWindowsKeyCode(); - // FIXME: Do we need to set IsAutoRepeat or IsKeyPad? + // FIXME: Do we need to set IsAutoRepeat? + if (isKeyPadKeyval(event->keyval)) + result.modifiers |= WebInputEvent::IsKeyPad; return result; } diff --git a/Source/WebKit/chromium/tests/CCAnimationTestCommon.cpp b/Source/WebKit/chromium/tests/CCAnimationTestCommon.cpp index 36f79818e..0e8c1a401 100644 --- a/Source/WebKit/chromium/tests/CCAnimationTestCommon.cpp +++ b/Source/WebKit/chromium/tests/CCAnimationTestCommon.cpp @@ -99,9 +99,9 @@ FakeTransformTransition::~FakeTransformTransition() { } -WebCore::TransformationMatrix FakeTransformTransition::getValue(double time, const WebCore::IntSize& size) const +WebKit::WebTransformationMatrix FakeTransformTransition::getValue(double time, const WebCore::IntSize& size) const { - return WebCore::TransformationMatrix(); + return WebKit::WebTransformationMatrix(); } PassOwnPtr<WebCore::CCAnimationCurve> FakeTransformTransition::clone() const diff --git a/Source/WebKit/chromium/tests/CCAnimationTestCommon.h b/Source/WebKit/chromium/tests/CCAnimationTestCommon.h index 776b75c8d..4384117d3 100644 --- a/Source/WebKit/chromium/tests/CCAnimationTestCommon.h +++ b/Source/WebKit/chromium/tests/CCAnimationTestCommon.h @@ -25,6 +25,7 @@ #ifndef CCAnimationTestCommon_h #define CCAnimationTestCommon_h +#include "IntSize.h" #include "cc/CCAnimationCurve.h" #include "cc/CCLayerAnimationController.h" @@ -53,7 +54,7 @@ public: virtual ~FakeTransformTransition(); virtual double duration() const OVERRIDE { return m_duration; } - virtual WebCore::TransformationMatrix getValue(double time, const WebCore::IntSize&) const OVERRIDE; + virtual WebKit::WebTransformationMatrix getValue(double time, const WebCore::IntSize&) const OVERRIDE; virtual PassOwnPtr<WebCore::CCAnimationCurve> clone() const OVERRIDE; @@ -86,13 +87,13 @@ public: virtual int id() const OVERRIDE { return 0; } virtual void setOpacityFromAnimation(float opacity) OVERRIDE { m_opacity = opacity; } virtual float opacity() const OVERRIDE { return m_opacity; } - virtual void setTransformFromAnimation(const WebCore::TransformationMatrix& transform) OVERRIDE { m_transform = transform; } - virtual const WebCore::TransformationMatrix& transform() const OVERRIDE { return m_transform; } + virtual void setTransformFromAnimation(const WebKit::WebTransformationMatrix& transform) OVERRIDE { m_transform = transform; } + virtual const WebKit::WebTransformationMatrix& transform() const OVERRIDE { return m_transform; } virtual const WebCore::IntSize& bounds() const OVERRIDE { return m_bounds; } private: float m_opacity; - WebCore::TransformationMatrix m_transform; + WebKit::WebTransformationMatrix m_transform; WebCore::IntSize m_bounds; }; diff --git a/Source/WebKit/chromium/tests/CCDamageTrackerTest.cpp b/Source/WebKit/chromium/tests/CCDamageTrackerTest.cpp index bbea971dd..56d85fafa 100644 --- a/Source/WebKit/chromium/tests/CCDamageTrackerTest.cpp +++ b/Source/WebKit/chromium/tests/CCDamageTrackerTest.cpp @@ -46,7 +46,7 @@ namespace { void executeCalculateDrawTransformsAndVisibility(CCLayerImpl* root, Vector<CCLayerImpl*>& renderSurfaceLayerList) { CCLayerSorter layerSorter; - TransformationMatrix identityMatrix; + WebTransformationMatrix identityMatrix; Vector<CCLayerImpl*> dummyLayerList; int dummyMaxTextureSize = 512; @@ -291,7 +291,7 @@ TEST_F(CCDamageTrackerTest, verifyDamageForTransformedLayer) OwnPtr<CCLayerImpl> root = createAndSetUpTestTreeWithOneSurface(); CCLayerImpl* child = root->children()[0].get(); - TransformationMatrix rotation; + WebTransformationMatrix rotation; rotation.rotate(45); // Note carefully, the anchor is actually part of layer->position(). By setting anchor @@ -332,7 +332,7 @@ TEST_F(CCDamageTrackerTest, verifyDamageForPerspectiveClippedLayer) OwnPtr<CCLayerImpl> root = createAndSetUpTestTreeWithOneSurface(); CCLayerImpl* child = root->children()[0].get(); - TransformationMatrix transform; + WebTransformationMatrix transform; transform.applyPerspective(1); transform.translate3d(-150, -50, 0); transform.rotate3d(0, 45, 0); @@ -789,7 +789,7 @@ TEST_F(CCDamageTrackerTest, verifyDamageForReplica) OwnPtr<CCLayerImpl> grandChild1Replica = CCLayerImpl::create(7); grandChild1Replica->setPosition(FloatPoint::zero()); grandChild1Replica->setAnchorPoint(FloatPoint::zero()); - TransformationMatrix reflection; + WebTransformationMatrix reflection; reflection.scale3d(-1.0, 1.0, 1.0); grandChild1Replica->setTransform(reflection); grandChild1->setReplicaLayer(grandChild1Replica.release()); @@ -928,7 +928,7 @@ TEST_F(CCDamageTrackerTest, verifyDamageForReplicaMask) OwnPtr<CCLayerImpl> grandChild1Replica = CCLayerImpl::create(6); grandChild1Replica->setPosition(FloatPoint::zero()); grandChild1Replica->setAnchorPoint(FloatPoint::zero()); - TransformationMatrix reflection; + WebTransformationMatrix reflection; reflection.scale3d(-1.0, 1.0, 1.0); grandChild1Replica->setTransform(reflection); grandChild1->setReplicaLayer(grandChild1Replica.release()); @@ -988,7 +988,7 @@ TEST_F(CCDamageTrackerTest, verifyDamageForReplicaMaskWithAnchor) OwnPtr<CCLayerImpl> grandChild1Replica = CCLayerImpl::create(6); grandChild1Replica->setPosition(FloatPoint::zero()); grandChild1Replica->setAnchorPoint(FloatPoint::zero()); // note, this is not the anchor being tested. - TransformationMatrix reflection; + WebTransformationMatrix reflection; reflection.scale3d(-1.0, 1.0, 1.0); grandChild1Replica->setTransform(reflection); grandChild1->setReplicaLayer(grandChild1Replica.release()); diff --git a/Source/WebKit/chromium/tests/CCKeyframedAnimationCurveTest.cpp b/Source/WebKit/chromium/tests/CCKeyframedAnimationCurveTest.cpp index 15b554a06..ad1ae74ca 100644 --- a/Source/WebKit/chromium/tests/CCKeyframedAnimationCurveTest.cpp +++ b/Source/WebKit/chromium/tests/CCKeyframedAnimationCurveTest.cpp @@ -31,18 +31,18 @@ #include <gmock/gmock.h> #include <gtest/gtest.h> +#include <public/WebTransformationMatrix.h> #include <wtf/OwnPtr.h> #include <wtf/Vector.h> using namespace WebCore; +using WebKit::WebTransformationMatrix; namespace { -void expectTranslateX(double translateX, const TransformationMatrix& matrix) +void expectTranslateX(double translateX, const WebTransformationMatrix& matrix) { - TransformationMatrix::DecomposedType decomposedType; - matrix.decompose(decomposedType); - EXPECT_FLOAT_EQ(translateX, decomposedType.translateX); + EXPECT_FLOAT_EQ(translateX, matrix.m41()); } // Tests that a float animation with one keyframe works as expected. @@ -191,10 +191,8 @@ TEST(CCKeyframedAnimationCurveTest, RepeatedTransformKeyTimes) expectTranslateX(4, curve->getValue(0.5, layerSize)); // There is a discontinuity at 1. Any value between 4 and 6 is valid. - TransformationMatrix value = curve->getValue(1, layerSize); - TransformationMatrix::DecomposedType decomposedType; - value.decompose(decomposedType); - EXPECT_TRUE(decomposedType.translateX >= 4 && decomposedType.translateX <= 6); + WebTransformationMatrix value = curve->getValue(1, layerSize); + EXPECT_TRUE(value.m41() >= 4 && value.m41() <= 6); expectTranslateX(6, curve->getValue(1.5, layerSize)); expectTranslateX(6, curve->getValue(2, layerSize)); diff --git a/Source/WebKit/chromium/tests/CCLayerAnimationControllerTest.cpp b/Source/WebKit/chromium/tests/CCLayerAnimationControllerTest.cpp index 827194bbc..dbed02c74 100644 --- a/Source/WebKit/chromium/tests/CCLayerAnimationControllerTest.cpp +++ b/Source/WebKit/chromium/tests/CCLayerAnimationControllerTest.cpp @@ -35,18 +35,18 @@ #include <gmock/gmock.h> #include <gtest/gtest.h> +#include <public/WebTransformationMatrix.h> #include <wtf/Vector.h> using namespace WebCore; using namespace WebKitTests; +using WebKit::WebTransformationMatrix; namespace { -void expectTranslateX(double translateX, const TransformationMatrix& matrix) +void expectTranslateX(double translateX, const WebTransformationMatrix& matrix) { - TransformationMatrix::DecomposedType decomposedType; - matrix.decompose(decomposedType); - EXPECT_FLOAT_EQ(translateX, decomposedType.translateX); + EXPECT_FLOAT_EQ(translateX, matrix.m41()); } PassOwnPtr<CCActiveAnimation> createActiveAnimation(PassOwnPtr<CCAnimationCurve> curve, int id, CCActiveAnimation::TargetProperty property) diff --git a/Source/WebKit/chromium/tests/CCLayerImplTest.cpp b/Source/WebKit/chromium/tests/CCLayerImplTest.cpp index f5259e1cf..827c9adaa 100644 --- a/Source/WebKit/chromium/tests/CCLayerImplTest.cpp +++ b/Source/WebKit/chromium/tests/CCLayerImplTest.cpp @@ -86,7 +86,7 @@ TEST(CCLayerImplTest, verifyLayerChangesAreTrackedProperly) IntRect arbitraryIntRect = IntRect(arbitraryIntPoint, arbitraryIntSize); FloatRect arbitraryFloatRect = FloatRect(arbitraryFloatPoint, FloatSize(1.234f, 5.678f)); Color arbitraryColor = Color(10, 20, 30); - TransformationMatrix arbitraryTransform; + WebTransformationMatrix arbitraryTransform; arbitraryTransform.scale3d(0.1, 0.2, 0.3); WebFilterOperations arbitraryFilters; arbitraryFilters.append(WebFilterOperation::createOpacityFilter(0.5)); diff --git a/Source/WebKit/chromium/tests/CCLayerIteratorTest.cpp b/Source/WebKit/chromium/tests/CCLayerIteratorTest.cpp index f5eae7f84..105c7186e 100644 --- a/Source/WebKit/chromium/tests/CCLayerIteratorTest.cpp +++ b/Source/WebKit/chromium/tests/CCLayerIteratorTest.cpp @@ -30,8 +30,10 @@ #include "cc/CCLayerTreeHostCommon.h" #include <gmock/gmock.h> #include <gtest/gtest.h> +#include <public/WebTransformationMatrix.h> using namespace WebCore; +using WebKit::WebTransformationMatrix; using ::testing::Mock; using ::testing::_; using ::testing::AtLeast; @@ -139,7 +141,7 @@ TEST(CCLayerIteratorTest, simpleTree) Vector<RefPtr<LayerChromium> > layerList; renderSurfaceLayerList.append(rootLayer.get()); CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility(rootLayer.get(), rootLayer.get(), - TransformationMatrix(), TransformationMatrix(), + WebTransformationMatrix(), WebTransformationMatrix(), renderSurfaceLayerList, layerList, 256); @@ -186,7 +188,7 @@ TEST(CCLayerIteratorTest, complexTree) Vector<RefPtr<LayerChromium> > layerList; renderSurfaceLayerList.append(rootLayer.get()); CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility(rootLayer.get(), rootLayer.get(), - TransformationMatrix(), TransformationMatrix(), + WebTransformationMatrix(), WebTransformationMatrix(), renderSurfaceLayerList, layerList, 256); @@ -245,7 +247,7 @@ TEST(CCLayerIteratorTest, complexTreeMultiSurface) Vector<RefPtr<LayerChromium> > layerList; renderSurfaceLayerList.append(rootLayer.get()); CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility(rootLayer.get(), rootLayer.get(), - TransformationMatrix(), TransformationMatrix(), + WebTransformationMatrix(), WebTransformationMatrix(), renderSurfaceLayerList, layerList, 256); diff --git a/Source/WebKit/chromium/tests/CCLayerSorterTest.cpp b/Source/WebKit/chromium/tests/CCLayerSorterTest.cpp index 65db549ba..d231e1259 100644 --- a/Source/WebKit/chromium/tests/CCLayerSorterTest.cpp +++ b/Source/WebKit/chromium/tests/CCLayerSorterTest.cpp @@ -30,8 +30,10 @@ #include "cc/CCMathUtil.h" #include "cc/CCSingleThreadProxy.h" #include <gtest/gtest.h> +#include <public/WebTransformationMatrix.h> using namespace WebCore; +using WebKit::WebTransformationMatrix; namespace { @@ -46,11 +48,11 @@ TEST(CCLayerSorterTest, BasicOverlap) float weight = 0; // Trivial test, with one layer directly obscuring the other. - TransformationMatrix neg4Translate; + WebTransformationMatrix neg4Translate; neg4Translate.translate3d(0, 0, -4); CCLayerSorter::LayerShape front(2, 2, neg4Translate); - TransformationMatrix neg5Translate; + WebTransformationMatrix neg5Translate; neg5Translate.translate3d(0, 0, -5); CCLayerSorter::LayerShape back(2, 2, neg5Translate); @@ -63,7 +65,7 @@ TEST(CCLayerSorterTest, BasicOverlap) EXPECT_EQ(1, weight); // One layer translated off to the right. No overlap should be detected. - TransformationMatrix rightTranslate; + WebTransformationMatrix rightTranslate; rightTranslate.translate3d(10, 0, -5); CCLayerSorter::LayerShape backRight(2, 2, rightTranslate); overlapResult = CCLayerSorter::checkOverlap(&front, &backRight, zThreshold, weight); @@ -80,14 +82,15 @@ TEST(CCLayerSorterTest, RightAngleOverlap) const float zThreshold = 0.1f; float weight = 0; - TransformationMatrix perspectiveMatrix; + WebTransformationMatrix perspectiveMatrix; perspectiveMatrix.applyPerspective(1000); // Two layers forming a right angle with a perspective viewing transform. - TransformationMatrix leftFaceMatrix; - leftFaceMatrix.rotate3d(0, 1, 0, -90).translateRight3d(-1, 0, -5); + WebTransformationMatrix leftFaceMatrix; + leftFaceMatrix.rotate3d(0, 1, 0, -90); + leftFaceMatrix.translateRight3d(-1, 0, -5); CCLayerSorter::LayerShape leftFace(2, 2, perspectiveMatrix * leftFaceMatrix); - TransformationMatrix frontFaceMatrix; + WebTransformationMatrix frontFaceMatrix; frontFaceMatrix.translate3d(0, 0, -4); CCLayerSorter::LayerShape frontFace(2, 2, perspectiveMatrix * frontFaceMatrix); @@ -101,17 +104,18 @@ TEST(CCLayerSorterTest, IntersectingLayerOverlap) const float zThreshold = 0.1f; float weight = 0; - TransformationMatrix perspectiveMatrix; + WebTransformationMatrix perspectiveMatrix; perspectiveMatrix.applyPerspective(1000); // Intersecting layers. An explicit order will be returned based on relative z // values at the overlapping features but the weight returned should be zero. - TransformationMatrix frontFaceMatrix; + WebTransformationMatrix frontFaceMatrix; frontFaceMatrix.translate3d(0, 0, -4); CCLayerSorter::LayerShape frontFace(2, 2, perspectiveMatrix * frontFaceMatrix); - TransformationMatrix throughMatrix; - throughMatrix.rotate3d(0, 1, 0, 45).translateRight3d(0, 0, -4); + WebTransformationMatrix throughMatrix; + throughMatrix.rotate3d(0, 1, 0, 45); + throughMatrix.translateRight3d(0, 0, -4); CCLayerSorter::LayerShape rotatedFace(2, 2, perspectiveMatrix * throughMatrix); overlapResult = CCLayerSorter::checkOverlap(&frontFace, &rotatedFace, zThreshold, weight); EXPECT_NE(CCLayerSorter::None, overlapResult); @@ -136,15 +140,15 @@ TEST(CCLayerSorterTest, LayersAtAngleOverlap) // C is in front of A and behind B (not what you'd expect by comparing centers). // A and B don't overlap, so they're incomparable. - TransformationMatrix transformA; + WebTransformationMatrix transformA; transformA.translate3d(-6, 0, 1); CCLayerSorter::LayerShape layerA(8, 20, transformA); - TransformationMatrix transformB; + WebTransformationMatrix transformB; transformB.translate3d(6, 0, -1); CCLayerSorter::LayerShape layerB(8, 20, transformB); - TransformationMatrix transformC; + WebTransformationMatrix transformC; transformC.rotate3d(0, 1, 0, 40); CCLayerSorter::LayerShape layerC(8, 20, transformC); @@ -167,10 +171,10 @@ TEST(CCLayerSorterTest, LayersUnderPathologicalPerspectiveTransform) // where w < 0. If the code uses the invalid value, it will think that a layer has // different bounds than it really does, which can cause things to sort incorrectly. - TransformationMatrix perspectiveMatrix; + WebTransformationMatrix perspectiveMatrix; perspectiveMatrix.applyPerspective(1); - TransformationMatrix transformA; + WebTransformationMatrix transformA; transformA.translate3d(-15, 0, -2); CCLayerSorter::LayerShape layerA(10, 10, perspectiveMatrix * transformA); @@ -178,7 +182,7 @@ TEST(CCLayerSorterTest, LayersUnderPathologicalPerspectiveTransform) // visible on the left half of the projection plane, in front of layerA. When it is // not clipped, its bounds will actually incorrectly appear much smaller and the // correct sorting dependency will not be found. - TransformationMatrix transformB; + WebTransformationMatrix transformB; transformB.translate3d(0, 0, 0.7); transformB.rotate3d(0, 45, 0); CCLayerSorter::LayerShape layerB(10, 10, perspectiveMatrix * transformB); @@ -216,9 +220,9 @@ TEST(CCLayerSorterTest, verifyExistingOrderingPreservedWhenNoZDiff) OwnPtr<CCLayerImpl> layer4 = CCLayerImpl::create(4); OwnPtr<CCLayerImpl> layer5 = CCLayerImpl::create(5); - TransformationMatrix BehindMatrix; + WebTransformationMatrix BehindMatrix; BehindMatrix.translate3d(0, 0, 2); - TransformationMatrix FrontMatrix; + WebTransformationMatrix FrontMatrix; FrontMatrix.translate3d(0, 0, 1); layer1->setBounds(IntSize(10, 10)); diff --git a/Source/WebKit/chromium/tests/CCLayerTreeHostCommonTest.cpp b/Source/WebKit/chromium/tests/CCLayerTreeHostCommonTest.cpp index 17e570199..fce9046c7 100644 --- a/Source/WebKit/chromium/tests/CCLayerTreeHostCommonTest.cpp +++ b/Source/WebKit/chromium/tests/CCLayerTreeHostCommonTest.cpp @@ -29,20 +29,21 @@ #include "CCAnimationTestCommon.h" #include "CCLayerTreeTestCommon.h" #include "LayerChromium.h" -#include "TransformationMatrix.h" #include "TranslateTransformOperation.h" #include "cc/CCLayerAnimationController.h" #include "cc/CCMathUtil.h" #include <gmock/gmock.h> #include <gtest/gtest.h> +#include <public/WebTransformationMatrix.h> using namespace WebCore; using namespace WebKitTests; +using WebKit::WebTransformationMatrix; namespace { -void setLayerPropertiesForTesting(LayerChromium* layer, const TransformationMatrix& transform, const TransformationMatrix& sublayerTransform, const FloatPoint& anchor, const FloatPoint& position, const IntSize& bounds, bool preserves3D) +void setLayerPropertiesForTesting(LayerChromium* layer, const WebTransformationMatrix& transform, const WebTransformationMatrix& sublayerTransform, const FloatPoint& anchor, const FloatPoint& position, const IntSize& bounds, bool preserves3D) { layer->setTransform(transform); layer->setSublayerTransform(sublayerTransform); @@ -54,16 +55,16 @@ void setLayerPropertiesForTesting(LayerChromium* layer, const TransformationMatr void executeCalculateDrawTransformsAndVisibility(LayerChromium* rootLayer) { - TransformationMatrix identityMatrix; + WebTransformationMatrix identityMatrix; Vector<RefPtr<LayerChromium> > dummyRenderSurfaceLayerList; Vector<RefPtr<LayerChromium> > dummyLayerList; int dummyMaxTextureSize = 512; CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility(rootLayer, rootLayer, identityMatrix, identityMatrix, dummyRenderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize); } -TransformationMatrix remove3DComponentOfMatrix(const TransformationMatrix& mat) +WebTransformationMatrix remove3DComponentOfMatrix(const WebTransformationMatrix& mat) { - TransformationMatrix ret = mat; + WebTransformationMatrix ret = mat; ret.setM13(0); ret.setM23(0); ret.setM31(0); @@ -98,7 +99,7 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForNoOpLayer) parent->addChild(child); child->addChild(grandChild); - TransformationMatrix identityMatrix; + WebTransformationMatrix identityMatrix; setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, FloatPoint(0.0f, 0.0f), FloatPoint(0.0f, 0.0f), IntSize(0, 0), false); setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, FloatPoint(0.0f, 0.0f), FloatPoint(0.0f, 0.0f), IntSize(0, 0), false); setLayerPropertiesForTesting(grandChild.get(), identityMatrix, identityMatrix, FloatPoint(0.0f, 0.0f), FloatPoint(0.0f, 0.0f), IntSize(0, 0), false); @@ -120,12 +121,12 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForSingleLayer) // value of LayerChromium::position() changes if the anchor changes, even though the layer is not actually located in a // different position. When we initialize layers for testing here, we need to initialize that unintutive position value. - TransformationMatrix identityMatrix; + WebTransformationMatrix identityMatrix; RefPtr<LayerChromium> layer = LayerChromium::create(); layer->createRenderSurface(); // Case 1: setting the sublayer transform should not affect this layer's draw transform or screen-space transform. - TransformationMatrix arbitraryTranslation; + WebTransformationMatrix arbitraryTranslation; arbitraryTranslation.translate(10.0, 20.0); setLayerPropertiesForTesting(layer.get(), identityMatrix, arbitraryTranslation, FloatPoint(0.0f, 0.0f), FloatPoint(0.0f, 0.0f), IntSize(0, 0), false); executeCalculateDrawTransformsAndVisibility(layer.get()); @@ -134,7 +135,7 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForSingleLayer) // Case 2: setting the bounds of the layer should result in a draw transform that translates to half the width and height. // The screen-space transform should remain as the identity, because it does not deal with transforming to/from the center of the layer. - TransformationMatrix translationToCenter; + WebTransformationMatrix translationToCenter; translationToCenter.translate(5.0, 6.0); setLayerPropertiesForTesting(layer.get(), identityMatrix, identityMatrix, FloatPoint(0.0f, 0.0f), FloatPoint(0.0f, 0.0f), IntSize(10, 12), false); executeCalculateDrawTransformsAndVisibility(layer.get()); @@ -148,7 +149,7 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForSingleLayer) EXPECT_TRANSFORMATION_MATRIX_EQ(identityMatrix, layer->screenSpaceTransform()); // Case 4: A change in "actual" position affects both the draw transform and screen space transform. - TransformationMatrix positionTransform; + WebTransformationMatrix positionTransform; positionTransform.translate(0.0, 1.2); setLayerPropertiesForTesting(layer.get(), identityMatrix, identityMatrix, FloatPoint(0.25f, 0.25f), FloatPoint(2.5f, 4.2f), IntSize(10, 12), false); executeCalculateDrawTransformsAndVisibility(layer.get()); @@ -157,7 +158,7 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForSingleLayer) // Case 5: In the correct sequence of transforms, the layer transform should pre-multiply the translationToCenter. This is easily tested by // using a scale transform, because scale and translation are not commutative. - TransformationMatrix layerTransform; + WebTransformationMatrix layerTransform; layerTransform.scale3d(2.0, 2.0, 1.0); setLayerPropertiesForTesting(layer.get(), layerTransform, identityMatrix, FloatPoint(0.0f, 0.0f), FloatPoint(0.0f, 0.0f), IntSize(10, 12), false); executeCalculateDrawTransformsAndVisibility(layer.get()); @@ -165,9 +166,9 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForSingleLayer) EXPECT_TRANSFORMATION_MATRIX_EQ(layerTransform, layer->screenSpaceTransform()); // Case 6: The layer transform should occur with respect to the anchor point. - TransformationMatrix translationToAnchor; + WebTransformationMatrix translationToAnchor; translationToAnchor.translate(5.0, 0.0); - TransformationMatrix expectedResult = translationToAnchor * layerTransform * translationToAnchor.inverse(); + WebTransformationMatrix expectedResult = translationToAnchor * layerTransform * translationToAnchor.inverse(); setLayerPropertiesForTesting(layer.get(), layerTransform, identityMatrix, FloatPoint(0.5f, 0.0f), FloatPoint(5.0f, 0.0f), IntSize(10, 12), false); executeCalculateDrawTransformsAndVisibility(layer.get()); EXPECT_TRANSFORMATION_MATRIX_EQ(expectedResult * translationToCenter, layer->drawTransform()); @@ -185,7 +186,7 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForSingleLayer) TEST(CCLayerTreeHostCommonTest, verifyTransformsForSimpleHierarchy) { - TransformationMatrix identityMatrix; + WebTransformationMatrix identityMatrix; RefPtr<LayerChromium> parent = LayerChromium::create(); RefPtr<LayerChromium> child = LayerChromium::create(); RefPtr<LayerChromium> grandChild = LayerChromium::create(); @@ -194,7 +195,7 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForSimpleHierarchy) child->addChild(grandChild); // Case 1: parent's anchorPoint should not affect child or grandChild. - TransformationMatrix childTranslationToCenter, grandChildTranslationToCenter; + WebTransformationMatrix childTranslationToCenter, grandChildTranslationToCenter; childTranslationToCenter.translate(8.0, 9.0); grandChildTranslationToCenter.translate(38.0, 39.0); setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, FloatPoint(0.25f, 0.25f), FloatPoint(2.5f, 3.0f), IntSize(10, 12), false); @@ -207,7 +208,7 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForSimpleHierarchy) EXPECT_TRANSFORMATION_MATRIX_EQ(identityMatrix, grandChild->screenSpaceTransform()); // Case 2: parent's position affects child and grandChild. - TransformationMatrix parentPositionTransform; + WebTransformationMatrix parentPositionTransform; parentPositionTransform.translate(0.0, 1.2); setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, FloatPoint(0.25f, 0.25f), FloatPoint(2.5f, 4.2f), IntSize(10, 12), false); setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, FloatPoint(0.0f, 0.0f), FloatPoint(0.0f, 0.0f), IntSize(16, 18), false); @@ -219,11 +220,11 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForSimpleHierarchy) EXPECT_TRANSFORMATION_MATRIX_EQ(parentPositionTransform, grandChild->screenSpaceTransform()); // Case 3: parent's local transform affects child and grandchild - TransformationMatrix parentLayerTransform; + WebTransformationMatrix parentLayerTransform; parentLayerTransform.scale3d(2.0, 2.0, 1.0); - TransformationMatrix parentTranslationToAnchor; + WebTransformationMatrix parentTranslationToAnchor; parentTranslationToAnchor.translate(2.5, 3.0); - TransformationMatrix parentCompositeTransform = parentTranslationToAnchor * parentLayerTransform * parentTranslationToAnchor.inverse(); + WebTransformationMatrix parentCompositeTransform = parentTranslationToAnchor * parentLayerTransform * parentTranslationToAnchor.inverse(); setLayerPropertiesForTesting(parent.get(), parentLayerTransform, identityMatrix, FloatPoint(0.25f, 0.25f), FloatPoint(2.5f, 3.0f), IntSize(10, 12), false); setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, FloatPoint(0.0f, 0.0f), FloatPoint(0.0f, 0.0f), IntSize(16, 18), false); setLayerPropertiesForTesting(grandChild.get(), identityMatrix, identityMatrix, FloatPoint(0.0f, 0.0f), FloatPoint(0.0f, 0.0f), IntSize(76, 78), false); @@ -237,14 +238,14 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForSimpleHierarchy) // scaling is used here again so that the correct sequence of transforms is properly tested. // Note that preserves3D is false, but the sublayer matrix should retain its 3D properties when given to child. // But then, the child also does not preserve3D. When it gives its hierarchy to the grandChild, it should be flattened to 2D. - TransformationMatrix parentSublayerMatrix; + WebTransformationMatrix parentSublayerMatrix; parentSublayerMatrix.scale3d(10.0, 10.0, 3.3); - TransformationMatrix parentTranslationToCenter; + WebTransformationMatrix parentTranslationToCenter; parentTranslationToCenter.translate(5.0, 6.0); // Sublayer matrix is applied to the center of the parent layer. parentCompositeTransform = parentTranslationToAnchor * parentLayerTransform * parentTranslationToAnchor.inverse() * parentTranslationToCenter * parentSublayerMatrix * parentTranslationToCenter.inverse(); - TransformationMatrix flattenedCompositeTransform = remove3DComponentOfMatrix(parentCompositeTransform); + WebTransformationMatrix flattenedCompositeTransform = remove3DComponentOfMatrix(parentCompositeTransform); setLayerPropertiesForTesting(parent.get(), parentLayerTransform, parentSublayerMatrix, FloatPoint(0.25f, 0.25f), FloatPoint(2.5f, 3.0f), IntSize(10, 12), false); setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, FloatPoint(0.0f, 0.0f), FloatPoint(0.0f, 0.0f), IntSize(16, 18), false); setLayerPropertiesForTesting(grandChild.get(), identityMatrix, identityMatrix, FloatPoint(0.0f, 0.0f), FloatPoint(0.0f, 0.0f), IntSize(76, 78), false); @@ -278,18 +279,18 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForSingleRenderSurface) // Child is set up so that a new render surface should be created. child->setOpacity(0.5f); - TransformationMatrix identityMatrix; - TransformationMatrix parentLayerTransform; + WebTransformationMatrix identityMatrix; + WebTransformationMatrix parentLayerTransform; parentLayerTransform.scale3d(2.0, 2.0, 1.0); - TransformationMatrix parentTranslationToAnchor; + WebTransformationMatrix parentTranslationToAnchor; parentTranslationToAnchor.translate(2.5, 3.0); - TransformationMatrix parentSublayerMatrix; + WebTransformationMatrix parentSublayerMatrix; parentSublayerMatrix.scale3d(10.0, 10.0, 3.3); - TransformationMatrix parentTranslationToCenter; + WebTransformationMatrix parentTranslationToCenter; parentTranslationToCenter.translate(5.0, 6.0); - TransformationMatrix parentCompositeTransform = parentTranslationToAnchor * parentLayerTransform * parentTranslationToAnchor.inverse() + WebTransformationMatrix parentCompositeTransform = parentTranslationToAnchor * parentLayerTransform * parentTranslationToAnchor.inverse() * parentTranslationToCenter * parentSublayerMatrix * parentTranslationToCenter.inverse(); - TransformationMatrix childTranslationToCenter; + WebTransformationMatrix childTranslationToCenter; childTranslationToCenter.translate(8.0, 9.0); // Child's render surface should not exist yet. @@ -331,22 +332,22 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForReplica) // Child is set up so that a new render surface should be created. child->setOpacity(0.5f); - TransformationMatrix identityMatrix; - TransformationMatrix parentLayerTransform; + WebTransformationMatrix identityMatrix; + WebTransformationMatrix parentLayerTransform; parentLayerTransform.scale3d(2.0, 2.0, 1.0); - TransformationMatrix parentTranslationToAnchor; + WebTransformationMatrix parentTranslationToAnchor; parentTranslationToAnchor.translate(2.5, 3.0); - TransformationMatrix parentSublayerMatrix; + WebTransformationMatrix parentSublayerMatrix; parentSublayerMatrix.scale3d(10.0, 10.0, 3.3); - TransformationMatrix parentTranslationToCenter; + WebTransformationMatrix parentTranslationToCenter; parentTranslationToCenter.translate(5.0, 6.0); - TransformationMatrix parentCompositeTransform = parentTranslationToAnchor * parentLayerTransform * parentTranslationToAnchor.inverse() + WebTransformationMatrix parentCompositeTransform = parentTranslationToAnchor * parentLayerTransform * parentTranslationToAnchor.inverse() * parentTranslationToCenter * parentSublayerMatrix * parentTranslationToCenter.inverse(); - TransformationMatrix childTranslationToCenter; + WebTransformationMatrix childTranslationToCenter; childTranslationToCenter.translate(8.0, 9.0); - TransformationMatrix replicaLayerTransform; + WebTransformationMatrix replicaLayerTransform; replicaLayerTransform.scale3d(3.0, 3.0, 1.0); - TransformationMatrix replicaCompositeTransform = parentCompositeTransform * replicaLayerTransform; + WebTransformationMatrix replicaCompositeTransform = parentCompositeTransform * replicaLayerTransform; // Child's render surface should not exist yet. ASSERT_FALSE(child->renderSurface()); @@ -408,20 +409,20 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForRenderSurfaceHierarchy) // // x component tests that layerTransform and sublayerTransform are done in the right order (translation and scale are noncommutative). // y component has a translation by 1.0 for every ancestor, which indicates the "depth" of the layer in the hierarchy. - TransformationMatrix translationToAnchor; + WebTransformationMatrix translationToAnchor; translationToAnchor.translate(2.5, 0.0); - TransformationMatrix translationToCenter; + WebTransformationMatrix translationToCenter; translationToCenter.translate(5.0, 5.0); - TransformationMatrix layerTransform; + WebTransformationMatrix layerTransform; layerTransform.translate(1.0, 1.0); - TransformationMatrix sublayerTransform; + WebTransformationMatrix sublayerTransform; sublayerTransform.scale3d(10.0, 1.0, 1.0); - TransformationMatrix replicaLayerTransform; + WebTransformationMatrix replicaLayerTransform; replicaLayerTransform.scale3d(-2.0, 5.0, 1.0); - TransformationMatrix A = translationToAnchor * layerTransform * translationToAnchor.inverse(); - TransformationMatrix B = translationToCenter * sublayerTransform * translationToCenter.inverse(); - TransformationMatrix R = A * translationToAnchor * replicaLayerTransform * translationToAnchor.inverse(); + WebTransformationMatrix A = translationToAnchor * layerTransform * translationToAnchor.inverse(); + WebTransformationMatrix B = translationToCenter * sublayerTransform * translationToCenter.inverse(); + WebTransformationMatrix R = A * translationToAnchor * replicaLayerTransform * translationToAnchor.inverse(); setLayerPropertiesForTesting(parent.get(), layerTransform, sublayerTransform, FloatPoint(0.25f, 0.0f), FloatPoint(2.5f, 0.0f), IntSize(10, 10), false); setLayerPropertiesForTesting(renderSurface1.get(), layerTransform, sublayerTransform, FloatPoint(0.25f, 0.0f), FloatPoint(2.5f, 0.0f), IntSize(10, 10), false); @@ -531,7 +532,7 @@ TEST(CCLayerTreeHostCommonTest, verifyRenderSurfaceListForClipLayer) RefPtr<LayerChromiumWithForcedDrawsContent> child = adoptRef(new LayerChromiumWithForcedDrawsContent()); renderSurface1->setOpacity(0.9f); - const TransformationMatrix identityMatrix; + const WebTransformationMatrix identityMatrix; setLayerPropertiesForTesting(renderSurface1.get(), identityMatrix, identityMatrix, FloatPoint::zero(), FloatPoint::zero(), IntSize(10, 10), false); setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, FloatPoint::zero(), FloatPoint(30, 30), IntSize(10, 10), false); @@ -560,7 +561,7 @@ TEST(CCLayerTreeHostCommonTest, verifyRenderSurfaceListForTransparentChild) RefPtr<LayerChromiumWithForcedDrawsContent> child = adoptRef(new LayerChromiumWithForcedDrawsContent()); renderSurface1->setOpacity(0); - const TransformationMatrix identityMatrix; + const WebTransformationMatrix identityMatrix; setLayerPropertiesForTesting(renderSurface1.get(), identityMatrix, identityMatrix, FloatPoint::zero(), FloatPoint::zero(), IntSize(10, 10), false); setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, FloatPoint::zero(), FloatPoint::zero(), IntSize(10, 10), false); @@ -588,7 +589,7 @@ TEST(CCLayerTreeHostCommonTest, verifyForceRenderSurface) RefPtr<LayerChromiumWithForcedDrawsContent> child = adoptRef(new LayerChromiumWithForcedDrawsContent()); renderSurface1->setForceRenderSurface(true); - const TransformationMatrix identityMatrix; + const WebTransformationMatrix identityMatrix; setLayerPropertiesForTesting(renderSurface1.get(), identityMatrix, identityMatrix, FloatPoint::zero(), FloatPoint::zero(), IntSize(10, 10), false); setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, FloatPoint::zero(), FloatPoint::zero(), IntSize(10, 10), false); @@ -628,7 +629,7 @@ TEST(CCLayerTreeHostCommonTest, verifyClipRectCullsRenderSurfaces) // clipRect, and they should never get scheduled on the list of renderSurfaces. // - const TransformationMatrix identityMatrix; + const WebTransformationMatrix identityMatrix; RefPtr<LayerChromium> parent = LayerChromium::create(); RefPtr<LayerChromium> child = LayerChromium::create(); RefPtr<LayerChromium> grandChild = LayerChromium::create(); @@ -677,7 +678,7 @@ TEST(CCLayerTreeHostCommonTest, verifyClipRectCullsRenderSurfacesCrashRepro) // This is a similar situation as verifyClipRectCullsRenderSurfaces, except that // it reproduces a crash bug http://code.google.com/p/chromium/issues/detail?id=106734. - const TransformationMatrix identityMatrix; + const WebTransformationMatrix identityMatrix; RefPtr<LayerChromium> parent = LayerChromium::create(); RefPtr<LayerChromium> child = LayerChromium::create(); RefPtr<LayerChromium> grandChild = LayerChromium::create(); @@ -749,7 +750,7 @@ TEST(CCLayerTreeHostCommonTest, verifyClipRectCullsSurfaceWithoutVisibleContent) // this clipping should be avoided and we should keep the grandChild // in the renderSurfaceLayerList. - const TransformationMatrix identityMatrix; + const WebTransformationMatrix identityMatrix; RefPtr<LayerChromium> parent = LayerChromium::create(); RefPtr<LayerChromium> child = LayerChromium::create(); RefPtr<LayerChromium> grandChild = LayerChromium::create(); @@ -813,7 +814,7 @@ TEST(CCLayerTreeHostCommonTest, verifyClipRectIsPropagatedCorrectlyToLayers) // grandChild4 - outside parent's clipRect, and masksToBounds; the clipRect should be empty. // - const TransformationMatrix identityMatrix; + const WebTransformationMatrix identityMatrix; RefPtr<LayerChromium> parent = LayerChromium::create(); RefPtr<LayerChromium> child = LayerChromium::create(); RefPtr<LayerChromium> grandChild1 = LayerChromium::create(); @@ -871,7 +872,7 @@ TEST(CCLayerTreeHostCommonTest, verifyClipRectIsPropagatedCorrectlyToSurfaces) // have a clipRect of their own layer bounds, however, if masksToBounds was true. // - const TransformationMatrix identityMatrix; + const WebTransformationMatrix identityMatrix; RefPtr<LayerChromium> parent = LayerChromium::create(); RefPtr<LayerChromium> child = LayerChromium::create(); RefPtr<LayerChromium> grandChild1 = LayerChromium::create(); @@ -972,9 +973,9 @@ TEST(CCLayerTreeHostCommonTest, verifyAnimationsForRenderSurfaceHierarchy) // Also put an animated opacity on a layer without descendants. addOpacityTransitionToController(*grandChildOfRoot->layerAnimationController(), 10, 1, 0, false); - TransformationMatrix layerTransform; + WebTransformationMatrix layerTransform; layerTransform.translate(1.0, 1.0); - TransformationMatrix sublayerTransform; + WebTransformationMatrix sublayerTransform; sublayerTransform.scale3d(10.0, 1.0, 1.0); // In combination with descendantDrawsContent and masksToBounds, an animated transform forces the layer to have a new renderSurface. @@ -1089,7 +1090,7 @@ TEST(CCLayerTreeHostCommonTest, verifyVisibleRectForIdentityTransform) // Test the calculateVisibleRect() function works correctly for identity transforms. IntRect targetSurfaceRect = IntRect(IntPoint(0, 0), IntSize(100, 100)); - TransformationMatrix layerToSurfaceTransform; + WebTransformationMatrix layerToSurfaceTransform; // Case 1: Layer is contained within the surface. IntRect layerContentRect = IntRect(IntPoint(10, 10), IntSize(30, 30)); @@ -1115,7 +1116,7 @@ TEST(CCLayerTreeHostCommonTest, verifyVisibleRectForTranslations) IntRect targetSurfaceRect = IntRect(IntPoint(0, 0), IntSize(100, 100)); IntRect layerContentRect = IntRect(IntPoint(0, 0), IntSize(30, 30)); - TransformationMatrix layerToSurfaceTransform; + WebTransformationMatrix layerToSurfaceTransform; // Case 1: Layer is contained within the surface. layerToSurfaceTransform.makeIdentity(); @@ -1145,7 +1146,7 @@ TEST(CCLayerTreeHostCommonTest, verifyVisibleRectFor2DRotations) IntRect targetSurfaceRect = IntRect(IntPoint(0, 0), IntSize(100, 100)); IntRect layerContentRect = IntRect(IntPoint(0, 0), IntSize(30, 30)); - TransformationMatrix layerToSurfaceTransform; + WebTransformationMatrix layerToSurfaceTransform; // Case 1: Layer is contained within the surface. layerToSurfaceTransform.makeIdentity(); @@ -1192,7 +1193,7 @@ TEST(CCLayerTreeHostCommonTest, verifyVisibleRectFor3dOrthographicTransform) IntRect targetSurfaceRect = IntRect(IntPoint(0, 0), IntSize(100, 100)); IntRect layerContentRect = IntRect(IntPoint(0, 0), IntSize(100, 100)); - TransformationMatrix layerToSurfaceTransform; + WebTransformationMatrix layerToSurfaceTransform; // Case 1: Orthographic projection of a layer rotated about y-axis by 45 degrees, should be fully contained in the renderSurface. layerToSurfaceTransform.makeIdentity(); @@ -1220,7 +1221,7 @@ TEST(CCLayerTreeHostCommonTest, verifyVisibleRectFor3dPerspectiveTransform) IntRect targetSurfaceRect = IntRect(IntPoint(0, 0), IntSize(100, 100)); IntRect layerContentRect = IntRect(IntPoint(-50, -50), IntSize(200, 200)); - TransformationMatrix layerToSurfaceTransform; + WebTransformationMatrix layerToSurfaceTransform; // Case 1: Even though the layer is twice as large as the surface, due to perspective // foreshortening, the layer will fit fully in the surface when its translated @@ -1262,7 +1263,7 @@ TEST(CCLayerTreeHostCommonTest, verifyVisibleRectFor3dOrthographicIsNotClippedBe IntRect targetSurfaceRect = IntRect(IntPoint(0, 0), IntSize(100, 100)); IntRect layerContentRect = IntRect(IntPoint(0, 0), IntSize(100, 100)); - TransformationMatrix layerToSurfaceTransform; + WebTransformationMatrix layerToSurfaceTransform; // This sequence of transforms effectively rotates the layer about the y-axis at the // center of the layer. @@ -1286,7 +1287,7 @@ TEST(CCLayerTreeHostCommonTest, verifyVisibleRectFor3dPerspectiveWhenClippedByW) IntRect targetSurfaceRect = IntRect(IntPoint(-50, -50), IntSize(100, 100)); IntRect layerContentRect = IntRect(IntPoint(-10, -1), IntSize(20, 2)); - TransformationMatrix layerToSurfaceTransform; + WebTransformationMatrix layerToSurfaceTransform; // The layer is positioned so that the right half of the layer should be in front of // the camera, while the other half is behind the surface's projection plane. The @@ -1294,7 +1295,7 @@ TEST(CCLayerTreeHostCommonTest, verifyVisibleRectFor3dPerspectiveWhenClippedByW) // center of the layer. layerToSurfaceTransform.makeIdentity(); layerToSurfaceTransform.applyPerspective(1); - layerToSurfaceTransform.translate3d(-1, 0, 1); + layerToSurfaceTransform.translate3d(-2, 0, 1); layerToSurfaceTransform.rotate3d(0, 45, 0); // Sanity check that this transform does indeed cause w < 0 when applying the @@ -1320,7 +1321,7 @@ TEST(CCLayerTreeHostCommonTest, verifyVisibleRectForPerspectiveUnprojection) // This sequence of transforms causes one corner of the layer to protrude across the w = 0 plane, and should be clipped. IntRect targetSurfaceRect = IntRect(IntPoint(-50, -50), IntSize(100, 100)); IntRect layerContentRect = IntRect(IntPoint(-10, -10), IntSize(20, 20)); - TransformationMatrix layerToSurfaceTransform; + WebTransformationMatrix layerToSurfaceTransform; layerToSurfaceTransform.makeIdentity(); layerToSurfaceTransform.applyPerspective(1); layerToSurfaceTransform.translate3d(0, 0, -5); @@ -1348,7 +1349,7 @@ TEST(CCLayerTreeHostCommonTest, verifyBackFaceCullingWithoutPreserves3d) // that 3d transforms still apply in this case, but they are "flattened" to each // parent layer according to current W3C spec. - const TransformationMatrix identityMatrix; + const WebTransformationMatrix identityMatrix; RefPtr<LayerChromium> parent = LayerChromium::create(); RefPtr<LayerChromiumWithForcedDrawsContent> frontFacingChild = adoptRef(new LayerChromiumWithForcedDrawsContent()); RefPtr<LayerChromiumWithForcedDrawsContent> backFacingChild = adoptRef(new LayerChromiumWithForcedDrawsContent()); @@ -1379,7 +1380,7 @@ TEST(CCLayerTreeHostCommonTest, verifyBackFaceCullingWithoutPreserves3d) frontFacingChildOfBackFacingSurface->setDoubleSided(false); backFacingChildOfBackFacingSurface->setDoubleSided(false); - TransformationMatrix backfaceMatrix; + WebTransformationMatrix backfaceMatrix; backfaceMatrix.translate(50, 50); backfaceMatrix.rotate3d(0, 1, 0, 180); backfaceMatrix.translate(-50, -50); @@ -1446,7 +1447,7 @@ TEST(CCLayerTreeHostCommonTest, verifyBackFaceCullingWithPreserves3d) { // Verify the behavior of back-face culling when preserves-3d transform style is used. - const TransformationMatrix identityMatrix; + const WebTransformationMatrix identityMatrix; RefPtr<LayerChromium> parent = LayerChromium::create(); RefPtr<LayerChromiumWithForcedDrawsContent> frontFacingChild = adoptRef(new LayerChromiumWithForcedDrawsContent()); RefPtr<LayerChromiumWithForcedDrawsContent> backFacingChild = adoptRef(new LayerChromiumWithForcedDrawsContent()); @@ -1479,7 +1480,7 @@ TEST(CCLayerTreeHostCommonTest, verifyBackFaceCullingWithPreserves3d) frontFacingChildOfBackFacingSurface->setDoubleSided(false); backFacingChildOfBackFacingSurface->setDoubleSided(false); - TransformationMatrix backfaceMatrix; + WebTransformationMatrix backfaceMatrix; backfaceMatrix.translate(50, 50); backfaceMatrix.rotate3d(0, 1, 0, 180); backfaceMatrix.translate(-50, -50); @@ -1549,7 +1550,7 @@ TEST(CCLayerTreeHostCommonTest, verifyBackFaceCullingWithAnimatingTransforms) // treated as "unknown" so we can not be sure that their back face is really showing. // - const TransformationMatrix identityMatrix; + const WebTransformationMatrix identityMatrix; RefPtr<LayerChromium> parent = LayerChromium::create(); RefPtr<LayerChromiumWithForcedDrawsContent> child = adoptRef(new LayerChromiumWithForcedDrawsContent()); RefPtr<LayerChromiumWithForcedDrawsContent> animatingSurface = adoptRef(new LayerChromiumWithForcedDrawsContent()); @@ -1571,7 +1572,7 @@ TEST(CCLayerTreeHostCommonTest, verifyBackFaceCullingWithAnimatingTransforms) childOfAnimatingSurface->setDoubleSided(false); animatingChild->setDoubleSided(false); - TransformationMatrix backfaceMatrix; + WebTransformationMatrix backfaceMatrix; backfaceMatrix.translate(50, 50); backfaceMatrix.rotate3d(0, 1, 0, 180); backfaceMatrix.translate(-50, -50); @@ -1634,7 +1635,7 @@ TEST(CCLayerTreeHostCommonTest, verifyBackFaceCullingWithPreserves3dForFlattenin // Verify the behavior of back-face culling for a renderSurface that is created // when it flattens its subtree, and its parent has preserves-3d. - const TransformationMatrix identityMatrix; + const WebTransformationMatrix identityMatrix; RefPtr<LayerChromium> parent = LayerChromium::create(); RefPtr<LayerChromiumWithForcedDrawsContent> frontFacingSurface = adoptRef(new LayerChromiumWithForcedDrawsContent()); RefPtr<LayerChromiumWithForcedDrawsContent> backFacingSurface = adoptRef(new LayerChromiumWithForcedDrawsContent()); @@ -1651,7 +1652,7 @@ TEST(CCLayerTreeHostCommonTest, verifyBackFaceCullingWithPreserves3dForFlattenin frontFacingSurface->setDoubleSided(false); backFacingSurface->setDoubleSided(false); - TransformationMatrix backfaceMatrix; + WebTransformationMatrix backfaceMatrix; backfaceMatrix.translate(50, 50); backfaceMatrix.rotate3d(0, 1, 0, 180); backfaceMatrix.translate(-50, -50); diff --git a/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp b/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp index 1275ec854..b996006ae 100644 --- a/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp +++ b/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp @@ -32,6 +32,7 @@ #include "CCTiledLayerTestCommon.h" #include "CompositorFakeWebGraphicsContext3D.h" #include "ContentLayerChromium.h" +#include "FakeWebGraphicsContext3D.h" #include "GraphicsContext3DPrivate.h" #include "LayerChromium.h" #include "TextureManager.h" @@ -43,6 +44,7 @@ #include "cc/CCLayerImpl.h" #include "cc/CCLayerTreeHostImpl.h" #include "cc/CCScopedThreadProxy.h" +#include "cc/CCSingleThreadProxy.h" #include "cc/CCTextureUpdater.h" #include "cc/CCThreadTask.h" #include "cc/CCTimingFunction.h" @@ -71,6 +73,52 @@ using namespace WTF; namespace { +class CompositorFakeWebGraphicsContext3DWithTextureTracking : public CompositorFakeWebGraphicsContext3D { +public: + static PassOwnPtr<CompositorFakeWebGraphicsContext3DWithTextureTracking> create(Attributes attrs) + { + return adoptPtr(new CompositorFakeWebGraphicsContext3DWithTextureTracking(attrs)); + } + + virtual WebGLId createTexture() + { + WebGLId texture = m_textures.size() + 1; + m_textures.append(texture); + return texture; + } + + virtual void deleteTexture(WebGLId texture) + { + for (size_t i = 0; i < m_textures.size(); i++) { + if (m_textures[i] == texture) { + m_textures.remove(i); + break; + } + } + } + + virtual void bindTexture(WGC3Denum /* target */, WebGLId texture) + { + m_usedTextures.add(texture); + } + + int numTextures() const { return static_cast<int>(m_textures.size()); } + int texture(int i) const { return m_textures[i]; } + void resetTextures() { m_textures.clear(); } + + int numUsedTextures() const { return static_cast<int>(m_usedTextures.size()); } + bool usedTexture(int texture) const { return m_usedTextures.find(texture) != m_usedTextures.end(); } + void resetUsedTextures() { m_usedTextures.clear(); } + +private: + explicit CompositorFakeWebGraphicsContext3DWithTextureTracking(Attributes attrs) : CompositorFakeWebGraphicsContext3D(attrs) + { + } + + Vector<WebGLId> m_textures; + HashSet<WebGLId, DefaultHash<WebGLId>::Hash, UnsignedWithZeroKeyHashTraits<WebGLId> > m_usedTextures; +}; + // Used by test stubs to notify the test when something interesting happens. class TestHooks : public CCLayerAnimationDelegate { public: @@ -83,7 +131,7 @@ public: virtual void applyScrollAndScale(const IntSize&, float) { } virtual void updateAnimations(double monotonicTime) { } virtual void layout() { } - virtual void didRecreateContext(bool succeded) { } + virtual void didRecreateContext(bool succeeded) { } virtual void didCommit() { } virtual void didCommitAndDrawFrame() { } virtual void scheduleComposite() { } @@ -91,6 +139,16 @@ public: // Implementation of CCLayerAnimationDelegate virtual void notifyAnimationStarted(double time) { } virtual void notifyAnimationFinished(double time) { } + + virtual PassRefPtr<GraphicsContext3D> createContext() + { + GraphicsContext3D::Attributes attrs; + WebGraphicsContext3D::Attributes webAttrs; + webAttrs.alpha = attrs.alpha; + + OwnPtr<WebGraphicsContext3D> webContext = CompositorFakeWebGraphicsContext3DWithTextureTracking::create(webAttrs); + return GraphicsContext3DPrivate::createGraphicsContextFromWebContext(webContext.release(), GraphicsContext3D::RenderDirectlyToHostWindow); + } }; // Adapts CCLayerTreeHostImpl for test. Runs real code, then invokes test hooks. @@ -206,52 +264,6 @@ private: bool m_didAddAnimationWasCalled; }; -class CompositorFakeWebGraphicsContext3DWithTextureTracking : public CompositorFakeWebGraphicsContext3D { -public: - static PassOwnPtr<CompositorFakeWebGraphicsContext3DWithTextureTracking> create(Attributes attrs) - { - return adoptPtr(new CompositorFakeWebGraphicsContext3DWithTextureTracking(attrs)); - } - - virtual WebGLId createTexture() - { - WebGLId texture = m_textures.size() + 1; - m_textures.append(texture); - return texture; - } - - virtual void deleteTexture(WebGLId texture) - { - for (size_t i = 0; i < m_textures.size(); i++) { - if (m_textures[i] == texture) { - m_textures.remove(i); - break; - } - } - } - - virtual void bindTexture(WGC3Denum /* target */, WebGLId texture) - { - m_usedTextures.add(texture); - } - - int numTextures() const { return static_cast<int>(m_textures.size()); } - int texture(int i) const { return m_textures[i]; } - void resetTextures() { m_textures.clear(); } - - int numUsedTextures() const { return static_cast<int>(m_usedTextures.size()); } - bool usedTexture(int texture) const { return m_usedTextures.find(texture) != m_usedTextures.end(); } - void resetUsedTextures() { m_usedTextures.clear(); } - -private: - explicit CompositorFakeWebGraphicsContext3DWithTextureTracking(Attributes attrs) : CompositorFakeWebGraphicsContext3D(attrs) - { - } - - Vector<WebGLId> m_textures; - HashSet<WebGLId, DefaultHash<WebGLId>::Hash, UnsignedWithZeroKeyHashTraits<WebGLId> > m_usedTextures; -}; - // Implementation of CCLayerTreeHost callback interface. class MockLayerTreeHostClient : public CCLayerTreeHostClient { public: @@ -285,12 +297,7 @@ public: virtual PassRefPtr<GraphicsContext3D> createContext() OVERRIDE { - GraphicsContext3D::Attributes attrs; - WebGraphicsContext3D::Attributes webAttrs; - webAttrs.alpha = attrs.alpha; - - OwnPtr<WebGraphicsContext3D> webContext = CompositorFakeWebGraphicsContext3DWithTextureTracking::create(webAttrs); - return GraphicsContext3DPrivate::createGraphicsContextFromWebContext(webContext.release(), GraphicsContext3D::RenderDirectlyToHostWindow); + return m_testHooks->createContext(); } virtual void willCommit() OVERRIDE @@ -343,6 +350,7 @@ public: virtual void beginTest() = 0; void endTest(); + void endTestAfterDelay(int delayMilliseconds); void postSetNeedsAnimateToMainThread() { @@ -395,6 +403,11 @@ public: m_timeoutTask = 0; } + void clearEndTestTask() + { + m_endTestTask = 0; + } + CCLayerTreeHost* layerTreeHost() { return m_layerTreeHost.get(); } @@ -406,6 +419,7 @@ protected: , m_finished(false) , m_scheduled(false) , m_started(false) + , m_endTestTask(0) { } void doBeginTest(); @@ -597,6 +611,34 @@ protected: CCLayerTreeHostTest* m_test; }; + class EndTestTask : public WebThread::Task { + public: + explicit EndTestTask(CCLayerTreeHostTest* test) + : m_test(test) + { + } + + virtual ~EndTestTask() + { + if (m_test) + m_test->clearEndTestTask(); + } + + void clearTest() + { + m_test = 0; + } + + virtual void run() + { + if (m_test) + m_test->endTest(); + } + + private: + CCLayerTreeHostTest* m_test; + }; + virtual void runTest(bool threaded) { if (threaded) { @@ -621,6 +663,9 @@ protected: if (m_timeoutTask) m_timeoutTask->clearTest(); + if (m_endTestTask) + m_endTestTask->clearTest(); + ASSERT_FALSE(m_layerTreeHost.get()); m_client.clear(); if (m_timedOut) { @@ -648,6 +693,7 @@ private: RefPtr<CCScopedThreadProxy> m_mainThreadProxy; TimeoutTask* m_timeoutTask; BeginTask* m_beginTask; + EndTestTask* m_endTestTask; }; void CCLayerTreeHostTest::doBeginTest() @@ -686,6 +732,17 @@ void CCLayerTreeHostTest::endTest() } } +void CCLayerTreeHostTest::endTestAfterDelay(int delayMilliseconds) +{ + // If we are called from the CCThread, re-call endTest on the main thread. + if (!isMainThread()) + m_mainThreadProxy->postTask(createCCThreadTask(this, &CCLayerTreeHostTest::endTestAfterDelay, delayMilliseconds)); + else { + m_endTestTask = new EndTestTask(this); + WebKit::Platform::current()->currentThread()->postDelayedTask(m_endTestTask, delayMilliseconds); + } +} + class CCLayerTreeHostTestThreadOnly : public CCLayerTreeHostTest { public: void runTestThreaded() @@ -1389,6 +1446,56 @@ private: SINGLE_AND_MULTI_THREAD_TEST_F(CCLayerTreeHostTestSynchronizeAnimationStartTimes) +class FakeWebGraphicsContext3DMakeCurrentFails : public FakeWebGraphicsContext3D { +public: + virtual bool makeContextCurrent() { return false; } +}; + +// Ensures that we do not animate +class CCLayerTreeHostTestInitializeLayerRendererFailsAfterAddAnimation : public CCLayerTreeHostTest { +public: + CCLayerTreeHostTestInitializeLayerRendererFailsAfterAddAnimation() + { + } + + virtual void beginTest() + { + // This will cause the animation timer to be set which will fire in + // CCSingleThreadProxy::animationTimerDelay() seconds. + postAddAnimationToMainThread(); + } + + virtual void animateLayers(CCLayerTreeHostImpl* layerTreeHostImpl, double monotonicTime) + { + ASSERT_NOT_REACHED(); + } + + virtual void didRecreateContext(bool succeeded) + { + EXPECT_FALSE(succeeded); + + // Make sure we wait CCSingleThreadProxy::animationTimerDelay() seconds + // (use ceil just to be sure). If the timer was not disabled, we will + // attempt to call CCSingleThreadProxy::compositeImmediately and the + // test will fail. + endTestAfterDelay(ceil(CCSingleThreadProxy::animationTimerDelay() * 1000)); + } + + virtual PassRefPtr<GraphicsContext3D> createContext() OVERRIDE + { + return GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new FakeWebGraphicsContext3DMakeCurrentFails), GraphicsContext3D::RenderDirectlyToHostWindow); + } + + virtual void afterTest() + { + } +}; + +TEST_F(CCLayerTreeHostTestInitializeLayerRendererFailsAfterAddAnimation, runSingleThread) +{ + runTest(false); +} + // Ensures that main thread animations have their start times synchronized with impl thread animations. class CCLayerTreeHostTestAnimationFinishedEvents : public CCLayerTreeHostTestThreadOnly { public: @@ -1985,21 +2092,21 @@ public: // The root render surface is the size of the viewport. EXPECT_EQ_RECT(IntRect(0, 0, 60, 60), root->renderSurface()->contentRect()); - TransformationMatrix scaleTransform; + WebTransformationMatrix scaleTransform; scaleTransform.scale(impl->settings().deviceScaleFactor); // The root layer is scaled by 2x. - TransformationMatrix rootScreenSpaceTransform = scaleTransform; - TransformationMatrix rootDrawTransform = scaleTransform; + WebTransformationMatrix rootScreenSpaceTransform = scaleTransform; + WebTransformationMatrix rootDrawTransform = scaleTransform; rootDrawTransform.translate(root->bounds().width() * 0.5, root->bounds().height() * 0.5); EXPECT_EQ(rootDrawTransform, root->drawTransform()); EXPECT_EQ(rootScreenSpaceTransform, root->screenSpaceTransform()); // The child is at position 2,2, so translate by 2,2 before applying the scale by 2x. - TransformationMatrix childScreenSpaceTransform = scaleTransform; + WebTransformationMatrix childScreenSpaceTransform = scaleTransform; childScreenSpaceTransform.translate(2, 2); - TransformationMatrix childDrawTransform = scaleTransform; + WebTransformationMatrix childDrawTransform = scaleTransform; childDrawTransform.translate(2, 2); childDrawTransform.translate(child->bounds().width() * 0.5, child->bounds().height() * 0.5); @@ -2113,7 +2220,7 @@ TEST_F(CCLayerTreeHostTestAtomicCommit, runMultiThread) runTest(true); } -static void setLayerPropertiesForTesting(LayerChromium* layer, LayerChromium* parent, const TransformationMatrix& transform, const FloatPoint& anchor, const FloatPoint& position, const IntSize& bounds, bool opaque) +static void setLayerPropertiesForTesting(LayerChromium* layer, LayerChromium* parent, const WebTransformationMatrix& transform, const FloatPoint& anchor, const FloatPoint& position, const IntSize& bounds, bool opaque) { layer->removeAllChildren(); if (parent) @@ -2141,7 +2248,7 @@ public: m_layerTreeHost->setRootLayer(m_parent); m_layerTreeHost->setViewportSize(IntSize(10, 20)); - TransformationMatrix identityMatrix; + WebTransformationMatrix identityMatrix; setLayerPropertiesForTesting(m_parent.get(), 0, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(10, 20), true); setLayerPropertiesForTesting(m_child.get(), m_parent.get(), identityMatrix, FloatPoint(0, 0), FloatPoint(0, 10), IntSize(10, 10), false); @@ -2301,7 +2408,7 @@ private: Region m_occludedScreenSpace; }; -static void setTestLayerPropertiesForTesting(TestLayerChromium* layer, LayerChromium* parent, const TransformationMatrix& transform, const FloatPoint& anchor, const FloatPoint& position, const IntSize& bounds, bool opaque) +static void setTestLayerPropertiesForTesting(TestLayerChromium* layer, LayerChromium* parent, const WebTransformationMatrix& transform, const FloatPoint& anchor, const FloatPoint& position, const IntSize& bounds, bool opaque) { setLayerPropertiesForTesting(layer, parent, transform, anchor, position, bounds, opaque); layer->clearOccludedScreenSpace(); @@ -2319,8 +2426,8 @@ public: RefPtr<TestLayerChromium> grandChild = TestLayerChromium::create(); RefPtr<TestLayerChromium> mask = TestLayerChromium::create(); - TransformationMatrix identityMatrix; - TransformationMatrix childTransform; + WebTransformationMatrix identityMatrix; + WebTransformationMatrix childTransform; childTransform.translate(250, 250); childTransform.rotate(90); childTransform.translate(-250, -250); @@ -2521,8 +2628,8 @@ public: RefPtr<TestLayerChromium> grandChild = TestLayerChromium::create(); RefPtr<TestLayerChromium> mask = TestLayerChromium::create(); - TransformationMatrix identityMatrix; - TransformationMatrix childTransform; + WebTransformationMatrix identityMatrix; + WebTransformationMatrix childTransform; childTransform.translate(250, 250); childTransform.rotate(90); childTransform.translate(-250, -250); @@ -2607,7 +2714,7 @@ public: { // We create enough RenderSurfaces that it will trigger Vector reallocation while computing occlusion. Region occluded; - const TransformationMatrix identityMatrix; + const WebTransformationMatrix identityMatrix; Vector<RefPtr<TestLayerChromium> > layers; Vector<RefPtr<TestLayerChromium> > children; int numSurfaces = 20; diff --git a/Source/WebKit/chromium/tests/CCLayerTreeTestCommon.h b/Source/WebKit/chromium/tests/CCLayerTreeTestCommon.h index 75e487a4a..5c01c8049 100644 --- a/Source/WebKit/chromium/tests/CCLayerTreeTestCommon.h +++ b/Source/WebKit/chromium/tests/CCLayerTreeTestCommon.h @@ -41,7 +41,7 @@ namespace WebKitTests { EXPECT_EQ((expected).size().height(), (actual).size().height()) // This is a macro instead of a function so that we get useful line numbers where a test failed. -// Even though TransformationMatrix values are double precision, there are many other floating-point values used that affect +// Even though WebTransformationMatrix values are double precision, there are many other floating-point values used that affect // the transforms, and so we only expect them to be accurate up to floating-point precision. #define EXPECT_TRANSFORMATION_MATRIX_EQ(expected, actual) \ EXPECT_FLOAT_EQ((expected).m11(), (actual).m11()); \ diff --git a/Source/WebKit/chromium/tests/CCMathUtilTest.cpp b/Source/WebKit/chromium/tests/CCMathUtilTest.cpp index 3909677a5..44a68b9eb 100644 --- a/Source/WebKit/chromium/tests/CCMathUtilTest.cpp +++ b/Source/WebKit/chromium/tests/CCMathUtilTest.cpp @@ -26,18 +26,20 @@ #include "cc/CCMathUtil.h" -#include "TransformationMatrix.h" - +#include "CCLayerTreeTestCommon.h" +#include "FloatRect.h" #include <gmock/gmock.h> #include <gtest/gtest.h> +#include <public/WebTransformationMatrix.h> using namespace WebCore; +using WebKit::WebTransformationMatrix; namespace { TEST(CCMathUtilTest, verifyBackfaceVisibilityBasicCases) { - TransformationMatrix transform; + WebTransformationMatrix transform; transform.makeIdentity(); EXPECT_FALSE(transform.isBackFaceVisible()); @@ -58,7 +60,7 @@ TEST(CCMathUtilTest, verifyBackfaceVisibilityBasicCases) TEST(CCMathUtilTest, verifyBackfaceVisibilityForPerspective) { - TransformationMatrix layerSpaceToProjectionPlane; + WebTransformationMatrix layerSpaceToProjectionPlane; // This tests if isBackFaceVisible works properly under perspective transforms. // Specifically, layers that may have their back face visible in orthographic @@ -104,7 +106,7 @@ TEST(CCMathUtilTest, verifyProjectionOfPerpendicularPlane) // In this case, the m33() element of the transform becomes zero, which could cause a // divide-by-zero when projecting points/quads. - TransformationMatrix transform; + WebTransformationMatrix transform; transform.makeIdentity(); transform.setM33(0); @@ -116,4 +118,38 @@ TEST(CCMathUtilTest, verifyProjectionOfPerpendicularPlane) EXPECT_TRUE(projectedRect.isEmpty()); } +TEST(CCMathUtilTest, verifyEnclosingClippedRectUsesCorrectInitialBounds) +{ + HomogeneousCoordinate h1(-100, -100, 0, 1); + HomogeneousCoordinate h2(-10, -10, 0, 1); + HomogeneousCoordinate h3(10, 10, 0, -1); + HomogeneousCoordinate h4(100, 100, 0, -1); + + // The bounds of the enclosing clipped rect should be -100 to -10 for both x and y. + // However, if there is a bug where the initial xmin/xmax/ymin/ymax are initialized to + // numeric_limits<float>::min() (which is zero, not -flt_max) then the enclosing + // clipped rect will be computed incorrectly. + FloatRect result = CCMathUtil::computeEnclosingClippedRect(h1, h2, h3, h4); + + EXPECT_FLOAT_RECT_EQ(FloatRect(FloatPoint(-100, -100), FloatSize(90, 90)), result); +} + +TEST(CCMathUtilTest, verifyEnclosingRectOfVerticesUsesCorrectInitialBounds) +{ + FloatPoint vertices[3]; + int numVertices = 3; + + vertices[0] = FloatPoint(-10, -100); + vertices[1] = FloatPoint(-100, -10); + vertices[2] = FloatPoint(-30, -30); + + // The bounds of the enclosing rect should be -100 to -10 for both x and y. However, + // if there is a bug where the initial xmin/xmax/ymin/ymax are initialized to + // numeric_limits<float>::min() (which is zero, not -flt_max) then the enclosing + // clipped rect will be computed incorrectly. + FloatRect result = CCMathUtil::computeEnclosingRectOfVertices(vertices, numVertices); + + EXPECT_FLOAT_RECT_EQ(FloatRect(FloatPoint(-100, -100), FloatSize(90, 90)), result); +} + } // namespace diff --git a/Source/WebKit/chromium/tests/CCOcclusionTrackerTest.cpp b/Source/WebKit/chromium/tests/CCOcclusionTrackerTest.cpp index 976dc3f29..80317a008 100644 --- a/Source/WebKit/chromium/tests/CCOcclusionTrackerTest.cpp +++ b/Source/WebKit/chromium/tests/CCOcclusionTrackerTest.cpp @@ -27,30 +27,26 @@ #include "cc/CCOcclusionTracker.h" #include "CCAnimationTestCommon.h" +#include "CCLayerTreeTestCommon.h" #include "CCOcclusionTrackerTestCommon.h" #include "LayerChromium.h" #include "Region.h" -#include "TransformationMatrix.h" #include "TranslateTransformOperation.h" #include "cc/CCLayerAnimationController.h" #include "cc/CCLayerImpl.h" #include "cc/CCLayerTreeHostCommon.h" +#include "cc/CCMathUtil.h" #include "cc/CCSingleThreadProxy.h" #include <gmock/gmock.h> #include <gtest/gtest.h> #include <public/WebFilterOperation.h> #include <public/WebFilterOperations.h> +#include <public/WebTransformationMatrix.h> using namespace WebCore; using namespace WebKit; using namespace WebKitTests; -#define EXPECT_EQ_RECT(a, b) \ - EXPECT_EQ(a.x(), b.x()); \ - EXPECT_EQ(a.y(), b.y()); \ - EXPECT_EQ(a.width(), b.width()); \ - EXPECT_EQ(a.height(), b.height()); - namespace { class TestContentLayerChromium : public LayerChromium { @@ -177,7 +173,7 @@ protected: CCLayerTreeHost::setNeedsFilterContext(false); } - typename Types::ContentLayerType* createRoot(const TransformationMatrix& transform, const FloatPoint& position, const IntSize& bounds) + typename Types::ContentLayerType* createRoot(const WebTransformationMatrix& transform, const FloatPoint& position, const IntSize& bounds) { typename Types::ContentLayerPtrType layer(Types::createContentLayer()); typename Types::ContentLayerType* layerPtr = layer.get(); @@ -188,7 +184,7 @@ protected: return layerPtr; } - typename Types::LayerType* createLayer(typename Types::LayerType* parent, const TransformationMatrix& transform, const FloatPoint& position, const IntSize& bounds) + typename Types::LayerType* createLayer(typename Types::LayerType* parent, const WebTransformationMatrix& transform, const FloatPoint& position, const IntSize& bounds) { typename Types::LayerPtrType layer(Types::createLayer()); typename Types::LayerType* layerPtr = layer.get(); @@ -197,7 +193,7 @@ protected: return layerPtr; } - typename Types::LayerType* createSurface(typename Types::LayerType* parent, const TransformationMatrix& transform, const FloatPoint& position, const IntSize& bounds) + typename Types::LayerType* createSurface(typename Types::LayerType* parent, const WebTransformationMatrix& transform, const FloatPoint& position, const IntSize& bounds) { typename Types::LayerType* layer = createLayer(parent, transform, position, bounds); WebFilterOperations filters; @@ -206,7 +202,7 @@ protected: return layer; } - typename Types::ContentLayerType* createDrawingLayer(typename Types::LayerType* parent, const TransformationMatrix& transform, const FloatPoint& position, const IntSize& bounds, bool opaque) + typename Types::ContentLayerType* createDrawingLayer(typename Types::LayerType* parent, const WebTransformationMatrix& transform, const FloatPoint& position, const IntSize& bounds, bool opaque) { typename Types::ContentLayerPtrType layer(Types::createContentLayer()); typename Types::ContentLayerType* layerPtr = layer.get(); @@ -226,7 +222,7 @@ protected: return layerPtr; } - typename Types::LayerType* createReplicaLayer(typename Types::LayerType* owningLayer, const TransformationMatrix& transform, const FloatPoint& position, const IntSize& bounds) + typename Types::LayerType* createReplicaLayer(typename Types::LayerType* owningLayer, const WebTransformationMatrix& transform, const FloatPoint& position, const IntSize& bounds) { typename Types::ContentLayerPtrType layer(Types::createContentLayer()); typename Types::ContentLayerType* layerPtr = layer.get(); @@ -244,7 +240,7 @@ protected: return layerPtr; } - typename Types::ContentLayerType* createDrawingSurface(typename Types::LayerType* parent, const TransformationMatrix& transform, const FloatPoint& position, const IntSize& bounds, bool opaque) + typename Types::ContentLayerType* createDrawingSurface(typename Types::LayerType* parent, const WebTransformationMatrix& transform, const FloatPoint& position, const IntSize& bounds, bool opaque) { typename Types::ContentLayerType* layer = createDrawingLayer(parent, transform, position, bounds, opaque); WebFilterOperations filters; @@ -336,24 +332,24 @@ protected: m_layerIterator = m_layerIteratorBegin; } - const TransformationMatrix identityMatrix; + const WebTransformationMatrix identityMatrix; private: - void setBaseProperties(typename Types::LayerType* layer, const TransformationMatrix& transform, const FloatPoint& position, const IntSize& bounds) + void setBaseProperties(typename Types::LayerType* layer, const WebTransformationMatrix& transform, const FloatPoint& position, const IntSize& bounds) { layer->setTransform(transform); - layer->setSublayerTransform(TransformationMatrix()); + layer->setSublayerTransform(WebTransformationMatrix()); layer->setAnchorPoint(FloatPoint(0, 0)); layer->setPosition(position); layer->setBounds(bounds); } - void setProperties(LayerChromium* layer, const TransformationMatrix& transform, const FloatPoint& position, const IntSize& bounds) + void setProperties(LayerChromium* layer, const WebTransformationMatrix& transform, const FloatPoint& position, const IntSize& bounds) { setBaseProperties(layer, transform, position, bounds); } - void setProperties(CCLayerImpl* layer, const TransformationMatrix& transform, const FloatPoint& position, const IntSize& bounds) + void setProperties(CCLayerImpl* layer, const WebTransformationMatrix& transform, const FloatPoint& position, const IntSize& bounds) { setBaseProperties(layer, transform, position, bounds); @@ -449,9 +445,9 @@ protected: this->visitLayer(layer, occlusion); this->enterLayer(parent, occlusion); - EXPECT_EQ_RECT(IntRect(30, 30, 70, 70), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(30, 30, 70, 70), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); EXPECT_TRUE(occlusion.occluded(parent, IntRect(30, 30, 70, 70))); @@ -469,14 +465,14 @@ protected: occlusion.setLayerScissorRect(IntRect(0, 0, 1000, 1000)); EXPECT_TRUE(occlusion.unoccludedContentRect(parent, IntRect(30, 30, 70, 70)).isEmpty()); - EXPECT_EQ_RECT(IntRect(29, 30, 1, 70), occlusion.unoccludedContentRect(parent, IntRect(29, 30, 70, 70))); - EXPECT_EQ_RECT(IntRect(29, 29, 70, 70), occlusion.unoccludedContentRect(parent, IntRect(29, 29, 70, 70))); - EXPECT_EQ_RECT(IntRect(30, 29, 70, 1), occlusion.unoccludedContentRect(parent, IntRect(30, 29, 70, 70))); - EXPECT_EQ_RECT(IntRect(31, 29, 70, 70), occlusion.unoccludedContentRect(parent, IntRect(31, 29, 70, 70))); - EXPECT_EQ_RECT(IntRect(100, 30, 1, 70), occlusion.unoccludedContentRect(parent, IntRect(31, 30, 70, 70))); - EXPECT_EQ_RECT(IntRect(31, 31, 70, 70), occlusion.unoccludedContentRect(parent, IntRect(31, 31, 70, 70))); - EXPECT_EQ_RECT(IntRect(30, 100, 70, 1), occlusion.unoccludedContentRect(parent, IntRect(30, 31, 70, 70))); - EXPECT_EQ_RECT(IntRect(29, 31, 70, 70), occlusion.unoccludedContentRect(parent, IntRect(29, 31, 70, 70))); + EXPECT_INT_RECT_EQ(IntRect(29, 30, 1, 70), occlusion.unoccludedContentRect(parent, IntRect(29, 30, 70, 70))); + EXPECT_INT_RECT_EQ(IntRect(29, 29, 70, 70), occlusion.unoccludedContentRect(parent, IntRect(29, 29, 70, 70))); + EXPECT_INT_RECT_EQ(IntRect(30, 29, 70, 1), occlusion.unoccludedContentRect(parent, IntRect(30, 29, 70, 70))); + EXPECT_INT_RECT_EQ(IntRect(31, 29, 70, 70), occlusion.unoccludedContentRect(parent, IntRect(31, 29, 70, 70))); + EXPECT_INT_RECT_EQ(IntRect(100, 30, 1, 70), occlusion.unoccludedContentRect(parent, IntRect(31, 30, 70, 70))); + EXPECT_INT_RECT_EQ(IntRect(31, 31, 70, 70), occlusion.unoccludedContentRect(parent, IntRect(31, 31, 70, 70))); + EXPECT_INT_RECT_EQ(IntRect(30, 100, 70, 1), occlusion.unoccludedContentRect(parent, IntRect(30, 31, 70, 70))); + EXPECT_INT_RECT_EQ(IntRect(29, 31, 70, 70), occlusion.unoccludedContentRect(parent, IntRect(29, 31, 70, 70))); } }; @@ -487,7 +483,7 @@ class CCOcclusionTrackerTestRotatedChild : public CCOcclusionTrackerTest<Types, protected: void runMyTest() { - TransformationMatrix layerTransform; + WebTransformationMatrix layerTransform; layerTransform.translate(250, 250); layerTransform.rotate(90); layerTransform.translate(-250, -250); @@ -502,9 +498,9 @@ protected: this->visitLayer(layer, occlusion); this->enterLayer(parent, occlusion); - EXPECT_EQ_RECT(IntRect(30, 30, 70, 70), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(30, 30, 70, 70), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); EXPECT_TRUE(occlusion.occluded(parent, IntRect(30, 30, 70, 70))); @@ -522,14 +518,14 @@ protected: occlusion.setLayerScissorRect(IntRect(0, 0, 1000, 1000)); EXPECT_TRUE(occlusion.unoccludedContentRect(parent, IntRect(30, 30, 70, 70)).isEmpty()); - EXPECT_EQ_RECT(IntRect(29, 30, 1, 70), occlusion.unoccludedContentRect(parent, IntRect(29, 30, 70, 70))); - EXPECT_EQ_RECT(IntRect(29, 29, 70, 70), occlusion.unoccludedContentRect(parent, IntRect(29, 29, 70, 70))); - EXPECT_EQ_RECT(IntRect(30, 29, 70, 1), occlusion.unoccludedContentRect(parent, IntRect(30, 29, 70, 70))); - EXPECT_EQ_RECT(IntRect(31, 29, 70, 70), occlusion.unoccludedContentRect(parent, IntRect(31, 29, 70, 70))); - EXPECT_EQ_RECT(IntRect(100, 30, 1, 70), occlusion.unoccludedContentRect(parent, IntRect(31, 30, 70, 70))); - EXPECT_EQ_RECT(IntRect(31, 31, 70, 70), occlusion.unoccludedContentRect(parent, IntRect(31, 31, 70, 70))); - EXPECT_EQ_RECT(IntRect(30, 100, 70, 1), occlusion.unoccludedContentRect(parent, IntRect(30, 31, 70, 70))); - EXPECT_EQ_RECT(IntRect(29, 31, 70, 70), occlusion.unoccludedContentRect(parent, IntRect(29, 31, 70, 70))); + EXPECT_INT_RECT_EQ(IntRect(29, 30, 1, 70), occlusion.unoccludedContentRect(parent, IntRect(29, 30, 70, 70))); + EXPECT_INT_RECT_EQ(IntRect(29, 29, 70, 70), occlusion.unoccludedContentRect(parent, IntRect(29, 29, 70, 70))); + EXPECT_INT_RECT_EQ(IntRect(30, 29, 70, 1), occlusion.unoccludedContentRect(parent, IntRect(30, 29, 70, 70))); + EXPECT_INT_RECT_EQ(IntRect(31, 29, 70, 70), occlusion.unoccludedContentRect(parent, IntRect(31, 29, 70, 70))); + EXPECT_INT_RECT_EQ(IntRect(100, 30, 1, 70), occlusion.unoccludedContentRect(parent, IntRect(31, 30, 70, 70))); + EXPECT_INT_RECT_EQ(IntRect(31, 31, 70, 70), occlusion.unoccludedContentRect(parent, IntRect(31, 31, 70, 70))); + EXPECT_INT_RECT_EQ(IntRect(30, 100, 70, 1), occlusion.unoccludedContentRect(parent, IntRect(30, 31, 70, 70))); + EXPECT_INT_RECT_EQ(IntRect(29, 31, 70, 70), occlusion.unoccludedContentRect(parent, IntRect(29, 31, 70, 70))); } }; @@ -540,7 +536,7 @@ class CCOcclusionTrackerTestTranslatedChild : public CCOcclusionTrackerTest<Type protected: void runMyTest() { - TransformationMatrix layerTransform; + WebTransformationMatrix layerTransform; layerTransform.translate(20, 20); typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(100, 100)); @@ -553,9 +549,9 @@ protected: this->visitLayer(layer, occlusion); this->enterLayer(parent, occlusion); - EXPECT_EQ_RECT(IntRect(50, 50, 50, 50), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(50, 50, 50, 50), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(50, 50, 50, 50), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(IntRect(50, 50, 50, 50), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); EXPECT_TRUE(occlusion.occluded(parent, IntRect(50, 50, 50, 50))); @@ -573,25 +569,25 @@ protected: occlusion.setLayerScissorRect(IntRect(0, 0, 1000, 1000)); EXPECT_TRUE(occlusion.unoccludedContentRect(parent, IntRect(50, 50, 50, 50)).isEmpty()); - EXPECT_EQ_RECT(IntRect(49, 50, 1, 50), occlusion.unoccludedContentRect(parent, IntRect(49, 50, 50, 50))); - EXPECT_EQ_RECT(IntRect(49, 49, 50, 50), occlusion.unoccludedContentRect(parent, IntRect(49, 49, 50, 50))); - EXPECT_EQ_RECT(IntRect(50, 49, 50, 1), occlusion.unoccludedContentRect(parent, IntRect(50, 49, 50, 50))); - EXPECT_EQ_RECT(IntRect(51, 49, 50, 50), occlusion.unoccludedContentRect(parent, IntRect(51, 49, 50, 50))); - EXPECT_EQ_RECT(IntRect(100, 50, 1, 50), occlusion.unoccludedContentRect(parent, IntRect(51, 50, 50, 50))); - EXPECT_EQ_RECT(IntRect(51, 51, 50, 50), occlusion.unoccludedContentRect(parent, IntRect(51, 51, 50, 50))); - EXPECT_EQ_RECT(IntRect(50, 100, 50, 1), occlusion.unoccludedContentRect(parent, IntRect(50, 51, 50, 50))); - EXPECT_EQ_RECT(IntRect(49, 51, 50, 50), occlusion.unoccludedContentRect(parent, IntRect(49, 51, 50, 50))); + EXPECT_INT_RECT_EQ(IntRect(49, 50, 1, 50), occlusion.unoccludedContentRect(parent, IntRect(49, 50, 50, 50))); + EXPECT_INT_RECT_EQ(IntRect(49, 49, 50, 50), occlusion.unoccludedContentRect(parent, IntRect(49, 49, 50, 50))); + EXPECT_INT_RECT_EQ(IntRect(50, 49, 50, 1), occlusion.unoccludedContentRect(parent, IntRect(50, 49, 50, 50))); + EXPECT_INT_RECT_EQ(IntRect(51, 49, 50, 50), occlusion.unoccludedContentRect(parent, IntRect(51, 49, 50, 50))); + EXPECT_INT_RECT_EQ(IntRect(100, 50, 1, 50), occlusion.unoccludedContentRect(parent, IntRect(51, 50, 50, 50))); + EXPECT_INT_RECT_EQ(IntRect(51, 51, 50, 50), occlusion.unoccludedContentRect(parent, IntRect(51, 51, 50, 50))); + EXPECT_INT_RECT_EQ(IntRect(50, 100, 50, 1), occlusion.unoccludedContentRect(parent, IntRect(50, 51, 50, 50))); + EXPECT_INT_RECT_EQ(IntRect(49, 51, 50, 50), occlusion.unoccludedContentRect(parent, IntRect(49, 51, 50, 50))); occlusion.useDefaultLayerScissorRect(); EXPECT_TRUE(occlusion.unoccludedContentRect(parent, IntRect(50, 50, 50, 50)).isEmpty()); - EXPECT_EQ_RECT(IntRect(49, 50, 1, 50), occlusion.unoccludedContentRect(parent, IntRect(49, 50, 50, 50))); - EXPECT_EQ_RECT(IntRect(49, 49, 50, 50), occlusion.unoccludedContentRect(parent, IntRect(49, 49, 50, 50))); - EXPECT_EQ_RECT(IntRect(50, 49, 50, 1), occlusion.unoccludedContentRect(parent, IntRect(50, 49, 50, 50))); - EXPECT_EQ_RECT(IntRect(51, 49, 49, 1), occlusion.unoccludedContentRect(parent, IntRect(51, 49, 50, 50))); + EXPECT_INT_RECT_EQ(IntRect(49, 50, 1, 50), occlusion.unoccludedContentRect(parent, IntRect(49, 50, 50, 50))); + EXPECT_INT_RECT_EQ(IntRect(49, 49, 50, 50), occlusion.unoccludedContentRect(parent, IntRect(49, 49, 50, 50))); + EXPECT_INT_RECT_EQ(IntRect(50, 49, 50, 1), occlusion.unoccludedContentRect(parent, IntRect(50, 49, 50, 50))); + EXPECT_INT_RECT_EQ(IntRect(51, 49, 49, 1), occlusion.unoccludedContentRect(parent, IntRect(51, 49, 50, 50))); EXPECT_TRUE(occlusion.unoccludedContentRect(parent, IntRect(51, 50, 50, 50)).isEmpty()); EXPECT_TRUE(occlusion.unoccludedContentRect(parent, IntRect(51, 51, 50, 50)).isEmpty()); EXPECT_TRUE(occlusion.unoccludedContentRect(parent, IntRect(50, 51, 50, 50)).isEmpty()); - EXPECT_EQ_RECT(IntRect(49, 51, 1, 49), occlusion.unoccludedContentRect(parent, IntRect(49, 51, 50, 50))); + EXPECT_INT_RECT_EQ(IntRect(49, 51, 1, 49), occlusion.unoccludedContentRect(parent, IntRect(49, 51, 50, 50))); occlusion.setLayerScissorRect(IntRect(0, 0, 1000, 1000)); } }; @@ -603,7 +599,7 @@ class CCOcclusionTrackerTestChildInRotatedChild : public CCOcclusionTrackerTest< protected: void runMyTest() { - TransformationMatrix childTransform; + WebTransformationMatrix childTransform; childTransform.translate(250, 250); childTransform.rotate(90); childTransform.translate(-250, -250); @@ -620,9 +616,9 @@ protected: this->visitLayer(layer, occlusion); this->enterContributingSurface(child, occlusion); - EXPECT_EQ_RECT(IntRect(30, 40, 70, 60), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(30, 40, 70, 60), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(10, 430, 60, 70), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(IntRect(10, 430, 60, 70), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); EXPECT_TRUE(occlusion.occluded(child, IntRect(10, 430, 60, 70))); @@ -642,9 +638,9 @@ protected: this->leaveContributingSurface(child, occlusion); this->enterLayer(parent, occlusion); - EXPECT_EQ_RECT(IntRect(30, 40, 70, 60), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(30, 40, 70, 60), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(30, 40, 70, 60), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(IntRect(30, 40, 70, 60), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); EXPECT_TRUE(occlusion.occluded(parent, IntRect(30, 40, 70, 60))); @@ -696,7 +692,7 @@ class CCOcclusionTrackerTestVisitTargetTwoTimes : public CCOcclusionTrackerTest< protected: void runMyTest() { - TransformationMatrix childTransform; + WebTransformationMatrix childTransform; childTransform.translate(250, 250); childTransform.rotate(90); childTransform.translate(-250, -250); @@ -715,16 +711,16 @@ protected: this->visitLayer(child2, occlusion); - EXPECT_EQ_RECT(IntRect(30, 30, 60, 20), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(30, 30, 60, 20), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(30, 30, 60, 20), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(IntRect(30, 30, 60, 20), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); this->visitLayer(layer, occlusion); - EXPECT_EQ_RECT(IntRect(30, 30, 70, 70), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(2u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(10, 430, 60, 70), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(IntRect(10, 430, 60, 70), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); this->enterContributingSurface(child, occlusion); @@ -745,18 +741,18 @@ protected: EXPECT_TRUE(occlusion.unoccludedContentRect(child, IntRect(10, 430, 60, 70)).isEmpty()); // This is the little piece not occluded by child2 - EXPECT_EQ_RECT(IntRect(9, 430, 1, 10), occlusion.unoccludedContentRect(child, IntRect(9, 430, 60, 70))); + EXPECT_INT_RECT_EQ(IntRect(9, 430, 1, 10), occlusion.unoccludedContentRect(child, IntRect(9, 430, 60, 70))); // This extends past both sides of child2, so it will be the original rect. - EXPECT_EQ_RECT(IntRect(9, 430, 60, 80), occlusion.unoccludedContentRect(child, IntRect(9, 430, 60, 80))); + EXPECT_INT_RECT_EQ(IntRect(9, 430, 60, 80), occlusion.unoccludedContentRect(child, IntRect(9, 430, 60, 80))); // This extends past two adjacent sides of child2, and should included the unoccluded parts of each side. // This also demonstrates that the rect can be arbitrary and does not get clipped to the layer's visibleLayerRect(). - EXPECT_EQ_RECT(IntRect(-10, 430, 20, 70), occlusion.unoccludedContentRect(child, IntRect(-10, 430, 60, 70))); + EXPECT_INT_RECT_EQ(IntRect(-10, 430, 20, 70), occlusion.unoccludedContentRect(child, IntRect(-10, 430, 60, 70))); // This extends past three adjacent sides of child2, so it should contain the unoccluded parts of each side. The left // and bottom edges are completely unoccluded for some row/column so we get back the original query rect. - EXPECT_EQ_RECT(IntRect(-10, 430, 60, 80), occlusion.unoccludedContentRect(child, IntRect(-10, 430, 60, 80))); - EXPECT_EQ_RECT(IntRect(10, 429, 60, 1), occlusion.unoccludedContentRect(child, IntRect(10, 429, 60, 70))); - EXPECT_EQ_RECT(IntRect(70, 430, 1, 70), occlusion.unoccludedContentRect(child, IntRect(11, 430, 60, 70))); - EXPECT_EQ_RECT(IntRect(10, 500, 60, 1), occlusion.unoccludedContentRect(child, IntRect(10, 431, 60, 70))); + EXPECT_INT_RECT_EQ(IntRect(-10, 430, 60, 80), occlusion.unoccludedContentRect(child, IntRect(-10, 430, 60, 80))); + EXPECT_INT_RECT_EQ(IntRect(10, 429, 60, 1), occlusion.unoccludedContentRect(child, IntRect(10, 429, 60, 70))); + EXPECT_INT_RECT_EQ(IntRect(70, 430, 1, 70), occlusion.unoccludedContentRect(child, IntRect(11, 430, 60, 70))); + EXPECT_INT_RECT_EQ(IntRect(10, 500, 60, 1), occlusion.unoccludedContentRect(child, IntRect(10, 431, 60, 70))); occlusion.useDefaultLayerScissorRect(); EXPECT_TRUE(occlusion.unoccludedContentRect(child, IntRect(10, 430, 60, 70)).isEmpty()); @@ -773,13 +769,13 @@ protected: this->leaveContributingSurface(child, occlusion); this->enterLayer(parent, occlusion); - EXPECT_EQ_RECT(IntRect(30, 30, 70, 70), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(2u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(30, 30, 70, 70), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(2u, occlusion.occlusionInTargetSurface().rects().size()); EXPECT_FALSE(occlusion.occluded(parent, IntRect(30, 30, 70, 70))); - EXPECT_EQ_RECT(IntRect(90, 30, 10, 10), occlusion.unoccludedContentRect(parent, IntRect(30, 30, 70, 70))); + EXPECT_INT_RECT_EQ(IntRect(90, 30, 10, 10), occlusion.unoccludedContentRect(parent, IntRect(30, 30, 70, 70))); EXPECT_TRUE(occlusion.occluded(parent, IntRect(30, 30, 60, 10))); EXPECT_FALSE(occlusion.occluded(parent, IntRect(29, 30, 60, 10))); @@ -792,21 +788,21 @@ protected: EXPECT_FALSE(occlusion.occluded(parent, IntRect(30, 39, 70, 60))); EXPECT_TRUE(occlusion.unoccludedContentRect(parent, IntRect(30, 30, 60, 10)).isEmpty()); - EXPECT_EQ_RECT(IntRect(29, 30, 1, 10), occlusion.unoccludedContentRect(parent, IntRect(29, 30, 60, 10))); - EXPECT_EQ_RECT(IntRect(30, 29, 60, 1), occlusion.unoccludedContentRect(parent, IntRect(30, 29, 60, 10))); - EXPECT_EQ_RECT(IntRect(90, 30, 1, 10), occlusion.unoccludedContentRect(parent, IntRect(31, 30, 60, 10))); + EXPECT_INT_RECT_EQ(IntRect(29, 30, 1, 10), occlusion.unoccludedContentRect(parent, IntRect(29, 30, 60, 10))); + EXPECT_INT_RECT_EQ(IntRect(30, 29, 60, 1), occlusion.unoccludedContentRect(parent, IntRect(30, 29, 60, 10))); + EXPECT_INT_RECT_EQ(IntRect(90, 30, 1, 10), occlusion.unoccludedContentRect(parent, IntRect(31, 30, 60, 10))); EXPECT_TRUE(occlusion.unoccludedContentRect(parent, IntRect(30, 31, 60, 10)).isEmpty()); EXPECT_TRUE(occlusion.unoccludedContentRect(parent, IntRect(30, 40, 70, 60)).isEmpty()); - EXPECT_EQ_RECT(IntRect(29, 40, 1, 60), occlusion.unoccludedContentRect(parent, IntRect(29, 40, 70, 60))); + EXPECT_INT_RECT_EQ(IntRect(29, 40, 1, 60), occlusion.unoccludedContentRect(parent, IntRect(29, 40, 70, 60))); // This rect is mostly occluded by |child2|. - EXPECT_EQ_RECT(IntRect(90, 39, 10, 1), occlusion.unoccludedContentRect(parent, IntRect(30, 39, 70, 60))); + EXPECT_INT_RECT_EQ(IntRect(90, 39, 10, 1), occlusion.unoccludedContentRect(parent, IntRect(30, 39, 70, 60))); // This rect extends past top/right ends of |child2|. - EXPECT_EQ_RECT(IntRect(30, 29, 70, 11), occlusion.unoccludedContentRect(parent, IntRect(30, 29, 70, 70))); + EXPECT_INT_RECT_EQ(IntRect(30, 29, 70, 11), occlusion.unoccludedContentRect(parent, IntRect(30, 29, 70, 70))); // This rect extends past left/right ends of |child2|. - EXPECT_EQ_RECT(IntRect(20, 39, 80, 60), occlusion.unoccludedContentRect(parent, IntRect(20, 39, 80, 60))); - EXPECT_EQ_RECT(IntRect(100, 40, 1, 60), occlusion.unoccludedContentRect(parent, IntRect(31, 40, 70, 60))); - EXPECT_EQ_RECT(IntRect(30, 100, 70, 1), occlusion.unoccludedContentRect(parent, IntRect(30, 41, 70, 60))); + EXPECT_INT_RECT_EQ(IntRect(20, 39, 80, 60), occlusion.unoccludedContentRect(parent, IntRect(20, 39, 80, 60))); + EXPECT_INT_RECT_EQ(IntRect(100, 40, 1, 60), occlusion.unoccludedContentRect(parent, IntRect(31, 40, 70, 60))); + EXPECT_INT_RECT_EQ(IntRect(30, 100, 70, 1), occlusion.unoccludedContentRect(parent, IntRect(30, 41, 70, 60))); /* Justification for the above occlusion from |layer|: 100 @@ -842,12 +838,12 @@ class CCOcclusionTrackerTestSurfaceRotatedOffAxis : public CCOcclusionTrackerTes protected: void runMyTest() { - TransformationMatrix childTransform; + WebTransformationMatrix childTransform; childTransform.translate(250, 250); childTransform.rotate(95); childTransform.translate(-250, -250); - TransformationMatrix layerTransform; + WebTransformationMatrix layerTransform; layerTransform.translate(10, 10); typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(100, 100)); @@ -859,14 +855,14 @@ protected: TestCCOcclusionTrackerWithScissor<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); occlusion.setLayerScissorRect(IntRect(0, 0, 1000, 1000)); - IntRect clippedLayerInChild = layerTransform.mapRect(layer->visibleLayerRect()); + IntRect clippedLayerInChild = CCMathUtil::mapClippedRect(layerTransform, layer->visibleLayerRect()); this->visitLayer(layer, occlusion); this->enterContributingSurface(child, occlusion); - EXPECT_EQ_RECT(IntRect(), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(0u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(clippedLayerInChild, occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(clippedLayerInChild, occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); EXPECT_TRUE(occlusion.occluded(child, clippedLayerInChild)); @@ -891,13 +887,13 @@ protected: this->leaveContributingSurface(child, occlusion); this->enterLayer(parent, occlusion); - EXPECT_EQ_RECT(IntRect(), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(0u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(IntRect(), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(0u, occlusion.occlusionInTargetSurface().rects().size()); EXPECT_FALSE(occlusion.occluded(parent, IntRect(75, 55, 1, 1))); - EXPECT_EQ_RECT(IntRect(75, 55, 1, 1), occlusion.unoccludedContentRect(parent, IntRect(75, 55, 1, 1))); + EXPECT_INT_RECT_EQ(IntRect(75, 55, 1, 1), occlusion.unoccludedContentRect(parent, IntRect(75, 55, 1, 1))); } }; @@ -908,7 +904,7 @@ class CCOcclusionTrackerTestSurfaceWithTwoOpaqueChildren : public CCOcclusionTra protected: void runMyTest() { - TransformationMatrix childTransform; + WebTransformationMatrix childTransform; childTransform.translate(250, 250); childTransform.rotate(90); childTransform.translate(-250, -250); @@ -927,9 +923,9 @@ protected: this->visitLayer(layer1, occlusion); this->enterContributingSurface(child, occlusion); - EXPECT_EQ_RECT(IntRect(30, 40, 70, 60), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(30, 40, 70, 60), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(10, 430, 60, 70), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(IntRect(10, 430, 60, 70), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); EXPECT_TRUE(occlusion.occluded(child, IntRect(10, 430, 60, 70))); @@ -939,17 +935,17 @@ protected: EXPECT_FALSE(occlusion.occluded(child, IntRect(10, 431, 60, 70))); EXPECT_TRUE(occlusion.unoccludedContentRect(child, IntRect(10, 430, 60, 70)).isEmpty()); - EXPECT_EQ_RECT(IntRect(9, 430, 1, 70), occlusion.unoccludedContentRect(child, IntRect(9, 430, 60, 70))); - EXPECT_EQ_RECT(IntRect(10, 429, 60, 1), occlusion.unoccludedContentRect(child, IntRect(10, 429, 60, 70))); - EXPECT_EQ_RECT(IntRect(70, 430, 1, 70), occlusion.unoccludedContentRect(child, IntRect(11, 430, 60, 70))); - EXPECT_EQ_RECT(IntRect(10, 500, 60, 1), occlusion.unoccludedContentRect(child, IntRect(10, 431, 60, 70))); + EXPECT_INT_RECT_EQ(IntRect(9, 430, 1, 70), occlusion.unoccludedContentRect(child, IntRect(9, 430, 60, 70))); + EXPECT_INT_RECT_EQ(IntRect(10, 429, 60, 1), occlusion.unoccludedContentRect(child, IntRect(10, 429, 60, 70))); + EXPECT_INT_RECT_EQ(IntRect(70, 430, 1, 70), occlusion.unoccludedContentRect(child, IntRect(11, 430, 60, 70))); + EXPECT_INT_RECT_EQ(IntRect(10, 500, 60, 1), occlusion.unoccludedContentRect(child, IntRect(10, 431, 60, 70))); this->leaveContributingSurface(child, occlusion); this->enterLayer(parent, occlusion); - EXPECT_EQ_RECT(IntRect(30, 40, 70, 60), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(30, 40, 70, 60), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(30, 40, 70, 60), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(IntRect(30, 40, 70, 60), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); EXPECT_TRUE(occlusion.occluded(parent, IntRect(30, 40, 70, 60))); @@ -957,10 +953,10 @@ protected: EXPECT_FALSE(occlusion.occluded(parent, IntRect(30, 39, 70, 60))); EXPECT_TRUE(occlusion.unoccludedContentRect(parent, IntRect(30, 40, 70, 60)).isEmpty()); - EXPECT_EQ_RECT(IntRect(29, 40, 1, 60), occlusion.unoccludedContentRect(parent, IntRect(29, 40, 70, 60))); - EXPECT_EQ_RECT(IntRect(30, 39, 70, 1), occlusion.unoccludedContentRect(parent, IntRect(30, 39, 70, 60))); - EXPECT_EQ_RECT(IntRect(100, 40, 1, 60), occlusion.unoccludedContentRect(parent, IntRect(31, 40, 70, 60))); - EXPECT_EQ_RECT(IntRect(30, 100, 70, 1), occlusion.unoccludedContentRect(parent, IntRect(30, 41, 70, 60))); + EXPECT_INT_RECT_EQ(IntRect(29, 40, 1, 60), occlusion.unoccludedContentRect(parent, IntRect(29, 40, 70, 60))); + EXPECT_INT_RECT_EQ(IntRect(30, 39, 70, 1), occlusion.unoccludedContentRect(parent, IntRect(30, 39, 70, 60))); + EXPECT_INT_RECT_EQ(IntRect(100, 40, 1, 60), occlusion.unoccludedContentRect(parent, IntRect(31, 40, 70, 60))); + EXPECT_INT_RECT_EQ(IntRect(30, 100, 70, 1), occlusion.unoccludedContentRect(parent, IntRect(30, 41, 70, 60))); /* Justification for the above occlusion from |layer1| and |layer2|: @@ -996,7 +992,7 @@ class CCOcclusionTrackerTestOverlappingSurfaceSiblings : public CCOcclusionTrack protected: void runMyTest() { - TransformationMatrix childTransform; + WebTransformationMatrix childTransform; childTransform.translate(250, 250); childTransform.rotate(90); childTransform.translate(-250, -250); @@ -1014,9 +1010,9 @@ protected: this->visitLayer(layer2, occlusion); this->enterContributingSurface(child2, occlusion); - EXPECT_EQ_RECT(IntRect(20, 30, 80, 70), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(20, 30, 80, 70), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(-10, 420, 70, 80), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(IntRect(-10, 420, 70, 80), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); EXPECT_TRUE(occlusion.occluded(child2, IntRect(-10, 420, 70, 80))); @@ -1034,15 +1030,15 @@ protected: occlusion.setLayerScissorRect(IntRect(-20, -20, 1000, 1000)); // There is nothing above child2's surface in the z-order. - EXPECT_EQ_RECT(IntRect(-10, 420, 70, 80), occlusion.unoccludedContributingSurfaceContentRect(child2->renderSurface(), false, IntRect(-10, 420, 70, 80))); + EXPECT_INT_RECT_EQ(IntRect(-10, 420, 70, 80), occlusion.unoccludedContributingSurfaceContentRect(child2->renderSurface(), false, IntRect(-10, 420, 70, 80))); this->leaveContributingSurface(child2, occlusion); this->visitLayer(layer1, occlusion); this->enterContributingSurface(child1, occlusion); - EXPECT_EQ_RECT(IntRect(20, 20, 80, 80), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(20, 20, 80, 80), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(2u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(-10, 430, 80, 70), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(IntRect(-10, 430, 80, 70), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); EXPECT_TRUE(occlusion.occluded(child1, IntRect(-10, 430, 80, 70))); @@ -1052,14 +1048,14 @@ protected: EXPECT_FALSE(occlusion.occluded(child1, IntRect(-10, 430, 80, 71))); // child2's contents will occlude child1 below it. - EXPECT_EQ_RECT(IntRect(-10, 430, 10, 70), occlusion.unoccludedContributingSurfaceContentRect(child1->renderSurface(), false, IntRect(-10, 430, 80, 70))); + EXPECT_INT_RECT_EQ(IntRect(-10, 430, 10, 70), occlusion.unoccludedContributingSurfaceContentRect(child1->renderSurface(), false, IntRect(-10, 430, 80, 70))); this->leaveContributingSurface(child1, occlusion); this->enterLayer(parent, occlusion); - EXPECT_EQ_RECT(IntRect(20, 20, 80, 80), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(20, 20, 80, 80), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(2u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(20, 20, 80, 80), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(IntRect(20, 20, 80, 80), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(2u, occlusion.occlusionInTargetSurface().rects().size()); EXPECT_FALSE(occlusion.occluded(parent, IntRect(20, 20, 80, 80))); @@ -1105,12 +1101,12 @@ class CCOcclusionTrackerTestOverlappingSurfaceSiblingsWithTwoTransforms : public protected: void runMyTest() { - TransformationMatrix child1Transform; + WebTransformationMatrix child1Transform; child1Transform.translate(250, 250); child1Transform.rotate(-90); child1Transform.translate(-250, -250); - TransformationMatrix child2Transform; + WebTransformationMatrix child2Transform; child2Transform.translate(250, 250); child2Transform.rotate(90); child2Transform.translate(-250, -250); @@ -1128,9 +1124,9 @@ protected: this->visitLayer(layer2, occlusion); this->enterLayer(child2, occlusion); - EXPECT_EQ_RECT(IntRect(20, 30, 80, 70), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(20, 30, 80, 70), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(-10, 420, 70, 80), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(IntRect(-10, 420, 70, 80), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); EXPECT_TRUE(occlusion.occluded(child2, IntRect(-10, 420, 70, 80))); @@ -1143,15 +1139,15 @@ protected: this->enterContributingSurface(child2, occlusion); // There is nothing above child2's surface in the z-order. - EXPECT_EQ_RECT(IntRect(-10, 420, 70, 80), occlusion.unoccludedContributingSurfaceContentRect(child2->renderSurface(), false, IntRect(-10, 420, 70, 80))); + EXPECT_INT_RECT_EQ(IntRect(-10, 420, 70, 80), occlusion.unoccludedContributingSurfaceContentRect(child2->renderSurface(), false, IntRect(-10, 420, 70, 80))); this->leaveContributingSurface(child2, occlusion); this->visitLayer(layer1, occlusion); this->enterContributingSurface(child1, occlusion); - EXPECT_EQ_RECT(IntRect(10, 20, 90, 80), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(10, 20, 90, 80), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(420, -20, 80, 90), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(IntRect(420, -20, 80, 90), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); EXPECT_TRUE(occlusion.occluded(child1, IntRect(420, -20, 80, 90))); @@ -1161,16 +1157,16 @@ protected: EXPECT_FALSE(occlusion.occluded(child1, IntRect(421, -20, 80, 90))); // child2's contents will occlude child1 below it. - EXPECT_EQ_RECT(IntRect(420, -20, 80, 90), occlusion.unoccludedContributingSurfaceContentRect(child1->renderSurface(), false, IntRect(420, -20, 80, 90))); - EXPECT_EQ_RECT(IntRect(490, -10, 10, 80), occlusion.unoccludedContributingSurfaceContentRect(child1->renderSurface(), false, IntRect(420, -10, 80, 90))); - EXPECT_EQ_RECT(IntRect(420, -20, 70, 10), occlusion.unoccludedContributingSurfaceContentRect(child1->renderSurface(), false, IntRect(420, -20, 70, 90))); + EXPECT_INT_RECT_EQ(IntRect(420, -20, 80, 90), occlusion.unoccludedContributingSurfaceContentRect(child1->renderSurface(), false, IntRect(420, -20, 80, 90))); + EXPECT_INT_RECT_EQ(IntRect(490, -10, 10, 80), occlusion.unoccludedContributingSurfaceContentRect(child1->renderSurface(), false, IntRect(420, -10, 80, 90))); + EXPECT_INT_RECT_EQ(IntRect(420, -20, 70, 10), occlusion.unoccludedContributingSurfaceContentRect(child1->renderSurface(), false, IntRect(420, -20, 70, 90))); this->leaveContributingSurface(child1, occlusion); this->enterLayer(parent, occlusion); - EXPECT_EQ_RECT(IntRect(10, 20, 90, 80), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(10, 20, 90, 80), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(10, 20, 90, 80), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(IntRect(10, 20, 90, 80), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); EXPECT_TRUE(occlusion.occluded(parent, IntRect(10, 20, 90, 80))); @@ -1212,7 +1208,7 @@ class CCOcclusionTrackerTestFilters : public CCOcclusionTrackerTest<Types, opaqu protected: void runMyTest() { - TransformationMatrix layerTransform; + WebTransformationMatrix layerTransform; layerTransform.translate(250, 250); layerTransform.rotate(90); layerTransform.translate(-250, -250); @@ -1255,16 +1251,16 @@ protected: this->visitLayer(opaqueLayer, occlusion); this->enterContributingSurface(opaqueLayer, occlusion); - EXPECT_EQ_RECT(IntRect(30, 30, 70, 70), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(0, 430, 70, 70), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 430, 70, 70), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); // And it gets translated to the parent surface. this->leaveContributingSurface(opaqueLayer, occlusion); - EXPECT_EQ_RECT(IntRect(30, 30, 70, 70), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(30, 30, 70, 70), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); // The blur layer needs to throw away any occlusion from outside its subtree. @@ -1281,9 +1277,9 @@ protected: // But the opaque layer's occlusion is preserved on the parent. this->leaveContributingSurface(blurLayer, occlusion); this->enterLayer(parent, occlusion); - EXPECT_EQ_RECT(IntRect(30, 30, 70, 70), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(30, 30, 70, 70), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); } }; @@ -1305,16 +1301,16 @@ protected: this->visitLayer(surface, occlusion); - EXPECT_EQ_RECT(IntRect(0, 100, 50, 50), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 100, 50, 50), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(0, 0, 50, 50), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 50, 50), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); this->visitContributingSurface(surface, occlusion); this->enterLayer(parent, occlusion); // The surface and replica should both be occluding the parent. - EXPECT_EQ_RECT(IntRect(0, 100, 100, 100), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 100, 100, 100), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(2u, occlusion.occlusionInTargetSurface().rects().size()); } }; @@ -1336,16 +1332,16 @@ protected: this->visitLayer(surface, occlusion); - EXPECT_EQ_RECT(IntRect(0, 100, 50, 50), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 100, 50, 50), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(0, 0, 50, 50), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 50, 50), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); this->visitContributingSurface(surface, occlusion); this->enterLayer(parent, occlusion); // The surface and replica should both be occluding the parent. - EXPECT_EQ_RECT(IntRect(0, 100, 100, 70), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 100, 100, 70), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(2u, occlusion.occlusionInTargetSurface().rects().size()); } }; @@ -1368,16 +1364,16 @@ protected: this->visitLayer(surface, occlusion); - EXPECT_EQ_RECT(IntRect(0, 100, 50, 50), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 100, 50, 50), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(0, 0, 50, 50), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 50, 50), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); this->visitContributingSurface(surface, occlusion); this->enterLayer(parent, occlusion); // The replica should not be occluding the parent, since it has a mask applied to it. - EXPECT_EQ_RECT(IntRect(0, 100, 50, 50), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 100, 50, 50), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); } }; @@ -1422,7 +1418,7 @@ protected: EXPECT_TRUE(occlusion.occluded(parent, IntRect(100, 200, 100, 100))); EXPECT_TRUE(occlusion.occluded(parent, IntRect(200, 200, 100, 100))); - EXPECT_EQ_RECT(IntRect(200, 100, 100, 100), occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 300))); + EXPECT_INT_RECT_EQ(IntRect(200, 100, 100, 100), occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 300))); } }; @@ -1466,7 +1462,7 @@ protected: EXPECT_TRUE(occlusion.occluded(parent, IntRect(100, 200, 100, 100))); EXPECT_TRUE(occlusion.occluded(parent, IntRect(200, 200, 100, 100))); - EXPECT_EQ_RECT(IntRect(200, 100, 100, 100), occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 300))); + EXPECT_INT_RECT_EQ(IntRect(200, 100, 100, 100), occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 300))); } }; @@ -1583,11 +1579,11 @@ protected: EXPECT_FALSE(occlusion.occluded(parent, IntRect(100, 200, 100, 100))); EXPECT_FALSE(occlusion.occluded(parent, IntRect(200, 200, 100, 100))); - EXPECT_EQ_RECT(IntRect(50, 50, 200, 200), occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 300))); - EXPECT_EQ_RECT(IntRect(200, 50, 50, 50), occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 100))); - EXPECT_EQ_RECT(IntRect(200, 100, 50, 100), occlusion.unoccludedContentRect(parent, IntRect(0, 100, 300, 100))); - EXPECT_EQ_RECT(IntRect(200, 100, 50, 100), occlusion.unoccludedContentRect(parent, IntRect(200, 100, 100, 100))); - EXPECT_EQ_RECT(IntRect(100, 200, 100, 50), occlusion.unoccludedContentRect(parent, IntRect(100, 200, 100, 100))); + EXPECT_INT_RECT_EQ(IntRect(50, 50, 200, 200), occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 300))); + EXPECT_INT_RECT_EQ(IntRect(200, 50, 50, 50), occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 100))); + EXPECT_INT_RECT_EQ(IntRect(200, 100, 50, 100), occlusion.unoccludedContentRect(parent, IntRect(0, 100, 300, 100))); + EXPECT_INT_RECT_EQ(IntRect(200, 100, 50, 100), occlusion.unoccludedContentRect(parent, IntRect(200, 100, 100, 100))); + EXPECT_INT_RECT_EQ(IntRect(100, 200, 100, 50), occlusion.unoccludedContentRect(parent, IntRect(100, 200, 100, 100))); } }; @@ -1626,11 +1622,11 @@ protected: EXPECT_FALSE(occlusion.occluded(parent, IntRect(100, 200, 100, 100))); EXPECT_FALSE(occlusion.occluded(parent, IntRect(200, 200, 100, 100))); - EXPECT_EQ_RECT(IntRect(50, 50, 200, 200), occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 300))); - EXPECT_EQ_RECT(IntRect(200, 50, 50, 50), occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 100))); - EXPECT_EQ_RECT(IntRect(200, 100, 50, 100), occlusion.unoccludedContentRect(parent, IntRect(0, 100, 300, 100))); - EXPECT_EQ_RECT(IntRect(200, 100, 50, 100), occlusion.unoccludedContentRect(parent, IntRect(200, 100, 100, 100))); - EXPECT_EQ_RECT(IntRect(100, 200, 100, 50), occlusion.unoccludedContentRect(parent, IntRect(100, 200, 100, 100))); + EXPECT_INT_RECT_EQ(IntRect(50, 50, 200, 200), occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 300))); + EXPECT_INT_RECT_EQ(IntRect(200, 50, 50, 50), occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 100))); + EXPECT_INT_RECT_EQ(IntRect(200, 100, 50, 100), occlusion.unoccludedContentRect(parent, IntRect(0, 100, 300, 100))); + EXPECT_INT_RECT_EQ(IntRect(200, 100, 50, 100), occlusion.unoccludedContentRect(parent, IntRect(200, 100, 100, 100))); + EXPECT_INT_RECT_EQ(IntRect(100, 200, 100, 50), occlusion.unoccludedContentRect(parent, IntRect(100, 200, 100, 100))); } }; @@ -1799,7 +1795,7 @@ protected: this->visitLayer(layer, occlusion); this->enterLayer(parent, occlusion); - EXPECT_EQ_RECT(IntRect(100, 100, 100, 100), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(100, 100, 100, 100), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); EXPECT_FALSE(occlusion.occluded(parent, IntRect(0, 100, 100, 100))); @@ -1815,7 +1811,7 @@ protected: this->visitLayer(layer, occlusion); this->enterLayer(parent, occlusion); - EXPECT_EQ_RECT(IntRect(120, 120, 180, 180), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(120, 120, 180, 180), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); EXPECT_FALSE(occlusion.occluded(parent, IntRect(0, 100, 100, 100))); @@ -1831,7 +1827,7 @@ protected: this->visitLayer(layer, occlusion); this->enterLayer(parent, occlusion); - EXPECT_EQ_RECT(IntRect(250, 250, 50, 50), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(250, 250, 50, 50), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); EXPECT_FALSE(occlusion.occluded(parent, IntRect(0, 100, 100, 100))); @@ -1848,7 +1844,7 @@ class CCOcclusionTrackerTest3dTransform : public CCOcclusionTrackerTest<Types, o protected: void runMyTest() { - TransformationMatrix transform; + WebTransformationMatrix transform; transform.rotate3d(0, 30, 0); typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300)); @@ -1860,7 +1856,7 @@ protected: this->enterLayer(layer, occlusion); // The layer is rotated in 3d but without preserving 3d, so it only gets resized. - EXPECT_EQ_RECT(IntRect(0, 0, 200, 200), occlusion.unoccludedContentRect(layer, IntRect(0, 0, 200, 200))); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 200, 200), occlusion.unoccludedContentRect(layer, IntRect(0, 0, 200, 200))); } }; @@ -1871,7 +1867,7 @@ class CCOcclusionTrackerTestPerspectiveTransform : public CCOcclusionTrackerTest protected: void runMyTest() { - TransformationMatrix transform; + WebTransformationMatrix transform; transform.translate(150, 150); transform.applyPerspective(400); transform.rotate3d(1, 0, 0, -30); @@ -1887,7 +1883,7 @@ protected: TestCCOcclusionTrackerWithScissor<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); this->enterLayer(layer, occlusion); - EXPECT_EQ_RECT(IntRect(0, 0, 200, 200), occlusion.unoccludedContentRect(layer, IntRect(0, 0, 200, 200))); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 200, 200), occlusion.unoccludedContentRect(layer, IntRect(0, 0, 200, 200))); } }; @@ -1899,7 +1895,7 @@ protected: void runMyTest() { // This test is based on the platform/chromium/compositing/3d-corners.html layout test. - TransformationMatrix transform; + WebTransformationMatrix transform; transform.translate(250, 50); transform.applyPerspective(10); transform.translate(-250, -50); @@ -1930,7 +1926,7 @@ class CCOcclusionTrackerTestLayerBehindCameraDoesNotOcclude : public CCOcclusion protected: void runMyTest() { - TransformationMatrix transform; + WebTransformationMatrix transform; transform.translate(50, 50); transform.applyPerspective(100); transform.translate3d(0, 0, 110); @@ -1959,7 +1955,7 @@ class CCOcclusionTrackerTestLargePixelsOccludeInsideClipRect : public CCOcclusio protected: void runMyTest() { - TransformationMatrix transform; + WebTransformationMatrix transform; transform.translate(50, 50); transform.applyPerspective(100); transform.translate3d(0, 0, 99); @@ -2012,27 +2008,27 @@ protected: this->visitLayer(topmost, occlusion); this->enterLayer(parent2, occlusion); // This occlusion will affect all surfaces. - EXPECT_EQ_RECT(IntRect(0, 0, 250, 300), occlusion.unoccludedContentRect(parent2, IntRect(0, 0, 300, 300))); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 250, 300), occlusion.unoccludedContentRect(parent2, IntRect(0, 0, 300, 300))); this->leaveLayer(parent2, occlusion); this->visitLayer(surfaceChild2, occlusion); this->enterLayer(surfaceChild, occlusion); - EXPECT_EQ_RECT(IntRect(100, 0, 150, 300), occlusion.unoccludedContentRect(surfaceChild, IntRect(0, 0, 300, 300))); + EXPECT_INT_RECT_EQ(IntRect(100, 0, 150, 300), occlusion.unoccludedContentRect(surfaceChild, IntRect(0, 0, 300, 300))); this->leaveLayer(surfaceChild, occlusion); this->enterLayer(surface, occlusion); - EXPECT_EQ_RECT(IntRect(200, 0, 50, 300), occlusion.unoccludedContentRect(surface, IntRect(0, 0, 300, 300))); + EXPECT_INT_RECT_EQ(IntRect(200, 0, 50, 300), occlusion.unoccludedContentRect(surface, IntRect(0, 0, 300, 300))); this->leaveLayer(surface, occlusion); this->enterContributingSurface(surface, occlusion); // Occlusion within the surface is lost when leaving the animating surface. - EXPECT_EQ_RECT(IntRect(0, 0, 250, 300), occlusion.unoccludedContributingSurfaceContentRect(surface->renderSurface(), false, IntRect(0, 0, 300, 300))); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 250, 300), occlusion.unoccludedContributingSurfaceContentRect(surface->renderSurface(), false, IntRect(0, 0, 300, 300))); this->leaveContributingSurface(surface, occlusion); this->visitLayer(layer, occlusion); this->enterLayer(parent, occlusion); // Occlusion is not added for the animating |layer|. - EXPECT_EQ_RECT(IntRect(0, 0, 250, 300), occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 300))); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 250, 300), occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 300))); } }; @@ -2064,27 +2060,27 @@ protected: this->visitLayer(topmost, occlusion); this->enterLayer(parent2, occlusion); // This occlusion will affect all surfaces. - EXPECT_EQ_RECT(IntRect(0, 0, 250, 300), occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 300))); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 250, 300), occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 300))); this->leaveLayer(parent2, occlusion); this->visitLayer(surfaceChild2, occlusion); this->enterLayer(surfaceChild, occlusion); - EXPECT_EQ_RECT(IntRect(100, 0, 150, 300), occlusion.unoccludedContentRect(surfaceChild, IntRect(0, 0, 300, 300))); + EXPECT_INT_RECT_EQ(IntRect(100, 0, 150, 300), occlusion.unoccludedContentRect(surfaceChild, IntRect(0, 0, 300, 300))); this->leaveLayer(surfaceChild, occlusion); this->enterLayer(surface, occlusion); - EXPECT_EQ_RECT(IntRect(200, 0, 50, 300), occlusion.unoccludedContentRect(surface, IntRect(0, 0, 300, 300))); + EXPECT_INT_RECT_EQ(IntRect(200, 0, 50, 300), occlusion.unoccludedContentRect(surface, IntRect(0, 0, 300, 300))); this->leaveLayer(surface, occlusion); this->enterContributingSurface(surface, occlusion); // Occlusion within the surface is lost when leaving the animating surface. - EXPECT_EQ_RECT(IntRect(0, 0, 250, 300), occlusion.unoccludedContributingSurfaceContentRect(surface->renderSurface(), false, IntRect(0, 0, 300, 300))); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 250, 300), occlusion.unoccludedContributingSurfaceContentRect(surface->renderSurface(), false, IntRect(0, 0, 300, 300))); this->leaveContributingSurface(surface, occlusion); this->visitLayer(layer, occlusion); this->enterLayer(parent, occlusion); // Occlusion is not added for the animating |layer|. - EXPECT_EQ_RECT(IntRect(0, 0, 250, 300), occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 300))); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 250, 300), occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 300))); } }; @@ -2122,7 +2118,7 @@ protected: this->visitLayer(surface2, occlusion); this->enterContributingSurface(surface2, occlusion); - EXPECT_EQ_RECT(IntRect(0, 0, 50, 300), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 50, 300), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); this->leaveContributingSurface(surface2, occlusion); @@ -2130,53 +2126,53 @@ protected: // surfaceChild2 is moving in screen space but not relative to its target, so occlusion should happen in its target space only. // It also means that things occluding in screen space (e.g. surface2) cannot occlude this layer. - EXPECT_EQ_RECT(IntRect(0, 0, 100, 300), occlusion.unoccludedContentRect(surfaceChild2, IntRect(0, 0, 100, 300))); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 300), occlusion.unoccludedContentRect(surfaceChild2, IntRect(0, 0, 100, 300))); EXPECT_FALSE(occlusion.occluded(surfaceChild, IntRect(0, 0, 50, 300))); this->leaveLayer(surfaceChild2, occlusion); this->enterLayer(surfaceChild, occlusion); EXPECT_FALSE(occlusion.occluded(surfaceChild, IntRect(0, 0, 100, 300))); - EXPECT_EQ_RECT(IntRect(0, 0, 50, 300), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 50, 300), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(0, 0, 100, 300), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 300), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); - EXPECT_EQ_RECT(IntRect(100, 0, 200, 300), occlusion.unoccludedContentRect(surface, IntRect(0, 0, 300, 300))); + EXPECT_INT_RECT_EQ(IntRect(100, 0, 200, 300), occlusion.unoccludedContentRect(surface, IntRect(0, 0, 300, 300))); // The surfaceChild is occluded by the surfaceChild2, but is moving relative its target and the screen, so it // can't be occluded. - EXPECT_EQ_RECT(IntRect(0, 0, 200, 300), occlusion.unoccludedContentRect(surfaceChild, IntRect(0, 0, 200, 300))); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 200, 300), occlusion.unoccludedContentRect(surfaceChild, IntRect(0, 0, 200, 300))); EXPECT_FALSE(occlusion.occluded(surfaceChild, IntRect(0, 0, 50, 300))); this->leaveLayer(surfaceChild, occlusion); this->enterLayer(surface, occlusion); // The surfaceChild is moving in screen space but not relative to its target, so occlusion should happen in its target space only. - EXPECT_EQ_RECT(IntRect(0, 0, 50, 300), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 50, 300), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(0, 0, 100, 300), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 300), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); - EXPECT_EQ_RECT(IntRect(100, 0, 200, 300), occlusion.unoccludedContentRect(surface, IntRect(0, 0, 300, 300))); + EXPECT_INT_RECT_EQ(IntRect(100, 0, 200, 300), occlusion.unoccludedContentRect(surface, IntRect(0, 0, 300, 300))); this->leaveLayer(surface, occlusion); // The surface's owning layer is moving in screen space but not relative to its target, so occlusion should happen in its target space only. - EXPECT_EQ_RECT(IntRect(0, 0, 50, 300), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 50, 300), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(0, 0, 300, 300), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 300, 300), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); - EXPECT_EQ_RECT(IntRect(0, 0, 0, 0), occlusion.unoccludedContentRect(surface, IntRect(0, 0, 300, 300))); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 0, 0), occlusion.unoccludedContentRect(surface, IntRect(0, 0, 300, 300))); this->enterContributingSurface(surface, occlusion); // The contributing |surface| is animating so it can't be occluded. - EXPECT_EQ_RECT(IntRect(0, 0, 300, 300), occlusion.unoccludedContributingSurfaceContentRect(surface->renderSurface(), false, IntRect(0, 0, 300, 300))); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 300, 300), occlusion.unoccludedContributingSurfaceContentRect(surface->renderSurface(), false, IntRect(0, 0, 300, 300))); this->leaveContributingSurface(surface, occlusion); this->enterLayer(layer, occlusion); // The |surface| is moving in the screen and in its target, so all occlusion within the surface is lost when leaving it. - EXPECT_EQ_RECT(IntRect(50, 0, 250, 300), occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 300))); + EXPECT_INT_RECT_EQ(IntRect(50, 0, 250, 300), occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 300))); this->leaveLayer(layer, occlusion); this->enterLayer(parent, occlusion); // The |layer| is animating in the screen and in its target, so no occlusion is added. - EXPECT_EQ_RECT(IntRect(50, 0, 250, 300), occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 300))); + EXPECT_INT_RECT_EQ(IntRect(50, 0, 250, 300), occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 300))); } }; @@ -2187,7 +2183,7 @@ class CCOcclusionTrackerTestSurfaceOcclusionTranslatesToParent : public CCOcclus protected: void runMyTest() { - TransformationMatrix surfaceTransform; + WebTransformationMatrix surfaceTransform; surfaceTransform.translate(300, 300); surfaceTransform.scale(2); surfaceTransform.translate(-150, -150); @@ -2204,9 +2200,9 @@ protected: this->visitLayer(surface2, occlusion); this->visitContributingSurface(surface2, occlusion); - EXPECT_EQ_RECT(IntRect(50, 50, 200, 200), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(50, 50, 200, 200), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(50, 50, 200, 200), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(IntRect(50, 50, 200, 200), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); // Clear any stored occlusion. @@ -2216,9 +2212,9 @@ protected: this->visitLayer(surface, occlusion); this->visitContributingSurface(surface, occlusion); - EXPECT_EQ_RECT(IntRect(0, 0, 400, 400), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 400, 400), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(0, 0, 400, 400), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 400, 400), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); } }; @@ -2240,9 +2236,9 @@ protected: this->visitLayer(surface, occlusion); this->visitContributingSurface(surface, occlusion); - EXPECT_EQ_RECT(IntRect(0, 0, 300, 200), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 300, 200), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(0, 0, 300, 200), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 300, 200), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); } }; @@ -2266,22 +2262,22 @@ protected: // |topmost| occludes the replica, but not the surface itself. this->visitLayer(topmost, occlusion); - EXPECT_EQ_RECT(IntRect(0, 100, 100, 100), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 100, 100, 100), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(0, 100, 100, 100), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 100, 100, 100), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); this->visitLayer(surface, occlusion); - EXPECT_EQ_RECT(IntRect(0, 0, 100, 200), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 200), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(0, 0, 100, 100), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 100), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); this->enterContributingSurface(surface, occlusion); // Surface is not occluded so it shouldn't think it is. - EXPECT_EQ_RECT(IntRect(0, 0, 100, 100), occlusion.unoccludedContributingSurfaceContentRect(surface->renderSurface(), false, IntRect(0, 0, 100, 100))); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 100), occlusion.unoccludedContributingSurfaceContentRect(surface->renderSurface(), false, IntRect(0, 0, 100, 100))); } }; @@ -2304,23 +2300,23 @@ protected: // |topmost| occludes the surface, but not the entire surface's replica. this->visitLayer(topmost, occlusion); - EXPECT_EQ_RECT(IntRect(0, 0, 100, 110), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 110), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(0, 0, 100, 110), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 110), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); this->visitLayer(surface, occlusion); - EXPECT_EQ_RECT(IntRect(0, 0, 100, 110), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 110), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(0, 0, 100, 100), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 100), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); this->enterContributingSurface(surface, occlusion); // Surface is occluded, but only the top 10px of the replica. - EXPECT_EQ_RECT(IntRect(0, 0, 0, 0), occlusion.unoccludedContributingSurfaceContentRect(surface->renderSurface(), false, IntRect(0, 0, 100, 100))); - EXPECT_EQ_RECT(IntRect(0, 10, 100, 90), occlusion.unoccludedContributingSurfaceContentRect(surface->renderSurface(), true, IntRect(0, 0, 100, 100))); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 0, 0), occlusion.unoccludedContributingSurfaceContentRect(surface->renderSurface(), false, IntRect(0, 0, 100, 100))); + EXPECT_INT_RECT_EQ(IntRect(0, 10, 100, 90), occlusion.unoccludedContributingSurfaceContentRect(surface->renderSurface(), true, IntRect(0, 0, 100, 100))); } }; @@ -2345,23 +2341,23 @@ protected: this->visitLayer(overReplica, occlusion); this->visitLayer(overSurface, occlusion); - EXPECT_EQ_RECT(IntRect(0, 0, 50, 200), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 50, 200), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(2u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(0, 0, 50, 200), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 50, 200), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(2u, occlusion.occlusionInTargetSurface().rects().size()); this->visitLayer(surface, occlusion); - EXPECT_EQ_RECT(IntRect(0, 0, 100, 200), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 200), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(2u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(0, 0, 100, 100), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 100), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); this->enterContributingSurface(surface, occlusion); // Surface and replica are occluded different amounts. - EXPECT_EQ_RECT(IntRect(40, 0, 60, 100), occlusion.unoccludedContributingSurfaceContentRect(surface->renderSurface(), false, IntRect(0, 0, 100, 100))); - EXPECT_EQ_RECT(IntRect(50, 0, 50, 100), occlusion.unoccludedContributingSurfaceContentRect(surface->renderSurface(), true, IntRect(0, 0, 100, 100))); + EXPECT_INT_RECT_EQ(IntRect(40, 0, 60, 100), occlusion.unoccludedContributingSurfaceContentRect(surface->renderSurface(), false, IntRect(0, 0, 100, 100))); + EXPECT_INT_RECT_EQ(IntRect(50, 0, 50, 100), occlusion.unoccludedContributingSurfaceContentRect(surface->renderSurface(), true, IntRect(0, 0, 100, 100))); } }; @@ -2385,18 +2381,18 @@ protected: // |topmost| occludes everything partially so we know occlusion is happening at all. this->visitLayer(topmost, occlusion); - EXPECT_EQ_RECT(IntRect(0, 0, 100, 50), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 50), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(0, 0, 100, 50), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 50), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); this->visitLayer(surfaceChild, occlusion); // surfaceChild increases the occlusion in the screen by a narrow sliver. - EXPECT_EQ_RECT(IntRect(0, 0, 100, 60), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 60), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); // In its own surface, surfaceChild is at 0,0 as is its occlusion. - EXPECT_EQ_RECT(IntRect(0, 0, 100, 50), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 50), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); // The root layer always has a clipRect. So the parent of |surface| has a clipRect. However, the owning layer for |surface| does not @@ -2406,26 +2402,65 @@ protected: this->enterContributingSurface(surfaceChild, occlusion); // The surfaceChild's parent does not have a clipRect as it owns a render surface. Make sure the unoccluded rect // does not get clipped away inappropriately. - EXPECT_EQ_RECT(IntRect(0, 40, 100, 10), occlusion.unoccludedContributingSurfaceContentRect(surfaceChild->renderSurface(), false, IntRect(0, 0, 100, 50))); + EXPECT_INT_RECT_EQ(IntRect(0, 40, 100, 10), occlusion.unoccludedContributingSurfaceContentRect(surfaceChild->renderSurface(), false, IntRect(0, 0, 100, 50))); this->leaveContributingSurface(surfaceChild, occlusion); // When the surfaceChild's occlusion is transformed up to its parent, make sure it is not clipped away inappropriately also. this->enterLayer(surface, occlusion); - EXPECT_EQ_RECT(IntRect(0, 0, 100, 60), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 60), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(0, 10, 100, 50), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 10, 100, 50), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); this->leaveLayer(surface, occlusion); this->enterContributingSurface(surface, occlusion); // The surface's parent does have a clipRect as it is the root layer. - EXPECT_EQ_RECT(IntRect(0, 50, 100, 50), occlusion.unoccludedContributingSurfaceContentRect(surface->renderSurface(), false, IntRect(0, 0, 100, 100))); + EXPECT_INT_RECT_EQ(IntRect(0, 50, 100, 50), occlusion.unoccludedContributingSurfaceContentRect(surface->renderSurface(), false, IntRect(0, 0, 100, 100))); } }; ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestSurfaceChildOfSurface); template<class Types, bool opaqueLayers> +class CCOcclusionTrackerTestTopmostSurfaceIsClippedToScissor : public CCOcclusionTrackerTest<Types, opaqueLayers> { +protected: + void runMyTest() + { + // This test verifies that the top-most surface is considered occluded outside of its scissor rect and outside the screen's scissor rect. + + typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(100, 200)); + typename Types::LayerType* surface = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(100, 300), true); + this->calcDrawEtc(parent); + + { + // Make a screen scissor rect that is larger than the root layer's. + TestCCOcclusionTrackerWithScissor<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); + + this->visitLayer(surface, occlusion); + + // The root layer always has a clipRect. So the parent of |surface| has a clipRect giving the surface itself a clipRect. + this->enterContributingSurface(surface, occlusion); + // Make sure the parent's clipRect clips the unoccluded region of the child surface. + EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 200), occlusion.unoccludedContributingSurfaceContentRect(surface->renderSurface(), false, IntRect(0, 0, 100, 300))); + } + this->resetLayerIterator(); + { + // Make a screen scissor rect that is smaller than the root layer's. + TestCCOcclusionTrackerWithScissor<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 100, 100)); + + this->visitLayer(surface, occlusion); + + // The root layer always has a clipRect. So the parent of |surface| has a clipRect giving the surface itself a clipRect. + this->enterContributingSurface(surface, occlusion); + // Make sure the screen scissor rect clips the unoccluded region of the child surface. + EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 100), occlusion.unoccludedContributingSurfaceContentRect(surface->renderSurface(), false, IntRect(0, 0, 100, 300))); + } + } +}; + +ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestTopmostSurfaceIsClippedToScissor); + +template<class Types, bool opaqueLayers> class CCOcclusionTrackerTestSurfaceChildOfClippingSurface : public CCOcclusionTrackerTest<Types, opaqueLayers> { protected: void runMyTest() @@ -2444,17 +2479,17 @@ protected: // |topmost| occludes everything partially so we know occlusion is happening at all. this->visitLayer(topmost, occlusion); - EXPECT_EQ_RECT(IntRect(0, 0, 80, 50), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 80, 50), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(0, 0, 80, 50), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 80, 50), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); // surfaceChild is not opaque and does not occlude, so we have a non-empty unoccluded area on surface. this->visitLayer(surfaceChild, occlusion); - EXPECT_EQ_RECT(IntRect(0, 0, 80, 50), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 80, 50), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(0, 0, 0, 0), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 0, 0), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(0u, occlusion.occlusionInTargetSurface().rects().size()); // The root layer always has a clipRect. So the parent of |surface| has a clipRect. However, the owning layer for |surface| does not @@ -2463,13 +2498,13 @@ protected: this->enterContributingSurface(surfaceChild, occlusion); // The surfaceChild's parent does not have a clipRect as it owns a render surface. - EXPECT_EQ_RECT(IntRect(0, 50, 80, 50), occlusion.unoccludedContributingSurfaceContentRect(surfaceChild->renderSurface(), false, IntRect(0, 0, 100, 100))); + EXPECT_INT_RECT_EQ(IntRect(0, 50, 80, 50), occlusion.unoccludedContributingSurfaceContentRect(surfaceChild->renderSurface(), false, IntRect(0, 0, 100, 100))); this->leaveContributingSurface(surfaceChild, occlusion); this->visitLayer(surface, occlusion); this->enterContributingSurface(surface, occlusion); // The surface's parent does have a clipRect as it is the root layer. - EXPECT_EQ_RECT(IntRect(0, 50, 80, 50), occlusion.unoccludedContributingSurfaceContentRect(surface->renderSurface(), false, IntRect(0, 0, 100, 100))); + EXPECT_INT_RECT_EQ(IntRect(0, 50, 80, 50), occlusion.unoccludedContributingSurfaceContentRect(surface->renderSurface(), false, IntRect(0, 0, 100, 100))); } }; @@ -2480,7 +2515,7 @@ class CCOcclusionTrackerTestDontOccludePixelsNeededForBackgroundFilter : public protected: void runMyTest() { - TransformationMatrix scaleByHalf; + WebTransformationMatrix scaleByHalf; scaleByHalf.scale(0.5); // Make a surface and its replica, each 50x50, that are completely surrounded by opaque layers which are above them in the z-order. @@ -2517,28 +2552,28 @@ protected: this->visitLayer(occludingLayer2, occlusion); this->visitLayer(occludingLayer1, occlusion); - EXPECT_EQ_RECT(IntRect(0, 0, 300, 150), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 300, 150), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(5u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(0, 0, 300, 150), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 300, 150), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(5u, occlusion.occlusionInTargetSurface().rects().size()); // Everything outside the surface/replica is occluded but the surface/replica itself is not. this->enterLayer(filteredSurface, occlusion); - EXPECT_EQ_RECT(IntRect(1, 0, 99, 100), occlusion.unoccludedContentRect(filteredSurface, IntRect(1, 0, 100, 100))); - EXPECT_EQ_RECT(IntRect(0, 1, 100, 99), occlusion.unoccludedContentRect(filteredSurface, IntRect(0, 1, 100, 100))); - EXPECT_EQ_RECT(IntRect(0, 0, 99, 100), occlusion.unoccludedContentRect(filteredSurface, IntRect(-1, 0, 100, 100))); - EXPECT_EQ_RECT(IntRect(0, 0, 100, 99), occlusion.unoccludedContentRect(filteredSurface, IntRect(0, -1, 100, 100))); - - EXPECT_EQ_RECT(IntRect(300 + 1, 0, 99, 100), occlusion.unoccludedContentRect(filteredSurface, IntRect(300 + 1, 0, 100, 100))); - EXPECT_EQ_RECT(IntRect(300 + 0, 1, 100, 99), occlusion.unoccludedContentRect(filteredSurface, IntRect(300 + 0, 1, 100, 100))); - EXPECT_EQ_RECT(IntRect(300 + 0, 0, 99, 100), occlusion.unoccludedContentRect(filteredSurface, IntRect(300 - 1, 0, 100, 100))); - EXPECT_EQ_RECT(IntRect(300 + 0, 0, 100, 99), occlusion.unoccludedContentRect(filteredSurface, IntRect(300 + 0, -1, 100, 100))); + EXPECT_INT_RECT_EQ(IntRect(1, 0, 99, 100), occlusion.unoccludedContentRect(filteredSurface, IntRect(1, 0, 100, 100))); + EXPECT_INT_RECT_EQ(IntRect(0, 1, 100, 99), occlusion.unoccludedContentRect(filteredSurface, IntRect(0, 1, 100, 100))); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 99, 100), occlusion.unoccludedContentRect(filteredSurface, IntRect(-1, 0, 100, 100))); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 99), occlusion.unoccludedContentRect(filteredSurface, IntRect(0, -1, 100, 100))); + + EXPECT_INT_RECT_EQ(IntRect(300 + 1, 0, 99, 100), occlusion.unoccludedContentRect(filteredSurface, IntRect(300 + 1, 0, 100, 100))); + EXPECT_INT_RECT_EQ(IntRect(300 + 0, 1, 100, 99), occlusion.unoccludedContentRect(filteredSurface, IntRect(300 + 0, 1, 100, 100))); + EXPECT_INT_RECT_EQ(IntRect(300 + 0, 0, 99, 100), occlusion.unoccludedContentRect(filteredSurface, IntRect(300 - 1, 0, 100, 100))); + EXPECT_INT_RECT_EQ(IntRect(300 + 0, 0, 100, 99), occlusion.unoccludedContentRect(filteredSurface, IntRect(300 + 0, -1, 100, 100))); this->leaveLayer(filteredSurface, occlusion); // The filtered layer/replica does not occlude. - EXPECT_EQ_RECT(IntRect(0, 0, 300, 150), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 300, 150), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(5u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(0, 0, 0, 0), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 0, 0), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(0u, occlusion.occlusionInTargetSurface().rects().size()); // The surface has a background blur, so it needs pixels that are currently considered occluded in order to be drawn. So the pixels @@ -2546,9 +2581,9 @@ protected: this->visitContributingSurface(filteredSurface, occlusion); this->enterLayer(parent, occlusion); - EXPECT_EQ_RECT(IntRect(0, 0, 300, 150), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 300, 150), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(5u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(0, 0, 300, 150), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 300, 150), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(5u, occlusion.occlusionInTargetSurface().rects().size()); IntRect outsetRect; @@ -2557,44 +2592,44 @@ protected: // Nothing in the blur outsets for the filteredSurface is occluded. outsetRect = IntRect(50 - outsetLeft, 50 - outsetTop, 50 + outsetLeft + outsetRight, 50 + outsetTop + outsetBottom); testRect = outsetRect; - EXPECT_EQ_RECT(outsetRect, occlusion.unoccludedContentRect(parent, testRect)); + EXPECT_INT_RECT_EQ(outsetRect, occlusion.unoccludedContentRect(parent, testRect)); // Stuff outside the blur outsets is still occluded though. testRect = outsetRect; testRect.expand(1, 0); - EXPECT_EQ_RECT(outsetRect, occlusion.unoccludedContentRect(parent, testRect)); + EXPECT_INT_RECT_EQ(outsetRect, occlusion.unoccludedContentRect(parent, testRect)); testRect = outsetRect; testRect.expand(0, 1); - EXPECT_EQ_RECT(outsetRect, occlusion.unoccludedContentRect(parent, testRect)); + EXPECT_INT_RECT_EQ(outsetRect, occlusion.unoccludedContentRect(parent, testRect)); testRect = outsetRect; testRect.move(-1, 0); testRect.expand(1, 0); - EXPECT_EQ_RECT(outsetRect, occlusion.unoccludedContentRect(parent, testRect)); + EXPECT_INT_RECT_EQ(outsetRect, occlusion.unoccludedContentRect(parent, testRect)); testRect = outsetRect; testRect.move(0, -1); testRect.expand(0, 1); - EXPECT_EQ_RECT(outsetRect, occlusion.unoccludedContentRect(parent, testRect)); + EXPECT_INT_RECT_EQ(outsetRect, occlusion.unoccludedContentRect(parent, testRect)); // Nothing in the blur outsets for the filteredSurface's replica is occluded. outsetRect = IntRect(200 - outsetLeft, 50 - outsetTop, 50 + outsetLeft + outsetRight, 50 + outsetTop + outsetBottom); testRect = outsetRect; - EXPECT_EQ_RECT(outsetRect, occlusion.unoccludedContentRect(parent, testRect)); + EXPECT_INT_RECT_EQ(outsetRect, occlusion.unoccludedContentRect(parent, testRect)); // Stuff outside the blur outsets is still occluded though. testRect = outsetRect; testRect.expand(1, 0); - EXPECT_EQ_RECT(outsetRect, occlusion.unoccludedContentRect(parent, testRect)); + EXPECT_INT_RECT_EQ(outsetRect, occlusion.unoccludedContentRect(parent, testRect)); testRect = outsetRect; testRect.expand(0, 1); - EXPECT_EQ_RECT(outsetRect, occlusion.unoccludedContentRect(parent, testRect)); + EXPECT_INT_RECT_EQ(outsetRect, occlusion.unoccludedContentRect(parent, testRect)); testRect = outsetRect; testRect.move(-1, 0); testRect.expand(1, 0); - EXPECT_EQ_RECT(outsetRect, occlusion.unoccludedContentRect(parent, testRect)); + EXPECT_INT_RECT_EQ(outsetRect, occlusion.unoccludedContentRect(parent, testRect)); testRect = outsetRect; testRect.move(0, -1); testRect.expand(0, 1); - EXPECT_EQ_RECT(outsetRect, occlusion.unoccludedContentRect(parent, testRect)); + EXPECT_INT_RECT_EQ(outsetRect, occlusion.unoccludedContentRect(parent, testRect)); } }; @@ -2605,7 +2640,7 @@ class CCOcclusionTrackerTestTwoBackgroundFiltersReduceOcclusionTwice : public CC protected: void runMyTest() { - TransformationMatrix scaleByHalf; + WebTransformationMatrix scaleByHalf; scaleByHalf.scale(0.5); // Makes two surfaces that completely cover |parent|. The occlusion both above and below the filters will be reduced by each of them. @@ -2632,9 +2667,9 @@ protected: occlusion.setLayerScissorRect(IntRect(0, 0, 1000, 1000)); this->visitLayer(occludingLayerAbove, occlusion); - EXPECT_EQ_RECT(IntRect(100 / 2, 100 / 2, 50 / 2, 50 / 2), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(100 / 2, 100 / 2, 50 / 2, 50 / 2), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(100, 100, 50, 50), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(IntRect(100, 100, 50, 50), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); this->visitLayer(filteredSurface2, occlusion); @@ -2647,7 +2682,7 @@ protected: // Test expectations in the target. IntRect expectedOcclusion = IntRect(100 + outsetRight * 2, 100 + outsetBottom * 2, 50 - (outsetLeft + outsetRight) * 2, 50 - (outsetTop + outsetBottom) * 2); - EXPECT_EQ_RECT(expectedOcclusion, occlusion.occlusionInTargetSurface().rects()[0]); + EXPECT_INT_RECT_EQ(expectedOcclusion, occlusion.occlusionInTargetSurface().rects()[0]); // Test expectations in the screen. Take the ceiling of half of the outsets. outsetTop = (outsetTop + 1) / 2; @@ -2656,7 +2691,7 @@ protected: outsetLeft = (outsetLeft + 1) / 2; expectedOcclusion = IntRect(100 / 2 + outsetRight * 2, 100 / 2 + outsetBottom * 2, 50 / 2 - (outsetLeft + outsetRight) * 2, 50 /2 - (outsetTop + outsetBottom) * 2); - EXPECT_EQ_RECT(expectedOcclusion, occlusion.occlusionInScreenSpace().rects()[0]); + EXPECT_INT_RECT_EQ(expectedOcclusion, occlusion.occlusionInScreenSpace().rects()[0]); } }; @@ -2703,28 +2738,28 @@ protected: this->visitLayer(occludingLayer2, occlusion); this->visitLayer(occludingLayer1, occlusion); - EXPECT_EQ_RECT(IntRect(0, 0, 300, 150), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 300, 150), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(5u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(0, 0, 300, 150), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 300, 150), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(5u, occlusion.occlusionInTargetSurface().rects().size()); // Everything outside the surface/replica is occluded but the surface/replica itself is not. this->enterLayer(filteredSurface, occlusion); - EXPECT_EQ_RECT(IntRect(1, 0, 49, 50), occlusion.unoccludedContentRect(filteredSurface, IntRect(1, 0, 50, 50))); - EXPECT_EQ_RECT(IntRect(0, 1, 50, 49), occlusion.unoccludedContentRect(filteredSurface, IntRect(0, 1, 50, 50))); - EXPECT_EQ_RECT(IntRect(0, 0, 49, 50), occlusion.unoccludedContentRect(filteredSurface, IntRect(-1, 0, 50, 50))); - EXPECT_EQ_RECT(IntRect(0, 0, 50, 49), occlusion.unoccludedContentRect(filteredSurface, IntRect(0, -1, 50, 50))); - - EXPECT_EQ_RECT(IntRect(150 + 1, 0, 49, 50), occlusion.unoccludedContentRect(filteredSurface, IntRect(150 + 1, 0, 50, 50))); - EXPECT_EQ_RECT(IntRect(150 + 0, 1, 50, 49), occlusion.unoccludedContentRect(filteredSurface, IntRect(150 + 0, 1, 50, 50))); - EXPECT_EQ_RECT(IntRect(150 + 0, 0, 49, 50), occlusion.unoccludedContentRect(filteredSurface, IntRect(150 - 1, 0, 50, 50))); - EXPECT_EQ_RECT(IntRect(150 + 0, 0, 50, 49), occlusion.unoccludedContentRect(filteredSurface, IntRect(150 + 0, -1, 50, 50))); + EXPECT_INT_RECT_EQ(IntRect(1, 0, 49, 50), occlusion.unoccludedContentRect(filteredSurface, IntRect(1, 0, 50, 50))); + EXPECT_INT_RECT_EQ(IntRect(0, 1, 50, 49), occlusion.unoccludedContentRect(filteredSurface, IntRect(0, 1, 50, 50))); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 49, 50), occlusion.unoccludedContentRect(filteredSurface, IntRect(-1, 0, 50, 50))); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 50, 49), occlusion.unoccludedContentRect(filteredSurface, IntRect(0, -1, 50, 50))); + + EXPECT_INT_RECT_EQ(IntRect(150 + 1, 0, 49, 50), occlusion.unoccludedContentRect(filteredSurface, IntRect(150 + 1, 0, 50, 50))); + EXPECT_INT_RECT_EQ(IntRect(150 + 0, 1, 50, 49), occlusion.unoccludedContentRect(filteredSurface, IntRect(150 + 0, 1, 50, 50))); + EXPECT_INT_RECT_EQ(IntRect(150 + 0, 0, 49, 50), occlusion.unoccludedContentRect(filteredSurface, IntRect(150 - 1, 0, 50, 50))); + EXPECT_INT_RECT_EQ(IntRect(150 + 0, 0, 50, 49), occlusion.unoccludedContentRect(filteredSurface, IntRect(150 + 0, -1, 50, 50))); this->leaveLayer(filteredSurface, occlusion); // The filtered layer/replica does not occlude. - EXPECT_EQ_RECT(IntRect(0, 0, 300, 150), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 300, 150), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(5u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(0, 0, 0, 0), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 0, 0), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(0u, occlusion.occlusionInTargetSurface().rects().size()); // The surface has a background blur, so it needs pixels that are currently considered occluded in order to be drawn. So the pixels @@ -2732,7 +2767,7 @@ protected: this->visitContributingSurface(filteredSurface, occlusion); this->enterContributingSurface(clippingSurface, occlusion); - EXPECT_EQ_RECT(IntRect(0, 0, 300, 150), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 300, 150), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(5u, occlusion.occlusionInScreenSpace().rects().size()); IntRect outsetRect; @@ -2743,45 +2778,45 @@ protected: outsetRect = IntRect(50 - outsetLeft, 50 - outsetTop, 50 + outsetLeft + outsetRight, 50 + outsetTop + outsetBottom); clippedOutsetRect = intersection(outsetRect, IntRect(0 - outsetLeft, 0 - outsetTop, 300 + outsetLeft + outsetRight, 70 + outsetTop + outsetBottom)); testRect = outsetRect; - EXPECT_EQ_RECT(clippedOutsetRect, occlusion.unoccludedContentRect(clippingSurface, testRect)); + EXPECT_INT_RECT_EQ(clippedOutsetRect, occlusion.unoccludedContentRect(clippingSurface, testRect)); // Stuff outside the (clipped) blur outsets is still occluded though. testRect = outsetRect; testRect.expand(1, 0); - EXPECT_EQ_RECT(clippedOutsetRect, occlusion.unoccludedContentRect(clippingSurface, testRect)); + EXPECT_INT_RECT_EQ(clippedOutsetRect, occlusion.unoccludedContentRect(clippingSurface, testRect)); testRect = outsetRect; testRect.expand(0, 1); - EXPECT_EQ_RECT(clippedOutsetRect, occlusion.unoccludedContentRect(clippingSurface, testRect)); + EXPECT_INT_RECT_EQ(clippedOutsetRect, occlusion.unoccludedContentRect(clippingSurface, testRect)); testRect = outsetRect; testRect.move(-1, 0); testRect.expand(1, 0); - EXPECT_EQ_RECT(clippedOutsetRect, occlusion.unoccludedContentRect(clippingSurface, testRect)); + EXPECT_INT_RECT_EQ(clippedOutsetRect, occlusion.unoccludedContentRect(clippingSurface, testRect)); testRect = outsetRect; testRect.move(0, -1); testRect.expand(0, 1); - EXPECT_EQ_RECT(clippedOutsetRect, occlusion.unoccludedContentRect(clippingSurface, testRect)); + EXPECT_INT_RECT_EQ(clippedOutsetRect, occlusion.unoccludedContentRect(clippingSurface, testRect)); // Nothing in the (clipped) blur outsets for the filteredSurface's replica is occluded. outsetRect = IntRect(200 - outsetLeft, 50 - outsetTop, 50 + outsetLeft + outsetRight, 50 + outsetTop + outsetBottom); clippedOutsetRect = intersection(outsetRect, IntRect(0 - outsetLeft, 0 - outsetTop, 300 + outsetLeft + outsetRight, 70 + outsetTop + outsetBottom)); testRect = outsetRect; - EXPECT_EQ_RECT(clippedOutsetRect, occlusion.unoccludedContentRect(clippingSurface, testRect)); + EXPECT_INT_RECT_EQ(clippedOutsetRect, occlusion.unoccludedContentRect(clippingSurface, testRect)); // Stuff outside the (clipped) blur outsets is still occluded though. testRect = outsetRect; testRect.expand(1, 0); - EXPECT_EQ_RECT(clippedOutsetRect, occlusion.unoccludedContentRect(clippingSurface, testRect)); + EXPECT_INT_RECT_EQ(clippedOutsetRect, occlusion.unoccludedContentRect(clippingSurface, testRect)); testRect = outsetRect; testRect.expand(0, 1); - EXPECT_EQ_RECT(clippedOutsetRect, occlusion.unoccludedContentRect(clippingSurface, testRect)); + EXPECT_INT_RECT_EQ(clippedOutsetRect, occlusion.unoccludedContentRect(clippingSurface, testRect)); testRect = outsetRect; testRect.move(-1, 0); testRect.expand(1, 0); - EXPECT_EQ_RECT(clippedOutsetRect, occlusion.unoccludedContentRect(clippingSurface, testRect)); + EXPECT_INT_RECT_EQ(clippedOutsetRect, occlusion.unoccludedContentRect(clippingSurface, testRect)); testRect = outsetRect; testRect.move(0, -1); testRect.expand(0, 1); - EXPECT_EQ_RECT(clippedOutsetRect, occlusion.unoccludedContentRect(clippingSurface, testRect)); + EXPECT_INT_RECT_EQ(clippedOutsetRect, occlusion.unoccludedContentRect(clippingSurface, testRect)); } }; @@ -2792,7 +2827,7 @@ class CCOcclusionTrackerTestDontReduceOcclusionBelowBackgroundFilter : public CC protected: void runMyTest() { - TransformationMatrix scaleByHalf; + WebTransformationMatrix scaleByHalf; scaleByHalf.scale(0.5); // Make a surface and its replica, each 50x50, with a smaller 30x30 layer centered below each. @@ -2827,9 +2862,9 @@ protected: IntRect occlusionBehindReplica = IntRect(210, 60, 30, 30); IntRect expectedOpaqueBounds = unionRect(occlusionBehindSurface, occlusionBehindReplica); - EXPECT_EQ_RECT(expectedOpaqueBounds, occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(expectedOpaqueBounds, occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(2u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(expectedOpaqueBounds, occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(expectedOpaqueBounds, occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(2u, occlusion.occlusionInTargetSurface().rects().size()); } }; @@ -2841,7 +2876,7 @@ class CCOcclusionTrackerTestDontReduceOcclusionIfBackgroundFilterIsOccluded : pu protected: void runMyTest() { - TransformationMatrix scaleByHalf; + WebTransformationMatrix scaleByHalf; scaleByHalf.scale(0.5); // Make a surface and its replica, each 50x50, that are completely occluded by opaque layers which are above them in the z-order. @@ -2875,9 +2910,9 @@ protected: IntRect occlusionAboveReplica = IntRect(200, 50, 50, 50); IntRect expectedOpaqueBounds = unionRect(occlusionAboveSurface, occlusionAboveReplica); - EXPECT_EQ_RECT(expectedOpaqueBounds, occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(expectedOpaqueBounds, occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(2u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(expectedOpaqueBounds, occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(expectedOpaqueBounds, occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(2u, occlusion.occlusionInTargetSurface().rects().size()); } }; @@ -2889,7 +2924,7 @@ class CCOcclusionTrackerTestReduceOcclusionWhenBackgroundFilterIsPartiallyOcclud protected: void runMyTest() { - TransformationMatrix scaleByHalf; + WebTransformationMatrix scaleByHalf; scaleByHalf.scale(0.5); // Make a surface and its replica, each 50x50, that are partially occluded by opaque layers which are above them in the z-order. @@ -2976,17 +3011,17 @@ protected: // The small layer is not tracked because it is too small. this->visitLayer(small, occlusion); - EXPECT_EQ_RECT(IntRect(), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(0u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(IntRect(), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(0u, occlusion.occlusionInTargetSurface().rects().size()); // The large layer is tracked as it is large enough. this->visitLayer(large, occlusion); - EXPECT_EQ_RECT(IntRect(IntPoint(), trackingSize), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(IntPoint(), trackingSize), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(IntPoint(), trackingSize), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(IntRect(IntPoint(), trackingSize), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); } }; diff --git a/Source/WebKit/chromium/tests/CCQuadCullerTest.cpp b/Source/WebKit/chromium/tests/CCQuadCullerTest.cpp index 634a25c7a..1a119d708 100644 --- a/Source/WebKit/chromium/tests/CCQuadCullerTest.cpp +++ b/Source/WebKit/chromium/tests/CCQuadCullerTest.cpp @@ -33,8 +33,10 @@ #include "cc/CCTileDrawQuad.h" #include <gmock/gmock.h> #include <gtest/gtest.h> +#include <public/WebTransformationMatrix.h> using namespace WebCore; +using WebKit::WebTransformationMatrix; namespace { @@ -55,7 +57,7 @@ private: typedef CCLayerIterator<CCLayerImpl, Vector<CCLayerImpl*>, CCRenderSurface, CCLayerIteratorActions::FrontToBack> CCLayerIteratorType; -static PassOwnPtr<CCTiledLayerImpl> makeLayer(CCTiledLayerImpl* parent, const TransformationMatrix& drawTransform, const IntRect& layerRect, float opacity, bool opaque, const IntRect& layerOpaqueRect, Vector<CCLayerImpl*>& surfaceLayerList) +static PassOwnPtr<CCTiledLayerImpl> makeLayer(CCTiledLayerImpl* parent, const WebTransformationMatrix& drawTransform, const IntRect& layerRect, float opacity, bool opaque, const IntRect& layerOpaqueRect, Vector<CCLayerImpl*>& surfaceLayerList) { OwnPtr<CCTiledLayerImpl> layer = CCTiledLayerImpl::create(0); OwnPtr<CCLayerTilingData> tiler = CCLayerTilingData::create(IntSize(100, 100), CCLayerTilingData::NoBorderTexels); @@ -105,7 +107,7 @@ static void appendQuads(CCQuadList& quadList, Vector<OwnPtr<CCSharedQuadState> > CCQuadList quadList; \ Vector<OwnPtr<CCSharedQuadState> > sharedStateList; \ Vector<CCLayerImpl*> renderSurfaceLayerList; \ - TransformationMatrix childTransform; \ + WebTransformationMatrix childTransform; \ IntSize rootSize = IntSize(300, 300); \ IntRect rootRect = IntRect(IntPoint(), rootSize); \ IntSize childSize = IntSize(200, 200); \ @@ -115,8 +117,8 @@ TEST(CCQuadCullerTest, verifyNoCulling) { DECLARE_AND_INITIALIZE_TEST_QUADS - OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, TransformationMatrix(), rootRect, 1.0, true, IntRect(), renderSurfaceLayerList); - OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), TransformationMatrix(), childRect, 1.0, false, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1.0, true, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), WebTransformationMatrix(), childRect, 1.0, false, IntRect(), renderSurfaceLayerList); TestCCOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000)); CCLayerIteratorType it = CCLayerIteratorType::begin(&renderSurfaceLayerList); @@ -132,8 +134,8 @@ TEST(CCQuadCullerTest, verifyCullChildLinesUpTopLeft) { DECLARE_AND_INITIALIZE_TEST_QUADS - OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, TransformationMatrix(), rootRect, 1.0, true, IntRect(), renderSurfaceLayerList); - OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), TransformationMatrix(), childRect, 1.0, true, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1.0, true, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), WebTransformationMatrix(), childRect, 1.0, true, IntRect(), renderSurfaceLayerList); TestCCOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000)); CCLayerIteratorType it = CCLayerIteratorType::begin(&renderSurfaceLayerList); @@ -149,7 +151,7 @@ TEST(CCQuadCullerTest, verifyCullWhenChildOpacityNotOne) { DECLARE_AND_INITIALIZE_TEST_QUADS - OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, TransformationMatrix(), rootRect, 1, true, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, IntRect(), renderSurfaceLayerList); OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 0.9f, true, IntRect(), renderSurfaceLayerList); TestCCOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000)); CCLayerIteratorType it = CCLayerIteratorType::begin(&renderSurfaceLayerList); @@ -166,7 +168,7 @@ TEST(CCQuadCullerTest, verifyCullWhenChildOpaqueFlagFalse) { DECLARE_AND_INITIALIZE_TEST_QUADS - OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, TransformationMatrix(), rootRect, 1.0, true, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1.0, true, IntRect(), renderSurfaceLayerList); OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1.0, false, IntRect(), renderSurfaceLayerList); TestCCOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000)); CCLayerIteratorType it = CCLayerIteratorType::begin(&renderSurfaceLayerList); @@ -185,7 +187,7 @@ TEST(CCQuadCullerTest, verifyCullCenterTileOnly) childTransform.translate(50, 50); - OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, TransformationMatrix(), rootRect, 1.0, true, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1.0, true, IntRect(), renderSurfaceLayerList); OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1.0, true, IntRect(), renderSurfaceLayerList); TestCCOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000)); CCLayerIteratorType it = CCLayerIteratorType::begin(&renderSurfaceLayerList); @@ -222,7 +224,7 @@ TEST(CCQuadCullerTest, verifyCullCenterTileNonIntegralSize1) // Make the root layer's quad have extent (99.1, 99.1) -> (200.9, 200.9) to make // sure it doesn't get culled due to transform rounding. - TransformationMatrix rootTransform; + WebTransformationMatrix rootTransform; rootTransform.translate(99.1, 99.1); rootTransform.scale(1.018); @@ -251,7 +253,7 @@ TEST(CCQuadCullerTest, verifyCullCenterTileNonIntegralSize2) childTransform.translate(100.1, 100.1); childTransform.scale(0.982); - TransformationMatrix rootTransform; + WebTransformationMatrix rootTransform; rootTransform.translate(100, 100); rootRect = childRect = IntRect(0, 0, 100, 100); @@ -276,7 +278,7 @@ TEST(CCQuadCullerTest, verifyCullChildLinesUpBottomRight) childTransform.translate(100, 100); - OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, TransformationMatrix(), rootRect, 1.0, true, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1.0, true, IntRect(), renderSurfaceLayerList); OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1.0, true, IntRect(), renderSurfaceLayerList); TestCCOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000)); CCLayerIteratorType it = CCLayerIteratorType::begin(&renderSurfaceLayerList); @@ -295,7 +297,7 @@ TEST(CCQuadCullerTest, verifyCullSubRegion) childTransform.translate(50, 50); - OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, TransformationMatrix(), rootRect, 1.0, true, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1.0, true, IntRect(), renderSurfaceLayerList); IntRect childOpaqueRect(childRect.x() + childRect.width() / 4, childRect.y() + childRect.height() / 4, childRect.width() / 2, childRect.height() / 2); OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1.0, false, childOpaqueRect, renderSurfaceLayerList); TestCCOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000)); @@ -315,7 +317,7 @@ TEST(CCQuadCullerTest, verifyCullSubRegion2) childTransform.translate(50, 10); - OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, TransformationMatrix(), rootRect, 1.0, true, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1.0, true, IntRect(), renderSurfaceLayerList); IntRect childOpaqueRect(childRect.x() + childRect.width() / 4, childRect.y() + childRect.height() / 4, childRect.width() / 2, childRect.height() * 3 / 4); OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1.0, false, childOpaqueRect, renderSurfaceLayerList); TestCCOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000)); @@ -335,7 +337,7 @@ TEST(CCQuadCullerTest, verifyCullSubRegionCheckOvercull) childTransform.translate(50, 49); - OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, TransformationMatrix(), rootRect, 1.0, true, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1.0, true, IntRect(), renderSurfaceLayerList); IntRect childOpaqueRect(childRect.x() + childRect.width() / 4, childRect.y() + childRect.height() / 4, childRect.width() / 2, childRect.height() / 2); OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1.0, false, childOpaqueRect, renderSurfaceLayerList); TestCCOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000)); @@ -356,7 +358,7 @@ TEST(CCQuadCullerTest, verifyNonAxisAlignedQuadsDontOcclude) // Use a small rotation so as to not disturb the geometry significantly. childTransform.rotate(1); - OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, TransformationMatrix(), rootRect, 1.0, true, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1.0, true, IntRect(), renderSurfaceLayerList); OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1.0, true, IntRect(), renderSurfaceLayerList); TestCCOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000)); CCLayerIteratorType it = CCLayerIteratorType::begin(&renderSurfaceLayerList); @@ -379,11 +381,11 @@ TEST(CCQuadCullerTest, verifyNonAxisAlignedQuadsSafelyCulled) DECLARE_AND_INITIALIZE_TEST_QUADS // Use a small rotation so as to not disturb the geometry significantly. - TransformationMatrix parentTransform; + WebTransformationMatrix parentTransform; parentTransform.rotate(1); OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, parentTransform, rootRect, 1.0, true, IntRect(), renderSurfaceLayerList); - OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), TransformationMatrix(), childRect, 1.0, true, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), WebTransformationMatrix(), childRect, 1.0, true, IntRect(), renderSurfaceLayerList); TestCCOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000)); CCLayerIteratorType it = CCLayerIteratorType::begin(&renderSurfaceLayerList); @@ -399,8 +401,8 @@ TEST(CCQuadCullerTest, verifyCullOutsideScissorOverTile) { DECLARE_AND_INITIALIZE_TEST_QUADS - OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, TransformationMatrix(), rootRect, 1.0, true, IntRect(), renderSurfaceLayerList); - OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), TransformationMatrix(), childRect, 1.0, true, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1.0, true, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), WebTransformationMatrix(), childRect, 1.0, true, IntRect(), renderSurfaceLayerList); TestCCOcclusionTrackerImpl occlusionTracker(IntRect(200, 100, 100, 100)); CCLayerIteratorType it = CCLayerIteratorType::begin(&renderSurfaceLayerList); @@ -416,8 +418,8 @@ TEST(CCQuadCullerTest, verifyCullOutsideScissorOverCulledTile) { DECLARE_AND_INITIALIZE_TEST_QUADS - OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, TransformationMatrix(), rootRect, 1.0, true, IntRect(), renderSurfaceLayerList); - OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), TransformationMatrix(), childRect, 1.0, true, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1.0, true, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), WebTransformationMatrix(), childRect, 1.0, true, IntRect(), renderSurfaceLayerList); TestCCOcclusionTrackerImpl occlusionTracker(IntRect(100, 100, 100, 100)); CCLayerIteratorType it = CCLayerIteratorType::begin(&renderSurfaceLayerList); @@ -433,8 +435,8 @@ TEST(CCQuadCullerTest, verifyCullOutsideScissorOverPartialTiles) { DECLARE_AND_INITIALIZE_TEST_QUADS - OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, TransformationMatrix(), rootRect, 1.0, true, IntRect(), renderSurfaceLayerList); - OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), TransformationMatrix(), childRect, 1.0, true, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1.0, true, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), WebTransformationMatrix(), childRect, 1.0, true, IntRect(), renderSurfaceLayerList); TestCCOcclusionTrackerImpl occlusionTracker(IntRect(50, 50, 200, 200)); CCLayerIteratorType it = CCLayerIteratorType::begin(&renderSurfaceLayerList); @@ -450,8 +452,8 @@ TEST(CCQuadCullerTest, verifyCullOutsideScissorOverNoTiles) { DECLARE_AND_INITIALIZE_TEST_QUADS - OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, TransformationMatrix(), rootRect, 1.0, true, IntRect(), renderSurfaceLayerList); - OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), TransformationMatrix(), childRect, 1.0, true, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1.0, true, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), WebTransformationMatrix(), childRect, 1.0, true, IntRect(), renderSurfaceLayerList); TestCCOcclusionTrackerImpl occlusionTracker(IntRect(500, 500, 100, 100)); CCLayerIteratorType it = CCLayerIteratorType::begin(&renderSurfaceLayerList); @@ -467,8 +469,8 @@ TEST(CCQuadCullerTest, verifyWithoutMetrics) { DECLARE_AND_INITIALIZE_TEST_QUADS - OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, TransformationMatrix(), rootRect, 1.0, true, IntRect(), renderSurfaceLayerList); - OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), TransformationMatrix(), childRect, 1.0, true, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1.0, true, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), WebTransformationMatrix(), childRect, 1.0, true, IntRect(), renderSurfaceLayerList); TestCCOcclusionTrackerImpl occlusionTracker(IntRect(50, 50, 200, 200), false); CCLayerIteratorType it = CCLayerIteratorType::begin(&renderSurfaceLayerList); diff --git a/Source/WebKit/chromium/tests/CCRenderSurfaceTest.cpp b/Source/WebKit/chromium/tests/CCRenderSurfaceTest.cpp index 7dac005d2..5cbe7fc54 100644 --- a/Source/WebKit/chromium/tests/CCRenderSurfaceTest.cpp +++ b/Source/WebKit/chromium/tests/CCRenderSurfaceTest.cpp @@ -26,14 +26,15 @@ #include "cc/CCRenderSurface.h" -#include "TransformationMatrix.h" #include "cc/CCLayerImpl.h" #include "cc/CCSharedQuadState.h" #include "cc/CCSingleThreadProxy.h" #include <gmock/gmock.h> #include <gtest/gtest.h> +#include <public/WebTransformationMatrix.h> using namespace WebCore; +using WebKit::WebTransformationMatrix; namespace { @@ -77,7 +78,7 @@ TEST(CCRenderSurfaceTest, verifySurfaceChangesAreTrackedProperly) EXECUTE_AND_VERIFY_SURFACE_DID_NOT_CHANGE(renderSurface->setContentRect(testRect)); OwnPtr<CCLayerImpl> dummyMask = CCLayerImpl::create(1); - TransformationMatrix dummyMatrix; + WebTransformationMatrix dummyMatrix; dummyMatrix.translate(1.0, 2.0); // The rest of the surface properties are either internal and should not cause change, @@ -86,9 +87,7 @@ TEST(CCRenderSurfaceTest, verifySurfaceChangesAreTrackedProperly) EXECUTE_AND_VERIFY_SURFACE_DID_NOT_CHANGE(renderSurface->setDrawTransform(dummyMatrix)); EXECUTE_AND_VERIFY_SURFACE_DID_NOT_CHANGE(renderSurface->setReplicaDrawTransform(dummyMatrix)); EXECUTE_AND_VERIFY_SURFACE_DID_NOT_CHANGE(renderSurface->setOriginTransform(dummyMatrix)); - EXECUTE_AND_VERIFY_SURFACE_DID_NOT_CHANGE(renderSurface->setSkipsDraw(true)); EXECUTE_AND_VERIFY_SURFACE_DID_NOT_CHANGE(renderSurface->clearLayerList()); - EXECUTE_AND_VERIFY_SURFACE_DID_NOT_CHANGE(renderSurface->setMaskLayer(dummyMask.get())); } TEST(CCRenderSurfaceTest, sanityCheckSurfaceCreatesCorrectSharedQuadState) @@ -103,8 +102,8 @@ TEST(CCRenderSurfaceTest, sanityCheckSurfaceCreatesCorrectSharedQuadState) IntRect contentRect = IntRect(IntPoint::zero(), IntSize(50, 50)); IntRect clipRect = IntRect(IntPoint(5, 5), IntSize(40, 40)); - TransformationMatrix draw; - TransformationMatrix origin; + WebTransformationMatrix draw; + WebTransformationMatrix origin; draw.translate(30, 40); diff --git a/Source/WebKit/chromium/tests/DecimalTest.cpp b/Source/WebKit/chromium/tests/DecimalTest.cpp new file mode 100644 index 000000000..db69edd38 --- /dev/null +++ b/Source/WebKit/chromium/tests/DecimalTest.cpp @@ -0,0 +1,971 @@ +/* + * Copyright (C) 2012 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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 "Decimal.h" + +#include <gtest/gtest.h> +#include <wtf/MathExtras.h> +#include <wtf/text/CString.h> + +namespace WebCore { + +std::ostream& operator<<(std::ostream& os, const Decimal& decimal) +{ + Decimal::EncodedData data = decimal.value(); + return os + << "encode(" << String::number(data.coefficient()).ascii().data() + << ", " << String::number(data.exponent()).ascii().data() + << ", " << (data.sign() == Decimal::Negative ? "Negative" : "Positive") + << ")=" << decimal.toString().ascii().data(); +} + +} // namespace WebCore + +using namespace WebCore; + +// Simulate WebCore/html/StepRange +class DecimalStepRange { +public: + Decimal maximum; + Decimal minimum; + Decimal step; + + DecimalStepRange(const Decimal& minimum, const Decimal& maximum, const Decimal& step) + : maximum(maximum) + , minimum(minimum) + , step(step) + { + } + + Decimal clampValue(Decimal value) const + { + const Decimal result = minimum + ((value - minimum) / step).round() * step; + ASSERT(result.isFinite()); + return result > maximum ? result - step : result; + } +}; + +class DecimalTest : public ::testing::Test { +protected: + typedef Decimal::Sign Sign; + protected: static const Sign Positive = Decimal::Positive; + protected: static const Sign Negative = Decimal::Negative; + + Decimal encode(uint64_t coefficient, int exponent, Sign sign) + { + return Decimal(sign, exponent, coefficient); + } + + protected: Decimal fromString(const String& string) + { + return Decimal::fromString(string); + } + + protected: String stepDown(const String& minimum, const String& maximum, const String& step, const String& valueString, int numberOfStepTimes) + { + DecimalStepRange stepRange(fromString(minimum), fromString(maximum), fromString(step)); + Decimal value = fromString(valueString); + for (int i = 0; i < numberOfStepTimes; ++i) { + value -= stepRange.step; + value = stepRange.clampValue(value); + } + return value.toString(); + } + + protected: String stepUp(const String& minimum, const String& maximum, const String& step, const String& valueString, int numberOfStepTimes) + { + DecimalStepRange stepRange(fromString(minimum), fromString(maximum), fromString(step)); + Decimal value = fromString(valueString); + for (int i = 0; i < numberOfStepTimes; ++i) { + value += stepRange.step; + value = stepRange.clampValue(value); + } + return value.toString(); + } +}; + +TEST_F(DecimalTest, Abs) +{ + EXPECT_EQ(encode(0, 0, Positive), encode(0, 0, Positive).abs()); + EXPECT_EQ(encode(0, 0, Positive), encode(0, 0, Negative).abs()); + + EXPECT_EQ(encode(0, 10, Positive), encode(0, 10, Positive).abs()); + EXPECT_EQ(encode(0, 10, Positive), encode(0, 10, Negative).abs()); + + EXPECT_EQ(encode(0, -10, Positive), encode(0, -10, Positive).abs()); + EXPECT_EQ(encode(0, -10, Positive), encode(0, -10, Negative).abs()); + + EXPECT_EQ(encode(1, 0, Positive), encode(1, 0, Positive).abs()); + EXPECT_EQ(encode(1, 0, Positive), encode(1, 0, Negative).abs()); + + EXPECT_EQ(encode(1, 10, Positive), encode(1, 10, Positive).abs()); + EXPECT_EQ(encode(1, 10, Positive), encode(1, 10, Negative).abs()); + + EXPECT_EQ(encode(1, -10, Positive), encode(1, -10, Positive).abs()); + EXPECT_EQ(encode(1, -10, Positive), encode(1, -10, Negative).abs()); +} + +TEST_F(DecimalTest, AbsBigExponent) +{ + EXPECT_EQ(encode(1, 1000, Positive), encode(1, 1000, Positive).abs()); + EXPECT_EQ(encode(1, 1000, Positive), encode(1, 1000, Negative).abs()); +} + +TEST_F(DecimalTest, AbsSmallExponent) +{ + EXPECT_EQ(encode(1, -1000, Positive), encode(1, -1000, Positive).abs()); + EXPECT_EQ(encode(1, -1000, Positive), encode(1, -1000, Negative).abs()); +} + +TEST_F(DecimalTest, AbsSpecialValues) +{ + EXPECT_EQ(Decimal::infinity(Positive), Decimal::infinity(Positive).abs()); + EXPECT_EQ(Decimal::infinity(Positive), Decimal::infinity(Negative).abs()); + EXPECT_EQ(Decimal::nan(), Decimal::nan().abs()); +} + +TEST_F(DecimalTest, Add) +{ + EXPECT_EQ(encode(0, 0, Positive), Decimal(0) + Decimal(0)); + EXPECT_EQ(Decimal(1), Decimal(2) + Decimal(-1)); + EXPECT_EQ(Decimal(1), Decimal(-1) + Decimal(2)); + EXPECT_EQ(encode(100, 0, Positive), Decimal(99) + Decimal(1)); + EXPECT_EQ(encode(100, 0, Negative), Decimal(-50) + Decimal(-50)); + EXPECT_EQ(encode(UINT64_C(1000000000000000), 35, Positive), encode(1, 50, Positive) + Decimal(1)); + EXPECT_EQ(encode(UINT64_C(1000000000000000), 35, Positive), Decimal(1) + encode(1, 50, Positive)); + EXPECT_EQ(encode(UINT64_C(10000000001), 0, Positive), encode(1, 10, Positive) + Decimal(1)); + EXPECT_EQ(encode(UINT64_C(10000000001), 0, Positive), Decimal(1) + encode(1, 10, Positive)); + EXPECT_EQ(encode(1, 0, Positive), encode(1, -1022, Positive) + encode(1, 0, Positive)); + EXPECT_EQ(encode(2, -1022, Positive), encode(1, -1022, Positive) + encode(1, -1022, Positive)); +} + +TEST_F(DecimalTest, AddBigExponent) +{ + EXPECT_EQ(encode(1, 1022, Positive), encode(1, 1022, Positive) + encode(1, 0, Positive)); + EXPECT_EQ(encode(2, 1022, Positive), encode(1, 1022, Positive) + encode(1, 1022, Positive)); + EXPECT_EQ(Decimal::infinity(Positive), encode(std::numeric_limits<uint64_t>::max(), 1022, Positive) + encode(1, 0, Positive)); + EXPECT_EQ(encode(1, 1022, Positive), encode(1, 1022, Positive) + encode(1, -1000, Positive)); +} + +TEST_F(DecimalTest, AddSmallExponent) +{ + EXPECT_EQ(encode(1, 0, Positive), encode(1, -1022, Positive) + encode(1, 0, Positive)); + EXPECT_EQ(encode(2, -1022, Positive), encode(1, -1022, Positive) + encode(1, -1022, Positive)); +} + +TEST_F(DecimalTest, AddSpecialValues) +{ + const Decimal Infinity(Decimal::infinity(Positive)); + const Decimal MinusInfinity(Decimal::infinity(Negative)); + const Decimal NaN(Decimal::nan()); + const Decimal Ten(10); + + EXPECT_EQ(Infinity, Infinity + Infinity); + EXPECT_EQ(NaN, Infinity + MinusInfinity); + EXPECT_EQ(NaN, MinusInfinity + Infinity); + EXPECT_EQ(MinusInfinity, MinusInfinity + MinusInfinity); + + EXPECT_EQ(Infinity, Infinity + Ten); + EXPECT_EQ(Infinity, Ten + Infinity); + EXPECT_EQ(MinusInfinity, MinusInfinity + Ten); + EXPECT_EQ(MinusInfinity, Ten + MinusInfinity); + + EXPECT_EQ(NaN, NaN + NaN); + EXPECT_EQ(NaN, NaN + Ten); + EXPECT_EQ(NaN, Ten + NaN); + + EXPECT_EQ(NaN, NaN - Infinity); + EXPECT_EQ(NaN, NaN - MinusInfinity); + EXPECT_EQ(NaN, Infinity - NaN); + EXPECT_EQ(NaN, MinusInfinity - NaN); +} + +TEST_F(DecimalTest, Ceiling) +{ + EXPECT_EQ(Decimal(1), Decimal(1).ceiling()); + EXPECT_EQ(Decimal(2), encode(11, -1, Positive).ceiling()); + EXPECT_EQ(Decimal(2), encode(13, -1, Positive).ceiling()); + EXPECT_EQ(Decimal(2), encode(15, -1, Positive).ceiling()); + EXPECT_EQ(Decimal(2), encode(19, -1, Positive).ceiling()); + + EXPECT_EQ(Decimal(-1), Decimal(-1).ceiling()); + EXPECT_EQ(Decimal(-1), encode(11, -1, Negative).ceiling()); + EXPECT_EQ(Decimal(-1), encode(13, -1, Negative).ceiling()); + EXPECT_EQ(Decimal(-1), encode(15, -1, Negative).ceiling()); + EXPECT_EQ(Decimal(-1), encode(19, -1, Negative).ceiling()); +} + +TEST_F(DecimalTest, CeilingBigExponent) +{ + EXPECT_EQ(encode(1, 1000, Positive), encode(1, 1000, Positive).ceiling()); + EXPECT_EQ(encode(1, 1000, Negative), encode(1, 1000, Negative).ceiling()); +} + +TEST_F(DecimalTest, CeilingSmallExponent) +{ + EXPECT_EQ(encode(0, 0, Positive), encode(1, -1000, Positive).ceiling()); + EXPECT_EQ(encode(0, 0, Negative), encode(1, -1000, Negative).ceiling()); +} + +TEST_F(DecimalTest, CeilingSpecialValues) +{ + EXPECT_EQ(Decimal::infinity(Positive), Decimal::infinity(Positive).ceiling()); + EXPECT_EQ(Decimal::infinity(Negative), Decimal::infinity(Negative).ceiling()); + EXPECT_EQ(Decimal::nan(), Decimal::nan().ceiling()); +} + +TEST_F(DecimalTest, Compare) +{ + EXPECT_TRUE(Decimal(0) == Decimal(0)); + EXPECT_TRUE(Decimal(0) != Decimal(1)); + EXPECT_TRUE(Decimal(0) < Decimal(1)); + EXPECT_TRUE(Decimal(0) <= Decimal(0)); + EXPECT_TRUE(Decimal(0) > Decimal(-1)); + EXPECT_TRUE(Decimal(0) >= Decimal(0)); + + EXPECT_FALSE(Decimal(1) == Decimal(2)); + EXPECT_FALSE(Decimal(1) != Decimal(1)); + EXPECT_FALSE(Decimal(1) < Decimal(0)); + EXPECT_FALSE(Decimal(1) <= Decimal(0)); + EXPECT_FALSE(Decimal(1) > Decimal(2)); + EXPECT_FALSE(Decimal(1) >= Decimal(2)); +} + +TEST_F(DecimalTest, CompareBigExponent) +{ + EXPECT_TRUE(encode(1, 1000, Positive) == encode(1, 1000, Positive)); + EXPECT_FALSE(encode(1, 1000, Positive) != encode(1, 1000, Positive)); + EXPECT_FALSE(encode(1, 1000, Positive) < encode(1, 1000, Positive)); + EXPECT_TRUE(encode(1, 1000, Positive) <= encode(1, 1000, Positive)); + EXPECT_FALSE(encode(1, 1000, Positive) > encode(1, 1000, Positive)); + EXPECT_TRUE(encode(1, 1000, Positive) >= encode(1, 1000, Positive)); + + EXPECT_TRUE(encode(1, 1000, Negative) == encode(1, 1000, Negative)); + EXPECT_FALSE(encode(1, 1000, Negative) != encode(1, 1000, Negative)); + EXPECT_FALSE(encode(1, 1000, Negative) < encode(1, 1000, Negative)); + EXPECT_TRUE(encode(1, 1000, Negative) <= encode(1, 1000, Negative)); + EXPECT_FALSE(encode(1, 1000, Negative) > encode(1, 1000, Negative)); + EXPECT_TRUE(encode(1, 1000, Negative) >= encode(1, 1000, Negative)); + + EXPECT_FALSE(encode(2, 1000, Positive) == encode(1, 1000, Positive)); + EXPECT_TRUE(encode(2, 1000, Positive) != encode(1, 1000, Positive)); + EXPECT_FALSE(encode(2, 1000, Positive) < encode(1, 1000, Positive)); + EXPECT_FALSE(encode(2, 1000, Positive) <= encode(1, 1000, Positive)); + EXPECT_TRUE(encode(2, 1000, Positive) > encode(1, 1000, Positive)); + EXPECT_TRUE(encode(2, 1000, Positive) >= encode(1, 1000, Positive)); + + EXPECT_FALSE(encode(2, 1000, Negative) == encode(1, 1000, Negative)); + EXPECT_TRUE(encode(2, 1000, Negative) != encode(1, 1000, Negative)); + EXPECT_TRUE(encode(2, 1000, Negative) < encode(1, 1000, Negative)); + EXPECT_TRUE(encode(2, 1000, Negative) <= encode(1, 1000, Negative)); + EXPECT_FALSE(encode(2, 1000, Negative) > encode(1, 1000, Negative)); + EXPECT_FALSE(encode(2, 1000, Negative) >= encode(1, 1000, Negative)); +} + +TEST_F(DecimalTest, CompareSmallExponent) +{ + EXPECT_TRUE(encode(1, -1000, Positive) == encode(1, -1000, Positive)); + EXPECT_FALSE(encode(1, -1000, Positive) != encode(1, -1000, Positive)); + EXPECT_FALSE(encode(1, -1000, Positive) < encode(1, -1000, Positive)); + EXPECT_TRUE(encode(1, -1000, Positive) <= encode(1, -1000, Positive)); + EXPECT_FALSE(encode(1, -1000, Positive) > encode(1, -1000, Positive)); + EXPECT_TRUE(encode(1, -1000, Positive) >= encode(1, -1000, Positive)); + + EXPECT_TRUE(encode(1, -1000, Negative) == encode(1, -1000, Negative)); + EXPECT_FALSE(encode(1, -1000, Negative) != encode(1, -1000, Negative)); + EXPECT_FALSE(encode(1, -1000, Negative) < encode(1, -1000, Negative)); + EXPECT_TRUE(encode(1, -1000, Negative) <= encode(1, -1000, Negative)); + EXPECT_FALSE(encode(1, -1000, Negative) > encode(1, -1000, Negative)); + EXPECT_TRUE(encode(1, -1000, Negative) >= encode(1, -1000, Negative)); + + EXPECT_FALSE(encode(2, -1000, Positive) == encode(1, -1000, Positive)); + EXPECT_TRUE(encode(2, -1000, Positive) != encode(1, -1000, Positive)); + EXPECT_FALSE(encode(2, -1000, Positive) < encode(1, -1000, Positive)); + EXPECT_FALSE(encode(2, -1000, Positive) <= encode(1, -1000, Positive)); + EXPECT_TRUE(encode(2, -1000, Positive) > encode(1, -1000, Positive)); + EXPECT_TRUE(encode(2, -1000, Positive) >= encode(1, -1000, Positive)); + + EXPECT_FALSE(encode(2, -1000, Negative) == encode(1, -1000, Negative)); + EXPECT_TRUE(encode(2, -1000, Negative) != encode(1, -1000, Negative)); + EXPECT_TRUE(encode(2, -1000, Negative) < encode(1, -1000, Negative)); + EXPECT_TRUE(encode(2, -1000, Negative) <= encode(1, -1000, Negative)); + EXPECT_FALSE(encode(2, -1000, Negative) > encode(1, -1000, Negative)); + EXPECT_FALSE(encode(2, -1000, Negative) >= encode(1, -1000, Negative)); +} + +TEST_F(DecimalTest, CompareSpecialValues) +{ + const Decimal Infinity(Decimal::infinity(Positive)); + const Decimal MinusInfinity(Decimal::infinity(Negative)); + const Decimal NaN(Decimal::nan()); + const Decimal Zero(Decimal::zero(Positive)); + const Decimal MinusZero(Decimal::zero(Negative)); + const Decimal Ten(10); + + EXPECT_TRUE(Zero == Zero); + EXPECT_FALSE(Zero != Zero); + EXPECT_FALSE(Zero < Zero); + EXPECT_TRUE(Zero <= Zero); + EXPECT_FALSE(Zero > Zero); + EXPECT_TRUE(Zero >= Zero); + + EXPECT_TRUE(Zero == MinusZero); + EXPECT_FALSE(Zero != MinusZero); + EXPECT_FALSE(Zero < MinusZero); + EXPECT_TRUE(Zero <= MinusZero); + EXPECT_FALSE(Zero > MinusZero); + EXPECT_TRUE(Zero >= MinusZero); + + EXPECT_TRUE(MinusZero == Zero); + EXPECT_FALSE(MinusZero != Zero); + EXPECT_FALSE(MinusZero < Zero); + EXPECT_TRUE(MinusZero <= Zero); + EXPECT_FALSE(MinusZero > Zero); + EXPECT_TRUE(MinusZero >= Zero); + + EXPECT_TRUE(MinusZero == MinusZero); + EXPECT_FALSE(MinusZero != MinusZero); + EXPECT_FALSE(MinusZero < MinusZero); + EXPECT_TRUE(MinusZero <= MinusZero); + EXPECT_FALSE(MinusZero > MinusZero); + EXPECT_TRUE(MinusZero >= MinusZero); + + EXPECT_TRUE(Infinity == Infinity); + EXPECT_FALSE(Infinity != Infinity); + EXPECT_FALSE(Infinity < Infinity); + EXPECT_TRUE(Infinity <= Infinity); + EXPECT_FALSE(Infinity > Infinity); + EXPECT_TRUE(Infinity >= Infinity); + + EXPECT_FALSE(Infinity == Ten); + EXPECT_TRUE(Infinity != Ten); + EXPECT_FALSE(Infinity < Ten); + EXPECT_FALSE(Infinity <= Ten); + EXPECT_TRUE(Infinity > Ten); + EXPECT_TRUE(Infinity >= Ten); + + EXPECT_FALSE(Infinity == MinusInfinity); + EXPECT_TRUE(Infinity != MinusInfinity); + EXPECT_FALSE(Infinity < MinusInfinity); + EXPECT_FALSE(Infinity <= MinusInfinity); + EXPECT_TRUE(Infinity > MinusInfinity); + EXPECT_TRUE(Infinity >= MinusInfinity); + + EXPECT_FALSE(Infinity == NaN); + EXPECT_FALSE(Infinity != NaN); + EXPECT_FALSE(Infinity < NaN); + EXPECT_FALSE(Infinity <= NaN); + EXPECT_FALSE(Infinity > NaN); + EXPECT_FALSE(Infinity >= NaN); + + EXPECT_FALSE(MinusInfinity == Infinity); + EXPECT_TRUE(MinusInfinity != Infinity); + EXPECT_TRUE(MinusInfinity < Infinity); + EXPECT_TRUE(MinusInfinity <= Infinity); + EXPECT_FALSE(MinusInfinity > Infinity); + EXPECT_FALSE(MinusInfinity >= Infinity); + + EXPECT_FALSE(MinusInfinity == Ten); + EXPECT_TRUE(MinusInfinity != Ten); + EXPECT_TRUE(MinusInfinity < Ten); + EXPECT_TRUE(MinusInfinity <= Ten); + EXPECT_FALSE(MinusInfinity > Ten); + EXPECT_FALSE(MinusInfinity >= Ten); + + EXPECT_TRUE(MinusInfinity == MinusInfinity); + EXPECT_FALSE(MinusInfinity != MinusInfinity); + EXPECT_FALSE(MinusInfinity < MinusInfinity); + EXPECT_TRUE(MinusInfinity <= MinusInfinity); + EXPECT_FALSE(MinusInfinity > MinusInfinity); + EXPECT_TRUE(MinusInfinity >= MinusInfinity); + + EXPECT_FALSE(MinusInfinity == NaN); + EXPECT_FALSE(MinusInfinity != NaN); + EXPECT_FALSE(MinusInfinity < NaN); + EXPECT_FALSE(MinusInfinity <= NaN); + EXPECT_FALSE(MinusInfinity > NaN); + EXPECT_FALSE(MinusInfinity >= NaN); + + EXPECT_FALSE(NaN == Infinity); + EXPECT_FALSE(NaN != Infinity); + EXPECT_FALSE(NaN < Infinity); + EXPECT_FALSE(NaN <= Infinity); + EXPECT_FALSE(NaN > Infinity); + EXPECT_FALSE(NaN >= Infinity); + + EXPECT_FALSE(NaN == Ten); + EXPECT_FALSE(NaN != Ten); + EXPECT_FALSE(NaN < Ten); + EXPECT_FALSE(NaN <= Ten); + EXPECT_FALSE(NaN > Ten); + EXPECT_FALSE(NaN >= Ten); + + EXPECT_FALSE(NaN == MinusInfinity); + EXPECT_FALSE(NaN != MinusInfinity); + EXPECT_FALSE(NaN < MinusInfinity); + EXPECT_FALSE(NaN <= MinusInfinity); + EXPECT_FALSE(NaN > MinusInfinity); + EXPECT_FALSE(NaN >= MinusInfinity); + + EXPECT_TRUE(NaN == NaN); + EXPECT_FALSE(NaN != NaN); + EXPECT_FALSE(NaN < NaN); + EXPECT_TRUE(NaN <= NaN); + EXPECT_FALSE(NaN > NaN); + EXPECT_TRUE(NaN >= NaN); +} + +TEST_F(DecimalTest, Division) +{ + EXPECT_EQ(encode(0, 0, Positive), Decimal(0) / Decimal(1)); + EXPECT_EQ(encode(2, 0, Negative), Decimal(2) / Decimal(-1)); + EXPECT_EQ(encode(5, -1, Negative), Decimal(-1) / Decimal(2)); + EXPECT_EQ(encode(99, 0, Positive), Decimal(99) / Decimal(1)); + EXPECT_EQ(Decimal(1), Decimal(-50) / Decimal(-50)); + EXPECT_EQ(encode(UINT64_C(3333333333333333), -16, Positive), Decimal(1) / Decimal(3)); + EXPECT_EQ(encode(UINT64_C(12345678901234), -1, Positive), encode(UINT64_C(12345678901234), 0, Positive) / Decimal(10)); +} + +TEST_F(DecimalTest, DivisionBigExponent) +{ + EXPECT_EQ(encode(1, 1022, Positive), encode(1, 1022, Positive) / encode(1, 0, Positive)); + EXPECT_EQ(encode(1, 0, Positive), encode(1, 1022, Positive) / encode(1, 1022, Positive)); + EXPECT_EQ(Decimal::infinity(Positive), encode(1, 1022, Positive) / encode(1, -1000, Positive)); +} + +TEST_F(DecimalTest, DivisionSmallExponent) +{ + EXPECT_EQ(encode(1, -1022, Positive), encode(1, -1022, Positive) / encode(1, 0, Positive)); + EXPECT_EQ(encode(1, 0, Positive), encode(1, -1022, Positive) / encode(1, -1022, Positive)); +} + +TEST_F(DecimalTest, DivisionSpecialValues) +{ + const Decimal Infinity(Decimal::infinity(Positive)); + const Decimal MinusInfinity(Decimal::infinity(Negative)); + const Decimal NaN(Decimal::nan()); + const Decimal Zero(Decimal::zero(Positive)); + const Decimal MinusZero(Decimal::zero(Negative)); + const Decimal Ten(10); + const Decimal MinusTen(-10); + + EXPECT_EQ(NaN, Zero / Zero); + EXPECT_EQ(NaN, Zero / MinusZero); + EXPECT_EQ(NaN, MinusZero / Zero); + EXPECT_EQ(NaN, MinusZero / MinusZero); + + EXPECT_EQ(Infinity, Ten / Zero); + EXPECT_EQ(MinusInfinity, Ten / MinusZero); + EXPECT_EQ(MinusInfinity, MinusTen / Zero); + EXPECT_EQ(Infinity, MinusTen / MinusZero); + + EXPECT_EQ(Infinity, Infinity / Zero); + EXPECT_EQ(MinusInfinity, Infinity / MinusZero); + EXPECT_EQ(MinusInfinity, MinusInfinity / Zero); + EXPECT_EQ(Infinity, MinusInfinity / MinusZero); + + EXPECT_EQ(NaN, Infinity / Infinity); + EXPECT_EQ(NaN, Infinity / MinusInfinity); + EXPECT_EQ(NaN, MinusInfinity / Infinity); + EXPECT_EQ(NaN, MinusInfinity / MinusInfinity); + + EXPECT_EQ(Zero, Ten / Infinity); + EXPECT_EQ(MinusZero, Ten / MinusInfinity); + EXPECT_EQ(MinusZero, MinusTen / Infinity); + EXPECT_EQ(Zero, MinusTen / MinusInfinity); + + EXPECT_EQ(NaN, NaN / NaN); + EXPECT_EQ(NaN, NaN / Ten); + EXPECT_EQ(NaN, Ten / NaN); + + EXPECT_EQ(NaN, NaN / Infinity); + EXPECT_EQ(NaN, NaN / MinusInfinity); + EXPECT_EQ(NaN, Infinity / NaN); + EXPECT_EQ(NaN, MinusInfinity / NaN); +} + +TEST_F(DecimalTest, EncodedData) +{ + EXPECT_EQ(encode(0, 0, Positive), encode(0, 0, Positive)); + EXPECT_EQ(encode(0, 0, Negative), encode(0, 0, Negative)); + EXPECT_EQ(Decimal(1), Decimal(1)); + EXPECT_EQ(encode(1, 0, Negative), encode(1, 0, Negative)); + EXPECT_EQ(Decimal::infinity(Positive), encode(1, 2000, Positive)); + EXPECT_EQ(Decimal::zero(Positive), encode(1, -2000, Positive)); +} + +TEST_F(DecimalTest, Floor) +{ + EXPECT_EQ(Decimal(1), Decimal(1).floor()); + EXPECT_EQ(Decimal(1), encode(11, -1, Positive).floor()); + EXPECT_EQ(Decimal(1), encode(13, -1, Positive).floor()); + EXPECT_EQ(Decimal(1), encode(15, -1, Positive).floor()); + EXPECT_EQ(Decimal(1), encode(19, -1, Positive).floor()); + + EXPECT_EQ(Decimal(-1), Decimal(-1).floor()); + EXPECT_EQ(Decimal(-2), encode(11, -1, Negative).floor()); + EXPECT_EQ(Decimal(-2), encode(13, -1, Negative).floor()); + EXPECT_EQ(Decimal(-2), encode(15, -1, Negative).floor()); + EXPECT_EQ(Decimal(-2), encode(19, -1, Negative).floor()); +} + +TEST_F(DecimalTest, FloorBigExponent) +{ + EXPECT_EQ(encode(1, 1000, Positive), encode(1, 1000, Positive).floor()); + EXPECT_EQ(encode(1, 1000, Negative), encode(1, 1000, Negative).floor()); +} + +TEST_F(DecimalTest, FloorSmallExponent) +{ + EXPECT_EQ(encode(0, 0, Positive), encode(1, -1000, Positive).floor()); + EXPECT_EQ(encode(0, 0, Negative), encode(1, -1000, Negative).floor()); +} + +TEST_F(DecimalTest, FloorSpecialValues) +{ + EXPECT_EQ(Decimal::infinity(Positive), Decimal::infinity(Positive).floor()); + EXPECT_EQ(Decimal::infinity(Negative), Decimal::infinity(Negative).floor()); + EXPECT_EQ(Decimal::nan(), Decimal::nan().floor()); +} + +TEST_F(DecimalTest, FromInt32) +{ + EXPECT_EQ(encode(0, 0, Positive), Decimal(0)); + EXPECT_EQ(encode(1, 0, Positive), Decimal(1)); + EXPECT_EQ(encode(1, 0, Negative), Decimal(-1)); + EXPECT_EQ(encode(100, 0, Positive), Decimal(100)); + EXPECT_EQ(encode(100, 0, Negative), Decimal(-100)); + EXPECT_EQ(encode(0x7FFFFFFF, 0, Positive), Decimal(std::numeric_limits<int32_t>::max())); + EXPECT_EQ(encode(0x80000000u, 0, Negative), Decimal(std::numeric_limits<int32_t>::min())); +} + +TEST_F(DecimalTest, FromString) +{ + EXPECT_EQ(encode(0, 0, Positive), fromString("0")); + EXPECT_EQ(encode(0, 0, Negative), fromString("-0")); + EXPECT_EQ(Decimal(1), fromString("1")); + EXPECT_EQ(encode(1, 0, Negative), fromString("-1")); + EXPECT_EQ(Decimal(1), fromString("01")); + EXPECT_EQ(encode(3, 0, Positive), fromString("+3")); + EXPECT_EQ(encode(0, 3, Positive), fromString("0E3")); + EXPECT_EQ(encode(5, -1, Positive), fromString(".5")); + EXPECT_EQ(encode(100, 0, Positive), fromString("100")); + EXPECT_EQ(encode(100, 0, Negative), fromString("-100")); + EXPECT_EQ(encode(123, -2, Positive), fromString("1.23")); + EXPECT_EQ(encode(123, -2, Negative), fromString("-1.23")); + EXPECT_EQ(encode(123, 8, Positive), fromString("1.23E10")); + EXPECT_EQ(encode(123, 8, Negative), fromString("-1.23E10")); + EXPECT_EQ(encode(123, 8, Positive), fromString("1.23E+10")); + EXPECT_EQ(encode(123, 8, Negative), fromString("-1.23E+10")); + EXPECT_EQ(encode(123, -12, Positive), fromString("1.23E-10")); + EXPECT_EQ(encode(123, -12, Negative), fromString("-1.23E-10")); + EXPECT_EQ(encode(5, -7, Positive), fromString("0.0000005")); + EXPECT_EQ(encode(0, 0, Positive), fromString("0e9999")); + EXPECT_EQ(encode(123, -3, Positive), fromString("0.123")); + EXPECT_EQ(encode(0, -2, Positive), fromString("00.00")); + EXPECT_EQ(encode(1, 2, Positive), fromString("1E2")); + EXPECT_EQ(Decimal::infinity(Positive), fromString("1E20000")); + EXPECT_EQ(Decimal::zero(Positive), fromString("1E-20000")); + EXPECT_EQ(encode(1000, 1023, Positive), fromString("1E1026")); + EXPECT_EQ(Decimal::zero(Positive), fromString("1E-1026")); + EXPECT_EQ(Decimal::infinity(Positive), fromString("1234567890E1036")); + + // 2^1024 + const uint64_t leadingDigitsOf2PowerOf1024 = UINT64_C(17976931348623159); + EXPECT_EQ(encode(leadingDigitsOf2PowerOf1024, 292, Positive), fromString("179769313486231590772930519078902473361797697894230657273430081157732675805500963132708477322407536021120113879871393357658789768814416622492847430639474124377767893424865485276302219601246094119453082952085005768838150682342462881473913110540827237163350510684586298239947245938479716304835356329624224137216")); +} + +// These strings are look like proper number, but we don't accept them. +TEST_F(DecimalTest, FromStringLikeNumber) +{ + EXPECT_EQ(Decimal::nan(), fromString(" 123 ")); + EXPECT_EQ(Decimal::nan(), fromString("1,234")); +} + +// fromString doesn't support infinity and NaN. +TEST_F(DecimalTest, FromStringSpecialValues) +{ + EXPECT_EQ(Decimal::nan(), fromString("INF")); + EXPECT_EQ(Decimal::nan(), fromString("Infinity")); + EXPECT_EQ(Decimal::nan(), fromString("infinity")); + EXPECT_EQ(Decimal::nan(), fromString("+Infinity")); + EXPECT_EQ(Decimal::nan(), fromString("+infinity")); + EXPECT_EQ(Decimal::nan(), fromString("-Infinity")); + EXPECT_EQ(Decimal::nan(), fromString("-infinity")); + EXPECT_EQ(Decimal::nan(), fromString("NaN")); + EXPECT_EQ(Decimal::nan(), fromString("nan")); + EXPECT_EQ(Decimal::nan(), fromString("+NaN")); + EXPECT_EQ(Decimal::nan(), fromString("+nan")); + EXPECT_EQ(Decimal::nan(), fromString("-NaN")); + EXPECT_EQ(Decimal::nan(), fromString("-nan")); +} + +TEST_F(DecimalTest, fromStringTruncated) +{ + EXPECT_EQ(Decimal::nan(), fromString("x")); + EXPECT_EQ(Decimal::nan(), fromString("0.")); + EXPECT_EQ(Decimal::nan(), fromString("1x")); + + EXPECT_EQ(Decimal::nan(), fromString("1Ex")); + EXPECT_EQ(Decimal::nan(), fromString("1E2x")); + EXPECT_EQ(Decimal::nan(), fromString("1E+x")); +} + +TEST_F(DecimalTest, Multiplication) +{ + EXPECT_EQ(encode(0, 0, Positive), Decimal(0) * Decimal(0)); + EXPECT_EQ(encode(2, 0, Negative), Decimal(2) * Decimal(-1)); + EXPECT_EQ(encode(2, 0, Negative), Decimal(-1) * Decimal(2)); + EXPECT_EQ(encode(99, 0, Positive), Decimal(99) * Decimal(1)); + EXPECT_EQ(encode(2500, 0, Positive), Decimal(-50) * Decimal(-50)); +} + +TEST_F(DecimalTest, MultiplicationBigExponent) +{ + EXPECT_EQ(encode(1, 1022, Positive), encode(1, 1022, Positive) * encode(1, 0, Positive)); + EXPECT_EQ(Decimal::infinity(Positive), encode(1, 1022, Positive) * encode(1, 1022, Positive)); + EXPECT_EQ(encode(1, 22, Positive), encode(1, 1022, Positive) * encode(1, -1000, Positive)); +} + +TEST_F(DecimalTest, MultiplicationSmallExponent) +{ + EXPECT_EQ(encode(1, -1022, Positive), encode(1, -1022, Positive) * encode(1, 0, Positive)); + EXPECT_EQ(encode(0, 0, Positive), encode(1, -1022, Positive) * encode(1, -1022, Positive)); +} + +TEST_F(DecimalTest, MultiplicationSpecialValues) +{ + const Decimal Infinity(Decimal::infinity(Positive)); + const Decimal MinusInfinity(Decimal::infinity(Negative)); + const Decimal NaN(Decimal::nan()); + const Decimal Ten(10); + const Decimal MinusTen(-10); + const Decimal Zero(Decimal::zero(Positive)); + const Decimal MinusZero(Decimal::zero(Negative)); + + EXPECT_EQ(Infinity, Infinity * Infinity); + EXPECT_EQ(MinusInfinity, Infinity * MinusInfinity); + EXPECT_EQ(MinusInfinity, MinusInfinity * Infinity); + EXPECT_EQ(Infinity, MinusInfinity * MinusInfinity); + + EXPECT_EQ(NaN, Infinity * Zero); + EXPECT_EQ(NaN, Zero * MinusInfinity); + EXPECT_EQ(NaN, MinusInfinity * Zero); + EXPECT_EQ(NaN, MinusInfinity * Zero); + + EXPECT_EQ(NaN, Infinity * MinusZero); + EXPECT_EQ(NaN, MinusZero * MinusInfinity); + EXPECT_EQ(NaN, MinusInfinity * MinusZero); + EXPECT_EQ(NaN, MinusInfinity * MinusZero); + + EXPECT_EQ(Infinity, Infinity * Ten); + EXPECT_EQ(Infinity, Ten * Infinity); + EXPECT_EQ(MinusInfinity, MinusInfinity * Ten); + EXPECT_EQ(MinusInfinity, Ten * MinusInfinity); + + EXPECT_EQ(MinusInfinity, Infinity * MinusTen); + EXPECT_EQ(MinusInfinity, MinusTen * Infinity); + EXPECT_EQ(Infinity, MinusInfinity * MinusTen); + EXPECT_EQ(Infinity, MinusTen * MinusInfinity); + + EXPECT_EQ(NaN, NaN * NaN); + EXPECT_EQ(NaN, NaN * Ten); + EXPECT_EQ(NaN, Ten * NaN); + + EXPECT_EQ(NaN, NaN * Infinity); + EXPECT_EQ(NaN, NaN * MinusInfinity); + EXPECT_EQ(NaN, Infinity * NaN); + EXPECT_EQ(NaN, MinusInfinity * NaN); +} + +TEST_F(DecimalTest, Negate) +{ + EXPECT_EQ(encode(0, 0, Negative), -encode(0, 0, Positive)); + EXPECT_EQ(encode(0, 0, Positive), -encode(0, 0, Negative)); + + EXPECT_EQ(encode(0, 10, Negative), -encode(0, 10, Positive)); + EXPECT_EQ(encode(0, 10, Positive), -encode(0, 10, Negative)); + + EXPECT_EQ(encode(0, -10, Negative), -encode(0, -10, Positive)); + EXPECT_EQ(encode(0, -10, Positive), -encode(0, -10, Negative)); + + EXPECT_EQ(encode(1, 0, Negative), -encode(1, 0, Positive)); + EXPECT_EQ(encode(1, 0, Positive), -encode(1, 0, Negative)); + + EXPECT_EQ(encode(1, 10, Negative), -encode(1, 10, Positive)); + EXPECT_EQ(encode(1, 10, Positive), -encode(1, 10, Negative)); + + EXPECT_EQ(encode(1, -10, Negative), -encode(1, -10, Positive)); + EXPECT_EQ(encode(1, -10, Positive), -encode(1, -10, Negative)); +} + +TEST_F(DecimalTest, NegateBigExponent) +{ + EXPECT_EQ(encode(1, 1000, Negative), -encode(1, 1000, Positive)); + EXPECT_EQ(encode(1, 1000, Positive), -encode(1, 1000, Negative)); +} + +TEST_F(DecimalTest, NegateSmallExponent) +{ + EXPECT_EQ(encode(1, -1000, Negative), -encode(1, -1000, Positive)); + EXPECT_EQ(encode(1, -1000, Positive), -encode(1, -1000, Negative)); +} + +TEST_F(DecimalTest, NegateSpecialValues) +{ + EXPECT_EQ(Decimal::infinity(Negative), -Decimal::infinity(Positive)); + EXPECT_EQ(Decimal::infinity(Positive), -Decimal::infinity(Negative)); + EXPECT_EQ(Decimal::nan(), -Decimal::nan()); +} + +TEST_F(DecimalTest, Predicates) +{ + EXPECT_TRUE(Decimal::zero(Positive).isFinite()); + EXPECT_TRUE(Decimal::zero(Positive).isPositive()); + EXPECT_FALSE(Decimal::zero(Positive).isNegative()); + EXPECT_FALSE(Decimal::zero(Positive).isSpecial()); + EXPECT_TRUE(Decimal::zero(Positive).isZero()); + + EXPECT_TRUE(Decimal::zero(Negative).isFinite()); + EXPECT_FALSE(Decimal::zero(Negative).isPositive()); + EXPECT_TRUE(Decimal::zero(Negative).isNegative()); + EXPECT_FALSE(Decimal::zero(Negative).isSpecial()); + EXPECT_TRUE(Decimal::zero(Negative).isZero()); + + EXPECT_TRUE(Decimal(123).isFinite()); + EXPECT_TRUE(Decimal(123).isPositive()); + EXPECT_FALSE(Decimal(123).isNegative()); + EXPECT_FALSE(Decimal(123).isSpecial()); + EXPECT_FALSE(Decimal(123).isZero()); + + EXPECT_TRUE(Decimal(-123).isFinite()); + EXPECT_FALSE(Decimal(-123).isPositive()); + EXPECT_TRUE(Decimal(-123).isNegative()); + EXPECT_FALSE(Decimal(-123).isSpecial()); + EXPECT_FALSE(Decimal(-123).isZero()); +} + +TEST_F(DecimalTest, PredicatesSpecialValues) +{ + EXPECT_FALSE(Decimal::infinity(Positive).isFinite()); + EXPECT_TRUE(Decimal::infinity(Positive).isPositive()); + EXPECT_FALSE(Decimal::infinity(Positive).isNegative()); + EXPECT_TRUE(Decimal::infinity(Positive).isSpecial()); + EXPECT_FALSE(Decimal::infinity(Positive).isZero()); + + EXPECT_FALSE(Decimal::infinity(Negative).isFinite()); + EXPECT_FALSE(Decimal::infinity(Negative).isPositive()); + EXPECT_TRUE(Decimal::infinity(Negative).isNegative()); + EXPECT_TRUE(Decimal::infinity(Negative).isSpecial()); + EXPECT_FALSE(Decimal::infinity(Negative).isZero()); + + EXPECT_FALSE(Decimal::nan().isFinite()); + EXPECT_TRUE(Decimal::nan().isSpecial()); + EXPECT_FALSE(Decimal::nan().isZero()); +} + +// LayoutTests/fast/forms/number/number-stepup-stepdown-from-renderer +TEST_F(DecimalTest, RealWorldExampleNumberStepUpStepDownFromRenderer) +{ + EXPECT_EQ(String("10"), stepDown("0", "100", "10", "19", 1)); + EXPECT_EQ(String("90"), stepUp("0", "99", "10", "89", 1)); + EXPECT_EQ(String("1"), stepUp("0", "1", "0.33333333333333333", "0", 3)); // step=1/3 + EXPECT_EQ(String("0.01"), stepUp("0", "0.01", "0.0033333333333333333", "0", 3)); // step=1/300 + EXPECT_EQ(String("1"), stepUp("0", "1", "0.003921568627450980", "0", 255)); // step=1/255 + EXPECT_EQ(String("1"), stepUp("0", "1", "0.1", "0", 10)); +} + +TEST_F(DecimalTest, RealWorldExampleNumberStepUpStepDownFromRendererRounding) +{ + EXPECT_EQ(String("5.015"), stepUp("0", "100", "0.005", "5.005", 2)); + EXPECT_EQ(String("5.06"), stepUp("0", "100", "0.005", "5.005", 11)); + EXPECT_EQ(String("5.065"), stepUp("0", "100", "0.005", "5.005", 12)); + + EXPECT_EQ(String("5.015"), stepUp("4", "9", "0.005", "5.005", 2)); + EXPECT_EQ(String("5.06"), stepUp("4", "9", "0.005", "5.005", 11)); + EXPECT_EQ(String("5.065"), stepUp("4", "9", "0.005", "5.005", 12)); +} + +TEST_F(DecimalTest, RealWorldExampleRangeStepUpStepDown) +{ + EXPECT_EQ(String("1e+38"), stepUp("0", "1E38", "1", "1E38", 9)); + EXPECT_EQ(String("1e+38"), stepDown("0", "1E38", "1", "1E38", 9)); +} + +TEST_F(DecimalTest, Remainder) +{ + EXPECT_EQ(encode(9, -1, Negative), encode(21, -1, Positive).remainder(3)); + EXPECT_EQ(Decimal(1), Decimal(10).remainder(3)); + EXPECT_EQ(encode(1, 0, Negative), Decimal(-10).remainder(3)); + EXPECT_EQ(encode(2, -1, Positive), encode(102, -1, Positive).remainder(1)); + EXPECT_EQ(encode(1, -1, Positive), Decimal(10).remainder(encode(3, -1, Positive))); + EXPECT_EQ(encode(3, -1, Negative), encode(36, -1, Positive).remainder(encode(13, -1, Positive))); + EXPECT_EQ(encode(1, 87, Positive), (encode(1234, 100, Positive).remainder(Decimal(3)))); +} + +TEST_F(DecimalTest, RemainderBigExponent) +{ + EXPECT_EQ(encode(0, 1022, Positive), encode(1, 1022, Positive).remainder(encode(1, 0, Positive))); + EXPECT_EQ(encode(0, 1022, Positive), encode(1, 1022, Positive).remainder(encode(1, 1022, Positive))); + EXPECT_EQ(Decimal::infinity(Positive), encode(1, 1022, Positive).remainder(encode(1, -1000, Positive))); +} + +TEST_F(DecimalTest, RemainderSmallExponent) +{ + EXPECT_EQ(encode(1, -1022, Positive), encode(1, -1022, Positive).remainder(encode(1, 0, Positive))); + EXPECT_EQ(encode(0, -1022, Positive), encode(1, -1022, Positive).remainder(encode(1, -1022, Positive))); +} + +TEST_F(DecimalTest, RemainderSpecialValues) +{ + EXPECT_EQ(Decimal::infinity(Positive), Decimal::infinity(Positive).remainder(1)); + EXPECT_EQ(Decimal::infinity(Negative), Decimal::infinity(Negative).remainder(1)); + EXPECT_EQ(Decimal::nan(), Decimal::nan().remainder(1)); + + EXPECT_EQ(Decimal::infinity(Negative), Decimal::infinity(Positive).remainder(-1)); + EXPECT_EQ(Decimal::infinity(Positive), Decimal::infinity(Negative).remainder(-1)); + EXPECT_EQ(Decimal::nan(), Decimal::nan().remainder(-1)); + + EXPECT_EQ(Decimal::infinity(Positive), Decimal::infinity(Positive).remainder(3)); + EXPECT_EQ(Decimal::infinity(Negative), Decimal::infinity(Negative).remainder(3)); + EXPECT_EQ(Decimal::nan(), Decimal::nan().remainder(3)); + + EXPECT_EQ(Decimal::infinity(Negative), Decimal::infinity(Positive).remainder(-1)); + EXPECT_EQ(Decimal::infinity(Positive), Decimal::infinity(Negative).remainder(-1)); + EXPECT_EQ(Decimal::nan(), Decimal::nan().remainder(-1)); + + EXPECT_EQ(Decimal::nan(), Decimal(1).remainder(Decimal::infinity(Positive))); + EXPECT_EQ(Decimal::nan(), Decimal(1).remainder(Decimal::infinity(Negative))); + EXPECT_EQ(Decimal::nan(), Decimal(1).remainder(Decimal::nan())); +} + +TEST_F(DecimalTest, Round) +{ + EXPECT_EQ(Decimal(1), (Decimal(9) / Decimal(10)).round()); + EXPECT_EQ(Decimal(25), (Decimal(5) / fromString("0.200")).round()); + EXPECT_EQ(Decimal(3), (Decimal(5) / Decimal(2)).round()); + EXPECT_EQ(Decimal(1), (Decimal(2) / Decimal(3)).round()); + EXPECT_EQ(Decimal(3), (Decimal(10) / Decimal(3)).round()); + EXPECT_EQ(Decimal(3), (Decimal(1) / fromString("0.3")).round()); + EXPECT_EQ(Decimal(10), (Decimal(1) / fromString("0.1")).round()); + EXPECT_EQ(Decimal(5), (Decimal(1) / fromString("0.2")).round()); + EXPECT_EQ(Decimal(10), (fromString("10.2") / 1).round()); + EXPECT_EQ(encode(1234, 100, Positive), encode(1234, 100, Positive).round()); +} + +TEST_F(DecimalTest, RoundSpecialValues) +{ + EXPECT_EQ(Decimal::infinity(Positive), Decimal::infinity(Positive).round()); + EXPECT_EQ(Decimal::infinity(Negative), Decimal::infinity(Negative).round()); + EXPECT_EQ(Decimal::nan(), Decimal::nan().round()); +} + +TEST_F(DecimalTest, Subtract) +{ + EXPECT_EQ(encode(0, 0, Positive), Decimal(0) - Decimal(0)); + EXPECT_EQ(encode(3, 0, Positive), Decimal(2) - Decimal(-1)); + EXPECT_EQ(encode(3, 0, Negative), Decimal(-1) - Decimal(2)); + EXPECT_EQ(encode(98, 0, Positive), Decimal(99) - Decimal(1)); + EXPECT_EQ(encode(0, 0, Positive), Decimal(-50) - Decimal(-50)); + EXPECT_EQ(encode(UINT64_C(1000000000000000), 35, Positive), encode(1, 50, Positive) - Decimal(1)); + EXPECT_EQ(encode(UINT64_C(1000000000000000), 35, Negative), Decimal(1) - encode(1, 50, Positive)); +} + +TEST_F(DecimalTest, SubtractBigExponent) +{ + EXPECT_EQ(encode(1, 1022, Positive), encode(1, 1022, Positive) - encode(1, 0, Positive)); + EXPECT_EQ(encode(0, 0, Positive), encode(1, 1022, Positive) - encode(1, 1022, Positive)); + EXPECT_EQ(encode(1, 1022, Positive), encode(1, 1022, Positive) + encode(1, -1000, Positive)); +} + +TEST_F(DecimalTest, SubtractSmallExponent) +{ + EXPECT_EQ(encode(UINT64_C(10000000000000000), -16, Negative), encode(1, -1022, Positive) - encode(1, 0, Positive)); + EXPECT_EQ(encode(0, 0, Positive), encode(1, -1022, Positive) - encode(1, -1022, Positive)); +} + +TEST_F(DecimalTest, SubtractSpecialValues) +{ + const Decimal Infinity(Decimal::infinity(Positive)); + const Decimal MinusInfinity(Decimal::infinity(Negative)); + const Decimal NaN(Decimal::nan()); + const Decimal Ten(10); + + EXPECT_EQ(NaN, Infinity - Infinity); + EXPECT_EQ(Infinity, Infinity - MinusInfinity); + EXPECT_EQ(MinusInfinity, MinusInfinity - Infinity); + EXPECT_EQ(NaN, MinusInfinity - MinusInfinity); + + EXPECT_EQ(Infinity, Infinity - Ten); + EXPECT_EQ(MinusInfinity, Ten - Infinity); + EXPECT_EQ(MinusInfinity, MinusInfinity - Ten); + EXPECT_EQ(Infinity, Ten - MinusInfinity); + + EXPECT_EQ(NaN, NaN - NaN); + EXPECT_EQ(NaN, NaN - Ten); + EXPECT_EQ(NaN, Ten - NaN); + + EXPECT_EQ(NaN, NaN - Infinity); + EXPECT_EQ(NaN, NaN - MinusInfinity); + EXPECT_EQ(NaN, Infinity - NaN); + EXPECT_EQ(NaN, MinusInfinity - NaN); +} + +TEST_F(DecimalTest, ToString) +{ + EXPECT_EQ(String("0"), Decimal::zero(Positive).toString()); + EXPECT_EQ(String("-0"), Decimal::zero(Negative).toString()); + EXPECT_EQ(String("1"), Decimal(1).toString()); + EXPECT_EQ(String("-1"), Decimal(-1).toString()); + EXPECT_EQ(String("1234567"), Decimal(1234567).toString()); + EXPECT_EQ(String("-1234567"), Decimal(-1234567).toString()); + EXPECT_EQ(String("0.5"), encode(5, -1, Positive).toString()); + EXPECT_EQ(String("-0.5"), encode(5, -1, Negative).toString()); + EXPECT_EQ(String("12.345"), encode(12345, -3, Positive).toString()); + EXPECT_EQ(String("-12.345"), encode(12345, -3, Negative).toString()); + EXPECT_EQ(String("0.12345"), encode(12345, -5, Positive).toString()); + EXPECT_EQ(String("-0.12345"), encode(12345, -5, Negative).toString()); + EXPECT_EQ(String("50"), encode(50, 0, Positive).toString()); + EXPECT_EQ(String("-50"), encode(50, 0, Negative).toString()); + EXPECT_EQ(String("5e+1"), encode(5, 1, Positive).toString()); + EXPECT_EQ(String("-5e+1"), encode(5, 1, Negative).toString()); + EXPECT_EQ(String("5.678e+103"), encode(5678, 100, Positive).toString()); + EXPECT_EQ(String("-5.678e+103"), encode(5678, 100, Negative).toString()); + EXPECT_EQ(String("5.678e-97"), encode(5678, -100, Positive).toString()); + EXPECT_EQ(String("-5.678e-97"), encode(5678, -100, Negative).toString()); +} + +TEST_F(DecimalTest, ToStringSpecialValues) +{ + EXPECT_EQ(String("Infinity"), Decimal::infinity(Positive).toString()); + EXPECT_EQ(String("-Infinity"), Decimal::infinity(Negative).toString()); + EXPECT_EQ(String("NaN"), Decimal::nan().toString()); +} diff --git a/Source/WebKit/chromium/tests/FloatQuadTest.cpp b/Source/WebKit/chromium/tests/FloatQuadTest.cpp index 6c7091ca4..3e2f9bce6 100644 --- a/Source/WebKit/chromium/tests/FloatQuadTest.cpp +++ b/Source/WebKit/chromium/tests/FloatQuadTest.cpp @@ -25,20 +25,20 @@ #include "config.h" +#include "cc/CCMathUtil.h" #include "FloatQuad.h" - -#include "TransformationMatrix.h" - #include <gtest/gtest.h> +#include <public/WebTransformationMatrix.h> using namespace WebCore; +using WebKit::WebTransformationMatrix; namespace { TEST(FloatQuadTest, IsRectilinearTest) { const int numRectilinear = 8; - TransformationMatrix rectilinearTrans[numRectilinear]; + WebTransformationMatrix rectilinearTrans[numRectilinear]; rectilinearTrans[1].rotate(90); rectilinearTrans[2].rotate(180); rectilinearTrans[3].rotate(270); @@ -50,12 +50,14 @@ TEST(FloatQuadTest, IsRectilinearTest) rectilinearTrans[7].rotate(180); for (int i = 0; i < numRectilinear; ++i) { - FloatQuad quad = rectilinearTrans[i].mapQuad(FloatRect(0.01010101f, 0.01010101f, 100.01010101f, 100.01010101f)); + bool clipped = false; + FloatQuad quad = CCMathUtil::mapQuad(rectilinearTrans[i], FloatRect(0.01010101f, 0.01010101f, 100.01010101f, 100.01010101f), clipped); + ASSERT_TRUE(!clipped); EXPECT_TRUE(quad.isRectilinear()); } const int numNonRectilinear = 10; - TransformationMatrix nonRectilinearTrans[numNonRectilinear]; + WebTransformationMatrix nonRectilinearTrans[numNonRectilinear]; nonRectilinearTrans[0].rotate(359.999); nonRectilinearTrans[1].rotate(0.0000001); nonRectilinearTrans[2].rotate(89.999999); @@ -68,7 +70,9 @@ TEST(FloatQuadTest, IsRectilinearTest) nonRectilinearTrans[9].skewY(0.00001); for (int i = 0; i < numNonRectilinear; ++i) { - FloatQuad quad = nonRectilinearTrans[i].mapQuad(FloatRect(0.01010101f, 0.01010101f, 100.01010101f, 100.01010101f)); + bool clipped = false; + FloatQuad quad = CCMathUtil::mapQuad(nonRectilinearTrans[i], FloatRect(0.01010101f, 0.01010101f, 100.01010101f, 100.01010101f), clipped); + ASSERT_TRUE(!clipped); EXPECT_FALSE(quad.isRectilinear()); } } diff --git a/Source/WebKit/chromium/tests/LayerChromiumTest.cpp b/Source/WebKit/chromium/tests/LayerChromiumTest.cpp index 491d48db5..8213dd812 100644 --- a/Source/WebKit/chromium/tests/LayerChromiumTest.cpp +++ b/Source/WebKit/chromium/tests/LayerChromiumTest.cpp @@ -36,9 +36,11 @@ #include "cc/CCSingleThreadProxy.h" #include <gmock/gmock.h> #include <gtest/gtest.h> +#include <public/WebTransformationMatrix.h> using namespace WebCore; using namespace WebKitTests; +using WebKit::WebTransformationMatrix; using ::testing::Mock; using ::testing::_; using ::testing::AtLeast; @@ -496,8 +498,8 @@ TEST_F(LayerChromiumTest, checkPropertyChangeCausesCorrectBehavior) EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(0, testLayer->setDrawOpacity(0.5f)); EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(0, testLayer->setClipRect(IntRect(3, 3, 8, 8))); EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(0, testLayer->setTargetRenderSurface(0)); - EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(0, testLayer->setDrawTransform(TransformationMatrix())); - EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(0, testLayer->setScreenSpaceTransform(TransformationMatrix())); + EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(0, testLayer->setDrawTransform(WebTransformationMatrix())); + EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(0, testLayer->setScreenSpaceTransform(WebTransformationMatrix())); EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(0, testLayer->setDrawableContentRect(IntRect(4, 5, 6, 7))); EXPECT_FALSE(testLayer->needsDisplay()); @@ -512,13 +514,13 @@ TEST_F(LayerChromiumTest, checkPropertyChangeCausesCorrectBehavior) EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setOpaque(true)); EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setPosition(FloatPoint(4.0f, 9.0f))); EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setReplicaLayer(dummyLayer.get())); - EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setSublayerTransform(TransformationMatrix(0, 0, 0, 0, 0, 0))); + EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setSublayerTransform(WebTransformationMatrix(0, 0, 0, 0, 0, 0))); EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setScrollable(true)); EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setShouldScrollOnMainThread(true)); EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setNonFastScrollableRegion(Region(IntRect(1, 1, 2, 2)))); EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setHaveWheelEventHandlers(true)); EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setScrollPosition(IntPoint(10, 10))); - EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setTransform(TransformationMatrix(0, 0, 0, 0, 0, 0))); + EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setTransform(WebTransformationMatrix(0, 0, 0, 0, 0, 0))); EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setDoubleSided(false)); EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setDebugName("Test Layer")); EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setDrawCheckerboardForMissingTiles(!testLayer->drawCheckerboardForMissingTiles())); diff --git a/Source/WebKit/chromium/tests/LayerRendererChromiumTest.cpp b/Source/WebKit/chromium/tests/LayerRendererChromiumTest.cpp index 8445feba7..4ed35986c 100644 --- a/Source/WebKit/chromium/tests/LayerRendererChromiumTest.cpp +++ b/Source/WebKit/chromium/tests/LayerRendererChromiumTest.cpp @@ -275,3 +275,44 @@ TEST(LayerRendererChromiumTest2, initializationDoesNotMakeSynchronousCalls) EXPECT_TRUE(layerRendererChromium.initialize()); } + +class LoseContextOnFirstGetContext : public FakeWebGraphicsContext3D { +public: + LoseContextOnFirstGetContext() + : m_contextLost(false) + { + } + + virtual bool makeContextCurrent() OVERRIDE + { + return !m_contextLost; + } + + virtual void getProgramiv(WebGLId program, WGC3Denum pname, WGC3Dint* value) OVERRIDE + { + m_contextLost = true; + *value = 0; + } + + virtual void getShaderiv(WebGLId shader, WGC3Denum pname, WGC3Dint* value) OVERRIDE + { + m_contextLost = true; + *value = 0; + } + + virtual WGC3Denum getGraphicsResetStatusARB() OVERRIDE + { + return m_contextLost ? 1 : 0; + } + +private: + bool m_contextLost; +}; + +TEST(LayerRendererChromiumTest2, initializationWithQuicklyLostContextDoesNotAssert) +{ + FakeLayerRendererChromiumClient mockClient; + FakeLayerRendererChromium layerRendererChromium(&mockClient, GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new LoseContextOnFirstGetContext), GraphicsContext3D::RenderDirectlyToHostWindow)); + + layerRendererChromium.initialize(); +} diff --git a/Source/WebKit/chromium/tests/LinkHighlightTest.cpp b/Source/WebKit/chromium/tests/LinkHighlightTest.cpp index edcfd4a63..be467a0d5 100644 --- a/Source/WebKit/chromium/tests/LinkHighlightTest.cpp +++ b/Source/WebKit/chromium/tests/LinkHighlightTest.cpp @@ -31,11 +31,12 @@ #include "GraphicsLayerClient.h" #include "IntRect.h" #include "Path.h" -#include "TransformationMatrix.h" #include <gtest/gtest.h> +#include <public/WebTransformationMatrix.h> #include <wtf/PassOwnPtr.h> using namespace WebCore; +using WebKit::WebTransformationMatrix; namespace { @@ -63,11 +64,10 @@ TEST(LinkHighlightTest, verifyLinkHighlightLayer) EXPECT_TRUE(contentLayer->transform().isIdentityOrTranslation()); EXPECT_TRUE(contentLayer->transform().isIntegerTranslation()); - TransformationMatrix::DecomposedType decomposition; - EXPECT_TRUE(contentLayer->transform().decompose(decomposition)); - - FloatPoint expectedTranslation(pathBoundingRect.x() + pathBoundingRect.width() / 2, pathBoundingRect.y() + pathBoundingRect.height() / 2); - EXPECT_EQ(FloatPoint(decomposition.translateX, decomposition.translateY), expectedTranslation); + float expectedXTranslation = pathBoundingRect.x() + pathBoundingRect.width() / 2; + float expectedYTranslation = pathBoundingRect.y() + pathBoundingRect.height() / 2; + EXPECT_FLOAT_EQ(expectedXTranslation, contentLayer->transform().m41()); + EXPECT_FLOAT_EQ(expectedYTranslation, contentLayer->transform().m42()); } TEST(LinkHighlightTest, verifyGraphicsLayerChromiumEmbedding) diff --git a/Source/WebKit/chromium/tests/PopupMenuTest.cpp b/Source/WebKit/chromium/tests/PopupMenuTest.cpp index 1db65ec6e..7acb31149 100644 --- a/Source/WebKit/chromium/tests/PopupMenuTest.cpp +++ b/Source/WebKit/chromium/tests/PopupMenuTest.cpp @@ -182,10 +182,6 @@ public: protected: virtual void SetUp() { - // When touch is enabled, padding is added to option elements - // In these tests, we'll assume touch is disabled. - m_touchWasEnabled = RuntimeEnabledFeatures::touchEnabled(); - RuntimeEnabledFeatures::setTouchEnabled(false); m_webView = static_cast<WebViewImpl*>(WebView::create(&m_webviewClient)); m_webView->initializeMainFrame(&m_webFrameClient); m_popupMenu = adoptRef(new PopupMenuChromium(&m_popupMenuClient)); @@ -196,7 +192,6 @@ protected: m_popupMenu = 0; m_webView->close(); webkit_support::UnregisterAllMockedURLs(); - RuntimeEnabledFeatures::setTouchEnabled(m_touchWasEnabled); } // Returns true if there currently is a select popup in the WebView. @@ -284,7 +279,6 @@ protected: TestWebFrameClient m_webFrameClient; TestPopupMenuClient m_popupMenuClient; RefPtr<PopupMenu> m_popupMenu; - bool m_touchWasEnabled; std::string baseURL; }; @@ -360,8 +354,9 @@ TEST_F(SelectPopupMenuTest, ClickItem) { showPopup(); - // Y of 18 to be on the item at index 1 (12 font plus border and more to be safe). - IntPoint row1Point(2, 18); + int menuItemHeight = m_webView->selectPopup()->menuItemHeight(); + // menuItemHeight * 1.5 means the Y position on the item at index 1. + IntPoint row1Point(2, menuItemHeight * 1.5); // Simulate a click down/up on the first item. simulateLeftMouseDownEvent(row1Point); simulateLeftMouseUpEvent(row1Point); @@ -377,8 +372,9 @@ TEST_F(SelectPopupMenuTest, MouseOverItemClickOutside) { showPopup(); - // Y of 18 to be on the item at index 1 (12 font plus border and more to be safe). - IntPoint row1Point(2, 18); + int menuItemHeight = m_webView->selectPopup()->menuItemHeight(); + // menuItemHeight * 1.5 means the Y position on the item at index 1. + IntPoint row1Point(2, menuItemHeight * 1.5); // Simulate the mouse moving over the first item. PlatformMouseEvent mouseEvent(row1Point, row1Point, NoButton, PlatformEvent::MouseMoved, 1, false, false, false, false, 0); @@ -421,9 +417,9 @@ TEST_F(SelectPopupMenuTest, DISABLED_SelectItemEventFire) showPopup(); - int menuHeight = m_webView->selectPopup()->menuItemHeight(); - // menuHeight * 0.5 means the Y position on the item at index 0. - IntPoint row1Point(2, menuHeight * 0.5); + int menuItemHeight = m_webView->selectPopup()->menuItemHeight(); + // menuItemHeight * 0.5 means the Y position on the item at index 0. + IntPoint row1Point(2, menuItemHeight * 0.5); simulateLeftMouseDownEvent(row1Point); simulateLeftMouseUpEvent(row1Point); @@ -437,8 +433,8 @@ TEST_F(SelectPopupMenuTest, DISABLED_SelectItemEventFire) m_popupMenuClient.setDisabledIndex(1); showPopup(); - // menuHeight * 1.5 means the Y position on the item at index 1. - row1Point.setY(menuHeight * 1.5); + // menuItemHeight * 1.5 means the Y position on the item at index 1. + row1Point.setY(menuItemHeight * 1.5); simulateLeftMouseDownEvent(row1Point); simulateLeftMouseUpEvent(row1Point); @@ -446,8 +442,8 @@ TEST_F(SelectPopupMenuTest, DISABLED_SelectItemEventFire) EXPECT_STREQ("upclick", std::string(element.innerText().utf8()).c_str()); showPopup(); - // menuHeight * 2.5 means the Y position on the item at index 2. - row1Point.setY(menuHeight * 2.5); + // menuItemHeight * 2.5 means the Y position on the item at index 2. + row1Point.setY(menuItemHeight * 2.5); simulateLeftMouseDownEvent(row1Point); simulateLeftMouseUpEvent(row1Point); @@ -488,9 +484,9 @@ TEST_F(SelectPopupMenuTest, SelectItemRemoveSelectOnChange) showPopup(); - int menuHeight = m_webView->selectPopup()->menuItemHeight(); - // menuHeight * 1.5 means the Y position on the item at index 1. - IntPoint row1Point(2, menuHeight * 1.5); + int menuItemHeight = m_webView->selectPopup()->menuItemHeight(); + // menuItemHeight * 1.5 means the Y position on the item at index 1. + IntPoint row1Point(2, menuItemHeight * 1.5); simulateLeftMouseDownEvent(row1Point); simulateLeftMouseUpEvent(row1Point); @@ -510,9 +506,9 @@ TEST_F(SelectPopupMenuTest, SelectItemRemoveSelectOnClick) showPopup(); - int menuHeight = m_webView->selectPopup()->menuItemHeight(); - // menuHeight * 1.5 means the Y position on the item at index 1. - IntPoint row1Point(2, menuHeight * 1.5); + int menuItemHeight = m_webView->selectPopup()->menuItemHeight(); + // menuItemHeight * 1.5 means the Y position on the item at index 1. + IntPoint row1Point(2, menuItemHeight * 1.5); simulateLeftMouseDownEvent(row1Point); simulateLeftMouseUpEvent(row1Point); diff --git a/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp b/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp index c9125a852..80b099f19 100644 --- a/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp +++ b/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp @@ -33,10 +33,12 @@ #include "WebCompositor.h" #include "cc/CCSingleThreadProxy.h" // For DebugScopedSetImplThread #include <gtest/gtest.h> +#include <public/WebTransformationMatrix.h> using namespace WebCore; using namespace WebKitTests; using namespace WTF; +using WebKit::WebTransformationMatrix; #define EXPECT_EQ_RECT(a, b) \ EXPECT_EQ(a.x(), b.x()); \ @@ -109,7 +111,7 @@ TEST(TiledLayerChromiumTest, pushOccludedDirtyTiles) // The tile size is 100x100, so this invalidates and then paints two tiles. layer->setBounds(IntSize(100, 200)); - layer->setDrawTransform(TransformationMatrix(1, 0, 0, 1, layer->bounds().width() / 2.0, layer->bounds().height() / 2.0)); + layer->setDrawTransform(WebTransformationMatrix(1, 0, 0, 1, layer->bounds().width() / 2.0, layer->bounds().height() / 2.0)); layer->setVisibleLayerRect(IntRect(0, 0, 100, 200)); layer->invalidateRect(IntRect(0, 0, 100, 200)); layer->updateLayerRect(updater, IntRect(0, 0, 100, 200), &occluded); @@ -327,7 +329,7 @@ TEST(TiledLayerChromiumTest, pushIdlePaintedOccludedTiles) occluded.setOcclusion(IntRect(0, 0, 100, 100)); layer->setBounds(IntSize(100, 100)); - layer->setDrawTransform(TransformationMatrix(1, 0, 0, 1, layer->bounds().width() / 2.0, layer->bounds().height() / 2.0)); + layer->setDrawTransform(WebTransformationMatrix(1, 0, 0, 1, layer->bounds().width() / 2.0, layer->bounds().height() / 2.0)); layer->setVisibleLayerRect(IntRect(0, 0, 100, 100)); layer->invalidateRect(IntRect(0, 0, 100, 100)); layer->updateLayerRect(updater, IntRect(0, 0, 100, 100), &occluded); @@ -1018,7 +1020,7 @@ TEST(TiledLayerChromiumTest, tilesPaintedWithOcclusion) // The tile size is 100x100. layer->setBounds(IntSize(600, 600)); - layer->setDrawTransform(TransformationMatrix(1, 0, 0, 1, layer->bounds().width() / 2.0, layer->bounds().height() / 2.0)); + layer->setDrawTransform(WebTransformationMatrix(1, 0, 0, 1, layer->bounds().width() / 2.0, layer->bounds().height() / 2.0)); occluded.setOcclusion(IntRect(200, 200, 300, 100)); layer->setVisibleLayerRect(IntRect(IntPoint(), layer->bounds())); @@ -1063,7 +1065,7 @@ TEST(TiledLayerChromiumTest, tilesPaintedWithOcclusionAndVisiblityConstraints) // The tile size is 100x100. layer->setBounds(IntSize(600, 600)); - layer->setDrawTransform(TransformationMatrix(1, 0, 0, 1, layer->bounds().width() / 2.0, layer->bounds().height() / 2.0)); + layer->setDrawTransform(WebTransformationMatrix(1, 0, 0, 1, layer->bounds().width() / 2.0, layer->bounds().height() / 2.0)); // The partially occluded tiles (by the 150 occlusion height) are visible beyond the occlusion, so not culled. occluded.setOcclusion(IntRect(200, 200, 300, 150)); @@ -1114,7 +1116,7 @@ TEST(TiledLayerChromiumTest, tilesNotPaintedWithoutInvalidation) // The tile size is 100x100. layer->setBounds(IntSize(600, 600)); - layer->setDrawTransform(TransformationMatrix(1, 0, 0, 1, layer->bounds().width() / 2.0, layer->bounds().height() / 2.0)); + layer->setDrawTransform(WebTransformationMatrix(1, 0, 0, 1, layer->bounds().width() / 2.0, layer->bounds().height() / 2.0)); occluded.setOcclusion(IntRect(200, 200, 300, 100)); layer->setVisibleLayerRect(IntRect(0, 0, 600, 600)); @@ -1149,10 +1151,10 @@ TEST(TiledLayerChromiumTest, tilesPaintedWithOcclusionAndTransforms) // This makes sure the painting works when the occluded region (in screen space) // is transformed differently than the layer. layer->setBounds(IntSize(600, 600)); - TransformationMatrix screenTransform; + WebTransformationMatrix screenTransform; screenTransform.scale(0.5); layer->setScreenSpaceTransform(screenTransform); - layer->setDrawTransform(screenTransform * TransformationMatrix(1, 0, 0, 1, layer->bounds().width() / 2.0, layer->bounds().height() / 2.0)); + layer->setDrawTransform(screenTransform * WebTransformationMatrix(1, 0, 0, 1, layer->bounds().width() / 2.0, layer->bounds().height() / 2.0)); occluded.setOcclusion(IntRect(100, 100, 150, 50)); layer->setVisibleLayerRect(IntRect(IntPoint(), layer->bounds())); @@ -1179,7 +1181,7 @@ TEST(TiledLayerChromiumTest, tilesPaintedWithOcclusionAndScaling) // pixels, which means none should be occluded. layer->setContentsScale(0.5); layer->setBounds(IntSize(600, 600)); - layer->setDrawTransform(TransformationMatrix(1, 0, 0, 1, layer->bounds().width() / 2.0, layer->bounds().height() / 2.0)); + layer->setDrawTransform(WebTransformationMatrix(1, 0, 0, 1, layer->bounds().width() / 2.0, layer->bounds().height() / 2.0)); occluded.setOcclusion(IntRect(200, 200, 300, 100)); layer->setVisibleLayerRect(IntRect(IntPoint(), layer->bounds())); @@ -1212,10 +1214,10 @@ TEST(TiledLayerChromiumTest, tilesPaintedWithOcclusionAndScaling) layer->fakeLayerTextureUpdater()->clearPrepareRectCount(); // This makes sure content scaling and transforms work together. - TransformationMatrix screenTransform; + WebTransformationMatrix screenTransform; screenTransform.scale(0.5); layer->setScreenSpaceTransform(screenTransform); - layer->setDrawTransform(screenTransform * TransformationMatrix(1, 0, 0, 1, layer->bounds().width() / 2.0, layer->bounds().height() / 2.0)); + layer->setDrawTransform(screenTransform * WebTransformationMatrix(1, 0, 0, 1, layer->bounds().width() / 2.0, layer->bounds().height() / 2.0)); occluded.setOcclusion(IntRect(100, 100, 150, 100)); layer->setVisibleLayerRect(IntRect(IntPoint(), layer->bounds())); @@ -1244,7 +1246,7 @@ TEST(TiledLayerChromiumTest, visibleContentOpaqueRegion) IntRect visibleBounds = IntRect(0, 0, 100, 150); layer->setBounds(contentBounds.size()); - layer->setDrawTransform(TransformationMatrix(1, 0, 0, 1, layer->bounds().width() / 2.0, layer->bounds().height() / 2.0)); + layer->setDrawTransform(WebTransformationMatrix(1, 0, 0, 1, layer->bounds().width() / 2.0, layer->bounds().height() / 2.0)); layer->setVisibleLayerRect(visibleBounds); layer->setDrawOpacity(1); @@ -1338,7 +1340,7 @@ TEST(TiledLayerChromiumTest, pixelsPaintedMetrics) IntRect visibleBounds = IntRect(0, 0, 100, 300); layer->setBounds(contentBounds.size()); - layer->setDrawTransform(TransformationMatrix(1, 0, 0, 1, layer->bounds().width() / 2.0, layer->bounds().height() / 2.0)); + layer->setDrawTransform(WebTransformationMatrix(1, 0, 0, 1, layer->bounds().width() / 2.0, layer->bounds().height() / 2.0)); layer->setVisibleLayerRect(visibleBounds); layer->setDrawOpacity(1); diff --git a/Source/WebKit/chromium/tests/WebFrameTest.cpp b/Source/WebKit/chromium/tests/WebFrameTest.cpp index a6ab77fc1..4aa905c78 100644 --- a/Source/WebKit/chromium/tests/WebFrameTest.cpp +++ b/Source/WebKit/chromium/tests/WebFrameTest.cpp @@ -643,4 +643,85 @@ TEST_F(WebFrameTest, FindInPage) webView->close(); } +TEST_F(WebFrameTest, GetContentAsPlainText) +{ + WebView* webView = FrameTestHelpers::createWebViewAndLoad("about:blank", true); + // We set the size because it impacts line wrapping, which changes the + // resulting text value. + webView->resize(WebSize(640, 480)); + WebFrame* frame = webView->mainFrame(); + + // Generate a simple test case. + const char simpleSource[] = "<div>Foo bar</div><div></div>baz"; + GURL testURL("about:blank"); + frame->loadHTMLString(simpleSource, testURL); + webkit_support::RunAllPendingMessages(); + + // Make sure it comes out OK. + const std::string expected("Foo bar\nbaz"); + WebString text = frame->contentAsText(std::numeric_limits<size_t>::max()); + EXPECT_EQ(expected, std::string(text.utf8())); + + // Try reading the same one with clipping of the text. + const int length = 5; + text = frame->contentAsText(length); + EXPECT_EQ(expected.substr(0, length), std::string(text.utf8())); + + // Now do a new test with a subframe. + const char outerFrameSource[] = "Hello<iframe></iframe> world"; + frame->loadHTMLString(outerFrameSource, testURL); + webkit_support::RunAllPendingMessages(); + + // Load something into the subframe. + WebFrame* subframe = frame->findChildByExpression(WebString::fromUTF8("/html/body/iframe")); + ASSERT_TRUE(subframe); + subframe->loadHTMLString("sub<p>text", testURL); + webkit_support::RunAllPendingMessages(); + + text = frame->contentAsText(std::numeric_limits<size_t>::max()); + EXPECT_EQ("Hello world\n\nsub\ntext", std::string(text.utf8())); + + // Get the frame text where the subframe separator falls on the boundary of + // what we'll take. There used to be a crash in this case. + text = frame->contentAsText(12); + EXPECT_EQ("Hello world", std::string(text.utf8())); + + webView->close(); +} + +TEST_F(WebFrameTest, GetFullHtmlOfPage) +{ + WebView* webView = FrameTestHelpers::createWebViewAndLoad("about:blank", true); + WebFrame* frame = webView->mainFrame(); + + // Generate a simple test case. + const char simpleSource[] = "<p>Hello</p><p>World</p>"; + GURL testURL("about:blank"); + frame->loadHTMLString(simpleSource, testURL); + webkit_support::RunAllPendingMessages(); + + WebString text = frame->contentAsText(std::numeric_limits<size_t>::max()); + EXPECT_EQ("Hello\n\nWorld", std::string(text.utf8())); + + const std::string html = frame->contentAsMarkup().utf8(); + + // Load again with the output html. + frame->loadHTMLString(html, testURL); + webkit_support::RunAllPendingMessages(); + + EXPECT_EQ(html, std::string(frame->contentAsMarkup().utf8())); + + text = frame->contentAsText(std::numeric_limits<size_t>::max()); + EXPECT_EQ("Hello\n\nWorld", std::string(text.utf8())); + + // Test selection check + EXPECT_FALSE(frame->hasSelection()); + frame->executeCommand(WebString::fromUTF8("SelectAll")); + EXPECT_TRUE(frame->hasSelection()); + frame->executeCommand(WebString::fromUTF8("Unselect")); + EXPECT_FALSE(frame->hasSelection()); + WebString selectionHtml = frame->selectionAsMarkup(); + EXPECT_TRUE(selectionHtml.isEmpty()); +} + } // namespace diff --git a/Source/WebKit/chromium/tests/WebInputEventFactoryTestGtk.cpp b/Source/WebKit/chromium/tests/WebInputEventFactoryTestGtk.cpp index 64c63eae9..3792eaf79 100644 --- a/Source/WebKit/chromium/tests/WebInputEventFactoryTestGtk.cpp +++ b/Source/WebKit/chromium/tests/WebInputEventFactoryTestGtk.cpp @@ -31,11 +31,16 @@ #include "config.h" #include <gdk/gdk.h> +#include <gdk/gdkkeysyms.h> #include <gtest/gtest.h> +#include "KeyboardEvent.h" #include "WebInputEvent.h" +#include "WebInputEventConversion.h" #include "WebInputEventFactory.h" +using WebKit::WebInputEvent; +using WebKit::WebKeyboardEvent; using WebKit::WebMouseEvent; using WebKit::WebInputEventFactory; @@ -172,4 +177,27 @@ TEST(WebInputEventFactoryTest, MouseUpClickCount) EXPECT_EQ(0, mouseUpEvent.clickCount); } +TEST(WebInputEventFactoryTest, NumPadConversion) +{ + // Construct a GDK input event for the numpad "5" key. + char five[] = "5"; + GdkEventKey gdkEvent; + memset(&gdkEvent, 0, sizeof(GdkEventKey)); + gdkEvent.type = GDK_KEY_PRESS; + gdkEvent.keyval = GDK_KP_5; + gdkEvent.string = five; + + // Numpad flag should be set on the WebKeyboardEvent. + WebKeyboardEvent webEvent = WebInputEventFactory::keyboardEvent(&gdkEvent); + EXPECT_TRUE(webEvent.modifiers & WebInputEvent::IsKeyPad); + + // Round-trip through the WebCore KeyboardEvent class. + WebKit::PlatformKeyboardEventBuilder platformBuilder(webEvent); + RefPtr<WebCore::KeyboardEvent> keypress = WebCore::KeyboardEvent::create(platformBuilder, 0); + EXPECT_TRUE(keypress->keyLocation() == WebCore::KeyboardEvent::DOM_KEY_LOCATION_NUMPAD); + + WebKit::WebKeyboardEventBuilder builder(*keypress); + EXPECT_TRUE(builder.modifiers & WebInputEvent::IsKeyPad); +} + } // anonymous namespace diff --git a/Source/WebKit/chromium/tests/WebTransformOperationsTest.cpp b/Source/WebKit/chromium/tests/WebTransformOperationsTest.cpp new file mode 100644 index 000000000..deaf7ad74 --- /dev/null +++ b/Source/WebKit/chromium/tests/WebTransformOperationsTest.cpp @@ -0,0 +1,341 @@ +/* + * Copyright (C) 2012 Google 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 <public/WebTransformOperations.h> + +#include <public/WebTransformationMatrix.h> + +#include "CCLayerTreeTestCommon.h" + +#include <gtest/gtest.h> +#include <wtf/OwnPtr.h> +#include <wtf/PassOwnPtr.h> +#include <wtf/Vector.h> + +using namespace WebKit; + +TEST(WebTransformOperationTest, transformTypesAreUnique) +{ + Vector<OwnPtr<WebTransformOperations> > transforms; + + WebTransformOperations* toAdd = new WebTransformOperations(); + toAdd->appendTranslate(0, 0, 0); + transforms.append(adoptPtr(toAdd)); + + toAdd = new WebTransformOperations(); + toAdd->appendRotate(0, 0, 1, 0); + transforms.append(adoptPtr(toAdd)); + + toAdd = new WebTransformOperations(); + toAdd->appendScale(1, 1, 1); + transforms.append(adoptPtr(toAdd)); + + toAdd = new WebTransformOperations(); + toAdd->appendSkew(0, 0); + transforms.append(adoptPtr(toAdd)); + + toAdd = new WebTransformOperations(); + toAdd->appendPerspective(800); + transforms.append(adoptPtr(toAdd)); + + for (size_t i = 0; i < transforms.size(); ++i) { + for (size_t j = 0; j < transforms.size(); ++j) { + bool matchesType = transforms[i]->matchesTypes(*transforms[j]); + EXPECT_TRUE((i == j && matchesType) || !matchesType); + } + } +} + +TEST(WebTransformOperationTest, matchTypesSameLength) +{ + WebTransformOperations translates; + translates.appendTranslate(0, 0, 0); + translates.appendTranslate(0, 0, 0); + translates.appendTranslate(0, 0, 0); + + WebTransformOperations skews; + skews.appendSkew(0, 0); + skews.appendSkew(0, 0); + skews.appendSkew(0, 0); + + WebTransformOperations translates2; + translates2.appendTranslate(0, 0, 0); + translates2.appendTranslate(0, 0, 0); + translates2.appendTranslate(0, 0, 0); + + WebTransformOperations translates3 = translates2; + + EXPECT_FALSE(translates.matchesTypes(skews)); + EXPECT_TRUE(translates.matchesTypes(translates2)); + EXPECT_TRUE(translates.matchesTypes(translates3)); +} + +TEST(WebTransformOperationTest, matchTypesDifferentLength) +{ + WebTransformOperations translates; + translates.appendTranslate(0, 0, 0); + translates.appendTranslate(0, 0, 0); + translates.appendTranslate(0, 0, 0); + + WebTransformOperations skews; + skews.appendSkew(0, 0); + skews.appendSkew(0, 0); + + WebTransformOperations translates2; + translates2.appendTranslate(0, 0, 0); + translates2.appendTranslate(0, 0, 0); + + EXPECT_FALSE(translates.matchesTypes(skews)); + EXPECT_FALSE(translates.matchesTypes(translates2)); +} + +TEST(WebTransformOperationTest, applyTranslate) +{ + double x = 1; + double y = 2; + double z = 3; + WebTransformOperations operations; + operations.appendTranslate(x, y, z); + WebTransformationMatrix expected; + expected.translate3d(x, y, z); + EXPECT_TRANSFORMATION_MATRIX_EQ(expected, operations.apply()); +} + +TEST(WebTransformOperationTest, applyRotate) +{ + double x = 1; + double y = 2; + double z = 3; + double degrees = 80; + WebTransformOperations operations; + operations.appendRotate(x, y, z, degrees); + WebTransformationMatrix expected; + expected.rotate3d(x, y, z, degrees); + EXPECT_TRANSFORMATION_MATRIX_EQ(expected, operations.apply()); +} + +TEST(WebTransformOperationTest, applyScale) +{ + double x = 1; + double y = 2; + double z = 3; + WebTransformOperations operations; + operations.appendScale(x, y, z); + WebTransformationMatrix expected; + expected.scale3d(x, y, z); + EXPECT_TRANSFORMATION_MATRIX_EQ(expected, operations.apply()); +} + +TEST(WebTransformOperationTest, applySkew) +{ + double x = 1; + double y = 2; + WebTransformOperations operations; + operations.appendSkew(x, y); + WebTransformationMatrix expected; + expected.skewX(x); + expected.skewY(y); + EXPECT_TRANSFORMATION_MATRIX_EQ(expected, operations.apply()); +} + +TEST(WebTransformOperationTest, applyPerspective) +{ + double depth = 800; + WebTransformOperations operations; + operations.appendPerspective(depth); + WebTransformationMatrix expected; + expected.applyPerspective(depth); + EXPECT_TRANSFORMATION_MATRIX_EQ(expected, operations.apply()); +} + +TEST(WebTransformOperationTest, applyMatrix) +{ + double dx = 1; + double dy = 2; + double dz = 3; + WebTransformationMatrix expectedMatrix; + expectedMatrix.translate3d(dx, dy, dz); + WebTransformOperations matrixTransform; + matrixTransform.appendMatrix(expectedMatrix); + EXPECT_TRANSFORMATION_MATRIX_EQ(expectedMatrix, matrixTransform.apply()); +} + +TEST(WebTransformOperationTest, applyOrder) +{ + double sx = 2; + double sy = 4; + double sz = 8; + + double dx = 1; + double dy = 2; + double dz = 3; + + WebTransformOperations operations; + operations.appendScale(sx, sy, sz); + operations.appendTranslate(dx, dy, dz); + + WebTransformationMatrix expectedScaleMatrix; + expectedScaleMatrix.scale3d(sx, sy, sz); + + WebTransformationMatrix expectedTranslateMatrix; + expectedTranslateMatrix.translate3d(dx, dy, dz); + + WebTransformationMatrix expectedCombinedMatrix = expectedScaleMatrix; + expectedCombinedMatrix.multiply(expectedTranslateMatrix); + + EXPECT_TRANSFORMATION_MATRIX_EQ(expectedCombinedMatrix, operations.apply()); +} + +TEST(WebTransformOperationTest, blendOrder) +{ + double sx1 = 2; + double sy1 = 4; + double sz1 = 8; + + double dx1 = 1; + double dy1 = 2; + double dz1 = 3; + + double sx2 = 4; + double sy2 = 8; + double sz2 = 16; + + double dx2 = 10; + double dy2 = 20; + double dz2 = 30; + + WebTransformOperations operationsFrom; + operationsFrom.appendScale(sx1, sy1, sz1); + operationsFrom.appendTranslate(dx1, dy1, dz1); + + WebTransformOperations operationsTo; + operationsTo.appendScale(sx2, sy2, sz2); + operationsTo.appendTranslate(dx2, dy2, dz2); + + WebTransformationMatrix scaleFrom; + scaleFrom.scale3d(sx1, sy1, sz1); + WebTransformationMatrix translateFrom; + translateFrom.translate3d(dx1, dy1, dz1); + + WebTransformationMatrix scaleTo; + scaleTo.scale3d(sx2, sy2, sz2); + WebTransformationMatrix translateTo; + translateTo.translate3d(dx2, dy2, dz2); + + double progress = 0.25; + + WebTransformationMatrix blendedScale = scaleTo; + blendedScale.blend(scaleFrom, progress); + + WebTransformationMatrix blendedTranslate = translateTo; + blendedTranslate.blend(translateFrom, progress); + + WebTransformationMatrix expected = blendedScale; + expected.multiply(blendedTranslate); + + EXPECT_TRANSFORMATION_MATRIX_EQ(expected, operationsTo.blend(operationsFrom, progress)); +} + +static void checkProgress(double progress, + const WebTransformationMatrix& fromMatrix, + const WebTransformationMatrix& toMatrix, + const WebTransformOperations& fromTransform, + const WebTransformOperations& toTransform) +{ + WebTransformationMatrix expectedMatrix = toMatrix; + expectedMatrix.blend(fromMatrix, progress); + EXPECT_TRANSFORMATION_MATRIX_EQ(expectedMatrix, toTransform.blend(fromTransform, progress)); +} + +TEST(WebTransformOperationTest, blendProgress) +{ + double sx = 2; + double sy = 4; + double sz = 8; + WebTransformOperations operationsFrom; + operationsFrom.appendScale(sx, sy, sz); + + WebTransformationMatrix matrixFrom; + matrixFrom.scale3d(sx, sy, sz); + + sx = 4; + sy = 8; + sz = 16; + WebTransformOperations operationsTo; + operationsTo.appendScale(sx, sy, sz); + + WebTransformationMatrix matrixTo; + matrixTo.scale3d(sx, sy, sz); + + checkProgress(-1, matrixFrom, matrixTo, operationsFrom, operationsTo); + checkProgress(0, matrixFrom, matrixTo, operationsFrom, operationsTo); + checkProgress(0.25, matrixFrom, matrixTo, operationsFrom, operationsTo); + checkProgress(0.5, matrixFrom, matrixTo, operationsFrom, operationsTo); + checkProgress(1, matrixFrom, matrixTo, operationsFrom, operationsTo); + checkProgress(2, matrixFrom, matrixTo, operationsFrom, operationsTo); +} + +TEST(WebTransformOperationTest, blendWhenTypesDoNotMatch) +{ + double sx1 = 2; + double sy1 = 4; + double sz1 = 8; + + double dx1 = 1; + double dy1 = 2; + double dz1 = 3; + + double sx2 = 4; + double sy2 = 8; + double sz2 = 16; + + double dx2 = 10; + double dy2 = 20; + double dz2 = 30; + + WebTransformOperations operationsFrom; + operationsFrom.appendScale(sx1, sy1, sz1); + operationsFrom.appendTranslate(dx1, dy1, dz1); + + WebTransformOperations operationsTo; + operationsTo.appendTranslate(dx2, dy2, dz2); + operationsTo.appendScale(sx2, sy2, sz2); + + WebTransformationMatrix from; + from.scale3d(sx1, sy1, sz1); + from.translate3d(dx1, dy1, dz1); + + WebTransformationMatrix to; + to.translate3d(dx2, dy2, dz2); + to.scale3d(sx2, sy2, sz2); + + double progress = 0.25; + + WebTransformationMatrix expected = to; + expected.blend(from, progress); + + EXPECT_TRANSFORMATION_MATRIX_EQ(expected, operationsTo.blend(operationsFrom, progress)); +} diff --git a/Source/WebKit/chromium/tests/WebTransformationMatrixTest.cpp b/Source/WebKit/chromium/tests/WebTransformationMatrixTest.cpp index 2888e0d7c..937cee202 100644 --- a/Source/WebKit/chromium/tests/WebTransformationMatrixTest.cpp +++ b/Source/WebKit/chromium/tests/WebTransformationMatrixTest.cpp @@ -153,6 +153,15 @@ TEST(WebTransformationMatrixTest, verifyConstructorFor2dElements) EXPECT_ROW4_EQ(0, 0, 0, 1, A); } +TEST(WebTransformationMatrixTest, verifyConstructorForAllElements) +{ + WebTransformationMatrix A(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + EXPECT_ROW1_EQ(1, 5, 9, 13, A); + EXPECT_ROW2_EQ(2, 6, 10, 14, A); + EXPECT_ROW3_EQ(3, 7, 11, 15, A); + EXPECT_ROW4_EQ(4, 8, 12, 16, A); +} + TEST(WebTransformationMatrixTest, verifyCopyConstructor) { WebTransformationMatrix A; @@ -624,6 +633,38 @@ TEST(WebTransformationMatrixTest, verifyRotateAxisAngle3d) EXPECT_ROW4_EQ(0, 0, 0, 1, A); } +TEST(WebTransformationMatrixTest, verifyRotateAxisAngle3dForArbitraryAxis) +{ + // Check rotation about an arbitrary non-axis-aligned vector. + WebTransformationMatrix A; + A.rotate3d(1, 1, 1, 90); + EXPECT_ROW1_NEAR(0.3333333333333334258519187, + -0.2440169358562924717404030, + 0.9106836025229592124219380, + 0, A, ERROR_THRESHOLD); + EXPECT_ROW2_NEAR(0.9106836025229592124219380, + 0.3333333333333334258519187, + -0.2440169358562924717404030, + 0, A, ERROR_THRESHOLD); + EXPECT_ROW3_NEAR(-0.2440169358562924717404030, + 0.9106836025229592124219380, + 0.3333333333333334258519187, + 0, A, ERROR_THRESHOLD); + EXPECT_ROW4_EQ(0, 0, 0, 1, A); +} + +TEST(WebTransformationMatrixTest, verifyRotateAxisAngle3dForDegenerateAxis) +{ + // Check rotation about a degenerate zero vector. + // It is expected to default to rotation about the z-axis. + WebTransformationMatrix A; + A.rotate3d(0, 0, 0, 90); + EXPECT_ROW1_NEAR(0, -1, 0, 0, A, ERROR_THRESHOLD); + EXPECT_ROW2_NEAR(1, 0, 0, 0, A, ERROR_THRESHOLD); + EXPECT_ROW3_EQ(0, 0, 1, 0, A); + EXPECT_ROW4_EQ(0, 0, 0, 1, A); +} + TEST(WebTransformationMatrixTest, verifySkewX) { WebTransformationMatrix A; diff --git a/Source/WebKit/efl/ChangeLog b/Source/WebKit/efl/ChangeLog index 597886912..ec4f3151d 100644 --- a/Source/WebKit/efl/ChangeLog +++ b/Source/WebKit/efl/ChangeLog @@ -1,3 +1,118 @@ +2012-05-31 Alexander Shalamov <alexander.shalamov@intel.com> + + [EFL] <input type="number"> is not a spinbutton + https://bugs.webkit.org/show_bug.cgi?id=86846 + + Reviewed by Kenneth Rohde Christiansen. + + Implemented spinner widget. + + * DefaultTheme/default.edc: + * DefaultTheme/widget/spinner/sp_bg.png: Added. + * DefaultTheme/widget/spinner/sp_down_default.png: Added. + * DefaultTheme/widget/spinner/sp_down_hover.png: Added. + * DefaultTheme/widget/spinner/sp_down_pressed.png: Added. + * DefaultTheme/widget/spinner/sp_up_default.png: Added. + * DefaultTheme/widget/spinner/sp_up_hover.png: Added. + * DefaultTheme/widget/spinner/sp_up_pressed.png: Added. + * DefaultTheme/widget/spinner/spinner.edc: Added. + +2012-05-31 Hajime Morrita <morrita@chromium.org> + + REGRESSION(r117572): editing/spelling/spellcheck-async-remove-frame.html crashes on Mac + https://bugs.webkit.org/show_bug.cgi?id=86859 + + Reviewed by Ryosuke Niwa. + + * WebCoreSupport/EditorClientEfl.h: + (WebCore::EditorClientEfl::requestCheckingOfString): + +2012-05-31 Jussi Kukkonen <jussi.kukkonen@intel.com> + + [EFL][DRT] LayoutTestController does not implement clearApplicationCacheForOrigin + https://bugs.webkit.org/show_bug.cgi?id=86195 + + Reviewed by Gustavo Noronha Silva. + + add new function to clear security origin application cache, + and a function to create a security origin from url string. + Reindent the header to match new longer return signature. + + * ewk/ewk_security_origin.cpp: + (ewk_security_origin_application_cache_clear): + (ewk_security_origin_new_from_string): + * ewk/ewk_security_origin.h: + +2012-05-30 Christophe Dumez <christophe.dumez@intel.com> + + [EFL] EFL's DRT should print the number of MessagePorts for new each new intent + https://bugs.webkit.org/show_bug.cgi?id=86841 + + Reviewed by Adam Barth. + + Add EWKPrivate method to retrieve the internal WebCore object for a Ewk_Intent. + Add helper function to DumpRenderTreeSupportEfl that returns the MessagePorts + for a Ewk_Intent object so that the DRT can print information about them. + + * WebCoreSupport/DumpRenderTreeSupportEfl.cpp: + (DumpRenderTreeSupportEfl::intentMessagePorts): + * WebCoreSupport/DumpRenderTreeSupportEfl.h: + (WebCore): + * ewk/ewk_intent.cpp: + (EWKPrivate): + (EWKPrivate::coreIntent): + * ewk/ewk_intent_private.h: + (EWKPrivate): + +2012-05-30 Christophe Dumez <christophe.dumez@intel.com> + + [EFL] Ewk_Intent_Request's postResult/postFailure should take serialized script values in argument + https://bugs.webkit.org/show_bug.cgi?id=87829 + + Reviewed by Adam Barth. + + Ewk_Intent_Request's postResult/postFailure methods now take + SerializedScriptValues in argument instead of strings. The client can + now post results of any type, not just strings, which is according to + spec. Those methods are now moved to private header and a helper + function was added to DumpRenderTreeSupportEfl so that the DRT can + still send intent results. + + * WebCoreSupport/DumpRenderTreeSupportEfl.cpp: + (DumpRenderTreeSupportEfl::sendWebIntentResponse): + * WebCoreSupport/DumpRenderTreeSupportEfl.h: + * ewk/ewk_intent_private.h: + (WebCore): + * ewk/ewk_intent_request.cpp: + (ewk_intent_request_result_post): + (ewk_intent_request_failure_post): + * ewk/ewk_intent_request.h: + +2012-05-29 Christophe Dumez <christophe.dumez@intel.com> + + [EFL] Compilation warning in DumpRenderTreeView.cpp + https://bugs.webkit.org/show_bug.cgi?id=87636 + + Reviewed by Filip Pizlo. + + Fix return type of exceeded_application_cache_quota callback, it + should be int64_t, not uint64_t. + + * ewk/ewk_view.h: + +2012-05-25 Jesus Sanchez-Palencia <jesus.palencia@openbossa.org> + + WebKitTestRunner needs to support layoutTestController.setJavaScriptProfilingEnabled + https://bugs.webkit.org/show_bug.cgi?id=42328 + + Reviewed by Eric Seidel. + + Removed unneeded setJavaScriptProfilingEnabled function from DRT after its + move to windows.internals.settings. + + * WebCoreSupport/DumpRenderTreeSupportEfl.cpp: + * WebCoreSupport/DumpRenderTreeSupportEfl.h: + 2012-05-25 Mikhail Pozdnyakov <mikhail.pozdnyakov@intel.com> [EFL] API for PageGroup visited links hash populating diff --git a/Source/WebKit/efl/DefaultTheme/default.edc b/Source/WebKit/efl/DefaultTheme/default.edc index b44fe5cad..5715e289d 100644 --- a/Source/WebKit/efl/DefaultTheme/default.edc +++ b/Source/WebKit/efl/DefaultTheme/default.edc @@ -56,6 +56,7 @@ collections { #include "widget/search/cancel/search_cancel.edc" #include "widget/search/decoration/search_decoration.edc" #include "widget/slider/slider.edc" +#include "widget/spinner/spinner.edc" #include "widget/mediacontrol/playpausebutton/playpause_button.edc" #include "widget/mediacontrol/mutebutton/mute_button.edc" #include "widget/mediacontrol/seekforwardbutton/seekforward_button.edc" diff --git a/Source/WebKit/efl/DefaultTheme/widget/spinner/sp_bg.png b/Source/WebKit/efl/DefaultTheme/widget/spinner/sp_bg.png Binary files differnew file mode 100644 index 000000000..5d552a822 --- /dev/null +++ b/Source/WebKit/efl/DefaultTheme/widget/spinner/sp_bg.png diff --git a/Source/WebKit/efl/DefaultTheme/widget/spinner/sp_down_default.png b/Source/WebKit/efl/DefaultTheme/widget/spinner/sp_down_default.png Binary files differnew file mode 100644 index 000000000..f68387348 --- /dev/null +++ b/Source/WebKit/efl/DefaultTheme/widget/spinner/sp_down_default.png diff --git a/Source/WebKit/efl/DefaultTheme/widget/spinner/sp_down_hover.png b/Source/WebKit/efl/DefaultTheme/widget/spinner/sp_down_hover.png Binary files differnew file mode 100644 index 000000000..a1c4f3fdc --- /dev/null +++ b/Source/WebKit/efl/DefaultTheme/widget/spinner/sp_down_hover.png diff --git a/Source/WebKit/efl/DefaultTheme/widget/spinner/sp_down_pressed.png b/Source/WebKit/efl/DefaultTheme/widget/spinner/sp_down_pressed.png Binary files differnew file mode 100644 index 000000000..083531450 --- /dev/null +++ b/Source/WebKit/efl/DefaultTheme/widget/spinner/sp_down_pressed.png diff --git a/Source/WebKit/efl/DefaultTheme/widget/spinner/sp_up_default.png b/Source/WebKit/efl/DefaultTheme/widget/spinner/sp_up_default.png Binary files differnew file mode 100644 index 000000000..584a65593 --- /dev/null +++ b/Source/WebKit/efl/DefaultTheme/widget/spinner/sp_up_default.png diff --git a/Source/WebKit/efl/DefaultTheme/widget/spinner/sp_up_hover.png b/Source/WebKit/efl/DefaultTheme/widget/spinner/sp_up_hover.png Binary files differnew file mode 100644 index 000000000..000ffd1e2 --- /dev/null +++ b/Source/WebKit/efl/DefaultTheme/widget/spinner/sp_up_hover.png diff --git a/Source/WebKit/efl/DefaultTheme/widget/spinner/sp_up_pressed.png b/Source/WebKit/efl/DefaultTheme/widget/spinner/sp_up_pressed.png Binary files differnew file mode 100644 index 000000000..85a741706 --- /dev/null +++ b/Source/WebKit/efl/DefaultTheme/widget/spinner/sp_up_pressed.png diff --git a/Source/WebKit/efl/DefaultTheme/widget/spinner/spinner.edc b/Source/WebKit/efl/DefaultTheme/widget/spinner/spinner.edc new file mode 100644 index 000000000..a48b8f2f2 --- /dev/null +++ b/Source/WebKit/efl/DefaultTheme/widget/spinner/spinner.edc @@ -0,0 +1,215 @@ +/* + * Copyright (C) 2012, Intel Corporation. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU Lesser General Public License, + * version 2.1, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU Lesser General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St + * - Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +group { + name: "webkit/widget/spinner"; + + images { + image: "widget/spinner/sp_bg.png" COMP; + image: "widget/spinner/sp_up_default.png" COMP; + image: "widget/spinner/sp_down_default.png" COMP; + image: "widget/spinner/sp_up_pressed.png" COMP; + image: "widget/spinner/sp_down_pressed.png" COMP; + image: "widget/spinner/sp_up_hover.png" COMP; + image: "widget/spinner/sp_down_hover.png" COMP; + } + + script { + public isSpinup; + public isEnabled; + public isPressed; + public isHovered; + + public show() { + if (get_int(isEnabled) == 1) { + set_state(PART:"up_bt", "default", 0.0); + set_state(PART:"down_bt", "default", 0.0); + if (get_int(isHovered) == 1) { + if (get_int(isSpinup)) { + set_state(PART:"up_bt", "hovered", 0.0); + if (get_int(isPressed)) + set_state(PART:"up_bt", "pressed", 0.0); + } + else { + set_state(PART:"down_bt", "hovered", 0.0); + if (get_int(isPressed)) + set_state(PART:"down_bt", "pressed", 0.0); + } + } + } + else { + set_state(PART:"up_bt", "disabled", 0.0); + set_state(PART:"down_bt", "disabled", 0.0); + } + } + } + + parts { + part { + name: "bg"; + type: IMAGE; + description { + state: "default" 0.0; + rel1 { + relative: 0.0 0.0; + offset: 0 6; + } + rel2 { + relative: 1.0 1.0; + offset: -2 -6; + } + image { + normal: "widget/spinner/sp_bg.png"; + border: 1 0 0 0; + } + } + } + + part { + name: "up_bt"; + description { + state: "default" 0.0; + min: 9 7; + max: 9 7; + fixed: 1 1; + rel1 { + relative: 0.0 0.0; + offset: 0 16; + } + rel2 { + relative: 1.0 0.0; + offset: -1 -1; + } + image.normal: "widget/spinner/sp_up_default.png"; + } + description { + state: "pressed" 0.0; + inherit: "default" 0.0; + image.normal: "widget/spinner/sp_up_pressed.png"; + } + description { + state: "disabled" 0.0; + inherit: "default" 0.0; + color: 255 255 255 150; + } + description { + state: "hovered" 0.0; + inherit: "default" 0.0; + image.normal: "widget/spinner/sp_up_hover.png"; + } + } + + part { + name: "down_bt"; + description { + state: "default" 0.0; + min: 9 7; + max: 9 7; + fixed: 1 1; + rel1 { + relative: 0.0 1.0; + offset: 0 0; + } + rel2 { + relative: 1.0 1.0; + offset: -1 -18; + } + image.normal: "widget/spinner/sp_down_default.png"; + } + description { + state: "pressed" 0.0; + inherit: "default" 0.0; + image.normal: "widget/spinner/sp_down_pressed.png"; + } + description { + state: "disabled" 0.0; + inherit: "default" 0.0; + color: 255 255 255 150; + } + description { + state: "hovered" 0.0; + inherit: "default" 0.0; + image.normal: "widget/spinner/sp_down_hover.png"; + } + } + + part { + name: "text_confinement"; + type: RECT; + description { + state: "default" 0.0; + rel1 { + relative: 0.0 0.0; + offset: 0 0; + } + rel2 { + relative: 1.0 1.0; + offset: -18 0; + } + } + } + } + + programs { + program { + name: "spinup"; + signal: "spinup"; + script { + set_int(isSpinup, 1); + show(); + } + } + + program { + name: "pressed"; + signal: "pressed"; + script { + set_int(isPressed, 1); + show(); + } + } + + program { + name: "enabled"; + signal: "enabled"; + script { + set_int(isEnabled, 1); + show(); + } + } + program { + name: "hovered"; + signal: "hovered"; + script { + set_int(isHovered, 1); + show(); + } + } + program { + name: "reset"; + signal: "reset"; + script { + set_int(isSpinup, 0); + set_int(isEnabled, 0); + set_int(isPressed, 0); + set_int(isHovered, 0); + show(); + } + } + } +} diff --git a/Source/WebKit/efl/WebCoreSupport/DumpRenderTreeSupportEfl.cpp b/Source/WebKit/efl/WebCoreSupport/DumpRenderTreeSupportEfl.cpp index f372ade3f..7e2127ab2 100644 --- a/Source/WebKit/efl/WebCoreSupport/DumpRenderTreeSupportEfl.cpp +++ b/Source/WebKit/efl/WebCoreSupport/DumpRenderTreeSupportEfl.cpp @@ -24,6 +24,7 @@ #include "FrameLoaderClientEfl.h" #include "ewk_frame_private.h" #include "ewk_history_private.h" +#include "ewk_intent_private.h" #include "ewk_private.h" #include "ewk_view_private.h" @@ -41,8 +42,10 @@ #include <HTMLInputElement.h> #include <InspectorController.h> #include <IntRect.h> +#include <Intent.h> #include <JSCSSStyleDeclaration.h> #include <JSElement.h> +#include <JavaScriptCore/OpaqueJSString.h> #include <MemoryCache.h> #include <PageGroup.h> #include <PrintContext.h> @@ -428,24 +431,6 @@ void DumpRenderTreeSupportEfl::setCSSGridLayoutEnabled(const Evas_Object* ewkVie corePage->settings()->setCSSGridLayoutEnabled(enabled); } -void DumpRenderTreeSupportEfl::setJavaScriptProfilingEnabled(const Evas_Object* ewkView, bool enabled) -{ -#if ENABLE(JAVASCRIPT_DEBUGGER) && ENABLE(INSPECTOR) - WebCore::Page* corePage = EWKPrivate::corePage(ewkView); - if (!corePage) - return; - - WebCore::InspectorController* controller = corePage->inspectorController(); - if (!controller) - return; - - if (enabled) - controller->enableProfiler(); - else - controller->disableProfiler(); -#endif -} - bool DumpRenderTreeSupportEfl::isCommandEnabled(const Evas_Object* ewkView, const char* name) { WebCore::Page* page = EWKPrivate::corePage(ewkView); @@ -684,6 +669,27 @@ void DumpRenderTreeSupportEfl::setSerializeHTTPLoads(bool enabled) WebCore::resourceLoadScheduler()->setSerialLoadingEnabled(enabled); } +void DumpRenderTreeSupportEfl::sendWebIntentResponse(Ewk_Intent_Request* request, JSStringRef response) +{ +#if ENABLE(WEB_INTENTS) + JSC::UString responseString = response->ustring(); + if (responseString.isNull()) + ewk_intent_request_failure_post(request, WebCore::SerializedScriptValue::create(String::fromUTF8("ERROR"))); + else + ewk_intent_request_result_post(request, WebCore::SerializedScriptValue::create(String(responseString.impl()))); +#endif +} + +WebCore::MessagePortChannelArray* DumpRenderTreeSupportEfl::intentMessagePorts(const Ewk_Intent* intent) +{ +#if ENABLE(WEB_INTENTS) + const WebCore::Intent* coreIntent = EWKPrivate::coreIntent(intent); + return coreIntent ? coreIntent->messagePorts() : 0; +#else + return 0; +#endif +} + void DumpRenderTreeSupportEfl::setComposition(Evas_Object* ewkView, const char* text, int start, int length) { WebCore::Page* page = EWKPrivate::corePage(ewkView); diff --git a/Source/WebKit/efl/WebCoreSupport/DumpRenderTreeSupportEfl.h b/Source/WebKit/efl/WebCoreSupport/DumpRenderTreeSupportEfl.h index 2379f2013..c8007a213 100644 --- a/Source/WebKit/efl/WebCoreSupport/DumpRenderTreeSupportEfl.h +++ b/Source/WebKit/efl/WebCoreSupport/DumpRenderTreeSupportEfl.h @@ -31,11 +31,15 @@ typedef struct _Evas_Object Evas_Object; typedef struct _Ewk_History_Item Ewk_History_Item; +typedef struct _Ewk_Intent Ewk_Intent; +typedef struct _Ewk_Intent_Request Ewk_Intent_Request; typedef Vector<Ewk_History_Item*> HistoryItemChildrenVector; namespace WebCore { class Frame; +class MessagePortChannel; +typedef Vector<OwnPtr<MessagePortChannel>, 1> MessagePortChannelArray; } class EAPI DumpRenderTreeSupportEfl { @@ -77,7 +81,6 @@ public: static bool findString(const Evas_Object* ewkView, const String& text, WebCore::FindOptions); static bool isCommandEnabled(const Evas_Object* ewkView, const char* name); static void setCSSGridLayoutEnabled(const Evas_Object* ewkView, bool enabled); - static void setJavaScriptProfilingEnabled(const Evas_Object* ewkView, bool enabled); static void setSmartInsertDeleteEnabled(Evas_Object* ewkView, bool enabled); static void setSelectTrailingWhitespaceEnabled(Evas_Object* ewkView, bool enabled); @@ -105,6 +108,10 @@ public: static JSValueRef computedStyleIncludingVisitedInfo(JSContextRef, JSValueRef); static void setAuthorAndUserStylesEnabled(Evas_Object* ewkView, bool); static void setSerializeHTTPLoads(bool); + + // Web Intents + static void sendWebIntentResponse(Ewk_Intent_Request*, JSStringRef response); + static WebCore::MessagePortChannelArray* intentMessagePorts(const Ewk_Intent*); // TextInputController static void setComposition(Evas_Object*, const char*, int, int); diff --git a/Source/WebKit/efl/WebCoreSupport/EditorClientEfl.h b/Source/WebKit/efl/WebCoreSupport/EditorClientEfl.h index 583fc6ec6..d1feeb477 100644 --- a/Source/WebKit/efl/WebCoreSupport/EditorClientEfl.h +++ b/Source/WebKit/efl/WebCoreSupport/EditorClientEfl.h @@ -150,7 +150,7 @@ public: virtual void getGuessesForWord(const String& word, const String& context, WTF::Vector<String>& guesses); virtual void willSetInputMethodState(); virtual void setInputMethodState(bool enabled); - virtual void requestCheckingOfString(WebCore::SpellChecker*, const WebCore::TextCheckingRequest&) { } + virtual void requestCheckingOfString(WTF::PassRefPtr<WebCore::TextCheckingRequest>) { } virtual TextCheckerClient* textChecker() { return this; } private: diff --git a/Source/WebKit/efl/ewk/ewk_intent.cpp b/Source/WebKit/efl/ewk/ewk_intent.cpp index 9302263d2..e1da07f80 100644 --- a/Source/WebKit/efl/ewk/ewk_intent.cpp +++ b/Source/WebKit/efl/ewk/ewk_intent.cpp @@ -159,7 +159,7 @@ Eina_List* ewk_intent_extra_names_get(const Ewk_Intent* intent) * Creates a new Ewk_Intent object. * * @param core WebCore::Intent instance to use internally. - * @return a new allocated the Ewk_Intent object on sucess or @c 0 on failure + * @return a new allocated the Ewk_Intent object on success or @c 0 on failure */ Ewk_Intent* ewk_intent_new(WebCore::Intent* core) { @@ -188,4 +188,14 @@ void ewk_intent_free(Ewk_Intent* intent) eina_stringshare_del(intent->service); delete intent; } + +namespace EWKPrivate { + +WebCore::Intent* coreIntent(const Ewk_Intent* intent) +{ + EWK_INTENT_CORE_GET_OR_RETURN(intent, core, 0); + return core; +} + +} // namespace EWKPrivate #endif diff --git a/Source/WebKit/efl/ewk/ewk_intent_private.h b/Source/WebKit/efl/ewk/ewk_intent_private.h index 394622946..aaec903a8 100644 --- a/Source/WebKit/efl/ewk/ewk_intent_private.h +++ b/Source/WebKit/efl/ewk/ewk_intent_private.h @@ -29,11 +29,20 @@ namespace WebCore { class Intent; class IntentRequest; +class SerializedScriptValue; } Ewk_Intent* ewk_intent_new(WebCore::Intent* core); void ewk_intent_free(Ewk_Intent* intent); Ewk_Intent_Request* ewk_intent_request_new(PassRefPtr<WebCore::IntentRequest> core); + +void ewk_intent_request_result_post(Ewk_Intent_Request* request, PassRefPtr<WebCore::SerializedScriptValue> result); +void ewk_intent_request_failure_post(Ewk_Intent_Request* request, PassRefPtr<WebCore::SerializedScriptValue> failure); + +namespace EWKPrivate { +WebCore::Intent* coreIntent(const Ewk_Intent* intent); +} // namespace EWKPrivate + #endif #endif // ewk_intent_private_h diff --git a/Source/WebKit/efl/ewk/ewk_intent_request.cpp b/Source/WebKit/efl/ewk/ewk_intent_request.cpp index e70f274a2..4c30782fb 100644 --- a/Source/WebKit/efl/ewk/ewk_intent_request.cpp +++ b/Source/WebKit/efl/ewk/ewk_intent_request.cpp @@ -80,27 +80,43 @@ Ewk_Intent* ewk_intent_request_intent_get(const Ewk_Intent_Request* request) #endif } -void ewk_intent_request_result_post(Ewk_Intent_Request* request, const char* result) -{ #if ENABLE(WEB_INTENTS) +/** + * @internal + * + * Report request success. + * + * The serialized payload data will be passed to the success callback registered by the + * client. + * + * @param request request item. + * @param result serialized payload data. + */ +void ewk_intent_request_result_post(Ewk_Intent_Request* request, PassRefPtr<WebCore::SerializedScriptValue> result) +{ EWK_INTENT_REQUEST_CORE_GET_OR_RETURN(request, core); - RefPtr<WebCore::SerializedScriptValue> value = WebCore::SerializedScriptValue::create(String::fromUTF8(result)); - core->postResult(value.release().leakRef()); -#endif + core->postResult(result.get()); } -void ewk_intent_request_failure_post(Ewk_Intent_Request* request, const char* failure) +/** + * @internal + * + * Report request failure. + * + * The serialized payload data will be passed to the error callback registered by the + * client. + * + * @param request request item. + * @param failure serialized payload data. + */ +void ewk_intent_request_failure_post(Ewk_Intent_Request* request, PassRefPtr<WebCore::SerializedScriptValue> failure) { -#if ENABLE(WEB_INTENTS) EWK_INTENT_REQUEST_CORE_GET_OR_RETURN(request, core); - RefPtr<WebCore::SerializedScriptValue> value = WebCore::SerializedScriptValue::create(String::fromUTF8(failure)); - core->postFailure(value.release().leakRef()); -#endif + core->postFailure(failure.get()); } -#if ENABLE(WEB_INTENTS) /** * @internal * diff --git a/Source/WebKit/efl/ewk/ewk_intent_request.h b/Source/WebKit/efl/ewk/ewk_intent_request.h index 7554644c0..22c71d6b0 100644 --- a/Source/WebKit/efl/ewk/ewk_intent_request.h +++ b/Source/WebKit/efl/ewk/ewk_intent_request.h @@ -56,26 +56,6 @@ EAPI void ewk_intent_request_unref(Ewk_Intent_Request *request); */ EAPI Ewk_Intent *ewk_intent_request_intent_get(const Ewk_Intent_Request *request); -/** - * Report request success. - * - * The payload data will be passed to the success callback registered by the client. - * - * @param request request item. - * @param result payload data. - */ -EAPI void ewk_intent_request_result_post(Ewk_Intent_Request *request, const char *result); - -/** - * Report request failure. - * - * The payload data will be passed to the error callback registered by the client. - * - * @param request request item. - * @param failure payload data. - */ -EAPI void ewk_intent_request_failure_post(Ewk_Intent_Request *request, const char *failure); - #ifdef __cplusplus } #endif diff --git a/Source/WebKit/efl/ewk/ewk_security_origin.cpp b/Source/WebKit/efl/ewk/ewk_security_origin.cpp index e5b6a3393..66064a029 100644 --- a/Source/WebKit/efl/ewk/ewk_security_origin.cpp +++ b/Source/WebKit/efl/ewk/ewk_security_origin.cpp @@ -20,6 +20,7 @@ #include "config.h" #include "ewk_security_origin.h" +#include "ApplicationCache.h" #include "ApplicationCacheStorage.h" #include "DatabaseTracker.h" #include "SecurityOrigin.h" @@ -89,6 +90,11 @@ void ewk_security_origin_application_cache_quota_set(const Ewk_Security_Origin* WebCore::cacheStorage().storeUpdatedQuotaForOrigin(origin->securityOrigin.get(), quota); } +void ewk_security_origin_application_cache_clear(const Ewk_Security_Origin* origin) +{ + WebCore::ApplicationCache::deleteCacheForOrigin(origin->securityOrigin.get()); +} + Eina_List* ewk_security_origin_web_database_get_all(const Ewk_Security_Origin* origin) { Eina_List* databases = 0; @@ -117,6 +123,11 @@ void ewk_security_origin_free(Ewk_Security_Origin* origin) delete origin; } +Ewk_Security_Origin* ewk_security_origin_new_from_string(const char* url) +{ + return ewk_security_origin_new(WebCore::SecurityOrigin::createFromString(String::fromUTF8(url)).get()); +} + /** * @internal * Creates a EWK wrapper for WebCore Security Origin object. diff --git a/Source/WebKit/efl/ewk/ewk_security_origin.h b/Source/WebKit/efl/ewk/ewk_security_origin.h index 04148b486..98abf769a 100644 --- a/Source/WebKit/efl/ewk/ewk_security_origin.h +++ b/Source/WebKit/efl/ewk/ewk_security_origin.h @@ -51,7 +51,7 @@ typedef struct _Ewk_Security_Origin Ewk_Security_Origin; * * @return the protocol scheme */ -EAPI const char *ewk_security_origin_protocol_get(Ewk_Security_Origin *o); +EAPI const char *ewk_security_origin_protocol_get(Ewk_Security_Origin *o); /** * Returns the host of the security origin. @@ -63,7 +63,7 @@ EAPI const char *ewk_security_origin_protocol_get(Ewk_Security_Origin *o); * * @return the host domain */ -EAPI const char *ewk_security_origin_host_get(Ewk_Security_Origin *o); +EAPI const char *ewk_security_origin_host_get(Ewk_Security_Origin *o); /** * Returns the port of the security origin. @@ -72,7 +72,7 @@ EAPI const char *ewk_security_origin_host_get(Ewk_Security_Origin *o); * * @return the port */ -EAPI uint32_t ewk_security_origin_port_get(const Ewk_Security_Origin *o); +EAPI uint32_t ewk_security_origin_port_get(const Ewk_Security_Origin *o); /** * Retrieves the usage of a database for a security origin. @@ -84,7 +84,7 @@ EAPI uint32_t ewk_security_origin_port_get(const Ewk_Security_Origin *o); * * @return the usage in bytes */ -EAPI uint64_t ewk_security_origin_web_database_usage_get(const Ewk_Security_Origin *o); +EAPI uint64_t ewk_security_origin_web_database_usage_get(const Ewk_Security_Origin *o); /** * Retrieves the quota of a database for a security origin. @@ -96,7 +96,7 @@ EAPI uint64_t ewk_security_origin_web_database_usage_get(const Ewk_Security_ * * @return the quota in bytes */ -EAPI uint64_t ewk_security_origin_web_database_quota_get(const Ewk_Security_Origin *o); +EAPI uint64_t ewk_security_origin_web_database_quota_get(const Ewk_Security_Origin *o); /** * Sets the database usage quota for a security origin. @@ -107,7 +107,7 @@ EAPI uint64_t ewk_security_origin_web_database_quota_get(const Ewk_Security_ * @param o security origin object * @param quota the usage quota in bytes */ -EAPI void ewk_security_origin_web_database_quota_set(const Ewk_Security_Origin *o, uint64_t quota); +EAPI void ewk_security_origin_web_database_quota_set(const Ewk_Security_Origin *o, uint64_t quota); /** * Sets the application cache usage quota for a security origin. @@ -115,7 +115,14 @@ EAPI void ewk_security_origin_web_database_quota_set(const Ewk_Security_ * @param o security origin object * @param quota the usage quota in bytes */ -EAPI void ewk_security_origin_application_cache_quota_set(const Ewk_Security_Origin *o, int64_t quota); +EAPI void ewk_security_origin_application_cache_quota_set(const Ewk_Security_Origin *o, int64_t quota); + +/** + * Clears the application cache for a security origin. + * + * @param o security origin object. + */ +EAPI void ewk_security_origin_application_cache_clear(const Ewk_Security_Origin *o); /** * Return the list of web databases in the security origin. @@ -133,14 +140,24 @@ EAPI void ewk_security_origin_application_cache_quota_set(const Ewk_Secu * @see ewk_web_database_free() * @see ewk_web_database_list_free() */ -EAPI Eina_List *ewk_security_origin_web_database_get_all(const Ewk_Security_Origin *o); +EAPI Eina_List *ewk_security_origin_web_database_get_all(const Ewk_Security_Origin *o); /** * Release all resources allocated by a security origin object. * * @param o security origin object */ -EAPI void ewk_security_origin_free(Ewk_Security_Origin *o); +EAPI void ewk_security_origin_free(Ewk_Security_Origin *o); + +/** + * Creates a security origin for a url. + * + * @param url the url for the security origin. + * + * @return the security origin object + */ +EAPI Ewk_Security_Origin *ewk_security_origin_new_from_string(const char *url); + #ifdef __cplusplus } diff --git a/Source/WebKit/efl/ewk/ewk_view.h b/Source/WebKit/efl/ewk/ewk_view.h index 4331bd8c7..cc6503812 100644 --- a/Source/WebKit/efl/ewk/ewk_view.h +++ b/Source/WebKit/efl/ewk/ewk_view.h @@ -177,7 +177,7 @@ struct _Ewk_View_Smart_Class { Eina_Bool (*run_javascript_confirm)(Ewk_View_Smart_Data *sd, Evas_Object *frame, const char *message); Eina_Bool (*run_javascript_prompt)(Ewk_View_Smart_Data *sd, Evas_Object *frame, const char *message, const char *defaultValue, char **value); Eina_Bool (*should_interrupt_javascript)(Ewk_View_Smart_Data *sd); - uint64_t (*exceeded_application_cache_quota)(Ewk_View_Smart_Data *sd, Ewk_Security_Origin* origin, int64_t defaultOriginQuota, int64_t totalSpaceNeeded); + int64_t (*exceeded_application_cache_quota)(Ewk_View_Smart_Data *sd, Ewk_Security_Origin* origin, int64_t defaultOriginQuota, int64_t totalSpaceNeeded); uint64_t (*exceeded_database_quota)(Ewk_View_Smart_Data *sd, Evas_Object *frame, const char *databaseName, uint64_t current_size, uint64_t expected_size); Eina_Bool (*run_open_panel)(Ewk_View_Smart_Data *sd, Evas_Object *frame, Eina_Bool allows_multiple_files, Eina_List *accept_types, Eina_List **selected_filenames); diff --git a/Source/WebKit/gtk/ChangeLog b/Source/WebKit/gtk/ChangeLog index 71935613b..9ed422cae 100644 --- a/Source/WebKit/gtk/ChangeLog +++ b/Source/WebKit/gtk/ChangeLog @@ -1,3 +1,96 @@ +2012-05-31 Hajime Morrita <morrita@chromium.org> + + REGRESSION(r117572): editing/spelling/spellcheck-async-remove-frame.html crashes on Mac + https://bugs.webkit.org/show_bug.cgi?id=86859 + + Reviewed by Ryosuke Niwa. + + * WebCoreSupport/TextCheckerClientGtk.h: + (WebKit::TextCheckerClientGtk::requestCheckingOfString): + +2012-05-31 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r119113. + http://trac.webkit.org/changeset/119113 + https://bugs.webkit.org/show_bug.cgi?id=88016 + + This caused multiple regressions (Requested by mrobinson on + #webkit). + + * WebCoreSupport/TextCheckerClientGtk.cpp: + (WebKit::TextCheckerClientGtk::checkSpellingOfString): + * webkit/webkitspellcheckerenchant.cpp: + (checkSpellingOfString): + +2012-05-31 Sudarsana Nagineni <sudarsana.nagineni@linux.intel.com> + + [GTK] Memory leak in webkit_web_view_init + https://bugs.webkit.org/show_bug.cgi?id=87943 + + Reviewed by Martin Robinson. + + Fixed a memory leak in webkit_web_view_init by making the + UserMediaClientGtk to be owned by the WebView. + + * webkit/webkitwebview.cpp: + (webkit_web_view_init): + * webkit/webkitwebviewprivate.h: + +2012-05-31 Martin Robinson <mrobinson@igalia.com> + + Spell checker doesn't recognize contractions (apostrophes) + https://bugs.webkit.org/show_bug.cgi?id=86118 + + Reviewed by Gustavo Noronha Silva. + + The Enchant spell checker was breaking words on apostrophes, because + apparently they were always being detected as Pango word-end + characters. To know whether or not the apostrophe is a + word end character requires looking at a string with a larger + granularity than one character. + + Simplify the way the we break strings, by search for non-graphable + character manually to find word starts and ends. This has the side + effect of removing the dependency on Pango and eliminating one copy. + + This change also cleans up some misbehavior on the part of the + WebCoreSupport layer which was not converting from Unicode character + offsets to UTF-16. These offsets can be different if any of the + characters in the UTF-16 string are surrogate pairs (non BMP + characters). + + * WebCoreSupport/TextCheckerClientGtk.cpp: + (WebKit::TextCheckerClientGtk::checkSpellingOfString): Properly + convert from Unicode offsets to UTF-16 offsets. + * webkit/webkitspellcheckerenchant.cpp: + (findByteOffsetToFirstNonGraphableCharacter): Added this helper. + (getExtentsOfNextWord): Ditto. + (wordIsSpelledCorrectlyInAtLeastOneDictionary): Ditto. + (checkSpellingOfString): Don't split words on apostrophes. + +2012-05-30 Sudarsana Nagineni <sudarsana.nagineni@linux.intel.com> + + [GTK] [WK2] Memory leak in webkitWebViewBaseStartDrag + https://bugs.webkit.org/show_bug.cgi?id=87756 + + Reviewed by Carlos Garcia Campos. + + Fixed a memory leak in drag and drop by using adoptRef instead + of just getting a new reference of targetList. + + * WebCoreSupport/DragClientGtk.cpp: + (WebKit::DragClient::startDrag): + +2012-05-25 Jesus Sanchez-Palencia <jesus.palencia@openbossa.org> + + WebKitTestRunner needs to support layoutTestController.setJavaScriptProfilingEnabled + https://bugs.webkit.org/show_bug.cgi?id=42328 + + Reviewed by Eric Seidel. + + * webkit/webkitwebinspector.cpp: + (webkit_web_inspector_set_property): + 2012-05-25 Lu Guanqun <guanqun.lu@intel.com> [GTK] fix compilation for webkitwebview.cpp diff --git a/Source/WebKit/gtk/WebCoreSupport/DragClientGtk.cpp b/Source/WebKit/gtk/WebCoreSupport/DragClientGtk.cpp index bc8747d6b..92800d9fa 100644 --- a/Source/WebKit/gtk/WebCoreSupport/DragClientGtk.cpp +++ b/Source/WebKit/gtk/WebCoreSupport/DragClientGtk.cpp @@ -79,7 +79,7 @@ void DragClient::startDrag(DragImageRef image, const IntPoint& dragImageOrigin, WebKitWebView* webView = webkit_web_frame_get_web_view(kit(frame)); RefPtr<DataObjectGtk> dataObject = clipboardGtk->dataObject(); - GRefPtr<GtkTargetList> targetList(PasteboardHelper::defaultPasteboardHelper()->targetListForDataObject(dataObject.get())); + GRefPtr<GtkTargetList> targetList = adoptGRef(PasteboardHelper::defaultPasteboardHelper()->targetListForDataObject(dataObject.get())); GOwnPtr<GdkEvent> currentEvent(gtk_get_current_event()); GdkDragContext* context = gtk_drag_begin(GTK_WIDGET(m_webView), targetList.get(), dragOperationToGdkDragActions(clipboard->sourceOperation()), 1, currentEvent.get()); diff --git a/Source/WebKit/gtk/WebCoreSupport/TextCheckerClientGtk.h b/Source/WebKit/gtk/WebCoreSupport/TextCheckerClientGtk.h index 26d13d5bb..b4861df36 100644 --- a/Source/WebKit/gtk/WebCoreSupport/TextCheckerClientGtk.h +++ b/Source/WebKit/gtk/WebCoreSupport/TextCheckerClientGtk.h @@ -49,7 +49,7 @@ class TextCheckerClientGtk : public WebCore::TextCheckerClient { virtual WTF::String getAutoCorrectSuggestionForMisspelledWord(const WTF::String&); virtual void checkGrammarOfString(const UChar*, int length, WTF::Vector<WebCore::GrammarDetail>&, int* badGrammarLocation, int* badGrammarLength); virtual void getGuessesForWord(const WTF::String& word, const WTF::String& context, WTF::Vector<WTF::String>& guesses); - virtual void requestCheckingOfString(WebCore::SpellChecker*, const WebCore::TextCheckingRequest&) { } + virtual void requestCheckingOfString(WTF::PassRefPtr<WebCore::TextCheckingRequest>) { } void updateSpellCheckingLanguage(const char*); private: diff --git a/Source/WebKit/gtk/webkit/webkitwebinspector.cpp b/Source/WebKit/gtk/webkit/webkitwebinspector.cpp index 692079f68..164e46367 100644 --- a/Source/WebKit/gtk/webkit/webkitwebinspector.cpp +++ b/Source/WebKit/gtk/webkit/webkitwebinspector.cpp @@ -353,11 +353,7 @@ static void webkit_web_inspector_set_property(GObject* object, guint prop_id, co case PROP_JAVASCRIPT_PROFILING_ENABLED: { #if ENABLE(JAVASCRIPT_DEBUGGER) bool enabled = g_value_get_boolean(value); - WebCore::InspectorController* controller = priv->page->inspectorController(); - if (enabled) - controller->enableProfiler(); - else - controller->disableProfiler(); + priv->page->inspectorController()->setProfilerEnabled(enabled); #else g_message("PROP_JAVASCRIPT_PROFILING_ENABLED is not work because of the javascript debugger is disabled\n"); #endif diff --git a/Source/WebKit/gtk/webkit/webkitwebview.cpp b/Source/WebKit/gtk/webkit/webkitwebview.cpp index 1a54ea877..4b5244211 100644 --- a/Source/WebKit/gtk/webkit/webkitwebview.cpp +++ b/Source/WebKit/gtk/webkit/webkitwebview.cpp @@ -119,10 +119,6 @@ #include "DeviceOrientationClientGtk.h" #endif -#if ENABLE(MEDIA_STREAM) -#include "UserMediaClientGtk.h" -#endif - /** * SECTION:webkitwebview * @short_description: The central class of the WebKitGTK+ API @@ -3555,7 +3551,8 @@ static void webkit_web_view_init(WebKitWebView* webView) #endif #if ENABLE(MEDIA_STREAM) - WebCore::provideUserMediaTo(priv->corePage, new UserMediaClientGtk); + priv->userMediaClient = adoptPtr(new UserMediaClientGtk); + WebCore::provideUserMediaTo(priv->corePage, priv->userMediaClient.get()); #endif if (DumpRenderTreeSupportGtk::dumpRenderTreeModeEnabled()) { diff --git a/Source/WebKit/gtk/webkit/webkitwebviewprivate.h b/Source/WebKit/gtk/webkit/webkitwebviewprivate.h index 0bc5a56fa..4c65d0f55 100644 --- a/Source/WebKit/gtk/webkit/webkitwebviewprivate.h +++ b/Source/WebKit/gtk/webkit/webkitwebviewprivate.h @@ -34,6 +34,10 @@ #include <webkit/webkitwebview.h> #include <wtf/gobject/GOwnPtr.h> +#if ENABLE(MEDIA_STREAM) +#include "UserMediaClientGtk.h" +#endif + namespace WebKit { WebCore::Page* core(WebKitWebView*); WebKitWebView* kit(WebCore::Page*); @@ -104,6 +108,10 @@ struct _WebKitWebViewPrivate { #if ENABLE(ICONDATABASE) gulong iconLoadedHandler; #endif + +#if ENABLE(MEDIA_STREAM) + OwnPtr<WebKit::UserMediaClientGtk> userMediaClient; +#endif }; void webkit_web_view_notify_ready(WebKitWebView*); diff --git a/Source/WebKit/mac/ChangeLog b/Source/WebKit/mac/ChangeLog index 81d5761ec..4782c02f9 100644 --- a/Source/WebKit/mac/ChangeLog +++ b/Source/WebKit/mac/ChangeLog @@ -1,3 +1,57 @@ +2012-05-31 Hajime Morrita <morrita@chromium.org> + + REGRESSION(r117572): editing/spelling/spellcheck-async-remove-frame.html crashes on Mac + https://bugs.webkit.org/show_bug.cgi?id=86859 + + Reviewed by Ryosuke Niwa. + + * WebCoreSupport/WebEditorClient.h: + * WebCoreSupport/WebEditorClient.mm: + (-[WebEditorSpellCheckResponder initWithClient:sequence:results:]): + (-[WebEditorSpellCheckResponder perform]): + (WebEditorClient::didCheckSucceeded): + (WebEditorClient::requestCheckingOfString): + +2012-05-31 Andy Estes <aestes@apple.com> + + Disentangle code that relies on USE(AUTOMATIC_TEXT_REPLACEMENT) from that which merely relies on PLATFORM(MAC) + https://bugs.webkit.org/show_bug.cgi?id=87933 + + Reviewed by Dan Bernstein. + + * WebCoreSupport/WebEditorClient.h: + * WebCoreSupport/WebEditorClient.mm: + +2012-05-29 David Barr <davidbarr@chromium.org> + + Introduce ENABLE_CSS_IMAGE_RESOLUTION compile flag + https://bugs.webkit.org/show_bug.cgi?id=87685 + + Reviewed by Eric Seidel. + + Add a configuration option for CSS image-resolution support, disabling it by default. + + * Configurations/FeatureDefines.xcconfig: + +2012-05-29 Nikolas Zimmermann <nzimmermann@rim.com> + + SVGViewSpec DOM bindings aka SVGSVGElement.currentView is unimplemented + https://bugs.webkit.org/show_bug.cgi?id=15495 + + Reviewed by Rob Buis. + + * MigrateHeaders.make: Copy DOMSVGViewSpec*.h headers. + +2012-05-25 Jesus Sanchez-Palencia <jesus.palencia@openbossa.org> + + WebKitTestRunner needs to support layoutTestController.setJavaScriptProfilingEnabled + https://bugs.webkit.org/show_bug.cgi?id=42328 + + Reviewed by Eric Seidel. + + * WebInspector/WebInspector.mm: + (-[WebInspector setJavaScriptProfilingEnabled:]): + 2012-05-24 Tim Horton <timothy_horton@apple.com> Add feature defines for web-facing parts of CSS Regions and Exclusions diff --git a/Source/WebKit/mac/Configurations/FeatureDefines.xcconfig b/Source/WebKit/mac/Configurations/FeatureDefines.xcconfig index d4032fdba..b7255f055 100644 --- a/Source/WebKit/mac/Configurations/FeatureDefines.xcconfig +++ b/Source/WebKit/mac/Configurations/FeatureDefines.xcconfig @@ -39,6 +39,7 @@ ENABLE_CSS3_FLEXBOX = ENABLE_CSS3_FLEXBOX; ENABLE_CHANNEL_MESSAGING = ENABLE_CHANNEL_MESSAGING; ENABLE_CSS_EXCLUSIONS = ENABLE_CSS_EXCLUSIONS; ENABLE_CSS_FILTERS = ENABLE_CSS_FILTERS; +ENABLE_CSS_IMAGE_RESOLUTION = ; ENABLE_CSS_REGIONS = ENABLE_CSS_REGIONS; ENABLE_CSS_VARIABLES = ; ENABLE_DASHBOARD_SUPPORT = $(ENABLE_DASHBOARD_SUPPORT_$(REAL_PLATFORM_NAME)); @@ -126,4 +127,4 @@ ENABLE_WEB_TIMING = ; ENABLE_WORKERS = ENABLE_WORKERS; ENABLE_XSLT = ENABLE_XSLT; -FEATURE_DEFINES = $(ENABLE_3D_RENDERING) $(ENABLE_ACCELERATED_2D_CANVAS) $(ENABLE_ANIMATION_API) $(ENABLE_BLOB) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CSS3_FLEXBOX) $(ENABLE_CSS_EXCLUSIONS) $(ENABLE_CSS_FILTERS) $(ENABLE_CSS_REGIONS) $(ENABLE_CSS_SHADERS) $(ENABLE_CSS_VARIABLES) $(ENABLE_DASHBOARD_SUPPORT) $(ENABLE_DATALIST) $(ENABLE_DATA_TRANSFER_ITEMS) $(ENABLE_DETAILS) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DIRECTORY_UPLOAD) $(ENABLE_FILE_SYSTEM) $(ENABLE_FILTERS) $(ENABLE_FONT_BOOSTING) $(ENABLE_FULLSCREEN_API) $(ENABLE_GAMEPAD) $(ENABLE_GEOLOCATION) $(ENABLE_HIGH_DPI_CANVAS) $(ENABLE_ICONDATABASE) $(ENABLE_IFRAME_SEAMLESS) $(ENABLE_INDEXED_DATABASE) $(ENABLE_INPUT_TYPE_COLOR) $(ENABLE_INPUT_SPEECH) $(ENABLE_INPUT_TYPE_DATE) $(ENABLE_INPUT_TYPE_DATETIME) $(ENABLE_INPUT_TYPE_DATETIMELOCAL) $(ENABLE_INPUT_TYPE_MONTH) $(ENABLE_INPUT_TYPE_TIME) $(ENABLE_INPUT_TYPE_WEEK) $(ENABLE_JAVASCRIPT_DEBUGGER) $(ENABLE_LEGACY_NOTIFICATIONS) $(ENABLE_LINK_PREFETCH) $(ENABLE_LINK_PRERENDER) $(ENABLE_MATHML) $(ENABLE_MEDIA_SOURCE) $(ENABLE_MEDIA_STATISTICS) $(ENABLE_METER_TAG) $(ENABLE_MICRODATA) $(ENABLE_MUTATION_OBSERVERS) $(ENABLE_NOTIFICATIONS) $(ENABLE_PAGE_VISIBILITY_API) $(ENABLE_PROGRESS_TAG) $(ENABLE_QUOTA) $(ENABLE_REGISTER_PROTOCOL_HANDLER) $(ENABLE_REQUEST_ANIMATION_FRAME) $(ENABLE_SCRIPTED_SPEECH) $(ENABLE_SHADOW_DOM) $(ENABLE_SHARED_WORKERS) $(ENABLE_SQL_DATABASE) $(ENABLE_STYLE_SCOPED) $(ENABLE_SVG) $(ENABLE_SVG_DOM_OBJC_BINDINGS) $(ENABLE_SVG_FONTS) $(ENABLE_TEXT_NOTIFICATIONS_ONLY) $(ENABLE_TOUCH_ICON_LOADING) $(ENABLE_VIDEO) $(ENABLE_VIDEO_TRACK) $(ENABLE_WEBGL) $(ENABLE_WEB_AUDIO) $(ENABLE_WEB_SOCKETS) $(ENABLE_WEB_TIMING) $(ENABLE_WORKERS) $(ENABLE_XSLT); +FEATURE_DEFINES = $(ENABLE_3D_RENDERING) $(ENABLE_ACCELERATED_2D_CANVAS) $(ENABLE_ANIMATION_API) $(ENABLE_BLOB) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CSS3_FLEXBOX) $(ENABLE_CSS_EXCLUSIONS) $(ENABLE_CSS_FILTERS) $(ENABLE_CSS_IMAGE_RESOLUTION) $(ENABLE_CSS_REGIONS) $(ENABLE_CSS_SHADERS) $(ENABLE_CSS_VARIABLES) $(ENABLE_DASHBOARD_SUPPORT) $(ENABLE_DATALIST) $(ENABLE_DATA_TRANSFER_ITEMS) $(ENABLE_DETAILS) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DIRECTORY_UPLOAD) $(ENABLE_FILE_SYSTEM) $(ENABLE_FILTERS) $(ENABLE_FONT_BOOSTING) $(ENABLE_FULLSCREEN_API) $(ENABLE_GAMEPAD) $(ENABLE_GEOLOCATION) $(ENABLE_HIGH_DPI_CANVAS) $(ENABLE_ICONDATABASE) $(ENABLE_IFRAME_SEAMLESS) $(ENABLE_INDEXED_DATABASE) $(ENABLE_INPUT_TYPE_COLOR) $(ENABLE_INPUT_SPEECH) $(ENABLE_INPUT_TYPE_DATE) $(ENABLE_INPUT_TYPE_DATETIME) $(ENABLE_INPUT_TYPE_DATETIMELOCAL) $(ENABLE_INPUT_TYPE_MONTH) $(ENABLE_INPUT_TYPE_TIME) $(ENABLE_INPUT_TYPE_WEEK) $(ENABLE_JAVASCRIPT_DEBUGGER) $(ENABLE_LEGACY_NOTIFICATIONS) $(ENABLE_LINK_PREFETCH) $(ENABLE_LINK_PRERENDER) $(ENABLE_MATHML) $(ENABLE_MEDIA_SOURCE) $(ENABLE_MEDIA_STATISTICS) $(ENABLE_METER_TAG) $(ENABLE_MICRODATA) $(ENABLE_MUTATION_OBSERVERS) $(ENABLE_NOTIFICATIONS) $(ENABLE_PAGE_VISIBILITY_API) $(ENABLE_PROGRESS_TAG) $(ENABLE_QUOTA) $(ENABLE_REGISTER_PROTOCOL_HANDLER) $(ENABLE_REQUEST_ANIMATION_FRAME) $(ENABLE_SCRIPTED_SPEECH) $(ENABLE_SHADOW_DOM) $(ENABLE_SHARED_WORKERS) $(ENABLE_SQL_DATABASE) $(ENABLE_STYLE_SCOPED) $(ENABLE_SVG) $(ENABLE_SVG_DOM_OBJC_BINDINGS) $(ENABLE_SVG_FONTS) $(ENABLE_TEXT_NOTIFICATIONS_ONLY) $(ENABLE_TOUCH_ICON_LOADING) $(ENABLE_VIDEO) $(ENABLE_VIDEO_TRACK) $(ENABLE_WEBGL) $(ENABLE_WEB_AUDIO) $(ENABLE_WEB_SOCKETS) $(ENABLE_WEB_TIMING) $(ENABLE_WORKERS) $(ENABLE_XSLT); diff --git a/Source/WebKit/mac/MigrateHeaders.make b/Source/WebKit/mac/MigrateHeaders.make index fd6a1f523..163d3fa07 100644 --- a/Source/WebKit/mac/MigrateHeaders.make +++ b/Source/WebKit/mac/MigrateHeaders.make @@ -463,6 +463,8 @@ all : \ $(INTERNAL_HEADERS_DIR)/DOMSVGUseElementInternal.h \ $(PRIVATE_HEADERS_DIR)/DOMSVGViewElement.h \ $(INTERNAL_HEADERS_DIR)/DOMSVGViewElementInternal.h \ + $(PRIVATE_HEADERS_DIR)/DOMSVGViewSpec.h \ + $(INTERNAL_HEADERS_DIR)/DOMSVGViewSpecInternal.h \ $(PRIVATE_HEADERS_DIR)/DOMSVGZoomAndPan.h \ $(PRIVATE_HEADERS_DIR)/DOMSVGZoomEvent.h \ $(INTERNAL_HEADERS_DIR)/DOMSVGZoomEventInternal.h \ diff --git a/Source/WebKit/mac/WebCoreSupport/WebEditorClient.h b/Source/WebKit/mac/WebCoreSupport/WebEditorClient.h index 00b912566..1b3f3a5ab 100644 --- a/Source/WebKit/mac/WebCoreSupport/WebEditorClient.h +++ b/Source/WebKit/mac/WebCoreSupport/WebEditorClient.h @@ -76,10 +76,11 @@ public: virtual NSURL* canonicalizeURL(NSURL*) OVERRIDE; virtual NSURL* canonicalizeURLString(NSString*) OVERRIDE; -#ifndef BUILDING_ON_LEOPARD virtual void uppercaseWord() OVERRIDE; virtual void lowercaseWord() OVERRIDE; virtual void capitalizeWord() OVERRIDE; + +#if USE(AUTOMATIC_TEXT_REPLACEMENT) virtual void showSubstitutionsPanel(bool show) OVERRIDE; virtual bool substitutionsPanelIsShowing() OVERRIDE; virtual void toggleSmartInsertDelete() OVERRIDE; @@ -136,7 +137,10 @@ public: virtual void getGuessesForWord(const WTF::String& word, const WTF::String& context, WTF::Vector<WTF::String>& guesses) OVERRIDE; virtual void willSetInputMethodState() OVERRIDE; virtual void setInputMethodState(bool enabled) OVERRIDE; - virtual void requestCheckingOfString(WebCore::SpellChecker*, const WebCore::TextCheckingRequest&) OVERRIDE; + virtual void requestCheckingOfString(PassRefPtr<WebCore::TextCheckingRequest>) OVERRIDE; + + void didCheckSucceed(int sequence, NSArray* results); + private: void registerUndoOrRedoStep(PassRefPtr<WebCore::UndoStep>, bool isRedo); WebEditorClient(); @@ -144,4 +148,5 @@ private: WebView *m_webView; RetainPtr<WebEditorUndoTarget> m_undoTarget; bool m_haveUndoRedoOperations; + RefPtr<WebCore::TextCheckingRequest> m_textCheckingRequest; }; diff --git a/Source/WebKit/mac/WebCoreSupport/WebEditorClient.mm b/Source/WebKit/mac/WebCoreSupport/WebEditorClient.mm index bb4b4398a..5cc6ca4c3 100644 --- a/Source/WebKit/mac/WebCoreSupport/WebEditorClient.mm +++ b/Source/WebKit/mac/WebCoreSupport/WebEditorClient.mm @@ -376,8 +376,6 @@ void WebEditorClient::setInsertionPasteboard(const String& pasteboardName) [m_webView _setInsertionPasteboard:pasteboard]; } - -#ifndef BUILDING_ON_LEOPARD void WebEditorClient::uppercaseWord() { [m_webView uppercaseWord:nil]; @@ -393,6 +391,7 @@ void WebEditorClient::capitalizeWord() [m_webView capitalizeWord:nil]; } +#if USE(AUTOMATIC_TEXT_REPLACEMENT) void WebEditorClient::showSubstitutionsPanel(bool show) { NSPanel *spellingPanel = [[NSSpellChecker sharedSpellChecker] substitutionsPanel]; @@ -461,7 +460,7 @@ void WebEditorClient::toggleAutomaticSpellingCorrection() { [m_webView toggleAutomaticSpellingCorrection:nil]; } -#endif +#endif // USE(AUTOMATIC_TEXT_REPLACEMENT) bool WebEditorClient::shouldInsertNode(Node *node, Range* replacingRange, EditorInsertAction givenAction) { @@ -927,47 +926,54 @@ void WebEditorClient::setInputMethodState(bool) #ifndef BUILDING_ON_LEOPARD @interface WebEditorSpellCheckResponder : NSObject { - WebCore::SpellChecker* _sender; + WebEditorClient* _client; int _sequence; - TextCheckingTypeMask _types; RetainPtr<NSArray> _results; } -- (id)initWithSender:(WebCore::SpellChecker*)sender sequence:(int)sequence types:(WebCore::TextCheckingTypeMask)types results:(NSArray*)results; +- (id)initWithClient:(WebEditorClient*)client sequence:(int)sequence results:(NSArray*)results; - (void)perform; @end @implementation WebEditorSpellCheckResponder -- (id)initWithSender:(WebCore::SpellChecker*)sender sequence:(int)sequence types:(WebCore::TextCheckingTypeMask)types results:(NSArray*)results +- (id)initWithClient:(WebEditorClient*)client sequence:(int)sequence results:(NSArray*)results { self = [super init]; if (!self) return nil; - _sender = sender; + _client = client; _sequence = sequence; - _types = types; _results = results; return self; } - (void)perform { - _sender->didCheckSucceeded(_sequence, core(_results.get(), _types)); + _client->didCheckSucceed(_sequence, _results.get()); } @end #endif -void WebEditorClient::requestCheckingOfString(WebCore::SpellChecker* sender, const WebCore::TextCheckingRequest& request) +void WebEditorClient::didCheckSucceed(int sequence, NSArray* results) +{ + ASSERT_UNUSED(sequence, sequence == m_textCheckingRequest->sequence()); + m_textCheckingRequest->didSucceed(core(results, m_textCheckingRequest->mask())); + m_textCheckingRequest.clear(); +} + +void WebEditorClient::requestCheckingOfString(PassRefPtr<WebCore::TextCheckingRequest> request) { #ifndef BUILDING_ON_LEOPARD - NSRange range = NSMakeRange(0, request.text().length()); + ASSERT(!m_textCheckingRequest); + m_textCheckingRequest = request; + + int sequence = m_textCheckingRequest->sequence(); + NSRange range = NSMakeRange(0, m_textCheckingRequest->text().length()); NSRunLoop* currentLoop = [NSRunLoop currentRunLoop]; - int sequence = request.sequence(); - TextCheckingTypeMask types = request.mask(); - [[NSSpellChecker sharedSpellChecker] requestCheckingOfString:request.text() range:range types:NSTextCheckingAllSystemTypes options:0 inSpellDocumentWithTag:0 + [[NSSpellChecker sharedSpellChecker] requestCheckingOfString:m_textCheckingRequest->text() range:range types:NSTextCheckingAllSystemTypes options:0 inSpellDocumentWithTag:0 completionHandler:^(NSInteger, NSArray* results, NSOrthography*, NSInteger) { [currentLoop performSelector:@selector(perform) - target:[[[WebEditorSpellCheckResponder alloc] initWithSender:sender sequence:sequence types:types results:results] autorelease] + target:[[[WebEditorSpellCheckResponder alloc] initWithClient:this sequence:sequence results:results] autorelease] argument:nil order:0 modes:[NSArray arrayWithObject:NSDefaultRunLoopMode]]; }]; #endif diff --git a/Source/WebKit/mac/WebInspector/WebInspector.mm b/Source/WebKit/mac/WebInspector/WebInspector.mm index 67a73542d..08f4bfad2 100644 --- a/Source/WebKit/mac/WebInspector/WebInspector.mm +++ b/Source/WebKit/mac/WebInspector/WebInspector.mm @@ -149,10 +149,7 @@ using namespace WebCore; if (!page) return; - if (enabled) - page->inspectorController()->enableProfiler(); - else - page->inspectorController()->disableProfiler(); + page->inspectorController()->setProfilerEnabled(enabled); } - (BOOL)isTimelineProfilingEnabled diff --git a/Source/WebKit/qt/Api/qgraphicswebview.cpp b/Source/WebKit/qt/Api/qgraphicswebview.cpp index 3f6fe1471..d194f9fc3 100644 --- a/Source/WebKit/qt/Api/qgraphicswebview.cpp +++ b/Source/WebKit/qt/Api/qgraphicswebview.cpp @@ -313,7 +313,7 @@ bool QGraphicsWebView::sceneEvent(QEvent* event) if (d->page && (event->type() == QEvent::TouchBegin || event->type() == QEvent::TouchEnd || event->type() == QEvent::TouchUpdate -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) +#if HAVE(QT5) || event->type() == QEvent::TouchCancel #endif )) { diff --git a/Source/WebKit/qt/Api/qgraphicswebview.h b/Source/WebKit/qt/Api/qgraphicswebview.h index 15fe087d6..c7ca44aad 100644 --- a/Source/WebKit/qt/Api/qgraphicswebview.h +++ b/Source/WebKit/qt/Api/qgraphicswebview.h @@ -23,7 +23,7 @@ #include "qwebkitglobal.h" #include "qwebpage.h" #include <QtCore/qurl.h> -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) +#if defined(HAVE_QT5) && HAVE_QT5 #include <QtWidgets/qgraphicswidget.h> #else #include <QtGui/qgraphicswidget.h> diff --git a/Source/WebKit/qt/Api/qwebframe.cpp b/Source/WebKit/qt/Api/qwebframe.cpp index f09a8a80d..aba58db0c 100644 --- a/Source/WebKit/qt/Api/qwebframe.cpp +++ b/Source/WebKit/qt/Api/qwebframe.cpp @@ -116,7 +116,7 @@ #include <qregion.h> #include <qnetworkrequest.h> -#if ENABLE(ORIENTATION_EVENTS) && QT_VERSION < QT_VERSION_CHECK(5, 0, 0) +#if ENABLE(ORIENTATION_EVENTS) && !HAVE(QT5) QTM_USE_NAMESPACE #endif diff --git a/Source/WebKit/qt/Api/qwebframe_p.h b/Source/WebKit/qt/Api/qwebframe_p.h index 4ab7b9700..82fd92033 100644 --- a/Source/WebKit/qt/Api/qwebframe_p.h +++ b/Source/WebKit/qt/Api/qwebframe_p.h @@ -30,9 +30,9 @@ #include "PlatformString.h" #if ENABLE(ORIENTATION_EVENTS) #include "qorientationsensor.h" -#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) +#if !(defined(HAVE_QT5) && HAVE_QT5) using QTM_NAMESPACE::QOrientationSensor; -#endif // QT_VERSION < QT_VERSION_CHECK(5, 0, 0). +#endif #endif // ENABLE(ORIENTATION_EVENTS). #include "qwebelement.h" #include "wtf/RefPtr.h" diff --git a/Source/WebKit/qt/Api/qwebpage.cpp b/Source/WebKit/qt/Api/qwebpage.cpp index d9b00773b..8fb319dd4 100644 --- a/Source/WebKit/qt/Api/qwebpage.cpp +++ b/Source/WebKit/qt/Api/qwebpage.cpp @@ -3151,7 +3151,7 @@ bool QWebPage::event(QEvent *ev) case QEvent::TouchBegin: case QEvent::TouchUpdate: case QEvent::TouchEnd: -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) +#if HAVE(QT5) case QEvent::TouchCancel: #endif // Return whether the default action was cancelled in the JS event handler diff --git a/Source/WebKit/qt/Api/qwebpage.h b/Source/WebKit/qt/Api/qwebpage.h index 0bf35e247..fce68a8c4 100644 --- a/Source/WebKit/qt/Api/qwebpage.h +++ b/Source/WebKit/qt/Api/qwebpage.h @@ -26,7 +26,7 @@ #include <QtCore/qobject.h> #include <QtCore/qurl.h> -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) +#if defined(HAVE_QT5) && HAVE_QT5 #include <QtWidgets/qwidget.h> #else #include <QtGui/qwidget.h> diff --git a/Source/WebKit/qt/Api/qwebsettings.cpp b/Source/WebKit/qt/Api/qwebsettings.cpp index 4e01836f7..5425a9270 100644 --- a/Source/WebKit/qt/Api/qwebsettings.cpp +++ b/Source/WebKit/qt/Api/qwebsettings.cpp @@ -46,7 +46,7 @@ #include "FileSystem.h" #include <QApplication> -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) +#if HAVE(QT5) #include <QStandardPaths> #else #include <QDesktopServices> @@ -1151,7 +1151,7 @@ void QWebSettings::enablePersistentStorage(const QString& path) if (path.isEmpty()) { -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) +#if HAVE(QT5) storagePath = QStandardPaths::writableLocation(QStandardPaths::DataLocation); #else storagePath = QDesktopServices::storageLocation(QDesktopServices::DataLocation); @@ -1174,7 +1174,7 @@ void QWebSettings::enablePersistentStorage(const QString& path) #if ENABLE(NETSCAPE_PLUGIN_METADATA_CACHE) // All applications can share the common QtWebkit cache file(s). // Path is not configurable and uses QDesktopServices::CacheLocation by default. -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) +#if HAVE(QT5) QString cachePath = QStandardPaths::writableLocation(QStandardPaths::CacheLocation); #else QString cachePath = QDesktopServices::storageLocation(QDesktopServices::CacheLocation); diff --git a/Source/WebKit/qt/Api/qwebview.cpp b/Source/WebKit/qt/Api/qwebview.cpp index 937d3bdca..76bf39277 100644 --- a/Source/WebKit/qt/Api/qwebview.cpp +++ b/Source/WebKit/qt/Api/qwebview.cpp @@ -704,7 +704,7 @@ bool QWebView::event(QEvent *e) } else if (e->type() == QEvent::TouchBegin || e->type() == QEvent::TouchEnd || e->type() == QEvent::TouchUpdate -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) +#if HAVE(QT5) || e->type() == QEvent::TouchCancel #endif ) { diff --git a/Source/WebKit/qt/Api/qwebview.h b/Source/WebKit/qt/Api/qwebview.h index 90d0a8e3b..c31aa355b 100644 --- a/Source/WebKit/qt/Api/qwebview.h +++ b/Source/WebKit/qt/Api/qwebview.h @@ -23,7 +23,7 @@ #include "qwebkitglobal.h" #include "qwebpage.h" -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) +#if defined(HAVE_QT5) && HAVE_QT5 #include <QtWidgets/qwidget.h> #else #include <QtGui/qwidget.h> diff --git a/Source/WebKit/qt/ChangeLog b/Source/WebKit/qt/ChangeLog index bf8496bbb..3980c1975 100644 --- a/Source/WebKit/qt/ChangeLog +++ b/Source/WebKit/qt/ChangeLog @@ -1,3 +1,70 @@ +2012-05-31 Hajime Morrita <morrita@chromium.org> + + REGRESSION(r117572): editing/spelling/spellcheck-async-remove-frame.html crashes on Mac + https://bugs.webkit.org/show_bug.cgi?id=86859 + + Reviewed by Ryosuke Niwa. + + * WebCoreSupport/TextCheckerClientQt.h: + (WebCore::TextCheckerClientQt::requestCheckingOfString): + +2012-05-31 Tor Arne Vestbø <tor.arne.vestbo@nokia.com> + + [Qt] Simplify QT_VERSION_CHECKS for Qt5 by introducing HAVE(QT5) + https://bugs.webkit.org/show_bug.cgi?id=87955 + + Reviewed by Simon Hausmann. + + * Api/qgraphicswebview.cpp: + * Api/qgraphicswebview.h: + * Api/qwebframe.cpp: + * Api/qwebframe_p.h: + * Api/qwebpage.cpp: + * Api/qwebpage.h: + * Api/qwebsettings.cpp: + * Api/qwebview.cpp: + * Api/qwebview.h: + * WebCoreSupport/FrameLoaderClientQt.cpp: + * WebCoreSupport/GeolocationClientQt.cpp: + * WebCoreSupport/GeolocationClientQt.h: + * WebCoreSupport/PageClientQt.cpp: + * WebCoreSupport/WebEventConversion.cpp: + * declarative/plugin.cpp: + * tests/qwebframe/tst_qwebframe.cpp: + * tests/util.h: + +2012-05-29 Tor Arne Vestbø <tor.arne.vestbo@nokia.com> + + [Qt] Sync up favicon-implementation with WebView url changes in r118158 + + https://bugs.webkit.org/show_bug.cgi?id=87133 + + We now base64-encode the page url in the image-provider url, so that any + normalization done by QUrl will not mess up the page-url. The logic of + creating and parsing the provider-url has been moved into the image + provider, to keep it in one place. + + We were also releasing icons (even ones we hadn't retained), which we can't + do since we don't know when the icon url is no longer in use. + + Reviewed-by Simon Hausmann. + + * declarative/plugin.cpp: + * declarative/public.pri: + +2012-05-25 Jesus Sanchez-Palencia <jesus.palencia@openbossa.org> + + WebKitTestRunner needs to support layoutTestController.setJavaScriptProfilingEnabled + https://bugs.webkit.org/show_bug.cgi?id=42328 + + Reviewed by Eric Seidel. + + Removed unneeded setJavaScriptProfilingEnabled function from DRT after its + move to windows.internals.settings. + + * WebCoreSupport/DumpRenderTreeSupportQt.cpp: + * WebCoreSupport/DumpRenderTreeSupportQt.h: + 2012-05-27 Simon Hausmann <simon.hausmann@nokia.com> [Qt] Trivial unreviewed build fix with newer Qt diff --git a/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp b/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp index ff7d00627..e70bf004a 100644 --- a/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp +++ b/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp @@ -301,20 +301,6 @@ void DumpRenderTreeSupportQt::setAutofilled(const QWebElement& element, bool isA inputElement->setAutofilled(isAutofilled); } -void DumpRenderTreeSupportQt::setJavaScriptProfilingEnabled(QWebFrame* frame, bool enabled) -{ -#if ENABLE(JAVASCRIPT_DEBUGGER) && ENABLE(INSPECTOR) - Frame* coreFrame = QWebFramePrivate::core(frame); - InspectorController* controller = coreFrame->page()->inspectorController(); - if (!controller) - return; - if (enabled) - controller->enableProfiler(); - else - controller->disableProfiler(); -#endif -} - void DumpRenderTreeSupportQt::setValueForUser(const QWebElement& element, const QString& value) { WebCore::Element* webElement = element.m_element; @@ -1274,11 +1260,6 @@ void QWEBKIT_EXPORT qt_drt_run(bool b) DumpRenderTreeSupportQt::setDumpRenderTreeModeEnabled(b); } -void QWEBKIT_EXPORT qt_drt_setJavaScriptProfilingEnabled(QWebFrame* frame, bool enabled) -{ - DumpRenderTreeSupportQt::setJavaScriptProfilingEnabled(frame, enabled); -} - void QWEBKIT_EXPORT qt_drt_whiteListAccessFromOrigin(const QString& sourceOrigin, const QString& destinationProtocol, const QString& destinationHost, bool allowDestinationSubdomains) { DumpRenderTreeSupportQt::whiteListAccessFromOrigin(sourceOrigin, destinationProtocol, destinationHost, allowDestinationSubdomains); diff --git a/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h b/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h index 2c96fb3a2..41800fabd 100644 --- a/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h +++ b/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h @@ -125,7 +125,6 @@ public: static void garbageCollectorCollect(); static void garbageCollectorCollectOnAlternateThread(bool waitUntilDone); static void setAutofilled(const QWebElement&, bool enabled); - static void setJavaScriptProfilingEnabled(QWebFrame*, bool enabled); static void setValueForUser(const QWebElement&, const QString& value); static int javaScriptObjectsCount(); static void clearScriptWorlds(); diff --git a/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp b/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp index e816b9f21..097d7d889 100644 --- a/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp +++ b/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp @@ -1603,7 +1603,7 @@ PassRefPtr<Widget> FrameLoaderClientQt::createPlugin(const IntSize& pluginSize, Vector<String> params = paramNames; Vector<String> values = paramValues; if (mimeType == "application/x-shockwave-flash") { -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) +#if HAVE(QT5) const bool shouldInjectWmode = true; #else // Inject wmode=opaque when there is no client or the client is not a QWebView. diff --git a/Source/WebKit/qt/WebCoreSupport/GeolocationClientQt.cpp b/Source/WebKit/qt/WebCoreSupport/GeolocationClientQt.cpp index 8551cf906..ec4d1bb9e 100644 --- a/Source/WebKit/qt/WebCoreSupport/GeolocationClientQt.cpp +++ b/Source/WebKit/qt/WebCoreSupport/GeolocationClientQt.cpp @@ -37,9 +37,9 @@ #include "qwebpage.h" #include "qwebpage_p.h" -#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) +#if !HAVE(QT5) #include <QGeoPositionInfoSource> -#elif QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) +#elif HAVE(QT5) #include <QtLocation/QGeoPositionInfoSource> #endif diff --git a/Source/WebKit/qt/WebCoreSupport/GeolocationClientQt.h b/Source/WebKit/qt/WebCoreSupport/GeolocationClientQt.h index 9d07a9155..94b0f6531 100644 --- a/Source/WebKit/qt/WebCoreSupport/GeolocationClientQt.h +++ b/Source/WebKit/qt/WebCoreSupport/GeolocationClientQt.h @@ -31,13 +31,13 @@ #include <QObject> #include <wtf/RefPtr.h> -#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) +#if !HAVE(QT5) #include <QGeoPositionInfo> namespace QtMobility { class QGeoPositionInfoSource; }; using namespace QtMobility; -#elif QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) +#elif HAVE(QT5) #include <QtLocation/QGeoPositionInfo> class QGeoPositionInfoSource; #endif diff --git a/Source/WebKit/qt/WebCoreSupport/PageClientQt.cpp b/Source/WebKit/qt/WebCoreSupport/PageClientQt.cpp index ed61d1f96..93be5a5e2 100644 --- a/Source/WebKit/qt/WebCoreSupport/PageClientQt.cpp +++ b/Source/WebKit/qt/WebCoreSupport/PageClientQt.cpp @@ -30,7 +30,7 @@ #if ENABLE(WEBGL) #include <QGLWidget> -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) +#if HAVE(QT5) #include <QWindow> #endif @@ -50,7 +50,7 @@ static void createPlatformGraphicsContext3DFromWidget(QWidget* widget, PlatformG if (glWidget->isValid()) { // Geometry can be set to zero because m_glWidget is used only for its QGLContext. glWidget->setGeometry(0, 0, 0, 0); -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) +#if HAVE(QT5) *surface = glWidget->windowHandle(); *context = glWidget->context()->contextHandle(); #else @@ -69,7 +69,7 @@ static void createPlatformGraphicsContext3DFromWidget(QWidget* widget, PlatformG #include "texmap/TextureMapperLayer.h" #endif -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) +#if HAVE(QT5) QWindow* QWebPageClient::ownerWindow() const { QWidget* widget = ownerWidget(); diff --git a/Source/WebKit/qt/WebCoreSupport/TextCheckerClientQt.h b/Source/WebKit/qt/WebCoreSupport/TextCheckerClientQt.h index 22d728eb0..bf9ded465 100644 --- a/Source/WebKit/qt/WebCoreSupport/TextCheckerClientQt.h +++ b/Source/WebKit/qt/WebCoreSupport/TextCheckerClientQt.h @@ -48,7 +48,7 @@ public: virtual String getAutoCorrectSuggestionForMisspelledWord(const String& misspelledWord); virtual void checkGrammarOfString(const UChar*, int length, Vector<GrammarDetail>&, int* badGrammarLocation, int* badGrammarLength); virtual void getGuessesForWord(const String& word, const String& context, Vector<String>& guesses); - virtual void requestCheckingOfString(SpellChecker*, const TextCheckingRequest&) { } + virtual void requestCheckingOfString(WTF::PassRefPtr<WebCore::TextCheckingRequest>) { } virtual bool isContinousSpellCheckingEnabled(); virtual void toggleContinousSpellChecking(); diff --git a/Source/WebKit/qt/WebCoreSupport/WebEventConversion.cpp b/Source/WebKit/qt/WebCoreSupport/WebEventConversion.cpp index d45f8ce31..0b732a4ce 100644 --- a/Source/WebKit/qt/WebCoreSupport/WebEventConversion.cpp +++ b/Source/WebKit/qt/WebCoreSupport/WebEventConversion.cpp @@ -243,7 +243,7 @@ WebKitPlatformTouchEvent::WebKitPlatformTouchEvent(QTouchEvent* event) case QEvent::TouchEnd: m_type = PlatformEvent::TouchEnd; break; -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) +#if HAVE(QT5) case QEvent::TouchCancel: m_type = PlatformEvent::TouchCancel; break; diff --git a/Source/WebKit/qt/declarative/plugin.cpp b/Source/WebKit/qt/declarative/plugin.cpp index f8c532a06..988b36e0e 100644 --- a/Source/WebKit/qt/declarative/plugin.cpp +++ b/Source/WebKit/qt/declarative/plugin.cpp @@ -17,13 +17,15 @@ Boston, MA 02110-1301, USA. */ +#include "config.h" + #include "qglobal.h" #if defined(HAVE_QQUICK1) #include "qdeclarativewebview_p.h" #endif -#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) +#if (HAVE(QT5)) #include <QtQml/qqml.h> #include <QtQml/qqmlextensionplugin.h> #else diff --git a/Source/WebKit/qt/declarative/public.pri b/Source/WebKit/qt/declarative/public.pri index 04b17b724..576ce03ca 100644 --- a/Source/WebKit/qt/declarative/public.pri +++ b/Source/WebKit/qt/declarative/public.pri @@ -34,6 +34,8 @@ contains(DEFINES, HAVE_QQUICK1=1) { HEADERS += qdeclarativewebview_p.h } +WEBKIT += wtf + DESTDIR = $${ROOT_BUILD_DIR}/imports/$${TARGET.module_name} CONFIG += rpath diff --git a/Source/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp b/Source/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp index 2c28aef1f..3d8a2b3ce 100644 --- a/Source/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp +++ b/Source/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp @@ -2033,7 +2033,7 @@ void tst_QWebFrame::enumerate_data() << "dp1" << "dp2" << "dp3" // inherited signals and slots << "destroyed(QObject*)" << "destroyed()" -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) +#if defined(HAVE_QT5) && HAVE_QT5 << "objectNameChanged(QString)" #endif << "deleteLater()" diff --git a/Source/WebKit/qt/tests/util.h b/Source/WebKit/qt/tests/util.h index 22192bad2..2fb59e067 100644 --- a/Source/WebKit/qt/tests/util.h +++ b/Source/WebKit/qt/tests/util.h @@ -49,7 +49,7 @@ static bool waitForSignal(QObject* obj, const char* signal, int timeout = 10000) return timeoutSpy.isEmpty(); } -#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) +#if !(defined(HAVE_QT5) && HAVE_QT5) // Will try to wait for the condition while allowing event processing #define QTRY_VERIFY(__expr) \ do { \ diff --git a/Source/WebKit/win/ChangeLog b/Source/WebKit/win/ChangeLog index 8e6d35209..17b8a8747 100644 --- a/Source/WebKit/win/ChangeLog +++ b/Source/WebKit/win/ChangeLog @@ -1,3 +1,23 @@ +2012-05-31 Hajime Morrita <morrita@chromium.org> + + REGRESSION(r117572): editing/spelling/spellcheck-async-remove-frame.html crashes on Mac + https://bugs.webkit.org/show_bug.cgi?id=86859 + + Reviewed by Ryosuke Niwa. + + * WebCoreSupport/WebEditorClient.h: + (WebEditorClient::requestCheckingOfString): + +2012-05-25 Jesus Sanchez-Palencia <jesus.palencia@openbossa.org> + + WebKitTestRunner needs to support layoutTestController.setJavaScriptProfilingEnabled + https://bugs.webkit.org/show_bug.cgi?id=42328 + + Reviewed by Eric Seidel. + + * WebInspector.cpp: + (WebInspector::setJavaScriptProfilingEnabled): + 2012-05-25 Lynn Neir <lynn.neir@skype.net> Added methods needed to implement backend for DRT's TextInputController on windows, https://bugs.webkit.org/show_bug.cgi?id=32021 diff --git a/Source/WebKit/win/WebCoreSupport/WebEditorClient.h b/Source/WebKit/win/WebCoreSupport/WebEditorClient.h index 1a1e7c393..16deaa3ad 100644 --- a/Source/WebKit/win/WebCoreSupport/WebEditorClient.h +++ b/Source/WebKit/win/WebCoreSupport/WebEditorClient.h @@ -112,7 +112,7 @@ public: virtual void willSetInputMethodState(); virtual void setInputMethodState(bool); - virtual void requestCheckingOfString(WebCore::SpellChecker*, const WebCore::TextCheckingRequest&) { } + virtual void requestCheckingOfString(WTF::PassRefPtr<WebCore::TextCheckingRequest>) { } virtual WebCore::TextCheckerClient* textChecker() { return this; } diff --git a/Source/WebKit/win/WebInspector.cpp b/Source/WebKit/win/WebInspector.cpp index 39c75277d..8bfa7e53a 100644 --- a/Source/WebKit/win/WebInspector.cpp +++ b/Source/WebKit/win/WebInspector.cpp @@ -232,10 +232,7 @@ HRESULT STDMETHODCALLTYPE WebInspector::setJavaScriptProfilingEnabled(BOOL enabl if (!page) return S_OK; - if (enabled) - page->inspectorController()->enableProfiler(); - else - page->inspectorController()->disableProfiler(); + page->inspectorController()->setProfilerEnabled(enabled); return S_OK; } diff --git a/Source/WebKit/wince/ChangeLog b/Source/WebKit/wince/ChangeLog index 624eeb70a..2fc0e425c 100644 --- a/Source/WebKit/wince/ChangeLog +++ b/Source/WebKit/wince/ChangeLog @@ -1,3 +1,26 @@ +2012-05-31 Hajime Morrita <morrita@chromium.org> + + REGRESSION(r117572): editing/spelling/spellcheck-async-remove-frame.html crashes on Mac + https://bugs.webkit.org/show_bug.cgi?id=86859 + + Reviewed by Ryosuke Niwa. + + * WebCoreSupport/EditorClientWinCE.h: + (WebKit::EditorClientWinCE::requestCheckingOfString): + +2012-05-30 Patrick Gansterer <paroga@webkit.org> + + Unreviewed WinCE build fix after r115926. + + * WebView.cpp: + +2012-05-30 Patrick Gansterer <paroga@webkit.org> + + Unreviewed WinCE build fix after r117470. + + * WebCoreSupport/EditorClientWinCE.h: + (EditorClientWinCE): + 2012-05-18 MORITA Hajime <morrita@google.com> Another unreviewed attempt to fix build breakage on r117572. diff --git a/Source/WebKit/wince/WebCoreSupport/EditorClientWinCE.h b/Source/WebKit/wince/WebCoreSupport/EditorClientWinCE.h index 165a9d798..394802a19 100644 --- a/Source/WebKit/wince/WebCoreSupport/EditorClientWinCE.h +++ b/Source/WebKit/wince/WebCoreSupport/EditorClientWinCE.h @@ -90,7 +90,7 @@ public: virtual void textWillBeDeletedInTextField(WebCore::Element*); virtual void textDidChangeInTextArea(WebCore::Element*); - virtual bool shouldEraseMarkersAfterChangeSelection(TextCheckingType) const; + virtual bool shouldEraseMarkersAfterChangeSelection(WebCore::TextCheckingType) const; virtual void ignoreWordInSpellDocument(const WTF::String&); virtual void learnWord(const WTF::String&); virtual void checkSpellingOfString(const UChar*, int, int*, int*); @@ -103,7 +103,7 @@ public: virtual void getGuessesForWord(const WTF::String& word, const WTF::String& context, WTF::Vector<WTF::String>& guesses); virtual void willSetInputMethodState(); virtual void setInputMethodState(bool); - virtual void requestCheckingOfString(WebCore::SpellChecker*, const WebCore::TextCheckingRequest&) { } + virtual void requestCheckingOfString(WTF::PassRefPtr<WebCore::TextCheckingRequest>) { } virtual WebCore::TextCheckerClient* textChecker() { return this; } private: diff --git a/Source/WebKit/wince/WebView.cpp b/Source/WebKit/wince/WebView.cpp index 032a32f22..fcc04d7db 100644 --- a/Source/WebKit/wince/WebView.cpp +++ b/Source/WebKit/wince/WebView.cpp @@ -36,6 +36,7 @@ #include "FrameLoaderClientWinCE.h" #include "FrameView.h" #include "GraphicsContext.h" +#include "HTMLFormElement.h" #include "InitializeThreading.h" #include "InspectorClientWinCE.h" #include "IntSize.h" diff --git a/Source/WebKit/wx/ChangeLog b/Source/WebKit/wx/ChangeLog index c74ddf64e..077cdd463 100644 --- a/Source/WebKit/wx/ChangeLog +++ b/Source/WebKit/wx/ChangeLog @@ -1,3 +1,13 @@ +2012-05-31 Hajime Morrita <morrita@chromium.org> + + REGRESSION(r117572): editing/spelling/spellcheck-async-remove-frame.html crashes on Mac + https://bugs.webkit.org/show_bug.cgi?id=86859 + + Reviewed by Ryosuke Niwa. + + * WebKitSupport/EditorClientWx.h: + (WebCore::EditorClientWx::requestCheckingOfString): + 2012-05-18 MORITA Hajime <morrita@google.com> Another unreviewed attempt to fix build breakage on r117572. diff --git a/Source/WebKit/wx/WebKitSupport/EditorClientWx.h b/Source/WebKit/wx/WebKitSupport/EditorClientWx.h index 4ac6d73cf..12cd5f959 100644 --- a/Source/WebKit/wx/WebKitSupport/EditorClientWx.h +++ b/Source/WebKit/wx/WebKitSupport/EditorClientWx.h @@ -116,7 +116,7 @@ public: virtual void willSetInputMethodState(); virtual void setInputMethodState(bool enabled); - virtual void requestCheckingOfString(WebCore::SpellChecker*, const WebCore::TextCheckingRequest&) { } + virtual void requestCheckingOfString(WTF::PassRefPtr<WebCore::TextCheckingRequest>) { } virtual TextCheckerClient* textChecker() { return this; } private: |