summaryrefslogtreecommitdiffstats
path: root/WebKit/android
diff options
context:
space:
mode:
Diffstat (limited to 'WebKit/android')
-rw-r--r--WebKit/android/WebCoreSupport/ChromeClientAndroid.cpp2
-rw-r--r--WebKit/android/WebCoreSupport/WebRequest.cpp24
-rw-r--r--WebKit/android/WebCoreSupport/WebRequest.h3
-rw-r--r--WebKit/android/WebCoreSupport/WebUrlLoaderClient.cpp2
-rw-r--r--WebKit/android/jni/WebViewCore.cpp28
-rw-r--r--WebKit/android/jni/WebViewCore.h3
-rw-r--r--WebKit/android/nav/CacheBuilder.cpp16
-rw-r--r--WebKit/android/nav/CacheBuilder.h3
-rw-r--r--WebKit/android/nav/CachedFrame.cpp4
-rw-r--r--WebKit/android/nav/CachedFrame.h2
-rw-r--r--WebKit/android/nav/CachedNode.cpp5
-rw-r--r--WebKit/android/nav/CachedNode.h5
-rw-r--r--WebKit/android/nav/CachedRoot.cpp115
-rw-r--r--WebKit/android/nav/CachedRoot.h3
-rw-r--r--WebKit/android/nav/WebView.cpp15
15 files changed, 80 insertions, 150 deletions
diff --git a/WebKit/android/WebCoreSupport/ChromeClientAndroid.cpp b/WebKit/android/WebCoreSupport/ChromeClientAndroid.cpp
index fb5701a..980c03e 100644
--- a/WebKit/android/WebCoreSupport/ChromeClientAndroid.cpp
+++ b/WebKit/android/WebCoreSupport/ChromeClientAndroid.cpp
@@ -87,8 +87,6 @@ void ChromeClientAndroid::attachRootGraphicsLayer(WebCore::Frame*, WebCore::Grap
{
// frame is not used in Android as we should only get root graphics layer for the main frame
m_rootGraphicsLayer = layer;
- if (!layer)
- return;
scheduleCompositingLayerSync();
}
diff --git a/WebKit/android/WebCoreSupport/WebRequest.cpp b/WebKit/android/WebCoreSupport/WebRequest.cpp
index fd6bbe2..a14036f 100644
--- a/WebKit/android/WebCoreSupport/WebRequest.cpp
+++ b/WebKit/android/WebCoreSupport/WebRequest.cpp
@@ -116,10 +116,28 @@ const std::string& WebRequest::getUserAgent() const
return m_userAgent;
}
+#ifdef LOG_REQUESTS
+namespace {
+int remaining = 0;
+}
+#endif
+
void WebRequest::finish(bool success)
{
m_runnableFactory.RevokeAll();
- ASSERT(m_loadState < Finished, "called finish on an already finished WebRequest (%d)", m_loadState);
+ ASSERT(m_loadState < Finished, "(%p) called finish on an already finished WebRequest (%d) (%s)", this, m_loadState, m_url.c_str());
+ if (m_loadState >= Finished)
+ return;
+#ifdef LOG_REQUESTS
+ time_t finish;
+ time(&finish);
+ finish = finish - m_startTime;
+ struct tm * timeinfo;
+ char buffer[80];
+ timeinfo = localtime(&finish);
+ strftime(buffer, 80, "Time: %M:%S",timeinfo);
+ android_printLog(ANDROID_LOG_DEBUG, "KM", "(%p) finish (%d) (%s) (%d) (%s)", this, --remaining, buffer, success, m_url.c_str());
+#endif
// Make sure WebUrlLoaderClient doesn't delete us in the middle of this method.
scoped_refptr<WebRequest> guard(this);
@@ -183,6 +201,10 @@ void WebRequest::updateLoadFlags(int& loadFlags)
void WebRequest::start()
{
ASSERT(m_loadState == Created, "Start called on a WebRequest not in CREATED state: (%s)", m_url.c_str());
+#ifdef LOG_REQUESTS
+ android_printLog(ANDROID_LOG_DEBUG, "KM", "(%p) start (%d) (%s)", this, ++remaining, m_url.c_str());
+ time(&m_startTime);
+#endif
m_loadState = Started;
diff --git a/WebKit/android/WebCoreSupport/WebRequest.h b/WebKit/android/WebCoreSupport/WebRequest.h
index ae386fd..dba7559 100644
--- a/WebKit/android/WebCoreSupport/WebRequest.h
+++ b/WebKit/android/WebCoreSupport/WebRequest.h
@@ -113,6 +113,9 @@ private:
ScopedRunnableMethodFactory<WebRequest> m_runnableFactory;
bool m_wantToPause;
bool m_isPaused;
+#ifdef LOG_REQUESTS
+ time_t m_startTime;
+#endif
};
} // namespace android
diff --git a/WebKit/android/WebCoreSupport/WebUrlLoaderClient.cpp b/WebKit/android/WebCoreSupport/WebUrlLoaderClient.cpp
index 636f7be..642a81a 100644
--- a/WebKit/android/WebCoreSupport/WebUrlLoaderClient.cpp
+++ b/WebKit/android/WebCoreSupport/WebUrlLoaderClient.cpp
@@ -87,6 +87,8 @@ bool WebUrlLoaderClient::isActive() const
{
if (m_cancelling)
return false;
+ if (!m_resourceHandle)
+ return false;
if (!m_resourceHandle->client())
return false;
if (m_finished)
diff --git a/WebKit/android/jni/WebViewCore.cpp b/WebKit/android/jni/WebViewCore.cpp
index 8c0fade..6e6196a 100644
--- a/WebKit/android/jni/WebViewCore.cpp
+++ b/WebKit/android/jni/WebViewCore.cpp
@@ -2234,7 +2234,7 @@ String WebViewCore::modifySelectionTextNavigationAxis(DOMSelection* selection, i
// the text content, rather its container, is highlighted.
Node* focusNode = selection->focusNode();
if (focusNode->isElementNode()) {
- focusNode = getImplicitAnchorOrFocusNode(selection->focusNode(),
+ focusNode = getImplicitBoundaryNode(selection->focusNode(),
selection->focusOffset(), direction);
if (!focusNode)
return String();
@@ -2270,9 +2270,9 @@ String WebViewCore::modifySelectionTextNavigationAxis(DOMSelection* selection, i
// Enforce that the selection does not cross anchor boundaries. This is
// a workaround for the asymmetric behavior of WebKit while crossing
// anchors.
- anchorNode = getImplicitAnchorOrFocusNode(selection->anchorNode(),
+ anchorNode = getImplicitBoundaryNode(selection->anchorNode(),
selection->anchorOffset(), direction);
- focusNode = getImplicitAnchorOrFocusNode(selection->focusNode(),
+ focusNode = getImplicitBoundaryNode(selection->focusNode(),
selection->focusOffset(), direction);
if (anchorNode && focusNode && anchorNode != focusNode) {
Node* inputControl = getIntermediaryInputElement(anchorNode, focusNode,
@@ -2357,7 +2357,7 @@ String WebViewCore::modifySelectionTextNavigationAxis(DOMSelection* selection, i
return markup;
}
-Node* WebViewCore::getImplicitAnchorOrFocusNode(Node* node, unsigned offset, int direction)
+Node* WebViewCore::getImplicitBoundaryNode(Node* node, unsigned offset, int direction)
{
if (node->offsetInCharacters())
return node;
@@ -2404,7 +2404,7 @@ Node* WebViewCore::getNextAnchorNode(Node* anchorNode, bool ignoreFirstNode, int
void WebViewCore::advanceAnchorNode(DOMSelection* selection, int direction,
String& markup, bool ignoreFirstNode, ExceptionCode& ec)
{
- Node* anchorNode = getImplicitAnchorOrFocusNode(selection->anchorNode(),
+ Node* anchorNode = getImplicitBoundaryNode(selection->anchorNode(),
selection->anchorOffset(), direction);
if (!anchorNode) {
ec = NOT_FOUND_ERR;
@@ -2689,8 +2689,7 @@ String WebViewCore::formatMarkup(DOMSelection* selection)
Node* nextNode = currentNode->traverseNextNode();
if (!isVisible(currentNode)) {
if (currentRange) {
- markup = markup + stripAppleSpanFromMarkup(
- currentRange->toHTML()).utf8().data();
+ markup = markup + currentRange->toHTML().utf8().data();
currentRange = 0;
}
} else {
@@ -2715,8 +2714,7 @@ String WebViewCore::formatMarkup(DOMSelection* selection)
wholeRange->endOffset(), ec);
if (ec)
break;
- markup = markup + stripAppleSpanFromMarkup(
- currentRange->toHTML()).utf8().data();
+ markup = markup + currentRange->toHTML().utf8().data();
} else {
if (currentNode->offsetInCharacters())
currentRange->setEnd(currentNode,
@@ -2733,18 +2731,6 @@ String WebViewCore::formatMarkup(DOMSelection* selection)
return markup.stripWhiteSpace();
}
-String WebViewCore::stripAppleSpanFromMarkup(String markup)
-{
- int fromIdx = markup.find("<span class=\"Apple-style-span\"");
- while (fromIdx > -1) {
- int toIdx = markup.find(">");
- markup = markup.replace(fromIdx, toIdx - fromIdx + 1, "");
- markup = markup.replace("</span>", "");
- fromIdx = markup.find("<span class=\"Apple-style-span\"");
- }
- return markup;
-}
-
void WebViewCore::selectAt(int x, int y)
{
JNIEnv* env = JSC::Bindings::getJNIEnv();
diff --git a/WebKit/android/jni/WebViewCore.h b/WebKit/android/jni/WebViewCore.h
index d38be79..411be1c 100644
--- a/WebKit/android/jni/WebViewCore.h
+++ b/WebKit/android/jni/WebViewCore.h
@@ -671,13 +671,12 @@ namespace android {
Node* m_currentNodeDomNavigationAxis;
void scrollNodeIntoView(Frame* frame, Node* node);
bool isContentTextNode(Node* node);
- String stripAppleSpanFromMarkup(String markup);
Node* getIntermediaryInputElement(Node* fromNode, Node* toNode, int direction);
bool isContentInputElement(Node* node);
bool isDescendantOf(Node* parent, Node* node);
void advanceAnchorNode(DOMSelection* selection, int direction, String& markup, bool ignoreFirstNode, ExceptionCode& ec);
Node* getNextAnchorNode(Node* anchorNode, bool skipFirstHack, int direction);
- Node* getImplicitAnchorOrFocusNode(Node* node, unsigned offset, int direction);
+ Node* getImplicitBoundaryNode(Node* node, unsigned offset, int direction);
#if ENABLE(TOUCH_EVENTS)
bool m_forwardingTouchEvents;
diff --git a/WebKit/android/nav/CacheBuilder.cpp b/WebKit/android/nav/CacheBuilder.cpp
index 56bce1e..d2ae0a4 100644
--- a/WebKit/android/nav/CacheBuilder.cpp
+++ b/WebKit/android/nav/CacheBuilder.cpp
@@ -547,6 +547,7 @@ void CacheBuilder::Debug::groups() {
IntRect clipBounds = IntRect(0, 0, INT_MAX, INT_MAX);
IntRect focusBounds = IntRect(0, 0, INT_MAX, INT_MAX);
IntRect* rectPtr = &focusBounds;
+ int imageCount = 0;
if (node->isTextNode()) {
Text* textNode = (Text*) node;
if (CacheBuilder::ConstructTextRects(textNode, 0, textNode,
@@ -556,7 +557,7 @@ void CacheBuilder::Debug::groups() {
} else {
IntRect nodeBounds = node->getRect();
if (CacheBuilder::ConstructPartRects(node, nodeBounds, rectPtr,
- globalOffsetX, globalOffsetY, &rects) == false)
+ globalOffsetX, globalOffsetY, &rects, &imageCount) == false)
continue;
}
unsigned arraySize = rects.size();
@@ -592,8 +593,8 @@ void CacheBuilder::Debug::groups() {
mIndex += snprintf(&mBuffer[mIndex], mBufferSize - mIndex, ", %d, %d, %d, %d",
textBox->x(), textBox->y(), textBox->logicalWidth(), textBox->logicalHeight());
int baseline = textBox->renderer()->style(textBox->isFirstLineStyle())->font().ascent();
- mIndex += snprintf(&mBuffer[mIndex], mBufferSize - mIndex, ", %d }, // %d ",
- baseline, ++rectIndex);
+ mIndex += snprintf(&mBuffer[mIndex], mBufferSize - mIndex, ", %d, %d }, // %d ",
+ baseline, imageCount, ++rectIndex);
wideString(node->textContent().characters() + textBox->start(), textBox->len(), true);
DUMP_NAV_LOGD("%.*s\n", mIndex, mBuffer);
textBox = textBox->nextTextBox();
@@ -1129,6 +1130,7 @@ void CacheBuilder::BuildFrame(Frame* root, Frame* frame,
bool isFocus = node == focused;
bool takesFocus = false;
int columnGap = 0;
+ int imageCount = 0;
TextDirection direction = LTR;
String exported;
CachedNodeType type = NORMAL_CACHEDNODETYPE;
@@ -1328,7 +1330,8 @@ void CacheBuilder::BuildFrame(Frame* root, Frame* frame,
cachedNode.setBounds(bounds);
cachedNode.mCursorRing.append(bounds);
} else if (ConstructPartRects(node, bounds, &cachedNode.mBounds,
- globalOffsetX, globalOffsetY, &cachedNode.mCursorRing) == false)
+ globalOffsetX, globalOffsetY, &cachedNode.mCursorRing,
+ &imageCount) == false)
continue;
keepTextNode:
if (nodeRenderer) { // area tags' node->renderer() == 0
@@ -1412,6 +1415,7 @@ void CacheBuilder::BuildFrame(Frame* root, Frame* frame,
cachedNode.setOriginalAbsoluteBounds(originalAbsBounds);
cachedNode.setParentIndex(last->mCachedNodeIndex);
cachedNode.setParentGroup(ParentWithChildren(node));
+ cachedNode.setSingleImage(imageCount == 1);
cachedNode.setTabIndex(tabIndex);
cachedNode.setType(type);
if (type == TEXT_INPUT_CACHEDNODETYPE) {
@@ -3024,7 +3028,8 @@ bool CacheBuilder::AddPartRect(IntRect& bounds, int x, int y,
}
bool CacheBuilder::ConstructPartRects(Node* node, const IntRect& bounds,
- IntRect* focusBounds, int x, int y, WTF::Vector<IntRect>* result)
+ IntRect* focusBounds, int x, int y, WTF::Vector<IntRect>* result,
+ int* imageCountPtr)
{
WTF::Vector<ClipColumnTracker> clipTracker(1);
ClipColumnTracker* baseTracker = clipTracker.data(); // sentinel
@@ -3075,6 +3080,7 @@ bool CacheBuilder::ConstructPartRects(Node* node, const IntRect& bounds,
bounds.intersect(clipBounds);
if (AddPartRect(bounds, x, y, result, focusBounds) == false)
return false;
+ *imageCountPtr += 1;
continue;
}
if (hasClip == false) {
diff --git a/WebKit/android/nav/CacheBuilder.h b/WebKit/android/nav/CacheBuilder.h
index d229df0..d48a045 100644
--- a/WebKit/android/nav/CacheBuilder.h
+++ b/WebKit/android/nav/CacheBuilder.h
@@ -83,7 +83,8 @@ public:
void allowAllTextDetection() { mAllowableTypes = ALL_CACHEDNODE_BITS; }
void buildCache(CachedRoot* root);
static bool ConstructPartRects(Node* node, const IntRect& bounds,
- IntRect* focusBounds, int x, int y, WTF::Vector<IntRect>* result);
+ IntRect* focusBounds, int x, int y, WTF::Vector<IntRect>* result,
+ int* imageCountPtr);
Node* currentFocus() const;
void disallowAddressDetection() { mAllowableTypes = (CachedNodeBits) (
mAllowableTypes & ~ADDRESS_CACHEDNODE_BIT); }
diff --git a/WebKit/android/nav/CachedFrame.cpp b/WebKit/android/nav/CachedFrame.cpp
index b25ad7d..419be14 100644
--- a/WebKit/android/nav/CachedFrame.cpp
+++ b/WebKit/android/nav/CachedFrame.cpp
@@ -153,11 +153,9 @@ bool CachedFrame::checkBetween(BestData* best, Direction direction)
}
bool CachedFrame::checkRings(const CachedNode* node,
- const WTF::Vector<WebCore::IntRect>& rings,
- const WebCore::IntRect& nodeBounds,
const WebCore::IntRect& testBounds) const
{
- return mRoot->checkRings(picture(node), rings, nodeBounds, testBounds);
+ return mRoot->checkRings(picture(node), node, testBounds);
}
bool CachedFrame::checkVisited(const CachedNode* node, Direction direction) const
diff --git a/WebKit/android/nav/CachedFrame.h b/WebKit/android/nav/CachedFrame.h
index 8ca73cf..470f522 100644
--- a/WebKit/android/nav/CachedFrame.h
+++ b/WebKit/android/nav/CachedFrame.h
@@ -83,8 +83,6 @@ public:
WebCore::IntRect unadjustBounds(const CachedNode*,
const WebCore::IntRect& ) const;
bool checkRings(const CachedNode* node,
- const WTF::Vector<WebCore::IntRect>& rings,
- const WebCore::IntRect& nodeBounds,
const WebCore::IntRect& testBounds) const;
bool checkVisited(const CachedNode* , CachedFrame::Direction ) const;
size_t childCount() { return mCachedFrames.size(); }
diff --git a/WebKit/android/nav/CachedNode.cpp b/WebKit/android/nav/CachedNode.cpp
index 4ba7b48..e3ba34d 100644
--- a/WebKit/android/nav/CachedNode.cpp
+++ b/WebKit/android/nav/CachedNode.cpp
@@ -110,7 +110,7 @@ void CachedNode::fixUpCursorRects(const CachedFrame* frame)
mFixedUpCursorRects = true;
// if the hit-test rect doesn't intersect any other rect, use it
if (mHitBounds != mBounds && mHitBounds.contains(mBounds) &&
- frame->checkRings(this, mCursorRing, mBounds, mHitBounds)) {
+ frame->checkRings(this, mHitBounds)) {
DBG_NAV_LOGD("use mHitBounds (%d,%d,%d,%d)", mHitBounds.x(),
mHitBounds.y(), mHitBounds.width(), mHitBounds.height());
mUseHitBounds = true;
@@ -122,7 +122,7 @@ void CachedNode::fixUpCursorRects(const CachedFrame* frame)
// any other cursor ring bounds, use it
IntRect sloppyBounds = mBounds;
sloppyBounds.inflate(2); // give it a couple of extra pixels
- if (frame->checkRings(this, mCursorRing, mBounds, sloppyBounds)) {
+ if (frame->checkRings(this, sloppyBounds)) {
DBG_NAV_LOGD("use mBounds (%d,%d,%d,%d)", mBounds.x(),
mBounds.y(), mBounds.width(), mBounds.height());
mUseBounds = true;
@@ -424,6 +424,7 @@ void CachedNode::Debug::print() const
DEBUG_PRINT_BOOL(mLast);
DEBUG_PRINT_BOOL(mUseBounds);
DEBUG_PRINT_BOOL(mUseHitBounds);
+ DEBUG_PRINT_BOOL(mSingleImage);
}
#endif
diff --git a/WebKit/android/nav/CachedNode.h b/WebKit/android/nav/CachedNode.h
index 961018b..f9bcbed 100644
--- a/WebKit/android/nav/CachedNode.h
+++ b/WebKit/android/nav/CachedNode.h
@@ -145,8 +145,10 @@ public:
void* parentGroup() const { return mParentGroup; }
int parentIndex() const { return mParentIndex; }
bool partRectsContains(const CachedNode* other) const;
+ const WebCore::IntRect& rawBounds() const { return mBounds; }
void reset();
WebCore::IntRect ring(const CachedFrame* , size_t part) const;
+ const WTF::Vector<WebCore::IntRect>& rings() const { return mCursorRing; }
void setBounds(const WebCore::IntRect& bounds) { mBounds = bounds; }
void setClippedOut(bool clipped) { mClippedOut = clipped; }
void setColorIndex(int index) { mColorIndex = index; }
@@ -170,9 +172,11 @@ public:
void setNavableRects() { mNavableRects = mCursorRing.size(); }
void setParentGroup(void* group) { mParentGroup = group; }
void setParentIndex(int parent) { mParentIndex = parent; }
+ void setSingleImage(bool single) { mSingleImage = single; }
void setTabIndex(int index) { mTabIndex = index; }
void setType(CachedNodeType type) { mType = type; }
void show() { mIsHidden = false; }
+ bool singleImage() const { return mSingleImage; }
int tabIndex() const { return mTabIndex; }
int textInputIndex() const { return isTextInput() ? mDataIndex : -1; }
const CachedNode* traverseNextNode() const { return mLast ? NULL : &this[1]; }
@@ -210,6 +214,7 @@ private:
bool mIsTransparent : 1;
bool mIsUnclipped : 1;
bool mLast : 1; // true if this is the last node in a group
+ bool mSingleImage : 1;
bool mUseBounds : 1;
bool mUseHitBounds : 1;
#ifdef BROWSER_DEBUG
diff --git a/WebKit/android/nav/CachedRoot.cpp b/WebKit/android/nav/CachedRoot.cpp
index 2f0e74d..2662071 100644
--- a/WebKit/android/nav/CachedRoot.cpp
+++ b/WebKit/android/nav/CachedRoot.cpp
@@ -131,104 +131,6 @@ public:
#define kMargin 16
#define kSlop 2
-class BoundsCheck : public CommonCheck {
-public:
- BoundsCheck() {
- mAllDrawnIn.setEmpty();
- mLastAll.setEmpty();
- mLastOver.setEmpty();
- }
-
- static int Area(SkIRect test) {
- return test.width() * test.height();
- }
-
- void checkLast() {
- if (mAllDrawnIn.isEmpty())
- return;
- if (mLastAll.isEmpty() || Area(mLastAll) < Area(mAllDrawnIn)) {
- mLastAll = mAllDrawnIn;
- mDrawnOver.setEmpty();
- }
- mAllDrawnIn.setEmpty();
- }
-
- bool hidden() {
- return (mLastAll.isEmpty() && mLastOver.isEmpty()) ||
- mDrawnOver.contains(mBounds);
- }
-
- virtual bool onIRect(const SkIRect& rect) {
- if (joinGlyphs(rect))
- return false;
- bool interestingType = mType == kDrawBitmap_Type
- || mType == kDrawSprite_Type
- || mType == kDrawRect_Type || isTextType(mType);
- if (SkIRect::Intersects(mBounds, rect) == false) {
- DBG_NAV_LOGD("BoundsCheck (no intersect) rect={%d,%d,%d,%d}"
- " mType=%s", rect.fLeft, rect.fTop, rect.fRight, rect.fBottom,
- TypeNames[mType]);
- if (interestingType)
- checkLast();
- return false;
- }
- if (interestingType == false)
- return false;
- if (!mDrawnOver.contains(rect) && (mBoundsSlop.contains(rect) ||
- (mBounds.fLeft == rect.fLeft && mBounds.fRight == rect.fRight &&
- mBounds.fTop >= rect.fTop && mBounds.fBottom <= rect.fBottom) ||
- (mBounds.fTop == rect.fTop && mBounds.fBottom == rect.fBottom &&
- mBounds.fLeft >= rect.fLeft && mBounds.fRight <= rect.fRight))) {
- mDrawnOver.setEmpty();
- mAllDrawnIn.join(rect);
- DBG_NAV_LOGD("BoundsCheck (contains) rect={%d,%d,%d,%d}"
- " mAllDrawnIn={%d,%d,%d,%d} mType=%s",
- rect.fLeft, rect.fTop, rect.fRight, rect.fBottom,
- mAllDrawnIn.fLeft, mAllDrawnIn.fTop, mAllDrawnIn.fRight,
- mAllDrawnIn.fBottom, TypeNames[mType]);
- } else {
- checkLast();
- if (!isTextType(mType)) {
- if (
-#if 0
-// should the opaqueness of the bitmap disallow its ability to draw over?
-// not sure that this test is needed
- (mType != kDrawBitmap_Type ||
- (mIsOpaque && mAllOpaque)) &&
-#endif
- mLastAll.isEmpty() == false)
- mDrawnOver.op(rect, SkRegion::kUnion_Op);
- } else {
-// FIXME
-// sometimes the text is not drawn entirely inside the cursor area, even though
-// it is the correct text. Until I figure out why, I allow text drawn at the
-// end that is not covered up by something else to represent the link
-// example that triggers this that should be figured out:
-// http://cdn.labpixies.com/campaigns/blackjack/blackjack.html?lang=en&country=US&libs=assets/feature/core
-// ( http://tinyurl.com/ywsyzb )
- mLastOver = rect;
- }
-#if DEBUG_NAV_UI
- const SkIRect& drawnOver = mDrawnOver.getBounds();
- DBG_NAV_LOGD("(overlaps) rect={%d,%d,%d,%d}"
- " mDrawnOver={%d,%d,%d,%d} mType=%s mIsOpaque=%s mAllOpaque=%s",
- rect.fLeft, rect.fTop, rect.fRight, rect.fBottom,
- drawnOver.fLeft, drawnOver.fTop, drawnOver.fRight, drawnOver.fBottom,
- TypeNames[mType], mIsOpaque ? "true" : "false",
- mAllOpaque ? "true" : "false");
-#endif
- }
- return false;
- }
-
- SkIRect mBounds;
- SkIRect mBoundsSlop;
- SkRegion mDrawnOver;
- SkIRect mLastOver;
- SkIRect mAllDrawnIn;
- SkIRect mLastAll;
-};
-
class BoundsCanvas : public ParseCanvas {
public:
@@ -675,10 +577,12 @@ public:
class RingCheck : public CommonCheck {
public:
RingCheck(const WTF::Vector<WebCore::IntRect>& rings,
- const WebCore::IntRect& bitBounds, const WebCore::IntRect& testBounds)
+ const WebCore::IntRect& bitBounds, const WebCore::IntRect& testBounds,
+ bool singleImage)
: mTestBounds(testBounds)
, mBitBounds(bitBounds)
, mPushPop(false)
+ , mSingleImage(singleImage)
{
const WebCore::IntRect* r;
for (r = rings.begin(); r != rings.end(); r++) {
@@ -910,7 +814,7 @@ protected:
&& mType != kDrawSprite_Type && mType != kDrawBitmap_Type)
return false;
if (mLayerTypes.isEmpty() || mLayerTypes.last() != mType
- || !mAppendLikeTypes || mPushPop
+ || !mAppendLikeTypes || mPushPop || mSingleImage
// if the last and current were not glyphs,
// and the two bounds have a gap between, don't join them -- push
// an empty between them
@@ -1054,6 +958,7 @@ private:
char mCh;
bool mAppendLikeTypes;
bool mPushPop;
+ bool mSingleImage;
};
class RingCanvas : public BoundsCanvas {
@@ -1205,16 +1110,16 @@ void CachedRoot::checkForJiggle(int* xDeltaPtr) const
*xDeltaPtr = jiggleCheck.jiggle();
}
-bool CachedRoot::checkRings(SkPicture* picture,
- const WTF::Vector<WebCore::IntRect>& rings,
- const WebCore::IntRect& nodeBounds,
+bool CachedRoot::checkRings(SkPicture* picture, const CachedNode* node,
const WebCore::IntRect& testBounds) const
{
if (!picture)
return false;
+ const WTF::Vector<WebCore::IntRect>& rings = node->rings();
+ const WebCore::IntRect& nodeBounds = node->rawBounds();
IntRect bitBounds;
calcBitBounds(nodeBounds, &bitBounds);
- RingCheck ringCheck(rings, bitBounds, testBounds);
+ RingCheck ringCheck(rings, bitBounds, testBounds, node->singleImage());
RingCanvas checker(&ringCheck);
SkBitmap bitmap;
bitmap.setConfig(SkBitmap::kARGB_8888_Config, bitBounds.width(),
@@ -1576,7 +1481,7 @@ bool CachedRoot::maskIfHidden(BestData* best) const
const WebCore::IntRect& bounds = bestNode->bounds(frame);
IntRect bitBounds;
calcBitBounds(bounds, &bitBounds);
- RingCheck ringCheck(rings, bitBounds, bounds);
+ RingCheck ringCheck(rings, bitBounds, bounds, bestNode->singleImage());
RingCanvas checker(&ringCheck);
SkBitmap bitmap;
bitmap.setConfig(SkBitmap::kARGB_8888_Config, bitBounds.width(),
diff --git a/WebKit/android/nav/CachedRoot.h b/WebKit/android/nav/CachedRoot.h
index a09e4fb..1f8b851 100644
--- a/WebKit/android/nav/CachedRoot.h
+++ b/WebKit/android/nav/CachedRoot.h
@@ -52,8 +52,7 @@ public:
void calcBitBounds(const IntRect& , IntRect* ) const;
int checkForCenter(int x, int y) const;
void checkForJiggle(int* ) const;
- bool checkRings(SkPicture* , const WTF::Vector<WebCore::IntRect>& rings,
- const WebCore::IntRect& nodeBounds,
+ bool checkRings(SkPicture* , const CachedNode* ,
const WebCore::IntRect& testBounds) const;
WebCore::IntPoint cursorLocation() const;
int documentHeight() { return mContents.height(); }
diff --git a/WebKit/android/nav/WebView.cpp b/WebKit/android/nav/WebView.cpp
index 948ea6b..deb2b28 100644
--- a/WebKit/android/nav/WebView.cpp
+++ b/WebKit/android/nav/WebView.cpp
@@ -303,10 +303,8 @@ void nativeRecordButtons(bool hasFocus, bool pressed, bool invalidate)
if (hasFocus) {
if (pressed || m_ring.m_isPressed)
state = RenderSkinAndroid::kPressed;
- else if (SkTime::GetMSecs() < m_ringAnimationEnd
- && m_ringAnimationEnd != UINT_MAX) {
+ else if (SkTime::GetMSecs() < m_ringAnimationEnd)
state = RenderSkinAndroid::kFocused;
- }
}
}
ptr->updateFocusState(state);
@@ -390,6 +388,7 @@ bool drawCursorPreamble(CachedRoot* root)
resetCursorRing();
return false;
}
+ m_ring.setIsButton(node);
if (node->isHidden()) {
DBG_NAV_LOG("node->isHidden()");
m_viewImpl->m_hasCursorBounds = false;
@@ -473,6 +472,7 @@ bool drawGL(WebCore::IntRect& viewRect, float scale, int extras)
SkPicture picture;
IntRect rect(0, 0, 0, 0);
+ bool allowSame = false;
if (extra) {
LayerAndroid mainPicture(m_navPictureUI);
PictureSet* content = m_baseLayer->content();
@@ -480,8 +480,15 @@ bool drawGL(WebCore::IntRect& viewRect, float scale, int extras)
content->height());
extra->draw(canvas, &mainPicture, &rect);
picture.endRecording();
+ } else if (extras == DrawExtrasCursorRing && m_ring.m_isButton) {
+ const CachedFrame* cachedFrame;
+ const CachedNode* cachedCursor = root->currentCursor(&cachedFrame);
+ if (cachedCursor) {
+ rect = cachedCursor->bounds(cachedFrame);
+ allowSame = true;
+ }
}
- m_glWebViewState->setExtra(m_baseLayer, picture, rect);
+ m_glWebViewState->setExtra(m_baseLayer, picture, rect, allowSame);
LayerAndroid* compositeLayer = compositeRoot();
if (compositeLayer)