diff options
author | darin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-10-18 04:09:03 +0000 |
---|---|---|
committer | darin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-10-18 04:09:03 +0000 |
commit | 5ff6885209ae478cdbb34d975d7f7a7959f14e8e (patch) | |
tree | a96c8d93869d6e05bb1b3f31af743aa9dfe5f089 /webkit/glue | |
parent | 8e44632ef6673e72c0a07f08d45e340d888962b1 (diff) | |
download | chromium_src-5ff6885209ae478cdbb34d975d7f7a7959f14e8e.zip chromium_src-5ff6885209ae478cdbb34d975d7f7a7959f14e8e.tar.gz chromium_src-5ff6885209ae478cdbb34d975d7f7a7959f14e8e.tar.bz2 |
Disable PLATFORM(WIN) !!
port/platform/chromium/PlatformKeyboardEventChromium.cpp
- this is KeyEventWin.cpp renamed and mostly deleted. we just needed to define two static methods.
- the big switch case goes to event_conversion.cc.
port/platform/chromium/DragDataChromium.cpp
- yay, no more dropData wrapper!
port/platform/chromium/TemporaryLinkStubs.cpp
- just stubbing scheduleDispatchFunctionsOnMainThread() for now since i think we should really use an implementation based on MessageLoop, and we don't use background threads in webkit yet.
port/platform/chromium/DragImageChromium.cpp
- PLATFORM(WIN) to PLATFORM(WIN_OS)
port/platform/chromium/PopupMenuChromium.cpp
- lots of nice cleanup. no more dummy HWNDs!
port/platform/chromium/PlatformScrollBarChromium.cpp
port/platform/chromium/ScrollViewChromium.cpp
- GraphicsContext::getWindowsContext is gone. just use the skia canvas directly.
port/platform/network/chromium/NetworkStateNotifierChromium.cpp
- delete the PLATFORM(WIN) stubs
port/platform/win/KeyEventWin.cpp
port/platform/win/PlatformMouseEventWin.cpp
port/platform/graphics/IntPointWin.cpp
port/platform/graphics/IntSizeWin.cpp
port/platform/graphics/IntRectWin.cpp
- deleted :)
port/platform/win/ScreenWin.cpp
- compensate for no longer having implicit conversion between RECT and IntRect
port/platform/UniscribeStateTextRun.cpp
- scriptCache and scriptFontProperties now live on FontPlatformData as discussed with brett and hyatt.
port/platform/graphics/FontCacheWin.cpp
- getFontLinkInterface() function doesn't exist outside of PLATFORM(WIN)
port/platform/graphics/FontPlatformData.h
port/platform/graphics/FontPlatformDataWin.cpp
- support storing script{Cache,FontProperties} on FontPlatformData. need to implement assignment operator and copy constructor. the script{Cache,FontProperties} objects are not copied per discussion with hyatt.
- i moved m_isMLangFont into RefCountedHFONT so that we would know how to "destroy" the HFONT.
port/platform/graphics/SimpleFontDataWin.cpp
port/platform/graphics/GlyphPageTreeNodeWin.cpp
- modified to support changes to FontPlatformData
port/platform/graphics/ImageSkia.cpp
- getHBITMAP, etc. were never used and are not needed
port/platform/graphics/IconWin.cpp
- modifications corresponding to my changes to Icon.h. m_icon is of type PlatformIcon.
port/platform/graphics/GraphicsContextSkia.cpp
- {get,release}WindowsContext are no longer defined
port/platform/Cursor.h
pending/NetworkStateNotifier.h
pending/PlatformKeyboardEvent.h
- we no longer need to fork these files.
port/page/chromium/EventHandlerChromium.cpp
- add #include "Clipboard.h" to support non-WIN_OS
port/page/chromium/AccessibilityObjectWrapper.h
- changed to no longer be a COM interface
port/page/AccessibilityObjectWrapperWin.h
- moved to port/page/chromium/AccessibilityObjectWrapper.h
pending/AccessibleBase.cpp
pending/AccessibleBase.h
- modified to support changes to a11y wrapper class
- by the way, these files should not be in pending! will fix that later.
glue/glue_util.cc
glue/glue_util.h
- add conversion functions for rect structures.
glue/webframe_impl.cc
glue/webplugin_impl.cc
- use new webkit_glue rect conversion functions.
glue/glue_accessibility.cc
- add header that is needed to build this file on windows
glue/webview_impl.cc
- no longer supports auto-conversion between IntPoint and POINT
glue/event_conversion.cc
- initialize by modifying member variables of the base class directly.
- moved a static function from KeyEventWin.cpp
R=tony,brettw
BUG=3488
Review URL: http://codereview.chromium.org/7495
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@3587 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue')
-rw-r--r-- | webkit/glue/event_conversion.cc | 154 | ||||
-rw-r--r-- | webkit/glue/glue_accessibility.cc | 1 | ||||
-rw-r--r-- | webkit/glue/glue_util.cc | 12 | ||||
-rw-r--r-- | webkit/glue/glue_util.h | 8 | ||||
-rw-r--r-- | webkit/glue/localized_strings.cc | 10 | ||||
-rw-r--r-- | webkit/glue/webframe_impl.cc | 8 | ||||
-rw-r--r-- | webkit/glue/webplugin_impl.cc | 31 | ||||
-rw-r--r-- | webkit/glue/webview_impl.cc | 6 |
8 files changed, 178 insertions, 52 deletions
diff --git a/webkit/glue/event_conversion.cc b/webkit/glue/event_conversion.cc index 91100c6..8c56892 100644 --- a/webkit/glue/event_conversion.cc +++ b/webkit/glue/event_conversion.cc @@ -40,7 +40,7 @@ uint32 MakePlatformMouseEvent::last_click_time_ = 0; MakePlatformMouseEvent::MakePlatformMouseEvent(Widget* widget, const WebMouseEvent& e) #if defined(OS_WIN) - : PlatformMouseEvent(NULL, 0, 0, 0, false /* TODO(darin): do we care? */) { + { #elif defined(OS_MACOSX) : PlatformMouseEvent(e.mac_event.get()) { #elif defined(OS_LINUX) @@ -85,9 +85,7 @@ MakePlatformMouseEvent::MakePlatformMouseEvent(Widget* widget, last_click_position = IntPoint(); last_click_time_ = 0; } -#if defined(OS_WIN) - setClickCount(last_click_count_); -#endif + m_clickCount = last_click_count_; m_eventType = MouseEventMoved; break; @@ -101,16 +99,12 @@ MakePlatformMouseEvent::MakePlatformMouseEvent(Widget* widget, } last_click_time_ = current_time; last_click_button = m_button; -#if defined(OS_WIN) - setClickCount(last_click_count_); -#endif + m_clickCount = last_click_count_; m_eventType = MouseEventPressed; break; case WebInputEvent::MOUSE_UP: -#if defined(OS_WIN) - setClickCount(last_click_count_); -#endif + m_clickCount = last_click_count_; m_eventType = MouseEventReleased; break; @@ -119,9 +113,7 @@ MakePlatformMouseEvent::MakePlatformMouseEvent(Widget* widget, } if (webkit_glue::IsLayoutTestMode()) { -#if defined(OS_WIN) - setClickCount(e.layout_test_click_count); -#endif + m_clickCount = e.layout_test_click_count; } } @@ -130,7 +122,7 @@ MakePlatformMouseEvent::MakePlatformMouseEvent(Widget* widget, MakePlatformWheelEvent::MakePlatformWheelEvent(Widget* widget, const WebMouseWheelEvent& e) #if defined(OS_WIN) - : PlatformWheelEvent(NULL, 0, 0, false) { // TODO(jackson): Check if it's a horizontal event + { #elif defined(OS_MACOSX) : PlatformWheelEvent(e.mac_event.get()) { #elif defined(OS_LINUX) @@ -146,13 +138,20 @@ MakePlatformWheelEvent::MakePlatformWheelEvent(Widget* widget, m_linesToScrollPerDelta = 1; m_pageXScrollMode = false; m_pageYScrollMode = false; + m_isAccepted = false; m_shiftKey = (e.modifiers & WebInputEvent::SHIFT_KEY) != 0; m_ctrlKey = (e.modifiers & WebInputEvent::CTRL_KEY) != 0; m_altKey = (e.modifiers & WebInputEvent::ALT_KEY) != 0; m_metaKey = (e.modifiers & WebInputEvent::META_KEY) != 0; + m_isContinuous = false; + m_continuousDeltaX = 0; + m_continuousDeltaY = 0; } -static inline const PlatformKeyboardEvent::Type platformKeyTypeForWebInputEventType(WebInputEvent::Type type) { +// MakePlatformKeyboardEvent -------------------------------------------------- + +static inline const PlatformKeyboardEvent::Type ToPlatformKeyboardEventType( + WebInputEvent::Type type) { switch (type) { case WebInputEvent::KEY_UP: return PlatformKeyboardEvent::KeyUp; @@ -164,26 +163,141 @@ static inline const PlatformKeyboardEvent::Type platformKeyTypeForWebInputEventT ASSERT_NOT_REACHED(); } return PlatformKeyboardEvent::KeyDown; -} +} -// MakePlatformKeyboardEvent -------------------------------------------------- +static inline String ToSingleCharacterString(UChar c) { + return String(&c, 1); +} + +static String GetKeyIdentifierForWindowsKeyCode(unsigned short keyCode) { + switch (keyCode) { + case VK_MENU: + return "Alt"; + case VK_CONTROL: + return "Control"; + case VK_SHIFT: + return "Shift"; + case VK_CAPITAL: + return "CapsLock"; + case VK_LWIN: + case VK_RWIN: + return "Win"; + case VK_CLEAR: + return "Clear"; + case VK_DOWN: + return "Down"; + // "End" + case VK_END: + return "End"; + // "Enter" + case VK_RETURN: + return "Enter"; + case VK_EXECUTE: + return "Execute"; + case VK_F1: + return "F1"; + case VK_F2: + return "F2"; + case VK_F3: + return "F3"; + case VK_F4: + return "F4"; + case VK_F5: + return "F5"; + case VK_F6: + return "F6"; + case VK_F7: + return "F7"; + case VK_F8: + return "F8"; + case VK_F9: + return "F9"; + case VK_F10: + return "F11"; + case VK_F12: + return "F12"; + case VK_F13: + return "F13"; + case VK_F14: + return "F14"; + case VK_F15: + return "F15"; + case VK_F16: + return "F16"; + case VK_F17: + return "F17"; + case VK_F18: + return "F18"; + case VK_F19: + return "F19"; + case VK_F20: + return "F20"; + case VK_F21: + return "F21"; + case VK_F22: + return "F22"; + case VK_F23: + return "F23"; + case VK_F24: + return "F24"; + case VK_HELP: + return "Help"; + case VK_HOME: + return "Home"; + case VK_INSERT: + return "Insert"; + case VK_LEFT: + return "Left"; + case VK_NEXT: + return "PageDown"; + case VK_PRIOR: + return "PageUp"; + case VK_PAUSE: + return "Pause"; + case VK_SNAPSHOT: + return "PrintScreen"; + case VK_RIGHT: + return "Right"; + case VK_SCROLL: + return "Scroll"; + case VK_SELECT: + return "Select"; + case VK_UP: + return "Up"; + // Standard says that DEL becomes U+007F. + case VK_DELETE: + return "U+007F"; + default: + return String::format("U+%04X", toupper(keyCode)); + } +} MakePlatformKeyboardEvent::MakePlatformKeyboardEvent(const WebKeyboardEvent& e) #if defined(OS_WIN) - : PlatformKeyboardEvent(NULL, e.key_code, e.key_data, - platformKeyTypeForWebInputEventType(e.type), - e.system_key) { + { #elif defined(OS_MACOSX) : PlatformKeyboardEvent(e.mac_event.get()) { #elif defined(OS_LINUX) : PlatformKeyboardEvent(NULL) { #endif + m_type = ToPlatformKeyboardEventType(e.type); + if (m_type == Char || m_type == KeyDown) + m_text = m_unmodifiedText = ToSingleCharacterString(e.key_code); + if (m_type != Char) + m_keyIdentifier = GetKeyIdentifierForWindowsKeyCode(e.key_code); + if (m_type == Char || m_type == KeyDown || m_type == KeyUp || + m_type == RawKeyDown) { + m_windowsVirtualKeyCode = e.key_code; + } else { + m_windowsVirtualKeyCode = 0; + } m_autoRepeat = (e.modifiers & WebInputEvent::IS_AUTO_REPEAT) != 0; m_isKeypad = (e.modifiers & WebInputEvent::IS_KEYPAD) != 0; m_shiftKey = (e.modifiers & WebInputEvent::SHIFT_KEY) != 0; m_ctrlKey = (e.modifiers & WebInputEvent::CTRL_KEY) != 0; m_altKey = (e.modifiers & WebInputEvent::ALT_KEY) != 0; m_metaKey = (e.modifiers & WebInputEvent::META_KEY) != 0; + m_isSystemKey = e.system_key; } void MakePlatformKeyboardEvent::SetKeyType(Type type) { diff --git a/webkit/glue/glue_accessibility.cc b/webkit/glue/glue_accessibility.cc index 60c1cf9..370bbdb 100644 --- a/webkit/glue/glue_accessibility.cc +++ b/webkit/glue/glue_accessibility.cc @@ -9,6 +9,7 @@ #pragma warning(push, 0) #include "AccessibleDocument.h" #include "AXObjectCache.h" +#include "COMPtr.h" #include "Document.h" #include "Frame.h" #pragma warning(pop) diff --git a/webkit/glue/glue_util.cc b/webkit/glue/glue_util.cc index b45134b..6829cd5 100644 --- a/webkit/glue/glue_util.cc +++ b/webkit/glue/glue_util.cc @@ -7,11 +7,13 @@ #include "webkit/glue/glue_util.h" #include "base/compiler_specific.h" +#include "base/gfx/rect.h" #include "base/string_util.h" MSVC_PUSH_WARNING_LEVEL(0); #undef LOG #include "CString.h" +#include "IntRect.h" #include "PlatformString.h" MSVC_POP_WARNING(); @@ -93,5 +95,15 @@ WebCore::KURL GURLToKURL(const GURL& url) { #endif } +// Rect conversions ------------------------------------------------------------ + +gfx::Rect FromIntRect(const WebCore::IntRect& r) { + return gfx::Rect(r.x(), r.y(), r.width(), r.height()); +} + +WebCore::IntRect ToIntRect(const gfx::Rect& r) { + return WebCore::IntRect(r.x(), r.y(), r.width(), r.height()); +} + } // namespace webkit_glue diff --git a/webkit/glue/glue_util.h b/webkit/glue/glue_util.h index 91fa16a..d649ccf 100644 --- a/webkit/glue/glue_util.h +++ b/webkit/glue/glue_util.h @@ -12,10 +12,15 @@ namespace WebCore { class CString; +class IntRect; class KURL; class String; } +namespace gfx { +class Rect; +} + namespace webkit_glue { // WebCore::CString <-> std::string. All characters are 8-bit and are preserved @@ -40,6 +45,9 @@ WebCore::String StdStringToString(const std::string& str); GURL KURLToGURL(const WebCore::KURL& url); WebCore::KURL GURLToKURL(const GURL& url); +gfx::Rect FromIntRect(const WebCore::IntRect& r); +WebCore::IntRect ToIntRect(const gfx::Rect& r); + } // namespace webkit_glue #endif // #ifndef WEBKIT_GLUE_GLUE_UTIL_H_ diff --git a/webkit/glue/localized_strings.cc b/webkit/glue/localized_strings.cc index 10fe480..c9ba93d 100644 --- a/webkit/glue/localized_strings.cc +++ b/webkit/glue/localized_strings.cc @@ -123,16 +123,6 @@ String WebCore::unknownFileSizeText() { return String(); } -// These two are used in FileChooserWin.cpp. -#if PLATFORM(WIN) -String WebCore::uploadFileText() { - return String(); -} -String WebCore::allFilesText() { - return String(); -} -#endif - // The following two functions are not declared in LocalizedStrings.h. // They are used by the menu for the HTML keygen tag. namespace WebCore { diff --git a/webkit/glue/webframe_impl.cc b/webkit/glue/webframe_impl.cc index ca8997e..7d7638a 100644 --- a/webkit/glue/webframe_impl.cc +++ b/webkit/glue/webframe_impl.cc @@ -851,7 +851,7 @@ bool WebFrameImpl::Find(const FindInPageRequest& request, #if defined(OS_WIN) // TODO(pinkerton): Fix Mac scrolling to be more like Win ScrollView if (selection_rect) { - gfx::Rect rect( + gfx::Rect rect = webkit_glue::FromIntRect( frame()->view()->convertToContainingWindow(active_selection_rect_)); rect.Offset(-frameview()->scrollOffset().width(), -frameview()->scrollOffset().height()); @@ -959,7 +959,7 @@ bool WebFrameImpl::FindNext(const FindInPageRequest& request, pos.move(-frameview()->scrollOffset().width(), -frameview()->scrollOffset().height()); ReportFindInPageSelection( - gfx::Rect(frame()->view()->convertToContainingWindow(pos)), + webkit_glue::FromIntRect(frame()->view()->convertToContainingWindow(pos)), active_tickmark_ + 1, request.request_id); #endif @@ -1170,7 +1170,7 @@ void WebFrameImpl::ScopeStringMatches(FindInPageRequest request, pos.move(-frameview()->scrollOffset().width(), -frameview()->scrollOffset().height()); ReportFindInPageSelection( - gfx::Rect(frame()->view()->convertToContainingWindow(pos)), + webkit_glue::FromIntRect(frame()->view()->convertToContainingWindow(pos)), active_tickmark_ + 1, request.request_id); #endif @@ -1834,7 +1834,7 @@ void WebFrameImpl::GetPageRect(int page, gfx::Rect* page_size) const { NOTREACHED(); return; } - *page_size = pages_[page]; + *page_size = webkit_glue::FromIntRect(pages_[page]); } bool WebFrameImpl::SpoolPage(int page, diff --git a/webkit/glue/webplugin_impl.cc b/webkit/glue/webplugin_impl.cc index 4c25943..d164167 100644 --- a/webkit/glue/webplugin_impl.cc +++ b/webkit/glue/webplugin_impl.cc @@ -7,6 +7,7 @@ #include "base/compiler_specific.h" MSVC_PUSH_WARNING_LEVEL(0); +#include "Cursor.h" #include "Document.h" #include "Element.h" #include "Event.h" @@ -26,6 +27,7 @@ MSVC_PUSH_WARNING_LEVEL(0); #include "KeyboardEvent.h" #include "MouseEvent.h" #include "Page.h" +#include "PlatformContextSkia.h" #include "PlatformMouseEvent.h" #include "PlatformString.h" #include "ResourceHandle.h" @@ -52,7 +54,6 @@ MSVC_POP_WARNING(); #include "webkit/glue/stacking_order_iterator.h" #include "webkit/glue/webview_impl.h" #include "googleurl/src/gurl.h" -#include "webkit/port/platform/Cursor.h" // This class handles invididual multipart responses. It is instantiated when // we receive HTTP status code 206 in the HTTP response. This indicates @@ -518,7 +519,7 @@ void WebPluginImpl::Invalidate() { void WebPluginImpl::InvalidateRect(const gfx::Rect& rect) { if (widget_) - widget_->invalidateRect(WebCore::IntRect(rect.ToRECT())); + widget_->invalidateRect(webkit_glue::ToIntRect(rect)); } WebCore::IntRect WebPluginImpl::windowClipRect() const { @@ -615,8 +616,8 @@ void WebPluginImpl::setFrameGeometry(const WebCore::IntRect& rect) { // so that all the HWNDs are moved together. WebPluginGeometry move; move.window = window_; - move.window_rect = gfx::Rect(window_rect); - move.clip_rect = gfx::Rect(clip_rect); + move.window_rect = webkit_glue::FromIntRect(window_rect); + move.clip_rect = webkit_glue::FromIntRect(clip_rect); move.cutout_rects = cutout_rects; move.visible = visible_; @@ -624,7 +625,8 @@ void WebPluginImpl::setFrameGeometry(const WebCore::IntRect& rect) { } delegate_->UpdateGeometry( - gfx::Rect(window_rect), gfx::Rect(clip_rect), cutout_rects, + webkit_glue::FromIntRect(window_rect), + webkit_glue::FromIntRect(clip_rect), cutout_rects, received_first_paint_notification_? visible_ : false); // delegate_ can go away as a result of above call, so check it first. @@ -664,7 +666,8 @@ void WebPluginImpl::paint(WebCore::GraphicsContext* gc, CalculateBounds(widget_->frameGeometry(), &window_rect, &clip_rect, &cutout_rects); - delegate_->UpdateGeometry(gfx::Rect(window_rect), gfx::Rect(clip_rect), + delegate_->UpdateGeometry(webkit_glue::FromIntRect(window_rect), + webkit_glue::FromIntRect(clip_rect), cutout_rects, visible_); delegate_->FlushGeometryUpdates(); } @@ -682,15 +685,15 @@ void WebPluginImpl::paint(WebCore::GraphicsContext* gc, static_cast<float>(origin.y())); // HDC is only used when in windowless mode. - HDC hdc = gc->getWindowsContext(damage_rect); // Is this the right rect? + HDC hdc = gc->platformContext()->canvas()->beginPlatformPaint(); WebCore::IntRect window_rect = WebCore::IntRect(view->contentsToWindow(damage_rect.location()), damage_rect.size()); - delegate_->Paint(hdc, gfx::Rect(window_rect)); + delegate_->Paint(hdc, webkit_glue::FromIntRect(window_rect)); - gc->releaseWindowsContext(hdc, damage_rect); + gc->platformContext()->canvas()->endPlatformPaint(); gc->restore(); } @@ -702,11 +705,9 @@ void WebPluginImpl::print(WebCore::GraphicsContext* gc) { return; gc->save(); - // Our implementation of getWindowsContext doesn't care about any of the - // parameters, so just pass some random ones in. - HDC hdc = gc->getWindowsContext(WebCore::IntRect(), true, true); + HDC hdc = gc->platformContext()->canvas()->beginPlatformPaint(); delegate_->Print(hdc); - gc->releaseWindowsContext(hdc, WebCore::IntRect(), true, true); + gc->platformContext()->canvas()->endPlatformPaint(); gc->restore(); } @@ -821,7 +822,7 @@ void WebPluginImpl::handleMouseEvent(WebCore::MouseEvent* event) { // A windowless plugin can change the cursor in response to the WM_MOUSEMOVE // event. We need to reflect the changed cursor in the frame view as the // the mouse is moved in the boundaries of the windowless plugin. - parent()->setCursor(current_web_cursor); + parent()->setCursor(WebCore::PlatformCursor(current_web_cursor)); } void WebPluginImpl::handleKeyboardEvent(WebCore::KeyboardEvent* event) { @@ -1062,7 +1063,7 @@ void WebPluginImpl::CalculateBounds(const WebCore::IntRect& frame_rect, widget_->windowCutoutRects(&rects); // Convert to gfx::Rect and subtract out the plugin position. for (size_t i = 0; i < rects.size(); i++) { - gfx::Rect r(rects[i]); + gfx::Rect r = webkit_glue::FromIntRect(rects[i]); r.Offset(-frame_rect.x(), -frame_rect.y()); cutout_rects->push_back(r); } diff --git a/webkit/glue/webview_impl.cc b/webkit/glue/webview_impl.cc index e7affee..d4b7e23 100644 --- a/webkit/glue/webview_impl.cc +++ b/webkit/glue/webview_impl.cc @@ -401,7 +401,7 @@ bool WebViewImpl::SendContextMenuEvent(const WebKeyboardEvent& event) { if (!view) return false; - POINT coords = {-1, -1}; + IntPoint coords(-1, -1); int right_aligned = ::GetSystemMetrics(SM_MENUDROPALIGNMENT); IntPoint location; @@ -444,8 +444,8 @@ bool WebViewImpl::SendContextMenuEvent(const WebKeyboardEvent& event) { focused_frame->view()->setCursor(pointerCursor()); WebMouseEvent mouse_event; mouse_event.button = WebMouseEvent::BUTTON_RIGHT; - mouse_event.x = coords.x; - mouse_event.y = coords.y; + mouse_event.x = coords.x(); + mouse_event.y = coords.y(); mouse_event.type = WebInputEvent::MOUSE_UP; MakePlatformMouseEvent platform_event(view, mouse_event); |