summaryrefslogtreecommitdiffstats
path: root/chrome/views/widget
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/views/widget')
-rw-r--r--chrome/views/widget/root_view.cc13
-rw-r--r--chrome/views/widget/root_view.h4
-rw-r--r--chrome/views/widget/root_view_gtk.cc16
-rw-r--r--chrome/views/widget/root_view_win.cc7
-rw-r--r--chrome/views/widget/widget_gtk.cc8
5 files changed, 23 insertions, 25 deletions
diff --git a/chrome/views/widget/root_view.cc b/chrome/views/widget/root_view.cc
index 5e6bcc8..672a210 100644
--- a/chrome/views/widget/root_view.cc
+++ b/chrome/views/widget/root_view.cc
@@ -150,9 +150,13 @@ void RootView::ProcessPaint(ChromeCanvas* canvas) {
ScopedProcessingPaint processing_paint(&is_processing_paint_);
#endif
+#if defined(OS_WIN)
// Clip the invalid rect to our bounds. If a view is in a scrollview
// it could be a lot larger
- invalid_rect_ = GetScheduledPaintRectConstrainedToSize();
+ invalid_rect_ = gfx::Rect(GetScheduledPaintRectConstrainedToSize());
+#else
+ NOTIMPLEMENTED();
+#endif
if (invalid_rect_.IsEmpty())
return;
@@ -206,13 +210,6 @@ const gfx::Rect& RootView::GetScheduledPaintRect() {
return invalid_rect_;
}
-gfx::Rect RootView::GetScheduledPaintRectConstrainedToSize() {
- if (invalid_rect_.IsEmpty())
- return invalid_rect_;
-
- return invalid_rect_.Intersect(GetLocalBounds(true));
-}
-
/////////////////////////////////////////////////////////////////////////////
//
// RootView - tree
diff --git a/chrome/views/widget/root_view.h b/chrome/views/widget/root_view.h
index 0c9f59a..f7ad674 100644
--- a/chrome/views/widget/root_view.h
+++ b/chrome/views/widget/root_view.h
@@ -82,8 +82,10 @@ class RootView : public View,
// Invoked by the Widget to discover what rectangle should be painted.
const gfx::Rect& GetScheduledPaintRect();
+#if defined(OS_WIN)
// Returns the region scheduled to paint clipped to the RootViews bounds.
- gfx::Rect GetScheduledPaintRectConstrainedToSize();
+ RECT GetScheduledPaintRectConstrainedToSize();
+#endif
// Tree functions
diff --git a/chrome/views/widget/root_view_gtk.cc b/chrome/views/widget/root_view_gtk.cc
index 115b37d..1c7fe9c 100644
--- a/chrome/views/widget/root_view_gtk.cc
+++ b/chrome/views/widget/root_view_gtk.cc
@@ -10,22 +10,24 @@
namespace views {
+// TODO(port): Port GetScheduledPaintRectConstrainedToSize() to not use RECT.
+
void RootView::UpdateCursor(const MouseEvent& e) {
NOTIMPLEMENTED();
}
+// TODO(port): Port OnPaint() to not use HWNDs in its public interface.
void RootView::OnPaint(GdkEventExpose* event) {
ChromeCanvasPaint canvas(event);
+ canvas.FillRectInt(SK_ColorRED, 5, 5, 10, 10);
+ canvas.FillRectInt(SK_ColorGREEN, 25, 5, 10, 10);
+ canvas.FillRectInt(SK_ColorBLUE, 45, 5, 10, 10);
if (!canvas.isEmpty()) {
- SchedulePaint(gfx::Rect(canvas.rectangle()), false);
- if (NeedsPainting(false)) {
+ // const PAINTSTRUCT& ps = canvas.paintStruct();
+ // SchedulePaint(gfx::Rect(ps.rcPaint), false);
+ if (NeedsPainting(false))
ProcessPaint(&canvas);
-
- canvas.FillRectInt(SK_ColorRED, 5, 5, 10, 10);
- canvas.FillRectInt(SK_ColorGREEN, 25, 5, 10, 10);
- canvas.FillRectInt(SK_ColorBLUE, 45, 5, 10, 10);
- }
}
}
diff --git a/chrome/views/widget/root_view_win.cc b/chrome/views/widget/root_view_win.cc
index 4aa95ed7..b4641b4 100644
--- a/chrome/views/widget/root_view_win.cc
+++ b/chrome/views/widget/root_view_win.cc
@@ -37,15 +37,14 @@ void RootView::UpdateCursor(const MouseEvent& e) {
}
void RootView::OnPaint(HWND hwnd) {
- gfx::Rect original_dirty_region = GetScheduledPaintRectConstrainedToSize();
- if (!original_dirty_region.empty()) {
+ RECT original_dirty_region = GetScheduledPaintRectConstrainedToSize();
+ if (!IsRectEmpty(&original_dirty_region)) {
// Invoke InvalidateRect so that the dirty region of the window includes the
// region we need to paint. If we didn't do this and the region didn't
// include the dirty region, ProcessPaint would incorrectly mark everything
// as clean. This can happen if a WM_PAINT is generated by the system before
// the InvokeLater schedule by RootView is processed.
- RECT win_version = original_dirty_region.ToRECT();
- InvalidateRect(hwnd, &win_version, FALSE);
+ InvalidateRect(hwnd, &original_dirty_region, FALSE);
}
ChromeCanvasPaint canvas(hwnd);
if (!canvas.isEmpty()) {
diff --git a/chrome/views/widget/widget_gtk.cc b/chrome/views/widget/widget_gtk.cc
index a2a7b35..83d7766 100644
--- a/chrome/views/widget/widget_gtk.cc
+++ b/chrome/views/widget/widget_gtk.cc
@@ -87,11 +87,7 @@ void WidgetGtk::SetContentsView(View* view) {
root_view_->RemoveAllChildViews(true);
root_view_->AddChildView(view);
- // TODO(erg): Terrible hack to work around lack of real sizing mechanics for
- // now.
- root_view_->SetBounds(0, 0, 100, 100);
- root_view_->Layout();
- root_view_->SchedulePaint();
+ // TODO(erg): More windowy stuff here.
NOTIMPLEMENTED();
}
@@ -147,7 +143,9 @@ bool WidgetGtk::GetAccelerator(int cmd_id, Accelerator* accelerator) {
return false;
}
+
gboolean WidgetGtk::OnPaint(GtkWidget* widget, GdkEventExpose* event) {
+ // Do something here with a chrome canvas?
root_view_->OnPaint(event);
return true;
}