diff options
31 files changed, 313 insertions, 230 deletions
diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc index 9cebf46..186d3bb 100644 --- a/chrome/renderer/render_view.cc +++ b/chrome/renderer/render_view.cc @@ -51,7 +51,9 @@ #include "skia/ext/image_operations.h" #include "third_party/WebKit/WebKit/chromium/public/WebDragData.h" #include "third_party/WebKit/WebKit/chromium/public/WebPoint.h" +#include "third_party/WebKit/WebKit/chromium/public/WebRect.h" #include "third_party/WebKit/WebKit/chromium/public/WebScriptSource.h" +#include "third_party/WebKit/WebKit/chromium/public/WebSize.h" #include "webkit/default_plugin/default_plugin_shared.h" #include "webkit/glue/dom_operations.h" #include "webkit/glue/dom_serializer.h" @@ -90,6 +92,7 @@ using base::TimeDelta; using webkit_glue::WebAccessibility; using WebKit::WebConsoleMessage; using WebKit::WebDragData; +using WebKit::WebRect; using WebKit::WebScriptSource; //----------------------------------------------------------------------------- @@ -762,7 +765,7 @@ bool RenderView::CaptureThumbnail(WebFrame* frame, } } - score->at_top = (frame->ScrollOffset().height() == 0); + score->at_top = (frame->ScrollOffset().height == 0); SkBitmap subset; device->accessBitmap(false).extractSubset(&subset, src_rect); @@ -2153,7 +2156,7 @@ void RenderView::OnFind(int request_id, // frame, so we check here if we only have main_frame in the chain. bool wrap_within_frame = !multi_frame; - gfx::Rect selection_rect; + WebRect selection_rect; bool result = false; do { @@ -2262,7 +2265,7 @@ void RenderView::ReportFindInPageMatchCount(int count, int request_id, routing_id_, request_id, count, - gfx::Rect(0, 0, 0, 0), + gfx::Rect(), -1, // Don't update active match ordinal. final_update); queued_find_reply_message_.reset(msg); @@ -2272,7 +2275,7 @@ void RenderView::ReportFindInPageMatchCount(int count, int request_id, routing_id_, request_id, count, - gfx::Rect(0, 0, 0, 0), + gfx::Rect(), -1, // // Don't update active match ordinal. final_update)); } @@ -2280,7 +2283,7 @@ void RenderView::ReportFindInPageMatchCount(int count, int request_id, void RenderView::ReportFindInPageSelection(int request_id, int active_match_ordinal, - const gfx::Rect& selection_rect) { + const WebRect& selection_rect) { // Send the search result over to the browser process. Send(new ViewHostMsg_Find_Reply(routing_id_, request_id, diff --git a/chrome/renderer/render_view.h b/chrome/renderer/render_view.h index 6dd2871..a587ecc 100644 --- a/chrome/renderer/render_view.h +++ b/chrome/renderer/render_view.h @@ -307,7 +307,7 @@ class RenderView : public RenderWidget, bool final_update); virtual void ReportFindInPageSelection(int request_id, int active_match_ordinal, - const gfx::Rect& selection_rect); + const WebKit::WebRect& selection); virtual bool WasOpenedByUserGesture(WebView* webview) const; virtual void SpellCheck(const std::wstring& word, int& misspell_location, int& misspell_length); diff --git a/chrome/renderer/render_widget.cc b/chrome/renderer/render_widget.cc index 81421d1..ba82739 100644 --- a/chrome/renderer/render_widget.cc +++ b/chrome/renderer/render_widget.cc @@ -14,7 +14,9 @@ #include "chrome/common/transport_dib.h" #include "chrome/renderer/render_process.h" #include "skia/ext/platform_canvas.h" +#include "third_party/WebKit/WebKit/chromium/public/WebRect.h" #include "third_party/WebKit/WebKit/chromium/public/WebScreenInfo.h" +#include "third_party/WebKit/WebKit/chromium/public/WebSize.h" #if defined(OS_POSIX) #include "skia/include/SkPixelRef.h" @@ -25,7 +27,9 @@ #include "webkit/glue/webwidget.h" using WebKit::WebInputEvent; +using WebKit::WebRect; using WebKit::WebScreenInfo; +using WebKit::WebSize; RenderWidget::RenderWidget(RenderThreadBase* render_thread, bool activatable) : routing_id_(MSG_ROUTING_NONE), @@ -454,13 +458,13 @@ gfx::NativeViewId RenderWidget::GetContainingView(WebWidget* webwidget) { } void RenderWidget::DidInvalidateRect(WebWidget* webwidget, - const gfx::Rect& rect) { + const WebRect& rect) { // We only want one pending DoDeferredPaint call at any time... bool paint_pending = !paint_rect_.IsEmpty(); // If this invalidate overlaps with a pending scroll, then we have to // downgrade to invalidating the scroll rect. - if (rect.Intersects(scroll_rect_)) { + if (gfx::Rect(rect).Intersects(scroll_rect_)) { paint_rect_ = paint_rect_.Union(scroll_rect_); scroll_rect_ = gfx::Rect(); } @@ -486,7 +490,7 @@ void RenderWidget::DidInvalidateRect(WebWidget* webwidget, } void RenderWidget::DidScrollRect(WebWidget* webwidget, int dx, int dy, - const gfx::Rect& clip_rect) { + const WebRect& clip_rect) { if (dx != 0 && dy != 0) { // We only support scrolling along one axis at a time. DidScrollRect(webwidget, 0, dy, clip_rect); @@ -498,7 +502,7 @@ void RenderWidget::DidScrollRect(WebWidget* webwidget, int dx, int dy, // If we already have a pending scroll operation or if this scroll operation // intersects the existing paint region, then just failover to invalidating. if (!scroll_rect_.IsEmpty() || intersects_with_painting) { - if (!intersects_with_painting && scroll_rect_ == clip_rect) { + if (!intersects_with_painting && scroll_rect_ == gfx::Rect(clip_rect)) { // OK, we can just update the scroll delta (requires same scrolling axis) if (!dx && !scroll_delta_.x()) { scroll_delta_.set_y(scroll_delta_.y() + dy); @@ -561,7 +565,7 @@ void RenderWidget::Show(WebWidget* webwidget, } void RenderWidget::ShowWithItems(WebWidget* webwidget, - const gfx::Rect& bounds, + const WebRect& bounds, int item_height, int selected_index, const std::vector<MenuItem>& items) { @@ -598,11 +602,13 @@ void RenderWidget::Close() { } } -void RenderWidget::GetWindowRect(WebWidget* webwidget, gfx::Rect* rect) { - Send(new ViewHostMsg_GetWindowRect(routing_id_, host_window_, rect)); +void RenderWidget::GetWindowRect(WebWidget* webwidget, WebRect* result) { + gfx::Rect rect; + Send(new ViewHostMsg_GetWindowRect(routing_id_, host_window_, &rect)); + *result = rect; } -void RenderWidget::SetWindowRect(WebWidget* webwidget, const gfx::Rect& pos) { +void RenderWidget::SetWindowRect(WebWidget* webwidget, const WebRect& pos) { if (did_show_) { Send(new ViewHostMsg_RequestMove(routing_id_, pos)); } else { @@ -610,12 +616,14 @@ void RenderWidget::SetWindowRect(WebWidget* webwidget, const gfx::Rect& pos) { } } -void RenderWidget::GetRootWindowRect(WebWidget* webwidget, gfx::Rect* rect) { - Send(new ViewHostMsg_GetRootWindowRect(routing_id_, host_window_, rect)); +void RenderWidget::GetRootWindowRect(WebWidget* webwidget, WebRect* result) { + gfx::Rect rect; + Send(new ViewHostMsg_GetRootWindowRect(routing_id_, host_window_, &rect)); + *result = rect; } void RenderWidget::GetRootWindowResizerRect(WebWidget* webwidget, - gfx::Rect* rect) { + WebRect* rect) { *rect = resizer_rect_; } @@ -694,7 +702,7 @@ void RenderWidget::UpdateIME() { // Retrieve the caret position from the focused widget and verify we should // enabled IMEs attached to the browser process. bool enable_ime = false; - gfx::Rect caret_rect; + WebRect caret_rect; if (!webwidget_ || !webwidget_->ImeUpdateStatus(&enable_ime, &caret_rect)) { // There are not any editable widgets attached to this process. @@ -740,8 +748,8 @@ void RenderWidget::UpdateIME() { // The input focus is not changed. // Notify the caret position to a browser process only if it is changed. if (ime_control_enable_ime_) { - if (caret_rect.x() != ime_control_x_ || - caret_rect.y() != ime_control_y_) { + if (caret_rect.x != ime_control_x_ || + caret_rect.y != ime_control_y_) { Send(new ViewHostMsg_ImeUpdateStatus(routing_id(), IME_MOVE_WINDOWS, caret_rect)); } @@ -750,8 +758,8 @@ void RenderWidget::UpdateIME() { // Save the updated IME status to prevent from sending the same IPC messages. ime_control_updated_ = false; ime_control_enable_ime_ = ime_control_new_state_; - ime_control_x_ = caret_rect.x(); - ime_control_y_ = caret_rect.y(); + ime_control_x_ = caret_rect.x; + ime_control_y_ = caret_rect.y; } void RenderWidget::DidMove(WebWidget* webwidget, diff --git a/chrome/renderer/render_widget.h b/chrome/renderer/render_widget.h index 84eb9b2..32c2405 100644 --- a/chrome/renderer/render_widget.h +++ b/chrome/renderer/render_widget.h @@ -65,23 +65,26 @@ class RenderWidget : public IPC::Channel::Listener, // WebWidgetDelegate virtual gfx::NativeViewId GetContainingView(WebWidget* webwidget); - virtual void DidInvalidateRect(WebWidget* webwidget, const gfx::Rect& rect); + virtual void DidInvalidateRect(WebWidget* webwidget, + const WebKit::WebRect& rect); virtual void DidScrollRect(WebWidget* webwidget, int dx, int dy, - const gfx::Rect& clip_rect); + const WebKit::WebRect& clip_rect); virtual void SetCursor(WebWidget* webwidget, const WebCursor& cursor); virtual void Show(WebWidget* webwidget, WindowOpenDisposition disposition); virtual void ShowWithItems(WebWidget* webwidget, - const gfx::Rect& bounds, + const WebKit::WebRect& bounds, int item_height, int selected_index, const std::vector<MenuItem>& items); virtual void CloseWidgetSoon(WebWidget* webwidget); virtual void Focus(WebWidget* webwidget); virtual void Blur(WebWidget* webwidget); - virtual void GetWindowRect(WebWidget* webwidget, gfx::Rect* rect); - virtual void SetWindowRect(WebWidget* webwidget, const gfx::Rect& rect); - virtual void GetRootWindowRect(WebWidget* webwidget, gfx::Rect* rect); - virtual void GetRootWindowResizerRect(WebWidget* webwidget, gfx::Rect* rect); + virtual void GetWindowRect(WebWidget* webwidget, WebKit::WebRect* rect); + virtual void SetWindowRect(WebWidget* webwidget, + const WebKit::WebRect& rect); + virtual void GetRootWindowRect(WebWidget* webwidget, WebKit::WebRect* rect); + virtual void GetRootWindowResizerRect(WebWidget* webwidget, + WebKit::WebRect* rect); virtual void DidMove(WebWidget* webwidget, const WebPluginGeometry& move); virtual void RunModal(WebWidget* webwidget) {} virtual bool IsHidden(WebWidget* webwidget) { return is_hidden_; } diff --git a/chrome/renderer/webmediaplayer_delegate_impl.cc b/chrome/renderer/webmediaplayer_delegate_impl.cc index 6c30e25..5a0f1c2 100644 --- a/chrome/renderer/webmediaplayer_delegate_impl.cc +++ b/chrome/renderer/webmediaplayer_delegate_impl.cc @@ -2,11 +2,12 @@ // source code is governed by a BSD-style license that can be found in the // LICENSE file. +#include "chrome/renderer/webmediaplayer_delegate_impl.h" + #include "chrome/renderer/media/audio_renderer_impl.h" #include "chrome/renderer/media/data_source_impl.h" #include "chrome/renderer/media/video_renderer_impl.h" #include "chrome/renderer/render_view.h" -#include "chrome/renderer/webmediaplayer_delegate_impl.h" #include "googleurl/src/gurl.h" #if defined(OS_WIN) // FFmpeg is not ready for Linux and Mac yet. @@ -14,6 +15,11 @@ #include "media/filters/ffmpeg_demuxer.h" #include "media/filters/ffmpeg_video_decoder.h" #endif +#include "third_party/WebKit/WebKit/chromium/public/WebRect.h" +#include "third_party/WebKit/WebKit/chromium/public/WebSize.h" + +using WebKit::WebRect; +using WebKit::WebSize; ///////////////////////////////////////////////////////////////////////////// // Task to be posted on main thread that fire WebMediaPlayer methods. @@ -270,17 +276,17 @@ int64 WebMediaPlayerDelegateImpl::GetTotalBytes() const { return pipeline_.GetTotalBytes(); } -void WebMediaPlayerDelegateImpl::SetSize(const gfx::Size& size) { +void WebMediaPlayerDelegateImpl::SetSize(const WebSize& size) { DCHECK(main_loop_ && MessageLoop::current() == main_loop_); if (video_renderer_) { // TODO(scherkus): Change API to use SetSize(). - video_renderer_->SetRect(gfx::Rect(0, 0, size.width(), size.height())); + video_renderer_->SetRect(gfx::Rect(0, 0, size.width, size.height)); } } void WebMediaPlayerDelegateImpl::Paint(skia::PlatformCanvas *canvas, - const gfx::Rect& rect) { + const WebRect& rect) { if (video_renderer_) { video_renderer_->Paint(canvas, rect); } diff --git a/chrome/renderer/webmediaplayer_delegate_impl.h b/chrome/renderer/webmediaplayer_delegate_impl.h index 1f0c726..fc976bf 100644 --- a/chrome/renderer/webmediaplayer_delegate_impl.h +++ b/chrome/renderer/webmediaplayer_delegate_impl.h @@ -89,9 +89,10 @@ class WebMediaPlayerDelegateImpl : public webkit_glue::WebMediaPlayerDelegate, virtual bool IsTotalBytesKnown(); // Methods for painting. - virtual void SetSize(const gfx::Size& size); + virtual void SetSize(const WebKit::WebSize& size); - virtual void Paint(skia::PlatformCanvas *canvas, const gfx::Rect& rect); + virtual void Paint(skia::PlatformCanvas *canvas, + const WebKit::WebRect& rect); // True if a video is loaded. virtual bool IsVideo() const; diff --git a/webkit/glue/chrome_client_impl.cc b/webkit/glue/chrome_client_impl.cc index bfa6db4..aebc29b 100644 --- a/webkit/glue/chrome_client_impl.cc +++ b/webkit/glue/chrome_client_impl.cc @@ -43,6 +43,7 @@ MSVC_POP_WARNING(); using WebKit::WebInputEvent; using WebKit::WebMouseEvent; +using WebKit::WebRect; // Callback class that's given to the WebViewDelegate during a file choose // operation. @@ -100,26 +101,20 @@ void ChromeClientImpl::setWindowRect(const WebCore::FloatRect& r) { } WebCore::FloatRect ChromeClientImpl::windowRect() { + WebRect rect; if (webview_->delegate()) { - gfx::Rect rect; webview_->delegate()->GetRootWindowRect(webview_, &rect); - return WebCore::FloatRect( - static_cast<float>(rect.x()), - static_cast<float>(rect.y()), - static_cast<float>(rect.width()), - static_cast<float>(rect.height())); } else { // These numbers will be fairly wrong. The window's x/y coordinates will // be the top left corner of the screen and the size will be the content // size instead of the window size. - gfx::Point origin; - const gfx::Size size = webview_->size(); - return WebCore::FloatRect( - static_cast<float>(origin.x()), - static_cast<float>(origin.y()), - static_cast<float>(size.width()), - static_cast<float>(size.height())); + rect.width = webview_->size().width; + rect.height = webview_->size().height; } + return WebCore::FloatRect(static_cast<float>(rect.x), + static_cast<float>(rect.y), + static_cast<float>(rect.width), + static_cast<float>(rect.height)); } WebCore::FloatRect ChromeClientImpl::pageRect() { @@ -393,16 +388,13 @@ bool ChromeClientImpl::tabsToLinks() const { } WebCore::IntRect ChromeClientImpl::windowResizerRect() const { - WebCore::IntRect rv; + WebCore::IntRect result; if (webview_->delegate()) { - gfx::Rect resizer_rect; + WebRect resizer_rect; webview_->delegate()->GetRootWindowResizerRect(webview_, &resizer_rect); - rv = WebCore::IntRect(resizer_rect.x(), - resizer_rect.y(), - resizer_rect.width(), - resizer_rect.height()); + result = webkit_glue::WebRectToIntRect(resizer_rect); } - return rv; + return result; } void ChromeClientImpl::repaint( @@ -413,7 +405,8 @@ void ChromeClientImpl::repaint( return; WebViewDelegate* delegate = webview_->delegate(); if (delegate) - delegate->DidInvalidateRect(webview_, webkit_glue::FromIntRect(paint_rect)); + delegate->DidInvalidateRect(webview_, + webkit_glue::IntRectToWebRect(paint_rect)); } void ChromeClientImpl::scroll( @@ -424,7 +417,7 @@ void ChromeClientImpl::scroll( int dx = scroll_delta.width(); int dy = scroll_delta.height(); delegate->DidScrollRect(webview_, dx, dy, - webkit_glue::FromIntRect(clip_rect)); + webkit_glue::IntRectToWebRect(clip_rect)); } } @@ -440,9 +433,9 @@ WebCore::IntRect ChromeClientImpl::windowToScreen( WebViewDelegate* delegate = webview_->delegate(); if (delegate) { - gfx::Rect window_rect; + WebRect window_rect; delegate->GetWindowRect(webview_, &window_rect); - screen_rect.move(window_rect.x(), window_rect.y()); + screen_rect.move(window_rect.x, window_rect.y); } return screen_rect; @@ -521,7 +514,7 @@ void ChromeClientImpl::popupOpened(WebCore::FramelessScrollView* popup_view, WebWidgetImpl* webwidget = static_cast<WebWidgetImpl*>(delegate->CreatePopupWidget(webview_, activatable)); - webwidget->Init(popup_view, webkit_glue::FromIntRect(bounds)); + webwidget->Init(popup_view, webkit_glue::IntRectToWebRect(bounds)); } } @@ -566,7 +559,7 @@ void ChromeClientImpl::popupOpenedWithItems( } webwidget->InitWithItems(popup_view, - webkit_glue::FromIntRect(bounds), + webkit_glue::IntRectToWebRect(bounds), item_height, selected_index, popup_items); diff --git a/webkit/glue/glue_util.cc b/webkit/glue/glue_util.cc index da506ce..1ab7b16 100644 --- a/webkit/glue/glue_util.cc +++ b/webkit/glue/glue_util.cc @@ -31,6 +31,8 @@ #include "googleurl/src/gurl.h" #include "third_party/WebKit/WebKit/chromium/public/WebDragData.h" #include "third_party/WebKit/WebKit/chromium/public/WebPoint.h" +#include "third_party/WebKit/WebKit/chromium/public/WebRect.h" +#include "third_party/WebKit/WebKit/chromium/public/WebSize.h" #include "third_party/WebKit/WebKit/chromium/public/WebString.h" #include "third_party/WebKit/WebKit/chromium/public/WebURL.h" @@ -180,6 +182,26 @@ WebKit::WebPoint IntPointToWebPoint(const WebCore::IntPoint& point) { return point; } +// Rect conversions ------------------------------------------------------------ + +WebCore::IntRect WebRectToIntRect(const WebKit::WebRect& rect) { + return rect; +} + +WebKit::WebRect IntRectToWebRect(const WebCore::IntRect& rect) { + return rect; +} + +// Size conversions ------------------------------------------------------------ + +WebCore::IntSize WebSizeToIntSize(const WebKit::WebSize& size) { + return size; +} + +WebKit::WebSize IntSizeToWebSize(const WebCore::IntSize& size) { + return size; +} + // DragData conversions -------------------------------------------------------- WebKit::WebDragData ChromiumDataObjectToWebDragData( diff --git a/webkit/glue/glue_util.h b/webkit/glue/glue_util.h index 8f02767..46cc74a 100644 --- a/webkit/glue/glue_util.h +++ b/webkit/glue/glue_util.h @@ -15,6 +15,7 @@ class ChromiumDataObject; class CString; class IntPoint; class IntRect; +class IntSize; class KURL; class String; } @@ -25,6 +26,8 @@ class WebDragData; class WebString; class WebURL; struct WebPoint; +struct WebRect; +struct WebSize; } namespace WTF { @@ -85,6 +88,14 @@ WebCore::IntRect ToIntRect(const gfx::Rect& r); WebCore::IntPoint WebPointToIntPoint(const WebKit::WebPoint&); WebKit::WebPoint IntPointToWebPoint(const WebCore::IntPoint&); +// WebRect <-> IntRect +WebCore::IntRect WebRectToIntRect(const WebKit::WebRect&); +WebKit::WebRect IntRectToWebRect(const WebCore::IntRect&); + +// WebSize <-> IntSize +WebCore::IntSize WebSizeToIntSize(const WebKit::WebSize&); +WebKit::WebSize IntSizeToWebSize(const WebCore::IntSize&); + // WebDragData <-> ChromiumDataObject WebKit::WebDragData ChromiumDataObjectToWebDragData( const WTF::PassRefPtr<WebCore::ChromiumDataObject>&); diff --git a/webkit/glue/inspector_client_impl.cc b/webkit/glue/inspector_client_impl.cc index 704d9e7..d2130dd 100644 --- a/webkit/glue/inspector_client_impl.cc +++ b/webkit/glue/inspector_client_impl.cc @@ -17,6 +17,7 @@ MSVC_POP_WARNING(); #undef LOG #include "base/logging.h" #include "base/gfx/rect.h" +#include "third_party/WebKit/WebKit/chromium/public/WebRect.h" #include "webkit/glue/inspector_client_impl.h" #include "webkit/glue/webkit_glue.h" #include "webkit/glue/weburlrequest.h" @@ -26,6 +27,9 @@ MSVC_POP_WARNING(); using namespace WebCore; +using WebKit::WebRect; +using WebKit::WebSize; + static const float kDefaultInspectorXPos = 10; static const float kDefaultInspectorYPos = 50; static const float kDefaultInspectorHeight = 640; @@ -139,8 +143,8 @@ static void invalidateNodeBoundingRect(WebViewImpl* web_view) { // TODO(ojan): http://b/1143996 Is it important to just invalidate the rect // of the node region given that this is not on a critical codepath? // In order to do so, we'd have to take scrolling into account. - gfx::Size size = web_view->size(); - gfx::Rect damaged_rect(0, 0, size.width(), size.height()); + const WebSize& size = web_view->size(); + WebRect damaged_rect(0, 0, size.width, size.height); web_view->GetDelegate()->DidInvalidateRect(web_view, damaged_rect); } diff --git a/webkit/glue/media_player_private_impl.cc b/webkit/glue/media_player_private_impl.cc index 963f5b4..3e24819 100644 --- a/webkit/glue/media_player_private_impl.cc +++ b/webkit/glue/media_player_private_impl.cc @@ -15,6 +15,8 @@ #include "base/gfx/rect.h" #include "googleurl/src/gurl.h" +#include "third_party/WebKit/WebKit/chromium/public/WebRect.h" +#include "third_party/WebKit/WebKit/chromium/public/WebSize.h" #include "webkit/glue/glue_util.h" #include "webkit/glue/webframe.h" #include "webkit/glue/webkit_glue.h" @@ -259,14 +261,14 @@ void MediaPlayerPrivate::setVisible(bool visible) { void MediaPlayerPrivate::setSize(const IntSize& size) { if (m_data) { - AsDelegate(m_data)->SetSize(gfx::Size(size.width(), size.height())); + AsDelegate(m_data)->SetSize(webkit_glue::IntSizeToWebSize(size)); } } void MediaPlayerPrivate::paint(GraphicsContext* p, const IntRect& r) { if (m_data) { - gfx::Rect rect(r.x(), r.y(), r.width(), r.height()); - AsDelegate(m_data)->Paint(p->platformContext()->canvas(), rect); + AsDelegate(m_data)->Paint(p->platformContext()->canvas(), + webkit_glue::IntRectToWebRect(r)); } } diff --git a/webkit/glue/webframe.h b/webkit/glue/webframe.h index 9c36c95..97559b6 100644 --- a/webkit/glue/webframe.h +++ b/webkit/glue/webframe.h @@ -19,15 +19,12 @@ class WebView; class WebTextInput; struct NPObject; -namespace gfx { -class Rect; -class Size; -} - namespace WebKit { struct WebConsoleMessage; struct WebFindOptions; +struct WebRect; struct WebScriptSource; +struct WebSize; } // Every frame in a web page is represented by one WebFrame, including the @@ -223,7 +220,7 @@ class WebFrame { const string16& search_text, const WebKit::WebFindOptions& options, bool wrap_within_frame, - gfx::Rect* selection_rect) = 0; + WebKit::WebRect* selection_rect) = 0; // Notifies the frame that we are no longer interested in searching. This will // abort any asynchronous scoping effort already under way (see the function @@ -259,7 +256,7 @@ class WebFrame { // Notifies the webview-delegate about a new selection rect. This will result // in the browser getting notified. For more information see WebViewDelegate. - virtual void ReportFindInPageSelection(const gfx::Rect& selection_rect, + virtual void ReportFindInPageSelection(const WebKit::WebRect& selection_rect, int active_match_ordinal, int request_id) = 0; @@ -364,7 +361,7 @@ class WebFrame { virtual void ClosePage() = 0; // The current scroll offset from the top of frame in pixels. - virtual gfx::Size ScrollOffset() const = 0; + virtual WebKit::WebSize ScrollOffset() const = 0; // Reformats the web frame for printing. |page_size_px| is the page size in // pixels. @@ -372,7 +369,7 @@ class WebFrame { // |page_count| is the number of printed pages. // Returns false if it fails. It'll fail if the main frame failed to load but // will succeed even if a child frame failed to load. - virtual bool BeginPrint(const gfx::Size& page_size_px, + virtual bool BeginPrint(const WebKit::WebSize& page_size_px, int* page_count) = 0; // Prints one page. |page| is 0-based. diff --git a/webkit/glue/webframe_impl.cc b/webkit/glue/webframe_impl.cc index ceca109..a1e5416 100644 --- a/webkit/glue/webframe_impl.cc +++ b/webkit/glue/webframe_impl.cc @@ -137,7 +137,9 @@ MSVC_POP_WARNING(); #include "skia/ext/platform_canvas.h" #include "third_party/WebKit/WebKit/chromium/public/WebConsoleMessage.h" #include "third_party/WebKit/WebKit/chromium/public/WebFindOptions.h" +#include "third_party/WebKit/WebKit/chromium/public/WebRect.h" #include "third_party/WebKit/WebKit/chromium/public/WebScriptSource.h" +#include "third_party/WebKit/WebKit/chromium/public/WebSize.h" #include "webkit/glue/alt_error_page_resource_fetcher.h" #include "webkit/glue/dom_operations.h" #include "webkit/glue/dom_operations_private.h" @@ -199,7 +201,9 @@ using WebCore::XPathResult; using WebKit::WebConsoleMessage; using WebKit::WebFindOptions; +using WebKit::WebRect; using WebKit::WebScriptSource; +using WebKit::WebSize; // Key for a StatsCounter tracking how many WebFrames are active. static const char* const kWebFrameActiveCount = "WebFrameActiveCount"; @@ -935,7 +939,7 @@ void WebFrameImpl::IncreaseMatchCount(int count, int request_id) { frames_scoping_count_ == 0); } -void WebFrameImpl::ReportFindInPageSelection(const gfx::Rect& selection_rect, +void WebFrameImpl::ReportFindInPageSelection(const WebRect& selection_rect, int active_match_ordinal, int request_id) { // Update the UI with the latest selection rect. @@ -958,7 +962,7 @@ bool WebFrameImpl::Find(int request_id, const string16& search_text, const WebFindOptions& options, bool wrap_within_frame, - gfx::Rect* selection_rect) { + WebRect* selection_rect) { WebCore::String webcore_string = webkit_glue::String16ToString(search_text); WebFrameImpl* const main_frame_impl = @@ -1026,10 +1030,10 @@ bool WebFrameImpl::Find(int request_id, #if defined(OS_WIN) // TODO(pinkerton): Fix Mac scrolling to be more like Win ScrollView if (selection_rect) { - gfx::Rect rect = webkit_glue::FromIntRect( + WebRect rect = webkit_glue::IntRectToWebRect( frame()->view()->convertToContainingWindow(curr_selection_rect)); - rect.Offset(-frameview()->scrollOffset().width(), - -frameview()->scrollOffset().height()); + rect.x -= frameview()->scrollOffset().width(); + rect.y -= frameview()->scrollOffset().height(); *selection_rect = rect; ReportFindInPageSelection(rect, @@ -1274,10 +1278,10 @@ void WebFrameImpl::ScopeStringMatches(int request_id, result_bounds.move(-frameview()->scrollOffset().width(), -frameview()->scrollOffset().height()); ReportFindInPageSelection( - webkit_glue::FromIntRect( + webkit_glue::IntRectToWebRect( frame()->view()->convertToContainingWindow(result_bounds)), - active_match_index_ + 1, - request_id); + active_match_index_ + 1, + request_id); #endif } } @@ -1547,9 +1551,8 @@ void WebFrameImpl::CreateFrameView() { WebCore::FrameView* view; if (is_main_frame) { - IntSize initial_size( - webview_impl_->size().width(), webview_impl_->size().height()); - view = new FrameView(frame_, initial_size); + IntSize size = webkit_glue::WebSizeToIntSize(webview_impl_->size()); + view = new FrameView(frame_, size); } else { view = new FrameView(frame_); } @@ -1594,12 +1597,12 @@ void WebFrameImpl::Layout() { FromFrame(child)->Layout(); } -void WebFrameImpl::Paint(skia::PlatformCanvas* canvas, const gfx::Rect& rect) { +void WebFrameImpl::Paint(skia::PlatformCanvas* canvas, const WebRect& rect) { static StatsRate rendering("WebFramePaintTime"); StatsScope<StatsRate> rendering_scope(rendering); - if (!rect.IsEmpty()) { - IntRect dirty_rect(rect.x(), rect.y(), rect.width(), rect.height()); + if (!rect.isEmpty()) { + IntRect dirty_rect(webkit_glue::WebRectToIntRect(rect)); #if defined(OS_MACOSX) CGContextRef context = canvas->getTopPlatformDevice().GetBitmapContext(); GraphicsContext gc(context); @@ -1875,28 +1878,26 @@ void WebFrameImpl::ClosePage() { frame_->loader()->closeURL(); } -gfx::Size WebFrameImpl::ScrollOffset() const { +WebSize WebFrameImpl::ScrollOffset() const { WebCore::FrameView* view = frameview(); - if (view) { - WebCore::IntSize s = view->scrollOffset(); - return gfx::Size(s.width(), s.height()); - } + if (view) + return webkit_glue::IntSizeToWebSize(view->scrollOffset()); - return gfx::Size(); + return WebSize(); } void WebFrameImpl::SetAllowsScrolling(bool flag) { frame_->view()->setCanHaveScrollbars(flag); } -bool WebFrameImpl::BeginPrint(const gfx::Size& page_size_px, +bool WebFrameImpl::BeginPrint(const WebSize& page_size_px, int* page_count) { DCHECK_EQ(frame()->document()->isFrameSet(), false); print_context_.reset(new ChromePrintContext(frame())); WebCore::FloatRect rect(0, 0, - static_cast<float>(page_size_px.width()), - static_cast<float>(page_size_px.height())); + static_cast<float>(page_size_px.width), + static_cast<float>(page_size_px.height)); print_context_->begin(rect.width()); float page_height; // We ignore the overlays calculation for now since they are generated in the diff --git a/webkit/glue/webframe_impl.h b/webkit/glue/webframe_impl.h index 942c000..0d8b876 100644 --- a/webkit/glue/webframe_impl.h +++ b/webkit/glue/webframe_impl.h @@ -130,7 +130,7 @@ class WebFrameImpl : public WebFrame, public base::RefCounted<WebFrameImpl> { const string16& search_text, const WebKit::WebFindOptions& options, bool wrap_within_frame, - gfx::Rect* selection_rect); + WebKit::WebRect* selection_rect); virtual void StopFinding(bool clear_selection); virtual void ScopeStringMatches( int request_id, @@ -174,9 +174,9 @@ class WebFrameImpl : public WebFrame, public base::RefCounted<WebFrameImpl> { virtual void ClosePage(); - virtual gfx::Size ScrollOffset() const; + virtual WebKit::WebSize ScrollOffset() const; - virtual bool BeginPrint(const gfx::Size& page_size_px, + virtual bool BeginPrint(const WebKit::WebSize& page_size_px, int* page_count); virtual float PrintPage(int page, skia::PlatformCanvas* canvas); virtual void EndPrint(); @@ -193,7 +193,7 @@ class WebFrameImpl : public WebFrame, public base::RefCounted<WebFrameImpl> { // WebFrameImpl void Layout(); - void Paint(skia::PlatformCanvas* canvas, const gfx::Rect& rect); + void Paint(skia::PlatformCanvas* canvas, const WebKit::WebRect& rect); bool IsLoading(); @@ -286,7 +286,7 @@ class WebFrameImpl : public WebFrame, public base::RefCounted<WebFrameImpl> { // See WebFrame.h for details. virtual void IncreaseMatchCount(int count, int request_id); - virtual void ReportFindInPageSelection(const gfx::Rect& selection_rect, + virtual void ReportFindInPageSelection(const WebKit::WebRect& selection_rect, int active_match_ordinal, int request_id); diff --git a/webkit/glue/webmediaplayer_delegate.h b/webkit/glue/webmediaplayer_delegate.h index 7f60851..c86b001 100644 --- a/webkit/glue/webmediaplayer_delegate.h +++ b/webkit/glue/webmediaplayer_delegate.h @@ -13,8 +13,9 @@ class GURL; -namespace gfx { -class Rect; +namespace WebKit { +struct WebRect; +struct WebSize; } namespace webkit_glue { @@ -43,11 +44,12 @@ class WebMediaPlayerDelegate { virtual float GetMaxTimeSeekable() const = 0; // Methods for painting. - virtual void SetSize(const gfx::Size& size) = 0; + virtual void SetSize(const WebKit::WebSize& size) = 0; // TODO(hclam): Using paint at the moment, maybe we just need to return a // SkiaBitmap? - virtual void Paint(skia::PlatformCanvas *canvas, const gfx::Rect& rect) = 0; + virtual void Paint(skia::PlatformCanvas *canvas, + const WebKit::WebRect& rect) = 0; // True if a video is loaded. virtual bool IsVideo() const = 0; diff --git a/webkit/glue/webview_delegate.h b/webkit/glue/webview_delegate.h index 4c8775a..8b2866a 100644 --- a/webkit/glue/webview_delegate.h +++ b/webkit/glue/webview_delegate.h @@ -33,11 +33,6 @@ #include "webkit/glue/webdatasource.h" #include "webkit/glue/webwidget_delegate.h" -namespace gfx { -class Point; -class Rect; -} - namespace webkit_glue { class WebMediaPlayerDelegate; } @@ -45,6 +40,7 @@ class WebMediaPlayerDelegate; namespace WebKit { class WebDragData; struct WebPoint; +struct WebRect; } struct PasswordForm; @@ -165,7 +161,7 @@ class WebViewDelegate : virtual public WebWidgetDelegate { // selection rect is currently located. virtual void ReportFindInPageSelection(int request_id, int active_match_ordinal, - const gfx::Rect& selection_rect) { + const WebKit::WebRect& selection) { } // This function is called to retrieve a resource bitmap from the diff --git a/webkit/glue/webview_impl.cc b/webkit/glue/webview_impl.cc index 78ae88b..aa45bc8 100644 --- a/webkit/glue/webview_impl.cc +++ b/webkit/glue/webview_impl.cc @@ -121,6 +121,8 @@ using WebKit::WebKeyboardEvent; using WebKit::WebMouseEvent; using WebKit::WebMouseWheelEvent; using WebKit::WebPoint; +using WebKit::WebRect; +using WebKit::WebSize; // Change the text zoom level by kTextSizeMultiplierRatio each time the user // zooms text in or out (ie., change by 20%). The min and max values limit @@ -153,7 +155,7 @@ class AutocompletePopupMenuClient : public WebCore::PopupMenuClient { FontDescription font_description; #if defined(OS_WIN) - theme()->systemFont(CSSValueWebkitControl, font_description); + theme()->systemFont(CSSValueWebkitControl, 0, font_description); #else NOTIMPLEMENTED(); #endif @@ -368,7 +370,7 @@ WebViewImpl::WebViewImpl() WTF::initializeThreading(); // set to impossible point so we always get the first mouse pos - last_mouse_position_.SetPoint(-1, -1); + last_mouse_position_ = WebPoint(-1, -1); // the page will take ownership of the various clients page_.reset(new Page(new ChromeClientImpl(this), @@ -411,7 +413,7 @@ void WebViewImpl::MouseMove(const WebMouseEvent& event) { if (!main_frame() || !main_frame()->frameview()) return; - last_mouse_position_.SetPoint(event.x, event.y); + last_mouse_position_ = WebPoint(event.x, event.y); // We call mouseMoved here instead of handleMouseMovedEvent because we need // our ChromeClientImpl to receive changes to the mouse position and @@ -962,18 +964,18 @@ WebFrame* WebViewImpl::GetNextFrameAfter(WebFrame* frame, bool wrap) { return next ? WebFrameImpl::FromFrame(next) : NULL; } -void WebViewImpl::Resize(const gfx::Size& new_size) { +void WebViewImpl::Resize(const WebSize& new_size) { if (size_ == new_size) return; size_ = new_size; if (main_frame()->frameview()) { - main_frame()->frameview()->resize(size_.width(), size_.height()); + main_frame()->frameview()->resize(size_.width, size_.height); main_frame()->frame()->eventHandler()->sendResizeEvent(); } if (delegate_) { - gfx::Rect damaged_rect(0, 0, size_.width(), size_.height()); + WebRect damaged_rect(0, 0, size_.width, size_.height); delegate_->DidInvalidateRect(this, damaged_rect); } } @@ -998,7 +1000,7 @@ void WebViewImpl::Layout() { } } -void WebViewImpl::Paint(skia::PlatformCanvas* canvas, const gfx::Rect& rect) { +void WebViewImpl::Paint(skia::PlatformCanvas* canvas, const WebRect& rect) { WebFrameImpl* webframe = main_frame(); if (webframe) webframe->Paint(canvas, rect); @@ -1286,7 +1288,7 @@ bool WebViewImpl::ImeSetComposition(int string_type, } bool WebViewImpl::ImeUpdateStatus(bool* enable_ime, - gfx::Rect* caret_rect) { + WebRect* caret_rect) { // Store whether the selected node needs IME and the caret rectangle. // This process consists of the following four steps: // 1. Retrieve the selection controller of the focused frame; @@ -1297,22 +1299,27 @@ bool WebViewImpl::ImeUpdateStatus(bool* enable_ime, const Frame* focused = GetFocusedWebCoreFrame(); if (!focused) return false; + const Editor* editor = focused->editor(); if (!editor || !editor->canEdit()) return false; + SelectionController* controller = focused->selection(); if (!controller) return false; + const Node* node = controller->start().node(); if (!node) return false; + *enable_ime = node->shouldUseInputMethod() && !controller->isInPasswordField(); const FrameView* view = node->document()->view(); if (!view) return false; - const IntRect rect(view->contentsToWindow(controller->absoluteCaretBounds())); - caret_rect->SetRect(rect.x(), rect.y(), rect.width(), rect.height()); + + *caret_rect = webkit_glue::IntRectToWebRect( + view->contentsToWindow(controller->absoluteCaretBounds())); return true; } @@ -1324,6 +1331,7 @@ void WebViewImpl::SetTextDirection(WebTextDirection direction) { const Frame* focused = GetFocusedWebCoreFrame(); if (!focused) return; + Editor* editor = focused->editor(); if (!editor || !editor->canEdit()) return; @@ -1900,7 +1908,7 @@ void WebViewImpl::RefreshAutofillPopup() { WebWidgetImpl* web_widget = static_cast<WebWidgetImpl*>(autocomplete_popup_->client()); web_widget->delegate()->SetWindowRect( - web_widget, webkit_glue::FromIntRect(new_bounds)); + web_widget, webkit_glue::IntRectToWebRect(new_bounds)); } } diff --git a/webkit/glue/webview_impl.h b/webkit/glue/webview_impl.h index 413445e..c0ce294 100644 --- a/webkit/glue/webview_impl.h +++ b/webkit/glue/webview_impl.h @@ -9,9 +9,9 @@ #include "base/basictypes.h" #include "base/compiler_specific.h" -#include "base/gfx/point.h" -#include "base/gfx/size.h" #include "skia/ext/platform_canvas.h" +#include "third_party/WebKit/WebKit/chromium/public/WebPoint.h" +#include "third_party/WebKit/WebKit/chromium/public/WebSize.h" #include "webkit/glue/back_forward_list_client_impl.h" #include "webkit/glue/webframe_impl.h" #include "webkit/glue/webpreferences.h" @@ -63,10 +63,10 @@ class WebViewImpl : public WebView, public base::RefCounted<WebViewImpl> { virtual WebFrame* GetFrameWithName(const std::wstring& name); virtual WebFrame* GetPreviousFrameBefore(WebFrame* frame, bool wrap); virtual WebFrame* GetNextFrameAfter(WebFrame* frame, bool wrap); - virtual void Resize(const gfx::Size& new_size); - virtual gfx::Size GetSize() { return size(); } + virtual void Resize(const WebKit::WebSize& new_size); + virtual WebKit::WebSize GetSize() { return size(); } virtual void Layout(); - virtual void Paint(skia::PlatformCanvas* canvas, const gfx::Rect& rect); + virtual void Paint(skia::PlatformCanvas* canvas, const WebKit::WebRect& rect); virtual bool HandleInputEvent(const WebKit::WebInputEvent* input_event); virtual void MouseCaptureLost(); virtual void SetFocus(bool enable); @@ -78,7 +78,7 @@ class WebViewImpl : public WebView, public base::RefCounted<WebViewImpl> { int target_end, const std::wstring& ime_string); virtual bool ImeUpdateStatus(bool* enable_ime, - gfx::Rect* caret_rect); + WebKit::WebRect* caret_rect); virtual void SetTextDirection(WebTextDirection direction); virtual void StopLoading(); virtual void SetBackForwardListSize(int size); @@ -126,9 +126,9 @@ class WebViewImpl : public WebView, public base::RefCounted<WebViewImpl> { // WebViewImpl - const gfx::Size& size() const { return size_; } + const WebKit::WebSize& size() const { return size_; } - const gfx::Point& last_mouse_down_point() const { + const WebKit::WebPoint& last_mouse_down_point() const { return last_mouse_down_point_; } @@ -237,9 +237,9 @@ class WebViewImpl : public WebView, public base::RefCounted<WebViewImpl> { SearchableFormData* CreateSearchableFormDataForFocusedNode(); scoped_refptr<WebViewDelegate> delegate_; - gfx::Size size_; + WebKit::WebSize size_; - gfx::Point last_mouse_position_; + WebKit::WebPoint last_mouse_position_; // Reference to the Frame that last had focus. This is set once when // we lose focus, and used when focus is gained to reinstall focus to // the correct element. @@ -302,7 +302,7 @@ class WebViewImpl : public WebView, public base::RefCounted<WebViewImpl> { // mouse was at when the drag was initiated, only the current point, which // can be misleading as it is usually not over the element the user actually // dragged by the time a drag is initiated. - gfx::Point last_mouse_down_point_; + WebKit::WebPoint last_mouse_down_point_; // Keeps track of the current text zoom level. 0 means no zoom, positive // values mean larger text, negative numbers mean smaller. diff --git a/webkit/glue/webwidget.h b/webkit/glue/webwidget.h index ed38375..6653e28 100644 --- a/webkit/glue/webwidget.h +++ b/webkit/glue/webwidget.h @@ -8,13 +8,10 @@ #include "skia/ext/platform_canvas.h" #include "webkit/glue/webtextdirection.h" -namespace gfx { -class Rect; -class Size; -} - namespace WebKit { class WebInputEvent; +struct WebRect; +struct WebSize; } class WebWidgetDelegate; @@ -33,10 +30,10 @@ class WebWidget { virtual void Close() = 0; // Called to resize the WebWidget. - virtual void Resize(const gfx::Size& new_size) = 0; + virtual void Resize(const WebKit::WebSize& new_size) = 0; // Returns the current size of the WebWidget. - virtual gfx::Size GetSize() = 0; + virtual WebKit::WebSize GetSize() = 0; // Called to layout the WebWidget. This MUST be called before Paint, and it // may result in calls to WebWidgetDelegate::DidInvalidateRect. @@ -47,7 +44,8 @@ class WebWidget { // multiple times once Layout has been called, assuming no other changes are // made to the WebWidget (e.g., once events are processed, it should be assumed // that another call to Layout is warranted before painting again). - virtual void Paint(skia::PlatformCanvas* canvas, const gfx::Rect& rect) = 0; + virtual void Paint(skia::PlatformCanvas* canvas, + const WebKit::WebRect& rect) = 0; // Called to inform the WebWidget of an input event. // Returns true if the event has been processed, false otherwise. @@ -66,7 +64,8 @@ class WebWidget { const std::wstring& ime_string) = 0; // Retrieve the status of this widget required by IME APIs. - virtual bool ImeUpdateStatus(bool* enable_ime, gfx::Rect* caret_rect) = 0; + virtual bool ImeUpdateStatus(bool* enable_ime, + WebKit::WebRect* caret_rect) = 0; // Changes the text direction of the selected input node. virtual void SetTextDirection(WebTextDirection direction) = 0; diff --git a/webkit/glue/webwidget_delegate.h b/webkit/glue/webwidget_delegate.h index 37f3ff3..e6d95b0 100644 --- a/webkit/glue/webwidget_delegate.h +++ b/webkit/glue/webwidget_delegate.h @@ -12,12 +12,8 @@ #include "base/string16.h" #include "webkit/glue/window_open_disposition.h" -namespace gfx { -class Point; -class Rect; -} - namespace WebKit { +struct WebRect; struct WebScreenInfo; } @@ -47,12 +43,13 @@ class WebWidgetDelegate { virtual gfx::NativeViewId GetContainingView(WebWidget* webwidget) = 0; // Called when a region of the WebWidget needs to be re-painted. - virtual void DidInvalidateRect(WebWidget* webwidget, const gfx::Rect& rect) = 0; + virtual void DidInvalidateRect(WebWidget* webwidget, + const WebKit::WebRect& rect) = 0; // Called when a region of the WebWidget, given by clip_rect, should be // scrolled by the specified dx and dy amounts. virtual void DidScrollRect(WebWidget* webwidget, int dx, int dy, - const gfx::Rect& clip_rect) = 0; + const WebKit::WebRect& clip_rect) = 0; // This method is called to instruct the window containing the WebWidget to // show itself as the topmost window. This method is only used after a @@ -71,7 +68,7 @@ class WebWidgetDelegate { // such as the type (separator, option, group), the text representation and // the item's enabled status. virtual void ShowWithItems(WebWidget* webwidget, - const gfx::Rect& bounds, + const WebKit::WebRect& bounds, int item_height, int selected_index, const std::vector<MenuItem>& items) = 0; @@ -93,7 +90,7 @@ class WebWidgetDelegate { virtual void SetCursor(WebWidget* webwidget, const WebCursor& cursor) = 0; // Returns the rectangle of the WebWidget in screen coordinates. - virtual void GetWindowRect(WebWidget* webwidget, gfx::Rect* rect) = 0; + virtual void GetWindowRect(WebWidget* webwidget, WebKit::WebRect* rect) = 0; // This method is called to re-position the WebWidget on the screen. The given // rect is in screen coordinates. The implementation may choose to ignore @@ -101,15 +98,18 @@ class WebWidgetDelegate { // has been called. // TODO(darin): this is more of a request; does this need to take effect // synchronously? - virtual void SetWindowRect(WebWidget* webwidget, const gfx::Rect& rect) = 0; + virtual void SetWindowRect(WebWidget* webwidget, + const WebKit::WebRect& rect) = 0; // Returns the rectangle of the window in which this WebWidget is embeded. - virtual void GetRootWindowRect(WebWidget* webwidget, gfx::Rect* rect) = 0; + virtual void GetRootWindowRect(WebWidget* webwidget, + WebKit::WebRect* rect) = 0; // Returns the resizer rectangle of the window this WebWidget is in. This // is used on Mac to determine if a scrollbar is over the in-window resize // area at the bottom right corner. - virtual void GetRootWindowResizerRect(WebWidget* webwidget, gfx::Rect* rect) = 0; + virtual void GetRootWindowResizerRect(WebWidget* webwidget, + WebKit::WebRect* rect) = 0; // Keeps track of the necessary window move for a plugin window that resulted // from a scroll operation. That way, all plugin windows can be moved at the diff --git a/webkit/glue/webwidget_impl.cc b/webkit/glue/webwidget_impl.cc index 0c5f062..79408fb 100644 --- a/webkit/glue/webwidget_impl.cc +++ b/webkit/glue/webwidget_impl.cc @@ -19,7 +19,6 @@ MSVC_PUSH_WARNING_LEVEL(0); MSVC_POP_WARNING(); #undef LOG -#include "base/gfx/rect.h" #include "base/logging.h" #include "skia/ext/platform_canvas.h" #include "third_party/WebKit/WebKit/chromium/public/WebInputEvent.h" @@ -34,6 +33,9 @@ using WebKit::WebInputEvent; using WebKit::WebKeyboardEvent; using WebKit::WebMouseEvent; using WebKit::WebMouseWheelEvent; +using WebKit::WebPoint; +using WebKit::WebRect; +using WebKit::WebSize; // WebWidget ---------------------------------------------------------------- @@ -48,7 +50,7 @@ WebWidgetImpl::WebWidgetImpl(WebWidgetDelegate* delegate) : delegate_(delegate), widget_(NULL) { // set to impossible point so we always get the first mouse pos - last_mouse_position_.SetPoint(-1, -1); + last_mouse_position_ = WebPoint(-1, -1); } WebWidgetImpl::~WebWidgetImpl() { @@ -57,7 +59,7 @@ WebWidgetImpl::~WebWidgetImpl() { } void WebWidgetImpl::Init(WebCore::FramelessScrollView* widget, - const gfx::Rect& bounds) { + const WebRect& bounds) { widget_ = widget; widget_->setClient(this); @@ -68,7 +70,7 @@ void WebWidgetImpl::Init(WebCore::FramelessScrollView* widget, } void WebWidgetImpl::InitWithItems(WebCore::FramelessScrollView* widget, - const gfx::Rect& bounds, + const WebRect& bounds, int item_height, int selected_index, const std::vector<MenuItem>& items) { @@ -83,10 +85,9 @@ void WebWidgetImpl::InitWithItems(WebCore::FramelessScrollView* widget, void WebWidgetImpl::MouseMove(const WebMouseEvent& event) { // don't send mouse move messages if the mouse hasn't moved. - if (event.x != last_mouse_position_.x() || - event.y != last_mouse_position_.y()) { - last_mouse_position_.SetPoint(event.x, event.y); - + if (event.x != last_mouse_position_.x || + event.y != last_mouse_position_.y) { + last_mouse_position_ = WebPoint(event.x, event.y); widget_->handleMouseMoveEvent(MakePlatformMouseEvent(widget_, event)); } } @@ -123,18 +124,18 @@ void WebWidgetImpl::Close() { Release(); // Balances AddRef from WebWidget::Create } -void WebWidgetImpl::Resize(const gfx::Size& new_size) { +void WebWidgetImpl::Resize(const WebSize& new_size) { if (size_ == new_size) return; size_ = new_size; if (widget_) { - IntRect new_geometry(0, 0, size_.width(), size_.height()); + IntRect new_geometry(0, 0, size_.width, size_.height); widget_->setFrameRect(new_geometry); } if (delegate_) { - gfx::Rect damaged_rect(0, 0, size_.width(), size_.height()); + WebRect damaged_rect(0, 0, size_.width, size_.height); delegate_->DidInvalidateRect(this, damaged_rect); } } @@ -142,11 +143,11 @@ void WebWidgetImpl::Resize(const gfx::Size& new_size) { void WebWidgetImpl::Layout() { } -void WebWidgetImpl::Paint(skia::PlatformCanvas* canvas, const gfx::Rect& rect) { +void WebWidgetImpl::Paint(skia::PlatformCanvas* canvas, const WebRect& rect) { if (!widget_) return; - if (!rect.IsEmpty()) { + if (!rect.isEmpty()) { #if defined(OS_MACOSX) CGContextRef context = canvas->getTopPlatformDevice().GetBitmapContext(); GraphicsContext gc(context); @@ -156,9 +157,7 @@ void WebWidgetImpl::Paint(skia::PlatformCanvas* canvas, const gfx::Rect& rect) { GraphicsContext gc(reinterpret_cast<PlatformGraphicsContext*>(&context)); #endif - IntRect dirty_rect(rect.x(), rect.y(), rect.width(), rect.height()); - - widget_->paint(&gc, dirty_rect); + widget_->paint(&gc, webkit_glue::WebRectToIntRect(rect)); } } @@ -217,7 +216,7 @@ bool WebWidgetImpl::ImeSetComposition(int string_type, } bool WebWidgetImpl::ImeUpdateStatus(bool* enable_ime, - gfx::Rect* caret_rect) { + WebRect* caret_rect) { return false; } @@ -235,7 +234,8 @@ void WebWidgetImpl::repaint(const WebCore::IntRect& paint_rect, if (!content_changed || paint_rect.isEmpty()) return; if (delegate_) - delegate_->DidInvalidateRect(this, webkit_glue::FromIntRect(paint_rect)); + delegate_->DidInvalidateRect(this, + webkit_glue::IntRectToWebRect(paint_rect)); } void WebWidgetImpl::scroll(const WebCore::IntSize& scroll_delta, @@ -244,7 +244,8 @@ void WebWidgetImpl::scroll(const WebCore::IntSize& scroll_delta, if (delegate_) { int dx = scroll_delta.width(); int dy = scroll_delta.height(); - delegate_->DidScrollRect(this, dx, dy, webkit_glue::FromIntRect(clip_rect)); + delegate_->DidScrollRect(this, dx, dy, + webkit_glue::IntRectToWebRect(clip_rect)); } } diff --git a/webkit/glue/webwidget_impl.h b/webkit/glue/webwidget_impl.h index 5cf6cfe..548952b 100644 --- a/webkit/glue/webwidget_impl.h +++ b/webkit/glue/webwidget_impl.h @@ -9,8 +9,9 @@ #include "base/compiler_specific.h" #include "base/ref_counted.h" #include "base/gfx/native_widget_types.h" -#include "base/gfx/point.h" -#include "base/gfx/size.h" +#include "third_party/WebKit/WebKit/chromium/public/WebPoint.h" +#include "third_party/WebKit/WebKit/chromium/public/WebRect.h" +#include "third_party/WebKit/WebKit/chromium/public/WebSize.h" #include "webkit/glue/webwidget.h" #include "FramelessScrollViewClient.h" @@ -40,10 +41,11 @@ class WebWidgetImpl : public WebWidget, public: // WebWidget virtual void Close(); - virtual void Resize(const gfx::Size& new_size); - virtual gfx::Size GetSize() { return size(); } + virtual void Resize(const WebKit::WebSize& new_size); + virtual WebKit::WebSize GetSize() { return size(); } virtual void Layout(); - virtual void Paint(skia::PlatformCanvas* canvas, const gfx::Rect& rect); + virtual void Paint(skia::PlatformCanvas* canvas, + const WebKit::WebRect& rect); virtual bool HandleInputEvent(const WebKit::WebInputEvent* input_event); virtual void MouseCaptureLost(); virtual void SetFocus(bool enable); @@ -53,18 +55,19 @@ class WebWidgetImpl : public WebWidget, int target_end, const std::wstring& ime_string); virtual bool ImeUpdateStatus(bool* enable_ime, - gfx::Rect* caret_rect); + WebKit::WebRect* caret_rect); virtual void SetTextDirection(WebTextDirection direction); // WebWidgetImpl - void Init(WebCore::FramelessScrollView* widget, const gfx::Rect& bounds); + void Init(WebCore::FramelessScrollView* widget, + const WebKit::WebRect& bounds); void InitWithItems(WebCore::FramelessScrollView* widget, - const gfx::Rect& bounds, + const WebKit::WebRect& bounds, int item_height, int selected_index, const std::vector<MenuItem>& items); - const gfx::Size& size() const { return size_; } + const WebKit::WebSize& size() const { return size_; } WebWidgetDelegate* delegate() { return delegate_; @@ -111,9 +114,9 @@ class WebWidgetImpl : public WebWidget, #endif WebWidgetDelegate* delegate_; - gfx::Size size_; + WebKit::WebSize size_; - gfx::Point last_mouse_position_; + WebKit::WebPoint last_mouse_position_; // This is a non-owning ref. The popup will notify us via popupClosed() // before it is destroyed. diff --git a/webkit/tools/test_shell/mac/test_webview_delegate.mm b/webkit/tools/test_shell/mac/test_webview_delegate.mm index 039e34f3..9ae7a80 100755 --- a/webkit/tools/test_shell/mac/test_webview_delegate.mm +++ b/webkit/tools/test_shell/mac/test_webview_delegate.mm @@ -7,12 +7,15 @@ #import <Cocoa/Cocoa.h> #include "base/sys_string_conversions.h" #include "base/string_util.h" +#include "third_party/WebKit/WebKit/chromium/public/WebRect.h" #include "webkit/glue/webcursor.h" #include "webkit/glue/webview.h" #include "webkit/glue/plugins/plugin_list.h" #include "webkit/glue/plugins/webplugin_delegate_impl.h" #include "webkit/tools/test_shell/test_shell.h" +using WebKit::WebRect; + // MenuDelegate ---------------------------------------------------------------- // A class for determining whether an item was selected from an HTML select // control, or if the menu was dismissed without making a selection. If a menu @@ -121,7 +124,7 @@ void TestWebViewDelegate::Show(WebWidget* webview, // Display a HTML select menu. void TestWebViewDelegate::ShowWithItems( WebWidget* webview, - const gfx::Rect& bounds, + const WebRect& bounds, int item_height, int selected_index, const std::vector<MenuItem>& items) { @@ -141,9 +144,9 @@ void TestWebViewDelegate::ShowWithItems( [button selectItemAtIndex:selected_index]; NSView* web_view = shell_->webViewWnd(); NSRect view_rect = [web_view bounds]; - int y_offset = bounds.y() + bounds.height(); - NSRect position = NSMakeRect(bounds.x(), view_rect.size.height - y_offset, - bounds.width(), bounds.height()); + int y_offset = bounds.y + bounds.height; + NSRect position = NSMakeRect(bounds.x, view_rect.size.height - y_offset, + bounds.width, bounds.height); // Display the menu, and set a flag to determine if something was chosen. If // nothing was chosen (i.e., the user dismissed the popup by the "ESC" key or @@ -226,7 +229,7 @@ void TestWebViewDelegate::SetCursor(WebWidget* webwidget, } void TestWebViewDelegate::GetWindowRect(WebWidget* webwidget, - gfx::Rect* out_rect) { + WebRect* out_rect) { DCHECK(out_rect); if (WebWidgetHost* host = GetHostForWidget(webwidget)) { NSView *view = host->view_handle(); @@ -236,7 +239,7 @@ void TestWebViewDelegate::GetWindowRect(WebWidget* webwidget, } void TestWebViewDelegate::SetWindowRect(WebWidget* webwidget, - const gfx::Rect& rect) { + const WebRect& rect) { // TODO: Mac window movement if (webwidget == shell_->webView()) { // ignored @@ -247,7 +250,7 @@ void TestWebViewDelegate::SetWindowRect(WebWidget* webwidget, } void TestWebViewDelegate::GetRootWindowRect(WebWidget* webwidget, - gfx::Rect* out_rect) { + WebRect* out_rect) { if (WebWidgetHost* host = GetHostForWidget(webwidget)) { NSView *view = host->view_handle(); NSRect rect = [[[view window] contentView] frame]; @@ -260,7 +263,7 @@ void TestWebViewDelegate::GetRootWindowRect(WebWidget* webwidget, @end void TestWebViewDelegate::GetRootWindowResizerRect(WebWidget* webwidget, - gfx::Rect* out_rect) { + WebRect* out_rect) { NSRect resize_rect = NSMakeRect(0, 0, 0, 0); WebWidgetHost* host = GetHostForWidget(webwidget); // To match the WebKit screen shots, we need the resize area to overlap diff --git a/webkit/tools/test_shell/mac/webview_host.mm b/webkit/tools/test_shell/mac/webview_host.mm index 7c6c949..13f8332 100644 --- a/webkit/tools/test_shell/mac/webview_host.mm +++ b/webkit/tools/test_shell/mac/webview_host.mm @@ -10,9 +10,12 @@ #include "base/gfx/platform_canvas.h" #include "base/gfx/rect.h" #include "base/gfx/size.h" +#include "third_party/WebKit/WebKit/chromium/public/WebSize.h" #include "webkit/glue/webview.h" -/*static*/ +using WebKit::WebSize; + +// static WebViewHost* WebViewHost::Create(NSView* parent_view, WebViewDelegate* delegate, const WebPreferences& prefs) { @@ -31,8 +34,8 @@ WebViewHost* WebViewHost::Create(NSView* parent_view, [host->view_ release]; host->webwidget_ = WebView::Create(delegate, prefs); - host->webwidget_->Resize(gfx::Size(content_rect.size.width, - content_rect.size.height)); + host->webwidget_->Resize(WebSize(content_rect.size.width, + content_rect.size.height)); return host; } diff --git a/webkit/tools/test_shell/mac/webwidget_host.mm b/webkit/tools/test_shell/mac/webwidget_host.mm index bccb584..a24928a 100644 --- a/webkit/tools/test_shell/mac/webwidget_host.mm +++ b/webkit/tools/test_shell/mac/webwidget_host.mm @@ -14,6 +14,7 @@ #include "third_party/WebKit/WebKit/chromium/public/mac/WebScreenInfoFactory.h" #include "third_party/WebKit/WebKit/chromium/public/WebInputEvent.h" #include "third_party/WebKit/WebKit/chromium/public/WebScreenInfo.h" +#include "third_party/WebKit/WebKit/chromium/public/WebSize.h" #include "webkit/glue/webwidget.h" #include "webkit/tools/test_shell/test_shell.h" @@ -24,6 +25,7 @@ using WebKit::WebMouseEvent; using WebKit::WebMouseWheelEvent; using WebKit::WebScreenInfo; using WebKit::WebScreenInfoFactory; +using WebKit::WebSize; /*static*/ WebWidgetHost* WebWidgetHost::Create(NSView* parent_view, @@ -39,8 +41,8 @@ WebWidgetHost* WebWidgetHost::Create(NSView* parent_view, // win_util::SetWindowUserData(host->hwnd_, host); host->webwidget_ = WebWidget::Create(delegate); - host->webwidget_->Resize(gfx::Size(content_rect.size.width, - content_rect.size.height)); + host->webwidget_->Resize(WebSize(content_rect.size.width, + content_rect.size.height)); return host; } @@ -225,7 +227,7 @@ WebScreenInfo WebWidgetHost::GetScreenInfo() { void WebWidgetHost::Resize(const gfx::Rect& rect) { // Force an entire re-paint. TODO(darin): Maybe reuse this memory buffer. DiscardBackingStore(); - webwidget_->Resize(gfx::Size(rect.width(), rect.height())); + webwidget_->Resize(WebSize(rect.width(), rect.height())); } void WebWidgetHost::MouseEvent(NSEvent *event) { diff --git a/webkit/tools/test_shell/test_webview_delegate.cc b/webkit/tools/test_shell/test_webview_delegate.cc index af7a662..9ba64e0 100755 --- a/webkit/tools/test_shell/test_webview_delegate.cc +++ b/webkit/tools/test_shell/test_webview_delegate.cc @@ -43,7 +43,9 @@ #endif using WebKit::WebDragData; +using WebKit::WebRect; using WebKit::WebScreenInfo; +using WebKit::WebSize; using WebKit::WebString; namespace { @@ -715,13 +717,13 @@ gfx::NativeViewId TestWebViewDelegate::GetContainingView(WebWidget* webwidget) { } void TestWebViewDelegate::DidInvalidateRect(WebWidget* webwidget, - const gfx::Rect& rect) { + const WebRect& rect) { if (WebWidgetHost* host = GetHostForWidget(webwidget)) host->DidInvalidateRect(rect); } void TestWebViewDelegate::DidScrollRect(WebWidget* webwidget, int dx, int dy, - const gfx::Rect& clip_rect) { + const WebRect& clip_rect) { if (WebWidgetHost* host = GetHostForWidget(webwidget)) host->DidScrollRect(dx, dy, clip_rect); } diff --git a/webkit/tools/test_shell/test_webview_delegate.h b/webkit/tools/test_shell/test_webview_delegate.h index 94e1f83..e1692fe 100644 --- a/webkit/tools/test_shell/test_webview_delegate.h +++ b/webkit/tools/test_shell/test_webview_delegate.h @@ -212,12 +212,13 @@ class TestWebViewDelegate : public base::RefCounted<TestWebViewDelegate>, // WebWidgetDelegate virtual gfx::NativeViewId GetContainingView(WebWidget* webwidget); - virtual void DidInvalidateRect(WebWidget* webwidget, const gfx::Rect& rect); + virtual void DidInvalidateRect(WebWidget* webwidget, + const WebKit::WebRect& rect); virtual void DidScrollRect(WebWidget* webwidget, int dx, int dy, - const gfx::Rect& clip_rect); + const WebKit::WebRect& clip_rect); virtual void Show(WebWidget* webview, WindowOpenDisposition disposition); virtual void ShowWithItems(WebWidget* webwidget, - const gfx::Rect& bounds, + const WebKit::WebRect& bounds, int item_height, int selected_index, const std::vector<MenuItem>& items); @@ -226,10 +227,12 @@ class TestWebViewDelegate : public base::RefCounted<TestWebViewDelegate>, virtual void Blur(WebWidget* webwidget); virtual void SetCursor(WebWidget* webwidget, const WebCursor& cursor); - virtual void GetWindowRect(WebWidget* webwidget, gfx::Rect* rect); - virtual void SetWindowRect(WebWidget* webwidget, const gfx::Rect& rect); - virtual void GetRootWindowRect(WebWidget *, gfx::Rect *); - virtual void GetRootWindowResizerRect(WebWidget* webwidget, gfx::Rect* rect); + virtual void GetWindowRect(WebWidget* webwidget, WebKit::WebRect* rect); + virtual void SetWindowRect(WebWidget* webwidget, + const WebKit::WebRect& rect); + virtual void GetRootWindowRect(WebWidget *, WebKit::WebRect *); + virtual void GetRootWindowResizerRect(WebWidget* webwidget, + WebKit::WebRect* rect); virtual void DidMove(WebWidget* webwidget, const WebPluginGeometry& move); virtual void RunModal(WebWidget* webwidget); virtual bool IsHidden(WebWidget* webwidget); diff --git a/webkit/tools/test_shell/test_webview_delegate_gtk.cc b/webkit/tools/test_shell/test_webview_delegate_gtk.cc index bce7619..ef92a3b 100755 --- a/webkit/tools/test_shell/test_webview_delegate_gtk.cc +++ b/webkit/tools/test_shell/test_webview_delegate_gtk.cc @@ -14,6 +14,7 @@ #include "base/string_util.h" #include "net/base/net_errors.h" #include "chrome/common/page_transition_types.h" +#include "third_party/WebKit/WebKit/chromium/public/WebRect.h" #include "webkit/glue/webcursor.h" #include "webkit/glue/webdatasource.h" #include "webkit/glue/webdropdata.h" @@ -29,8 +30,9 @@ #include "webkit/tools/test_shell/test_navigation_controller.h" #include "webkit/tools/test_shell/test_shell.h" -namespace { +using WebKit::WebRect; +namespace { enum SelectionClipboardType { TEXT_HTML, @@ -114,7 +116,7 @@ void TestWebViewDelegate::Show(WebWidget* webwidget, } void TestWebViewDelegate::ShowWithItems(WebWidget* webwidget, - const gfx::Rect& bounds, + const WebRect& bounds, int item_height, int selected_index, const std::vector<MenuItem>& items) { @@ -159,7 +161,7 @@ void TestWebViewDelegate::SetCursor(WebWidget* webwidget, } void TestWebViewDelegate::GetWindowRect(WebWidget* webwidget, - gfx::Rect* out_rect) { + WebRect* out_rect) { DCHECK(out_rect); WebWidgetHost* host = GetHostForWidget(webwidget); GtkWidget* drawing_area = host->view_handle(); @@ -171,12 +173,13 @@ void TestWebViewDelegate::GetWindowRect(WebWidget* webwidget, x += vbox->allocation.x + drawing_area->allocation.x; y += vbox->allocation.y + drawing_area->allocation.y; - out_rect->SetRect(x, y, drawing_area->allocation.width, - drawing_area->allocation.height); + *out_rect = WebRect(x, y, + drawing_area->allocation.width, + drawing_area->allocation.height); } void TestWebViewDelegate::SetWindowRect(WebWidget* webwidget, - const gfx::Rect& rect) { + const WebRect& rect) { if (webwidget == shell_->webView()) { // ignored } else if (webwidget == shell_->popup()) { @@ -184,13 +187,13 @@ void TestWebViewDelegate::SetWindowRect(WebWidget* webwidget, GtkWidget* drawing_area = host->view_handle(); GtkWidget* window = gtk_widget_get_parent(gtk_widget_get_parent(drawing_area)); - gtk_window_resize(GTK_WINDOW(window), rect.width(), rect.height()); - gtk_window_move(GTK_WINDOW(window), rect.x(), rect.y()); + gtk_window_resize(GTK_WINDOW(window), rect.width, rect.height); + gtk_window_move(GTK_WINDOW(window), rect.x, rect.y); } } void TestWebViewDelegate::GetRootWindowRect(WebWidget* webwidget, - gfx::Rect* out_rect) { + WebRect* out_rect) { if (WebWidgetHost* host = GetHostForWidget(webwidget)) { // We are being asked for the x/y and width/height of the entire browser // window. This means the x/y is the distance from the corner of the @@ -202,14 +205,14 @@ void TestWebViewDelegate::GetRootWindowRect(WebWidget* webwidget, gint x, y, width, height; gtk_window_get_position(GTK_WINDOW(window), &x, &y); gtk_window_get_size(GTK_WINDOW(window), &width, &height); - out_rect->SetRect(x, y, width, height); + *out_rect = WebRect(x, y, width, height); } } void TestWebViewDelegate::GetRootWindowResizerRect(WebWidget* webwidget, - gfx::Rect* out_rect) { + WebRect* out_rect) { // Not necessary on Linux. - *out_rect = gfx::Rect(); + *out_rect = WebRect(); } void TestWebViewDelegate::DidMove(WebWidget* webwidget, diff --git a/webkit/tools/test_shell/test_webview_delegate_win.cc b/webkit/tools/test_shell/test_webview_delegate_win.cc index 28c5034..125c1b2 100755 --- a/webkit/tools/test_shell/test_webview_delegate_win.cc +++ b/webkit/tools/test_shell/test_webview_delegate_win.cc @@ -19,6 +19,7 @@ #include "base/string_util.h" #include "base/trace_event.h" #include "net/base/net_errors.h" +#include "third_party/WebKit/WebKit/chromium/public/WebRect.h" #include "webkit/glue/webdatasource.h" #include "webkit/glue/webdropdata.h" #include "webkit/glue/weberror.h" @@ -35,6 +36,8 @@ #include "webkit/tools/test_shell/test_navigation_controller.h" #include "webkit/tools/test_shell/test_shell.h" +using WebKit::WebRect; + // WebViewDelegate ----------------------------------------------------------- TestWebViewDelegate::~TestWebViewDelegate() { @@ -79,7 +82,7 @@ void TestWebViewDelegate::Show(WebWidget* webwidget, WindowOpenDisposition) { } void TestWebViewDelegate::ShowWithItems(WebWidget* webwidget, - const gfx::Rect& bounds, + const WebRect& bounds, int item_height, int selected_index, const std::vector<MenuItem>& items) { @@ -104,7 +107,7 @@ void TestWebViewDelegate::SetCursor(WebWidget* webwidget, } void TestWebViewDelegate::GetWindowRect(WebWidget* webwidget, - gfx::Rect* out_rect) { + WebRect* out_rect) { if (WebWidgetHost* host = GetHostForWidget(webwidget)) { RECT rect; ::GetWindowRect(host->view_handle(), &rect); @@ -113,17 +116,17 @@ void TestWebViewDelegate::GetWindowRect(WebWidget* webwidget, } void TestWebViewDelegate::SetWindowRect(WebWidget* webwidget, - const gfx::Rect& rect) { + const WebRect& rect) { if (webwidget == shell_->webView()) { // ignored } else if (webwidget == shell_->popup()) { MoveWindow(shell_->popupWnd(), - rect.x(), rect.y(), rect.width(), rect.height(), FALSE); + rect.x, rect.y, rect.width, rect.height, FALSE); } } void TestWebViewDelegate::GetRootWindowRect(WebWidget* webwidget, - gfx::Rect* out_rect) { + WebRect* out_rect) { if (WebWidgetHost* host = GetHostForWidget(webwidget)) { RECT rect; HWND root_window = ::GetAncestor(host->view_handle(), GA_ROOT); @@ -133,7 +136,7 @@ void TestWebViewDelegate::GetRootWindowRect(WebWidget* webwidget, } void TestWebViewDelegate::GetRootWindowResizerRect(WebWidget* webwidget, - gfx::Rect* out_rect) { + WebRect* out_rect) { // Not necessary on Windows. *out_rect = gfx::Rect(); } diff --git a/webkit/tools/test_shell/webwidget_host_gtk.cc b/webkit/tools/test_shell/webwidget_host_gtk.cc index 08dd9bc..5645da7 100644 --- a/webkit/tools/test_shell/webwidget_host_gtk.cc +++ b/webkit/tools/test_shell/webwidget_host_gtk.cc @@ -16,6 +16,7 @@ #include "third_party/WebKit/WebKit/chromium/public/gtk/WebScreenInfoFactory.h" #include "third_party/WebKit/WebKit/chromium/public/WebInputEvent.h" #include "third_party/WebKit/WebKit/chromium/public/WebScreenInfo.h" +#include "third_party/WebKit/WebKit/chromium/public/WebSize.h" #include "webkit/glue/webwidget.h" #include "webkit/tools/test_shell/test_shell.h" @@ -25,6 +26,7 @@ using WebKit::WebMouseEvent; using WebKit::WebMouseWheelEvent; using WebKit::WebScreenInfo; using WebKit::WebScreenInfoFactory; +using WebKit::WebSize; namespace { @@ -122,14 +124,14 @@ class WebWidgetHostGtkWidget { static void HandleSizeAllocate(GtkWidget* widget, GtkAllocation* allocation, WebWidgetHost* host) { - host->Resize(gfx::Size(allocation->width, allocation->height)); + host->Resize(WebSize(allocation->width, allocation->height)); } // Size, position, or stacking of the GdkWindow changed. static gboolean HandleConfigure(GtkWidget* widget, GdkEventConfigure* config, WebWidgetHost* host) { - host->Resize(gfx::Size(config->width, config->height)); + host->Resize(WebSize(config->width, config->height)); return FALSE; } diff --git a/webkit/tools/test_shell/webwidget_host_win.cc b/webkit/tools/test_shell/webwidget_host_win.cc index 9db06c0..c5464ef 100644 --- a/webkit/tools/test_shell/webwidget_host_win.cc +++ b/webkit/tools/test_shell/webwidget_host_win.cc @@ -11,6 +11,7 @@ #include "skia/ext/platform_canvas_win.h" #include "third_party/WebKit/WebKit/chromium/public/WebInputEvent.h" #include "third_party/WebKit/WebKit/chromium/public/WebScreenInfo.h" +#include "third_party/WebKit/WebKit/chromium/public/WebSize.h" #include "third_party/WebKit/WebKit/chromium/public/win/WebInputEventFactory.h" #include "third_party/WebKit/WebKit/chromium/public/win/WebScreenInfoFactory.h" #include "webkit/glue/webwidget.h" @@ -23,6 +24,7 @@ using WebKit::WebMouseEvent; using WebKit::WebMouseWheelEvent; using WebKit::WebScreenInfo; using WebKit::WebScreenInfoFactory; +using WebKit::WebSize; static const wchar_t kWindowClassName[] = L"WebWidgetHost"; @@ -285,7 +287,7 @@ void WebWidgetHost::Resize(LPARAM lparam) { // Force an entire re-paint. TODO(darin): Maybe reuse this memory buffer. DiscardBackingStore(); - webwidget_->Resize(gfx::Size(LOWORD(lparam), HIWORD(lparam))); + webwidget_->Resize(WebSize(LOWORD(lparam), HIWORD(lparam))); } void WebWidgetHost::MouseEvent(UINT message, WPARAM wparam, LPARAM lparam) { |