summaryrefslogtreecommitdiffstats
path: root/WebCore/platform/win/PopupMenuWin.cpp
diff options
context:
space:
mode:
authorSteve Block <steveblock@google.com>2010-08-04 11:41:34 +0100
committerSteve Block <steveblock@google.com>2010-08-09 12:04:44 +0100
commitdb14019a23d96bc8a444b6576a5da8bd1cfbc8b0 (patch)
tree9f793c5b0f5e1f2aca8247158920e2c4bf962bbf /WebCore/platform/win/PopupMenuWin.cpp
parentbf916837aa84f1e4b00e6ed6268516c2acd27545 (diff)
downloadexternal_webkit-db14019a23d96bc8a444b6576a5da8bd1cfbc8b0.zip
external_webkit-db14019a23d96bc8a444b6576a5da8bd1cfbc8b0.tar.gz
external_webkit-db14019a23d96bc8a444b6576a5da8bd1cfbc8b0.tar.bz2
Merge WebKit at r64523 : Initial merge by git.
Change-Id: Ibb796c6802e757b1d9b40f58205cfbe4da95fcd4
Diffstat (limited to 'WebCore/platform/win/PopupMenuWin.cpp')
-rw-r--r--WebCore/platform/win/PopupMenuWin.cpp67
1 files changed, 34 insertions, 33 deletions
diff --git a/WebCore/platform/win/PopupMenuWin.cpp b/WebCore/platform/win/PopupMenuWin.cpp
index 4bc6dc7..aaadc53 100644
--- a/WebCore/platform/win/PopupMenuWin.cpp
+++ b/WebCore/platform/win/PopupMenuWin.cpp
@@ -1,6 +1,7 @@
/*
* Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
* Copyright (C) 2007-2009 Torch Mobile Inc.
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -20,7 +21,7 @@
*/
#include "config.h"
-#include "PopupMenu.h"
+#include "PopupMenuWin.h"
#include "BitmapInfo.h"
#include "Document.h"
@@ -86,7 +87,7 @@ static void translatePoint(LPARAM& lParam, HWND from, HWND to)
lParam = MAKELPARAM(pt.x, pt.y);
}
-PopupMenu::PopupMenu(PopupMenuClient* client)
+PopupMenuWin::PopupMenuWin(PopupMenuClient* client)
: m_popupClient(client)
, m_scrollbar(0)
, m_popup(0)
@@ -102,7 +103,7 @@ PopupMenu::PopupMenu(PopupMenuClient* client)
{
}
-PopupMenu::~PopupMenu()
+PopupMenuWin::~PopupMenuWin()
{
if (m_bmp)
::DeleteObject(m_bmp);
@@ -114,12 +115,17 @@ PopupMenu::~PopupMenu()
m_scrollbar->setParent(0);
}
-LPCTSTR PopupMenu::popupClassName()
+void PopupMenuWin::disconnectClient()
+{
+ m_popupClient = 0;
+}
+
+LPCTSTR PopupMenuWin::popupClassName()
{
return kPopupWindowClassName;
}
-void PopupMenu::show(const IntRect& r, FrameView* view, int index)
+void PopupMenuWin::show(const IntRect& r, FrameView* view, int index)
{
calculatePositionAndSize(r, view);
if (clientRect().isEmpty())
@@ -267,7 +273,7 @@ void PopupMenu::show(const IntRect& r, FrameView* view, int index)
hide();
}
-void PopupMenu::hide()
+void PopupMenuWin::hide()
{
if (!m_showPopup)
return;
@@ -283,7 +289,7 @@ void PopupMenu::hide()
::PostMessage(m_popup, WM_NULL, 0, 0);
}
-void PopupMenu::calculatePositionAndSize(const IntRect& r, FrameView* v)
+void PopupMenuWin::calculatePositionAndSize(const IntRect& r, FrameView* v)
{
// r is in absolute document coordinates, but we want to be in screen coordinates
@@ -373,7 +379,7 @@ void PopupMenu::calculatePositionAndSize(const IntRect& r, FrameView* v)
return;
}
-bool PopupMenu::setFocusedIndex(int i, bool hotTracking)
+bool PopupMenuWin::setFocusedIndex(int i, bool hotTracking)
{
if (i < 0 || i >= client()->listSize() || i == focusedIndex())
return false;
@@ -395,22 +401,22 @@ bool PopupMenu::setFocusedIndex(int i, bool hotTracking)
return true;
}
-int PopupMenu::visibleItems() const
+int PopupMenuWin::visibleItems() const
{
return clientRect().height() / m_itemHeight;
}
-int PopupMenu::listIndexAtPoint(const IntPoint& point) const
+int PopupMenuWin::listIndexAtPoint(const IntPoint& point) const
{
return m_scrollOffset + point.y() / m_itemHeight;
}
-int PopupMenu::focusedIndex() const
+int PopupMenuWin::focusedIndex() const
{
return m_focusedIndex;
}
-void PopupMenu::focusFirst()
+void PopupMenuWin::focusFirst()
{
if (!client())
return;
@@ -424,7 +430,7 @@ void PopupMenu::focusFirst()
}
}
-void PopupMenu::focusLast()
+void PopupMenuWin::focusLast()
{
if (!client())
return;
@@ -438,7 +444,7 @@ void PopupMenu::focusLast()
}
}
-bool PopupMenu::down(unsigned lines)
+bool PopupMenuWin::down(unsigned lines)
{
if (!client())
return false;
@@ -457,7 +463,7 @@ bool PopupMenu::down(unsigned lines)
return setFocusedIndex(lastSelectableIndex);
}
-bool PopupMenu::up(unsigned lines)
+bool PopupMenuWin::up(unsigned lines)
{
if (!client())
return false;
@@ -476,7 +482,7 @@ bool PopupMenu::up(unsigned lines)
return setFocusedIndex(lastSelectableIndex);
}
-void PopupMenu::invalidateItem(int index)
+void PopupMenuWin::invalidateItem(int index)
{
if (!m_popup)
return;
@@ -491,7 +497,7 @@ void PopupMenu::invalidateItem(int index)
::InvalidateRect(m_popup, &r, TRUE);
}
-IntRect PopupMenu::clientRect() const
+IntRect PopupMenuWin::clientRect() const
{
IntRect clientRect = m_windowRect;
clientRect.inflate(-popupWindowBorderWidth);
@@ -499,12 +505,12 @@ IntRect PopupMenu::clientRect() const
return clientRect;
}
-void PopupMenu::incrementWheelDelta(int delta)
+void PopupMenuWin::incrementWheelDelta(int delta)
{
m_wheelDelta += delta;
}
-void PopupMenu::reduceWheelDelta(int delta)
+void PopupMenuWin::reduceWheelDelta(int delta)
{
ASSERT(delta >= 0);
ASSERT(delta <= abs(m_wheelDelta));
@@ -517,7 +523,7 @@ void PopupMenu::reduceWheelDelta(int delta)
return;
}
-bool PopupMenu::scrollToRevealSelection()
+bool PopupMenuWin::scrollToRevealSelection()
{
if (!m_scrollbar)
return false;
@@ -537,7 +543,7 @@ bool PopupMenu::scrollToRevealSelection()
return false;
}
-void PopupMenu::updateFromElement()
+void PopupMenuWin::updateFromElement()
{
if (!m_popup)
return;
@@ -549,14 +555,9 @@ void PopupMenu::updateFromElement()
::UpdateWindow(m_popup);
}
-bool PopupMenu::itemWritingDirectionIsNatural()
-{
- return true;
-}
-
const int separatorPadding = 4;
const int separatorHeight = 1;
-void PopupMenu::paint(const IntRect& damageRect, HDC hdc)
+void PopupMenuWin::paint(const IntRect& damageRect, HDC hdc)
{
if (!m_popup)
return;
@@ -663,7 +664,7 @@ void PopupMenu::paint(const IntRect& damageRect, HDC hdc)
::ReleaseDC(m_popup, localDC);
}
-void PopupMenu::valueChanged(Scrollbar* scrollBar)
+void PopupMenuWin::valueChanged(Scrollbar* scrollBar)
{
ASSERT(m_scrollbar);
@@ -699,7 +700,7 @@ void PopupMenu::valueChanged(Scrollbar* scrollBar)
::UpdateWindow(m_popup);
}
-void PopupMenu::invalidateScrollbarRect(Scrollbar* scrollbar, const IntRect& rect)
+void PopupMenuWin::invalidateScrollbarRect(Scrollbar* scrollbar, const IntRect& rect)
{
IntRect scrollRect = rect;
scrollRect.move(scrollbar->x(), scrollbar->y());
@@ -707,7 +708,7 @@ void PopupMenu::invalidateScrollbarRect(Scrollbar* scrollbar, const IntRect& rec
::InvalidateRect(m_popup, &r, false);
}
-void PopupMenu::registerClass()
+void PopupMenuWin::registerClass()
{
static bool haveRegisteredWindowClass = false;
@@ -743,7 +744,7 @@ void PopupMenu::registerClass()
}
-LRESULT CALLBACK PopupMenu::PopupMenuWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
+LRESULT CALLBACK PopupMenuWin::PopupMenuWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
#if OS(WINCE)
LONG longPtr = GetWindowLong(hWnd, 0);
@@ -751,7 +752,7 @@ LRESULT CALLBACK PopupMenu::PopupMenuWndProc(HWND hWnd, UINT message, WPARAM wPa
LONG_PTR longPtr = GetWindowLongPtr(hWnd, 0);
#endif
- if (PopupMenu* popup = reinterpret_cast<PopupMenu*>(longPtr))
+ if (PopupMenuWin* popup = reinterpret_cast<PopupMenuWin*>(longPtr))
return popup->wndProc(hWnd, message, wParam, lParam);
if (message == WM_CREATE) {
@@ -771,7 +772,7 @@ LRESULT CALLBACK PopupMenu::PopupMenuWndProc(HWND hWnd, UINT message, WPARAM wPa
const int smoothScrollAnimationDuration = 5000;
-LRESULT PopupMenu::wndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
+LRESULT PopupMenuWin::wndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
LRESULT lResult = 0;