2009-11-10 Yaar Schnitman <yaar@chromium.org>
authoreric@webkit.org <eric@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 10 Nov 2009 18:12:15 +0000 (18:12 +0000)
committereric@webkit.org <eric@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 10 Nov 2009 18:12:15 +0000 (18:12 +0000)
        Reviewed by Dimitri Glazkov.

        Up-streaming Chromium API src files: AppCach...BackForwardListClientImpl

        https://bugs.webkit.org/show_bug.cgi?id=31276

        * src/ApplicationCacheHost.cpp: Added.
        (WebCore::ApplicationCacheHostInternal::ApplicationCacheHostInternal):
        (WebCore::ApplicationCacheHostInternal::notifyEventListener):
        (WebCore::ApplicationCacheHost::ApplicationCacheHost):
        (WebCore::ApplicationCacheHost::~ApplicationCacheHost):
        (WebCore::ApplicationCacheHost::maybeLoadMainResource):
        (WebCore::ApplicationCacheHost::selectCacheWithoutManifest):
        (WebCore::ApplicationCacheHost::selectCacheWithManifest):
        (WebCore::ApplicationCacheHost::maybeLoadFallbackForMainResponse):
        (WebCore::ApplicationCacheHost::maybeLoadFallbackForMainError):
        (WebCore::ApplicationCacheHost::mainResourceDataReceived):
        (WebCore::ApplicationCacheHost::failedLoadingMainResource):
        (WebCore::ApplicationCacheHost::finishedLoadingMainResource):
        (WebCore::ApplicationCacheHost::maybeLoadResource):
        (WebCore::ApplicationCacheHost::maybeLoadFallbackForRedirect):
        (WebCore::ApplicationCacheHost::maybeLoadFallbackForResponse):
        (WebCore::ApplicationCacheHost::maybeLoadFallbackForError):
        (WebCore::ApplicationCacheHost::maybeLoadSynchronously):
        (WebCore::ApplicationCacheHost::maybeLoadFallbackSynchronously):
        (WebCore::ApplicationCacheHost::canCacheInPageCache):
        (WebCore::ApplicationCacheHost::setDOMApplicationCache):
        (WebCore::ApplicationCacheHost::notifyDOMApplicationCache):
        (WebCore::ApplicationCacheHost::status):
        (WebCore::ApplicationCacheHost::update):
        (WebCore::ApplicationCacheHost::swapCache):
        (WebCore::ApplicationCacheHost::isApplicationCacheEnabled):
        * src/AssertMatchingEnums.cpp: Added.
        * src/AutocompletePopupMenuClient.cpp: Added.
        (WebKit::AutocompletePopupMenuClient::AutocompletePopupMenuClient):
        (WebKit::AutocompletePopupMenuClient::~AutocompletePopupMenuClient):
        (WebKit::AutocompletePopupMenuClient::initialize):
        (WebKit::AutocompletePopupMenuClient::valueChanged):
        (WebKit::AutocompletePopupMenuClient::itemText):
        (WebKit::AutocompletePopupMenuClient::itemStyle):
        (WebKit::AutocompletePopupMenuClient::menuStyle):
        (WebKit::AutocompletePopupMenuClient::clientPaddingLeft):
        (WebKit::AutocompletePopupMenuClient::clientPaddingRight):
        (WebKit::AutocompletePopupMenuClient::popupDidHide):
        (WebKit::AutocompletePopupMenuClient::setTextFromItem):
        (WebKit::AutocompletePopupMenuClient::fontSelector):
        (WebKit::AutocompletePopupMenuClient::hostWindow):
        (WebKit::AutocompletePopupMenuClient::createScrollbar):
        (WebKit::AutocompletePopupMenuClient::setSuggestions):
        (WebKit::AutocompletePopupMenuClient::removeItemAtIndex):
        (WebKit::AutocompletePopupMenuClient::textFieldStyle):
        * src/AutocompletePopupMenuClient.h: Added.
        (WebKit::AutocompletePopupMenuClient::textField):
        (WebKit::AutocompletePopupMenuClient::itemToolTip):
        (WebKit::AutocompletePopupMenuClient::itemIsEnabled):
        (WebKit::AutocompletePopupMenuClient::clientInsetLeft):
        (WebKit::AutocompletePopupMenuClient::clientInsetRight):
        (WebKit::AutocompletePopupMenuClient::listSize):
        (WebKit::AutocompletePopupMenuClient::selectedIndex):
        (WebKit::AutocompletePopupMenuClient::itemIsSeparator):
        (WebKit::AutocompletePopupMenuClient::itemIsLabel):
        (WebKit::AutocompletePopupMenuClient::itemIsSelected):
        (WebKit::AutocompletePopupMenuClient::shouldPopOver):
        (WebKit::AutocompletePopupMenuClient::valueShouldChangeOnHotTrack):
        * src/BackForwardListClientImpl.cpp: Added.
        (WebKit::BackForwardListClientImpl::BackForwardListClientImpl):
        (WebKit::BackForwardListClientImpl::~BackForwardListClientImpl):
        (WebKit::BackForwardListClientImpl::setCurrentHistoryItem):
        (WebKit::BackForwardListClientImpl::previousHistoryItem):
        (WebKit::BackForwardListClientImpl::addItem):
        (WebKit::BackForwardListClientImpl::goToItem):
        (WebKit::BackForwardListClientImpl::currentItem):
        (WebKit::BackForwardListClientImpl::itemAtIndex):
        (WebKit::BackForwardListClientImpl::backListCount):
        (WebKit::BackForwardListClientImpl::forwardListCount):
        (WebKit::BackForwardListClientImpl::close):
        * src/BackForwardListClientImpl.h: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@50740 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebKit/chromium/ChangeLog
WebKit/chromium/src/ApplicationCacheHost.cpp [new file with mode: 0644]
WebKit/chromium/src/AssertMatchingEnums.cpp [new file with mode: 0644]
WebKit/chromium/src/AutocompletePopupMenuClient.cpp [new file with mode: 0644]
WebKit/chromium/src/AutocompletePopupMenuClient.h [new file with mode: 0644]
WebKit/chromium/src/BackForwardListClientImpl.cpp [new file with mode: 0644]
WebKit/chromium/src/BackForwardListClientImpl.h [new file with mode: 0644]

index 509fefa..cff3cb5 100644 (file)
@@ -2,6 +2,86 @@
 
         Reviewed by Dimitri Glazkov.
 
+        Up-streaming Chromium API src files: AppCach...BackForwardListClientImpl
+
+        https://bugs.webkit.org/show_bug.cgi?id=31276
+
+        * src/ApplicationCacheHost.cpp: Added.
+        (WebCore::ApplicationCacheHostInternal::ApplicationCacheHostInternal):
+        (WebCore::ApplicationCacheHostInternal::notifyEventListener):
+        (WebCore::ApplicationCacheHost::ApplicationCacheHost):
+        (WebCore::ApplicationCacheHost::~ApplicationCacheHost):
+        (WebCore::ApplicationCacheHost::maybeLoadMainResource):
+        (WebCore::ApplicationCacheHost::selectCacheWithoutManifest):
+        (WebCore::ApplicationCacheHost::selectCacheWithManifest):
+        (WebCore::ApplicationCacheHost::maybeLoadFallbackForMainResponse):
+        (WebCore::ApplicationCacheHost::maybeLoadFallbackForMainError):
+        (WebCore::ApplicationCacheHost::mainResourceDataReceived):
+        (WebCore::ApplicationCacheHost::failedLoadingMainResource):
+        (WebCore::ApplicationCacheHost::finishedLoadingMainResource):
+        (WebCore::ApplicationCacheHost::maybeLoadResource):
+        (WebCore::ApplicationCacheHost::maybeLoadFallbackForRedirect):
+        (WebCore::ApplicationCacheHost::maybeLoadFallbackForResponse):
+        (WebCore::ApplicationCacheHost::maybeLoadFallbackForError):
+        (WebCore::ApplicationCacheHost::maybeLoadSynchronously):
+        (WebCore::ApplicationCacheHost::maybeLoadFallbackSynchronously):
+        (WebCore::ApplicationCacheHost::canCacheInPageCache):
+        (WebCore::ApplicationCacheHost::setDOMApplicationCache):
+        (WebCore::ApplicationCacheHost::notifyDOMApplicationCache):
+        (WebCore::ApplicationCacheHost::status):
+        (WebCore::ApplicationCacheHost::update):
+        (WebCore::ApplicationCacheHost::swapCache):
+        (WebCore::ApplicationCacheHost::isApplicationCacheEnabled):
+        * src/AssertMatchingEnums.cpp: Added.
+        * src/AutocompletePopupMenuClient.cpp: Added.
+        (WebKit::AutocompletePopupMenuClient::AutocompletePopupMenuClient):
+        (WebKit::AutocompletePopupMenuClient::~AutocompletePopupMenuClient):
+        (WebKit::AutocompletePopupMenuClient::initialize):
+        (WebKit::AutocompletePopupMenuClient::valueChanged):
+        (WebKit::AutocompletePopupMenuClient::itemText):
+        (WebKit::AutocompletePopupMenuClient::itemStyle):
+        (WebKit::AutocompletePopupMenuClient::menuStyle):
+        (WebKit::AutocompletePopupMenuClient::clientPaddingLeft):
+        (WebKit::AutocompletePopupMenuClient::clientPaddingRight):
+        (WebKit::AutocompletePopupMenuClient::popupDidHide):
+        (WebKit::AutocompletePopupMenuClient::setTextFromItem):
+        (WebKit::AutocompletePopupMenuClient::fontSelector):
+        (WebKit::AutocompletePopupMenuClient::hostWindow):
+        (WebKit::AutocompletePopupMenuClient::createScrollbar):
+        (WebKit::AutocompletePopupMenuClient::setSuggestions):
+        (WebKit::AutocompletePopupMenuClient::removeItemAtIndex):
+        (WebKit::AutocompletePopupMenuClient::textFieldStyle):
+        * src/AutocompletePopupMenuClient.h: Added.
+        (WebKit::AutocompletePopupMenuClient::textField):
+        (WebKit::AutocompletePopupMenuClient::itemToolTip):
+        (WebKit::AutocompletePopupMenuClient::itemIsEnabled):
+        (WebKit::AutocompletePopupMenuClient::clientInsetLeft):
+        (WebKit::AutocompletePopupMenuClient::clientInsetRight):
+        (WebKit::AutocompletePopupMenuClient::listSize):
+        (WebKit::AutocompletePopupMenuClient::selectedIndex):
+        (WebKit::AutocompletePopupMenuClient::itemIsSeparator):
+        (WebKit::AutocompletePopupMenuClient::itemIsLabel):
+        (WebKit::AutocompletePopupMenuClient::itemIsSelected):
+        (WebKit::AutocompletePopupMenuClient::shouldPopOver):
+        (WebKit::AutocompletePopupMenuClient::valueShouldChangeOnHotTrack):
+        * src/BackForwardListClientImpl.cpp: Added.
+        (WebKit::BackForwardListClientImpl::BackForwardListClientImpl):
+        (WebKit::BackForwardListClientImpl::~BackForwardListClientImpl):
+        (WebKit::BackForwardListClientImpl::setCurrentHistoryItem):
+        (WebKit::BackForwardListClientImpl::previousHistoryItem):
+        (WebKit::BackForwardListClientImpl::addItem):
+        (WebKit::BackForwardListClientImpl::goToItem):
+        (WebKit::BackForwardListClientImpl::currentItem):
+        (WebKit::BackForwardListClientImpl::itemAtIndex):
+        (WebKit::BackForwardListClientImpl::backListCount):
+        (WebKit::BackForwardListClientImpl::forwardListCount):
+        (WebKit::BackForwardListClientImpl::close):
+        * src/BackForwardListClientImpl.h: Added.
+
+2009-11-10  Yaar Schnitman  <yaar@chromium.org>
+
+        Reviewed by Dimitri Glazkov.
+
         Up-streaming Chromium API src files: WebString...WebViewImpl
 
         https://bugs.webkit.org/show_bug.cgi?id=31276
diff --git a/WebKit/chromium/src/ApplicationCacheHost.cpp b/WebKit/chromium/src/ApplicationCacheHost.cpp
new file mode 100644 (file)
index 0000000..ef8f860
--- /dev/null
@@ -0,0 +1,256 @@
+/*
+ * Copyright (C) 2009 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "ApplicationCacheHost.h"
+
+#if ENABLE(OFFLINE_WEB_APPLICATIONS)
+
+#include "DocumentLoader.h"
+#include "DOMApplicationCache.h"
+#include "Frame.h"
+#include "Settings.h"
+#include "WebApplicationCacheHost.h"
+#include "WebApplicationCacheHostClient.h"
+#include "WebKit.h"
+#include "WebKitClient.h"
+#include "WebURL.h"
+#include "WebURLError.h"
+#include "WebURLResponse.h"
+#include "WrappedResourceRequest.h"
+#include "WrappedResourceResponse.h"
+
+using namespace WebKit;
+
+namespace WebCore {
+
+// ApplicationCacheHostInternal -----------------------------------------------
+
+class ApplicationCacheHostInternal : public WebApplicationCacheHostClient {
+public:
+    ApplicationCacheHostInternal(ApplicationCacheHost* host)
+        : m_innerHost(host)
+    {
+        m_outerHost.set(WebKit::webKitClient()->createApplicationCacheHost(this));
+    }
+
+    virtual void notifyEventListener(WebApplicationCacheHost::EventID eventID)
+    {
+        m_innerHost->notifyDOMApplicationCache(
+            static_cast<ApplicationCacheHost::EventID>(eventID));
+    }
+
+    ApplicationCacheHost* m_innerHost;
+    OwnPtr<WebApplicationCacheHost> m_outerHost;
+};
+
+// ApplicationCacheHost -------------------------------------------------------
+// We provide a custom implementation of this class that calls out to the
+// embedding application instead of using WebCore's built in appcache system.
+// This file replaces webcore/appcache/ApplicationCacheHost.cpp in our build.
+
+ApplicationCacheHost::ApplicationCacheHost(DocumentLoader* documentLoader)
+    : m_domApplicationCache(0)
+    , m_documentLoader(documentLoader)
+{
+    ASSERT(m_documentLoader);
+}
+
+ApplicationCacheHost::~ApplicationCacheHost()
+{
+}
+
+void ApplicationCacheHost::maybeLoadMainResource(ResourceRequest& request, SubstituteData&)
+{
+    // We defer creating the outer host object to avoid spurious creation/destruction
+    // around creating empty documents. At this point, we're initiating a main resource
+    // load for the document, so its for real.
+
+    if (!isApplicationCacheEnabled())
+        return;
+
+    m_internal.set(new ApplicationCacheHostInternal(this));
+    if (m_internal->m_outerHost) {
+        WrappedResourceRequest wrapped(request);
+        m_internal->m_outerHost->willStartMainResourceRequest(wrapped);
+    } else
+        m_internal.clear();
+
+    // NOTE: The semantics of this method, and others in this interface, are subtly different
+    // than the method names would suggest. For example, in this method never returns an appcached
+    // response in the SubstituteData out argument, instead we return the appcached response thru
+    // the usual resource loading pipeline.
+}
+
+void ApplicationCacheHost::selectCacheWithoutManifest()
+{
+    if (m_internal)
+        m_internal->m_outerHost->selectCacheWithoutManifest();
+}
+
+void ApplicationCacheHost::selectCacheWithManifest(const KURL& manifestURL)
+{
+    if (m_internal) {
+        if (!m_internal->m_outerHost->selectCacheWithManifest(manifestURL)) {
+            // It's a foreign entry, restart the current navigation from the top
+            // of the navigation algorithm. The navigation will not result in the
+            // same resource being loaded, because "foreign" entries are never picked
+            // during navigation.
+            // see WebCore::ApplicationCacheGroup::selectCache()
+            const KURL& docURL = m_documentLoader->frame()->document()->url();
+            String referrer = m_documentLoader->frameLoader()->referrer();
+            m_documentLoader->frame()->redirectScheduler()->scheduleLocationChange(docURL, referrer);
+        }
+    }
+}
+
+bool ApplicationCacheHost::maybeLoadFallbackForMainResponse(const ResourceRequest&, const ResourceResponse& response)
+{
+    if (m_internal) {
+        WrappedResourceResponse wrapped(response);
+        m_internal->m_outerHost->didReceiveResponseForMainResource(wrapped);
+    }
+    return false;
+}
+
+bool ApplicationCacheHost::maybeLoadFallbackForMainError(const ResourceRequest&, const ResourceError& error)
+{
+    // N/A to the chromium port
+    return false;
+}
+
+void ApplicationCacheHost::mainResourceDataReceived(const char* data, int length, long long, bool)
+{
+    if (m_internal)
+        m_internal->m_outerHost->didReceiveDataForMainResource(data, length);
+}
+
+void ApplicationCacheHost::failedLoadingMainResource()
+{
+    if (m_internal)
+        m_internal->m_outerHost->didFinishLoadingMainResource(false);
+}
+
+void ApplicationCacheHost::finishedLoadingMainResource()
+{
+    if (m_internal)
+        m_internal->m_outerHost->didFinishLoadingMainResource(true);
+}
+
+bool ApplicationCacheHost::maybeLoadResource(ResourceLoader*, ResourceRequest& request, const KURL&)
+{
+    // FIXME: look into the purpose of the unused KURL& originalURL parameter
+    if (m_internal) {
+        WrappedResourceRequest wrapped(request);
+        m_internal->m_outerHost->willStartSubResourceRequest(wrapped);
+    }
+    return false;
+}
+
+bool ApplicationCacheHost::maybeLoadFallbackForRedirect(ResourceLoader*, ResourceRequest&, const ResourceResponse&)
+{
+    // N/A to the chromium port
+    return false;
+}
+
+bool ApplicationCacheHost::maybeLoadFallbackForResponse(ResourceLoader*, const ResourceResponse&)
+{
+    // N/A to the chromium port
+    return false;
+}
+
+bool ApplicationCacheHost::maybeLoadFallbackForError(ResourceLoader*, const ResourceError&)
+{
+    // N/A to the chromium port
+    return false;
+}
+
+bool ApplicationCacheHost::maybeLoadSynchronously(ResourceRequest& request, ResourceError&, ResourceResponse&, Vector<char>&)
+{
+    if (m_internal) {
+        WrappedResourceRequest wrapped(request);
+        m_internal->m_outerHost->willStartSubResourceRequest(wrapped);
+    }
+    return false;
+}
+
+void ApplicationCacheHost::maybeLoadFallbackSynchronously(const ResourceRequest&, ResourceError&, ResourceResponse&, Vector<char>&)
+{
+    // N/A to the chromium port
+}
+
+bool ApplicationCacheHost::canCacheInPageCache() const
+{
+    // N/A to the chromium port which doesn't use the page cache.
+    return false;
+}
+
+void ApplicationCacheHost::setDOMApplicationCache(DOMApplicationCache* domApplicationCache)
+{
+    ASSERT(!m_domApplicationCache || !domApplicationCache);
+    m_domApplicationCache = domApplicationCache;
+}
+
+void ApplicationCacheHost::notifyDOMApplicationCache(EventID id)
+{
+    if (m_domApplicationCache) {
+        ExceptionCode ec = 0;
+        m_domApplicationCache->dispatchEvent(
+            Event::create(DOMApplicationCache::toEventType(id), false, false),
+            ec);
+        ASSERT(!ec);
+    }
+}
+
+ApplicationCacheHost::Status ApplicationCacheHost::status() const
+{
+    return m_internal ? static_cast<Status>(m_internal->m_outerHost->status()) : UNCACHED;
+}
+
+bool ApplicationCacheHost::update()
+{
+    return m_internal ? m_internal->m_outerHost->startUpdate() : false;
+}
+
+bool ApplicationCacheHost::swapCache()
+{
+    return m_internal ? m_internal->m_outerHost->swapCache() : false;
+}
+
+bool ApplicationCacheHost::isApplicationCacheEnabled()
+{
+    ASSERT(m_documentLoader->frame());
+    return m_documentLoader->frame()->settings()
+           && m_documentLoader->frame()->settings()->offlineWebApplicationCacheEnabled();
+}
+
+}  // namespace WebCore
+
+#endif  // ENABLE(OFFLINE_WEB_APPLICATIONS)
diff --git a/WebKit/chromium/src/AssertMatchingEnums.cpp b/WebKit/chromium/src/AssertMatchingEnums.cpp
new file mode 100644 (file)
index 0000000..408bd56
--- /dev/null
@@ -0,0 +1,240 @@
+/*
+ * Copyright (C) 2009 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// Use this file to assert that various WebKit API enum values continue
+// matching WebCore defined enum values.
+
+#include "config.h"
+
+#include "AccessibilityObject.h"
+#include "ApplicationCacheHost.h"
+#include "EditorInsertAction.h"
+#include "MediaPlayer.h"
+#include "NotificationPresenter.h"
+#include "PasteboardPrivate.h"
+#include "PlatformCursor.h"
+#include "TextAffinity.h"
+#include "WebAccessibilityObject.h"
+#include "WebApplicationCacheHost.h"
+#include "WebClipboard.h"
+#include "WebCursorInfo.h"
+#include "WebEditingAction.h"
+#include "WebMediaPlayer.h"
+#include "WebNotificationPresenter.h"
+#include "WebTextAffinity.h"
+#include <wtf/Assertions.h>
+
+#define COMPILE_ASSERT_MATCHING_ENUM(webkit_name, webcore_name) \
+    COMPILE_ASSERT(int(WebKit::webkit_name) == int(WebCore::webcore_name), mismatching_enums)
+
+COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleUnknown, UnknownRole);
+COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleButton, ButtonRole);
+COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleRadioButton, RadioButtonRole);
+COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleCheckBox, CheckBoxRole);
+COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleSlider, SliderRole);
+COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleTabGroup, TabGroupRole);
+COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleTextField, TextFieldRole);
+COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleStaticText, StaticTextRole);
+COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleTextArea, TextAreaRole);
+COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleScrollArea, ScrollAreaRole);
+COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRolePopUpButton, PopUpButtonRole);
+COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleMenuButton, MenuButtonRole);
+COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleTable, TableRole);
+COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleApplication, ApplicationRole);
+COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleGroup, GroupRole);
+COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleRadioGroup, RadioGroupRole);
+COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleList, ListRole);
+COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleScrollBar, ScrollBarRole);
+COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleValueIndicator, ValueIndicatorRole);
+COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleImage, ImageRole);
+COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleMenuBar, MenuBarRole);
+COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleMenu, MenuRole);
+COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleMenuItem, MenuItemRole);
+COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleColumn, ColumnRole);
+COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleRow, RowRole);
+COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleToolbar, ToolbarRole);
+COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleBusyIndicator, BusyIndicatorRole);
+COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleProgressIndicator, ProgressIndicatorRole);
+COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleWindow, WindowRole);
+COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleDrawer, DrawerRole);
+COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleSystemWide, SystemWideRole);
+COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleOutline, OutlineRole);
+COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleIncrementor, IncrementorRole);
+COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleBrowser, BrowserRole);
+COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleComboBox, ComboBoxRole);
+COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleSplitGroup, SplitGroupRole);
+COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleSplitter, SplitterRole);
+COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleColorWell, ColorWellRole);
+COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleGrowArea, GrowAreaRole);
+COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleSheet, SheetRole);
+COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleHelpTag, HelpTagRole);
+COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleMatte, MatteRole);
+COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleRuler, RulerRole);
+COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleRulerMarker, RulerMarkerRole);
+COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleLink, LinkRole);
+COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleDisclosureTriangle, DisclosureTriangleRole);
+COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleGrid, GridRole);
+COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleCell, CellRole);
+COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleColumnHeader, ColumnHeaderRole);
+COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleRowHeader, RowHeaderRole);
+COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleWebCoreLink, WebCoreLinkRole);
+COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleImageMapLink, ImageMapLinkRole);
+COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleImageMap, ImageMapRole);
+COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleListMarker, ListMarkerRole);
+COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleWebArea, WebAreaRole);
+COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleHeading, HeadingRole);
+COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleListBox, ListBoxRole);
+COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleListBoxOption, ListBoxOptionRole);
+COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleTableHeaderContainer, TableHeaderContainerRole);
+COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleDefinitionListTerm, DefinitionListTermRole);
+COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleDefinitionListDefinition, DefinitionListDefinitionRole);
+COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleAnnotation, AnnotationRole);
+COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleSliderThumb, SliderThumbRole);
+COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleIgnored, IgnoredRole);
+COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleTab, TabRole);
+COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleTabList, TabListRole);
+COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleTabPanel, TabPanelRole);
+COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleLandmarkApplication, LandmarkApplicationRole);
+COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleLandmarkBanner, LandmarkBannerRole);
+COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleLandmarkComplementary, LandmarkComplementaryRole);
+COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleLandmarkContentInfo, LandmarkContentInfoRole);
+COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleLandmarkMain, LandmarkMainRole);
+COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleLandmarkNavigation, LandmarkNavigationRole);
+COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleLandmarkSearch, LandmarkSearchRole);
+COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleApplicationLog, ApplicationLogRole);
+COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleApplicationMarquee, ApplicationMarqueeRole);
+COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleApplicationStatus, ApplicationStatusRole);
+COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleApplicationTimer, ApplicationTimerRole);
+COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleDocument, DocumentRole);
+COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleDocumentArticle, DocumentArticleRole);
+COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleDocumentNote, DocumentNoteRole);
+COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleDocumentRegion, DocumentRegionRole);
+COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleUserInterfaceTooltip, UserInterfaceTooltipRole);
+
+#if ENABLE(OFFLINE_WEB_APPLICATIONS)
+COMPILE_ASSERT_MATCHING_ENUM(WebApplicationCacheHost::Uncached, ApplicationCacheHost::UNCACHED);
+COMPILE_ASSERT_MATCHING_ENUM(WebApplicationCacheHost::Idle, ApplicationCacheHost::IDLE);
+COMPILE_ASSERT_MATCHING_ENUM(WebApplicationCacheHost::Checking, ApplicationCacheHost::CHECKING);
+COMPILE_ASSERT_MATCHING_ENUM(WebApplicationCacheHost::Downloading, ApplicationCacheHost::DOWNLOADING);
+COMPILE_ASSERT_MATCHING_ENUM(WebApplicationCacheHost::UpdateReady, ApplicationCacheHost::UPDATEREADY);
+COMPILE_ASSERT_MATCHING_ENUM(WebApplicationCacheHost::Obsolete, ApplicationCacheHost::OBSOLETE);
+COMPILE_ASSERT_MATCHING_ENUM(WebApplicationCacheHost::CheckingEvent, ApplicationCacheHost::CHECKING_EVENT);
+COMPILE_ASSERT_MATCHING_ENUM(WebApplicationCacheHost::ErrorEvent, ApplicationCacheHost::ERROR_EVENT);
+COMPILE_ASSERT_MATCHING_ENUM(WebApplicationCacheHost::NoUpdateEvent, ApplicationCacheHost::NOUPDATE_EVENT);
+COMPILE_ASSERT_MATCHING_ENUM(WebApplicationCacheHost::DownloadingEvent, ApplicationCacheHost::DOWNLOADING_EVENT);
+COMPILE_ASSERT_MATCHING_ENUM(WebApplicationCacheHost::ProgressEvent, ApplicationCacheHost::PROGRESS_EVENT);
+COMPILE_ASSERT_MATCHING_ENUM(WebApplicationCacheHost::UpdateReadyEvent, ApplicationCacheHost::UPDATEREADY_EVENT);
+COMPILE_ASSERT_MATCHING_ENUM(WebApplicationCacheHost::CachedEvent, ApplicationCacheHost::CACHED_EVENT);
+COMPILE_ASSERT_MATCHING_ENUM(WebApplicationCacheHost::ObsoleteEvent, ApplicationCacheHost::OBSOLETE_EVENT);
+#endif
+
+COMPILE_ASSERT_MATCHING_ENUM(WebClipboard::FormatHTML, PasteboardPrivate::HTMLFormat);
+COMPILE_ASSERT_MATCHING_ENUM(WebClipboard::FormatBookmark, PasteboardPrivate::BookmarkFormat);
+COMPILE_ASSERT_MATCHING_ENUM(WebClipboard::FormatSmartPaste, PasteboardPrivate::WebSmartPasteFormat);
+
+COMPILE_ASSERT_MATCHING_ENUM(WebClipboard::BufferStandard, PasteboardPrivate::StandardBuffer);
+COMPILE_ASSERT_MATCHING_ENUM(WebClipboard::BufferSelection, PasteboardPrivate::SelectionBuffer);
+
+COMPILE_ASSERT_MATCHING_ENUM(WebCursorInfo::TypePointer, PlatformCursor::TypePointer);
+COMPILE_ASSERT_MATCHING_ENUM(WebCursorInfo::TypeCross, PlatformCursor::TypeCross);
+COMPILE_ASSERT_MATCHING_ENUM(WebCursorInfo::TypeHand, PlatformCursor::TypeHand);
+COMPILE_ASSERT_MATCHING_ENUM(WebCursorInfo::TypeIBeam, PlatformCursor::TypeIBeam);
+COMPILE_ASSERT_MATCHING_ENUM(WebCursorInfo::TypeWait, PlatformCursor::TypeWait);
+COMPILE_ASSERT_MATCHING_ENUM(WebCursorInfo::TypeHelp, PlatformCursor::TypeHelp);
+COMPILE_ASSERT_MATCHING_ENUM(WebCursorInfo::TypeEastResize, PlatformCursor::TypeEastResize);
+COMPILE_ASSERT_MATCHING_ENUM(WebCursorInfo::TypeNorthResize, PlatformCursor::TypeNorthResize);
+COMPILE_ASSERT_MATCHING_ENUM(WebCursorInfo::TypeNorthEastResize, PlatformCursor::TypeNorthEastResize);
+COMPILE_ASSERT_MATCHING_ENUM(WebCursorInfo::TypeNorthWestResize, PlatformCursor::TypeNorthWestResize);
+COMPILE_ASSERT_MATCHING_ENUM(WebCursorInfo::TypeSouthResize, PlatformCursor::TypeSouthResize);
+COMPILE_ASSERT_MATCHING_ENUM(WebCursorInfo::TypeSouthEastResize, PlatformCursor::TypeSouthEastResize);
+COMPILE_ASSERT_MATCHING_ENUM(WebCursorInfo::TypeSouthWestResize, PlatformCursor::TypeSouthWestResize);
+COMPILE_ASSERT_MATCHING_ENUM(WebCursorInfo::TypeWestResize, PlatformCursor::TypeWestResize);
+COMPILE_ASSERT_MATCHING_ENUM(WebCursorInfo::TypeNorthSouthResize, PlatformCursor::TypeNorthSouthResize);
+COMPILE_ASSERT_MATCHING_ENUM(WebCursorInfo::TypeEastWestResize, PlatformCursor::TypeEastWestResize);
+COMPILE_ASSERT_MATCHING_ENUM(WebCursorInfo::TypeNorthEastSouthWestResize, PlatformCursor::TypeNorthEastSouthWestResize);
+COMPILE_ASSERT_MATCHING_ENUM(WebCursorInfo::TypeNorthWestSouthEastResize, PlatformCursor::TypeNorthWestSouthEastResize);
+COMPILE_ASSERT_MATCHING_ENUM(WebCursorInfo::TypeColumnResize, PlatformCursor::TypeColumnResize);
+COMPILE_ASSERT_MATCHING_ENUM(WebCursorInfo::TypeRowResize, PlatformCursor::TypeRowResize);
+COMPILE_ASSERT_MATCHING_ENUM(WebCursorInfo::TypeMiddlePanning, PlatformCursor::TypeMiddlePanning);
+COMPILE_ASSERT_MATCHING_ENUM(WebCursorInfo::TypeEastPanning, PlatformCursor::TypeEastPanning);
+COMPILE_ASSERT_MATCHING_ENUM(WebCursorInfo::TypeNorthPanning, PlatformCursor::TypeNorthPanning);
+COMPILE_ASSERT_MATCHING_ENUM(WebCursorInfo::TypeNorthEastPanning, PlatformCursor::TypeNorthEastPanning);
+COMPILE_ASSERT_MATCHING_ENUM(WebCursorInfo::TypeNorthWestPanning, PlatformCursor::TypeNorthWestPanning);
+COMPILE_ASSERT_MATCHING_ENUM(WebCursorInfo::TypeSouthPanning, PlatformCursor::TypeSouthPanning);
+COMPILE_ASSERT_MATCHING_ENUM(WebCursorInfo::TypeSouthEastPanning, PlatformCursor::TypeSouthEastPanning);
+COMPILE_ASSERT_MATCHING_ENUM(WebCursorInfo::TypeSouthWestPanning, PlatformCursor::TypeSouthWestPanning);
+COMPILE_ASSERT_MATCHING_ENUM(WebCursorInfo::TypeWestPanning, PlatformCursor::TypeWestPanning);
+COMPILE_ASSERT_MATCHING_ENUM(WebCursorInfo::TypeMove, PlatformCursor::TypeMove);
+COMPILE_ASSERT_MATCHING_ENUM(WebCursorInfo::TypeVerticalText, PlatformCursor::TypeVerticalText);
+COMPILE_ASSERT_MATCHING_ENUM(WebCursorInfo::TypeCell, PlatformCursor::TypeCell);
+COMPILE_ASSERT_MATCHING_ENUM(WebCursorInfo::TypeContextMenu, PlatformCursor::TypeContextMenu);
+COMPILE_ASSERT_MATCHING_ENUM(WebCursorInfo::TypeAlias, PlatformCursor::TypeAlias);
+COMPILE_ASSERT_MATCHING_ENUM(WebCursorInfo::TypeProgress, PlatformCursor::TypeProgress);
+COMPILE_ASSERT_MATCHING_ENUM(WebCursorInfo::TypeNoDrop, PlatformCursor::TypeNoDrop);
+COMPILE_ASSERT_MATCHING_ENUM(WebCursorInfo::TypeCopy, PlatformCursor::TypeCopy);
+COMPILE_ASSERT_MATCHING_ENUM(WebCursorInfo::TypeNone, PlatformCursor::TypeNone);
+COMPILE_ASSERT_MATCHING_ENUM(WebCursorInfo::TypeNotAllowed, PlatformCursor::TypeNotAllowed);
+COMPILE_ASSERT_MATCHING_ENUM(WebCursorInfo::TypeZoomIn, PlatformCursor::TypeZoomIn);
+COMPILE_ASSERT_MATCHING_ENUM(WebCursorInfo::TypeZoomOut, PlatformCursor::TypeZoomOut);
+COMPILE_ASSERT_MATCHING_ENUM(WebCursorInfo::TypeCustom, PlatformCursor::TypeCustom);
+
+COMPILE_ASSERT_MATCHING_ENUM(WebEditingActionTyped, EditorInsertActionTyped);
+COMPILE_ASSERT_MATCHING_ENUM(WebEditingActionPasted, EditorInsertActionPasted);
+COMPILE_ASSERT_MATCHING_ENUM(WebEditingActionDropped, EditorInsertActionDropped);
+
+#if ENABLE(VIDEO)
+COMPILE_ASSERT_MATCHING_ENUM(WebMediaPlayer::Empty, MediaPlayer::Empty);
+COMPILE_ASSERT_MATCHING_ENUM(WebMediaPlayer::Idle, MediaPlayer::Idle);
+COMPILE_ASSERT_MATCHING_ENUM(WebMediaPlayer::Loading, MediaPlayer::Loading);
+COMPILE_ASSERT_MATCHING_ENUM(WebMediaPlayer::Loaded, MediaPlayer::Loaded);
+COMPILE_ASSERT_MATCHING_ENUM(WebMediaPlayer::FormatError, MediaPlayer::FormatError);
+COMPILE_ASSERT_MATCHING_ENUM(WebMediaPlayer::NetworkError, MediaPlayer::NetworkError);
+COMPILE_ASSERT_MATCHING_ENUM(WebMediaPlayer::DecodeError, MediaPlayer::DecodeError);
+
+COMPILE_ASSERT_MATCHING_ENUM(WebMediaPlayer::HaveNothing, MediaPlayer::HaveNothing);
+COMPILE_ASSERT_MATCHING_ENUM(WebMediaPlayer::HaveMetadata, MediaPlayer::HaveMetadata);
+COMPILE_ASSERT_MATCHING_ENUM(WebMediaPlayer::HaveCurrentData, MediaPlayer::HaveCurrentData);
+COMPILE_ASSERT_MATCHING_ENUM(WebMediaPlayer::HaveFutureData, MediaPlayer::HaveFutureData);
+COMPILE_ASSERT_MATCHING_ENUM(WebMediaPlayer::HaveEnoughData, MediaPlayer::HaveEnoughData);
+
+COMPILE_ASSERT_MATCHING_ENUM(WebMediaPlayer::Unknown, MediaPlayer::Unknown);
+COMPILE_ASSERT_MATCHING_ENUM(WebMediaPlayer::Download, MediaPlayer::Download);
+COMPILE_ASSERT_MATCHING_ENUM(WebMediaPlayer::StoredStream, MediaPlayer::StoredStream);
+COMPILE_ASSERT_MATCHING_ENUM(WebMediaPlayer::LiveStream, MediaPlayer::LiveStream);
+#endif
+
+#if ENABLE(NOTIFICATIONS)
+COMPILE_ASSERT_MATCHING_ENUM(WebNotificationPresenter::PermissionAllowed, NotificationPresenter::PermissionAllowed);
+COMPILE_ASSERT_MATCHING_ENUM(WebNotificationPresenter::PermissionNotAllowed, NotificationPresenter::PermissionNotAllowed);
+COMPILE_ASSERT_MATCHING_ENUM(WebNotificationPresenter::PermissionDenied, NotificationPresenter::PermissionDenied);
+#endif
+
+COMPILE_ASSERT_MATCHING_ENUM(WebTextAffinityUpstream, UPSTREAM);
+COMPILE_ASSERT_MATCHING_ENUM(WebTextAffinityDownstream, DOWNSTREAM);
diff --git a/WebKit/chromium/src/AutocompletePopupMenuClient.cpp b/WebKit/chromium/src/AutocompletePopupMenuClient.cpp
new file mode 100644 (file)
index 0000000..62d4dff
--- /dev/null
@@ -0,0 +1,178 @@
+/*
+ * Copyright (C) 2009 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "AutocompletePopupMenuClient.h"
+
+#include "CSSStyleSelector.h"
+#include "CSSValueKeywords.h"
+#include "FrameView.h"
+#include "HTMLInputElement.h"
+#include "RenderTheme.h"
+#include "WebVector.h"
+#include "WebViewImpl.h"
+
+using namespace WebCore;
+
+namespace WebKit {
+
+AutocompletePopupMenuClient::AutocompletePopupMenuClient(WebViewImpl* webView)
+    : m_textField(0)
+    , m_selectedIndex(0)
+    , m_webView(webView)
+{
+}
+
+AutocompletePopupMenuClient::~AutocompletePopupMenuClient()
+{
+}
+
+void AutocompletePopupMenuClient::initialize(
+    HTMLInputElement* textField,
+    const WebVector<WebString>& suggestions,
+    int defaultSuggestionIndex)
+{
+    ASSERT(defaultSuggestionIndex < static_cast<int>(suggestions.size()));
+    m_textField = textField;
+    m_selectedIndex = defaultSuggestionIndex;
+    setSuggestions(suggestions);
+
+    FontDescription fontDescription;
+    m_webView->theme()->systemFont(CSSValueWebkitControl, fontDescription);
+    // Use a smaller font size to match IE/Firefox.
+    // FIXME: http://crbug.com/7376 use the system size instead of a
+    //        fixed font size value.
+    fontDescription.setComputedSize(12.0);
+    Font font(fontDescription, 0, 0);
+    font.update(textField->document()->styleSelector()->fontSelector());
+    // The direction of text in popup menu is set the same as the direction of
+    // the input element: textField.
+    m_style.set(new PopupMenuStyle(Color::black, Color::white, font, true,
+                                   Length(WebCore::Fixed),
+                                   textField->renderer()->style()->direction()));
+}
+
+void AutocompletePopupMenuClient::valueChanged(unsigned listIndex, bool fireEvents)
+{
+    m_textField->setValue(m_suggestions[listIndex]);
+    EditorClientImpl* editor =
+        static_cast<EditorClientImpl*>(m_webView->page()->editorClient());
+    ASSERT(editor);
+    editor->onAutofillSuggestionAccepted(
+        static_cast<HTMLInputElement*>(m_textField.get()));
+}
+
+String AutocompletePopupMenuClient::itemText(unsigned listIndex) const
+{
+    return m_suggestions[listIndex];
+}
+
+PopupMenuStyle AutocompletePopupMenuClient::itemStyle(unsigned listIndex) const
+{
+    return *m_style;
+}
+
+PopupMenuStyle AutocompletePopupMenuClient::menuStyle() const
+{
+    return *m_style;
+}
+
+int AutocompletePopupMenuClient::clientPaddingLeft() const
+{
+    // Bug http://crbug.com/7708 seems to indicate the style can be 0.
+    RenderStyle* style = textFieldStyle();
+    return style ? m_webView->theme()->popupInternalPaddingLeft(style) : 0;
+}
+
+int AutocompletePopupMenuClient::clientPaddingRight() const
+{
+    // Bug http://crbug.com/7708 seems to indicate the style can be 0.
+    RenderStyle* style = textFieldStyle();
+    return style ? m_webView->theme()->popupInternalPaddingRight(style) : 0;
+}
+
+void AutocompletePopupMenuClient::popupDidHide()
+{
+    m_webView->autoCompletePopupDidHide();
+}
+
+void AutocompletePopupMenuClient::setTextFromItem(unsigned listIndex)
+{
+    m_textField->setValue(m_suggestions[listIndex]);
+}
+
+FontSelector* AutocompletePopupMenuClient::fontSelector() const
+{
+    return m_textField->document()->styleSelector()->fontSelector();
+}
+
+HostWindow* AutocompletePopupMenuClient::hostWindow() const
+{
+    return m_textField->document()->view()->hostWindow();
+}
+
+PassRefPtr<Scrollbar> AutocompletePopupMenuClient::createScrollbar(
+    ScrollbarClient* client,
+    ScrollbarOrientation orientation,
+    ScrollbarControlSize size)
+{
+    return Scrollbar::createNativeScrollbar(client, orientation, size);
+}
+
+void AutocompletePopupMenuClient::setSuggestions(const WebVector<WebString>& suggestions)
+{
+    m_suggestions.clear();
+    for (size_t i = 0; i < suggestions.size(); ++i)
+        m_suggestions.append(suggestions[i]);
+    // Try to preserve selection if possible.
+    if (m_selectedIndex >= static_cast<int>(suggestions.size()))
+        m_selectedIndex = -1;
+}
+
+void AutocompletePopupMenuClient::removeItemAtIndex(int index)
+{
+    ASSERT(index >= 0 && index < static_cast<int>(m_suggestions.size()));
+    m_suggestions.remove(index);
+}
+
+RenderStyle* AutocompletePopupMenuClient::textFieldStyle() const
+{
+    RenderStyle* style = m_textField->computedStyle();
+    if (!style) {
+        // It seems we can only have a 0 style in a TextField if the
+        // node is detached, in which case we the popup shoud not be
+        // showing.  Please report this in http://crbug.com/7708 and
+        // include the page you were visiting.
+        ASSERT_NOT_REACHED();
+    }
+    return style;
+}
+
+} // namespace WebKit
diff --git a/WebKit/chromium/src/AutocompletePopupMenuClient.h b/WebKit/chromium/src/AutocompletePopupMenuClient.h
new file mode 100644 (file)
index 0000000..ad24e54
--- /dev/null
@@ -0,0 +1,96 @@
+/*
+ * Copyright (C) 2009 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "PopupMenuClient.h"
+
+namespace WebCore {
+class HTMLInputElement;
+class PopupMenuStyle;
+class RenderStyle;
+}
+
+namespace WebKit {
+class WebString;
+class WebViewImpl;
+template <typename T> class WebVector;
+
+// AutocompletePopupMenuClient
+class AutocompletePopupMenuClient : public WebCore::PopupMenuClient {
+public:
+    AutocompletePopupMenuClient(WebViewImpl* webview);
+    ~AutocompletePopupMenuClient();
+
+    void initialize(WebCore::HTMLInputElement*,
+                    const WebVector<WebString>& suggestions,
+                    int defaultSuggestionIndex);
+
+    WebCore::HTMLInputElement* textField() const { return m_textField.get(); }
+
+    void setSuggestions(const WebVector<WebString>&);
+    void removeItemAtIndex(int index);
+
+    // WebCore::PopupMenuClient methods:
+    virtual void valueChanged(unsigned listIndex, bool fireEvents = true);
+    virtual WebCore::String itemText(unsigned listIndex) const;
+    virtual WebCore::String itemToolTip(unsigned lastIndex) const { return WebCore::String(); }
+    virtual bool itemIsEnabled(unsigned listIndex) const { return true; }
+    virtual WebCore::PopupMenuStyle itemStyle(unsigned listIndex) const;
+    virtual WebCore::PopupMenuStyle menuStyle() const;
+    virtual int clientInsetLeft() const { return 0; }
+    virtual int clientInsetRight() const { return 0; }
+    virtual int clientPaddingLeft() const;
+    virtual int clientPaddingRight() const;
+    virtual int listSize() const { return m_suggestions.size(); }
+    virtual int selectedIndex() const { return m_selectedIndex; }
+    virtual void popupDidHide();
+    virtual bool itemIsSeparator(unsigned listIndex) const { return false; }
+    virtual bool itemIsLabel(unsigned listIndex) const { return false; }
+    virtual bool itemIsSelected(unsigned listIndex) const { return false; }
+    virtual bool shouldPopOver() const { return false; }
+    virtual bool valueShouldChangeOnHotTrack() const { return false; }
+    virtual void setTextFromItem(unsigned listIndex);
+    virtual WebCore::FontSelector* fontSelector() const;
+    virtual WebCore::HostWindow* hostWindow() const;
+    virtual PassRefPtr<WebCore::Scrollbar> createScrollbar(
+        WebCore::ScrollbarClient* client,
+        WebCore::ScrollbarOrientation orientation,
+        WebCore::ScrollbarControlSize size);
+
+private:
+    WebCore::RenderStyle* textFieldStyle() const;
+
+    RefPtr<WebCore::HTMLInputElement> m_textField;
+    Vector<WebCore::String> m_suggestions;
+    int m_selectedIndex;
+    WebViewImpl* m_webView;
+    OwnPtr<WebCore::PopupMenuStyle> m_style;
+};
+
+} // namespace WebKit
diff --git a/WebKit/chromium/src/BackForwardListClientImpl.cpp b/WebKit/chromium/src/BackForwardListClientImpl.cpp
new file mode 100644 (file)
index 0000000..8feae32
--- /dev/null
@@ -0,0 +1,136 @@
+/*
+ * Copyright (C) 2009 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "BackForwardListClientImpl.h"
+
+#include "HistoryItem.h"
+#include "WebViewClient.h"
+#include "WebViewImpl.h"
+
+using namespace WebCore;
+
+namespace WebKit {
+
+const char backForwardNavigationScheme[] = "chrome-back-forward";
+
+BackForwardListClientImpl::BackForwardListClientImpl(WebViewImpl* webView)
+    : m_webView(webView)
+{
+}
+
+BackForwardListClientImpl::~BackForwardListClientImpl()
+{
+}
+
+void BackForwardListClientImpl::setCurrentHistoryItem(HistoryItem* item)
+{
+    m_previousItem = m_currentItem;
+    m_currentItem = item;
+}
+
+HistoryItem* BackForwardListClientImpl::previousHistoryItem() const
+{
+    return m_previousItem.get();
+}
+
+void BackForwardListClientImpl::addItem(PassRefPtr<HistoryItem> item)
+{
+    m_previousItem = m_currentItem;
+    m_currentItem = item;
+
+    // If WebCore adds a new HistoryItem, it means this is a new navigation (ie,
+    // not a reload or back/forward).
+    m_webView->observeNewNavigation();
+
+    if (m_webView->client())
+        m_webView->client()->didAddHistoryItem();
+}
+
+void BackForwardListClientImpl::goToItem(HistoryItem* item)
+{
+    m_previousItem = m_currentItem;
+    m_currentItem = item;
+
+    if (m_pendingHistoryItem == item)
+        m_pendingHistoryItem = 0;
+}
+
+HistoryItem* BackForwardListClientImpl::currentItem()
+{
+    return m_currentItem.get();
+}
+
+HistoryItem* BackForwardListClientImpl::itemAtIndex(int index)
+{
+    if (!m_webView->client())
+        return 0;
+
+    // Since we don't keep the entire back/forward list, we have no way to
+    // properly implement this method.  We return a dummy entry instead that we
+    // intercept in our FrameLoaderClient implementation in case WebCore asks
+    // to navigate to this HistoryItem.
+
+    // FIXME: We should change WebCore to handle history.{back,forward,go}
+    // differently.  It should perhaps just ask the FrameLoaderClient to
+    // perform those navigations.
+
+    String url_string = String::format(
+        "%s://go/%d", backForwardNavigationScheme, index);
+
+    m_pendingHistoryItem =
+        HistoryItem::create(url_string, String(), 0.0);
+    return m_pendingHistoryItem.get();
+}
+
+int BackForwardListClientImpl::backListCount()
+{
+    if (!m_webView->client())
+        return 0;
+
+    return m_webView->client()->historyBackListCount();
+}
+
+int BackForwardListClientImpl::forwardListCount()
+{
+    if (!m_webView->client())
+        return 0;
+
+    return m_webView->client()->historyForwardListCount();
+}
+
+void BackForwardListClientImpl::close()
+{
+    m_currentItem = 0;
+    m_previousItem = 0;
+    m_pendingHistoryItem = 0;
+}
+
+} // namespace WebKit
diff --git a/WebKit/chromium/src/BackForwardListClientImpl.h b/WebKit/chromium/src/BackForwardListClientImpl.h
new file mode 100644 (file)
index 0000000..1d8beb0
--- /dev/null
@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 2009 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef BackForwardListClientImpl_h
+#define BackForwardListClientImpl_h
+
+#include "BackForwardList.h"
+
+namespace WebKit {
+class WebViewImpl;
+
+extern const char backForwardNavigationScheme[];
+
+class BackForwardListClientImpl : public WebCore::BackForwardListClient {
+public:
+    BackForwardListClientImpl(WebViewImpl* webview);
+    ~BackForwardListClientImpl();
+
+    void setCurrentHistoryItem(WebCore::HistoryItem* item);
+    WebCore::HistoryItem* previousHistoryItem() const;
+
+private:
+    // WebCore::BackForwardListClient methods:
+    virtual void addItem(PassRefPtr<WebCore::HistoryItem>);
+    virtual void goToItem(WebCore::HistoryItem*);
+    virtual WebCore::HistoryItem* currentItem();
+    virtual WebCore::HistoryItem* itemAtIndex(int index);
+    virtual int backListCount();
+    virtual int forwardListCount();
+    virtual void close();
+
+    WebViewImpl* m_webView;
+
+    RefPtr<WebCore::HistoryItem> m_previousItem;
+    RefPtr<WebCore::HistoryItem> m_currentItem;
+
+    // The last history item that was accessed via itemAtIndex().  We keep track
+    // of this until goToItem() is called, so we can track the navigation.
+    RefPtr<WebCore::HistoryItem> m_pendingHistoryItem;
+};
+
+} // namespace WebKit
+
+#endif