summaryrefslogtreecommitdiff
path: root/Source/WebKit/blackberry/Api
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebKit/blackberry/Api')
-rw-r--r--Source/WebKit/blackberry/Api/BackingStore.cpp31
-rw-r--r--Source/WebKit/blackberry/Api/BackingStore_p.h1
-rw-r--r--Source/WebKit/blackberry/Api/WebPage.cpp61
-rw-r--r--Source/WebKit/blackberry/Api/WebPage.h11
-rw-r--r--Source/WebKit/blackberry/Api/WebPageClient.h3
-rw-r--r--Source/WebKit/blackberry/Api/WebPage_p.h11
6 files changed, 106 insertions, 12 deletions
diff --git a/Source/WebKit/blackberry/Api/BackingStore.cpp b/Source/WebKit/blackberry/Api/BackingStore.cpp
index eeda7dd8a..ddc873fe0 100644
--- a/Source/WebKit/blackberry/Api/BackingStore.cpp
+++ b/Source/WebKit/blackberry/Api/BackingStore.cpp
@@ -79,6 +79,7 @@ const int s_renderTimerTimeout = 1.0;
WebPage* BackingStorePrivate::s_currentBackingStoreOwner = 0;
Platform::Graphics::Buffer* BackingStorePrivate::s_overScrollImage = 0;
std::string BackingStorePrivate::s_overScrollImagePath;
+Platform::IntSize BackingStorePrivate::s_overScrollImageSize;
typedef std::pair<int, int> Divisor;
typedef Vector<Divisor> DivisorList;
@@ -1207,43 +1208,38 @@ bool BackingStorePrivate::ensureOverScrollImage()
if (s_overScrollImage && path == s_overScrollImagePath)
return true;
- std::string imagePath = Platform::Client::get()->getApplicationDirectory() + path;
+ std::string imagePath = Platform::Client::get()->getApplicationLocalDirectory() + path;
SkBitmap bitmap;
-
if (!SkImageDecoder::DecodeFile(imagePath.c_str(), &bitmap)) {
BlackBerry::Platform::log(BlackBerry::Platform::LogLevelCritical,
"BackingStorePrivate::ensureOverScrollImage could not decode overscroll image: %s", imagePath.c_str());
return false;
}
- // FIXME: Make it orientation and resolution agnostic
- if (bitmap.width() != surfaceSize().width() || bitmap.height() != surfaceSize().height())
- return false;
-
- // FIXME: For now we fallback to solid color if sizes don't match, later we can implement tiling
+ destroyBuffer(s_overScrollImage);
s_overScrollImage = createBuffer(Platform::IntSize(bitmap.width(), bitmap.height()), Platform::Graphics::TemporaryBuffer);
SkCanvas* canvas = Platform::Graphics::lockBufferDrawable(s_overScrollImage);
-
if (!canvas) {
destroyBuffer(s_overScrollImage);
s_overScrollImage = 0;
return false;
}
+
SkPaint paint;
paint.setXfermodeMode(SkXfermode::kSrc_Mode);
paint.setFlags(SkPaint::kAntiAlias_Flag);
paint.setFilterBitmap(true);
SkRect rect = SkRect::MakeXYWH(0, 0, bitmap.width(), bitmap.height());
-
canvas->save();
canvas->drawBitmapRect(bitmap, 0, rect, &paint);
canvas->restore();
Platform::Graphics::releaseBufferDrawable(s_overScrollImage);
+ s_overScrollImageSize = Platform::IntSize(bitmap.width(), bitmap.height());
s_overScrollImagePath = path;
return true;
@@ -1278,9 +1274,20 @@ void BackingStorePrivate::paintDefaultBackground(const Platform::IntRect& conten
overScrollRect.intersect(Platform::IntRect(Platform::IntPoint(0, 0), surfaceSize()));
}
- if (ensureOverScrollImage())
- blitToWindow(overScrollRect, s_overScrollImage, overScrollRect, false, 255);
- else
+ if (ensureOverScrollImage()) {
+ // Tile the image on the window region.
+ Platform::IntRect dstRect;
+ for (int y = overScrollRect.y(); y < overScrollRect.y() + overScrollRect.height(); y += dstRect.height()) {
+ for (int x = overScrollRect.x(); x < overScrollRect.x() + overScrollRect.width(); x += dstRect.width()) {
+ Platform::IntRect imageRect = Platform::IntRect(Platform::IntPoint(x - (x % s_overScrollImageSize.width()),
+ y - (y % s_overScrollImageSize.height())), s_overScrollImageSize);
+ dstRect = imageRect;
+ dstRect.intersect(overScrollRect);
+ Platform::IntRect srcRect = Platform::IntRect(x - imageRect.x(), y - imageRect.y(), dstRect.width(), dstRect.height());
+ blitToWindow(dstRect, s_overScrollImage, srcRect, false, 255);
+ }
+ }
+ } else
clearWindow(overScrollRect, color.red(), color.green(), color.blue(), color.alpha());
}
}
diff --git a/Source/WebKit/blackberry/Api/BackingStore_p.h b/Source/WebKit/blackberry/Api/BackingStore_p.h
index 25b6c8c6b..24e94659b 100644
--- a/Source/WebKit/blackberry/Api/BackingStore_p.h
+++ b/Source/WebKit/blackberry/Api/BackingStore_p.h
@@ -371,6 +371,7 @@ public:
static Platform::Graphics::Buffer* s_overScrollImage;
static std::string s_overScrollImagePath;
+ static Platform::IntSize s_overScrollImageSize;
protected:
virtual ~BackingStorePrivate();
diff --git a/Source/WebKit/blackberry/Api/WebPage.cpp b/Source/WebKit/blackberry/Api/WebPage.cpp
index 21e906a3b..b1255d1ba 100644
--- a/Source/WebKit/blackberry/Api/WebPage.cpp
+++ b/Source/WebKit/blackberry/Api/WebPage.cpp
@@ -20,6 +20,7 @@
#include "WebPage.h"
#include "ApplicationCacheStorage.h"
+#include "AutofillManager.h"
#include "BackForwardController.h"
#include "BackForwardListImpl.h"
#include "BackingStoreClient.h"
@@ -35,6 +36,7 @@
#include "ContextMenuClientBlackBerry.h"
#include "CookieManager.h"
#include "CredentialManager.h"
+#include "CredentialStorage.h"
#include "CredentialTransformData.h"
#include "DOMSupport.h"
#include "Database.h"
@@ -82,6 +84,7 @@
#include "Page.h"
#include "PageCache.h"
#include "PageGroup.h"
+#include "PagePopupBlackBerry.h"
#include "PlatformTouchEvent.h"
#include "PlatformWheelEvent.h"
#include "PluginDatabase.h"
@@ -304,6 +307,11 @@ protected:
typedef DeferredTask<isActive> DeferredTaskType;
};
+void WebPage::autofillTextField(const string& item)
+{
+ d->m_autofillManager->autofillTextField(item.c_str());
+}
+
WebPagePrivate::WebPagePrivate(WebPage* webPage, WebPageClient* client, const IntRect& rect)
: m_webPage(webPage)
, m_client(client)
@@ -372,6 +380,9 @@ WebPagePrivate::WebPagePrivate(WebPage* webPage, WebPageClient* client, const In
, m_hasInRegionScrollableAreas(false)
, m_updateDelegatedOverlaysDispatched(false)
, m_deferredTasksTimer(this, &WebPagePrivate::deferredTasksTimerFired)
+ , m_selectPopup(0)
+ , m_parentPopup(0)
+ , m_autofillManager(AutofillManager::create(this))
{
static bool isInitialized = false;
if (!isInitialized) {
@@ -2121,6 +2132,14 @@ PageClientBlackBerry::SaveCredentialType WebPagePrivate::notifyShouldSaveCredent
return static_cast<PageClientBlackBerry::SaveCredentialType>(m_client->notifyShouldSaveCredential(isNew));
}
+void WebPagePrivate::notifyPopupAutofillDialog(const Vector<String>& candidates, const WebCore::IntRect& screenRect)
+{
+ vector<string> textItems;
+ for (size_t i = 0; i < candidates.size(); i++)
+ textItems.push_back(candidates[i].utf8().data());
+ m_client->notifyPopupAutofillDialog(textItems, screenRect);
+}
+
bool WebPagePrivate::useFixedLayout() const
{
return true;
@@ -3806,6 +3825,9 @@ bool WebPagePrivate::handleMouseEvent(PlatformMouseEvent& mouseEvent)
if (mouseEvent.type() == WebCore::PlatformEvent::MouseScroll)
return true;
+ if (m_parentPopup)
+ m_parentPopup->handleMouseEvent(mouseEvent);
+
Node* node = 0;
if (mouseEvent.inputMethod() == TouchScreen) {
const FatFingersResult lastFatFingersResult = m_touchEventHandler->lastFatFingersResult();
@@ -5171,6 +5193,11 @@ void WebPage::clearCredentials()
#endif
}
+void WebPage::clearAutofillData()
+{
+ AutofillManager::clear();
+}
+
void WebPage::clearNeverRememberSites()
{
#if ENABLE(BLACKBERRY_CREDENTIAL_PERSIST)
@@ -5277,6 +5304,11 @@ bool WebPage::nodeHasHover(const WebDOMNode& node)
}
#endif
+void WebPage::initPopupWebView(BlackBerry::WebKit::WebPage* webPage)
+{
+ d->m_selectPopup->init(webPage);
+}
+
String WebPagePrivate::findPatternStringForUrl(const KURL& url) const
{
if ((m_webSettings->shouldHandlePatternUrls() && protocolIs(url, "pattern"))
@@ -5994,6 +6026,8 @@ void WebPagePrivate::didChangeSettings(WebSettings* webSettings)
cookieManager().setPrivateMode(webSettings->isPrivateBrowsingEnabled());
+ CredentialStorage::setPrivateMode(webSettings->isPrivateBrowsingEnabled());
+
if (m_mainFrame && m_mainFrame->view()) {
Color backgroundColor(webSettings->backgroundColor());
m_mainFrame->view()->updateBackgroundRecursively(backgroundColor, backgroundColor.hasAlpha());
@@ -6077,5 +6111,32 @@ const String& WebPagePrivate::defaultUserAgent()
return *defaultUserAgent;
}
+void WebPage::popupOpened(PagePopupBlackBerry* webPopup)
+{
+ ASSERT(!d->m_selectPopup);
+ d->m_selectPopup = webPopup;
+}
+
+void WebPage::popupClosed()
+{
+ ASSERT(d->m_selectPopup);
+ d->m_selectPopup = 0;
+}
+
+bool WebPage::hasOpenedPopup() const
+{
+ return d->m_selectPopup;
+}
+
+PagePopupBlackBerry* WebPage::popup()
+{
+ return d->m_selectPopup;
+}
+
+void WebPagePrivate::setParentPopup(PagePopupBlackBerry* webPopup)
+{
+ m_parentPopup = webPopup;
+}
+
}
}
diff --git a/Source/WebKit/blackberry/Api/WebPage.h b/Source/WebKit/blackberry/Api/WebPage.h
index 82d4ef6ea..b01e66424 100644
--- a/Source/WebKit/blackberry/Api/WebPage.h
+++ b/Source/WebKit/blackberry/Api/WebPage.h
@@ -38,6 +38,7 @@ namespace WebCore {
class ChromeClientBlackBerry;
class Frame;
class FrameLoaderClientBlackBerry;
+class PagePopupBlackBerry;
}
class WebDOMDocument;
@@ -195,6 +196,7 @@ public:
void clearCache();
void clearLocalStorage();
void clearCredentials();
+ void clearAutofillData();
void clearNeverRememberSites();
void runLayoutTests();
@@ -332,6 +334,14 @@ public:
void setUserViewportArguments(const WebViewportArguments&);
void resetUserViewportArguments();
+ // Popup client
+ void initPopupWebView(BlackBerry::WebKit::WebPage*);
+ void popupOpened(WebCore::PagePopupBlackBerry* webPopup);
+ void popupClosed();
+ bool hasOpenedPopup() const;
+ WebCore::PagePopupBlackBerry* popup();
+
+ void autofillTextField(const std::string&);
private:
virtual ~WebPage();
@@ -344,6 +354,7 @@ private:
friend class WebKit::WebPagePrivate;
friend class WebCore::ChromeClientBlackBerry;
friend class WebCore::FrameLoaderClientBlackBerry;
+ friend class WebCore::PagePopupBlackBerry;
WebPagePrivate* d;
};
}
diff --git a/Source/WebKit/blackberry/Api/WebPageClient.h b/Source/WebKit/blackberry/Api/WebPageClient.h
index 329660963..2ae973fdd 100644
--- a/Source/WebKit/blackberry/Api/WebPageClient.h
+++ b/Source/WebKit/blackberry/Api/WebPageClient.h
@@ -213,6 +213,7 @@ public:
virtual void setPreventsScreenIdleDimming(bool noDimming) = 0;
virtual void 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;
virtual bool shouldPluginEnterFullScreen() = 0;
virtual void didPluginEnterFullScreen() = 0;
@@ -251,6 +252,8 @@ public:
virtual void clearCache() = 0;
virtual bool hasKeyboardFocus() = 0;
+ virtual void createPopupWebView(const Platform::IntRect& webViewRect) = 0;
+ virtual void closePopupWebView() = 0;
};
} // namespace WebKit
} // namespace BlackBerry
diff --git a/Source/WebKit/blackberry/Api/WebPage_p.h b/Source/WebKit/blackberry/Api/WebPage_p.h
index 1c86c1a4a..c688c6de6 100644
--- a/Source/WebKit/blackberry/Api/WebPage_p.h
+++ b/Source/WebKit/blackberry/Api/WebPage_p.h
@@ -36,6 +36,7 @@
#include <BlackBerryPlatformMessage.h>
namespace WebCore {
+class AutofillManager;
class DOMWrapperWorld;
class Document;
class Frame;
@@ -48,6 +49,7 @@ class RenderLayer;
class RenderObject;
class ScrollView;
class TransformationMatrix;
+class PagePopupBlackBerry;
template<typename T> class Timer;
}
@@ -189,6 +191,7 @@ public:
void overflowExceedsContentsSize() { m_overflowExceedsContentsSize = true; }
void layoutFinished();
void setNeedTouchEvents(bool);
+ void notifyPopupAutofillDialog(const Vector<String>&, const WebCore::IntRect&);
// Called according to our heuristic or from setLoadState depending on whether we have a virtual viewport.
void zoomToInitialScaleOnLoad();
@@ -398,6 +401,8 @@ public:
void addBackingStoreClientForFrame(const WebCore::Frame*, BackingStoreClient*);
void removeBackingStoreClientForFrame(const WebCore::Frame*);
+ void setParentPopup(WebCore::PagePopupBlackBerry* webPopup);
+
// Clean up any document related data we might be holding.
void clearDocumentData(const WebCore::Document*);
@@ -579,6 +584,12 @@ public:
Vector<OwnPtr<DeferredTaskBase> > m_deferredTasks;
WebCore::Timer<WebPagePrivate> m_deferredTasksTimer;
+ // The popup that opened in this webpage
+ WebCore::PagePopupBlackBerry* m_selectPopup;
+ // The popup that owned this webpage
+ WebCore::PagePopupBlackBerry* m_parentPopup;
+
+ RefPtr<WebCore::AutofillManager> m_autofillManager;
protected:
virtual ~WebPagePrivate();
};