summaryrefslogtreecommitdiff
path: root/Source/WebKit/blackberry
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebKit/blackberry')
-rw-r--r--Source/WebKit/blackberry/Api/BackingStore.cpp88
-rw-r--r--Source/WebKit/blackberry/Api/BackingStore_p.h9
-rw-r--r--Source/WebKit/blackberry/Api/DumpRenderTreeClient.h2
-rw-r--r--Source/WebKit/blackberry/Api/WebAnimation.cpp80
-rw-r--r--Source/WebKit/blackberry/Api/WebAnimation.h61
-rw-r--r--Source/WebKit/blackberry/Api/WebAnimation_p.h54
-rw-r--r--Source/WebKit/blackberry/Api/WebOverlay.cpp786
-rw-r--r--Source/WebKit/blackberry/Api/WebOverlay.h130
-rw-r--r--Source/WebKit/blackberry/Api/WebOverlayClient.h43
-rw-r--r--Source/WebKit/blackberry/Api/WebOverlayOverride.cpp127
-rw-r--r--Source/WebKit/blackberry/Api/WebOverlayOverride.h68
-rw-r--r--Source/WebKit/blackberry/Api/WebOverlay_p.h267
-rw-r--r--Source/WebKit/blackberry/Api/WebPage.cpp271
-rw-r--r--Source/WebKit/blackberry/Api/WebPage.h18
-rw-r--r--Source/WebKit/blackberry/Api/WebPageClient.h6
-rw-r--r--Source/WebKit/blackberry/Api/WebPageCompositor.cpp158
-rw-r--r--Source/WebKit/blackberry/Api/WebPageCompositor.h12
-rw-r--r--Source/WebKit/blackberry/Api/WebPageCompositorClient.h1
-rw-r--r--Source/WebKit/blackberry/Api/WebPageCompositor_p.h21
-rw-r--r--Source/WebKit/blackberry/Api/WebPage_p.h21
-rw-r--r--Source/WebKit/blackberry/Api/WebSelectionOverlay.h40
-rw-r--r--Source/WebKit/blackberry/Api/WebTapHighlight.h42
-rw-r--r--Source/WebKit/blackberry/ChangeLog764
-rw-r--r--Source/WebKit/blackberry/WebCoreSupport/AboutData.cpp58
-rw-r--r--Source/WebKit/blackberry/WebCoreSupport/AboutDataEnableFeatures.in1
-rw-r--r--Source/WebKit/blackberry/WebCoreSupport/ChromeClientBlackBerry.cpp23
-rw-r--r--Source/WebKit/blackberry/WebCoreSupport/EditorClientBlackBerry.cpp2
-rw-r--r--Source/WebKit/blackberry/WebCoreSupport/EditorClientBlackBerry.h2
-rw-r--r--Source/WebKit/blackberry/WebCoreSupport/InspectorClientBlackBerry.cpp23
-rw-r--r--Source/WebKit/blackberry/WebCoreSupport/InspectorClientBlackBerry.h4
-rw-r--r--Source/WebKit/blackberry/WebCoreSupport/InspectorOverlay.cpp128
-rw-r--r--Source/WebKit/blackberry/WebCoreSupport/InspectorOverlay.h77
-rw-r--r--Source/WebKit/blackberry/WebKitSupport/DefaultTapHighlight.cpp141
-rw-r--r--Source/WebKit/blackberry/WebKitSupport/DefaultTapHighlight.h79
-rw-r--r--Source/WebKit/blackberry/WebKitSupport/FatFingers.cpp5
-rw-r--r--Source/WebKit/blackberry/WebKitSupport/GLES2Context.cpp3
-rw-r--r--Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp2
-rw-r--r--Source/WebKit/blackberry/WebKitSupport/SelectionHandler.cpp3
-rw-r--r--Source/WebKit/blackberry/WebKitSupport/SelectionOverlay.cpp125
-rw-r--r--Source/WebKit/blackberry/WebKitSupport/SelectionOverlay.h74
-rw-r--r--Source/WebKit/blackberry/WebKitSupport/TouchEventHandler.cpp10
41 files changed, 3679 insertions, 150 deletions
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);
}
}