summaryrefslogtreecommitdiffstats
path: root/Source/WebKit
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebKit')
-rw-r--r--Source/WebKit/android/WebCoreSupport/WebCache.cpp39
-rw-r--r--Source/WebKit/android/WebCoreSupport/WebResourceRequest.cpp35
-rw-r--r--Source/WebKit/android/WebCoreSupport/WebResourceRequest.h2
-rw-r--r--Source/WebKit/android/WebCoreSupport/WebUrlLoader.cpp5
-rw-r--r--Source/WebKit/android/WebCoreSupport/WebUrlLoaderClient.cpp3
-rw-r--r--Source/WebKit/android/WebCoreSupport/autofill/WebAutofill.cpp16
-rw-r--r--Source/WebKit/android/nav/CacheBuilder.cpp2
-rw-r--r--Source/WebKit/android/nav/CachedNode.cpp15
-rw-r--r--Source/WebKit/android/nav/CachedNode.h4
-rw-r--r--Source/WebKit/android/nav/SelectText.cpp36
-rw-r--r--Source/WebKit/android/nav/SelectText.h4
-rw-r--r--Source/WebKit/android/nav/WebView.cpp66
12 files changed, 137 insertions, 90 deletions
diff --git a/Source/WebKit/android/WebCoreSupport/WebCache.cpp b/Source/WebKit/android/WebCoreSupport/WebCache.cpp
index 3c49430..9b505ee 100644
--- a/Source/WebKit/android/WebCoreSupport/WebCache.cpp
+++ b/Source/WebKit/android/WebCoreSupport/WebCache.cpp
@@ -42,28 +42,20 @@ namespace android {
static WTF::Mutex instanceMutex;
-static const string& rootDirectory()
-{
- // This method may be called on any thread, as the Java method is
- // synchronized.
- static WTF::Mutex mutex;
- MutexLocker lock(mutex);
- static string cacheDirectory;
- if (cacheDirectory.empty()) {
- JNIEnv* env = JSC::Bindings::getJNIEnv();
- jclass bridgeClass = env->FindClass("android/webkit/JniUtil");
- jmethodID method = env->GetStaticMethodID(bridgeClass, "getCacheDirectory", "()Ljava/lang/String;");
- cacheDirectory = jstringToStdString(env, static_cast<jstring>(env->CallStaticObjectMethod(bridgeClass, method)));
- env->DeleteLocalRef(bridgeClass);
- }
- return cacheDirectory;
-}
-
static string storageDirectory()
{
- // Private cache is currently in memory only
static const char* const kDirectory = "/webviewCacheChromium";
- string storageDirectory = rootDirectory();
+
+ JNIEnv* env = JSC::Bindings::getJNIEnv();
+ jclass bridgeClass = env->FindClass("android/webkit/JniUtil");
+ jmethodID method = env->GetStaticMethodID(bridgeClass, "getCacheDirectory", "()Ljava/lang/String;");
+ string storageDirectory = jstringToStdString(env, static_cast<jstring>(env->CallStaticObjectMethod(bridgeClass, method)));
+ env->DeleteLocalRef(bridgeClass);
+
+ // Return empty string if storageDirectory is an empty string
+ if (storageDirectory.empty())
+ return storageDirectory;
+
storageDirectory.append(kDirectory);
return storageDirectory;
}
@@ -111,8 +103,13 @@ WebCache::WebCache(bool isPrivateBrowsing)
if (isPrivateBrowsing)
backendFactory = net::HttpCache::DefaultBackend::InMemory(kMaximumCacheSizeBytes / 2);
else {
- FilePath directoryPath(storageDirectory().c_str());
- backendFactory = new net::HttpCache::DefaultBackend(net::DISK_CACHE, directoryPath, kMaximumCacheSizeBytes, cacheMessageLoopProxy);
+ string storage(storageDirectory());
+ if (storage.empty()) // Can't get a storage directory from the OS
+ backendFactory = net::HttpCache::DefaultBackend::InMemory(kMaximumCacheSizeBytes / 2);
+ else {
+ FilePath directoryPath(storage.c_str());
+ backendFactory = new net::HttpCache::DefaultBackend(net::DISK_CACHE, directoryPath, kMaximumCacheSizeBytes, cacheMessageLoopProxy);
+ }
}
m_cache = new net::HttpCache(m_hostResolver.get(),
diff --git a/Source/WebKit/android/WebCoreSupport/WebResourceRequest.cpp b/Source/WebKit/android/WebCoreSupport/WebResourceRequest.cpp
index 2ede1ca..663ded8 100644
--- a/Source/WebKit/android/WebCoreSupport/WebResourceRequest.cpp
+++ b/Source/WebKit/android/WebCoreSupport/WebResourceRequest.cpp
@@ -34,22 +34,33 @@ using namespace WebCore;
namespace android {
-WebResourceRequest::WebResourceRequest(const WebCore::ResourceRequest& resourceRequest)
+WebResourceRequest::WebResourceRequest(const WebCore::ResourceRequest& resourceRequest, bool shouldBlockNetworkLoads)
{
// Set the load flags based on the WebCore request.
m_loadFlags = net::LOAD_NORMAL;
- switch (resourceRequest.cachePolicy()) {
- case ReloadIgnoringCacheData:
- m_loadFlags |= net::LOAD_VALIDATE_CACHE;
- break;
- case ReturnCacheDataElseLoad:
- m_loadFlags |= net::LOAD_PREFERRING_CACHE;
- break;
- case ReturnCacheDataDontLoad:
+
+ if (shouldBlockNetworkLoads) {
+ // In the case that the embedder has blocked network loads, we only
+ // ever try to serve content out of the cache. If WebCore has set
+ // ReloadIgnoringCacheData, we would normally attempt to validate
+ // the cached data before serving it. In the absence of network
+ // we can't do that, so we will just return whatever we have in the
+ // cache (which may well be nothing).
m_loadFlags |= net::LOAD_ONLY_FROM_CACHE;
- break;
- case UseProtocolCachePolicy:
- break;
+ } else {
+ switch (resourceRequest.cachePolicy()) {
+ case ReloadIgnoringCacheData:
+ m_loadFlags |= net::LOAD_VALIDATE_CACHE;
+ break;
+ case ReturnCacheDataElseLoad:
+ m_loadFlags |= net::LOAD_PREFERRING_CACHE;
+ break;
+ case ReturnCacheDataDontLoad:
+ m_loadFlags |= net::LOAD_ONLY_FROM_CACHE;
+ break;
+ case UseProtocolCachePolicy:
+ break;
+ }
}
// TODO: We should consider setting these flags and net::LOAD_DO_NOT_SEND_AUTH_DATA
diff --git a/Source/WebKit/android/WebCoreSupport/WebResourceRequest.h b/Source/WebKit/android/WebCoreSupport/WebResourceRequest.h
index 38f37b5..7911f02 100644
--- a/Source/WebKit/android/WebCoreSupport/WebResourceRequest.h
+++ b/Source/WebKit/android/WebCoreSupport/WebResourceRequest.h
@@ -39,7 +39,7 @@ namespace android {
class WebResourceRequest {
public:
- WebResourceRequest(const WebCore::ResourceRequest&);
+ WebResourceRequest(const WebCore::ResourceRequest&, bool shouldBlockNetworkLoads);
const std::string& method() const
{
diff --git a/Source/WebKit/android/WebCoreSupport/WebUrlLoader.cpp b/Source/WebKit/android/WebCoreSupport/WebUrlLoader.cpp
index 0c90bc5..f81fa34 100644
--- a/Source/WebKit/android/WebCoreSupport/WebUrlLoader.cpp
+++ b/Source/WebKit/android/WebCoreSupport/WebUrlLoader.cpp
@@ -50,11 +50,6 @@ PassRefPtr<WebUrlLoader> WebUrlLoader::start(FrameLoaderClient* client, WebCore:
FrameLoaderClientAndroid* androidClient = static_cast<FrameLoaderClientAndroid*>(client);
WebFrame* webFrame = androidClient->webFrame();
- if (webFrame->blockNetworkLoads() &&
- (resourceRequest.url().protocolIs("http") ||
- resourceRequest.url().protocolIs("https")))
- return NULL;
-
webFrame->maybeSavePassword(androidClient->getFrame(), resourceRequest);
RefPtr<WebUrlLoader> loader = WebUrlLoader::create(webFrame, resourceHandle, resourceRequest);
diff --git a/Source/WebKit/android/WebCoreSupport/WebUrlLoaderClient.cpp b/Source/WebKit/android/WebCoreSupport/WebUrlLoaderClient.cpp
index 56a9539..a6e58c8 100644
--- a/Source/WebKit/android/WebCoreSupport/WebUrlLoaderClient.cpp
+++ b/Source/WebKit/android/WebCoreSupport/WebUrlLoaderClient.cpp
@@ -110,7 +110,8 @@ WebUrlLoaderClient::WebUrlLoaderClient(WebFrame* webFrame, WebCore::ResourceHand
, m_sync(false)
, m_finished(false)
{
- WebResourceRequest webResourceRequest(resourceRequest);
+ bool block = webFrame->blockNetworkLoads() && (resourceRequest.url().protocolIs("http") || resourceRequest.url().protocolIs("https"));
+ WebResourceRequest webResourceRequest(resourceRequest, block);
UrlInterceptResponse* intercept = webFrame->shouldInterceptRequest(resourceRequest.url().string());
if (intercept) {
m_request = new WebRequest(this, webResourceRequest, intercept);
diff --git a/Source/WebKit/android/WebCoreSupport/autofill/WebAutofill.cpp b/Source/WebKit/android/WebCoreSupport/autofill/WebAutofill.cpp
index 7ab7abd..863e8b0 100644
--- a/Source/WebKit/android/WebCoreSupport/autofill/WebAutofill.cpp
+++ b/Source/WebKit/android/WebCoreSupport/autofill/WebAutofill.cpp
@@ -129,6 +129,14 @@ void WebAutofill::formsSeenImpl()
void WebAutofill::formFieldFocused(WebCore::HTMLFormControlElement* formFieldElement)
{
+ if (!enabled()) {
+ // In case that we've just been disabled and the last time we got autofill
+ // suggestions we told Java about them, clear that bit Java side now
+ // we're disabled.
+ mWebViewCore->setWebTextViewAutoFillable(FORM_NOT_AUTOFILLABLE, string16());
+ return;
+ }
+
ASSERT(formFieldElement);
Document* doc = formFieldElement->document();
@@ -149,13 +157,7 @@ void WebAutofill::formFieldFocused(WebCore::HTMLFormControlElement* formFieldEle
mLastSearchDomVersion = domVersion;
}
- if (!enabled()) {
- // In case that we've just been disabled and the last time we got autofill
- // suggestions and told Java about them, clear that bit Java side now
- // we're disabled.
- mWebViewCore->setWebTextViewAutoFillable(FORM_NOT_AUTOFILLABLE, string16());
- return;
- }
+ ASSERT(mFormManager);
// Get the FormField from the Node.
webkit_glue::FormField* formField = new webkit_glue::FormField;
diff --git a/Source/WebKit/android/nav/CacheBuilder.cpp b/Source/WebKit/android/nav/CacheBuilder.cpp
index a4bc758..623d2cb 100644
--- a/Source/WebKit/android/nav/CacheBuilder.cpp
+++ b/Source/WebKit/android/nav/CacheBuilder.cpp
@@ -1406,7 +1406,6 @@ void CacheBuilder::BuildFrame(Frame* root, Frame* frame,
else if (cachedNode.clip(clip) == false)
continue; // skip this node if outside of the clip
}
- cachedNode.setNavableRects();
cachedNode.setColorIndex(colorIndex);
cachedNode.setExport(exported);
cachedNode.setHasCursorRing(hasCursorRing);
@@ -1478,7 +1477,6 @@ bool CacheBuilder::CleanUpContainedNodes(CachedRoot* cachedRoot,
lastNode->hasTagName(HTMLNames::formTag)) {
lastCached->setBounds(IntRect(0, 0, 0, 0));
lastCached->mCursorRing.clear();
- lastCached->setNavableRects();
return false;
}
CachedNode* onlyChildCached = cachedFrame->lastNode();
diff --git a/Source/WebKit/android/nav/CachedNode.cpp b/Source/WebKit/android/nav/CachedNode.cpp
index 86c2a38..e500875 100644
--- a/Source/WebKit/android/nav/CachedNode.cpp
+++ b/Source/WebKit/android/nav/CachedNode.cpp
@@ -92,10 +92,9 @@ void CachedNode::cursorRings(const CachedFrame* frame,
WebCore::IntRect CachedNode::cursorRingBounds(const CachedFrame* frame) const
{
- int partMax = mNavableRects;
- ASSERT(partMax > 0);
- WebCore::IntRect bounds = mCursorRing[0];
- for (int partIndex = 1; partIndex < partMax; partIndex++)
+ int partMax = navableRects();
+ WebCore::IntRect bounds;
+ for (int partIndex = 0; partIndex < partMax; partIndex++)
bounds.unite(mCursorRing[partIndex]);
bounds.inflate(CURSOR_RING_HIT_TEST_RADIUS);
return mIsInLayer ? frame->adjustBounds(this, bounds) : bounds;
@@ -116,7 +115,7 @@ void CachedNode::fixUpCursorRects(const CachedFrame* frame)
mUseHitBounds = true;
return;
}
- if (mNavableRects <= 1)
+ if (navableRects() <= 1)
return;
// if there is more than 1 rect, and the bounds doesn't intersect
// any other cursor ring bounds, use it
@@ -290,8 +289,8 @@ void CachedNode::move(int x, int y)
bool CachedNode::partRectsContains(const CachedNode* other) const
{
int outerIndex = 0;
- int outerMax = mNavableRects;
- int innerMax = other->mNavableRects;
+ int outerMax = navableRects();
+ int innerMax = other->navableRects();
do {
const WebCore::IntRect& outerBounds = mCursorRing[outerIndex];
int innerIndex = 0;
@@ -403,7 +402,7 @@ void CachedNode::Debug::print() const
DUMP_NAV_LOGD("// void* mParentGroup=%p; // (%d) \n", b->mParentGroup, mParentGroupIndex);
DUMP_NAV_LOGD("// int mDataIndex=%d;\n", b->mDataIndex);
DUMP_NAV_LOGD("// int mIndex=%d;\n", b->mIndex);
- DUMP_NAV_LOGD("// int mNavableRects=%d;\n", b->mNavableRects);
+ DUMP_NAV_LOGD("// int navableRects()=%d;\n", b->navableRects());
DUMP_NAV_LOGD("// int mParentIndex=%d;\n", b->mParentIndex);
DUMP_NAV_LOGD("// int mTabIndex=%d;\n", b->mTabIndex);
DUMP_NAV_LOGD("// int mColorIndex=%d;\n", b->mColorIndex);
diff --git a/Source/WebKit/android/nav/CachedNode.h b/Source/WebKit/android/nav/CachedNode.h
index 602dda6..321b7fd 100644
--- a/Source/WebKit/android/nav/CachedNode.h
+++ b/Source/WebKit/android/nav/CachedNode.h
@@ -136,7 +136,7 @@ public:
WebCore::IntRect localHitBounds(const CachedFrame* ) const;
WebCore::IntRect localRing(const CachedFrame* , size_t part) const;
void move(int x, int y);
- int navableRects() const { return mNavableRects; }
+ int navableRects() const { return mCursorRing.size(); }
void* nodePointer() const { return mNode; }
bool noSecondChance() const { return mCondition > SECOND_CHANCE_END; }
const WebCore::IntRect& originalAbsoluteBounds() const {
@@ -169,7 +169,6 @@ public:
void setIsTransparent(bool isTransparent) { mIsTransparent = isTransparent; }
void setIsUnclipped(bool unclipped) { mIsUnclipped = unclipped; }
void setLast() { mLast = true; }
- void setNavableRects() { mNavableRects = mCursorRing.size(); }
void setParentGroup(void* group) { mParentGroup = group; }
void setParentIndex(int parent) { mParentIndex = parent; }
void setSingleImage(bool single) { mSingleImage = single; }
@@ -195,7 +194,6 @@ private:
void* mParentGroup; // WebCore::Node*, only used to match pointers
int mDataIndex; // child frame if a frame; input data index; or -1
int mIndex; // index of itself, to find first in array (document)
- int mNavableRects; // FIXME: could be bitfield once I limit max number of rects
int mParentIndex;
int mTabIndex;
int mColorIndex; // index to ring color and other stylable properties
diff --git a/Source/WebKit/android/nav/SelectText.cpp b/Source/WebKit/android/nav/SelectText.cpp
index 8427e6f..4a6b509 100644
--- a/Source/WebKit/android/nav/SelectText.cpp
+++ b/Source/WebKit/android/nav/SelectText.cpp
@@ -51,6 +51,11 @@
#define VERBOSE_LOGGING 0
// #define EXTRA_NOISY_LOGGING 1
#define DEBUG_TOUCH_HANDLES 0
+#if DEBUG_TOUCH_HANDLES
+#define DBG_HANDLE_LOG(format, ...) LOGD("%s " format, __FUNCTION__, __VA_ARGS__)
+#else
+#define DBG_HANDLE_LOG(...)
+#endif
// TextRunIterator has been copied verbatim from GraphicsContext.cpp
namespace WebCore {
@@ -1311,6 +1316,7 @@ static WTF::String text(const SkPicture& picture, const SkIRect& area,
// from the drawable itself
#define CONTROL_HEIGHT 47
#define CONTROL_WIDTH 26
+#define CONTROL_SLOP 5
#define STROKE_WIDTH 1.0f
#define STROKE_OUTSET 3.5f
#define STROKE_I_OUTSET 4 // (int) ceil(STROKE_OUTSET)
@@ -1321,6 +1327,7 @@ static WTF::String text(const SkPicture& picture, const SkIRect& area,
SelectText::SelectText()
: m_controlWidth(CONTROL_WIDTH)
, m_controlHeight(CONTROL_HEIGHT)
+ , m_controlSlop(CONTROL_SLOP)
{
m_picture = 0;
reset();
@@ -1478,7 +1485,8 @@ static void addEnd(SkRegion* diff, const SkIRect& rect)
diff->op(bounds, SkRegion::kUnion_Op);
}
-void SelectText::getSelectionRegion(const IntRect& vis, SkRegion *region)
+void SelectText::getSelectionRegion(const IntRect& vis, SkRegion *region,
+ LayerAndroid* root)
{
SkIRect ivisBounds = vis;
ivisBounds.join(m_selStart);
@@ -1486,6 +1494,14 @@ void SelectText::getSelectionRegion(const IntRect& vis, SkRegion *region)
region->setEmpty();
buildSelection(*m_picture, ivisBounds, m_selStart, m_startBase,
m_selEnd, m_endBase, region);
+ if (root && m_layerId) {
+ Layer* layer = root->findById(m_layerId);
+ while (layer) {
+ const SkPoint& pos = layer->getPosition();
+ region->translate(pos.fX, pos.fY);
+ layer = layer->getParent();
+ }
+ }
}
void SelectText::drawSelectionRegion(SkCanvas* canvas, IntRect* inval)
@@ -1529,15 +1545,19 @@ void SelectText::drawSelectionRegion(SkCanvas* canvas, IntRect* inval)
#if DEBUG_TOUCH_HANDLES
SkRect touchHandleRect;
- paint.setColor(SkColorSetARGB(0xA0, 0xFF, 0x00, 0x00));
+ paint.setColor(SkColorSetARGB(0x60, 0xFF, 0x00, 0x00));
touchHandleRect.set(0, m_selStart.fBottom, m_selStart.fLeft, 0);
touchHandleRect.fBottom = touchHandleRect.fTop + m_controlHeight;
touchHandleRect.fLeft = touchHandleRect.fRight - m_controlWidth;
canvas->drawRect(touchHandleRect, paint);
+ touchHandleRect.inset(-m_controlSlop, -m_controlSlop);
+ canvas->drawRect(touchHandleRect, paint);
touchHandleRect.set(m_selEnd.fRight, m_selEnd.fBottom, 0, 0);
touchHandleRect.fBottom = touchHandleRect.fTop + m_controlHeight;
touchHandleRect.fRight = touchHandleRect.fLeft + m_controlWidth;
canvas->drawRect(touchHandleRect, paint);
+ touchHandleRect.inset(-m_controlSlop, -m_controlSlop);
+ canvas->drawRect(touchHandleRect, paint);
#endif
SkIRect a = diff.getBounds();
@@ -1780,6 +1800,9 @@ bool SelectText::hitCorner(int cx, int cy, int x, int y) const
{
SkIRect test;
test.set(cx, cy, cx + m_controlWidth, cy + m_controlHeight);
+ test.inset(-m_controlSlop, -m_controlSlop);
+ DBG_HANDLE_LOG("checking if %dx%d,%d-%d contains %dx%d",
+ cx, cy, m_controlWidth, m_controlHeight, x, y);
return test.contains(x, y);
}
@@ -1806,6 +1829,14 @@ bool SelectText::hitSelection(int x, int y) const
return m_selRegion.contains(x, y);
}
+void SelectText::getSelectionHandles(int* handles)
+{
+ handles[0] = m_selStart.fLeft;
+ handles[1] = m_selStart.fBottom;
+ handles[2] = m_selEnd.fRight;
+ handles[3] = m_selEnd.fBottom;
+}
+
void SelectText::moveSelection(const IntRect& vis, int x, int y)
{
if (!m_picture)
@@ -1944,6 +1975,7 @@ void SelectText::updateHandleScale(float handleScale)
{
m_controlHeight = CONTROL_HEIGHT * handleScale;
m_controlWidth = CONTROL_WIDTH * handleScale;
+ m_controlSlop = CONTROL_SLOP * handleScale;
}
/* selects the word at (x, y)
diff --git a/Source/WebKit/android/nav/SelectText.h b/Source/WebKit/android/nav/SelectText.h
index b1e1f11..4abf378 100644
--- a/Source/WebKit/android/nav/SelectText.h
+++ b/Source/WebKit/android/nav/SelectText.h
@@ -57,8 +57,9 @@ public:
void setExtendSelection(bool extend) { m_extendSelection = extend; }
bool startSelection(const CachedRoot* , const IntRect& vis, int x, int y);
bool wordSelection(const CachedRoot* , const IntRect& vis, int x, int y);
- void getSelectionRegion(const IntRect& vis, SkRegion *region);
+ void getSelectionRegion(const IntRect& vis, SkRegion *region, LayerAndroid* root);
void updateHandleScale(float handleScale);
+ void getSelectionHandles(int* handles);
public:
float m_inverseScale; // inverse scale, x, y used for drawing select path
int m_selectX;
@@ -66,6 +67,7 @@ public:
private:
int m_controlWidth;
int m_controlHeight;
+ int m_controlSlop;
class FirstCheck;
class EdgeCheck;
void drawSelectionPointer(SkCanvas* , IntRect* );
diff --git a/Source/WebKit/android/nav/WebView.cpp b/Source/WebKit/android/nav/WebView.cpp
index 0876db6..10f679d 100644
--- a/Source/WebKit/android/nav/WebView.cpp
+++ b/Source/WebKit/android/nav/WebView.cpp
@@ -420,7 +420,7 @@ void scrollRectOnScreen(const IntRect& rect)
{
if (rect.isEmpty())
return;
- SkRect visible;
+ SkRect visible = SkRect::MakeEmpty();
calcOurContentVisibleRect(&visible);
int dx = 0;
int left = rect.x();
@@ -572,10 +572,6 @@ bool drawGL(WebCore::IntRect& viewRect, WebCore::IntRect* invalRect, WebCore::In
unsigned int pic = m_glWebViewState->currentPictureCounter();
m_glWebViewState->glExtras()->setDrawExtra(extra);
- LayerAndroid* compositeLayer = compositeRoot();
- if (compositeLayer)
- compositeLayer->setExtra(0);
-
SkRect visibleRect;
calcOurContentVisibleRect(&visibleRect);
// Make sure we have valid coordinates. We might not have valid coords
@@ -650,28 +646,27 @@ PictureSet* draw(SkCanvas* canvas, SkColor bgColor, int extras, bool split)
default:
;
}
+#if USE(ACCELERATED_COMPOSITING)
+ LayerAndroid* compositeLayer = compositeRoot();
+ if (compositeLayer) {
+ SkRect visible;
+ calcOurContentVisibleRect(&visible);
+ // call this to be sure we've adjusted for any scrolling or animations
+ // before we actually draw
+ compositeLayer->updateFixedLayersPositions(visible);
+ compositeLayer->updatePositions();
+ // We have to set the canvas' matrix on the base layer
+ // (to have fixed layers work as intended)
+ SkAutoCanvasRestore restore(canvas, true);
+ m_baseLayer->setMatrix(canvas->getTotalMatrix());
+ canvas->resetMatrix();
+ m_baseLayer->draw(canvas);
+ }
+#endif
if (extra) {
IntRect dummy; // inval area, unused for now
extra->draw(canvas, &mainPicture, &dummy);
}
-#if USE(ACCELERATED_COMPOSITING)
- LayerAndroid* compositeLayer = compositeRoot();
- if (!compositeLayer)
- return ret;
- compositeLayer->setExtra(extra);
- SkRect visible;
- calcOurContentVisibleRect(&visible);
- // call this to be sure we've adjusted for any scrolling or animations
- // before we actually draw
- compositeLayer->updateFixedLayersPositions(visible);
- compositeLayer->updatePositions();
- // We have to set the canvas' matrix on the base layer
- // (to have fixed layers work as intended)
- SkAutoCanvasRestore restore(canvas, true);
- m_baseLayer->setMatrix(canvas->getTotalMatrix());
- canvas->resetMatrix();
- m_baseLayer->draw(canvas);
-#endif
return ret;
}
@@ -1557,7 +1552,12 @@ void setBaseLayer(BaseLayerAndroid* layer, SkRegion& inval, bool showVisualIndic
void getTextSelectionRegion(SkRegion *region)
{
- m_selectText.getSelectionRegion(getVisibleRect(), region);
+ m_selectText.getSelectionRegion(getVisibleRect(), region, compositeRoot());
+}
+
+void getTextSelectionHandles(int* handles)
+{
+ m_selectText.getSelectionHandles(handles);
}
void replaceBaseContent(PictureSet* set)
@@ -1989,12 +1989,22 @@ static void nativeSetBaseLayer(JNIEnv *env, jobject obj, jint layer, jobject inv
registerPageSwapCallback);
}
-static void nativeGetTextSelectionRegion(JNIEnv *env, jobject obj, jobject region)
+static void nativeGetTextSelectionRegion(JNIEnv *env, jobject obj, jint view,
+ jobject region)
{
if (!region)
return;
SkRegion* nregion = GraphicsJNI::getNativeRegion(env, region);
- GET_NATIVE_VIEW(env, obj)->getTextSelectionRegion(nregion);
+ ((WebView*)view)->getTextSelectionRegion(nregion);
+}
+
+static void nativeGetSelectionHandles(JNIEnv *env, jobject obj, jint view,
+ jintArray arr)
+{
+ int handles[4];
+ ((WebView*)view)->getTextSelectionHandles(handles);
+ env->SetIntArrayRegion(arr, 0, 4, handles);
+ checkException(env);
}
static BaseLayerAndroid* nativeGetBaseLayer(JNIEnv *env, jobject obj)
@@ -2902,8 +2912,10 @@ static JNINativeMethod gJavaWebViewMethods[] = {
(void*) nativeSetHeightCanMeasure },
{ "nativeSetBaseLayer", "(ILandroid/graphics/Region;ZZZ)V",
(void*) nativeSetBaseLayer },
- { "nativeGetTextSelectionRegion", "(Landroid/graphics/Region;)V",
+ { "nativeGetTextSelectionRegion", "(ILandroid/graphics/Region;)V",
(void*) nativeGetTextSelectionRegion },
+ { "nativeGetSelectionHandles", "(I[I)V",
+ (void*) nativeGetSelectionHandles },
{ "nativeGetBaseLayer", "()I",
(void*) nativeGetBaseLayer },
{ "nativeReplaceBaseContent", "(I)V",