diff options
author | cpu@google.com <cpu@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-08 23:16:24 +0000 |
---|---|---|
committer | cpu@google.com <cpu@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-08 23:16:24 +0000 |
commit | eb6439387ab5035450035d606f6ff32319c13789 (patch) | |
tree | 897f9ffa88d64addd5ed0de10039c3dfc383100a /webkit | |
parent | 1640ffbff45713748fb31c9bbae46ea47ab6e8e0 (diff) | |
download | chromium_src-eb6439387ab5035450035d606f6ff32319c13789.zip chromium_src-eb6439387ab5035450035d606f6ff32319c13789.tar.gz chromium_src-eb6439387ab5035450035d606f6ff32319c13789.tar.bz2 |
Reverting dfisher changes 133386 and 13381
TBR=darin
Review URL: http://codereview.chromium.org/58018
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@13387 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
25 files changed, 191 insertions, 255 deletions
diff --git a/webkit/glue/chrome_client_impl.cc b/webkit/glue/chrome_client_impl.cc index aebc29b..bfa6db4 100644 --- a/webkit/glue/chrome_client_impl.cc +++ b/webkit/glue/chrome_client_impl.cc @@ -43,7 +43,6 @@ 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. @@ -101,20 +100,26 @@ 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. - rect.width = webview_->size().width; - rect.height = webview_->size().height; + 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())); } - 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() { @@ -388,13 +393,16 @@ bool ChromeClientImpl::tabsToLinks() const { } WebCore::IntRect ChromeClientImpl::windowResizerRect() const { - WebCore::IntRect result; + WebCore::IntRect rv; if (webview_->delegate()) { - WebRect resizer_rect; + gfx::Rect resizer_rect; webview_->delegate()->GetRootWindowResizerRect(webview_, &resizer_rect); - result = webkit_glue::WebRectToIntRect(resizer_rect); + rv = WebCore::IntRect(resizer_rect.x(), + resizer_rect.y(), + resizer_rect.width(), + resizer_rect.height()); } - return result; + return rv; } void ChromeClientImpl::repaint( @@ -405,8 +413,7 @@ void ChromeClientImpl::repaint( return; WebViewDelegate* delegate = webview_->delegate(); if (delegate) - delegate->DidInvalidateRect(webview_, - webkit_glue::IntRectToWebRect(paint_rect)); + delegate->DidInvalidateRect(webview_, webkit_glue::FromIntRect(paint_rect)); } void ChromeClientImpl::scroll( @@ -417,7 +424,7 @@ void ChromeClientImpl::scroll( int dx = scroll_delta.width(); int dy = scroll_delta.height(); delegate->DidScrollRect(webview_, dx, dy, - webkit_glue::IntRectToWebRect(clip_rect)); + webkit_glue::FromIntRect(clip_rect)); } } @@ -433,9 +440,9 @@ WebCore::IntRect ChromeClientImpl::windowToScreen( WebViewDelegate* delegate = webview_->delegate(); if (delegate) { - WebRect window_rect; + gfx::Rect 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; @@ -514,7 +521,7 @@ void ChromeClientImpl::popupOpened(WebCore::FramelessScrollView* popup_view, WebWidgetImpl* webwidget = static_cast<WebWidgetImpl*>(delegate->CreatePopupWidget(webview_, activatable)); - webwidget->Init(popup_view, webkit_glue::IntRectToWebRect(bounds)); + webwidget->Init(popup_view, webkit_glue::FromIntRect(bounds)); } } @@ -559,7 +566,7 @@ void ChromeClientImpl::popupOpenedWithItems( } webwidget->InitWithItems(popup_view, - webkit_glue::IntRectToWebRect(bounds), + webkit_glue::FromIntRect(bounds), item_height, selected_index, popup_items); diff --git a/webkit/glue/glue_util.cc b/webkit/glue/glue_util.cc index 1ab7b16..da506ce 100644 --- a/webkit/glue/glue_util.cc +++ b/webkit/glue/glue_util.cc @@ -31,8 +31,6 @@ #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" @@ -182,26 +180,6 @@ 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 46cc74a..8f02767 100644 --- a/webkit/glue/glue_util.h +++ b/webkit/glue/glue_util.h @@ -15,7 +15,6 @@ class ChromiumDataObject; class CString; class IntPoint; class IntRect; -class IntSize; class KURL; class String; } @@ -26,8 +25,6 @@ class WebDragData; class WebString; class WebURL; struct WebPoint; -struct WebRect; -struct WebSize; } namespace WTF { @@ -88,14 +85,6 @@ 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 d2130dd..704d9e7 100644 --- a/webkit/glue/inspector_client_impl.cc +++ b/webkit/glue/inspector_client_impl.cc @@ -17,7 +17,6 @@ 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" @@ -27,9 +26,6 @@ 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; @@ -143,8 +139,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. - const WebSize& size = web_view->size(); - WebRect damaged_rect(0, 0, size.width, size.height); + gfx::Size size = web_view->size(); + gfx::Rect 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 3e24819..963f5b4 100644 --- a/webkit/glue/media_player_private_impl.cc +++ b/webkit/glue/media_player_private_impl.cc @@ -15,8 +15,6 @@ #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" @@ -261,14 +259,14 @@ void MediaPlayerPrivate::setVisible(bool visible) { void MediaPlayerPrivate::setSize(const IntSize& size) { if (m_data) { - AsDelegate(m_data)->SetSize(webkit_glue::IntSizeToWebSize(size)); + AsDelegate(m_data)->SetSize(gfx::Size(size.width(), size.height())); } } void MediaPlayerPrivate::paint(GraphicsContext* p, const IntRect& r) { if (m_data) { - AsDelegate(m_data)->Paint(p->platformContext()->canvas(), - webkit_glue::IntRectToWebRect(r)); + gfx::Rect rect(r.x(), r.y(), r.width(), r.height()); + AsDelegate(m_data)->Paint(p->platformContext()->canvas(), rect); } } diff --git a/webkit/glue/webframe.h b/webkit/glue/webframe.h index 97559b6..9c36c95 100644 --- a/webkit/glue/webframe.h +++ b/webkit/glue/webframe.h @@ -19,12 +19,15 @@ 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 @@ -220,7 +223,7 @@ class WebFrame { const string16& search_text, const WebKit::WebFindOptions& options, bool wrap_within_frame, - WebKit::WebRect* selection_rect) = 0; + gfx::Rect* 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 @@ -256,7 +259,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 WebKit::WebRect& selection_rect, + virtual void ReportFindInPageSelection(const gfx::Rect& selection_rect, int active_match_ordinal, int request_id) = 0; @@ -361,7 +364,7 @@ class WebFrame { virtual void ClosePage() = 0; // The current scroll offset from the top of frame in pixels. - virtual WebKit::WebSize ScrollOffset() const = 0; + virtual gfx::Size ScrollOffset() const = 0; // Reformats the web frame for printing. |page_size_px| is the page size in // pixels. @@ -369,7 +372,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 WebKit::WebSize& page_size_px, + virtual bool BeginPrint(const gfx::Size& 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 74e74dd..ceca109 100644 --- a/webkit/glue/webframe_impl.cc +++ b/webkit/glue/webframe_impl.cc @@ -137,9 +137,7 @@ 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" @@ -201,9 +199,7 @@ 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"; @@ -939,7 +935,7 @@ void WebFrameImpl::IncreaseMatchCount(int count, int request_id) { frames_scoping_count_ == 0); } -void WebFrameImpl::ReportFindInPageSelection(const WebRect& selection_rect, +void WebFrameImpl::ReportFindInPageSelection(const gfx::Rect& selection_rect, int active_match_ordinal, int request_id) { // Update the UI with the latest selection rect. @@ -962,7 +958,7 @@ bool WebFrameImpl::Find(int request_id, const string16& search_text, const WebFindOptions& options, bool wrap_within_frame, - WebRect* selection_rect) { + gfx::Rect* selection_rect) { WebCore::String webcore_string = webkit_glue::String16ToString(search_text); WebFrameImpl* const main_frame_impl = @@ -1030,10 +1026,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) { - WebRect rect = webkit_glue::IntRectToWebRect( + gfx::Rect rect = webkit_glue::FromIntRect( frame()->view()->convertToContainingWindow(curr_selection_rect)); - rect.x -= frameview()->scrollOffset().width(); - rect.y -= frameview()->scrollOffset().height(); + rect.Offset(-frameview()->scrollOffset().width(), + -frameview()->scrollOffset().height()); *selection_rect = rect; ReportFindInPageSelection(rect, @@ -1278,10 +1274,10 @@ void WebFrameImpl::ScopeStringMatches(int request_id, result_bounds.move(-frameview()->scrollOffset().width(), -frameview()->scrollOffset().height()); ReportFindInPageSelection( - webkit_glue::IntRectToWebRect( + webkit_glue::FromIntRect( frame()->view()->convertToContainingWindow(result_bounds)), - active_match_index_ + 1, - request_id); + active_match_index_ + 1, + request_id); #endif } } @@ -1551,8 +1547,9 @@ void WebFrameImpl::CreateFrameView() { WebCore::FrameView* view; if (is_main_frame) { - IntSize size = webkit_glue::WebSizeToIntSize(webview_impl_->size()); - view = new FrameView(frame_, size); + IntSize initial_size( + webview_impl_->size().width(), webview_impl_->size().height()); + view = new FrameView(frame_, initial_size); } else { view = new FrameView(frame_); } @@ -1597,12 +1594,12 @@ void WebFrameImpl::Layout() { FromFrame(child)->Layout(); } -void WebFrameImpl::Paint(skia::PlatformCanvas* canvas, const WebRect& rect) { +void WebFrameImpl::Paint(skia::PlatformCanvas* canvas, const gfx::Rect& rect) { static StatsRate rendering("WebFramePaintTime"); StatsScope<StatsRate> rendering_scope(rendering); - if (!rect.isEmpty()) { - IntRect dirty_rect(webkit_glue::WebRectToIntRect(rect)); + if (!rect.IsEmpty()) { + IntRect dirty_rect(rect.x(), rect.y(), rect.width(), rect.height()); #if defined(OS_MACOSX) CGContextRef context = canvas->getTopPlatformDevice().GetBitmapContext(); GraphicsContext gc(context); @@ -1878,28 +1875,28 @@ void WebFrameImpl::ClosePage() { frame_->loader()->closeURL(); } -WebSize WebFrameImpl::ScrollOffset() const { +gfx::Size WebFrameImpl::ScrollOffset() const { WebCore::FrameView* view = frameview(); if (view) { WebCore::IntSize s = view->scrollOffset(); - return WebSize(s.width(), s.height()); + return gfx::Size(s.width(), s.height()); } - return WebSize(); + return gfx::Size(); } void WebFrameImpl::SetAllowsScrolling(bool flag) { frame_->view()->setCanHaveScrollbars(flag); } -bool WebFrameImpl::BeginPrint(const WebSize& page_size_px, +bool WebFrameImpl::BeginPrint(const gfx::Size& 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 0d8b876..942c000 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, - WebKit::WebRect* selection_rect); + gfx::Rect* 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 WebKit::WebSize ScrollOffset() const; + virtual gfx::Size ScrollOffset() const; - virtual bool BeginPrint(const WebKit::WebSize& page_size_px, + virtual bool BeginPrint(const gfx::Size& 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 WebKit::WebRect& rect); + void Paint(skia::PlatformCanvas* canvas, const gfx::Rect& 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 WebKit::WebRect& selection_rect, + virtual void ReportFindInPageSelection(const gfx::Rect& selection_rect, int active_match_ordinal, int request_id); diff --git a/webkit/glue/webmediaplayer_delegate.h b/webkit/glue/webmediaplayer_delegate.h index c86b001..7f60851 100644 --- a/webkit/glue/webmediaplayer_delegate.h +++ b/webkit/glue/webmediaplayer_delegate.h @@ -13,9 +13,8 @@ class GURL; -namespace WebKit { -struct WebRect; -struct WebSize; +namespace gfx { +class Rect; } namespace webkit_glue { @@ -44,12 +43,11 @@ class WebMediaPlayerDelegate { virtual float GetMaxTimeSeekable() const = 0; // Methods for painting. - virtual void SetSize(const WebKit::WebSize& size) = 0; + virtual void SetSize(const gfx::Size& size) = 0; // TODO(hclam): Using paint at the moment, maybe we just need to return a // SkiaBitmap? - virtual void Paint(skia::PlatformCanvas *canvas, - const WebKit::WebRect& rect) = 0; + virtual void Paint(skia::PlatformCanvas *canvas, const gfx::Rect& 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 8b2866a..4c8775a 100644 --- a/webkit/glue/webview_delegate.h +++ b/webkit/glue/webview_delegate.h @@ -33,6 +33,11 @@ #include "webkit/glue/webdatasource.h" #include "webkit/glue/webwidget_delegate.h" +namespace gfx { +class Point; +class Rect; +} + namespace webkit_glue { class WebMediaPlayerDelegate; } @@ -40,7 +45,6 @@ class WebMediaPlayerDelegate; namespace WebKit { class WebDragData; struct WebPoint; -struct WebRect; } struct PasswordForm; @@ -161,7 +165,7 @@ class WebViewDelegate : virtual public WebWidgetDelegate { // selection rect is currently located. virtual void ReportFindInPageSelection(int request_id, int active_match_ordinal, - const WebKit::WebRect& selection) { + const gfx::Rect& selection_rect) { } // 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 cac8594..408246b 100644 --- a/webkit/glue/webview_impl.cc +++ b/webkit/glue/webview_impl.cc @@ -121,8 +121,6 @@ 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 @@ -365,7 +363,7 @@ WebViewImpl::WebViewImpl() WTF::initializeThreading(); // set to impossible point so we always get the first mouse pos - last_mouse_position_ = WebPoint(-1, -1); + last_mouse_position_.SetPoint(-1, -1); // the page will take ownership of the various clients page_.reset(new Page(new ChromeClientImpl(this), @@ -408,7 +406,7 @@ void WebViewImpl::MouseMove(const WebMouseEvent& event) { if (!main_frame() || !main_frame()->frameview()) return; - last_mouse_position_ = WebPoint(event.x, event.y); + last_mouse_position_.SetPoint(event.x, event.y); // We call mouseMoved here instead of handleMouseMovedEvent because we need // our ChromeClientImpl to receive changes to the mouse position and @@ -959,18 +957,18 @@ WebFrame* WebViewImpl::GetNextFrameAfter(WebFrame* frame, bool wrap) { return next ? WebFrameImpl::FromFrame(next) : NULL; } -void WebViewImpl::Resize(const WebSize& new_size) { +void WebViewImpl::Resize(const gfx::Size& 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_) { - WebRect damaged_rect(0, 0, size_.width, size_.height); + gfx::Rect damaged_rect(0, 0, size_.width(), size_.height()); delegate_->DidInvalidateRect(this, damaged_rect); } } @@ -995,7 +993,7 @@ void WebViewImpl::Layout() { } } -void WebViewImpl::Paint(skia::PlatformCanvas* canvas, const WebRect& rect) { +void WebViewImpl::Paint(skia::PlatformCanvas* canvas, const gfx::Rect& rect) { WebFrameImpl* webframe = main_frame(); if (webframe) webframe->Paint(canvas, rect); @@ -1250,7 +1248,7 @@ bool WebViewImpl::ImeSetComposition(int string_type, } bool WebViewImpl::ImeUpdateStatus(bool* enable_ime, - WebRect* caret_rect) { + gfx::Rect* 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; @@ -1261,27 +1259,22 @@ 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; - - *caret_rect = webkit_glue::IntRectToWebRect( - view->contentsToWindow(controller->absoluteCaretBounds())); + const IntRect rect(view->contentsToWindow(controller->absoluteCaretBounds())); + caret_rect->SetRect(rect.x(), rect.y(), rect.width(), rect.height()); return true; } @@ -1293,7 +1286,6 @@ void WebViewImpl::SetTextDirection(WebTextDirection direction) { const Frame* focused = GetFocusedWebCoreFrame(); if (!focused) return; - Editor* editor = focused->editor(); if (!editor || !editor->canEdit()) return; @@ -1870,7 +1862,7 @@ void WebViewImpl::RefreshAutofillPopup() { WebWidgetImpl* web_widget = static_cast<WebWidgetImpl*>(autocomplete_popup_->client()); web_widget->delegate()->SetWindowRect( - web_widget, webkit_glue::IntRectToWebRect(new_bounds)); + web_widget, webkit_glue::FromIntRect(new_bounds)); } } diff --git a/webkit/glue/webview_impl.h b/webkit/glue/webview_impl.h index f29c0cc..e52a8d2 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 WebKit::WebSize& new_size); - virtual WebKit::WebSize GetSize() { return size(); } + virtual void Resize(const gfx::Size& new_size); + virtual gfx::Size GetSize() { return size(); } virtual void Layout(); - virtual void Paint(skia::PlatformCanvas* canvas, const WebKit::WebRect& rect); + virtual void Paint(skia::PlatformCanvas* canvas, const gfx::Rect& rect); virtual bool HandleInputEvent(const WebKit::WebInputEvent* input_event); virtual void MouseCaptureLost(); virtual void SetFocus(bool enable); @@ -77,7 +77,7 @@ class WebViewImpl : public WebView, public base::RefCounted<WebViewImpl> { int target_end, const std::wstring& ime_string); virtual bool ImeUpdateStatus(bool* enable_ime, - WebKit::WebRect* caret_rect); + gfx::Rect* caret_rect); virtual void SetTextDirection(WebTextDirection direction); virtual void StopLoading(); virtual void SetBackForwardListSize(int size); @@ -125,9 +125,9 @@ class WebViewImpl : public WebView, public base::RefCounted<WebViewImpl> { // WebViewImpl - const WebKit::WebSize& size() const { return size_; } + const gfx::Size& size() const { return size_; } - const WebKit::WebPoint& last_mouse_down_point() const { + const gfx::Point& last_mouse_down_point() const { return last_mouse_down_point_; } @@ -236,9 +236,9 @@ class WebViewImpl : public WebView, public base::RefCounted<WebViewImpl> { SearchableFormData* CreateSearchableFormDataForFocusedNode(); scoped_refptr<WebViewDelegate> delegate_; - WebKit::WebSize size_; + gfx::Size size_; - WebKit::WebPoint last_mouse_position_; + gfx::Point 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. @@ -301,7 +301,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. - WebKit::WebPoint last_mouse_down_point_; + gfx::Point 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 6653e28..ed38375 100644 --- a/webkit/glue/webwidget.h +++ b/webkit/glue/webwidget.h @@ -8,10 +8,13 @@ #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; @@ -30,10 +33,10 @@ class WebWidget { virtual void Close() = 0; // Called to resize the WebWidget. - virtual void Resize(const WebKit::WebSize& new_size) = 0; + virtual void Resize(const gfx::Size& new_size) = 0; // Returns the current size of the WebWidget. - virtual WebKit::WebSize GetSize() = 0; + virtual gfx::Size GetSize() = 0; // Called to layout the WebWidget. This MUST be called before Paint, and it // may result in calls to WebWidgetDelegate::DidInvalidateRect. @@ -44,8 +47,7 @@ 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 WebKit::WebRect& rect) = 0; + virtual void Paint(skia::PlatformCanvas* canvas, const gfx::Rect& rect) = 0; // Called to inform the WebWidget of an input event. // Returns true if the event has been processed, false otherwise. @@ -64,8 +66,7 @@ class WebWidget { const std::wstring& ime_string) = 0; // Retrieve the status of this widget required by IME APIs. - virtual bool ImeUpdateStatus(bool* enable_ime, - WebKit::WebRect* caret_rect) = 0; + virtual bool ImeUpdateStatus(bool* enable_ime, gfx::Rect* 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 e6d95b0..37f3ff3 100644 --- a/webkit/glue/webwidget_delegate.h +++ b/webkit/glue/webwidget_delegate.h @@ -12,8 +12,12 @@ #include "base/string16.h" #include "webkit/glue/window_open_disposition.h" +namespace gfx { +class Point; +class Rect; +} + namespace WebKit { -struct WebRect; struct WebScreenInfo; } @@ -43,13 +47,12 @@ 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 WebKit::WebRect& rect) = 0; + virtual void DidInvalidateRect(WebWidget* webwidget, const gfx::Rect& 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 WebKit::WebRect& clip_rect) = 0; + const gfx::Rect& 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 @@ -68,7 +71,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 WebKit::WebRect& bounds, + const gfx::Rect& bounds, int item_height, int selected_index, const std::vector<MenuItem>& items) = 0; @@ -90,7 +93,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, WebKit::WebRect* rect) = 0; + virtual void GetWindowRect(WebWidget* webwidget, gfx::Rect* 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 @@ -98,18 +101,15 @@ 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 WebKit::WebRect& rect) = 0; + virtual void SetWindowRect(WebWidget* webwidget, const gfx::Rect& rect) = 0; // Returns the rectangle of the window in which this WebWidget is embeded. - virtual void GetRootWindowRect(WebWidget* webwidget, - WebKit::WebRect* rect) = 0; + virtual void GetRootWindowRect(WebWidget* webwidget, gfx::Rect* 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, - WebKit::WebRect* rect) = 0; + virtual void GetRootWindowResizerRect(WebWidget* webwidget, gfx::Rect* 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 79408fb..0c5f062 100644 --- a/webkit/glue/webwidget_impl.cc +++ b/webkit/glue/webwidget_impl.cc @@ -19,6 +19,7 @@ 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" @@ -33,9 +34,6 @@ using WebKit::WebInputEvent; using WebKit::WebKeyboardEvent; using WebKit::WebMouseEvent; using WebKit::WebMouseWheelEvent; -using WebKit::WebPoint; -using WebKit::WebRect; -using WebKit::WebSize; // WebWidget ---------------------------------------------------------------- @@ -50,7 +48,7 @@ WebWidgetImpl::WebWidgetImpl(WebWidgetDelegate* delegate) : delegate_(delegate), widget_(NULL) { // set to impossible point so we always get the first mouse pos - last_mouse_position_ = WebPoint(-1, -1); + last_mouse_position_.SetPoint(-1, -1); } WebWidgetImpl::~WebWidgetImpl() { @@ -59,7 +57,7 @@ WebWidgetImpl::~WebWidgetImpl() { } void WebWidgetImpl::Init(WebCore::FramelessScrollView* widget, - const WebRect& bounds) { + const gfx::Rect& bounds) { widget_ = widget; widget_->setClient(this); @@ -70,7 +68,7 @@ void WebWidgetImpl::Init(WebCore::FramelessScrollView* widget, } void WebWidgetImpl::InitWithItems(WebCore::FramelessScrollView* widget, - const WebRect& bounds, + const gfx::Rect& bounds, int item_height, int selected_index, const std::vector<MenuItem>& items) { @@ -85,9 +83,10 @@ 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_ = WebPoint(event.x, event.y); + if (event.x != last_mouse_position_.x() || + event.y != last_mouse_position_.y()) { + last_mouse_position_.SetPoint(event.x, event.y); + widget_->handleMouseMoveEvent(MakePlatformMouseEvent(widget_, event)); } } @@ -124,18 +123,18 @@ void WebWidgetImpl::Close() { Release(); // Balances AddRef from WebWidget::Create } -void WebWidgetImpl::Resize(const WebSize& new_size) { +void WebWidgetImpl::Resize(const gfx::Size& 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_) { - WebRect damaged_rect(0, 0, size_.width, size_.height); + gfx::Rect damaged_rect(0, 0, size_.width(), size_.height()); delegate_->DidInvalidateRect(this, damaged_rect); } } @@ -143,11 +142,11 @@ void WebWidgetImpl::Resize(const WebSize& new_size) { void WebWidgetImpl::Layout() { } -void WebWidgetImpl::Paint(skia::PlatformCanvas* canvas, const WebRect& rect) { +void WebWidgetImpl::Paint(skia::PlatformCanvas* canvas, const gfx::Rect& rect) { if (!widget_) return; - if (!rect.isEmpty()) { + if (!rect.IsEmpty()) { #if defined(OS_MACOSX) CGContextRef context = canvas->getTopPlatformDevice().GetBitmapContext(); GraphicsContext gc(context); @@ -157,7 +156,9 @@ void WebWidgetImpl::Paint(skia::PlatformCanvas* canvas, const WebRect& rect) { GraphicsContext gc(reinterpret_cast<PlatformGraphicsContext*>(&context)); #endif - widget_->paint(&gc, webkit_glue::WebRectToIntRect(rect)); + IntRect dirty_rect(rect.x(), rect.y(), rect.width(), rect.height()); + + widget_->paint(&gc, dirty_rect); } } @@ -216,7 +217,7 @@ bool WebWidgetImpl::ImeSetComposition(int string_type, } bool WebWidgetImpl::ImeUpdateStatus(bool* enable_ime, - WebRect* caret_rect) { + gfx::Rect* caret_rect) { return false; } @@ -234,8 +235,7 @@ void WebWidgetImpl::repaint(const WebCore::IntRect& paint_rect, if (!content_changed || paint_rect.isEmpty()) return; if (delegate_) - delegate_->DidInvalidateRect(this, - webkit_glue::IntRectToWebRect(paint_rect)); + delegate_->DidInvalidateRect(this, webkit_glue::FromIntRect(paint_rect)); } void WebWidgetImpl::scroll(const WebCore::IntSize& scroll_delta, @@ -244,8 +244,7 @@ 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::IntRectToWebRect(clip_rect)); + delegate_->DidScrollRect(this, dx, dy, webkit_glue::FromIntRect(clip_rect)); } } diff --git a/webkit/glue/webwidget_impl.h b/webkit/glue/webwidget_impl.h index 548952b..5cf6cfe 100644 --- a/webkit/glue/webwidget_impl.h +++ b/webkit/glue/webwidget_impl.h @@ -9,9 +9,8 @@ #include "base/compiler_specific.h" #include "base/ref_counted.h" #include "base/gfx/native_widget_types.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 "base/gfx/point.h" +#include "base/gfx/size.h" #include "webkit/glue/webwidget.h" #include "FramelessScrollViewClient.h" @@ -41,11 +40,10 @@ class WebWidgetImpl : public WebWidget, public: // WebWidget virtual void Close(); - virtual void Resize(const WebKit::WebSize& new_size); - virtual WebKit::WebSize GetSize() { return size(); } + virtual void Resize(const gfx::Size& new_size); + virtual gfx::Size GetSize() { return size(); } virtual void Layout(); - virtual void Paint(skia::PlatformCanvas* canvas, - const WebKit::WebRect& rect); + virtual void Paint(skia::PlatformCanvas* canvas, const gfx::Rect& rect); virtual bool HandleInputEvent(const WebKit::WebInputEvent* input_event); virtual void MouseCaptureLost(); virtual void SetFocus(bool enable); @@ -55,19 +53,18 @@ class WebWidgetImpl : public WebWidget, int target_end, const std::wstring& ime_string); virtual bool ImeUpdateStatus(bool* enable_ime, - WebKit::WebRect* caret_rect); + gfx::Rect* caret_rect); virtual void SetTextDirection(WebTextDirection direction); // WebWidgetImpl - void Init(WebCore::FramelessScrollView* widget, - const WebKit::WebRect& bounds); + void Init(WebCore::FramelessScrollView* widget, const gfx::Rect& bounds); void InitWithItems(WebCore::FramelessScrollView* widget, - const WebKit::WebRect& bounds, + const gfx::Rect& bounds, int item_height, int selected_index, const std::vector<MenuItem>& items); - const WebKit::WebSize& size() const { return size_; } + const gfx::Size& size() const { return size_; } WebWidgetDelegate* delegate() { return delegate_; @@ -114,9 +111,9 @@ class WebWidgetImpl : public WebWidget, #endif WebWidgetDelegate* delegate_; - WebKit::WebSize size_; + gfx::Size size_; - WebKit::WebPoint last_mouse_position_; + gfx::Point 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 9ae7a80..039e34f3 100755 --- a/webkit/tools/test_shell/mac/test_webview_delegate.mm +++ b/webkit/tools/test_shell/mac/test_webview_delegate.mm @@ -7,15 +7,12 @@ #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 @@ -124,7 +121,7 @@ void TestWebViewDelegate::Show(WebWidget* webview, // Display a HTML select menu. void TestWebViewDelegate::ShowWithItems( WebWidget* webview, - const WebRect& bounds, + const gfx::Rect& bounds, int item_height, int selected_index, const std::vector<MenuItem>& items) { @@ -144,9 +141,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 @@ -229,7 +226,7 @@ void TestWebViewDelegate::SetCursor(WebWidget* webwidget, } void TestWebViewDelegate::GetWindowRect(WebWidget* webwidget, - WebRect* out_rect) { + gfx::Rect* out_rect) { DCHECK(out_rect); if (WebWidgetHost* host = GetHostForWidget(webwidget)) { NSView *view = host->view_handle(); @@ -239,7 +236,7 @@ void TestWebViewDelegate::GetWindowRect(WebWidget* webwidget, } void TestWebViewDelegate::SetWindowRect(WebWidget* webwidget, - const WebRect& rect) { + const gfx::Rect& rect) { // TODO: Mac window movement if (webwidget == shell_->webView()) { // ignored @@ -250,7 +247,7 @@ void TestWebViewDelegate::SetWindowRect(WebWidget* webwidget, } void TestWebViewDelegate::GetRootWindowRect(WebWidget* webwidget, - WebRect* out_rect) { + gfx::Rect* out_rect) { if (WebWidgetHost* host = GetHostForWidget(webwidget)) { NSView *view = host->view_handle(); NSRect rect = [[[view window] contentView] frame]; @@ -263,7 +260,7 @@ void TestWebViewDelegate::GetRootWindowRect(WebWidget* webwidget, @end void TestWebViewDelegate::GetRootWindowResizerRect(WebWidget* webwidget, - WebRect* out_rect) { + gfx::Rect* 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 13f8332..7c6c949 100644 --- a/webkit/tools/test_shell/mac/webview_host.mm +++ b/webkit/tools/test_shell/mac/webview_host.mm @@ -10,12 +10,9 @@ #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" -using WebKit::WebSize; - -// static +/*static*/ WebViewHost* WebViewHost::Create(NSView* parent_view, WebViewDelegate* delegate, const WebPreferences& prefs) { @@ -34,8 +31,8 @@ WebViewHost* WebViewHost::Create(NSView* parent_view, [host->view_ release]; host->webwidget_ = WebView::Create(delegate, prefs); - host->webwidget_->Resize(WebSize(content_rect.size.width, - content_rect.size.height)); + host->webwidget_->Resize(gfx::Size(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 a24928a..bccb584 100644 --- a/webkit/tools/test_shell/mac/webwidget_host.mm +++ b/webkit/tools/test_shell/mac/webwidget_host.mm @@ -14,7 +14,6 @@ #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" @@ -25,7 +24,6 @@ using WebKit::WebMouseEvent; using WebKit::WebMouseWheelEvent; using WebKit::WebScreenInfo; using WebKit::WebScreenInfoFactory; -using WebKit::WebSize; /*static*/ WebWidgetHost* WebWidgetHost::Create(NSView* parent_view, @@ -41,8 +39,8 @@ WebWidgetHost* WebWidgetHost::Create(NSView* parent_view, // win_util::SetWindowUserData(host->hwnd_, host); host->webwidget_ = WebWidget::Create(delegate); - host->webwidget_->Resize(WebSize(content_rect.size.width, - content_rect.size.height)); + host->webwidget_->Resize(gfx::Size(content_rect.size.width, + content_rect.size.height)); return host; } @@ -227,7 +225,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(WebSize(rect.width(), rect.height())); + webwidget_->Resize(gfx::Size(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 9ba64e0..af7a662 100755 --- a/webkit/tools/test_shell/test_webview_delegate.cc +++ b/webkit/tools/test_shell/test_webview_delegate.cc @@ -43,9 +43,7 @@ #endif using WebKit::WebDragData; -using WebKit::WebRect; using WebKit::WebScreenInfo; -using WebKit::WebSize; using WebKit::WebString; namespace { @@ -717,13 +715,13 @@ gfx::NativeViewId TestWebViewDelegate::GetContainingView(WebWidget* webwidget) { } void TestWebViewDelegate::DidInvalidateRect(WebWidget* webwidget, - const WebRect& rect) { + const gfx::Rect& rect) { if (WebWidgetHost* host = GetHostForWidget(webwidget)) host->DidInvalidateRect(rect); } void TestWebViewDelegate::DidScrollRect(WebWidget* webwidget, int dx, int dy, - const WebRect& clip_rect) { + const gfx::Rect& 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 e1692fe..94e1f83 100644 --- a/webkit/tools/test_shell/test_webview_delegate.h +++ b/webkit/tools/test_shell/test_webview_delegate.h @@ -212,13 +212,12 @@ class TestWebViewDelegate : public base::RefCounted<TestWebViewDelegate>, // WebWidgetDelegate virtual gfx::NativeViewId GetContainingView(WebWidget* webwidget); - virtual void DidInvalidateRect(WebWidget* webwidget, - const WebKit::WebRect& rect); + virtual void DidInvalidateRect(WebWidget* webwidget, const gfx::Rect& rect); virtual void DidScrollRect(WebWidget* webwidget, int dx, int dy, - const WebKit::WebRect& clip_rect); + const gfx::Rect& clip_rect); virtual void Show(WebWidget* webview, WindowOpenDisposition disposition); virtual void ShowWithItems(WebWidget* webwidget, - const WebKit::WebRect& bounds, + const gfx::Rect& bounds, int item_height, int selected_index, const std::vector<MenuItem>& items); @@ -227,12 +226,10 @@ class TestWebViewDelegate : public base::RefCounted<TestWebViewDelegate>, virtual void Blur(WebWidget* webwidget); virtual void SetCursor(WebWidget* webwidget, const WebCursor& cursor); - 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 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 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 ef92a3b..bce7619 100755 --- a/webkit/tools/test_shell/test_webview_delegate_gtk.cc +++ b/webkit/tools/test_shell/test_webview_delegate_gtk.cc @@ -14,7 +14,6 @@ #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" @@ -30,10 +29,9 @@ #include "webkit/tools/test_shell/test_navigation_controller.h" #include "webkit/tools/test_shell/test_shell.h" -using WebKit::WebRect; - namespace { + enum SelectionClipboardType { TEXT_HTML, PLAIN_TEXT, @@ -116,7 +114,7 @@ void TestWebViewDelegate::Show(WebWidget* webwidget, } void TestWebViewDelegate::ShowWithItems(WebWidget* webwidget, - const WebRect& bounds, + const gfx::Rect& bounds, int item_height, int selected_index, const std::vector<MenuItem>& items) { @@ -161,7 +159,7 @@ void TestWebViewDelegate::SetCursor(WebWidget* webwidget, } void TestWebViewDelegate::GetWindowRect(WebWidget* webwidget, - WebRect* out_rect) { + gfx::Rect* out_rect) { DCHECK(out_rect); WebWidgetHost* host = GetHostForWidget(webwidget); GtkWidget* drawing_area = host->view_handle(); @@ -173,13 +171,12 @@ void TestWebViewDelegate::GetWindowRect(WebWidget* webwidget, x += vbox->allocation.x + drawing_area->allocation.x; y += vbox->allocation.y + drawing_area->allocation.y; - *out_rect = WebRect(x, y, - drawing_area->allocation.width, - drawing_area->allocation.height); + out_rect->SetRect(x, y, drawing_area->allocation.width, + drawing_area->allocation.height); } void TestWebViewDelegate::SetWindowRect(WebWidget* webwidget, - const WebRect& rect) { + const gfx::Rect& rect) { if (webwidget == shell_->webView()) { // ignored } else if (webwidget == shell_->popup()) { @@ -187,13 +184,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, - WebRect* out_rect) { + gfx::Rect* 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 @@ -205,14 +202,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 = WebRect(x, y, width, height); + out_rect->SetRect(x, y, width, height); } } void TestWebViewDelegate::GetRootWindowResizerRect(WebWidget* webwidget, - WebRect* out_rect) { + gfx::Rect* out_rect) { // Not necessary on Linux. - *out_rect = WebRect(); + *out_rect = gfx::Rect(); } 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 125c1b2..28c5034 100755 --- a/webkit/tools/test_shell/test_webview_delegate_win.cc +++ b/webkit/tools/test_shell/test_webview_delegate_win.cc @@ -19,7 +19,6 @@ #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" @@ -36,8 +35,6 @@ #include "webkit/tools/test_shell/test_navigation_controller.h" #include "webkit/tools/test_shell/test_shell.h" -using WebKit::WebRect; - // WebViewDelegate ----------------------------------------------------------- TestWebViewDelegate::~TestWebViewDelegate() { @@ -82,7 +79,7 @@ void TestWebViewDelegate::Show(WebWidget* webwidget, WindowOpenDisposition) { } void TestWebViewDelegate::ShowWithItems(WebWidget* webwidget, - const WebRect& bounds, + const gfx::Rect& bounds, int item_height, int selected_index, const std::vector<MenuItem>& items) { @@ -107,7 +104,7 @@ void TestWebViewDelegate::SetCursor(WebWidget* webwidget, } void TestWebViewDelegate::GetWindowRect(WebWidget* webwidget, - WebRect* out_rect) { + gfx::Rect* out_rect) { if (WebWidgetHost* host = GetHostForWidget(webwidget)) { RECT rect; ::GetWindowRect(host->view_handle(), &rect); @@ -116,17 +113,17 @@ void TestWebViewDelegate::GetWindowRect(WebWidget* webwidget, } void TestWebViewDelegate::SetWindowRect(WebWidget* webwidget, - const WebRect& rect) { + const gfx::Rect& 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, - WebRect* out_rect) { + gfx::Rect* out_rect) { if (WebWidgetHost* host = GetHostForWidget(webwidget)) { RECT rect; HWND root_window = ::GetAncestor(host->view_handle(), GA_ROOT); @@ -136,7 +133,7 @@ void TestWebViewDelegate::GetRootWindowRect(WebWidget* webwidget, } void TestWebViewDelegate::GetRootWindowResizerRect(WebWidget* webwidget, - WebRect* out_rect) { + gfx::Rect* 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 5645da7..08dd9bc 100644 --- a/webkit/tools/test_shell/webwidget_host_gtk.cc +++ b/webkit/tools/test_shell/webwidget_host_gtk.cc @@ -16,7 +16,6 @@ #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" @@ -26,7 +25,6 @@ using WebKit::WebMouseEvent; using WebKit::WebMouseWheelEvent; using WebKit::WebScreenInfo; using WebKit::WebScreenInfoFactory; -using WebKit::WebSize; namespace { @@ -124,14 +122,14 @@ class WebWidgetHostGtkWidget { static void HandleSizeAllocate(GtkWidget* widget, GtkAllocation* allocation, WebWidgetHost* host) { - host->Resize(WebSize(allocation->width, allocation->height)); + host->Resize(gfx::Size(allocation->width, allocation->height)); } // Size, position, or stacking of the GdkWindow changed. static gboolean HandleConfigure(GtkWidget* widget, GdkEventConfigure* config, WebWidgetHost* host) { - host->Resize(WebSize(config->width, config->height)); + host->Resize(gfx::Size(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 c5464ef..9db06c0 100644 --- a/webkit/tools/test_shell/webwidget_host_win.cc +++ b/webkit/tools/test_shell/webwidget_host_win.cc @@ -11,7 +11,6 @@ #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" @@ -24,7 +23,6 @@ using WebKit::WebMouseEvent; using WebKit::WebMouseWheelEvent; using WebKit::WebScreenInfo; using WebKit::WebScreenInfoFactory; -using WebKit::WebSize; static const wchar_t kWindowClassName[] = L"WebWidgetHost"; @@ -287,7 +285,7 @@ void WebWidgetHost::Resize(LPARAM lparam) { // Force an entire re-paint. TODO(darin): Maybe reuse this memory buffer. DiscardBackingStore(); - webwidget_->Resize(WebSize(LOWORD(lparam), HIWORD(lparam))); + webwidget_->Resize(gfx::Size(LOWORD(lparam), HIWORD(lparam))); } void WebWidgetHost::MouseEvent(UINT message, WPARAM wparam, LPARAM lparam) { |