summaryrefslogtreecommitdiffstats
path: root/WebCore/platform/win
diff options
context:
space:
mode:
Diffstat (limited to 'WebCore/platform/win')
-rw-r--r--WebCore/platform/win/FileSystemWin.cpp6
-rw-r--r--WebCore/platform/win/PopupMenuWin.cpp5
-rw-r--r--WebCore/platform/win/WheelEventWin.cpp55
3 files changed, 44 insertions, 22 deletions
diff --git a/WebCore/platform/win/FileSystemWin.cpp b/WebCore/platform/win/FileSystemWin.cpp
index 5671462..746fceb 100644
--- a/WebCore/platform/win/FileSystemWin.cpp
+++ b/WebCore/platform/win/FileSystemWin.cpp
@@ -191,11 +191,11 @@ CString openTemporaryFile(const char*, PlatformFileHandle& handle)
char tempPath[MAX_PATH];
int tempPathLength = ::GetTempPathA(_countof(tempPath), tempPath);
if (tempPathLength <= 0 || tempPathLength > _countof(tempPath))
- return 0;
+ return CString();
HCRYPTPROV hCryptProv = 0;
if (!CryptAcquireContext(&hCryptProv, 0, 0, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT))
- return 0;
+ return CString();
char proposedPath[MAX_PATH];
while (1) {
@@ -226,7 +226,7 @@ CString openTemporaryFile(const char*, PlatformFileHandle& handle)
CryptReleaseContext(hCryptProv, 0);
if (!isHandleValid(handle))
- return 0;
+ return CString();
return proposedPath;
}
diff --git a/WebCore/platform/win/PopupMenuWin.cpp b/WebCore/platform/win/PopupMenuWin.cpp
index 59ea563..52f2eb9 100644
--- a/WebCore/platform/win/PopupMenuWin.cpp
+++ b/WebCore/platform/win/PopupMenuWin.cpp
@@ -527,6 +527,8 @@ void PopupMenu::paint(const IntRect& damageRect, HDC hdc)
// Draw the item text
if (itemStyle.isVisible()) {
int textX = max(0, client()->clientPaddingLeft() - client()->clientInsetLeft());
+ if (theme()->popupOptionSupportsTextIndent() && itemStyle.textDirection() == LTR)
+ textX += itemStyle.textIndent().calcMinValue(itemRect.width());
int textY = itemRect.y() + itemFont.ascent() + (itemRect.height() - itemFont.height()) / 2;
context.drawBidiText(itemFont, textRun, IntPoint(textX, textY));
}
@@ -683,6 +685,9 @@ static LRESULT CALLBACK PopupWndProc(HWND hWnd, UINT message, WPARAM wParam, LPA
::SendMessage(popup->client()->hostWindow()->platformWindow(), message, wParam, lParam);
popup->client()->hidePopup();
break;
+ case VK_ESCAPE:
+ popup->client()->hidePopup();
+ break;
default:
if (isASCIIPrintable(wParam))
// Send the keydown to the WebView so it can be used for type-to-select.
diff --git a/WebCore/platform/win/WheelEventWin.cpp b/WebCore/platform/win/WheelEventWin.cpp
index d272ba7..e6670a4 100644
--- a/WebCore/platform/win/WheelEventWin.cpp
+++ b/WebCore/platform/win/WheelEventWin.cpp
@@ -46,23 +46,23 @@ static IntPoint globalPositionForEvent(HWND hWnd, LPARAM lParam)
return point;
}
-int PlatformWheelEvent::horizontalLineMultiplier() const
+static int horizontalScrollChars()
{
static ULONG scrollChars;
if (!scrollChars && !SystemParametersInfo(SPI_GETWHEELSCROLLCHARS, 0, &scrollChars, 0))
- scrollChars = cLineMultiplier;
+ scrollChars = 1;
return scrollChars;
}
-int PlatformWheelEvent::verticalLineMultiplier() const
+static int verticalScrollLines()
{
static ULONG scrollLines;
if (!scrollLines && !SystemParametersInfo(SPI_GETWHEELSCROLLLINES, 0, &scrollLines, 0))
- scrollLines = cLineMultiplier;
+ scrollLines = 3;
return scrollLines;
}
-
-PlatformWheelEvent::PlatformWheelEvent(HWND hWnd, WPARAM wParam, LPARAM lParam, bool isHorizontal)
+
+PlatformWheelEvent::PlatformWheelEvent(HWND hWnd, WPARAM wParam, LPARAM lParam, bool isMouseHWheel)
: m_position(positionForEvent(hWnd, lParam))
, m_globalPosition(globalPositionForEvent(hWnd, lParam))
, m_isAccepted(false)
@@ -71,23 +71,40 @@ PlatformWheelEvent::PlatformWheelEvent(HWND hWnd, WPARAM wParam, LPARAM lParam,
, m_altKey(GetKeyState(VK_MENU) & HIGH_BIT_MASK_SHORT)
, m_metaKey(m_altKey) // FIXME: We'll have to test other browsers
{
- static ULONG scrollLines, scrollChars;
- float delta = GET_WHEEL_DELTA_WPARAM(wParam) / (float)WHEEL_DELTA;
- if (isHorizontal) {
- // Windows sends a positive delta for scrolling right, while AppKit
- // sends a negative delta. EventHandler expects the AppKit values,
- // so we have to negate our horizontal delta to match.
- m_deltaX = -delta * horizontalLineMultiplier();
+ // How many pixels should we scroll per line? Gecko uses the height of the
+ // current line, which means scroll distance changes as you go through the
+ // page or go to different pages. IE 7 is ~50 px/line, although the value
+ // seems to vary slightly by page and zoom level. Since IE 7 has a
+ // smoothing algorithm on scrolling, it can get away with slightly larger
+ // scroll values without feeling jerky. Here we use 100 px per three lines
+ // (the default scroll amount on Windows is three lines per wheel tick).
+ static const float cScrollbarPixelsPerLine = 100.0f / 3.0f;
+ float delta = GET_WHEEL_DELTA_WPARAM(wParam) / static_cast<float>(WHEEL_DELTA);
+ if (isMouseHWheel) {
+ // Windows is <-- -/+ -->, WebKit wants <-- +/- -->, so we negate
+ // |delta| after saving the original value on the wheel tick member.
+ m_wheelTicksX = delta;
+ m_wheelTicksY = 0;
+ delta = -delta;
+ } else {
+ // Even though we use shift + vertical wheel to scroll horizontally in
+ // WebKit, we still note it as a vertical scroll on the wheel tick
+ // member, so that the DOM event we later construct will match the real
+ // hardware event better.
+ m_wheelTicksX = 0;
+ m_wheelTicksY = delta;
+ }
+ if (isMouseHWheel || m_shiftKey) {
+ m_deltaX = delta * static_cast<float>(horizontalScrollChars()) * cScrollbarPixelsPerLine;
m_deltaY = 0;
- m_granularity = ScrollByLineWheelEvent;
+ m_granularity = ScrollByPixelWheelEvent;
} else {
m_deltaX = 0;
m_deltaY = delta;
- int verticalMultiplier = verticalLineMultiplier();
- // A multiplier of -1 is used to mean that vertical wheel scrolling should be done by page.
- m_granularity = (verticalMultiplier == -1) ? ScrollByPageWheelEvent : ScrollByLineWheelEvent;
- if (m_granularity == ScrollByLineWheelEvent)
- m_deltaY *= verticalMultiplier;
+ int verticalMultiplier = verticalScrollLines();
+ m_granularity = (verticalMultiplier == WHEEL_PAGESCROLL) ? ScrollByPageWheelEvent : ScrollByPixelWheelEvent;
+ if (m_granularity == ScrollByPixelWheelEvent)
+ m_deltaY *= static_cast<float>(verticalMultiplier) * cScrollbarPixelsPerLine;
}
}