diff options
author | tc@google.com <tc@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-10-14 21:15:23 +0000 |
---|---|---|
committer | tc@google.com <tc@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-10-14 21:15:23 +0000 |
commit | 99304a704db0fbb0f65dea844da7422a21763d58 (patch) | |
tree | 3a58c46272d7a36e690df2040c47d028118d82b1 | |
parent | 96b667d273c25e55150785848942c51f1a98851b (diff) | |
download | chromium_src-99304a704db0fbb0f65dea844da7422a21763d58.zip chromium_src-99304a704db0fbb0f65dea844da7422a21763d58.tar.gz chromium_src-99304a704db0fbb0f65dea844da7422a21763d58.tar.bz2 |
get webframe_impl.cc to compile on linux
Includes changes from http://codereview.chromium.org/7244 by icefox (Torchmobile Inc.)
Review URL: http://codereview.chromium.org/7319
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@3366 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | base/gfx/bitmap_platform_device_linux.cc | 6 | ||||
-rw-r--r-- | base/gfx/bitmap_platform_device_linux.h | 3 | ||||
-rw-r--r-- | base/gfx/rect.cc | 15 | ||||
-rw-r--r-- | base/gfx/rect.h | 8 | ||||
-rw-r--r-- | webkit/glue/SConscript | 2 | ||||
-rw-r--r-- | webkit/glue/webframe_impl.cc | 33 | ||||
-rw-r--r-- | webkit/glue/webframe_impl.h | 20 |
7 files changed, 68 insertions, 19 deletions
diff --git a/base/gfx/bitmap_platform_device_linux.cc b/base/gfx/bitmap_platform_device_linux.cc index 1211a15..171f6b9 100644 --- a/base/gfx/bitmap_platform_device_linux.cc +++ b/base/gfx/bitmap_platform_device_linux.cc @@ -38,6 +38,12 @@ BitmapPlatformDeviceLinux::BitmapPlatformDeviceLinux(const SkBitmap& bitmap) : PlatformDeviceLinux(bitmap) { } +BitmapPlatformDeviceLinux::BitmapPlatformDeviceLinux( + const BitmapPlatformDeviceLinux& other) + : PlatformDeviceLinux(const_cast<BitmapPlatformDeviceLinux&>( + other).accessBitmap(true)) { +} + BitmapPlatformDeviceLinux::~BitmapPlatformDeviceLinux() { } diff --git a/base/gfx/bitmap_platform_device_linux.h b/base/gfx/bitmap_platform_device_linux.h index 2bb5a24..f459d42 100644 --- a/base/gfx/bitmap_platform_device_linux.h +++ b/base/gfx/bitmap_platform_device_linux.h @@ -24,6 +24,9 @@ class BitmapPlatformDeviceLinux : public PlatformDeviceLinux { /// the Windows and Mac versions of this class do. BitmapPlatformDeviceLinux(const SkBitmap& other); virtual ~BitmapPlatformDeviceLinux(); + + // A stub copy constructor. Needs to be properly implemented. + BitmapPlatformDeviceLinux(const BitmapPlatformDeviceLinux& other); }; } // namespace gfx diff --git a/base/gfx/rect.cc b/base/gfx/rect.cc index b7e2942..0f9708c 100644 --- a/base/gfx/rect.cc +++ b/base/gfx/rect.cc @@ -8,6 +8,8 @@ #include <windows.h> #elif defined(OS_MACOSX) #include <CoreGraphics/CGGeometry.h> +#elif defined(OS_LINUX) +#include <gdk/gdk.h> #endif #include "base/logging.h" @@ -68,6 +70,19 @@ Rect& Rect::operator=(const CGRect& r) { set_height(r.size.height); return *this; } +#elif defined(OS_LINUX) +Rect::Rect(const GdkRectangle& r) + : origin_(r.x, r.y) { + set_width(r.width); + set_height(r.height); +} + +Rect& Rect::operator=(const GdkRectangle& r) { + origin_.SetPoint(r.x, r.y); + set_width(r.width); + set_height(r.height); + return *this; +} #endif void Rect::set_width(int width) { diff --git a/base/gfx/rect.h b/base/gfx/rect.h index 963470a..a7a3d9c 100644 --- a/base/gfx/rect.h +++ b/base/gfx/rect.h @@ -17,6 +17,10 @@ #if defined(OS_WIN) typedef struct tagRECT RECT; +#elif defined(OS_LINUX) +// It's wrong to hide GDK stuff behind OS_LINUX, but until we have a different +// linux target, this is less complex. +typedef struct _GdkRectangle GdkRectangle; #endif namespace gfx { @@ -30,6 +34,8 @@ class Rect { explicit Rect(const RECT& r); #elif defined(OS_MACOSX) explicit Rect(const CGRect& r); +#elif defined(OS_LINUX) + explicit Rect(const GdkRectangle& r); #endif Rect(const gfx::Point& origin, const gfx::Size& size); @@ -39,6 +45,8 @@ class Rect { Rect& operator=(const RECT& r); #elif defined(OS_MACOSX) Rect& operator=(const CGRect& r); +#elif defined(OS_LINUX) + Rect& operator=(const GdkRectangle& r); #endif int x() const { return origin_.x(); } diff --git a/webkit/glue/SConscript b/webkit/glue/SConscript index f3718fc..b5312d8 100644 --- a/webkit/glue/SConscript +++ b/webkit/glue/SConscript @@ -52,6 +52,7 @@ input_files = [ 'webdatasource_impl.cc', 'webdocumentloader_impl.cc', 'weberror_impl.cc', + 'webframe_impl.cc', 'webframeloaderclient_impl.cc', 'webhistoryitem_impl.cc', 'webkit_glue.cc', @@ -79,7 +80,6 @@ if env['PLATFORM'] == 'win32': 'plugins/webplugin_delegate_impl.cc', 'resource_handle_win.cc', 'webdropdata.cc', - 'webframe_impl.cc', 'webinputevent_win.cc', 'webplugin_impl.cc', 'webview_impl.cc', diff --git a/webkit/glue/webframe_impl.cc b/webkit/glue/webframe_impl.cc index fd3ceb1..accc174 100644 --- a/webkit/glue/webframe_impl.cc +++ b/webkit/glue/webframe_impl.cc @@ -147,6 +147,10 @@ #include "webkit/port/page/ChromeClientWin.h" #include "webkit/port/platform/WidgetClientWin.h" +#if defined(OS_LINUX) +#include <gdk/gdk.h> +#endif + using WebCore::ChromeClientWin; using WebCore::Color; using WebCore::Document; @@ -244,7 +248,6 @@ static void FrameContentAsPlainText(int max_chars, Frame* frame, // Recursively walk the children. FrameTree* frame_tree = frame->tree(); - Frame* cur_child = frame_tree->firstChild(); for (Frame* cur_child = frame_tree->firstChild(); cur_child; cur_child = cur_child->tree()->nextSibling()) { // Make sure the frame separator won't fill up the buffer, and give up if @@ -277,13 +280,13 @@ MSVC_POP_WARNING() allows_scrolling_(true), margin_width_(-1), margin_height_(-1), - last_match_count_(-1), - total_matchcount_(-1), inspected_node_(NULL), active_tickmark_frame_(NULL), active_tickmark_(WidgetClientWin::kNoTickmark), locating_active_rect_(false), last_active_range_(NULL), + last_match_count_(-1), + total_matchcount_(-1), frames_scoping_count_(-1), scoping_complete_(false), next_invalidate_after_(0), @@ -723,10 +726,10 @@ void WebFrameImpl::GetContentAsPlainText(int max_chars, void WebFrameImpl::InvalidateArea(AreaToInvalidate area) { ASSERT(frame() && frame()->view()); - FrameView* view = frame()->view(); - #if defined(OS_WIN) // TODO(pinkerton): Fix Mac invalidation to be more like Win ScrollView + FrameView* view = frame()->view(); + if ((area & INVALIDATE_ALL) == INVALIDATE_ALL) { view->addToDirtyRegion(view->frameGeometry()); } else { @@ -752,10 +755,10 @@ void WebFrameImpl::InvalidateArea(AreaToInvalidate area) { void WebFrameImpl::InvalidateTickmark(RefPtr<WebCore::Range> tickmark) { ASSERT(frame() && frame()->view()); - FrameView* view = frame()->view(); - #if defined(OS_WIN) // TODO(pinkerton): Fix Mac invalidation to be more like Win ScrollView + FrameView* view = frame()->view(); + IntRect pos = tickmark->boundingBox(); pos.move(-view->contentsX(), -view->contentsY()); view->addToDirtyRegion(pos); @@ -1491,6 +1494,7 @@ void WebFrameImpl::Paint(gfx::PlatformCanvas* canvas, const gfx::Rect& rect) { } } +// TODO(tc): Merge these as they are almost identical across platforms. #if defined(OS_WIN) gfx::BitmapPlatformDevice WebFrameImpl::CaptureImage(bool scroll_to_zero) { // Must layout before painting. @@ -1527,7 +1531,20 @@ gfx::BitmapPlatformDevice WebFrameImpl::CaptureImage(bool scroll_to_zero) { } #else gfx::BitmapPlatformDevice WebFrameImpl::CaptureImage(bool scroll_to_zero) { - NOTIMPLEMENTED(); + // Must layout before painting. + Layout(); + + gfx::PlatformCanvasLinux canvas(frameview()->width(), frameview()->height(), + true); + PlatformContextSkia context(&canvas); + + GraphicsContext gc(reinterpret_cast<PlatformGraphicsContext*>(&context)); + frameview()->paint(&gc, IntRect(0, 0, frameview()->width(), + frameview()->height())); + + gfx::BitmapPlatformDevice& device = + static_cast<gfx::BitmapPlatformDevice&>(canvas.getTopPlatformDevice()); + return device; } #endif diff --git a/webkit/glue/webframe_impl.h b/webkit/glue/webframe_impl.h index 61751cb..fd887d5 100644 --- a/webkit/glue/webframe_impl.h +++ b/webkit/glue/webframe_impl.h @@ -299,6 +299,10 @@ class WebFrameImpl : public WebFrame { WebFrameLoaderClient frame_loader_client_; + // This is a factory for creating cancelable tasks for this frame that run + // asynchronously in order to scope string matches during a find operation. + ScopedRunnableMethodFactory<WebFrameImpl> scope_matches_factory_; + // Holding a reference back to the WebViewImpl is necessary to ensure that // its HWND is not destroyed before all of the WebCore::Widgets, which refer // to the WebViewImpl's HWND as their containingWindow. However, this ref @@ -331,12 +335,16 @@ class WebFrameImpl : public WebFrame { // Handling requests from TextInputController on this frame. scoped_ptr<WebTextInputImpl> webtextinput_impl_; + // The node selected in the web inspector. Used for highlighting it on the page. + WebCore::Node* inspected_node_; + // This vector maintains a list of Ranges representing locations for search // string matches that were found in the frame during a FindInPage operation. Vector<RefPtr<WebCore::Range> > tickmarks_; - // The node selected in the web inspector. Used for highlighting it on the page. - WebCore::Node* inspected_node_; + // A way for the main frame to keep track of which frame has an active + // tickmark. Should be NULL for all other frames. + WebFrameImpl* active_tickmark_frame_; // The index of the active tickmark for the current frame. size_t active_tickmark_; @@ -381,10 +389,6 @@ class WebFrameImpl : public WebFrame { // (on the main frame only). It should be -1 for all other frames. int total_matchcount_; - // A way for the main frame to keep track of which frame has an active - // tickmark. Should be NULL for all other frames. - WebFrameImpl* active_tickmark_frame_; - // This variable keeps a cumulative total of how many frames are currently // scoping, and is incremented/decremented on the main frame only. // It should be -1 for all other frames. @@ -398,10 +402,6 @@ class WebFrameImpl : public WebFrame { // and the frame area. int next_invalidate_after_; - // This is a factory for creating cancelable tasks for this frame that run - // asynchronously in order to scope string matches during a find operation. - ScopedRunnableMethodFactory<WebFrameImpl> scope_matches_factory_; - private: // A bit mask specifying area of the frame to invalidate. enum AreaToInvalidate { |