[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
paroga at webkit.org
paroga at webkit.org
Wed Dec 22 16:24:31 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit b151ba68d08b55ca85beee20efd49b62ee930478
Author: paroga at webkit.org <paroga at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Tue Nov 23 06:26:26 2010 +0000
2010-11-22 Patrick Gansterer <paroga at webkit.org>
Reviewed by Adam Roben.
Port ContextMenuWin.cpp to WinCE
https://bugs.webkit.org/show_bug.cgi?id=48408
* platform/ContextMenu.h:
* platform/win/ContextMenuWin.cpp:
(WebCore::ContextMenu::ContextMenu):
(WebCore::ContextMenu::itemCount):
(WebCore::insertMenuItem):
(WebCore::ContextMenu::insertItem):
(WebCore::contextMenuItemByIdOrPosition):
(WebCore::ContextMenu::setPlatformDescription):
(WebCore::contextMenuItemVector):
(WebCore::platformMenuDescription):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@72585 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index dce9c69..31d4c6a 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,21 @@
+2010-11-22 Patrick Gansterer <paroga at webkit.org>
+
+ Reviewed by Adam Roben.
+
+ Port ContextMenuWin.cpp to WinCE
+ https://bugs.webkit.org/show_bug.cgi?id=48408
+
+ * platform/ContextMenu.h:
+ * platform/win/ContextMenuWin.cpp:
+ (WebCore::ContextMenu::ContextMenu):
+ (WebCore::ContextMenu::itemCount):
+ (WebCore::insertMenuItem):
+ (WebCore::ContextMenu::insertItem):
+ (WebCore::contextMenuItemByIdOrPosition):
+ (WebCore::ContextMenu::setPlatformDescription):
+ (WebCore::contextMenuItemVector):
+ (WebCore::platformMenuDescription):
+
2010-11-22 David Hyatt <hyatt at apple.com>
Back out r72527 since it caused multiple rendering regressions. Details in bug.
diff --git a/WebCore/platform/ContextMenu.h b/WebCore/platform/ContextMenu.h
index a162fe4..5321ed6 100644
--- a/WebCore/platform/ContextMenu.h
+++ b/WebCore/platform/ContextMenu.h
@@ -88,6 +88,9 @@ namespace WebCore {
PlatformMenuDescription m_platformDescription;
#else
PlatformMenuDescription m_platformDescription;
+#if OS(WINCE)
+ unsigned m_itemCount;
+#endif
#endif
};
diff --git a/WebCore/platform/win/ContextMenuWin.cpp b/WebCore/platform/win/ContextMenuWin.cpp
index ad53f7e..10443aa 100644
--- a/WebCore/platform/win/ContextMenuWin.cpp
+++ b/WebCore/platform/win/ContextMenuWin.cpp
@@ -30,15 +30,25 @@
#include "Frame.h"
#include "FrameView.h"
#include "Node.h"
-#include <wtf/text/CString.h>
#include <tchar.h>
#include <windows.h>
+#include <wtf/text/CString.h>
+
+#ifndef MIIM_FTYPE
+#define MIIM_FTYPE MIIM_TYPE
+#endif
+#ifndef MIIM_STRING
+#define MIIM_STRING MIIM_TYPE
+#endif
namespace WebCore {
ContextMenu::ContextMenu(const HitTestResult& result)
: m_hitTestResult(result)
, m_platformDescription(0)
+#if OS(WINCE)
+ , m_itemCount(0)
+#endif
{
setPlatformDescription(::CreatePopupMenu());
}
@@ -46,6 +56,9 @@ ContextMenu::ContextMenu(const HitTestResult& result)
ContextMenu::ContextMenu(const HitTestResult& result, const PlatformMenuDescription menu)
: m_hitTestResult(result)
, m_platformDescription(0)
+#if OS(WINCE)
+ , m_itemCount(0)
+#endif
{
setPlatformDescription(menu);
}
@@ -58,11 +71,47 @@ ContextMenu::~ContextMenu()
unsigned ContextMenu::itemCount() const
{
+#if OS(WINCE)
+ return m_itemCount;
+#else
if (!m_platformDescription)
return 0;
return ::GetMenuItemCount(m_platformDescription);
+#endif
+}
+
+#if OS(WINCE)
+static bool insertMenuItem(PlatformMenuDescription menu, unsigned int position, ContextMenuItem& item)
+{
+ UINT flags = MF_BYPOSITION;
+ UINT newItem = 0;
+ LPCWSTR title = 0;
+
+ if (item.type() == SeparatorType)
+ flags |= MF_SEPARATOR;
+ else {
+ flags |= MF_STRING;
+ flags |= item.checked() ? MF_CHECKED : MF_UNCHECKED;
+ flags |= item.enabled() ? MF_ENABLED : MF_GRAYED;
+
+ PlatformMenuItemDescription description = item.releasePlatformDescription();
+ title = description->dwTypeData;
+ description->dwTypeData = 0;
+
+ if (description->hSubMenu) {
+ flags |= MF_POPUP;
+ newItem = reinterpret_cast<UINT>(description->hSubMenu);
+ description->hSubMenu = 0;
+ } else
+ newItem = description->wID;
+
+ free(description);
+ }
+
+ return ::InsertMenuW(menu, position, flags, newItem, title);
}
+#endif
void ContextMenu::insertItem(unsigned int position, ContextMenuItem& item)
{
@@ -70,7 +119,13 @@ void ContextMenu::insertItem(unsigned int position, ContextMenuItem& item)
return;
checkOrEnableIfNeeded(item);
+
+#if OS(WINCE)
+ if (insertMenuItem(m_platformDescription, position, item))
+ ++m_itemCount;
+#else
::InsertMenuItem(m_platformDescription, position, TRUE, item.releasePlatformDescription());
+#endif
}
void ContextMenu::appendItem(ContextMenuItem& item)
@@ -82,14 +137,14 @@ static ContextMenuItem* contextMenuItemByIdOrPosition(HMENU menu, unsigned id, B
{
if (!menu)
return 0;
- LPMENUITEMINFO info = (LPMENUITEMINFO)malloc(sizeof(MENUITEMINFO));
+ LPMENUITEMINFO info = static_cast<LPMENUITEMINFO>(malloc(sizeof(MENUITEMINFO)));
if (!info)
return 0;
memset(info, 0, sizeof(MENUITEMINFO));
info->cbSize = sizeof(MENUITEMINFO);
-
+
// Setting MIIM_DATA which is useful for WebKit clients who store data in this member for their custom menu items.
info->fMask = MIIM_FTYPE | MIIM_ID | MIIM_STRING | MIIM_DATA;
@@ -98,9 +153,8 @@ static ContextMenuItem* contextMenuItemByIdOrPosition(HMENU menu, unsigned id, B
return 0;
}
- UINT type = info->fType & ~(MFT_MENUBARBREAK | MFT_MENUBREAK | MFT_OWNERDRAW | MFT_RADIOCHECK | MFT_RIGHTORDER | MFT_RIGHTJUSTIFY);
- if (type == MFT_STRING) {
- LPTSTR buffer = (LPTSTR)malloc(++info->cch * sizeof(TCHAR));
+ if (info->fType & MFT_STRING) {
+ LPTSTR buffer = static_cast<LPTSTR>(malloc(++info->cch * sizeof(TCHAR)));
if (!buffer) {
free(info);
return 0;
@@ -108,7 +162,7 @@ static ContextMenuItem* contextMenuItemByIdOrPosition(HMENU menu, unsigned id, B
info->dwTypeData = buffer;
::GetMenuItemInfo(menu, id, byPosition, info);
}
-
+
return new ContextMenuItem(info);
}
@@ -134,6 +188,7 @@ void ContextMenu::setPlatformDescription(HMENU menu)
if (!m_platformDescription)
return;
+#if !OS(WINCE)
MENUINFO menuInfo = {0};
menuInfo.cbSize = sizeof(MENUINFO);
menuInfo.fMask = MIM_STYLE;
@@ -141,6 +196,7 @@ void ContextMenu::setPlatformDescription(HMENU menu)
menuInfo.fMask = MIM_STYLE;
menuInfo.dwStyle |= MNS_NOTIFYBYPOS;
::SetMenuInfo(m_platformDescription, &menuInfo);
+#endif
}
HMENU ContextMenu::platformDescription() const
@@ -157,14 +213,14 @@ HMENU ContextMenu::releasePlatformDescription()
Vector<ContextMenuItem> contextMenuItemVector(PlatformMenuDescription)
{
- // FIXME - Implement
+ // FIXME - Implement
return Vector<ContextMenuItem>();
}
PlatformMenuDescription platformMenuDescription(Vector<ContextMenuItem>& menuItemVector)
{
- // FIXME - Implement
+ // FIXME - Implement
return 0;
}
-}
+} // namespace WebCore
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list