diff options
author | The Android Open Source Project <initial-contribution@android.com> | 2009-01-22 00:13:42 -0800 |
---|---|---|
committer | The Android Open Source Project <initial-contribution@android.com> | 2009-01-22 00:13:42 -0800 |
commit | f7e76168422a049a356179665d34ddfb74184920 (patch) | |
tree | fcec0de1891e83e86d93259cc2b46b6cee499b64 | |
parent | 528e2187562372a650037bc65fc4446ac2ff0772 (diff) | |
download | external_webkit-f7e76168422a049a356179665d34ddfb74184920.zip external_webkit-f7e76168422a049a356179665d34ddfb74184920.tar.gz external_webkit-f7e76168422a049a356179665d34ddfb74184920.tar.bz2 |
auto import from //branches/cupcake/...@127436
-rw-r--r-- | WebCore/html/HTMLAppletElement.cpp | 19 | ||||
-rw-r--r-- | WebCore/html/HTMLEmbedElement.cpp | 20 | ||||
-rw-r--r-- | WebCore/html/HTMLFormElement.cpp | 25 | ||||
-rw-r--r-- | WebCore/html/HTMLFormElement.h | 5 | ||||
-rw-r--r-- | WebCore/html/HTMLImageElement.cpp | 29 | ||||
-rw-r--r-- | WebCore/html/HTMLImageElement.h | 5 | ||||
-rw-r--r-- | WebCore/html/HTMLObjectElement.cpp | 19 | ||||
-rw-r--r-- | WebCore/html/HTMLPlugInElement.cpp | 5 | ||||
-rw-r--r-- | WebCore/html/HTMLPlugInElement.h | 5 | ||||
-rw-r--r-- | WebKit/android/jni/WebViewCore.cpp | 25 | ||||
-rw-r--r-- | WebKit/android/nav/CachedFrame.cpp | 22 | ||||
-rw-r--r-- | WebKit/android/nav/CachedFrame.h | 2 | ||||
-rw-r--r-- | WebKit/android/nav/WebView.cpp | 25 |
13 files changed, 41 insertions, 165 deletions
diff --git a/WebCore/html/HTMLAppletElement.cpp b/WebCore/html/HTMLAppletElement.cpp index d637ce0..bdb1cca 100644 --- a/WebCore/html/HTMLAppletElement.cpp +++ b/WebCore/html/HTMLAppletElement.cpp @@ -43,15 +43,6 @@ HTMLAppletElement::HTMLAppletElement(Document* doc) HTMLAppletElement::~HTMLAppletElement() { -#ifdef ANDROID_FIX - // addressing webkit bug, http://bugs.webkit.org/show_bug.cgi?id=16512 - // ensure the m_name and m_id are removed from HTMLDocument's NameCountMap - if (oldNameIdCount && document()->isHTMLDocument()) { - HTMLDocument* doc = static_cast<HTMLDocument*>(document()); - doc->removeNamedItem(m_name); - doc->removeExtraNamedItem(m_id); - } -#endif } void HTMLAppletElement::parseMappedAttribute(MappedAttribute* attr) @@ -91,11 +82,6 @@ void HTMLAppletElement::insertedIntoDocument() HTMLDocument* document = static_cast<HTMLDocument*>(this->document()); document->addNamedItem(m_name); document->addExtraNamedItem(m_id); -#ifdef ANDROID_FIX - // addressing webkit bug, http://bugs.webkit.org/show_bug.cgi?id=16512 - // ensure the m_name and m_id are removed from HTMLDocument's NameCountMap - oldNameIdCount++; -#endif } HTMLPlugInElement::insertedIntoDocument(); @@ -107,11 +93,6 @@ void HTMLAppletElement::removedFromDocument() HTMLDocument* document = static_cast<HTMLDocument*>(this->document()); document->removeNamedItem(m_name); document->removeExtraNamedItem(m_id); -#ifdef ANDROID_FIX - // addressing webkit bug, http://bugs.webkit.org/show_bug.cgi?id=16512 - // ensure the m_name and m_id are removed from HTMLDocument's NameCountMap - oldNameIdCount--; -#endif } HTMLPlugInElement::removedFromDocument(); diff --git a/WebCore/html/HTMLEmbedElement.cpp b/WebCore/html/HTMLEmbedElement.cpp index 7ffe3b1..1beb563 100644 --- a/WebCore/html/HTMLEmbedElement.cpp +++ b/WebCore/html/HTMLEmbedElement.cpp @@ -48,14 +48,6 @@ HTMLEmbedElement::HTMLEmbedElement(Document* doc) HTMLEmbedElement::~HTMLEmbedElement() { -#ifdef ANDROID_FIX - // addressing webkit bug, http://bugs.webkit.org/show_bug.cgi?id=16512 - // ensure that m_name is removed from HTMLDocument's NameCountMap - if (oldNameIdCount && document()->isHTMLDocument()) { - HTMLDocument* doc = static_cast<HTMLDocument*>(document()); - doc->removeNamedItem(m_name); - } -#endif } static inline RenderWidget* findWidgetRenderer(const Node* n) @@ -188,12 +180,6 @@ void HTMLEmbedElement::insertedIntoDocument() { if (document()->isHTMLDocument()) static_cast<HTMLDocument*>(document())->addNamedItem(m_name); -#ifdef ANDROID_FIX - // addressing webkit bug, http://bugs.webkit.org/show_bug.cgi?id=16512 - // ensure that m_name is removed from HTMLDocument's NameCountMap - if (document()->isHTMLDocument()) - oldNameIdCount++; -#endif String width = getAttribute(widthAttr); String height = getAttribute(heightAttr); @@ -216,12 +202,6 @@ void HTMLEmbedElement::removedFromDocument() { if (document()->isHTMLDocument()) static_cast<HTMLDocument*>(document())->removeNamedItem(m_name); -#ifdef ANDROID_FIX - // addressing webkit bug, http://bugs.webkit.org/show_bug.cgi?id=16512 - // ensure that m_name is removed from HTMLDocument's NameCountMap - if (document()->isHTMLDocument()) - oldNameIdCount--; -#endif HTMLPlugInElement::removedFromDocument(); } diff --git a/WebCore/html/HTMLFormElement.cpp b/WebCore/html/HTMLFormElement.cpp index 28ea290..0e4d88e 100644 --- a/WebCore/html/HTMLFormElement.cpp +++ b/WebCore/html/HTMLFormElement.cpp @@ -76,24 +76,11 @@ HTMLFormElement::HTMLFormElement(Document* doc) , m_doingsubmit(false) , m_inreset(false) , m_malformed(false) -#ifdef ANDROID_FIX - // addressing webkit bug, http://bugs.webkit.org/show_bug.cgi?id=16512 - // ensure that m_name is removed from HTMLDocument's NameCountMap - , oldNameCount(0) -#endif { } HTMLFormElement::~HTMLFormElement() { -#ifdef ANDROID_FIX - // addressing webkit bug, http://bugs.webkit.org/show_bug.cgi?id=16512 - // ensure that m_name is removed from HTMLDocument's NameCountMap - if (oldNameCount && document()->isHTMLDocument()) { - HTMLDocument* doc = static_cast<HTMLDocument*>(document()); - doc->removeNamedItem(m_name); - } -#endif if (!m_autocomplete) document()->unregisterForDocumentActivationCallbacks(this); @@ -120,12 +107,6 @@ void HTMLFormElement::insertedIntoDocument() { if (document()->isHTMLDocument()) static_cast<HTMLDocument*>(document())->addNamedItem(m_name); -#ifdef ANDROID_FIX - // addressing webkit bug, http://bugs.webkit.org/show_bug.cgi?id=16512 - // ensure that m_name is removed from HTMLDocument's NameCountMap - if (document()->isHTMLDocument()) - oldNameCount++; -#endif HTMLElement::insertedIntoDocument(); } @@ -134,12 +115,6 @@ void HTMLFormElement::removedFromDocument() { if (document()->isHTMLDocument()) static_cast<HTMLDocument*>(document())->removeNamedItem(m_name); -#ifdef ANDROID_FIX - // addressing webkit bug, http://bugs.webkit.org/show_bug.cgi?id=16512 - // ensure that m_name is removed from HTMLDocument's NameCountMap - if (document()->isHTMLDocument()) - oldNameCount--; -#endif HTMLElement::removedFromDocument(); } diff --git a/WebCore/html/HTMLFormElement.h b/WebCore/html/HTMLFormElement.h index c65304b..464a53c 100644 --- a/WebCore/html/HTMLFormElement.h +++ b/WebCore/html/HTMLFormElement.h @@ -157,11 +157,6 @@ private: bool m_inreset : 1; bool m_malformed : 1; AtomicString m_name; -#ifdef ANDROID_FIX - // addressing webkit bug, http://bugs.webkit.org/show_bug.cgi?id=16512 - // ensure that m_name is removed from HTMLDocument's NameCountMap - int oldNameCount; -#endif }; } // namespace WebCore diff --git a/WebCore/html/HTMLImageElement.cpp b/WebCore/html/HTMLImageElement.cpp index d319553..ea05689 100644 --- a/WebCore/html/HTMLImageElement.cpp +++ b/WebCore/html/HTMLImageElement.cpp @@ -44,11 +44,6 @@ HTMLImageElement::HTMLImageElement(Document* doc, HTMLFormElement* f) , ismap(false) , m_form(f) , m_compositeOperator(CompositeSourceOver) -#ifdef ANDROID_FIX - // addressing webkit bug, http://bugs.webkit.org/show_bug.cgi?id=16512 - // ensure that m_name and m_id are removed from HTMLDocument's NameCountMap - , oldNameIdCount(0) -#endif { if (f) f->registerImgElement(this); @@ -60,25 +55,11 @@ HTMLImageElement::HTMLImageElement(const QualifiedName& tagName, Document* doc) , ismap(false) , m_form(0) , m_compositeOperator(CompositeSourceOver) -#ifdef ANDROID_FIX - // addressing webkit bug, http://bugs.webkit.org/show_bug.cgi?id=16512 - // ensure that m_name and m_id are removed from HTMLDocument's NameCountMap - , oldNameIdCount(0) -#endif { } HTMLImageElement::~HTMLImageElement() { -#ifdef ANDROID_FIX - // addressing webkit bug, http://bugs.webkit.org/show_bug.cgi?id=16512 - // ensure that m_name and m_id are removed from HTMLDocument's NameCountMap - if (oldNameIdCount && document()->isHTMLDocument()) { - HTMLDocument* doc = static_cast<HTMLDocument*>(document()); - doc->removeNamedItem(m_name); - doc->removeExtraNamedItem(m_id); - } -#endif if (m_form) m_form->removeImgElement(this); } @@ -211,11 +192,6 @@ void HTMLImageElement::insertedIntoDocument() HTMLDocument* document = static_cast<HTMLDocument*>(this->document()); document->addNamedItem(m_name); document->addExtraNamedItem(m_id); -#ifdef ANDROID_FIX - // addressing webkit bug, http://bugs.webkit.org/show_bug.cgi?id=16512 - // ensure that m_name and m_id are removed from HTMLDocument's NameCountMap - oldNameIdCount++; -#endif } HTMLElement::insertedIntoDocument(); @@ -227,11 +203,6 @@ void HTMLImageElement::removedFromDocument() HTMLDocument* document = static_cast<HTMLDocument*>(this->document()); document->removeNamedItem(m_name); document->removeExtraNamedItem(m_id); -#ifdef ANDROID_FIX - // addressing webkit bug, http://bugs.webkit.org/show_bug.cgi?id=16512 - // ensure that m_name and m_id are removed from HTMLDocument's NameCountMap - oldNameIdCount--; -#endif } HTMLElement::removedFromDocument(); diff --git a/WebCore/html/HTMLImageElement.h b/WebCore/html/HTMLImageElement.h index 848ecb1..a7a6c62 100644 --- a/WebCore/html/HTMLImageElement.h +++ b/WebCore/html/HTMLImageElement.h @@ -124,11 +124,6 @@ private: AtomicString m_name; AtomicString m_id; CompositeOperator m_compositeOperator; -#ifdef ANDROID_FIX - // addressing webkit bug, http://bugs.webkit.org/show_bug.cgi?id=16512 - // ensure that m_name and m_id are removed from HTMLDocument's NameCountMap - int oldNameIdCount; -#endif }; } //namespace diff --git a/WebCore/html/HTMLObjectElement.cpp b/WebCore/html/HTMLObjectElement.cpp index 694f2d3..940d0b4 100644 --- a/WebCore/html/HTMLObjectElement.cpp +++ b/WebCore/html/HTMLObjectElement.cpp @@ -54,15 +54,6 @@ HTMLObjectElement::HTMLObjectElement(Document* doc, bool createdByParser) HTMLObjectElement::~HTMLObjectElement() { -#ifdef ANDROID_FIX - // addressing webkit bug, http://bugs.webkit.org/show_bug.cgi?id=16512 - // ensure that m_name and m_id are removed from HTMLDocument's NameCountMap - if (oldNameIdCount && document()->isHTMLDocument()) { - HTMLDocument* doc = static_cast<HTMLDocument*>(document()); - doc->removeNamedItem(m_name); - doc->removeExtraNamedItem(m_id); - } -#endif } RenderWidget* HTMLObjectElement::renderWidgetForJSBindings() const @@ -199,11 +190,6 @@ void HTMLObjectElement::insertedIntoDocument() HTMLDocument* document = static_cast<HTMLDocument*>(this->document()); document->addNamedItem(m_name); document->addExtraNamedItem(m_id); -#ifdef ANDROID_FIX - // addressing webkit bug, http://bugs.webkit.org/show_bug.cgi?id=16512 - // ensure that m_name and m_id are removed from HTMLDocument's NameCountMap - oldNameIdCount++; -#endif } HTMLPlugInElement::insertedIntoDocument(); @@ -215,11 +201,6 @@ void HTMLObjectElement::removedFromDocument() HTMLDocument* document = static_cast<HTMLDocument*>(this->document()); document->removeNamedItem(m_name); document->removeExtraNamedItem(m_id); -#ifdef ANDROID_FIX - // addressing webkit bug, http://bugs.webkit.org/show_bug.cgi?id=16512 - // ensure that m_name and m_id are removed from HTMLDocument's NameCountMap - oldNameIdCount--; -#endif } HTMLPlugInElement::removedFromDocument(); diff --git a/WebCore/html/HTMLPlugInElement.cpp b/WebCore/html/HTMLPlugInElement.cpp index 5f585e7..7334132 100644 --- a/WebCore/html/HTMLPlugInElement.cpp +++ b/WebCore/html/HTMLPlugInElement.cpp @@ -56,11 +56,6 @@ HTMLPlugInElement::HTMLPlugInElement(const QualifiedName& tagName, Document* doc #if ENABLE(NETSCAPE_PLUGIN_API) , m_NPObject(0) #endif -#ifdef ANDROID_FIX -// addressing webkit bug, http://bugs.webkit.org/show_bug.cgi?id=16512 -// ensure that m_name is removed from HTMLDocument's NameCountMap - , oldNameIdCount(0) -#endif { } diff --git a/WebCore/html/HTMLPlugInElement.h b/WebCore/html/HTMLPlugInElement.h index 2b8c8ca..1b3d911 100644 --- a/WebCore/html/HTMLPlugInElement.h +++ b/WebCore/html/HTMLPlugInElement.h @@ -88,11 +88,6 @@ protected: #if ENABLE(NETSCAPE_PLUGIN_API) NPObject* m_NPObject; #endif -#ifdef ANDROID_FIX - // addressing webkit bug, http://bugs.webkit.org/show_bug.cgi?id=16512 - // ensure that m_name is removed from HTMLDocument's NameCountMap - int oldNameIdCount; -#endif }; } // namespace WebCore diff --git a/WebKit/android/jni/WebViewCore.cpp b/WebKit/android/jni/WebViewCore.cpp index 6aa92cb..64bfd8f 100644 --- a/WebKit/android/jni/WebViewCore.cpp +++ b/WebKit/android/jni/WebViewCore.cpp @@ -1684,20 +1684,21 @@ void WebViewCore::touchUp(int touchGeneration, int buildGeneration, bool WebViewCore::handleMouseClick(WebCore::Frame* framePtr, WebCore::Node* nodePtr) { - if (framePtr && !FrameLoaderClientAndroid::get(m_mainFrame)->getCacheBuilder().validNode(framePtr, nodePtr)) - return false; + bool valid = framePtr == NULL || FrameLoaderClientAndroid::get( + m_mainFrame)->getCacheBuilder().validNode(framePtr, nodePtr); WebFrame* webFrame = WebFrame::getWebFrame(m_mainFrame); + if (valid && nodePtr) { // Need to special case area tags because an image map could have an area element in the middle // so when attempting to get the default, the point chosen would be follow the wrong link. - if (nodePtr && nodePtr->hasTagName(WebCore::HTMLNames::areaTag)) { - webFrame->setUserInitiatedClick(true); - WebCore::EventTargetNodeCast(nodePtr)->dispatchSimulatedClick(0, true, true); - webFrame->setUserInitiatedClick(false); - return true; - } - WebCore::RenderObject* renderer = nodePtr ? nodePtr->renderer() : 0; - if (renderer) { - if (renderer->isMenuList()) { + if (nodePtr->hasTagName(WebCore::HTMLNames::areaTag)) { + webFrame->setUserInitiatedClick(true); + WebCore::EventTargetNodeCast(nodePtr)->dispatchSimulatedClick(0, + true, true); + webFrame->setUserInitiatedClick(false); + return true; + } + WebCore::RenderObject* renderer = nodePtr->renderer(); + if (renderer && renderer->isMenuList()) { WebCore::HTMLSelectElement* select = static_cast<WebCore::HTMLSelectElement*>(nodePtr); const WTF::Vector<WebCore::HTMLElement*>& listItems = select->listItems(); SkTDArray<const uint16_t*> names; @@ -1727,7 +1728,7 @@ bool WebViewCore::handleMouseClick(WebCore::Frame* framePtr, WebCore::Node* node return true; } } - if (!framePtr) + if (!valid || !framePtr) framePtr = m_mainFrame; webFrame->setUserInitiatedClick(true); DBG_NAV_LOGD("m_mousePos={%d,%d}", m_mousePos.x(), m_mousePos.y()); diff --git a/WebKit/android/nav/CachedFrame.cpp b/WebKit/android/nav/CachedFrame.cpp index 9365d06..0231394 100644 --- a/WebKit/android/nav/CachedFrame.cpp +++ b/WebKit/android/nav/CachedFrame.cpp @@ -287,18 +287,6 @@ int CachedFrame::compare(BestData& testData, const BestData& bestData, const Cac return UNDECIDED; } -bool CachedFrame::containsFrame(const CachedFrame* test) const -{ - if (this == test) - return true; - for (const CachedFrame* frame = mCachedFrames.begin(); - frame != mCachedFrames.end(); frame++) { - if (frame->containsFrame(test)) - return true; - } - return false; -} - const CachedNode* CachedFrame::currentFocus(const CachedFrame** framePtr) const { if (framePtr) @@ -910,6 +898,16 @@ void CachedFrame::resetClippedOut() } } +bool CachedFrame::sameFrame(const CachedFrame* test) const +{ + ASSERT(test); + if (mIndex != test->mIndex) + return false; + if (mIndex == -1) // index within parent's array of children, or -1 if root + return true; + return mParent->sameFrame(test->mParent); +} + void CachedFrame::setData() { if (this != mRoot) { diff --git a/WebKit/android/nav/CachedFrame.h b/WebKit/android/nav/CachedFrame.h index 1347f62..8e77470 100644 --- a/WebKit/android/nav/CachedFrame.h +++ b/WebKit/android/nav/CachedFrame.h @@ -66,7 +66,6 @@ public: bool checkVisited(const CachedNode* , CachedFrame::Direction ) const; size_t childCount() { return mCachedFrames.size(); } void clearFocus(); - bool containsFrame(const CachedFrame* ) const; const CachedNode* currentFocus() const { return currentFocus(NULL); } const CachedNode* currentFocus(const CachedFrame** ) const; bool directionChange() const; @@ -92,6 +91,7 @@ public: CachedFrame* lastChild() { return &mCachedFrames.last(); } const CachedFrame* parent() const { return mParent; } CachedFrame* parent() { return mParent; } + bool sameFrame(const CachedFrame* ) const; void removeLast() { mCachedNodes.removeLast(); } void resetClippedOut(); void setContentsSize(int width, int height) { mContents.setWidth(width); diff --git a/WebKit/android/nav/WebView.cpp b/WebKit/android/nav/WebView.cpp index c645f72..64876ab 100644 --- a/WebKit/android/nav/WebView.cpp +++ b/WebKit/android/nav/WebView.cpp @@ -776,14 +776,12 @@ OutOfFocusFix fixOutOfDateFocus(bool useReplay) const WebCore::IntRect& cachedBounds = m_frameCacheUI->rootHistory()->focusBounds(); const CachedFrame* webFrame = 0; const CachedNode* webFocusNode = webRoot->currentFocus(&webFrame); - if (webFocusNode && webRoot->containsFrame(cachedFrame)) { + if (webFocusNode && webFrame && webFrame->sameFrame(cachedFrame)) { if (useReplay && !m_replay.count()) { DBG_NAV_LOG("!m_replay.count()"); return DoNothing; } - if (webFocusNode->index() == cachedFocusNode->index() && - webFrame->indexInParent() == cachedFrame->indexInParent()) - { + if (webFocusNode->index() == cachedFocusNode->index()) { DBG_NAV_LOG("index =="); return DoNothing; } @@ -796,7 +794,18 @@ OutOfFocusFix fixOutOfDateFocus(bool useReplay) DBG_NAV_LOG("webBounds contains"); return DoNothing; } - } + DBG_NAV_LOGD("cachedBounds=(%d,%d,w=%d,h=%d) webBounds=(%d,%d,w=%d," + "%h=d)", cachedBounds.x(), cachedBounds.y(), + cachedBounds.width(), cachedBounds.height(), webBounds.x(), + webBounds.y(), webBounds.width(), webBounds.height()); + } else + DBG_NAV_LOGD("cachedBounds=(%d,%d,w=%d,h=%d) cachedFrame=%p (%d)" + " webFocusNode=%p (%d) webFrame=%p (%d)", + cachedBounds.x(), cachedBounds.y(), + cachedBounds.width(), cachedBounds.height(), + cachedFrame, cachedFrame ? cachedFrame->indexInParent() : -1, + webFocusNode, webFocusNode ? webFocusNode->index() : -1, + webFrame, webFrame ? webFrame->indexInParent() : -1); const CachedFrame* foundFrame = 0; int x, y; const CachedNode* found = findAt(webRoot, cachedBounds, &foundFrame, &x, &y); @@ -806,9 +815,9 @@ OutOfFocusFix fixOutOfDateFocus(bool useReplay) foundFrame, foundFrame ? foundFrame->indexInParent() : -1); if (found) { WebCore::IntRect newBounds = found->bounds(); - DBG_NAV_LOGD("cachedBounds=(%d,%d,%d,%d) found=(%d,%d,%d,%d)", - cachedBounds.x(), cachedBounds.y(), cachedBounds.width(), cachedBounds.height(), - newBounds.x(), newBounds.y(), newBounds.width(), newBounds.height()); + DBG_NAV_LOGD("found=(%d,%d,w=%d,h=%d) x=%d y=%d", + newBounds.x(), newBounds.y(), newBounds.width(), + newBounds.height(), x, y); } #endif webRoot->setCachedFocus(const_cast<CachedFrame*>(foundFrame), |