summaryrefslogtreecommitdiffstats
path: root/WebKit
diff options
context:
space:
mode:
Diffstat (limited to 'WebKit')
-rw-r--r--WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.cpp47
-rw-r--r--WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.h3
-rw-r--r--WebKit/android/jni/WebCoreResourceLoader.cpp16
-rw-r--r--WebKit/android/jni/WebViewCore.cpp33
-rw-r--r--WebKit/android/jni/WebViewCore.h3
-rw-r--r--WebKit/android/nav/CachedFrame.cpp8
-rw-r--r--WebKit/android/nav/CachedFrame.h3
-rw-r--r--WebKit/android/nav/CachedRoot.cpp3
-rw-r--r--WebKit/android/nav/FindCanvas.cpp2
-rw-r--r--WebKit/android/nav/WebView.cpp10
10 files changed, 74 insertions, 54 deletions
diff --git a/WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.cpp b/WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.cpp
index b0b9b35..9112afe 100644
--- a/WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.cpp
+++ b/WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.cpp
@@ -56,6 +56,8 @@
#include "PluginWidget.h"
#include "ProgressTracker.h"
#include "RenderPart.h"
+#include "RenderView.h"
+#include "RenderWidget.h"
#include "ResourceError.h"
#include "ResourceHandle.h"
#include "ResourceHandleInternal.h"
@@ -84,7 +86,8 @@ FrameLoaderClientAndroid::FrameLoaderClientAndroid(WebFrame* webframe)
: m_frame(NULL)
, m_webFrame(webframe)
, m_manualLoader(NULL)
- , m_hasSentResponseToPlugin(false) {
+ , m_hasSentResponseToPlugin(false)
+ , m_onDemandPluginsEnabled(false) {
Retain(m_webFrame);
}
@@ -108,6 +111,7 @@ bool FrameLoaderClientAndroid::hasWebView() const {
}
void FrameLoaderClientAndroid::makeRepresentation(DocumentLoader*) {
+ m_onDemandPluginsEnabled = false;
// don't use representation
verifiedOk();
}
@@ -1049,10 +1053,17 @@ public:
ctx->save();
ctx->clip(frameRect());
- // Draw a 1 pixel light gray border
ctx->setFillColor(Color::white, DeviceColorSpace);
- ctx->setStrokeColor(Color::lightGray, DeviceColorSpace);
- ctx->drawRect(frameRect());
+ ctx->fillRect(frameRect());
+ if (frameRect().contains(imageRect)) {
+ // Leave a 2 pixel padding.
+ const int pixelWidth = 2;
+ IntRect innerRect = frameRect();
+ innerRect.inflate(-pixelWidth);
+ // Draw a 2 pixel light gray border.
+ ctx->setStrokeColor(Color::lightGray, DeviceColorSpace);
+ ctx->strokeRect(innerRect, pixelWidth);
+ }
// Draw the image in the center
ctx->drawImage(image.get(), DeviceColorSpace, imageRect.location());
@@ -1064,6 +1075,29 @@ public:
if (event->type() != eventNames().clickEvent)
return;
+ Frame* frame = m_parent->page()->mainFrame();
+ while (frame) {
+ RenderView* view = frame->contentRenderer();
+ const HashSet<RenderWidget*> widgets = view->widgets();
+ HashSet<RenderWidget*>::const_iterator it = widgets.begin();
+ HashSet<RenderWidget*>::const_iterator end = widgets.end();
+ for (; it != end; ++it) {
+ Widget* widget = (*it)->widget();
+ // PluginWidget is used only with PluginToggleWidget
+ if (widget->isPluginWidget()) {
+ PluginToggleWidget* ptw =
+ static_cast<PluginToggleWidget*>(widget);
+ ptw->swapPlugin(*it);
+ }
+ }
+ frame = frame->tree()->traverseNext();
+ }
+ }
+
+ void swapPlugin(RenderWidget* renderer) {
+ typedef FrameLoaderClientAndroid FLCA;
+ FLCA* client = static_cast<FLCA*>(m_parent->loader()->client());
+ client->enableOnDemandPlugins();
WTF::PassRefPtr<PluginView> prpWidget =
PluginView::create(m_parent.get(),
m_size,
@@ -1074,8 +1108,6 @@ public:
m_mimeType,
m_loadManually);
RefPtr<Widget> myProtector(this);
- RenderWidget* renderer =
- static_cast<RenderWidget*>(m_element->renderer());
prpWidget->focusPluginElement();
renderer->setWidget(prpWidget);
}
@@ -1114,7 +1146,8 @@ WTF::PassRefPtr<Widget> FrameLoaderClientAndroid::createPlugin(
Settings* settings = m_frame->settings();
// Do the placeholder if plugins are on-demand and there is a plugin for the
// given mime type.
- if (settings && settings->arePluginsOnDemand() && plugin) {
+ if (settings && settings->arePluginsOnDemand() && plugin &&
+ !m_onDemandPluginsEnabled) {
return adoptRef(new PluginToggleWidget(m_frame, size, element, url,
names, values, mimeType, loadManually));
}
diff --git a/WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.h b/WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.h
index 2fb552c..3b754b8 100644
--- a/WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.h
+++ b/WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.h
@@ -208,12 +208,15 @@ namespace android {
// FIXME: this doesn't really go here, but it's better than Frame
CacheBuilder& getCacheBuilder() { return m_cacheBuilder; }
+
+ void enableOnDemandPlugins() { m_onDemandPluginsEnabled = true; }
private:
CacheBuilder m_cacheBuilder;
Frame* m_frame;
WebFrame* m_webFrame;
PluginManualLoader* m_manualLoader;
bool m_hasSentResponseToPlugin;
+ bool m_onDemandPluginsEnabled;
enum ResourceErrors {
InternalErrorCancelled = -99,
diff --git a/WebKit/android/jni/WebCoreResourceLoader.cpp b/WebKit/android/jni/WebCoreResourceLoader.cpp
index cf32c09..297ecb0 100644
--- a/WebKit/android/jni/WebCoreResourceLoader.cpp
+++ b/WebKit/android/jni/WebCoreResourceLoader.cpp
@@ -253,6 +253,16 @@ jstring WebCoreResourceLoader::RedirectedToUrl(JNIEnv* env, jobject obj,
WebCore::ResourceRequest r = handle->request();
WebCore::KURL url(WebCore::KURL(WebCore::ParsedURLString, to_string(env, baseUrl)),
to_string(env, redirectTo));
+ WebCore::ResourceResponse* response = (WebCore::ResourceResponse*)nativeResponse;
+ // If the url fails to resolve the relative path, return null.
+ if (url.protocol().isEmpty()) {
+ delete response;
+ return NULL;
+ } else {
+ // Ensure the protocol is lowercase.
+ url.setProtocol(url.protocol().lower());
+ }
+ // Set the url after updating the protocol.
r.setURL(url);
if (r.httpMethod() == "POST") {
r.setHTTPMethod("GET");
@@ -260,12 +270,6 @@ jstring WebCoreResourceLoader::RedirectedToUrl(JNIEnv* env, jobject obj,
r.setHTTPBody(0);
r.setHTTPContentType("");
}
- WebCore::ResourceResponse* response = (WebCore::ResourceResponse*)nativeResponse;
- // If the url fails to resolve the relative path, return null.
- if (url.protocol().isEmpty()) {
- delete response;
- return NULL;
- }
handle->client()->willSendRequest(handle, r, *response);
delete response;
WebCore::String s = url.string();
diff --git a/WebKit/android/jni/WebViewCore.cpp b/WebKit/android/jni/WebViewCore.cpp
index 2a90f36..8dc58d2 100644
--- a/WebKit/android/jni/WebViewCore.cpp
+++ b/WebKit/android/jni/WebViewCore.cpp
@@ -1632,9 +1632,6 @@ void WebViewCore::moveMouse(WebCore::Frame* frame, int x, int y)
x, y, m_scrollOffsetX, m_scrollOffsetY);
if (!frame || CacheBuilder::validNode(m_mainFrame, frame, NULL) == false)
frame = m_mainFrame;
-#if USE(ACCELERATED_COMPOSITING) && ENABLE(COMPOSITED_FIXED_ELEMENTS)
- markPositionedObjectsForLayout();
-#endif
// mouse event expects the position in the window coordinate
m_mousePos = WebCore::IntPoint(x - m_scrollOffsetX, y - m_scrollOffsetY);
// validNode will still return true if the node is null, as long as we have
@@ -1982,9 +1979,6 @@ void WebViewCore::listBoxRequest(WebCoreReply* reply, const uint16_t** labels, s
bool WebViewCore::key(const PlatformKeyboardEvent& event)
{
-#if USE(ACCELERATED_COMPOSITING) && ENABLE(COMPOSITED_FIXED_ELEMENTS)
- markPositionedObjectsForLayout();
-#endif
WebCore::EventHandler* eventHandler = m_mainFrame->eventHandler();
WebCore::Node* focusNode = currentFocus();
if (focusNode)
@@ -1996,9 +1990,6 @@ bool WebViewCore::key(const PlatformKeyboardEvent& event)
// For when the user clicks the trackball
void WebViewCore::click(WebCore::Frame* frame, WebCore::Node* node) {
-#if USE(ACCELERATED_COMPOSITING) && ENABLE(COMPOSITED_FIXED_ELEMENTS)
- markPositionedObjectsForLayout();
-#endif
if (!node) {
WebCore::IntPoint pt = m_mousePos;
pt.move(m_scrollOffsetX, m_scrollOffsetY);
@@ -2021,7 +2012,6 @@ void WebViewCore::click(WebCore::Frame* frame, WebCore::Node* node) {
}
#if USE(ACCELERATED_COMPOSITING)
-
GraphicsLayerAndroid* WebViewCore::graphicsRootLayer() const
{
RenderView* contentRenderer = m_mainFrame->contentRenderer();
@@ -2030,24 +2020,7 @@ GraphicsLayerAndroid* WebViewCore::graphicsRootLayer() const
return static_cast<GraphicsLayerAndroid*>(
contentRenderer->compositor()->rootPlatformLayer());
}
-
-#if ENABLE(COMPOSITED_FIXED_ELEMENTS)
-
-// If we have composited fixed elements, we need to mark
-// fixed elements' as needing a relayout, as they could have
-// visually moved on the UI side, without that movement being
-// reflected in webkit.
-void WebViewCore::markPositionedObjectsForLayout()
-{
- GraphicsLayerAndroid* graphicsLayer = graphicsRootLayer();
- if (graphicsLayer && graphicsLayer->hasFixedLayers() &&
- m_mainFrame->contentRenderer())
- m_mainFrame->contentRenderer()->markPositionedObjectsForLayout();
-}
-
-#endif // ENABLE(COMPOSITED_FIXED_ELEMENTS)
-
-#endif // USE(ACCELERATED_COMPOSITING)
+#endif
bool WebViewCore::handleTouchEvent(int action, int x, int y, int metaState)
{
@@ -2059,10 +2032,6 @@ bool WebViewCore::handleTouchEvent(int action, int x, int y, int metaState)
rootLayer->pauseDisplay(true);
#endif
-#if USE(ACCELERATED_COMPOSITING) && ENABLE(COMPOSITED_FIXED_ELEMENTS)
- markPositionedObjectsForLayout();
-#endif
-
#if ENABLE(TOUCH_EVENTS) // Android
WebCore::TouchEventType type = WebCore::TouchStart;
WebCore::PlatformTouchPoint::State touchState = WebCore::PlatformTouchPoint::TouchPressed;
diff --git a/WebKit/android/jni/WebViewCore.h b/WebKit/android/jni/WebViewCore.h
index 336ddca..8c885e6 100644
--- a/WebKit/android/jni/WebViewCore.h
+++ b/WebKit/android/jni/WebViewCore.h
@@ -139,9 +139,6 @@ namespace android {
GraphicsLayerAndroid* graphicsRootLayer() const;
void immediateRepaint();
void setUIRootLayer(const LayerAndroid* layer);
-#if ENABLE(COMPOSITED_FIXED_ELEMENTS)
- void markPositionedObjectsForLayout();
-#endif
#endif
/** Invalidate the view/screen, NOT the content/DOM, but expressed in
diff --git a/WebKit/android/nav/CachedFrame.cpp b/WebKit/android/nav/CachedFrame.cpp
index bd36bfb..21a4115 100644
--- a/WebKit/android/nav/CachedFrame.cpp
+++ b/WebKit/android/nav/CachedFrame.cpp
@@ -355,6 +355,7 @@ CachedNode* CachedFrame::find(WebCore::Node* node) // !!! probably debugging onl
const CachedNode* CachedFrame::findBestAt(const WebCore::IntRect& rect,
int* best, bool* inside, const CachedNode** directHit,
+ const CachedFrame** directHitFramePtr,
const CachedFrame** framePtr, int* x, int* y,
bool checkForHiddenStart) const
{
@@ -392,7 +393,7 @@ const CachedNode* CachedFrame::findBestAt(const WebCore::IntRect& rect,
// We have a direct hit.
if (*directHit == NULL) {
*directHit = test;
- *framePtr = this;
+ *directHitFramePtr = this;
*x = center.x();
*y = center.y();
} else {
@@ -402,7 +403,7 @@ const CachedNode* CachedFrame::findBestAt(const WebCore::IntRect& rect,
// This rectangle is inside the other one, so it is
// the best one.
*directHit = test;
- *framePtr = this;
+ *directHitFramePtr = this;
}
}
}
@@ -444,12 +445,13 @@ const CachedNode* CachedFrame::findBestAt(const WebCore::IntRect& rect,
for (const CachedFrame* frame = mCachedFrames.begin();
frame != mCachedFrames.end(); frame++) {
const CachedNode* frameResult = frame->findBestAt(rect, best, inside,
- directHit, framePtr, x, y, checkForHiddenStart);
+ directHit, directHitFramePtr, framePtr, x, y, checkForHiddenStart);
if (NULL != frameResult)
result = frameResult;
}
if (NULL != *directHit) {
result = *directHit;
+ *framePtr = *directHitFramePtr;
}
return result;
}
diff --git a/WebKit/android/nav/CachedFrame.h b/WebKit/android/nav/CachedFrame.h
index f7276c1..ed76583 100644
--- a/WebKit/android/nav/CachedFrame.h
+++ b/WebKit/android/nav/CachedFrame.h
@@ -92,7 +92,8 @@ public:
const CachedNode* document() const { return mCachedNodes.begin(); }
bool empty() const { return mCachedNodes.size() < 2; } // must have 1 past doc
const CachedNode* findBestAt(const WebCore::IntRect& , int* best,
- bool* inside, const CachedNode** , const CachedFrame** , int* x,
+ bool* inside, const CachedNode** , const CachedFrame** directFrame,
+ const CachedFrame** resultFrame, int* x,
int* y, bool checkForHidden) const;
const CachedFrame* findBestFrameAt(int x, int y) const;
const CachedNode* findBestHitAt(const WebCore::IntRect& ,
diff --git a/WebKit/android/nav/CachedRoot.cpp b/WebKit/android/nav/CachedRoot.cpp
index 0941c7c..71c0993 100644
--- a/WebKit/android/nav/CachedRoot.cpp
+++ b/WebKit/android/nav/CachedRoot.cpp
@@ -780,9 +780,10 @@ const CachedNode* CachedRoot::findAt(const WebCore::IntRect& rect,
int best = INT_MAX;
bool inside = false;
(const_cast<CachedRoot*>(this))->resetClippedOut();
+ const CachedFrame* directHitFramePtr;
const CachedNode* directHit = NULL;
const CachedNode* node = findBestAt(rect, &best, &inside, &directHit,
- framePtr, x, y, checkForHidden);
+ &directHitFramePtr, framePtr, x, y, checkForHidden);
DBG_NAV_LOGD("node=%d (%p)", node == NULL ? 0 : node->index(),
node == NULL ? NULL : node->nodePointer());
if (node == NULL) {
diff --git a/WebKit/android/nav/FindCanvas.cpp b/WebKit/android/nav/FindCanvas.cpp
index 1d84822..d8e908b 100644
--- a/WebKit/android/nav/FindCanvas.cpp
+++ b/WebKit/android/nav/FindCanvas.cpp
@@ -631,7 +631,7 @@ void FindOnPage::drawMatch(const SkRegion& region, SkCanvas* canvas,
void FindOnPage::findNext(bool forward)
{
- if (!m_matches || !m_matches->size())
+ if (!m_matches || !m_matches->size() || !m_hasCurrentLocation)
return;
if (forward) {
m_findIndex++;
diff --git a/WebKit/android/nav/WebView.cpp b/WebKit/android/nav/WebView.cpp
index c83ceea..0ac6bd6 100644
--- a/WebKit/android/nav/WebView.cpp
+++ b/WebKit/android/nav/WebView.cpp
@@ -1221,6 +1221,14 @@ static const CachedNode* getFocusCandidate(JNIEnv *env, jobject obj,
return root->currentFocus();
}
+static bool focusCandidateHasNextTextfield(JNIEnv *env, jobject obj)
+{
+ const CachedFrame* frame;
+ const CachedNode* cursor = getFocusCandidate(env, obj, &frame);
+ if (!cursor || !cursor->isTextInput()) return false;
+ return frame->nextTextField(cursor, 0);
+}
+
static const CachedNode* getFocusNode(JNIEnv *env, jobject obj)
{
WebView* view = GET_NATIVE_VIEW(env, obj);
@@ -1919,6 +1927,8 @@ static JNINativeMethod gJavaWebViewMethods[] = {
(void*) nativeFindNext },
{ "nativeFocusCandidateFramePointer", "()I",
(void*) nativeFocusCandidateFramePointer },
+ { "nativeFocusCandidateHasNextTextfield", "()Z",
+ (void*) focusCandidateHasNextTextfield },
{ "nativeFocusCandidateIsPassword", "()Z",
(void*) nativeFocusCandidateIsPassword },
{ "nativeFocusCandidateIsRtlText", "()Z",