diff options
Diffstat (limited to 'Source/WebKit/android')
-rw-r--r-- | Source/WebKit/android/WebCoreSupport/ChromeClientAndroid.cpp | 5 | ||||
-rw-r--r-- | Source/WebKit/android/WebCoreSupport/ChromeClientAndroid.h | 3 | ||||
-rw-r--r-- | Source/WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.cpp | 8 | ||||
-rw-r--r-- | Source/WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.h | 2 | ||||
-rw-r--r-- | Source/WebKit/android/jni/MIMETypeRegistry.cpp | 1 | ||||
-rw-r--r-- | Source/WebKit/android/jni/WebCoreFrameBridge.cpp | 13 | ||||
-rw-r--r-- | Source/WebKit/android/jni/WebViewCore.cpp | 39 | ||||
-rw-r--r-- | Source/WebKit/android/nav/CacheBuilder.cpp | 17 | ||||
-rw-r--r-- | Source/WebKit/android/nav/CachedFrame.cpp | 89 | ||||
-rw-r--r-- | Source/WebKit/android/nav/CachedFrame.h | 4 | ||||
-rw-r--r-- | Source/WebKit/android/nav/CachedHistory.cpp | 20 | ||||
-rw-r--r-- | Source/WebKit/android/nav/CachedNode.cpp | 20 | ||||
-rw-r--r-- | Source/WebKit/android/nav/CachedRoot.cpp | 38 | ||||
-rw-r--r-- | Source/WebKit/android/nav/WebView.cpp | 34 |
14 files changed, 152 insertions, 141 deletions
diff --git a/Source/WebKit/android/WebCoreSupport/ChromeClientAndroid.cpp b/Source/WebKit/android/WebCoreSupport/ChromeClientAndroid.cpp index c3732e7..60f6263 100644 --- a/Source/WebKit/android/WebCoreSupport/ChromeClientAndroid.cpp +++ b/Source/WebKit/android/WebCoreSupport/ChromeClientAndroid.cpp @@ -538,6 +538,11 @@ bool ChromeClientAndroid::selectItemWritingDirectionIsNatural() return false; } +bool ChromeClientAndroid::selectItemAlignmentFollowsMenuWritingDirection() +{ + return false; +} + PassRefPtr<PopupMenu> ChromeClientAndroid::createPopupMenu(PopupMenuClient* client) const { return adoptRef(new PopupMenuAndroid(static_cast<ListPopupMenuClient*>(client))); diff --git a/Source/WebKit/android/WebCoreSupport/ChromeClientAndroid.h b/Source/WebKit/android/WebCoreSupport/ChromeClientAndroid.h index 81b3d49..6d8f6f3 100644 --- a/Source/WebKit/android/WebCoreSupport/ChromeClientAndroid.h +++ b/Source/WebKit/android/WebCoreSupport/ChromeClientAndroid.h @@ -160,8 +160,6 @@ namespace android { // will be called frequently, so handling should be very fast. virtual void formStateDidChange(const Node*); - virtual PassOwnPtr<HTMLParserQuirks> createHTMLParserQuirks() { return 0; } - // Android-specific void setWebFrame(android::WebFrame* webframe); android::WebFrame* webFrame() { return m_webFrame; } @@ -176,6 +174,7 @@ namespace android { #endif virtual bool selectItemWritingDirectionIsNatural(); + virtual bool selectItemAlignmentFollowsMenuWritingDirection(); virtual PassRefPtr<WebCore::PopupMenu> createPopupMenu(WebCore::PopupMenuClient*) const; virtual PassRefPtr<WebCore::SearchPopupMenu> createSearchPopupMenu(WebCore::PopupMenuClient*) const; diff --git a/Source/WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.cpp b/Source/WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.cpp index 946a4a7..86588ee 100644 --- a/Source/WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.cpp +++ b/Source/WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.cpp @@ -249,7 +249,7 @@ void FrameLoaderClientAndroid::dispatchDidReceiveIcon() { ASSERT(m_frame); if (m_frame->tree() && m_frame->tree()->parent()) return; - WTF::String url(m_frame->loader()->url().string()); + WTF::String url(m_frame->document()->url().string()); // Try to obtain the icon image. WebCore::Image* icon = WebCore::iconDatabase()->iconForPageURL( url, WebCore::IntSize(16, 16)); @@ -706,7 +706,7 @@ void FrameLoaderClientAndroid::didDisplayInsecureContent() notImplemented(); } -void FrameLoaderClientAndroid::didRunInsecureContent(SecurityOrigin*) +void FrameLoaderClientAndroid::didRunInsecureContent(SecurityOrigin*, const KURL&) { notImplemented(); } @@ -761,7 +761,7 @@ bool FrameLoaderClientAndroid::shouldFallBack(const ResourceError&) { bool FrameLoaderClientAndroid::canHandleRequest(const ResourceRequest& request) const { ASSERT(m_frame); // Don't allow hijacking of intrapage navigation - if (WebCore::equalIgnoringFragmentIdentifier(request.url(), m_frame->loader()->url())) + if (WebCore::equalIgnoringFragmentIdentifier(request.url(), m_frame->document()->url())) return true; // Don't allow hijacking of iframe urls that are http or https @@ -1334,7 +1334,7 @@ void FrameLoaderClientAndroid::didAddIconForPageUrl(const String& pageUrl) { // to be read from disk. registerForIconNotification(false); KURL u(ParsedURLString, pageUrl); - if (equalIgnoringFragmentIdentifier(u, m_frame->loader()->url())) { + if (equalIgnoringFragmentIdentifier(u, m_frame->document()->url())) { dispatchDidReceiveIcon(); } } diff --git a/Source/WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.h b/Source/WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.h index 25561a8..046fc73 100644 --- a/Source/WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.h +++ b/Source/WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.h @@ -135,7 +135,7 @@ namespace android { virtual bool shouldGoToHistoryItem(HistoryItem*) const; virtual void didDisplayInsecureContent(); - virtual void didRunInsecureContent(SecurityOrigin*); + virtual void didRunInsecureContent(SecurityOrigin*, const KURL&); virtual void dispatchDidAddBackForwardItem(HistoryItem*) const; virtual void dispatchDidRemoveBackForwardItem(HistoryItem*) const; diff --git a/Source/WebKit/android/jni/MIMETypeRegistry.cpp b/Source/WebKit/android/jni/MIMETypeRegistry.cpp index 40f8cef..cbfef6c 100644 --- a/Source/WebKit/android/jni/MIMETypeRegistry.cpp +++ b/Source/WebKit/android/jni/MIMETypeRegistry.cpp @@ -41,6 +41,7 @@ namespace WebCore { String MIMETypeRegistry::getMIMETypeForExtension(const String& ext) { + ASSERT(isMainThread()); JNIEnv* env = JSC::Bindings::getJNIEnv(); jclass mimeClass = env->FindClass("android/webkit/MimeTypeMap"); LOG_ASSERT(mimeClass, "Could not find class MimeTypeMap"); diff --git a/Source/WebKit/android/jni/WebCoreFrameBridge.cpp b/Source/WebKit/android/jni/WebCoreFrameBridge.cpp index 21ac8ef..5caf633 100644 --- a/Source/WebKit/android/jni/WebCoreFrameBridge.cpp +++ b/Source/WebKit/android/jni/WebCoreFrameBridge.cpp @@ -78,6 +78,7 @@ #include "SubstituteData.h" #include "UrlInterceptResponse.h" #include "UserGestureIndicator.h" +#include "WebArchiveAndroid.h" #include "WebCache.h" #include "WebCoreJni.h" #include "WebCoreResourceLoader.h" @@ -119,10 +120,6 @@ #include "TimeCounter.h" #endif -#if ENABLE(ARCHIVE) -#include "WebArchiveAndroid.h" -#endif - #if ENABLE(WEB_AUTOFILL) #include "autofill/WebAutoFill.h" #endif @@ -1422,7 +1419,7 @@ static void StopLoading(JNIEnv *env, jobject obj) pFrame->loader()->stopForUserCancel(); } -#if ENABLE(ARCHIVE) +#if ENABLE(WEB_ARCHIVE) static String saveArchiveAutoname(String basename, String name, String extension) { if (name.isNull() || name.isEmpty()) { name = String("index"); @@ -1458,11 +1455,11 @@ static String saveArchiveAutoname(String basename, String name, String extension return String(); } -#endif +#endif // ENABLE(WEB_ARCHIVE) static jstring SaveWebArchive(JNIEnv *env, jobject obj, jstring basename, jboolean autoname) { -#if ENABLE(ARCHIVE) +#if ENABLE(WEB_ARCHIVE) WebCore::Frame* pFrame = GET_NATIVE_FRAME(env, obj); LOG_ASSERT(pFrame, "nativeSaveWebArchive must take a valid frame pointer!"); String mimeType = pFrame->loader()->documentLoader()->mainResource()->mimeType(); @@ -1504,7 +1501,7 @@ static jstring SaveWebArchive(JNIEnv *env, jobject obj, jstring basename, jboole if (result) return wtfStringToJstring(env, filename); -#endif +#endif // ENABLE(WEB_ARCHIVE) return NULL; } diff --git a/Source/WebKit/android/jni/WebViewCore.cpp b/Source/WebKit/android/jni/WebViewCore.cpp index d7f60d3..0b5845b 100644 --- a/Source/WebKit/android/jni/WebViewCore.cpp +++ b/Source/WebKit/android/jni/WebViewCore.cpp @@ -569,11 +569,6 @@ void WebViewCore::recordPictureSet(PictureSet* content) DBG_SET_LOG("!m_mainFrame->document()"); return; } - // If there is a pending style recalculation, just return. - if (m_mainFrame->document()->isPendingStyleRecalc()) { - LOGW("recordPictureSet: pending style recalc, ignoring."); - return; - } if (m_addInval.isEmpty()) { DBG_SET_LOG("m_addInval.isEmpty()"); return; @@ -918,6 +913,11 @@ BaseLayerAndroid* WebViewCore::createBaseLayer() BaseLayerAndroid* WebViewCore::recordContent(SkRegion* region, SkIPoint* point) { DBG_SET_LOG("start"); + // If there is a pending style recalculation, just return. + if (m_mainFrame->document()->isPendingStyleRecalc()) { + DBG_SET_LOGD("recordContent: pending style recalc, ignoring."); + return 0; + } float progress = (float) m_mainFrame->page()->progress()->estimatedProgress(); m_progressDone = progress <= 0.0f || progress >= 1.0f; recordPictureSet(&m_content); @@ -974,7 +974,7 @@ void WebViewCore::viewInvalidate(const WebCore::IntRect& rect) JNIEnv* env = JSC::Bindings::getJNIEnv(); env->CallVoidMethod(m_javaGlue->object(env).get(), m_javaGlue->m_sendViewInvalidate, - rect.x(), rect.y(), rect.right(), rect.bottom()); + rect.x(), rect.y(), rect.maxX(), rect.maxY()); checkException(env); } @@ -1035,13 +1035,12 @@ void WebViewCore::didFirstLayout() DEBUG_NAV_UI_LOGD("%s", __FUNCTION__); LOG_ASSERT(m_javaGlue->m_obj, "A Java widget was not associated with this view bridge!"); - WebCore::FrameLoader* loader = m_mainFrame->loader(); - const WebCore::KURL& url = loader->url(); + const WebCore::KURL& url = m_mainFrame->document()->url(); if (url.isEmpty()) return; LOGV("::WebCore:: didFirstLayout %s", url.string().ascii().data()); - WebCore::FrameLoadType loadType = loader->loadType(); + WebCore::FrameLoadType loadType = m_mainFrame->loader()->loadType(); JNIEnv* env = JSC::Bindings::getJNIEnv(); env->CallVoidMethod(m_javaGlue->object(env).get(), m_javaGlue->m_didFirstLayout, @@ -1767,32 +1766,32 @@ Vector<IntRect> WebViewCore::getTouchHighlightRects(int x, int y, int slop) inside = true; continue; } - if (x >= rects[i].x() && x < rects[i].right()) { + if (x >= rects[i].x() && x < rects[i].maxX()) { if (y < rects[i].y()) { if (rects[i].y() - y < distance) { newx = x; newy = rects[i].y(); distance = rects[i].y() - y; } - } else if (y >= rects[i].bottom()) { - if (y - rects[i].bottom() + 1 < distance) { + } else if (y >= rects[i].maxY()) { + if (y - rects[i].maxY() + 1 < distance) { newx = x; - newy = rects[i].bottom() - 1; - distance = y - rects[i].bottom() + 1; + newy = rects[i].maxY() - 1; + distance = y - rects[i].maxY() + 1; } } - } else if (y >= rects[i].y() && y < rects[i].bottom()) { + } else if (y >= rects[i].y() && y < rects[i].maxY()) { if (x < rects[i].x()) { if (rects[i].x() - x < distance) { newx = rects[i].x(); newy = y; distance = rects[i].x() - x; } - } else if (x >= rects[i].right()) { - if (x - rects[i].right() + 1 < distance) { - newx = rects[i].right() - 1; + } else if (x >= rects[i].maxX()) { + if (x - rects[i].maxX() + 1 < distance) { + newx = rects[i].maxX() - 1; newy = y; - distance = x - rects[i].right() + 1; + distance = x - rects[i].maxX() + 1; } } } @@ -4387,7 +4386,7 @@ static jobject GetTouchHighlightRects(JNIEnv* env, jobject obj, jint x, jint y, for (size_t i = 0; i < rects.size(); i++) { jobject rect = env->NewObject(rectClass, rectinit, rects[i].x(), - rects[i].y(), rects[i].right(), rects[i].bottom()); + rects[i].y(), rects[i].maxX(), rects[i].maxY()); if (rect) { env->CallBooleanMethod(array, add, rect); env->DeleteLocalRef(rect); diff --git a/Source/WebKit/android/nav/CacheBuilder.cpp b/Source/WebKit/android/nav/CacheBuilder.cpp index e7691d7..019ac49 100644 --- a/Source/WebKit/android/nav/CacheBuilder.cpp +++ b/Source/WebKit/android/nav/CacheBuilder.cpp @@ -2560,7 +2560,7 @@ IntRect CacheBuilder::getAreaRect(const HTMLAreaElement* area) if (n == area) { if (area->isDefault()) return image->absoluteBoundingBoxRect(); - return area->getRect(image); + return area->computeRect(image); } } } @@ -2998,7 +2998,7 @@ bool CacheBuilder::AddPartRect(IntRect& bounds, int x, int y, if (bounds.isEmpty()) return true; bounds.move(x, y); - if (bounds.right() <= 0 || bounds.bottom() <= 0) + if (bounds.maxX() <= 0 || bounds.maxY() <= 0) return true; IntRect* work = result->begin() - 1; IntRect* end = result->end(); @@ -3090,14 +3090,11 @@ bool CacheBuilder::ConstructPartRects(Node* node, const IntRect& bounds, if (hasClip == false) { if (nodeIsAnchor && test->hasTagName(HTMLNames::divTag)) { IntRect bounds = renderer->absoluteBoundingBoxRect(); // x, y fixup done by AddPartRect - int left = bounds.x() + ((RenderBox*)renderer)->paddingLeft() - + ((RenderBox*)renderer)->borderLeft(); - int top = bounds.y() + ((RenderBox*)renderer)->paddingTop() - + ((RenderBox*)renderer)->borderTop(); - int right = bounds.right() - ((RenderBox*)renderer)->paddingRight() - - ((RenderBox*)renderer)->borderRight(); - int bottom = bounds.bottom() - ((RenderBox*)renderer)->paddingBottom() - - ((RenderBox*)renderer)->borderBottom(); + RenderBox* renderBox = static_cast<RenderBox*>(renderer); + int left = bounds.x() + renderBox->paddingLeft() + renderBox->borderLeft(); + int top = bounds.y() + renderBox->paddingTop() + renderBox->borderTop(); + int right = bounds.maxX() - renderBox->paddingRight() - renderBox->borderRight(); + int bottom = bounds.maxY() - renderBox->paddingBottom() - renderBox->borderBottom(); if (left >= right || top >= bottom) continue; bounds = IntRect(left, top, right - left, bottom - top); diff --git a/Source/WebKit/android/nav/CachedFrame.cpp b/Source/WebKit/android/nav/CachedFrame.cpp index b26e24b..4d245d2 100644 --- a/Source/WebKit/android/nav/CachedFrame.cpp +++ b/Source/WebKit/android/nav/CachedFrame.cpp @@ -70,7 +70,7 @@ bool CachedFrame::CheckBetween(Direction direction, const WebCore::IntRect& best { int left, top, width, height; if (direction & UP_DOWN) { - top = direction == UP ? bestRect.bottom() : prior.bottom(); + top = direction == UP ? bestRect.maxY() : prior.maxY(); int bottom = direction == UP ? prior.y() : bestRect.y(); height = bottom - top; if (height < 0) @@ -79,13 +79,13 @@ bool CachedFrame::CheckBetween(Direction direction, const WebCore::IntRect& best int testLeft = bestRect.x(); if (left > testLeft) left = testLeft; - int right = prior.right(); - int testRight = bestRect.right(); + int right = prior.maxX(); + int testRight = bestRect.maxX(); if (right < testRight) right = testRight; width = right - left; } else { - left = direction == LEFT ? bestRect.right() : prior.right(); + left = direction == LEFT ? bestRect.maxX() : prior.maxX(); int right = direction == LEFT ? prior.x() : bestRect.x(); width = right - left; if (width < 0) @@ -94,8 +94,8 @@ bool CachedFrame::CheckBetween(Direction direction, const WebCore::IntRect& best int testTop = bestRect.y(); if (top > testTop) top = testTop; - int bottom = prior.bottom(); - int testBottom = bestRect.bottom(); + int bottom = prior.maxY(); + int testBottom = bestRect.maxY(); if (bottom < testBottom) bottom = testBottom; height = bottom - top; @@ -590,18 +590,35 @@ void CachedFrame::findClosest(BestData* bestData, Direction originalDirection, // clip bottom' -- keep the old code but try this instead switch (direction) { #if 0 - case LEFT: distance = testBounds.x() - clip->x(); break; - case RIGHT: distance = clip->right() - testBounds.right(); break; - case UP: distance = testBounds.y() - clip->y(); break; - case DOWN: distance = clip->bottom() - testBounds.bottom(); break; + case LEFT: + distance = testBounds.x() - clip->x(); + break; + case RIGHT: + distance = clip->right() - testBounds.right(); + break; + case UP: + distance = testBounds.y() - clip->y(); + break; + case DOWN: + distance = clip->bottom() - testBounds.bottom(); + break; #else - case LEFT: distance = clip->right() - testBounds.x(); break; - case RIGHT: distance = testBounds.right() - clip->x(); break; - case UP: distance = clip->bottom() - testBounds.y(); break; - case DOWN: distance = testBounds.bottom() - clip->y(); break; + case LEFT: + distance = clip->maxX() - testBounds.x(); + break; + case RIGHT: + distance = testBounds.maxX() - clip->x(); + break; + case UP: + distance = clip->maxY() - testBounds.y(); + break; + case DOWN: + distance = testBounds.maxY() - clip->y(); + break; #endif - default: - distance = 0; ASSERT(0); + default: + distance = 0; + ASSERT(false); } if (distance < bestData->mDistance) { bestData->mNode = test; @@ -1227,10 +1244,10 @@ void CachedFrame::BestData::setDistances() bool CachedFrame::BestData::setDownDirection(const CachedHistory* history) { const WebCore::IntRect& navBounds = history->navBounds(); - mMajorButt = mNodeBounds.y() - navBounds.bottom(); + mMajorButt = mNodeBounds.y() - navBounds.maxY(); int testX = mNodeBounds.x(); - int testRight = mNodeBounds.right(); - setNavOverlap(navBounds.width(), navBounds.right() - testX, + int testRight = mNodeBounds.maxX(); + setNavOverlap(navBounds.width(), navBounds.maxX() - testX, testRight - navBounds.x()); if (canBeReachedByAnotherDirection()) { mNode->setCondition(CachedNode::BEST_DIRECTION); @@ -1244,8 +1261,8 @@ bool CachedFrame::BestData::setDownDirection(const CachedHistory* history) mNode->setCondition(CachedNode::CENTER_FURTHER); // never move up or sideways return REJECT_TEST; } - int inNavBottom = navBounds.bottom() - mNodeBounds.bottom(); - setNavInclusion(testRight - navBounds.right(), navBounds.x() - testX); + int inNavBottom = navBounds.maxY() - mNodeBounds.maxY(); + setNavInclusion(testRight - navBounds.maxX(), navBounds.x() - testX); bool subsumes = navBounds.height() > 0 && inOrSubsumesNav(); if (inNavTop <= 0 && inNavBottom <= 0 && subsumes && !mNode->wantsKeyEvents()) { mNode->setCondition(CachedNode::NOT_ENCLOSING_CURSOR); @@ -1267,16 +1284,16 @@ bool CachedFrame::BestData::setDownDirection(const CachedHistory* history) bool CachedFrame::BestData::setLeftDirection(const CachedHistory* history) { const WebCore::IntRect& navBounds = history->navBounds(); - mMajorButt = navBounds.x() - mNodeBounds.right(); + mMajorButt = navBounds.x() - mNodeBounds.maxX(); int testY = mNodeBounds.y(); - int testBottom = mNodeBounds.bottom(); - setNavOverlap(navBounds.height(), navBounds.bottom() - testY, + int testBottom = mNodeBounds.maxY(); + setNavOverlap(navBounds.height(), navBounds.maxY() - testY, testBottom - navBounds.y()); if (canBeReachedByAnotherDirection()) { mNode->setCondition(CachedNode::BEST_DIRECTION); return REJECT_TEST; } - int inNavRight = navBounds.right() - mNodeBounds.right(); + int inNavRight = navBounds.maxX() - mNodeBounds.maxX(); mMajorDelta2 = inNavRight; mMajorDelta = mMajorDelta2 - ((navBounds.width() - mNodeBounds.width()) >> 1); @@ -1285,7 +1302,7 @@ bool CachedFrame::BestData::setLeftDirection(const CachedHistory* history) return REJECT_TEST; } int inNavLeft = mNodeBounds.x() - navBounds.x(); - setNavInclusion(navBounds.y() - testY, testBottom - navBounds.bottom()); + setNavInclusion(navBounds.y() - testY, testBottom - navBounds.maxY()); bool subsumes = navBounds.width() > 0 && inOrSubsumesNav(); if (inNavLeft <= 0 && inNavRight <= 0 && subsumes && !mNode->wantsKeyEvents()) { mNode->setCondition(CachedNode::NOT_ENCLOSING_CURSOR); @@ -1307,10 +1324,10 @@ bool CachedFrame::BestData::setLeftDirection(const CachedHistory* history) bool CachedFrame::BestData::setRightDirection(const CachedHistory* history) { const WebCore::IntRect& navBounds = history->navBounds(); - mMajorButt = mNodeBounds.x() - navBounds.right(); + mMajorButt = mNodeBounds.x() - navBounds.maxX(); int testY = mNodeBounds.y(); - int testBottom = mNodeBounds.bottom(); - setNavOverlap(navBounds.height(), navBounds.bottom() - testY, + int testBottom = mNodeBounds.maxY(); + setNavOverlap(navBounds.height(), navBounds.maxY() - testY, testBottom - navBounds.y()); if (canBeReachedByAnotherDirection()) { mNode->setCondition(CachedNode::BEST_DIRECTION); @@ -1324,8 +1341,8 @@ bool CachedFrame::BestData::setRightDirection(const CachedHistory* history) mNode->setCondition(CachedNode::CENTER_FURTHER); // never move left or sideways return REJECT_TEST; } - int inNavRight = navBounds.right() - mNodeBounds.right(); - setNavInclusion(testBottom - navBounds.bottom(), navBounds.y() - testY); + int inNavRight = navBounds.maxX() - mNodeBounds.maxX(); + setNavInclusion(testBottom - navBounds.maxY(), navBounds.y() - testY); bool subsumes = navBounds.width() > 0 && inOrSubsumesNav(); if (inNavLeft <= 0 && inNavRight <= 0 && subsumes && !mNode->wantsKeyEvents()) { mNode->setCondition(CachedNode::NOT_ENCLOSING_CURSOR); @@ -1347,16 +1364,16 @@ bool CachedFrame::BestData::setRightDirection(const CachedHistory* history) bool CachedFrame::BestData::setUpDirection(const CachedHistory* history) { const WebCore::IntRect& navBounds = history->navBounds(); - mMajorButt = navBounds.y() - mNodeBounds.bottom(); + mMajorButt = navBounds.y() - mNodeBounds.maxY(); int testX = mNodeBounds.x(); - int testRight = mNodeBounds.right(); - setNavOverlap(navBounds.width(), navBounds.right() - testX, + int testRight = mNodeBounds.maxX(); + setNavOverlap(navBounds.width(), navBounds.maxX() - testX, testRight - navBounds.x()); if (canBeReachedByAnotherDirection()) { mNode->setCondition(CachedNode::BEST_DIRECTION); return REJECT_TEST; } - int inNavBottom = navBounds.bottom() - mNodeBounds.bottom(); + int inNavBottom = navBounds.maxY() - mNodeBounds.maxY(); mMajorDelta2 = inNavBottom; mMajorDelta = mMajorDelta2 - ((navBounds.height() - mNodeBounds.height()) >> 1); @@ -1365,7 +1382,7 @@ bool CachedFrame::BestData::setUpDirection(const CachedHistory* history) return REJECT_TEST; } int inNavTop = mNodeBounds.y() - navBounds.y(); - setNavInclusion(navBounds.x() - testX, testRight - navBounds.right()); + setNavInclusion(navBounds.x() - testX, testRight - navBounds.maxX()); bool subsumes = navBounds.height() > 0 && inOrSubsumesNav(); if (inNavTop <= 0 && inNavBottom <= 0 && subsumes && !mNode->wantsKeyEvents()) { mNode->setCondition(CachedNode::NOT_ENCLOSING_CURSOR); diff --git a/Source/WebKit/android/nav/CachedFrame.h b/Source/WebKit/android/nav/CachedFrame.h index 039a0ee..5802e36 100644 --- a/Source/WebKit/android/nav/CachedFrame.h +++ b/Source/WebKit/android/nav/CachedFrame.h @@ -173,7 +173,7 @@ protected: bool mInNav; bool mNavOutside; bool mWorkingOutside; - int bottom() const { return bounds().bottom(); } + int bottom() const { return bounds().maxY(); } const WebCore::IntRect& bounds() const { return mNodeBounds; } bool canBeReachedByAnotherDirection(); int height() const { return bounds().height(); } @@ -183,7 +183,7 @@ protected: const WebCore::IntRect& mouseBounds() const { return mMouseBounds; } static SkFixed Overlap(int span, int left, int right); void reset() { mNode = NULL; } - int right() const { return bounds().right(); } + int right() const { return bounds().maxX(); } void setMouseBounds(const WebCore::IntRect& b) { mMouseBounds = b; } void setNodeBounds(const WebCore::IntRect& b) { mNodeBounds = b; } void setDistances(); diff --git a/Source/WebKit/android/nav/CachedHistory.cpp b/Source/WebKit/android/nav/CachedHistory.cpp index 9066412..d132cc3 100644 --- a/Source/WebKit/android/nav/CachedHistory.cpp +++ b/Source/WebKit/android/nav/CachedHistory.cpp @@ -64,18 +64,14 @@ bool CachedHistory::checkVisited(const CachedNode* node, CachedFrame::Direction void CachedHistory::pinMaxMin(const WebCore::IntRect& viewBounds) { - if (mMinWorkingHorizontal < viewBounds.y() || - mMinWorkingHorizontal >= viewBounds.bottom()) + if (mMinWorkingHorizontal < viewBounds.y() || mMinWorkingHorizontal >= viewBounds.maxY()) mMinWorkingHorizontal = viewBounds.y(); - if (mMaxWorkingHorizontal > viewBounds.bottom() || - mMaxWorkingHorizontal <= viewBounds.y()) - mMaxWorkingHorizontal = viewBounds.bottom(); - if (mMinWorkingVertical < viewBounds.x() || - mMinWorkingVertical >= viewBounds.right()) + if (mMaxWorkingHorizontal > viewBounds.maxY() || mMaxWorkingHorizontal <= viewBounds.y()) + mMaxWorkingHorizontal = viewBounds.maxY(); + if (mMinWorkingVertical < viewBounds.x() || mMinWorkingVertical >= viewBounds.maxX()) mMinWorkingVertical = viewBounds.x(); - if (mMaxWorkingVertical > viewBounds.right() || - mMaxWorkingVertical <= viewBounds.x()) - mMaxWorkingVertical = viewBounds.right(); + if (mMaxWorkingVertical > viewBounds.maxX() || mMaxWorkingVertical <= viewBounds.x()) + mMaxWorkingVertical = viewBounds.maxX(); } void CachedHistory::reset() @@ -111,11 +107,11 @@ void CachedHistory::setWorking(CachedFrame::Direction newMove, if (change) { // uninitialized or change in direction if (lastAxis != CachedFrame::LEFT && navBounds->height() > 0) { mMinWorkingHorizontal = navBounds->y(); - mMaxWorkingHorizontal = navBounds->bottom(); + mMaxWorkingHorizontal = navBounds->maxY(); } if (lastAxis != CachedFrame::UP && navBounds->width() > 0) { mMinWorkingVertical = navBounds->x(); - mMaxWorkingVertical = navBounds->right(); + mMaxWorkingVertical = navBounds->maxX(); } } pinMaxMin(viewBounds); diff --git a/Source/WebKit/android/nav/CachedNode.cpp b/Source/WebKit/android/nav/CachedNode.cpp index e3ba34d..86c2a38 100644 --- a/Source/WebKit/android/nav/CachedNode.cpp +++ b/Source/WebKit/android/nav/CachedNode.cpp @@ -147,17 +147,17 @@ void CachedNode::fixUpCursorRects(const CachedFrame* frame) while (++unitBoundsPtr < unitBoundsEnd) { // any other unitBounds to the left or right of this one? int unitTop = unitBoundsPtr->y(); - int unitBottom = unitBoundsPtr->bottom(); + int unitBottom = unitBoundsPtr->maxY(); int unitLeft = unitBoundsPtr->x(); - int unitRight = unitBoundsPtr->right(); + int unitRight = unitBoundsPtr->maxX(); WebCore::IntRect* testBoundsPtr = mCursorRing.begin() - 1; while (++testBoundsPtr < unitBoundsEnd) { if (unitBoundsPtr == testBoundsPtr) continue; int testTop = testBoundsPtr->y(); - int testBottom = testBoundsPtr->bottom(); + int testBottom = testBoundsPtr->maxY(); int testLeft = testBoundsPtr->x(); - int testRight = testBoundsPtr->right(); + int testRight = testBoundsPtr->maxX(); int candidateTop = unitTop > testTop ? unitTop : testTop; int candidateBottom = unitBottom < testBottom ? unitBottom : testBottom; int candidateLeft = unitRight < testLeft ? unitRight : testRight; @@ -184,19 +184,19 @@ void CachedNode::fixUpCursorRects(const CachedFrame* frame) continue; if (leftRight) { if (candidateTop >= checkBoundsPtr->y() && - candidateBottom > checkBoundsPtr->bottom()) - candidateTop = checkBoundsPtr->bottom(); + candidateBottom > checkBoundsPtr->maxY()) + candidateTop = checkBoundsPtr->maxY(); else if (candidateTop < checkBoundsPtr->y() && - candidateBottom <= checkBoundsPtr->bottom()) + candidateBottom <= checkBoundsPtr->maxY()) candidateBottom = checkBoundsPtr->y(); else goto nextCheck; } else { if (candidateLeft >= checkBoundsPtr->x() && - candidateRight > checkBoundsPtr->right()) - candidateLeft = checkBoundsPtr->right(); + candidateRight > checkBoundsPtr->maxX()) + candidateLeft = checkBoundsPtr->maxX(); else if (candidateLeft < checkBoundsPtr->x() && - candidateRight <= checkBoundsPtr->right()) + candidateRight <= checkBoundsPtr->maxX()) candidateRight = checkBoundsPtr->x(); else goto nextCheck; diff --git a/Source/WebKit/android/nav/CachedRoot.cpp b/Source/WebKit/android/nav/CachedRoot.cpp index 64bf19a..e841683 100644 --- a/Source/WebKit/android/nav/CachedRoot.cpp +++ b/Source/WebKit/android/nav/CachedRoot.cpp @@ -589,7 +589,7 @@ public: { const WebCore::IntRect* r; for (r = rings.begin(); r != rings.end(); r++) { - SkIRect fatter = {r->x(), r->y(), r->right(), r->bottom()}; + SkIRect fatter = {r->x(), r->y(), r->maxX(), r->maxY()}; fatter.inset(-CURSOR_RING_HIT_TEST_RADIUS, -CURSOR_RING_HIT_TEST_RADIUS); DBG_NAV_LOGD("RingCheck fat=(%d,%d,r=%d,b=%d)", fatter.fLeft, fatter.fTop, fatter.fRight, fatter.fBottom); @@ -1285,15 +1285,15 @@ bool CachedRoot::innerDown(const CachedNode* test, BestData* bestData) const // (line up) mScrolledBounds.setHeight(mScrolledBounds.height() + mMaxYScroll); int testTop = mScrolledBounds.y(); - int viewBottom = mViewBounds.bottom(); + int viewBottom = mViewBounds.maxY(); const WebCore::IntRect& navBounds = mHistory->mNavBounds; if (navBounds.isEmpty() == false && - navBounds.bottom() > viewBottom && viewBottom < mContents.height()) + navBounds.maxY() > viewBottom && viewBottom < mContents.height()) return false; if (navBounds.isEmpty() == false) { int navTop = navBounds.y(); int scrollBottom; - if (testTop < navTop && navTop < (scrollBottom = mScrolledBounds.bottom())) { + if (testTop < navTop && navTop < (scrollBottom = mScrolledBounds.maxY())) { mScrolledBounds.setHeight(scrollBottom - navTop); mScrolledBounds.setY(navTop); } @@ -1310,14 +1310,14 @@ bool CachedRoot::innerLeft(const CachedNode* test, BestData* bestData) const setupScrolledBounds(); mScrolledBounds.setX(mScrolledBounds.x() - mMaxXScroll); mScrolledBounds.setWidth(mScrolledBounds.width() + mMaxXScroll); - int testRight = mScrolledBounds.right(); + int testRight = mScrolledBounds.maxX(); int viewLeft = mViewBounds.x(); const WebCore::IntRect& navBounds = mHistory->mNavBounds; if (navBounds.isEmpty() == false && navBounds.x() < viewLeft && viewLeft > mContents.x()) return false; if (navBounds.isEmpty() == false) { - int navRight = navBounds.right(); + int navRight = navBounds.maxX(); int scrollLeft; if (testRight > navRight && navRight > (scrollLeft = mScrolledBounds.x())) mScrolledBounds.setWidth(navRight - scrollLeft); @@ -1347,7 +1347,7 @@ void CachedRoot::innerMove(const CachedNode* node, BestData* bestData, switch (direction) { case LEFT: if (outOfCursor) - mHistory->mNavBounds = WebCore::IntRect(mViewBounds.right(), + mHistory->mNavBounds = WebCore::IntRect(mViewBounds.maxX(), mViewBounds.y(), 1, mViewBounds.height()); findClosest = innerLeft(node, bestData); break; @@ -1360,7 +1360,7 @@ void CachedRoot::innerMove(const CachedNode* node, BestData* bestData, case UP: if (outOfCursor) mHistory->mNavBounds = WebCore::IntRect(mViewBounds.x(), - mViewBounds.bottom(), mViewBounds.width(), 1); + mViewBounds.maxY(), mViewBounds.width(), 1); findClosest = innerUp(node, bestData); break; case DOWN: @@ -1390,12 +1390,12 @@ void CachedRoot::innerMove(const CachedNode* node, BestData* bestData, newBounds.move(offsetX, offsetY); if (mViewBounds.x() > newBounds.x()) offsetX = mViewBounds.x() - mHistory->mNavBounds.x(); - else if (mViewBounds.right() < newBounds.right()) - offsetX = mViewBounds.right() - mHistory->mNavBounds.right(); + else if (mViewBounds.maxX() < newBounds.maxX()) + offsetX = mViewBounds.maxX() - mHistory->mNavBounds.maxX(); if (mViewBounds.y() > newBounds.y()) offsetY = mViewBounds.y() - mHistory->mNavBounds.y(); - else if (mViewBounds.bottom() < newBounds.bottom()) - offsetY = mViewBounds.bottom() - mHistory->mNavBounds.bottom(); + else if (mViewBounds.maxY() < newBounds.maxY()) + offsetY = mViewBounds.maxY() - mHistory->mNavBounds.maxY(); mHistory->mNavBounds.move(offsetX, offsetY); } mHistory->setDidFirstLayout(false); @@ -1409,15 +1409,15 @@ bool CachedRoot::innerRight(const CachedNode* test, BestData* bestData) const // (align) mScrolledBounds.setWidth(mScrolledBounds.width() + mMaxXScroll); int testLeft = mScrolledBounds.x(); - int viewRight = mViewBounds.right(); + int viewRight = mViewBounds.maxX(); const WebCore::IntRect& navBounds = mHistory->mNavBounds; if (navBounds.isEmpty() == false && - navBounds.right() > viewRight && viewRight < mContents.width()) + navBounds.maxX() > viewRight && viewRight < mContents.width()) return false; if (navBounds.isEmpty() == false) { int navLeft = navBounds.x(); int scrollRight; - if (testLeft < navLeft && navLeft < (scrollRight = mScrolledBounds.right())) { + if (testLeft < navLeft && navLeft < (scrollRight = mScrolledBounds.maxX())) { mScrolledBounds.setWidth(scrollRight - navLeft); mScrolledBounds.setX(navLeft); } @@ -1434,14 +1434,14 @@ bool CachedRoot::innerUp(const CachedNode* test, BestData* bestData) const setupScrolledBounds(); mScrolledBounds.setY(mScrolledBounds.y() - mMaxYScroll); mScrolledBounds.setHeight(mScrolledBounds.height() + mMaxYScroll); - int testBottom = mScrolledBounds.bottom(); + int testBottom = mScrolledBounds.maxY(); int viewTop = mViewBounds.y(); const WebCore::IntRect& navBounds = mHistory->mNavBounds; if (navBounds.isEmpty() == false && navBounds.y() < viewTop && viewTop > mContents.y()) return false; if (navBounds.isEmpty() == false) { - int navBottom = navBounds.bottom(); + int navBottom = navBounds.maxY(); int scrollTop; if (testBottom > navBottom && navBottom > (scrollTop = mScrolledBounds.y())) mScrolledBounds.setHeight(navBottom - scrollTop); @@ -1657,13 +1657,13 @@ bool CachedRoot::scrollDelta(WebCore::IntRect& newOutset, Direction direction, i return newOutset.x() >= mViewBounds.x(); case RIGHT: *delta = mMaxXScroll; - return newOutset.right() <= mViewBounds.right(); + return newOutset.maxX() <= mViewBounds.maxX(); case UP: *delta = -mMaxYScroll; return newOutset.y() >= mViewBounds.y(); case DOWN: *delta = mMaxYScroll; - return newOutset.bottom() <= mViewBounds.bottom(); + return newOutset.maxY() <= mViewBounds.maxY(); default: *delta = 0; ASSERT(0); diff --git a/Source/WebKit/android/nav/WebView.cpp b/Source/WebKit/android/nav/WebView.cpp index ff5d73d..f56cd69 100644 --- a/Source/WebKit/android/nav/WebView.cpp +++ b/Source/WebKit/android/nav/WebView.cpp @@ -321,7 +321,7 @@ void nativeRecordButtons(bool hasFocus, bool pressed, bool invalidate) m_viewImpl->gButtonMutex.unlock(); if (invalidate && cachedCursor && cursorIsOnButton) { const WebCore::IntRect& b = cachedCursor->bounds(cachedFrame); - viewInvalidateRect(b.x(), b.y(), b.right(), b.bottom()); + viewInvalidateRect(b.x(), b.y(), b.maxX(), b.maxY()); } } @@ -335,7 +335,7 @@ void scrollRectOnScreen(const IntRect& rect) calcOurContentVisibleRect(&visible); int dx = 0; int left = rect.x(); - int right = rect.right(); + int right = rect.maxX(); if (left < visible.fLeft) { dx = left - visible.fLeft; // Only scroll right if the entire width can fit on screen. @@ -344,7 +344,7 @@ void scrollRectOnScreen(const IntRect& rect) } int dy = 0; int top = rect.y(); - int bottom = rect.bottom(); + int bottom = rect.maxY(); if (top < visible.fTop) { dy = top - visible.fTop; // Only scroll down if the entire height can fit on screen @@ -649,9 +649,9 @@ void fixCursor() return; if (abs(bounds.y() - newBounds.y()) > 4) return; - if (abs(bounds.right() - newBounds.right()) > 4) + if (abs(bounds.maxX() - newBounds.maxX()) > 4) return; - if (abs(bounds.bottom() - newBounds.bottom()) > 4) + if (abs(bounds.maxY() - newBounds.maxY()) > 4) return; DBG_NAV_LOGD("node=%p frame=%p x=%d y=%d bounds=(%d,%d,w=%d,h=%d)", node, frame, x, y, bounds.x(), bounds.y(), bounds.width(), @@ -882,12 +882,12 @@ bool moveCursor(int keyCode, int count, bool ignoreScroll) } else { int docHeight = root->documentHeight(); int docWidth = root->documentWidth(); - if (visibleRect.bottom() + dy > docHeight) - dy = docHeight - visibleRect.bottom(); + if (visibleRect.maxY() + dy > docHeight) + dy = docHeight - visibleRect.maxY(); else if (visibleRect.y() + dy < 0) dy = -visibleRect.y(); - if (visibleRect.right() + dx > docWidth) - dx = docWidth - visibleRect.right(); + if (visibleRect.maxX() + dx > docWidth) + dx = docWidth - visibleRect.maxX(); else if (visibleRect.x() < 0) dx = -visibleRect.x(); result = direction == CachedFrame::LEFT ? dx >= 0 : @@ -1345,7 +1345,7 @@ void postInvalidateDelayed(int64_t delay, const WebCore::IntRect& bounds) { JNIEnv* env = JSC::Bindings::getJNIEnv(); env->CallVoidMethod(m_javaGlue.object(env).get(), m_javaGlue.m_postInvalidateDelayed, - delay, bounds.x(), bounds.y(), bounds.right(), bounds.bottom()); + delay, bounds.x(), bounds.y(), bounds.maxX(), bounds.maxY()); checkException(env); } @@ -1520,8 +1520,8 @@ class GLDrawFunctor : Functor { } info->dirtyLeft = finalInval.x(); info->dirtyTop = finalInval.y(); - info->dirtyRight = finalInval.right(); - info->dirtyBottom = finalInval.bottom(); + info->dirtyRight = finalInval.maxX(); + info->dirtyBottom = finalInval.maxY(); } // return 1 if invalidation needed, 0 otherwise return retVal ? 1 : 0; @@ -1557,7 +1557,7 @@ static jobject nativeCacheHitNodeBounds(JNIEnv *env, jobject obj) jclass rectClass = env->FindClass("android/graphics/Rect"); jmethodID init = env->GetMethodID(rectClass, "<init>", "(IIII)V"); jobject rect = env->NewObject(rectClass, init, bounds.x(), - bounds.y(), bounds.right(), bounds.bottom()); + bounds.y(), bounds.maxX(), bounds.maxY()); env->DeleteLocalRef(rectClass); return rect; } @@ -1692,7 +1692,7 @@ static jobject nativeCursorNodeBounds(JNIEnv *env, jobject obj) jclass rectClass = env->FindClass("android/graphics/Rect"); jmethodID init = env->GetMethodID(rectClass, "<init>", "(IIII)V"); jobject rect = env->NewObject(rectClass, init, bounds.x(), - bounds.y(), bounds.right(), bounds.bottom()); + bounds.y(), bounds.maxX(), bounds.maxY()); env->DeleteLocalRef(rectClass); return rect; } @@ -1930,7 +1930,7 @@ static jobject nativeFocusCandidateNodeBounds(JNIEnv *env, jobject obj) const CachedNode* node = getFocusCandidate(env, obj, &frame); WebCore::IntRect bounds = node ? node->bounds(frame) : WebCore::IntRect(0, 0, 0, 0); - return createJavaRect(env, bounds.x(), bounds.y(), bounds.right(), bounds.bottom()); + return createJavaRect(env, bounds.x(), bounds.y(), bounds.maxX(), bounds.maxY()); } static jobject nativeFocusCandidatePaddingRect(JNIEnv *env, jobject obj) @@ -1998,7 +1998,7 @@ static jobject nativeFocusNodeBounds(JNIEnv *env, jobject obj) jclass rectClass = env->FindClass("android/graphics/Rect"); jmethodID init = env->GetMethodID(rectClass, "<init>", "(IIII)V"); jobject rect = env->NewObject(rectClass, init, bounds.x(), - bounds.y(), bounds.right(), bounds.bottom()); + bounds.y(), bounds.maxX(), bounds.maxY()); env->DeleteLocalRef(rectClass); return rect; } @@ -2169,7 +2169,7 @@ static jobject nativeGetCursorRingBounds(JNIEnv *env, jobject obj) WebCore::IntRect webRect; view->cursorRingBounds(&webRect); jobject rect = env->NewObject(rectClass, init, webRect.x(), - webRect.y(), webRect.right(), webRect.bottom()); + webRect.y(), webRect.maxX(), webRect.maxY()); env->DeleteLocalRef(rectClass); return rect; } |