diff options
43 files changed, 430 insertions, 1177 deletions
@@ -12,7 +12,7 @@ deps = { "http://googletest.googlecode.com/svn/trunk@63", "src/third_party/WebKit": - "/trunk/deps/third_party/WebKit@3571", + "/trunk/deps/third_party/WebKit@3586", "src/third_party/cygwin": "/trunk/deps/third_party/cygwin@3248", diff --git a/webkit/build/JavaScriptCore/WTF.vcproj b/webkit/build/JavaScriptCore/WTF.vcproj index a5eacfe..0dc5ef0 100644 --- a/webkit/build/JavaScriptCore/WTF.vcproj +++ b/webkit/build/JavaScriptCore/WTF.vcproj @@ -138,6 +138,14 @@ > </File> <File + RelativePath="..\..\..\third_party\WebKit\JavaScriptCore\wtf\unicode\Collator.h" + > + </File> + <File + RelativePath="..\..\..\third_party\WebKit\JavaScriptCore\wtf\unicode\icu\CollatorICU.cpp" + > + </File> + <File RelativePath="..\..\..\third_party\WebKit\JavaScriptCore\wtf\Deque.h" > </File> @@ -294,18 +302,10 @@ > </File> <File - RelativePath="..\..\..\third_party\WebKit\JavaScriptCore\wtf\unicode\Collator.h" - > - </File> - <File RelativePath="..\..\..\third_party\WebKit\JavaScriptCore\wtf\unicode\Unicode.h" > </File> <File - RelativePath="..\..\..\third_party\WebKit\JavaScriptCore\wtf\unicode\icu\CollatorICU.cpp" - > - </File> - <File RelativePath="..\..\..\third_party\WebKit\JavaScriptCore\wtf\unicode\icu\UnicodeIcu.h" > </File> @@ -329,10 +329,6 @@ RelativePath="..\..\..\third_party\WebKit\JavaScriptCore\wtf\VectorTraits.h" > </File> - <File - RelativePath="..\..\..\third_party\WebKit\JavaScriptCore\wtf\win\MainThreadWin.cpp" - > - </File> </Files> <Globals> </Globals> diff --git a/webkit/build/port/port.vcproj b/webkit/build/port/port.vcproj index 4e14bf8..a4e0856 100644 --- a/webkit/build/port/port.vcproj +++ b/webkit/build/port/port.vcproj @@ -183,10 +183,6 @@ <Filter Name="page" > - <File - RelativePath="..\..\port\page\AccessibilityObjectWrapperWin.h" - > - </File> <Filter Name="chromium" > @@ -731,18 +727,10 @@ > </File> <File - RelativePath="..\..\port\platform\win\KeyEventWin.cpp" - > - </File> - <File RelativePath="..\..\port\platform\win\PasteboardWin.cpp" > </File> <File - RelativePath="..\..\port\platform\win\PlatformMouseEventWin.cpp" - > - </File> - <File RelativePath="..\..\port\platform\win\ScreenWin.cpp" > </File> @@ -758,10 +746,6 @@ RelativePath="..\..\port\platform\win\WCDataObject.h" > </File> - <File - RelativePath="..\..\port\platform\win\WheelEventWin.cpp" - > - </File> </Filter> <Filter Name="chromium" @@ -807,6 +791,10 @@ > </File> <File + RelativePath="..\..\port\platform\chromium\PlatformKeyboardEventChromium.cpp" + > + </File> + <File RelativePath="..\..\port\platform\chromium\PlatformScrollBar.h" > </File> @@ -951,22 +939,10 @@ > </File> <File - RelativePath="..\..\port\platform\graphics\IntPointWin.cpp" - > - </File> - <File RelativePath="..\..\port\platform\graphics\IntRectSkia.cpp" > </File> <File - RelativePath="..\..\port\platform\graphics\IntRectWin.cpp" - > - </File> - <File - RelativePath="..\..\port\platform\graphics\IntSizeWin.cpp" - > - </File> - <File RelativePath="..\..\port\platform\graphics\NativeImageSkia.cpp" > </File> @@ -1062,6 +1038,14 @@ > </File> </Filter> + <Filter + Name="chromium" + > + <File + RelativePath="..\..\port\platform\graphics\chromium\PlatformIcon.h" + > + </File> + </Filter> </Filter> <Filter Name="image-decoders" diff --git a/webkit/build/webkit_common_includes.vsprops b/webkit/build/webkit_common_includes.vsprops index 2e676fc..c123e8b 100644 --- a/webkit/build/webkit_common_includes.vsprops +++ b/webkit/build/webkit_common_includes.vsprops @@ -6,6 +6,6 @@ > <Tool Name="VCCLCompilerTool" - AdditionalIncludeDirectories=""$(OutDir)\obj\WebCore";"$(OutDir)\obj\WebCore\JavaScriptHeaders";"$(OutDir)\obj\WebCore\JavaScriptHeaders\JavaScriptCore";..\..\pending\;..\..\pending\kjs;..\..\pending\wtf;..\..\port\bridge;..\..\port\css;..\..\port\dom;..\..\port\history;..\..\port\loader;..\..\port\page;..\..\port\page\chromium;..\..\port\page\win;..\..\port\platform;..\..\port\platform\chromium;..\..\port\platform\win;..\..\port\platform\network\chromium;..\..\port\platform\image-decoders;..\..\port\platform\image-decoders\bmp;..\..\port\platform\image-decoders\gif;..\..\port\platform\image-decoders\ico;..\..\port\platform\image-decoders\jpeg;..\..\port\platform\image-decoders\png;..\..\port\platform\image-decoders\xbm;..\..\port\platform\network;..\..\port\plugins;..\..\port\rendering;..\..\;"$(ProjectDir)";..\..\..\third_party\WebKit\WebCore\;..\..\..\third_party\WebKit\WebCore\bridge;..\..\..\third_party\WebKit\WebCore\css;..\..\..\third_party\WebKit\WebCore\dom;..\..\..\third_party\WebKit\WebCore\editing;..\..\..\third_party\WebKit\WebCore\history;..\..\..\third_party\WebKit\WebCore\html;..\..\..\third_party\WebKit\WebCore\loader;..\..\..\third_party\WebKit\WebCore\loader\appcache;..\..\..\third_party\WebKit\WebCore\loader\archive;..\..\..\third_party\WebKit\WebCore\loader\icon;..\..\..\third_party\WebKit\WebCore\page;..\..\..\third_party\WebKit\WebCore\platform;..\..\..\third_party\WebKit\WebCore\page\animation;..\..\..\third_party\WebKit\WebCore\platform\text;..\..\..\third_party\WebKit\WebCore\platform\graphics;..\..\port\platform\graphics;..\..\..\third_party\WebKit\WebCore\svg\graphics;..\..\..\third_party\WebKit\WebCore\platform\network;..\..\..\third_party\WebKit\WebCore\platform\sql;..\..\..\third_party\WebKit\WebCore\rendering;..\..\..\third_party\WebKit\WebCore\rendering\style;..\..\..\third_party\WebKit\WebCore\storage;..\..\..\third_party\WebKit\WebCore\xml;..\..\..\third_party\WebKit\WebCore;"..\..\..\third_party\WebKit\WebCore\os-win32";..\..\..\third_party\WebKit\WebCore\wtf;..\..\..\third_party\WebKit\JavaScriptCore;..\..\..\third_party\WebKit\JavaScriptCore\wtf;"..\..\..\third_party\WebKit\JavaScriptCore\os-win32";..\..\build;"$(SDKIncludes)";"$(IntDir)\..\WebCore\DerivedSources";..\..\..\third_party\WebKit\WebCore\svg;..\..\..\third_party\WebKit\WebCore\svg\animation;..\..\..\third_party\WebKit\WebCore\svg\graphics\filters;..\..\..\third_party\WebKit\WebCore\plugins" + AdditionalIncludeDirectories=""$(OutDir)\obj\WebCore";"$(OutDir)\obj\WebCore\JavaScriptHeaders";"$(OutDir)\obj\WebCore\JavaScriptHeaders\JavaScriptCore";..\..\pending\;..\..\pending\kjs;..\..\pending\wtf;..\..\port\bridge;..\..\port\css;..\..\port\dom;..\..\port\history;..\..\port\loader;..\..\port\page;..\..\port\page\chromium;..\..\port\page\win;..\..\port\platform;..\..\port\platform\chromium;..\..\port\platform\win;..\..\port\platform\network\chromium;..\..\port\platform\image-decoders;..\..\port\platform\image-decoders\bmp;..\..\port\platform\image-decoders\gif;..\..\port\platform\image-decoders\ico;..\..\port\platform\image-decoders\jpeg;..\..\port\platform\image-decoders\png;..\..\port\platform\image-decoders\xbm;..\..\port\platform\network;..\..\port\plugins;..\..\port\rendering;..\..\;"$(ProjectDir)";..\..\..\third_party\WebKit\WebCore\;..\..\..\third_party\WebKit\WebCore\bridge;..\..\..\third_party\WebKit\WebCore\css;..\..\..\third_party\WebKit\WebCore\dom;..\..\..\third_party\WebKit\WebCore\editing;..\..\..\third_party\WebKit\WebCore\history;..\..\..\third_party\WebKit\WebCore\html;..\..\..\third_party\WebKit\WebCore\loader;..\..\..\third_party\WebKit\WebCore\loader\appcache;..\..\..\third_party\WebKit\WebCore\loader\archive;..\..\..\third_party\WebKit\WebCore\loader\icon;..\..\..\third_party\WebKit\WebCore\page;..\..\..\third_party\WebKit\WebCore\platform;..\..\..\third_party\WebKit\WebCore\page\animation;..\..\..\third_party\WebKit\WebCore\platform\text;..\..\..\third_party\WebKit\WebCore\platform\graphics;..\..\port\platform\graphics;..\..\port\platform\graphics\chromium;..\..\..\third_party\WebKit\WebCore\svg\graphics;..\..\..\third_party\WebKit\WebCore\platform\network;..\..\..\third_party\WebKit\WebCore\platform\sql;..\..\..\third_party\WebKit\WebCore\rendering;..\..\..\third_party\WebKit\WebCore\rendering\style;..\..\..\third_party\WebKit\WebCore\storage;..\..\..\third_party\WebKit\WebCore\xml;..\..\..\third_party\WebKit\WebCore;"..\..\..\third_party\WebKit\WebCore\os-win32";..\..\..\third_party\WebKit\WebCore\wtf;..\..\..\third_party\WebKit\JavaScriptCore;..\..\..\third_party\WebKit\JavaScriptCore\wtf;"..\..\..\third_party\WebKit\JavaScriptCore\os-win32";..\..\build;"$(SDKIncludes)";"$(IntDir)\..\WebCore\DerivedSources";..\..\..\third_party\WebKit\WebCore\svg;..\..\..\third_party\WebKit\WebCore\svg\animation;..\..\..\third_party\WebKit\WebCore\svg\graphics\filters;..\..\..\third_party\WebKit\WebCore\plugins" /> </VisualStudioPropertySheet> 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); diff --git a/webkit/pending/AccessibleBase.cpp b/webkit/pending/AccessibleBase.cpp index 73ca027..9f4c320 100644 --- a/webkit/pending/AccessibleBase.cpp +++ b/webkit/pending/AccessibleBase.cpp @@ -47,7 +47,6 @@ using namespace WebCore; AccessibleBase::AccessibleBase(AccessibilityObject* obj) : AccessibilityObjectWrapper(obj) - , m_refCount(0) { ASSERT_ARG(obj, obj); m_object->setWrapper(this); @@ -81,12 +80,15 @@ HRESULT STDMETHODCALLTYPE AccessibleBase::QueryInterface(REFIID riid, void** ppv return S_OK; } +ULONG STDMETHODCALLTYPE AccessibleBase::AddRef(void) +{ + ref(); + return 0; +} + ULONG STDMETHODCALLTYPE AccessibleBase::Release(void) { - ASSERT(m_refCount > 0); - if (--m_refCount) - return m_refCount; - delete this; + deref(); return 0; } diff --git a/webkit/pending/AccessibleBase.h b/webkit/pending/AccessibleBase.h index 908ed63..57f867b 100644 --- a/webkit/pending/AccessibleBase.h +++ b/webkit/pending/AccessibleBase.h @@ -27,7 +27,7 @@ #define AccessibleBase_h #include "AccessibilityObject.h" -#include "AccessibilityObjectWrapperWin.h" +#include "AccessibilityObjectWrapper.h" class AccessibleBase : public IAccessible, public WebCore::AccessibilityObjectWrapper { public: @@ -35,7 +35,7 @@ public: // IUnknown virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject); - virtual ULONG STDMETHODCALLTYPE AddRef(void) { return ++m_refCount; } + virtual ULONG STDMETHODCALLTYPE AddRef(void); virtual ULONG STDMETHODCALLTYPE Release(void); // IAccessible @@ -101,8 +101,6 @@ protected: static AccessibleBase* wrapper(WebCore::AccessibilityObject*); - int m_refCount; - private: AccessibleBase() { } }; diff --git a/webkit/pending/NetworkStateNotifier.h b/webkit/pending/NetworkStateNotifier.h deleted file mode 100644 index 2c6d456..0000000 --- a/webkit/pending/NetworkStateNotifier.h +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (C) 2008 Apple 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: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. 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. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``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 APPLE INC. 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 NetworkStateNotifier_h -#define NetworkStateNotifier_h - -#if PLATFORM(MAC) -#include <wtf/RetainPtr.h> -#include "Timer.h" - -typedef const struct __CFArray * CFArrayRef; -typedef const struct __SCDynamicStore * SCDynamicStoreRef; -#endif - -#if PLATFORM(WIN) -#include <windows.h> -#endif - -namespace WebCore { - -class NetworkStateNotifier { -public: - NetworkStateNotifier(); - void setNetworkStateChangedFunction(void (*)()); - - bool onLine() const { return m_isOnLine; } - -private: - bool m_isOnLine; - void (*m_networkStateChangedFunction)(); - - void updateState(); - -#if PLATFORM(MAC) - void networkStateChangeTimerFired(Timer<NetworkStateNotifier>*); - - static void dynamicStoreCallback(SCDynamicStoreRef, CFArrayRef changedKeys, void *info); - - RetainPtr<SCDynamicStoreRef> m_store; - Timer<NetworkStateNotifier> m_networkStateChangeTimer; - -#elif PLATFORM(WIN) - static void CALLBACK addrChangeCallback(void*, BOOLEAN timedOut); - static void callAddressChanged(void*); - void addressChanged(); - - void registerForAddressChange(); - HANDLE m_waitHandle; - OVERLAPPED m_overlapped; -#endif -}; - -#if !PLATFORM(MAC) && !PLATFORM(WIN) -inline NetworkStateNotifier::NetworkStateNotifier() - : m_isOnLine(true) -{ -} - -inline void updateState() { } - -#endif - -NetworkStateNotifier& networkStateNotifier(); - -}; - -#endif // NetworkStateNotifier_h diff --git a/webkit/pending/PlatformKeyboardEvent.h b/webkit/pending/PlatformKeyboardEvent.h deleted file mode 100644 index 7ba9690..0000000 --- a/webkit/pending/PlatformKeyboardEvent.h +++ /dev/null @@ -1,178 +0,0 @@ -/* - * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. All rights reserved. - * Copyright (C) 2008 Collabora, Ltd. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. 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. - * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``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 APPLE COMPUTER, INC. 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 PlatformKeyboardEvent_h -#define PlatformKeyboardEvent_h - -#include "PlatformString.h" -#include <wtf/Platform.h> - -#if PLATFORM(MAC) -#include <wtf/RetainPtr.h> -#ifdef __OBJC__ -@class NSEvent; -#else -class NSEvent; -#endif -#endif - -#if PLATFORM(WIN) -typedef struct HWND__ *HWND; -typedef unsigned WPARAM; -typedef long LPARAM; -#endif - -#if PLATFORM(GTK) -typedef struct _GdkEventKey GdkEventKey; -#endif - -#if PLATFORM(QT) -QT_BEGIN_NAMESPACE -class QKeyEvent; -QT_END_NAMESPACE -#endif - -#if PLATFORM(WX) -class wxKeyEvent; -#endif - -namespace WebCore { - - class PlatformKeyboardEvent { - public: - enum Type { - // KeyDown is sent by platforms such as Mac OS X, gtk and Qt, and has information about both physical pressed key, and its translation. - // For DOM processing, it needs to be disambiguated as RawKeyDown or Char event. - KeyDown, - - // KeyUp is sent by all platforms. - KeyUp, - - // These events are sent by platforms such as Windows and wxWidgets. RawKeyDown only has information about a physical key, and Char - // only has information about a character it was translated into. - RawKeyDown, - Char - }; - - enum ModifierKey { - AltKey = 1 << 0, - CtrlKey = 1 << 1, - MetaKey = 1 << 2, - ShiftKey = 1 << 3, - }; - - Type type() const { return m_type; } - void disambiguateKeyDownEvent(Type, bool backwardCompatibilityMode = false); // Only used on platforms that need it, i.e. those that generate KeyDown events. - - // Text as as generated by processing a virtual key code with a keyboard layout - // (in most cases, just a character code, but the layout can emit several - // characters in a single keypress event on some platforms). - // This may bear no resemblance to the ultimately inserted text if an input method - // processes the input. - // Will be null for KeyUp and RawKeyDown events. - String text() const { return m_text; } - - // Text that would have been generated by the keyboard if no modifiers were pressed - // (except for Shift); useful for shortcut (accelerator) key handling. - // Otherwise, same as text(). - String unmodifiedText() const { return m_unmodifiedText; } - - // Most compatible Windows virtual key code associated with the event. - // Zero for Char events. - int windowsVirtualKeyCode() const { return m_windowsVirtualKeyCode; } - void setWindowsVirtualKeyCode(int code) { m_windowsVirtualKeyCode = code; } - - String keyIdentifier() const { return m_keyIdentifier; } - bool isAutoRepeat() const { return m_autoRepeat; } - void setIsAutoRepeat(bool in) { m_autoRepeat = in; } - bool isKeypad() const { return m_isKeypad; } - bool shiftKey() const { return m_shiftKey; } - bool ctrlKey() const { return m_ctrlKey; } - bool altKey() const { return m_altKey; } - bool metaKey() const { return m_metaKey; } - unsigned modifiers() const { - return (altKey() ? AltKey : 0) - | (ctrlKey() ? CtrlKey : 0) - | (metaKey() ? MetaKey : 0) - | (shiftKey() ? ShiftKey : 0); - } - - static bool currentCapsLockState(); - -#if PLATFORM(MAC) - PlatformKeyboardEvent(NSEvent*); - NSEvent* macEvent() const { return m_macEvent.get(); } -#endif - -#if PLATFORM(WIN) - PlatformKeyboardEvent(HWND, WPARAM, LPARAM, Type, bool); - bool isSystemKey() const { return m_isSystemKey; } -#endif - -#if PLATFORM(GTK) - PlatformKeyboardEvent(GdkEventKey*); - GdkEventKey* gdkEventKey() const; -#endif - -#if PLATFORM(QT) - PlatformKeyboardEvent(QKeyEvent*); - QKeyEvent* qtEvent() const { return m_qtEvent; } -#endif - -#if PLATFORM(WX) - PlatformKeyboardEvent(wxKeyEvent&); -#endif - - private: - Type m_type; - String m_text; - String m_unmodifiedText; - String m_keyIdentifier; - bool m_autoRepeat; - int m_windowsVirtualKeyCode; - bool m_isKeypad; - bool m_shiftKey; - bool m_ctrlKey; - bool m_altKey; - bool m_metaKey; - -#if PLATFORM(MAC) - RetainPtr<NSEvent> m_macEvent; -#endif -#if PLATFORM(WIN) - bool m_isSystemKey; -#endif -#if PLATFORM(GTK) - GdkEventKey* m_gdkEventKey; -#endif -#if PLATFORM(QT) - QKeyEvent* m_qtEvent; -#endif - }; - -} // namespace WebCore - -#endif // PlatformKeyboardEvent_h diff --git a/webkit/port/page/AccessibilityObjectWrapperWin.h b/webkit/port/page/chromium/AccessibilityObjectWrapper.h index c6612795..12cd146 100644 --- a/webkit/port/page/AccessibilityObjectWrapperWin.h +++ b/webkit/port/page/chromium/AccessibilityObjectWrapper.h @@ -23,9 +23,8 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - -#ifndef AccessibilityObjectWrapperWin_h -#define AccessibilityObjectWrapperWin_h +#ifndef AccessibilityObjectWrapper_h +#define AccessibilityObjectWrapper_h #include <oleacc.h> @@ -33,19 +32,16 @@ namespace WebCore { class AccessibilityObject; - class AccessibilityObjectWrapper : public IUnknown { + class AccessibilityObjectWrapper : public RefCounted<AccessibilityObjectWrapper> { public: - // IUnknown - virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject) = 0; - virtual ULONG STDMETHODCALLTYPE AddRef(void) = 0; - virtual ULONG STDMETHODCALLTYPE Release(void) = 0; - + virtual ~AccessibilityObjectWrapper() {} virtual void detach() = 0; bool attached() const { return m_object; } AccessibilityObject* accessibilityObject() const { return m_object; } protected: - AccessibilityObjectWrapper(AccessibilityObject* obj) : m_object(obj) { } + AccessibilityObjectWrapper(AccessibilityObject* obj) + : RefCounted<AccessibilityObjectWrapper>(0), m_object(obj) { } AccessibilityObjectWrapper() : m_object(0) { } AccessibilityObject* m_object; @@ -53,4 +49,4 @@ namespace WebCore { } // namespace WebCore -#endif // AccessibilityObjectWrapperWin_h +#endif // AccessibilityObjectWrapper_h diff --git a/webkit/port/page/chromium/DragControllerChromium.cpp b/webkit/port/page/chromium/DragControllerChromium.cpp index ac73890..23ad070 100644 --- a/webkit/port/page/chromium/DragControllerChromium.cpp +++ b/webkit/port/page/chromium/DragControllerChromium.cpp @@ -30,7 +30,7 @@ #include "SelectionController.h" #include <wtf/RefPtr.h> -#if PLATFORM(WIN) +#if PLATFORM(WIN_OS) #include <windows.h> #endif @@ -56,7 +56,7 @@ DragOperation DragController::dragOperation(DragData* dragData) bool DragController::isCopyKeyDown() { // TODO(darin): This should not be OS specific. Delegate to the embedder // instead. -#if PLATFORM(WIN) +#if PLATFORM(WIN_OS) return ::GetAsyncKeyState(VK_CONTROL); #else return false; diff --git a/webkit/port/page/chromium/EventHandlerChromium.cpp b/webkit/port/page/chromium/EventHandlerChromium.cpp index fe95bad..ef4d732 100644 --- a/webkit/port/page/chromium/EventHandlerChromium.cpp +++ b/webkit/port/page/chromium/EventHandlerChromium.cpp @@ -26,6 +26,7 @@ #include "config.h" #include "EventHandler.h" +#include "Clipboard.h" #include "Cursor.h" #include "FloatPoint.h" #include "FocusController.h" @@ -42,7 +43,7 @@ #include "SelectionController.h" #include "NotImplemented.h" -#if PLATFORM(WIN) +#if PLATFORM(WIN_OS) #include "ClipboardWin.h" #include "WCDataObject.h" #endif @@ -139,7 +140,7 @@ bool EventHandler::eventActivatedView(const PlatformMouseEvent& event) const PassRefPtr<Clipboard> EventHandler::createDraggingClipboard() const { -#if PLATFORM(WIN) +#if PLATFORM(WIN_OS) COMPtr<WCDataObject> dataObject; WCDataObject::createInstance(&dataObject); return ClipboardWin::create(true, dataObject.get(), ClipboardWritable); diff --git a/webkit/port/platform/Cursor.h b/webkit/port/platform/Cursor.h deleted file mode 100644 index c976ea9..0000000 --- a/webkit/port/platform/Cursor.h +++ /dev/null @@ -1,136 +0,0 @@ -/* - * Copyright (C) 2004, 2006, 2008 Apple 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: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. 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. - * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``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 APPLE COMPUTER, INC. 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 Cursor_h -#define Cursor_h - -#include <wtf/Platform.h> - -#if PLATFORM(WIN) -#include "webkit/glue/webcursor.h" -typedef struct HICON__* HICON; -typedef HICON HCURSOR; -#include <wtf/PassRefPtr.h> -#include <wtf/RefCounted.h> -#include <wtf/RefPtr.h> -#elif PLATFORM(GTK) -#include <gdk/gdk.h> -#elif PLATFORM(QT) -#include <QCursor> -#endif - -#if PLATFORM(MAC) -#ifdef __OBJC__ -@class NSCursor; -#else -class NSCursor; -#endif -#endif - -#if PLATFORM(WX) -class wxCursor; -#endif - -namespace WebCore { - - class Image; - class IntPoint; - -#if PLATFORM(WIN) - typedef WebCursor PlatformCursor; -#elif PLATFORM(MAC) - typedef NSCursor* PlatformCursor; -#elif PLATFORM(GTK) - typedef GdkCursor* PlatformCursor; -#elif PLATFORM(QT) && !defined(QT_NO_CURSOR) - typedef QCursor PlatformCursor; -#elif PLATFORM(WX) - typedef wxCursor* PlatformCursor; -#else - typedef void* PlatformCursor; -#endif - - class Cursor { - public: - Cursor() - { } - - Cursor(Image*, const IntPoint& hotspot); - Cursor(const Cursor&); - ~Cursor(); - Cursor& operator=(const Cursor&); - - Cursor(PlatformCursor); - PlatformCursor impl() const { return m_impl; } - - private: - PlatformCursor m_impl; - }; - - const Cursor& pointerCursor(); - const Cursor& crossCursor(); - const Cursor& handCursor(); - const Cursor& moveCursor(); - const Cursor& iBeamCursor(); - const Cursor& waitCursor(); - const Cursor& helpCursor(); - const Cursor& eastResizeCursor(); - const Cursor& northResizeCursor(); - const Cursor& northEastResizeCursor(); - const Cursor& northWestResizeCursor(); - const Cursor& southResizeCursor(); - const Cursor& southEastResizeCursor(); - const Cursor& southWestResizeCursor(); - const Cursor& westResizeCursor(); - const Cursor& northSouthResizeCursor(); - const Cursor& eastWestResizeCursor(); - const Cursor& northEastSouthWestResizeCursor(); - const Cursor& northWestSouthEastResizeCursor(); - const Cursor& columnResizeCursor(); - const Cursor& rowResizeCursor(); - const Cursor& middlePanningCursor(); - const Cursor& eastPanningCursor(); - const Cursor& northPanningCursor(); - const Cursor& northEastPanningCursor(); - const Cursor& northWestPanningCursor(); - const Cursor& southPanningCursor(); - const Cursor& southEastPanningCursor(); - const Cursor& southWestPanningCursor(); - const Cursor& westPanningCursor(); - const Cursor& verticalTextCursor(); - const Cursor& cellCursor(); - const Cursor& contextMenuCursor(); - const Cursor& noDropCursor(); - const Cursor& notAllowedCursor(); - const Cursor& progressCursor(); - const Cursor& aliasCursor(); - const Cursor& zoomInCursor(); - const Cursor& zoomOutCursor(); - const Cursor& copyCursor(); - const Cursor& noneCursor(); - -} // namespace WebCore - -#endif // Cursor_h diff --git a/webkit/port/platform/UniscribeStateTextRun.cpp b/webkit/port/platform/UniscribeStateTextRun.cpp index ce5c30c..5a3c8f5 100644 --- a/webkit/port/platform/UniscribeStateTextRun.cpp +++ b/webkit/port/platform/UniscribeStateTextRun.cpp @@ -36,8 +36,8 @@ UniscribeStateTextRun::UniscribeStateTextRun(const WebCore::TextRun& run, const WebCore::Font& font) : UniscribeState(run.characters(), run.length(), run.rtl(), font.primaryFont()->platformData().hfont(), - font.primaryFont()->scriptCache(), - font.primaryFont()->scriptFontProperties()), + font.primaryFont()->platformData().scriptCache(), + font.primaryFont()->platformData().scriptFontProperties()), font_(&font), font_index_(0) { set_directional_override(run.directionalOverride()); @@ -112,8 +112,8 @@ bool UniscribeStateTextRun::NextWinFontData( font_data->fontDataForCharacter(' '); hfonts_->push_back(simple_font_data->platformData().hfont()); - script_caches_->push_back(simple_font_data->scriptCache()); - font_properties_->push_back(simple_font_data->scriptFontProperties()); + script_caches_->push_back(simple_font_data->platformData().scriptCache()); + font_properties_->push_back(simple_font_data->platformData().scriptFontProperties()); ascents_->push_back(simple_font_data->ascent()); } diff --git a/webkit/port/platform/chromium/DragDataChromium.cpp b/webkit/port/platform/chromium/DragDataChromium.cpp index cc53e09..9ac0d5f 100644 --- a/webkit/port/platform/chromium/DragDataChromium.cpp +++ b/webkit/port/platform/chromium/DragDataChromium.cpp @@ -29,7 +29,7 @@ #include "config.h" #include "DragData.h" -#if PLATFORM(WIN) +#if PLATFORM(WIN_OS) #include "ClipboardWin.h" #include "ClipboardUtilitiesWin.h" #include "WCDataObject.h" @@ -56,12 +56,6 @@ bool containsHTML(const WebDropData& drop_data) { || drop_data.text_html.length() > 0; } -// Our DragDataRef is actually a WebDropData* instead of a IDataObject*. -// Provide a helper method for converting back. -WebDropData* dropData(DragDataRef dragData) { - return reinterpret_cast<WebDropData*>(dragData); -} - } namespace WebCore { @@ -69,7 +63,7 @@ namespace WebCore { PassRefPtr<Clipboard> DragData::createClipboard(ClipboardAccessPolicy policy) const { // TODO(darin): Invent ClipboardChromium and use that instead. -#if PLATFORM(WIN) +#if PLATFORM(WIN_OS) WCDataObject* data; WCDataObject::createInstance(&data); RefPtr<ClipboardWin> clipboard = ClipboardWin::create(true, data, policy); @@ -85,43 +79,40 @@ PassRefPtr<Clipboard> DragData::createClipboard(ClipboardAccessPolicy policy) co bool DragData::containsURL() const { - return dropData(m_platformDragData)->url.is_valid(); + return m_platformDragData->url.is_valid(); } String DragData::asURL(String* title) const { - WebDropData* data = dropData(m_platformDragData); - if (!data->url.is_valid()) + if (!m_platformDragData->url.is_valid()) return String(); // |title| can be NULL if (title) - *title = webkit_glue::StdWStringToString(data->url_title); - return webkit_glue::StdStringToString(data->url.spec()); + *title = webkit_glue::StdWStringToString(m_platformDragData->url_title); + return webkit_glue::StdStringToString(m_platformDragData->url.spec()); } bool DragData::containsFiles() const { - return !dropData(m_platformDragData)->filenames.empty(); + return !m_platformDragData->filenames.empty(); } void DragData::asFilenames(Vector<String>& result) const { - WebDropData* data = dropData(m_platformDragData); - for (size_t i = 0; i < data->filenames.size(); ++i) { - result.append(webkit_glue::StdWStringToString(data->filenames[i])); - } + for (size_t i = 0; i < m_platformDragData->filenames.size(); ++i) + result.append(webkit_glue::StdWStringToString(m_platformDragData->filenames[i])); } bool DragData::containsPlainText() const { - return !dropData(m_platformDragData)->plain_text.empty(); + return !m_platformDragData->plain_text.empty(); } String DragData::asPlainText() const { - return webkit_glue::StdWStringToString(dropData( - m_platformDragData)->plain_text); + return webkit_glue::StdWStringToString( + m_platformDragData->plain_text); } bool DragData::containsColor() const @@ -135,15 +126,15 @@ bool DragData::canSmartReplace() const // This is allowed whenever the drag data contains a 'range' (ie., // ClipboardWin::writeRange is called). For example, dragging a link // should not result in a space being added. - WebDropData* data = dropData(m_platformDragData); - return !data->cf_html.empty() && !data->plain_text.empty() && - !data->url.is_valid(); + return !m_platformDragData->cf_html.empty() && + !m_platformDragData->plain_text.empty() && + !m_platformDragData->url.is_valid(); } bool DragData::containsCompatibleContent() const { return containsPlainText() || containsURL() - || ::containsHTML(*dropData(m_platformDragData)) + || ::containsHTML(*m_platformDragData) || containsColor(); } @@ -166,17 +157,16 @@ PassRefPtr<DocumentFragment> DragData::asFragment(Document* doc) const // if (PassRefPtr<DocumentFragment> fragment = fragmentFromFilenames(doc, m_platformDragData)) // return fragment; - WebDropData* data = dropData(m_platformDragData); - if (!data->cf_html.empty()) { + if (!m_platformDragData->cf_html.empty()) { RefPtr<DocumentFragment> fragment = fragmentFromCF_HTML(doc, - webkit_glue::StdWStringToString(data->cf_html)); + webkit_glue::StdWStringToString(m_platformDragData->cf_html)); return fragment; } - if (!data->text_html.empty()) { + if (!m_platformDragData->text_html.empty()) { String url; RefPtr<DocumentFragment> fragment = createFragmentFromMarkup(doc, - webkit_glue::StdWStringToString(data->text_html), url); + webkit_glue::StdWStringToString(m_platformDragData->text_html), url); return fragment; } diff --git a/webkit/port/platform/chromium/DragImageChromium.cpp b/webkit/port/platform/chromium/DragImageChromium.cpp index 5ec6b97..e74a204 100644 --- a/webkit/port/platform/chromium/DragImageChromium.cpp +++ b/webkit/port/platform/chromium/DragImageChromium.cpp @@ -30,7 +30,7 @@ #include "GraphicsContext.h" #include "Image.h" -#if PLATFORM(WIN) +#if PLATFORM(WIN_OS) #include <windows.h> #else #include "NotImplemented.h" @@ -43,7 +43,7 @@ IntSize dragImageSize(DragImageRef image) // TODO(darin): DragImageRef should be changed to be a cross-platform // container. However, it may still make sense for its contents to be // platform-dependent. -#if PLATFORM(WIN) +#if PLATFORM(WIN_OS) if (!image) return IntSize(); BITMAP b; @@ -56,7 +56,7 @@ IntSize dragImageSize(DragImageRef image) void deleteDragImage(DragImageRef image) { -#if PLATFORM(WIN) +#if PLATFORM(WIN_OS) if (image) ::DeleteObject(image); #else diff --git a/webkit/port/platform/win/PlatformMouseEventWin.cpp b/webkit/port/platform/chromium/PlatformKeyboardEventChromium.cpp index 33c5692..af67f0d 100644 --- a/webkit/port/platform/win/PlatformMouseEventWin.cpp +++ b/webkit/port/platform/chromium/PlatformKeyboardEventChromium.cpp @@ -23,17 +23,32 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "PlatformMouseEvent.h" +#include "config.h" +#include "PlatformKeyboardEvent.h" +#if PLATFORM(WIN_OS) #include <windows.h> +#else +#include "NotImplemented.h" +#endif namespace WebCore { -PlatformMouseEvent::PlatformMouseEvent(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam, bool activatedWebView) - : m_clickCount(0) - , m_activatedWebView(activatedWebView) +void PlatformKeyboardEvent::disambiguateKeyDownEvent(Type, bool) { - // All other code in here has moved to glue/event_conversion.cc + // No KeyDown events on Windows to disambiguate. + ASSERT_NOT_REACHED(); } -} // namespace WebCore +bool PlatformKeyboardEvent::currentCapsLockState() +{ +#if PLATFORM(WIN_OS) + // TODO(darin): does this even work inside the sandbox? + return GetKeyState(VK_CAPITAL) & 1; +#else + notImplemented(); + return false; +#endif +} + +} diff --git a/webkit/port/platform/chromium/PlatformScrollBarChromium.cpp b/webkit/port/platform/chromium/PlatformScrollBarChromium.cpp index ff75630..b0cc684 100644 --- a/webkit/port/platform/chromium/PlatformScrollBarChromium.cpp +++ b/webkit/port/platform/chromium/PlatformScrollBarChromium.cpp @@ -236,7 +236,7 @@ void PlatformScrollbar::paint(GraphicsContext* gc, const IntRect& damageRect) layout(); - HDC hdc = gc->getWindowsContext(damageRect); + HDC hdc = gc->platformContext()->canvas()->beginPlatformPaint(); const bool horz = orientation() == HorizontalScrollbar; const PlatformContextSkia* const skia = gc->platformContext(); const gfx::NativeTheme* const nativeTheme = skia->nativeTheme(); @@ -306,7 +306,7 @@ void PlatformScrollbar::paint(GraphicsContext* gc, const IntRect& damageRect) DFCS_SCROLLRIGHT : DFCS_SCROLLDOWN) | getClassicThemeState(Arrow2), &m_segmentRects[Arrow2]); - gc->releaseWindowsContext(hdc, damageRect); + gc->platformContext()->canvas()->endPlatformPaint(); gc->restore(); } diff --git a/webkit/port/platform/chromium/PopupMenuChromium.cpp b/webkit/port/platform/chromium/PopupMenuChromium.cpp index 1071d8c..31a07b7 100644 --- a/webkit/port/platform/chromium/PopupMenuChromium.cpp +++ b/webkit/port/platform/chromium/PopupMenuChromium.cpp @@ -76,7 +76,7 @@ class PopupListBox; // to the child listBox (with the appropriate transforms). class PopupContainer : public FramelessScrollView { public: - static HWND Create(PopupMenuClient* client); + static PassRefPtr<PopupContainer> create(PopupMenuClient* client); // FramelessScrollView virtual void paint(GraphicsContext* gc, const IntRect& rect); @@ -315,19 +315,10 @@ static PlatformWheelEvent constructRelativeWheelEvent(const PlatformWheelEvent& /////////////////////////////////////////////////////////////////////////////// // PopupContainer implementation -// Get a pointer to the PopupContainer instance for the m_popup HWND, since we -// can't augment the PopupMenu class (above the portability layer). We store the -// PopupContainer in the HWND member, which is fairly hacky. -static PopupContainer* popupWindow(HWND popup) -{ - return reinterpret_cast<PopupContainer*>(popup); -} - // static -HWND PopupContainer::Create(PopupMenuClient* client) +PassRefPtr<PopupContainer> PopupContainer::create(PopupMenuClient* client) { - PopupContainer* container = new PopupContainer(client); - return reinterpret_cast<HWND>(container); + return adoptRef(new PopupContainer(client)); } PopupContainer::PopupContainer(PopupMenuClient* client) @@ -1016,8 +1007,6 @@ bool PopupListBox::isPointInBounds(const IntPoint& point) PopupMenu::PopupMenu(PopupMenuClient* client) : m_popupClient(client) - , m_popup(0) - , m_wasClicked(false) { } @@ -1028,13 +1017,12 @@ PopupMenu::~PopupMenu() void PopupMenu::show(const IntRect& r, FrameView* v, int index) { - m_popup = PopupContainer::Create(client()); + p.m_popup = PopupContainer::create(client()); - PopupContainer* popup = popupWindow(m_popup); // The rect is the size of the select box. It's usually larger than we need. // subtract border size so that usually the container will be displayed // exactly the same width as the select box. - popup->listBox()->setBaseWidth(max(r.width() - kBorderSize * 2, 0)); + p.m_popup->listBox()->setBaseWidth(max(r.width() - kBorderSize * 2, 0)); updateFromElement(); @@ -1050,23 +1038,21 @@ void PopupMenu::show(const IntRect& r, FrameView* v, int index) location.move(0, r.height()); IntRect popupRect(location, r.size()); - popup->setFrameGeometry(popupRect); - popup->showPopup(v); + p.m_popup->setFrameGeometry(popupRect); + p.m_popup->showPopup(v); } void PopupMenu::hide() { - if (m_popup) { - PopupContainer* popup = popupWindow(m_popup); - popup->hidePopup(); - popup->deref(); - m_popup = 0; + if (p.m_popup) { + p.m_popup->hidePopup(); + p.m_popup = 0; } } void PopupMenu::updateFromElement() { - popupWindow(m_popup)->listBox()->updateFromElement(); + p.m_popup->listBox()->updateFromElement(); } bool PopupMenu::itemWritingDirectionIsNatural() @@ -1074,32 +1060,4 @@ bool PopupMenu::itemWritingDirectionIsNatural() return false; } -bool PopupMenu::up(unsigned lines) -{ - popupWindow(m_popup)->listBox()->adjustSelectedIndex(-static_cast<int>(lines)); - return true; -} - -bool PopupMenu::down(unsigned lines) -{ - popupWindow(m_popup)->listBox()->adjustSelectedIndex(static_cast<int>(lines)); - return true; -} - -int PopupMenu::focusedIndex() const -{ - return popupWindow(m_popup)->listBox()->selectedIndex(); -} - -void PopupMenu::valueChanged(Scrollbar*) -{ - // FIXME -} - -WebCore::IntRect PopupMenu::windowClipRect() const -{ - // FIXME - return WebCore::IntRect(); -} - } // namespace WebCore diff --git a/webkit/port/platform/chromium/ScrollViewChromium.cpp b/webkit/port/platform/chromium/ScrollViewChromium.cpp index 8ab2822..5a6957f 100644 --- a/webkit/port/platform/chromium/ScrollViewChromium.cpp +++ b/webkit/port/platform/chromium/ScrollViewChromium.cpp @@ -346,8 +346,7 @@ void ScrollView::ScrollViewPrivate::highlightMatches( vert_end -= PlatformScrollbar::horizontalScrollbarHeight() + 1; } - IntRect view_rect(IntPoint(), m_view->size()); - HDC hdc = context->getWindowsContext(view_rect); + HDC hdc = canvas->beginPlatformPaint(); // We create a memory DC, copy the bits we want to highlight to the DC and // then MERGE_COPY pieces of it back with a yellow brush selected (which @@ -400,7 +399,7 @@ void ScrollView::ScrollViewPrivate::highlightMatches( DeleteDC(mem_dc); - context->releaseWindowsContext(hdc, view_rect); + canvas->endPlatformPaint(); context->restore(); } diff --git a/webkit/port/platform/chromium/TemporaryLinkStubs.cpp b/webkit/port/platform/chromium/TemporaryLinkStubs.cpp index 34fb5f3..97ef053 100644 --- a/webkit/port/platform/chromium/TemporaryLinkStubs.cpp +++ b/webkit/port/platform/chromium/TemporaryLinkStubs.cpp @@ -50,3 +50,7 @@ PassRefPtr<SharedBuffer> SharedBuffer::createWithContentsOfFile(const String& fi notImplemented(); return 0; } + +namespace WTF { +void scheduleDispatchFunctionsOnMainThread() { notImplemented(); } +} diff --git a/webkit/port/platform/graphics/FontCacheWin.cpp b/webkit/port/platform/graphics/FontCacheWin.cpp index 0156ccb..c9c8238 100644 --- a/webkit/port/platform/graphics/FontCacheWin.cpp +++ b/webkit/port/platform/graphics/FontCacheWin.cpp @@ -36,6 +36,7 @@ #include <hash_map> #include <string> #include <windows.h> +#include <objidl.h> #include <mlang.h> #include "base/gfx/font_utils.h" @@ -336,11 +337,6 @@ static bool fontContainsCharacter(const FontPlatformData* font_data, return cmap->contains(character); } -IMLangFontLink2* FontCache::getFontLinkInterface() -{ - return webkit_glue::GetLangFontLink(); -} - // Given the desired base font, this will create a SimpleFontData for a specific // font that can be used to render the given range of characters. // Two methods are used : our own getFallbackFamily and Windows' font linking. @@ -438,7 +434,7 @@ const SimpleFontData* FontCache::getFontDataForCharacters(const Font& font, // IMLangFontLink can break up a string into regions that can be rendered // using one particular font. // See http://blogs.msdn.com/oldnewthing/archive/2004/07/16/185261.aspx - IMLangFontLink2* langFontLink = getFontLinkInterface(); + IMLangFontLink2* langFontLink = webkit_glue::GetLangFontLink(); if (!langFontLink) return 0; diff --git a/webkit/port/platform/graphics/FontPlatformData.h b/webkit/port/platform/graphics/FontPlatformData.h index 25938dc..77f85cd 100644 --- a/webkit/port/platform/graphics/FontPlatformData.h +++ b/webkit/port/platform/graphics/FontPlatformData.h @@ -27,6 +27,7 @@ #include "StringImpl.h" #include <wtf/PassRefPtr.h> #include <wtf/RefCounted.h> +#include <usp10.h> typedef struct HFONT__ *HFONT; @@ -42,21 +43,14 @@ public: // to this "Deleted" one. It expects the Deleted one to be differentiable // from the NULL one (created with the empty constructor), so we can't just // set everything to NULL. - FontPlatformData(WTF::HashTableDeletedValueType) - : m_font(hashTableDeletedFontValue()) - , m_size(-1) - , m_isMLangFont(false) - {} - - FontPlatformData() - : m_font(0) - , m_size(0) - , m_isMLangFont(false) - {} - + FontPlatformData(WTF::HashTableDeletedValueType); + FontPlatformData(); FontPlatformData(HFONT hfont, float size, bool isMLangFont); FontPlatformData(float size, bool bold, bool oblique); + FontPlatformData(const FontPlatformData& data); + + FontPlatformData& operator=(const FontPlatformData& data); bool isHashTableDeletedValue() const { return m_font == hashTableDeletedFontValue(); } @@ -64,7 +58,6 @@ public: HFONT hfont() const { return m_font ? m_font->hfont() : 0; } float size() const { return m_size; } - bool isMLangFont() const { return m_isMLangFont; } unsigned hash() const { @@ -76,15 +69,18 @@ public: return m_font == other.m_font && m_size == other.m_size; } + SCRIPT_FONTPROPERTIES* scriptFontProperties() const; + SCRIPT_CACHE* scriptCache() const { return &m_scriptCache; } + private: // We refcount the internal HFONT so that FontPlatformData can be // efficiently copied. WebKit depends on being able to copy it, and we // don't really want to re-create the HFONT. class RefCountedHFONT : public RefCounted<RefCountedHFONT> { public: - static PassRefPtr<RefCountedHFONT> create(HFONT hfont) + static PassRefPtr<RefCountedHFONT> create(HFONT hfont, bool isMLangFont) { - return adoptRef(new RefCountedHFONT(hfont)); + return adoptRef(new RefCountedHFONT(hfont, isMLangFont)); } ~RefCountedHFONT(); @@ -95,15 +91,22 @@ private: return StringImpl::computeHash(reinterpret_cast<const UChar*>(&m_hfont), sizeof(HFONT) / sizeof(UChar)); } + bool operator==(const RefCountedHFONT& other) const + { + return m_hfont == other.m_hfont; + } + private: // The create() function assumes there is already a refcount of one // so it can do adoptRef. - RefCountedHFONT(HFONT hfont) + RefCountedHFONT(HFONT hfont, bool isMLangFont) : m_hfont(hfont) + , m_isMLangFont(isMLangFont) { } HFONT m_hfont; + bool m_isMLangFont; }; static RefCountedHFONT* hashTableDeletedFontValue(); @@ -111,7 +114,8 @@ private: RefPtr<RefCountedHFONT> m_font; float m_size; // Point size of the font in pixels. - bool m_isMLangFont; + mutable SCRIPT_CACHE m_scriptCache; + mutable SCRIPT_FONTPROPERTIES* m_scriptFontProperties; }; } diff --git a/webkit/port/platform/graphics/FontPlatformDataWin.cpp b/webkit/port/platform/graphics/FontPlatformDataWin.cpp index 2aad126..b529484 100644 --- a/webkit/port/platform/graphics/FontPlatformDataWin.cpp +++ b/webkit/port/platform/graphics/FontPlatformDataWin.cpp @@ -22,44 +22,137 @@ */ #include "config.h" +#include "FontPlatformData.h" + #include <windows.h> +#include <objidl.h> +#include <mlang.h> -#include "FontPlatformData.h" +#undef LOG +#include "webkit/glue/webkit_glue.h" namespace WebCore { +FontPlatformData::FontPlatformData(WTF::HashTableDeletedValueType) + : m_font(hashTableDeletedFontValue()) + , m_size(-1) + , m_scriptCache(0) + , m_scriptFontProperties(0) +{ +} + +FontPlatformData::FontPlatformData() + : m_font(0) + , m_size(0) + , m_scriptCache(0) + , m_scriptFontProperties(0) +{ +} + FontPlatformData::FontPlatformData(HFONT font, float size, bool isMLangFont) - : m_font(RefCountedHFONT::create(font)) + : m_font(RefCountedHFONT::create(font, isMLangFont)) , m_size(size) - , m_isMLangFont(isMLangFont) + , m_scriptCache(0) + , m_scriptFontProperties(0) { } // TODO(jhaas): this ctor is needed for SVG fonts but doesn't seem // to do much FontPlatformData::FontPlatformData(float size, bool bold, bool oblique) - : m_size(size) - , m_font(0) + : m_font(0) + , m_size(size) + , m_scriptCache(0) + , m_scriptFontProperties(0) { } +FontPlatformData::FontPlatformData(const FontPlatformData& data) + : m_font(data.m_font) + , m_size(data.m_size) + , m_scriptCache(0) + , m_scriptFontProperties(0) +{ +} + +FontPlatformData& FontPlatformData::operator=(const FontPlatformData& data) +{ + if (this != &data) { + m_font = data.m_font; + m_size = data.m_size; + + // The following fields will get re-computed if necessary. + + ScriptFreeCache(&m_scriptCache); + m_scriptCache = 0; + + delete m_scriptFontProperties; + m_scriptFontProperties = 0; + } + return *this; +} FontPlatformData::~FontPlatformData() { + ScriptFreeCache(&m_scriptCache); + m_scriptCache = 0; + + delete m_scriptFontProperties; + m_scriptFontProperties = 0; } FontPlatformData::RefCountedHFONT::~RefCountedHFONT() { - if (m_hfont != reinterpret_cast<HFONT>(-1)) - DeleteObject(m_hfont); + if (m_hfont != reinterpret_cast<HFONT>(-1)) { + if (m_isMLangFont) { + IMLangFontLink2* langFontLink = webkit_glue::GetLangFontLink(); + if (langFontLink) + langFontLink->ReleaseFont(m_hfont); + } else { + DeleteObject(m_hfont); + } + } } FontPlatformData::RefCountedHFONT* FontPlatformData::hashTableDeletedFontValue() { static RefPtr<RefCountedHFONT> deletedValue = - RefCountedHFONT::create(reinterpret_cast<HFONT>(-1)); + RefCountedHFONT::create(reinterpret_cast<HFONT>(-1), false); return deletedValue.get(); } +SCRIPT_FONTPROPERTIES* FontPlatformData::scriptFontProperties() const +{ + if (!m_scriptFontProperties) { + m_scriptFontProperties = new SCRIPT_FONTPROPERTIES; + memset(m_scriptFontProperties, 0, sizeof(SCRIPT_FONTPROPERTIES)); + m_scriptFontProperties->cBytes = sizeof(SCRIPT_FONTPROPERTIES); + HRESULT result = ScriptGetFontProperties(0, scriptCache(), + m_scriptFontProperties); + if (result == E_PENDING) { + HDC dc = GetDC(0); + HGDIOBJ oldFont = SelectObject(dc, hfont()); + HRESULT hr = ScriptGetFontProperties(dc, scriptCache(), + m_scriptFontProperties); + if (S_OK != hr) { + if (webkit_glue::EnsureFontLoaded(hfont())) { + // Retry ScriptGetFontProperties. + // TODO(nsylvain): Handle gracefully the error if this call + // also fails. See bug 1136944. + hr = ScriptGetFontProperties(dc, scriptCache(), + m_scriptFontProperties); + if (S_OK != hr) { + ASSERT_NOT_REACHED(); + } + } + } + + SelectObject(dc, oldFont); + ReleaseDC(0, dc); + } + } + return m_scriptFontProperties; +} + } diff --git a/webkit/port/platform/graphics/GlyphPageTreeNodeWin.cpp b/webkit/port/platform/graphics/GlyphPageTreeNodeWin.cpp index de73a83..b7d2549 100644 --- a/webkit/port/platform/graphics/GlyphPageTreeNodeWin.cpp +++ b/webkit/port/platform/graphics/GlyphPageTreeNodeWin.cpp @@ -195,11 +195,11 @@ static bool FillNonBMPGlyphs(UChar* buffer, const SimpleFontData* fontData) { bool have_glyphs = false; - + UniscribeStateTextRun state(buffer, GlyphPage::size * 2, false, fontData->m_font.hfont(), - fontData->scriptCache(), - fontData->scriptFontProperties()); + fontData->m_font.scriptCache(), + fontData->m_font.scriptFontProperties()); state.set_inhibit_ligate(true); state.Init(); diff --git a/webkit/port/platform/graphics/GraphicsContextSkia.cpp b/webkit/port/platform/graphics/GraphicsContextSkia.cpp index 9beade1..ba9cdba 100644 --- a/webkit/port/platform/graphics/GraphicsContextSkia.cpp +++ b/webkit/port/platform/graphics/GraphicsContextSkia.cpp @@ -981,21 +981,6 @@ AffineTransform GraphicsContext::getCTM() const return m_data->canvas()->getTotalMatrix(); } -#if PLATFORM(WIN_OS) -HDC GraphicsContext::getWindowsContext(const IntRect&, bool supportAlphaBlend, bool mayCreateBitmap) -{ - if (paintingDisabled()) - return 0; - // No need to ever call endPlatformPaint() since it is a noop. - return m_data->canvas()->beginPlatformPaint(); -} - -void GraphicsContext::releaseWindowsContext(HDC hdc, const IntRect&, bool supportAlphaBlend, bool mayCreateBitmap) -{ - // noop, the DC will be lazily freed by the bitmap when no longer needed -} -#endif - static inline float square(float n) { return n * n; diff --git a/webkit/port/platform/graphics/IconWin.cpp b/webkit/port/platform/graphics/IconWin.cpp index 6c17a53..1856add 100644 --- a/webkit/port/platform/graphics/IconWin.cpp +++ b/webkit/port/platform/graphics/IconWin.cpp @@ -31,15 +31,15 @@ namespace WebCore { -Icon::Icon(HICON icon) - : m_hIcon(icon) +Icon::Icon(const PlatformIcon& icon) + : m_icon(icon) { } Icon::~Icon() { - if (m_hIcon) - DestroyIcon(m_hIcon); + if (m_icon) + DestroyIcon(m_icon); } PassRefPtr<Icon> Icon::newIconForFile(const String& filename) @@ -59,7 +59,7 @@ void Icon::paint(GraphicsContext* context, const IntRect& r) if (context->paintingDisabled()) return; - context->platformContext()->paintIcon(m_hIcon, r); + context->platformContext()->paintIcon(m_icon, r); } } // namespace WebCore diff --git a/webkit/port/platform/graphics/ImageSkia.cpp b/webkit/port/platform/graphics/ImageSkia.cpp index 0a5b7a2..cf82481 100644 --- a/webkit/port/platform/graphics/ImageSkia.cpp +++ b/webkit/port/platform/graphics/ImageSkia.cpp @@ -273,36 +273,6 @@ void BitmapImage::checkForSolidColor() { } -bool BitmapImage::getHBITMAP(HBITMAP bmp) -{ - NativeImageSkia* bm = nativeImageForCurrentFrame(); - if (!bm) - return false; - - // |bmp| is already allocated and sized correctly, we just need to draw - // into it. - BITMAPINFOHEADER hdr; - gfx::CreateBitmapHeader(bm->width(), bm->height(), &hdr); - SkAutoLockPixels bm_lock(*bm); - return SetDIBits(0, bmp, 0, bm->height(), bm->getPixels(), - reinterpret_cast<BITMAPINFO*>(&hdr), DIB_RGB_COLORS) == - bm->height(); -} - -bool BitmapImage::getHBITMAPOfSize(HBITMAP bmp, LPSIZE size) -{ - notImplemented(); - return false; -} - -void BitmapImage::drawFrameMatchingSourceSize(GraphicsContext*, - const FloatRect& dstRect, - const IntSize& srcSize, - CompositeOperator) -{ - notImplemented(); -} - void BitmapImage::draw(GraphicsContext* ctxt, const FloatRect& dstRect, const FloatRect& srcRect, CompositeOperator compositeOp) { diff --git a/webkit/port/platform/graphics/IntPointWin.cpp b/webkit/port/platform/graphics/IntPointWin.cpp deleted file mode 100644 index 91ffe02..0000000 --- a/webkit/port/platform/graphics/IntPointWin.cpp +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (C) 2006 Apple Computer, 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: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. 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. - * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``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 APPLE COMPUTER, INC. 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 "IntPoint.h" - -#include <windows.h> - -namespace WebCore { - -IntPoint::IntPoint(const POINT& p) - : m_x(p.x) - , m_y(p.y) -{ -} - -IntPoint::operator POINT() const -{ - POINT p = {m_x, m_y}; - return p; -} - -IntPoint::IntPoint(const POINTS& p) - : m_x(p.x) - , m_y(p.y) -{ -} - -IntPoint::operator POINTS() const -{ - POINTS p = {m_x, m_y}; - return p; -} - -} // namespace WebCore diff --git a/webkit/port/platform/graphics/IntRectWin.cpp b/webkit/port/platform/graphics/IntRectWin.cpp deleted file mode 100644 index a156039..0000000 --- a/webkit/port/platform/graphics/IntRectWin.cpp +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (C) 2006 Apple Computer, 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: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. 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. - * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``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 APPLE COMPUTER, INC. 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 "IntRect.h" - -#include <windows.h> - -namespace WebCore { - -IntRect::IntRect(const RECT& r) - : m_location(IntPoint(r.left, r.top)) - , m_size(IntSize(r.right-r.left, r.bottom-r.top)) -{ -} - -IntRect::operator RECT() const -{ - RECT rect = { x(), y(), right(), bottom() }; - return rect; -} - -} // namespace WebCore diff --git a/webkit/port/platform/graphics/IntSizeWin.cpp b/webkit/port/platform/graphics/IntSizeWin.cpp deleted file mode 100644 index b8156e5..0000000 --- a/webkit/port/platform/graphics/IntSizeWin.cpp +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (C) 2006 Apple Computer, 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: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. 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. - * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``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 APPLE COMPUTER, INC. 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 "IntSize.h" - -#include <windows.h> - -namespace WebCore { - -IntSize::IntSize(const SIZE& s) - : m_width(s.cx) - , m_height(s.cy) -{ -} - -IntSize::operator SIZE() const -{ - SIZE s = {m_width, m_height}; - return s; -} - -} // namespace WebCore diff --git a/webkit/port/platform/graphics/SimpleFontDataWin.cpp b/webkit/port/platform/graphics/SimpleFontDataWin.cpp index bbe1d3a..f35c08d 100644 --- a/webkit/port/platform/graphics/SimpleFontDataWin.cpp +++ b/webkit/port/platform/graphics/SimpleFontDataWin.cpp @@ -35,6 +35,7 @@ #include <wtf/MathExtras.h> #include <unicode/uchar.h> #include <unicode/unorm.h> +#include <objidl.h> #include <mlang.h> #include "webkit/glue/webkit_glue.h" @@ -51,8 +52,6 @@ void SimpleFontData::platformInit() HDC dc = GetDC(0); HGDIOBJ oldFont = SelectObject(dc, m_font.hfont()); - m_isSystemFont = false; - TEXTMETRIC tm = {0}; if (!GetTextMetrics(dc, &tm)) { if (webkit_glue::EnsureFontLoaded(m_font.hfont())) { @@ -88,36 +87,13 @@ void SimpleFontData::platformInit() SelectObject(dc, oldFont); ReleaseDC(0, dc); - - // Uniscribe will allocate this for us, and expects it to be initialized to - // NULL. - m_scriptCache = 0; - - // It's unclear why this variable is a pointer. - m_scriptFontProperties = 0; } void SimpleFontData::platformDestroy() { - if (m_font.isMLangFont()) { - // We have to release the font instead of just deleting it, since we - // didn't make it. - // - // TODO(brettw): bug 1072298: This should be removed when we remove - // IMLangFontLink2 support. I think this is incorrect, as it will delete - // the font out from under any other PlatformData structures that share - // the same internal refcounted objects. - IMLangFontLink2* langFontLink = FontCache::getFontLinkInterface(); - if (langFontLink) - langFontLink->ReleaseFont(m_font.hfont()); - } - // We don't hash this on Win32, so it's effectively owned by us. delete m_smallCapsFontData; m_smallCapsFontData = NULL; - - ScriptFreeCache(&m_scriptCache); - delete m_scriptFontProperties; } SimpleFontData* SimpleFontData::smallCapsFontData(const FontDescription& fontDescription) const @@ -142,7 +118,7 @@ bool SimpleFontData::containsCharacters(const UChar* characters, int length) con // FIXME: Microsoft documentation seems to imply that characters can be output using a given font and DC // merely by testing code page intersection. This seems suspect though. Can't a font only partially // cover a given code page? - IMLangFontLink2* langFontLink = FontCache::getFontLinkInterface(); + IMLangFontLink2* langFontLink = webkit_glue::GetLangFontLink(); if (!langFontLink) return false; @@ -216,37 +192,4 @@ float SimpleFontData::platformWidthForGlyph(Glyph glyph) const return static_cast<float>(width); } -SCRIPT_FONTPROPERTIES* SimpleFontData::scriptFontProperties() const -{ - if (!m_scriptFontProperties) { - m_scriptFontProperties = new SCRIPT_FONTPROPERTIES; - memset(m_scriptFontProperties, 0, sizeof(SCRIPT_FONTPROPERTIES)); - m_scriptFontProperties->cBytes = sizeof(SCRIPT_FONTPROPERTIES); - HRESULT result = ScriptGetFontProperties(0, scriptCache(), - m_scriptFontProperties); - if (result == E_PENDING) { - HDC dc = GetDC(0); - HGDIOBJ oldFont = SelectObject(dc, m_font.hfont()); - HRESULT hr = ScriptGetFontProperties(dc, scriptCache(), - m_scriptFontProperties); - if (S_OK != hr) { - if (webkit_glue::EnsureFontLoaded(m_font.hfont())) { - // Retry ScriptGetFontProperties. - // TODO(nsylvain): Handle gracefully the error if this call - // also fails. See bug 1136944. - hr = ScriptGetFontProperties(dc, scriptCache(), - m_scriptFontProperties); - if (S_OK != hr) { - ASSERT_NOT_REACHED(); - } - } - } - - SelectObject(dc, oldFont); - ReleaseDC(0, dc); - } - } - return m_scriptFontProperties; -} - } diff --git a/webkit/port/platform/network/chromium/NetworkStateNotifierChromium.cpp b/webkit/port/platform/network/chromium/NetworkStateNotifierChromium.cpp index db40b10..b7e8f08 100644 --- a/webkit/port/platform/network/chromium/NetworkStateNotifierChromium.cpp +++ b/webkit/port/platform/network/chromium/NetworkStateNotifierChromium.cpp @@ -36,24 +36,8 @@ void NetworkStateNotifier::updateState() {
}
-// TODO(darin): Kill this once we stop defining PLATFORM(WIN)
-#if PLATFORM(WIN)
-void NetworkStateNotifier::addressChanged()
-{
-}
-
-void NetworkStateNotifier::callAddressChanged(void* context)
-{
-}
-
-void CALLBACK NetworkStateNotifier::addrChangeCallback(void* context, BOOLEAN timedOut)
-{
-}
-
-void NetworkStateNotifier::registerForAddressChange()
-{
-}
-#elif PLATFORM(MAC)
+// TODO(darin): Kill this once we stop defining PLATFORM(MAC)
+#if PLATFORM(MAC)
void NetworkStateNotifier::networkStateChangeTimerFired(Timer<NetworkStateNotifier>*)
{
}
diff --git a/webkit/port/platform/win/KeyEventWin.cpp b/webkit/port/platform/win/KeyEventWin.cpp deleted file mode 100644 index 5650747..0000000 --- a/webkit/port/platform/win/KeyEventWin.cpp +++ /dev/null @@ -1,209 +0,0 @@ -/* - * Copyright (C) 2006, 2007 Apple 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: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. 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. - * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``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 APPLE COMPUTER, INC. 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 "PlatformKeyboardEvent.h" -#include <windows.h> - -namespace WebCore { - -static const unsigned short HIGH_BIT_MASK_SHORT = 0x8000; - -// FIXME: This is incomplete. We could change this to mirror -// more like what Firefox does, and generate these switch statements -// at build time. -static String keyIdentifierForWindowsKeyCode(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)); - } -} - -static bool isKeypadEvent(WPARAM code, LPARAM keyData, PlatformKeyboardEvent::Type type) -{ - if (type != PlatformKeyboardEvent::RawKeyDown && type != PlatformKeyboardEvent::KeyUp) - return false; - - switch (code) { - case VK_NUMLOCK: - case VK_NUMPAD0: - case VK_NUMPAD1: - case VK_NUMPAD2: - case VK_NUMPAD3: - case VK_NUMPAD4: - case VK_NUMPAD5: - case VK_NUMPAD6: - case VK_NUMPAD7: - case VK_NUMPAD8: - case VK_NUMPAD9: - case VK_MULTIPLY: - case VK_ADD: - case VK_SEPARATOR: - case VK_SUBTRACT: - case VK_DECIMAL: - case VK_DIVIDE: - return true; - case VK_RETURN: - return (keyData >> 16) & KF_EXTENDED; - case VK_INSERT: - case VK_DELETE: - case VK_PRIOR: - case VK_NEXT: - case VK_END: - case VK_HOME: - case VK_LEFT: - case VK_UP: - case VK_RIGHT: - case VK_DOWN: - return !((keyData >> 16) & KF_EXTENDED); - default: - return false; - } -} - -static inline String singleCharacterString(UChar c) { return String(&c, 1); } - -// When constructing a PlatformKeyboardEvent instance, WParam will be the -// keyCode, LParam will be characterData. -PlatformKeyboardEvent::PlatformKeyboardEvent(HWND, WPARAM code, LPARAM keyData, Type type, bool systemKey) - : m_type(type) - , m_text((type == Char || type == KeyDown) ? singleCharacterString(code) : String()) - , m_unmodifiedText((type == Char || type == KeyDown) ? singleCharacterString(code) : String()) - , m_keyIdentifier((type == Char) ? String() : keyIdentifierForWindowsKeyCode(code)) - , m_windowsVirtualKeyCode((type == RawKeyDown || type == KeyDown || type == KeyUp || type == Char) ? code : 0) - , m_isSystemKey(systemKey) - // All other members are initialized by glue/event_conversion.cc -{ -} - -void PlatformKeyboardEvent::disambiguateKeyDownEvent(Type, bool) -{ - // No KeyDown events on Windows to disambiguate. - ASSERT_NOT_REACHED(); -} - -bool PlatformKeyboardEvent::currentCapsLockState() -{ - return GetKeyState(VK_CAPITAL) & 1; -} - -} diff --git a/webkit/port/platform/win/ScreenWin.cpp b/webkit/port/platform/win/ScreenWin.cpp index 83f97cd..d69888a 100644 --- a/webkit/port/platform/win/ScreenWin.cpp +++ b/webkit/port/platform/win/ScreenWin.cpp @@ -37,6 +37,10 @@ namespace WebCore { +static FloatRect ToFloatRect(const RECT& rect) { + return FloatRect(rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top); +} + // Returns info for the default monitor if widget is NULL static MONITORINFOEX monitorInfoForWidget(Widget* widget) { @@ -78,13 +82,13 @@ bool screenIsMonochrome(Widget* widget) FloatRect screenRect(Widget* widget) { MONITORINFOEX monitorInfo = monitorInfoForWidget(widget); - return monitorInfo.rcMonitor; + return ToFloatRect(monitorInfo.rcMonitor); } FloatRect screenAvailableRect(Widget* widget) { MONITORINFOEX monitorInfo = monitorInfoForWidget(widget); - return monitorInfo.rcWork; + return ToFloatRect(monitorInfo.rcWork); } } // namespace WebCore diff --git a/webkit/port/platform/win/WheelEventWin.cpp b/webkit/port/platform/win/WheelEventWin.cpp deleted file mode 100644 index 22c2dce..0000000 --- a/webkit/port/platform/win/WheelEventWin.cpp +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (C) 2006, 2007 Apple 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: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. 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. - * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``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 APPLE COMPUTER, INC. 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 "PlatformWheelEvent.h" - -namespace WebCore { - -PlatformWheelEvent::PlatformWheelEvent(HWND hWnd, WPARAM wParam, LPARAM lParam, bool isHorizontal) - : m_isAccepted(false) - , m_isContinuous(false) - // All other members are initialized by glue/event_conversion.cc - // TODO(jackson): We should probably not ignore the isHorizontal parameter -{ -} - -} - |