diff options
Diffstat (limited to 'webkit')
-rw-r--r-- | webkit/SConscript.port | 2 | ||||
-rw-r--r-- | webkit/build/glue/glue.vcproj | 12 | ||||
-rw-r--r-- | webkit/build/port/port.vcproj | 12 | ||||
-rw-r--r-- | webkit/glue/SConscript | 6 | ||||
-rw-r--r-- | webkit/glue/chrome_client_impl.cc | 4 | ||||
-rw-r--r-- | webkit/glue/chromium_bridge_impl.cc | 46 | ||||
-rw-r--r-- | webkit/glue/webkit_glue.cc | 8 | ||||
-rw-r--r-- | webkit/glue/webkit_glue.h | 37 | ||||
-rw-r--r-- | webkit/glue/webkit_glue_win.cc | 30 | ||||
-rw-r--r-- | webkit/glue/webview_impl.cc | 4 | ||||
-rw-r--r-- | webkit/glue/webview_impl.h | 1 | ||||
-rw-r--r-- | webkit/glue/webwidget_impl.cc | 8 | ||||
-rw-r--r-- | webkit/glue/webwidget_impl.h | 1 | ||||
-rw-r--r-- | webkit/port/platform/Language.cpp | 48 | ||||
-rw-r--r-- | webkit/port/platform/chromium/ChromiumBridge.h | 51 | ||||
-rw-r--r-- | webkit/port/platform/chromium/PlatformScreenChromium.cpp | 63 | ||||
-rw-r--r-- | webkit/port/platform/win/PlatformScreenWin.cpp | 95 |
17 files changed, 240 insertions, 188 deletions
diff --git a/webkit/SConscript.port b/webkit/SConscript.port index ebe20dd..8443c3f 100644 --- a/webkit/SConscript.port +++ b/webkit/SConscript.port @@ -55,6 +55,7 @@ input_files = [ '$PORT_DIR/platform/chromium/Language.cpp', '$PORT_DIR/platform/chromium/MimeTypeRegistryChromium.cpp', '$PORT_DIR/platform/chromium/PlatformKeyboardEventChromium.cpp', + '$PORT_DIR/platform/chromium/PlatformScreenChromium.cpp', '$PORT_DIR/platform/chromium/PopupMenuChromium.cpp', '$PORT_DIR/platform/chromium/SearchPopupMenuChromium.cpp', '$PORT_DIR/platform/chromium/SharedTimerChromium.cpp', @@ -153,7 +154,6 @@ if env['PLATFORM'] == 'win32': '$PORT_DIR/platform/win/ClipboardWin.cpp', '$PORT_DIR/platform/win/EditorWin.cpp', '$PORT_DIR/platform/win/PasteboardWin.cpp', - '$PORT_DIR/platform/win/PlatformScreenWin.cpp', '$PORT_DIR/platform/win/SoundWin.cpp', '$PORT_DIR/platform/win/WCDataObject.cpp', '$PORT_DIR/platform/graphics/FontCacheWin.cpp', diff --git a/webkit/build/glue/glue.vcproj b/webkit/build/glue/glue.vcproj index 46e99cb..784de66 100644 --- a/webkit/build/glue/glue.vcproj +++ b/webkit/build/glue/glue.vcproj @@ -165,6 +165,10 @@ > </File> <File + RelativePath="..\..\glue\screen_info.h" + > + </File> + <File RelativePath="..\..\glue\webdatasource.h" > </File> @@ -285,6 +289,10 @@ > </File> <File + RelativePath="..\..\glue\chromium_bridge_impl.cc" + > + </File> + <File RelativePath="..\..\glue\context_menu_client_impl.cc" > </File> @@ -569,6 +577,10 @@ > </File> <File + RelativePath="..\..\glue\webkit_glue_win.cc" + > + </File> + <File RelativePath="..\..\glue\webplugin_impl.cc" > </File> diff --git a/webkit/build/port/port.vcproj b/webkit/build/port/port.vcproj index 17e2ba0..c91d3ba 100644 --- a/webkit/build/port/port.vcproj +++ b/webkit/build/port/port.vcproj @@ -719,10 +719,6 @@ > </File> <File - RelativePath="..\..\port\platform\win\PlatformScreenWin.cpp" - > - </File> - <File RelativePath="..\..\port\platform\win\SoundWin.cpp" > </File> @@ -739,6 +735,10 @@ Name="chromium" > <File + RelativePath="..\..\port\platform\chromium\ChromiumBridge.h" + > + </File> + <File RelativePath="..\..\port\platform\chromium\ContextMenuChromium.cpp" > </File> @@ -791,6 +791,10 @@ > </File> <File + RelativePath="..\..\port\platform\chromium\PlatformScreenChromium.cpp" + > + </File> + <File RelativePath="..\..\port\platform\chromium\PopupMenuChromium.cpp" > </File> diff --git a/webkit/glue/SConscript b/webkit/glue/SConscript index e8275ef..0edb2f2 100644 --- a/webkit/glue/SConscript +++ b/webkit/glue/SConscript @@ -23,6 +23,7 @@ input_files = [ 'autocomplete_input_listener.cc', 'cache_manager.cc', 'chrome_client_impl.cc', + 'chromium_bridge_impl.cc', 'context_menu_client_impl.cc', 'cpp_binding_example.cc', 'cpp_bound_class.cc', @@ -98,7 +99,10 @@ if env['PLATFORM'] == 'win32': ]) if env['PLATFORM'] == 'win32': - input_files.append('webinputevent_win.cc') + input_files.extend([ + 'webinputevent_win.cc', + 'webkit_glue_win.cc', + [) elif env['PLATFORM'] == 'posix': input_files.append('webinputevent_linux.cc') diff --git a/webkit/glue/chrome_client_impl.cc b/webkit/glue/chrome_client_impl.cc index 24cbb7c..b0eaf95 100644 --- a/webkit/glue/chrome_client_impl.cc +++ b/webkit/glue/chrome_client_impl.cc @@ -398,8 +398,8 @@ WebCore::IntRect ChromeClientImpl::windowToScreen( } PlatformWidget ChromeClientImpl::platformWindow() const { - // We have no native widget. - return NULL; + WebViewDelegate* d = webview_->delegate(); + return d ? d->GetContainingWindow(webview_) : NULL; } void ChromeClientImpl::mouseDidMoveOverElement( diff --git a/webkit/glue/chromium_bridge_impl.cc b/webkit/glue/chromium_bridge_impl.cc new file mode 100644 index 0000000..c936b30 --- /dev/null +++ b/webkit/glue/chromium_bridge_impl.cc @@ -0,0 +1,46 @@ +// Copyright (c) 2008 The Chromium Authors. All rights reserved. Use of this +// source code is governed by a BSD-style license that can be found in the +// LICENSE file. + +#include "config.h" +#include "ChromiumBridge.h" + +#include "HostWindow.h" +#include "PlatformWidget.h" +#include "ScrollView.h" +#include "Widget.h" + +#include "webkit/glue/glue_util.h" +#include "webkit/glue/webkit_glue.h" + +namespace WebCore { + +static PlatformWidget ToPlatform(Widget* widget) { + return widget ? widget->root()->hostWindow()->platformWindow() : 0; +} + +// Screen --------------------------------------------------------------------- + +int ChromiumBridge::screenDepth(Widget* widget) { + return webkit_glue::GetScreenInfo(ToPlatform(widget)).depth; +} + +int ChromiumBridge::screenDepthPerComponent(Widget* widget) { + return webkit_glue::GetScreenInfo(ToPlatform(widget)).depth_per_component; +} + +bool ChromiumBridge::screenIsMonochrome(Widget* widget) { + return webkit_glue::GetScreenInfo(ToPlatform(widget)).is_monochrome; +} + +IntRect ChromiumBridge::screenRect(Widget* widget) { + return webkit_glue::ToIntRect( + webkit_glue::GetScreenInfo(ToPlatform(widget)).rect); +} + +IntRect ChromiumBridge::screenAvailableRect(Widget* widget) { + return webkit_glue::ToIntRect( + webkit_glue::GetScreenInfo(ToPlatform(widget)).available_rect); +} + +} // namespace WebCore diff --git a/webkit/glue/webkit_glue.cc b/webkit/glue/webkit_glue.cc index 1c5d0fd..07b7057 100644 --- a/webkit/glue/webkit_glue.cc +++ b/webkit/glue/webkit_glue.cc @@ -75,14 +75,6 @@ bool IsLayoutTestMode() { } #if defined(OS_WIN) -MONITORINFOEX GetMonitorInfoForWindowHelper(HWND window) { - HMONITOR monitor = MonitorFromWindow(window, MONITOR_DEFAULTTOPRIMARY); - MONITORINFOEX monitorInfo; - monitorInfo.cbSize = sizeof(MONITORINFOEX); - GetMonitorInfo(monitor, &monitorInfo); - return monitorInfo; -} - IMLangFontLink2* GetLangFontLinkHelper() { // TODO(hbono): http://b/1072298 Experimentally disabled this code to // prevent registry leaks caused by this IMLangFontLink2 interface. diff --git a/webkit/glue/webkit_glue.h b/webkit/glue/webkit_glue.h index 71b1c68..b8b2156 100644 --- a/webkit/glue/webkit_glue.h +++ b/webkit/glue/webkit_glue.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef WEBKIT_GLUE_H__ -#define WEBKIT_GLUE_H__ +#ifndef WEBKIT_GLUE_WEBKIT_GLUE_H_ +#define WEBKIT_GLUE_WEBKIT_GLUE_H_ #include "base/basictypes.h" @@ -14,7 +14,9 @@ #include <string> #include <vector> +#include "base/gfx/native_widget_types.h" #include "base/string16.h" +#include "webkit/glue/screen_info.h" #include "webkit/glue/webplugin.h" // We do not include the header files for these interfaces since this header @@ -29,16 +31,15 @@ class GURL; struct _NPNetscapeFuncs; typedef _NPNetscapeFuncs NPNetscapeFuncs; -#ifdef _WIN32 +#if defined(OS_WIN) struct IMLangFontLink2; #endif +// TODO(darin): This file should not be dealing in WebCore types!! namespace WebCore { - class Document; class Frame; - -} // namespace WebCore +} class SkBitmap; @@ -69,12 +70,12 @@ bool IsLayoutTestMode(); // default way to do this operation. It can be called directly from // GetLangFontLink. IMLangFontLink2* GetLangFontLinkHelper(); - -// Returns the monitor information corresponding to the window. -// This is the default implementation. -MONITORINFOEX GetMonitorInfoForWindowHelper(HWND window); #endif +// Returns screen information corresponding to the given window. This is the +// default implementation. +ScreenInfo GetScreenInfoHelper(gfx::ViewHandle window); + // Returns the text of the document element. std::wstring DumpDocumentText(WebFrame* web_frame); @@ -151,7 +152,7 @@ bool GetMimeTypeFromFile(const std::wstring& file_path, std::string* mime_type); bool GetPreferredExtensionForMimeType(const std::string& mime_type, std::wstring* ext); -#ifdef _WIN32 +#if defined(OS_WIN) // Returns the com object pointer for the FontLink interface IMLangFontLink2* GetLangFontLink(); #endif @@ -186,7 +187,7 @@ std::string GetDataResource(int resource_id); // specified as BINDATA in the relevant .rc file. GlueBitmap GetBitmapResource(int resource_id); -#ifdef _WIN32 +#if defined(OS_WIN) // Loads and returns a cursor. HCURSOR LoadCursor(int cursor_id); #endif @@ -252,14 +253,14 @@ bool GetPlugins(bool refresh, std::vector<WebPluginInfo>* plugins); // false otherwise. bool IsPluginRunningInRendererProcess(); -#ifdef _WIN32 +#if defined(OS_WIN) // Asks the browser to load the font. bool EnsureFontLoaded(HFONT font); - -// Returns the monitor information corresponding to the window. -MONITORINFOEX GetMonitorInfoForWindow(HWND window); #endif +// Returns screen information corresponding to the given window. +ScreenInfo GetScreenInfo(gfx::ViewHandle window); + // Functions implemented by webkit_glue for WebKit ---------------------------- // Notifies the embedder that a form element value has changed. The document @@ -270,7 +271,7 @@ void NotifyFormStateChanged(const WebCore::Document* document); // Returns a bool indicating if the Null plugin should be enabled or not. bool IsDefaultPluginEnabled(); -#ifdef _WIN32 +#if defined(OS_WIN) // Downloads the file specified by the URL. On sucess a WM_COPYDATA message // will be sent to the caller_window. bool DownloadUrl(const std::string& url, HWND caller_window); @@ -296,4 +297,4 @@ bool ShouldForcefullyTerminatePluginProcess(); } // namespace webkit_glue -#endif // WEBKIT_GLUE_H__ +#endif // WEBKIT_GLUE_WEBKIT_GLUE_H_ diff --git a/webkit/glue/webkit_glue_win.cc b/webkit/glue/webkit_glue_win.cc new file mode 100644 index 0000000..107a569 --- /dev/null +++ b/webkit/glue/webkit_glue_win.cc @@ -0,0 +1,30 @@ +// Copyright (c) 2008 The Chromium Authors. All rights reserved. Use of this +// source code is governed by a BSD-style license that can be found in the +// LICENSE file. + +#include "webkit/glue/webkit_glue.h" + +namespace webkit_glue { + +ScreenInfo GetScreenInfoHelper(gfx::ViewHandle window) { + HMONITOR monitor = MonitorFromWindow(window, MONITOR_DEFAULTTOPRIMARY); + + MONITORINFOEX monitor_info; + monitor_info.cbSize = sizeof(MONITORINFOEX); + GetMonitorInfo(monitor, &monitor_info); + + DEVMODE dev_mode; + dev_mode.dmSize = sizeof(dev_mode); + dev_mode.dmDriverExtra = 0; + EnumDisplaySettings(monitor_info.szDevice, ENUM_CURRENT_SETTINGS, &dev_mode); + + ScreenInfo results; + results.depth = dev_mode.dmBitsPerPel; + results.depth_per_component = dev_mode.dmBitsPerPel / 3; // Assumes RGB + results.is_monochrome = dev_mode.dmColor == DMCOLOR_MONOCHROME; + results.rect = gfx::Rect(monitor_info.rcMonitor); + results.available_rect = gfx::Rect(monitor_info.rcWork); + return results; +} + +} // namespace webkit_glue diff --git a/webkit/glue/webview_impl.cc b/webkit/glue/webview_impl.cc index 7c5ecac..9816773 100644 --- a/webkit/glue/webview_impl.cc +++ b/webkit/glue/webview_impl.cc @@ -1377,10 +1377,6 @@ void WebViewImpl::ImageResourceDownloadDone(ImageResourceFetcher* fetcher, // TODO(darin): Figure out what to do with these methods. #if 0 -gfx::ViewHandle WebViewImpl::containingWindow() { - return delegate_ ? delegate_->GetContainingWindow(this) : NULL; -} - const SkBitmap* WebViewImpl::getPreloadedResourceBitmap(int resource_id) { if (!delegate_) return NULL; diff --git a/webkit/glue/webview_impl.h b/webkit/glue/webview_impl.h index e4ec4b4..96efd28 100644 --- a/webkit/glue/webview_impl.h +++ b/webkit/glue/webview_impl.h @@ -189,7 +189,6 @@ class WebViewImpl : public WebView, public WebCore::BackForwardListClient { // TODO(darin): Figure out what happens to these methods. #if 0 // WebCore::WidgetClientWin - virtual gfx::ViewHandle containingWindow(); virtual const SkBitmap* getPreloadedResourceBitmap(int resource_id); virtual void onScrollPositionChanged(WebCore::Widget* widget); virtual const WTF::Vector<RefPtr<WebCore::Range> >* getTickmarks( diff --git a/webkit/glue/webwidget_impl.cc b/webkit/glue/webwidget_impl.cc index c04bedb..fd04639 100644 --- a/webkit/glue/webwidget_impl.cc +++ b/webkit/glue/webwidget_impl.cc @@ -230,7 +230,9 @@ WebCore::IntRect WebWidgetImpl::windowToScreen( } PlatformWidget WebWidgetImpl::platformWindow() const { - return NULL; + if (!delegate_) + return NULL; + return delegate_->GetContainingWindow(const_cast<WebWidgetImpl*>(this)); } //----------------------------------------------------------------------------- @@ -250,10 +252,6 @@ void WebWidgetImpl::popupClosed(WebCore::FramelessScrollView* widget) { // TODO(darin): Figure out what happens to these methods. #if 0 -gfx::ViewHandle WebWidgetImpl::containingWindow() { - return delegate_ ? delegate_->GetContainingWindow(this) : NULL; -} - const SkBitmap* WebWidgetImpl::getPreloadedResourceBitmap(int resource_id) { return NULL; } diff --git a/webkit/glue/webwidget_impl.h b/webkit/glue/webwidget_impl.h index 288485f..1c8a9a2 100644 --- a/webkit/glue/webwidget_impl.h +++ b/webkit/glue/webwidget_impl.h @@ -89,7 +89,6 @@ class WebWidgetImpl : public WebWidget, // TODO(darin): Figure out what happens to these methods. #if 0 // WebCore::WidgetClientWin - virtual gfx::ViewHandle containingWindow(); virtual const SkBitmap* getPreloadedResourceBitmap(int resource_id); virtual void onScrollPositionChanged(WebCore::Widget* widget); virtual const WTF::Vector<RefPtr<WebCore::Range> >* getTickmarks( diff --git a/webkit/port/platform/Language.cpp b/webkit/port/platform/Language.cpp deleted file mode 100644 index b21f7d4..0000000 --- a/webkit/port/platform/Language.cpp +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (C) 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 "Language.h" - -#include "CString.h" -#include "PlatformString.h" -#include "webkit/glue/glue_util.h" -#include "webkit/glue/webkit_glue.h" - - -namespace WebCore { - -String defaultLanguage() -{ - static String computedDefaultLanguage; - if (!computedDefaultLanguage.isEmpty()) - return computedDefaultLanguage; - - computedDefaultLanguage = - webkit_glue::StdWStringToString(webkit_glue::GetWebKitLocale()); - return computedDefaultLanguage; -} - -} diff --git a/webkit/port/platform/chromium/ChromiumBridge.h b/webkit/port/platform/chromium/ChromiumBridge.h new file mode 100644 index 0000000..b7ff628 --- /dev/null +++ b/webkit/port/platform/chromium/ChromiumBridge.h @@ -0,0 +1,51 @@ +// Copyright (c) 2008, Google 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: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * 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. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "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 THE COPYRIGHT +// OWNER 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 ChromiumBridge_h +#define ChromiumBridge_h + +namespace WebCore { + class IntRect; + class Widget; + + // An interface to the embedding layer, which has the ability to answer + // questions about the system and so on... + + class ChromiumBridge { + public: + // Screen information ------------------------------------------------- + static int screenDepth(Widget*); + static int screenDepthPerComponent(Widget*); + static bool screenIsMonochrome(Widget*); + static IntRect screenRect(Widget*); + static IntRect screenAvailableRect(Widget*); + }; +} + +#endif diff --git a/webkit/port/platform/chromium/PlatformScreenChromium.cpp b/webkit/port/platform/chromium/PlatformScreenChromium.cpp new file mode 100644 index 0000000..ad9eeb9 --- /dev/null +++ b/webkit/port/platform/chromium/PlatformScreenChromium.cpp @@ -0,0 +1,63 @@ +// Copyright (c) 2008, Google 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: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * 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. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "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 THE COPYRIGHT +// OWNER 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 "PlatformScreen.h" + +#include "ChromiumBridge.h" +#include "IntRect.h" + +namespace WebCore { + +int screenDepth(Widget* widget) +{ + return ChromiumBridge::screenDepth(widget); +} + +int screenDepthPerComponent(Widget* widget) +{ + return ChromiumBridge::screenDepthPerComponent(widget); +} + +bool screenIsMonochrome(Widget* widget) +{ + return ChromiumBridge::screenIsMonochrome(widget); +} + +FloatRect screenRect(Widget* widget) +{ + return ChromiumBridge::screenRect(widget); +} + +FloatRect screenAvailableRect(Widget* widget) +{ + return ChromiumBridge::screenAvailableRect(widget); +} + +} // namespace WebCore diff --git a/webkit/port/platform/win/PlatformScreenWin.cpp b/webkit/port/platform/win/PlatformScreenWin.cpp deleted file mode 100644 index 1c529d8..0000000 --- a/webkit/port/platform/win/PlatformScreenWin.cpp +++ /dev/null @@ -1,95 +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 "PlatformScreen.h" - -#include "IntRect.h" -#include "FloatRect.h" -#include "Frame.h" -#include "FrameView.h" -#include "Page.h" -#include <windows.h> - -#include "webkit/glue/webkit_glue.h" - -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) -{ - // TODO(darin): We should not be dealing with native widgets here! - HWND window = widget ? widget->root()->hostWindow()->platformWindow() : 0; - return webkit_glue::GetMonitorInfoForWindow(window); -} - -static DEVMODE deviceInfoForWidget(Widget* widget) -{ - MONITORINFOEX monitorInfo = monitorInfoForWidget(widget); - - DEVMODE deviceInfo; - deviceInfo.dmSize = sizeof(DEVMODE); - deviceInfo.dmDriverExtra = 0; - EnumDisplaySettings(monitorInfo.szDevice, ENUM_CURRENT_SETTINGS, &deviceInfo); - - return deviceInfo; -} - -int screenDepth(Widget* widget) -{ - DEVMODE deviceInfo = deviceInfoForWidget(widget); - return deviceInfo.dmBitsPerPel; -} - -int screenDepthPerComponent(Widget* widget) -{ - // FIXME: Assumes RGB -- not sure if this is right. - DEVMODE deviceInfo = deviceInfoForWidget(widget); - return deviceInfo.dmBitsPerPel / 3; -} - -bool screenIsMonochrome(Widget* widget) -{ - DEVMODE deviceInfo = deviceInfoForWidget(widget); - return deviceInfo.dmColor == DMCOLOR_MONOCHROME; -} - -FloatRect screenRect(Widget* widget) -{ - MONITORINFOEX monitorInfo = monitorInfoForWidget(widget); - return ToFloatRect(monitorInfo.rcMonitor); -} - -FloatRect screenAvailableRect(Widget* widget) -{ - MONITORINFOEX monitorInfo = monitorInfoForWidget(widget); - return ToFloatRect(monitorInfo.rcWork); -} - -} // namespace WebCore |