WebCore:
2008-10-02 David Hyatt <hyatt@apple.com>
https://bugs.webkit.org/show_bug.cgi?id=21328
Make widget invalidation more cross-platform.
(1) Make invalidateRect a pure virtual function on Widget. All leaf widgets must now implement this function.
(2) Scrollbars now send invalidations through the ScrollbarClient. windowClipRect on ScrollbarClient has been removed and replaced with this invalidation call.
This allows all scrollbar invalidations to go through the render tree so that transforms and reflections will be respected.
(3) Plugins now have the native window invalidation code for windowed plugins. Windowless plugins do a repaintRectangle on the plugin's renderer.
(4) FrameViews now do a repaintRectangle on their owner element's renderer.
Reviewed by Sam Weinig
* WebCore.base.exp:
* page/FrameView.cpp:
(WebCore::FrameView::invalidateRect):
(WebCore::FrameView::invalidateScrollbarRect):
* page/FrameView.h:
* platform/PopupMenu.h:
* platform/ScrollView.cpp:
(WebCore::ScrollView::scrollContents):
* platform/ScrollView.h:
* platform/Scrollbar.cpp:
(WebCore::Scrollbar::setEnabled):
(WebCore::Scrollbar::invalidateRect):
* platform/Scrollbar.h:
* platform/ScrollbarClient.h:
* platform/Widget.h:
* platform/gtk/WidgetGtk.cpp:
* platform/mac/WidgetMac.mm:
* platform/win/PopupMenuWin.cpp:
(WebCore::PopupMenu::invalidateScrollbarRect):
* platform/win/WidgetWin.cpp:
* plugins/PluginView.cpp:
(WebCore::PluginView::invalidateTimerFired):
(WebCore::PluginView::invalidateWindowlessPluginRect):
* plugins/PluginView.h:
* plugins/gtk/PluginViewGtk.cpp:
(WebCore::PluginView::invalidateRect):
* plugins/qt/PluginViewQt.cpp:
(WebCore::PluginView::invalidateRect):
* plugins/win/PluginViewWin.cpp:
(WebCore::PluginView::invalidateRect):
(WebCore::PluginView::invalidateRegion):
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::invalidateScrollbarRect):
* rendering/RenderLayer.h:
* rendering/RenderListBox.cpp:
(WebCore::RenderListBox::paintObject):
(WebCore::RenderListBox::paintScrollbar):
(WebCore::RenderListBox::invalidateScrollbarRect):
* rendering/RenderListBox.h:
WebKit/mac:
2008-10-02 David Hyatt <hyatt@apple.com>
https://bugs.webkit.org/show_bug.cgi?id=21328
Make widget invalidation more cross-platform.
(1) Make invalidateRect a pure virtual function on Widget. All leaf widgets must now implement this function.
(2) Scrollbars now send invalidations through the ScrollbarClient. windowClipRect on ScrollbarClient has been removed and replaced with this invalidation call.
This allows all scrollbar invalidations to go through the render tree so that transforms and reflections will be respected.
(3) Plugins now have the native window invalidation code for windowed plugins. Windowless plugins do a repaintRectangle on the plugin's renderer.
(4) FrameViews now do a repaintRectangle on their owner element's renderer.
Reviewed by Sam Weinig
* WebCoreSupport/WebFrameLoaderClient.mm:
(PluginWidget::PluginWidget):
(PluginWidget::invalidateRect):
(NetscapePluginWidget::NetscapePluginWidget):
(WebFrameLoaderClient::createPlugin):
WebKit/win:
2008-10-02 David Hyatt <hyatt@apple.com>
https://bugs.webkit.org/show_bug.cgi?id=21328
Make widget invalidation more cross-platform.
(1) Make invalidateRect a pure virtual function on Widget. All leaf widgets must now implement this function.
(2) Scrollbars now send invalidations through the ScrollbarClient. windowClipRect on ScrollbarClient has been removed and replaced with this invalidation call.
This allows all scrollbar invalidations to go through the render tree so that transforms and reflections will be respected.
(3) Plugins now have the native window invalidation code for windowed plugins. Windowless plugins do a repaintRectangle on the plugin's renderer.
(4) FrameViews now do a repaintRectangle on their owner element's renderer.
Reviewed by Sam Weinig
* WebCoreSupport/EmbeddedWidget.cpp:
(EmbeddedWidget::invalidateRect):
* WebCoreSupport/EmbeddedWidget.h:
* WebScrollBar.cpp:
(WebScrollBar::invalidateScrollbarRect):
* WebScrollBar.h:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@37223 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index f89679e..ff58b39 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,60 @@
+2008-10-02 David Hyatt <hyatt@apple.com>
+
+ https://bugs.webkit.org/show_bug.cgi?id=21328
+
+ Make widget invalidation more cross-platform.
+
+ (1) Make invalidateRect a pure virtual function on Widget. All leaf widgets must now implement this function.
+
+ (2) Scrollbars now send invalidations through the ScrollbarClient. windowClipRect on ScrollbarClient has been removed and replaced with this invalidation call.
+ This allows all scrollbar invalidations to go through the render tree so that transforms and reflections will be respected.
+
+ (3) Plugins now have the native window invalidation code for windowed plugins. Windowless plugins do a repaintRectangle on the plugin's renderer.
+
+ (4) FrameViews now do a repaintRectangle on their owner element's renderer.
+
+ Reviewed by Sam Weinig
+
+ * WebCore.base.exp:
+ * page/FrameView.cpp:
+ (WebCore::FrameView::invalidateRect):
+ (WebCore::FrameView::invalidateScrollbarRect):
+ * page/FrameView.h:
+ * platform/PopupMenu.h:
+ * platform/ScrollView.cpp:
+ (WebCore::ScrollView::scrollContents):
+ * platform/ScrollView.h:
+ * platform/Scrollbar.cpp:
+ (WebCore::Scrollbar::setEnabled):
+ (WebCore::Scrollbar::invalidateRect):
+ * platform/Scrollbar.h:
+ * platform/ScrollbarClient.h:
+ * platform/Widget.h:
+ * platform/gtk/WidgetGtk.cpp:
+ * platform/mac/WidgetMac.mm:
+ * platform/win/PopupMenuWin.cpp:
+ (WebCore::PopupMenu::invalidateScrollbarRect):
+ * platform/win/WidgetWin.cpp:
+ * plugins/PluginView.cpp:
+ (WebCore::PluginView::invalidateTimerFired):
+ (WebCore::PluginView::invalidateWindowlessPluginRect):
+ * plugins/PluginView.h:
+ * plugins/gtk/PluginViewGtk.cpp:
+ (WebCore::PluginView::invalidateRect):
+ * plugins/qt/PluginViewQt.cpp:
+ (WebCore::PluginView::invalidateRect):
+ * plugins/win/PluginViewWin.cpp:
+ (WebCore::PluginView::invalidateRect):
+ (WebCore::PluginView::invalidateRegion):
+ * rendering/RenderLayer.cpp:
+ (WebCore::RenderLayer::invalidateScrollbarRect):
+ * rendering/RenderLayer.h:
+ * rendering/RenderListBox.cpp:
+ (WebCore::RenderListBox::paintObject):
+ (WebCore::RenderListBox::paintScrollbar):
+ (WebCore::RenderListBox::invalidateScrollbarRect):
+ * rendering/RenderListBox.h:
+
2008-10-02 Dan Bernstein <mitz@apple.com>
Reviewed by Geoffrey Garen and Sam Weinig.
diff --git a/WebCore/WebCore.base.exp b/WebCore/WebCore.base.exp
index 9442d77..ac08ff2 100644
--- a/WebCore/WebCore.base.exp
+++ b/WebCore/WebCore.base.exp
@@ -530,7 +530,6 @@
__ZN7WebCore6StringC1EPKc
__ZN7WebCore6StringC1EPKcj
__ZN7WebCore6StringC1ERKN3JSC7UStringE
-__ZN7WebCore6Widget14invalidateRectERKNS_7IntRectE
__ZN7WebCore6Widget16removeFromParentEv
__ZN7WebCore6Widget12setFrameRectERKNS_7IntRectE
__ZN7WebCore6Widget20retainPlatformWidgetEv
diff --git a/WebCore/page/FrameView.cpp b/WebCore/page/FrameView.cpp
index bf3631a..d8921f7 100644
--- a/WebCore/page/FrameView.cpp
+++ b/WebCore/page/FrameView.cpp
@@ -259,6 +259,27 @@
setScrollbarModes(d->m_hmode, d->m_vmode);
}
+void FrameView::invalidateRect(const IntRect& rect)
+{
+ if (!parent()) {
+ if (hostWindow())
+ hostWindow()->repaint(rect, true);
+ return;
+ }
+
+ if (!m_frame)
+ return;
+
+ RenderPart* renderer = m_frame->ownerRenderer();
+ if (!renderer)
+ return;
+
+ IntRect repaintRect = rect;
+ repaintRect.move(renderer->borderLeft() + renderer->paddingLeft(),
+ renderer->borderTop() + renderer->paddingTop());
+ renderer->repaintRectangle(repaintRect);
+}
+
void FrameView::setMarginWidth(int w)
{
// make it update the rendering area when set
@@ -971,18 +992,6 @@
}
}
-IntRect FrameView::windowClipRect(const Scrollbar*) const
-{
- // When we get called by the scrollbar client, it means that we are not clipping to contents, since
- // these scrollbars are ours.
- return windowClipRect(false);
-}
-
-IntRect FrameView::windowClipRect() const
-{
- return windowClipRect(true);
-}
-
IntRect FrameView::windowClipRect(bool clipToContents) const
{
ASSERT(m_frame->view() == this);
@@ -1034,6 +1043,14 @@
frame()->sendScrollEvent();
}
+void FrameView::invalidateScrollbarRect(Scrollbar* scrollbar, const IntRect& rect)
+{
+ // Add in our offset within the FrameView.
+ IntRect dirtyRect = rect;
+ dirtyRect.move(scrollbar->x(), scrollbar->y());
+ invalidateRect(dirtyRect);
+}
+
IntRect FrameView::windowResizerRect() const
{
Page* page = frame() ? frame()->page() : 0;
diff --git a/WebCore/page/FrameView.h b/WebCore/page/FrameView.h
index 5fac146..6c6a36c 100644
--- a/WebCore/page/FrameView.h
+++ b/WebCore/page/FrameView.h
@@ -63,6 +63,8 @@
virtual ~FrameView();
virtual HostWindow* hostWindow() const;
+
+ virtual void invalidateRect(const IntRect&);
Frame* frame() const { return m_frame.get(); }
void clearFrame();
@@ -111,12 +113,11 @@
void adjustViewSize();
void initScrollbars();
- virtual IntRect windowClipRect(const Scrollbar*) const;
- virtual IntRect windowClipRect() const;
- IntRect windowClipRect(bool clipToContents) const;
+ virtual IntRect windowClipRect(bool clipToContents = true) const;
IntRect windowClipRectForLayer(const RenderLayer*, bool clipToLayerContents) const;
virtual bool isActive() const;
+ virtual void invalidateScrollbarRect(Scrollbar*, const IntRect&);
virtual void valueChanged(Scrollbar*);
virtual IntRect windowResizerRect() const;
diff --git a/WebCore/platform/PopupMenu.h b/WebCore/platform/PopupMenu.h
index 55b336fb..c6b572e 100644
--- a/WebCore/platform/PopupMenu.h
+++ b/WebCore/platform/PopupMenu.h
@@ -144,7 +144,7 @@
#elif PLATFORM(WIN)
// ScrollBarClient
virtual void valueChanged(Scrollbar*);
- virtual IntRect windowClipRect(const Scrollbar*) const;
+ virtual void invalidateScrollbarRect(Scrollbar*, const IntRect&);
virtual bool isActive() const { return true; }
void calculatePositionAndSize(const IntRect&, FrameView*);
diff --git a/WebCore/platform/ScrollView.cpp b/WebCore/platform/ScrollView.cpp
index d9fa07e..dd1f176 100644
--- a/WebCore/platform/ScrollView.cpp
+++ b/WebCore/platform/ScrollView.cpp
@@ -379,7 +379,7 @@
{
// Since scrolling is double buffered, we will be blitting the scroll view's intersection
// with the clip rect every time to keep it smooth.
- IntRect clipRect = static_cast<Widget*>(this)->windowClipRect();
+ IntRect clipRect = windowClipRect();
IntRect scrollViewRect = convertToContainingWindow(IntRect(0, 0, visibleWidth(), visibleHeight()));
IntRect updateRect = clipRect;
updateRect.intersect(scrollViewRect);
diff --git a/WebCore/platform/ScrollView.h b/WebCore/platform/ScrollView.h
index 84c042b..325eda6 100644
--- a/WebCore/platform/ScrollView.h
+++ b/WebCore/platform/ScrollView.h
@@ -71,6 +71,9 @@
// host window in the window's coordinate space.
virtual HostWindow* hostWindow() const = 0;
+ // Returns a clip rect in host window coordinates. Used to clip the blit on a scroll.
+ virtual IntRect windowClipRect(bool clipToContents = true) const = 0;
+
// Methods for child manipulation and inspection.
const HashSet<Widget*>* children() const { return &m_children; }
void addChild(Widget*);
diff --git a/WebCore/platform/Scrollbar.cpp b/WebCore/platform/Scrollbar.cpp
index e58124d..59a378a 100644
--- a/WebCore/platform/Scrollbar.cpp
+++ b/WebCore/platform/Scrollbar.cpp
@@ -417,23 +417,12 @@
m_enabled = e;
invalidate();
}
-
-IntRect Scrollbar::windowClipRect() const
-{
- IntRect clipRect(0, 0, width(), height());
-
- clipRect = convertToContainingWindow(clipRect);
- if (m_client)
- clipRect.intersect(m_client->windowClipRect(this));
-
- return clipRect;
-}
void Scrollbar::invalidateRect(const IntRect& rect)
{
if (suppressInvalidation())
return;
- Widget::invalidateRect(rect);
+ m_client->invalidateScrollbarRect(this, rect);
}
}
diff --git a/WebCore/platform/Scrollbar.h b/WebCore/platform/Scrollbar.h
index 5125c1f..77c0f06 100644
--- a/WebCore/platform/Scrollbar.h
+++ b/WebCore/platform/Scrollbar.h
@@ -110,7 +110,6 @@
virtual void setParent(ScrollView*);
virtual void setFrameRect(const IntRect&);
- virtual IntRect windowClipRect() const;
virtual void invalidateRect(const IntRect&);
diff --git a/WebCore/platform/ScrollbarClient.h b/WebCore/platform/ScrollbarClient.h
index 283d4fb..be3588b 100644
--- a/WebCore/platform/ScrollbarClient.h
+++ b/WebCore/platform/ScrollbarClient.h
@@ -37,8 +37,7 @@
virtual ~ScrollbarClient() {}
virtual void valueChanged(Scrollbar*) = 0;
- // Used to obtain a window clip rect.
- virtual IntRect windowClipRect(const Scrollbar*) const = 0;
+ virtual void invalidateScrollbarRect(Scrollbar*, const IntRect&) = 0;
virtual bool isActive() const = 0;
};
diff --git a/WebCore/platform/Widget.h b/WebCore/platform/Widget.h
index e977de2..b8a93d1 100644
--- a/WebCore/platform/Widget.h
+++ b/WebCore/platform/Widget.h
@@ -133,7 +133,7 @@
virtual void paint(GraphicsContext*, const IntRect&);
void invalidate() { invalidateRect(boundsRect()); }
- virtual void invalidateRect(const IntRect&);
+ virtual void invalidateRect(const IntRect&) = 0;
virtual void setFocus();
@@ -158,11 +158,6 @@
ScrollView* parent() const { return m_parent; }
ScrollView* root() const;
- // This method is used by plugins on all platforms to obtain a clip rect that includes clips set by WebCore,
- // e.g., in overflow:auto sections. The clip rects coordinates are in the containing window's coordinate space.
- // This clip includes any clips that the widget itself sets up for its children.
- virtual IntRect windowClipRect() const { return IntRect(); }
-
virtual void handleEvent(Event*) { }
// The containing window is used as the coordinate space for event handling.
diff --git a/WebCore/platform/gtk/WidgetGtk.cpp b/WebCore/platform/gtk/WidgetGtk.cpp
index bf42c01..7b2d6f6 100644
--- a/WebCore/platform/gtk/WidgetGtk.cpp
+++ b/WebCore/platform/gtk/WidgetGtk.cpp
@@ -151,29 +151,6 @@
notImplemented();
}
-void Widget::invalidateRect(const IntRect& rect)
-{
- if (!parent()) {
- gtk_widget_queue_draw_area(GTK_WIDGET(containingWindow()), rect.x(), rect.y(),
- rect.width(), rect.height());
- if (isFrameView())
- static_cast<FrameView*>(this)->addToDirtyRegion(rect);
- return;
- }
-
- // Get the root widget.
- ScrollView* outermostView = parent();
- while (outermostView && outermostView->parent())
- outermostView = outermostView->parent();
- if (!outermostView)
- return;
-
- IntRect windowRect = convertToContainingWindow(rect);
- gtk_widget_queue_draw_area(GTK_WIDGET(containingWindow()), windowRect.x(), windowRect.y(),
- windowRect.width(), windowRect.height());
- outermostView->addToDirtyRegion(windowRect);
-}
-
IntRect Widget::frameRect() const
{
return m_frame;
diff --git a/WebCore/platform/mac/WidgetMac.mm b/WebCore/platform/mac/WidgetMac.mm
index 7a45807..dbbe95c 100644
--- a/WebCore/platform/mac/WidgetMac.mm
+++ b/WebCore/platform/mac/WidgetMac.mm
@@ -229,19 +229,6 @@
}
}
-void Widget::invalidateRect(const IntRect& r)
-{
- if (!platformWidget() && parent()) {
- IntPoint newPoint = parent()->convertChildToSelf(this, r.location());
- parent()->invalidateRect(IntRect(newPoint, r.size()));
- return;
- }
-
- BEGIN_BLOCK_OBJC_EXCEPTIONS;
- [platformWidget() setNeedsDisplayInRect: r];
- END_BLOCK_OBJC_EXCEPTIONS;
-}
-
void Widget::setIsSelected(bool isSelected)
{
NSView *view = platformWidget();
diff --git a/WebCore/platform/win/PopupMenuWin.cpp b/WebCore/platform/win/PopupMenuWin.cpp
index c465334..d1545d4 100644
--- a/WebCore/platform/win/PopupMenuWin.cpp
+++ b/WebCore/platform/win/PopupMenuWin.cpp
@@ -584,9 +584,12 @@
::UpdateWindow(m_popup);
}
-IntRect PopupMenu::windowClipRect(const Scrollbar*) const
+void PopupMenu::invalidateScrollbarRect(Scrollbar* scrollbar, const IntRect& rect)
{
- return m_windowRect;
+ IntRect scrollRect = rect;
+ scrollRect.move(scrollbar->x(), scrollbar->y());
+ RECT r = scrollRect;
+ ::InvalidateRect(m_popup, &r, false);
}
static ATOM registerPopup()
diff --git a/WebCore/platform/win/WidgetWin.cpp b/WebCore/platform/win/WidgetWin.cpp
index df7ecd8..c1d5459 100644
--- a/WebCore/platform/win/WidgetWin.cpp
+++ b/WebCore/platform/win/WidgetWin.cpp
@@ -83,6 +83,7 @@
{
}
+/*
void Widget::invalidateRect(const IntRect& r)
{
if (!parent()) {
@@ -110,6 +111,7 @@
::InvalidateRect(containingWindow(), &rect, false);
outermostView->addToDirtyRegion(windowRect);
}
+*/
void Widget::setFocus()
{
diff --git a/WebCore/plugins/PluginView.cpp b/WebCore/plugins/PluginView.cpp
index 47495943..2fddd48 100644
--- a/WebCore/plugins/PluginView.cpp
+++ b/WebCore/plugins/PluginView.cpp
@@ -57,6 +57,7 @@
#include "PluginDebug.h"
#include "PluginMainThreadScheduler.h"
#include "PluginPackage.h"
+#include "RenderObject.h"
#include "c_instance.h"
#include "npruntime_impl.h"
#include "runtime_root.h"
@@ -431,7 +432,7 @@
ASSERT(timer == &m_invalidateTimer);
for (unsigned i = 0; i < m_invalidRects.size(); i++)
- Widget::invalidateRect(m_invalidRects[i]);
+ invalidateRect(m_invalidRects[i]);
m_invalidRects.clear();
}
@@ -878,4 +879,18 @@
return load(frameLoadRequest, sendNotification, notifyData);
}
+void PluginView::invalidateWindowlessPluginRect(const IntRect& rect)
+{
+ if (!isVisible())
+ return;
+
+ RenderObject* renderer = m_element->renderer();
+ if (!renderer)
+ return;
+
+ IntRect dirtyRect = rect;
+ dirtyRect.move(renderer->borderLeft() + renderer->paddingLeft(), renderer->borderTop() + renderer->paddingTop());
+ renderer->repaintRectangle(dirtyRect);
+}
+
} // namespace WebCore
diff --git a/WebCore/plugins/PluginView.h b/WebCore/plugins/PluginView.h
index ba3a6bf..3404abb 100644
--- a/WebCore/plugins/PluginView.h
+++ b/WebCore/plugins/PluginView.h
@@ -136,6 +136,8 @@
void pushPopupsEnabledState(bool state);
void popPopupsEnabledState();
+ virtual void invalidateRect(const IntRect&);
+
bool arePopupsAllowed() const;
void setJavaScriptPaused(bool);
@@ -150,7 +152,12 @@
virtual void show();
virtual void hide();
virtual void paint(GraphicsContext*, const IntRect&);
- virtual IntRect windowClipRect() const;
+
+ // This method is used by plugins on all platforms to obtain a clip rect that includes clips set by WebCore,
+ // e.g., in overflow:auto sections. The clip rects coordinates are in the containing window's coordinate space.
+ // This clip includes any clips that the widget itself sets up for its children.
+ IntRect windowClipRect() const;
+
virtual void handleEvent(Event*);
virtual void setParent(ScrollView*);
virtual void setParentVisible(bool);
@@ -190,6 +197,8 @@
static void freeStringArray(char** stringArray, int length);
void setCallingPlugin(bool) const;
+ void invalidateWindowlessPluginRect(const IntRect&);
+
Frame* m_parentFrame;
RefPtr<PluginPackage> m_plugin;
Element* m_element;
diff --git a/WebCore/plugins/gtk/PluginViewGtk.cpp b/WebCore/plugins/gtk/PluginViewGtk.cpp
index ac5e148..1fe3ccc 100644
--- a/WebCore/plugins/gtk/PluginViewGtk.cpp
+++ b/WebCore/plugins/gtk/PluginViewGtk.cpp
@@ -452,6 +452,16 @@
}
}
+void PluginView::invalidateRect(const IntRect& rect)
+{
+ if (m_isWindowed) {
+ gtk_widget_queue_draw_area(GTK_WIDGET(platformPluginWidget()), rect.x(), rect.y(), rect.width(), rect.height());
+ return;
+ }
+
+ invalidateWindowlessPluginRect(rect);
+}
+
void PluginView::invalidateRect(NPRect* rect)
{
if (!rect) {
@@ -460,7 +470,7 @@
}
IntRect r(rect->left, rect->top, rect->right - rect->left, rect->bottom - rect->top);
- Widget::invalidateRect(r);
+ invalidateRect(r);
}
void PluginView::forceRedraw()
diff --git a/WebCore/plugins/qt/PluginViewQt.cpp b/WebCore/plugins/qt/PluginViewQt.cpp
index 4bde334..57a5fec 100644
--- a/WebCore/plugins/qt/PluginViewQt.cpp
+++ b/WebCore/plugins/qt/PluginViewQt.cpp
@@ -381,6 +381,16 @@
}
}
+void PluginView::invalidateRect(const IntRect& rect)
+{
+ if (platformWidget()) {
+ platformWidget()->update(rect);
+ return;
+ }
+
+ invalidateWindowlessPluginRect(rect);
+}
+
void PluginView::invalidateRect(NPRect* rect)
{
notImplemented();
diff --git a/WebCore/plugins/win/PluginViewWin.cpp b/WebCore/plugins/win/PluginViewWin.cpp
index 36cbc4f..7f7eb23 100644
--- a/WebCore/plugins/win/PluginViewWin.cpp
+++ b/WebCore/plugins/win/PluginViewWin.cpp
@@ -725,6 +725,17 @@
}
}
+void PluginView::invalidateRect(const IntRect& rect)
+{
+ if (m_isWindowed) {
+ RECT invalidRect = rect;
+ ::InvalidateRect(platformPluginWidget(), &invalidRect, false);
+ return;
+ }
+
+ invalidateWindowlessPluginRect(rect);
+}
+
void PluginView::invalidateRect(NPRect* rect)
{
if (!rect) {
@@ -743,7 +754,7 @@
if (!m_invalidateTimer.isActive())
m_invalidateTimer.startOneShot(0.001);
} else
- Widget::invalidateRect(r);
+ invalidateRect(r);
}
}
@@ -760,7 +771,7 @@
}
IntRect rect(IntPoint(r.left, r.top), IntSize(r.right-r.left, r.bottom-r.top));
- Widget::invalidateRect(rect);
+ invalidateRect(rect);
}
void PluginView::forceRedraw()
diff --git a/WebCore/rendering/RenderLayer.cpp b/WebCore/rendering/RenderLayer.cpp
index 56b1d0b..efc10e2 100644
--- a/WebCore/rendering/RenderLayer.cpp
+++ b/WebCore/rendering/RenderLayer.cpp
@@ -1092,22 +1092,22 @@
scrollToOffset(newX, newY, false);
}
-IntRect RenderLayer::windowClipRect(const Scrollbar*) const
-{
- RenderView* view = renderer()->view();
- ASSERT(view);
- FrameView* frameView = view->frameView();
- if (!frameView)
- return IntRect();
- return frameView->windowClipRectForLayer(this, false);
-}
-
bool RenderLayer::isActive() const
{
Page* page = renderer()->document()->frame()->page();
return page && page->focusController()->isActive();
}
+void RenderLayer::invalidateScrollbarRect(Scrollbar* scrollbar, const IntRect& rect)
+{
+ IntRect scrollRect = rect;
+ if (scrollbar == m_vBar.get())
+ scrollRect.move(renderer()->width() - renderer()->borderRight() - scrollbar->width(), renderer()->borderTop());
+ else
+ scrollRect.move(renderer()->height() - renderer()->borderBottom() - scrollbar->height(), renderer()->borderLeft());
+ renderer()->repaintRectangle(scrollRect);
+}
+
PassRefPtr<Scrollbar> RenderLayer::createScrollbar(ScrollbarOrientation orientation)
{
RefPtr<Scrollbar> widget = Scrollbar::createNativeScrollbar(this, orientation, RegularScrollbar);
diff --git a/WebCore/rendering/RenderLayer.h b/WebCore/rendering/RenderLayer.h
index 78d4f9e..8fdd99a 100644
--- a/WebCore/rendering/RenderLayer.h
+++ b/WebCore/rendering/RenderLayer.h
@@ -349,7 +349,7 @@
bool shouldBeOverflowOnly() const;
virtual void valueChanged(Scrollbar*);
- virtual IntRect windowClipRect(const Scrollbar*) const;
+ virtual void invalidateScrollbarRect(Scrollbar*, const IntRect&);
virtual bool isActive() const;
void updateOverflowStatus(bool horizontalOverflow, bool verticalOverflow);
diff --git a/WebCore/rendering/RenderListBox.cpp b/WebCore/rendering/RenderListBox.cpp
index 0262856..8b87c33 100644
--- a/WebCore/rendering/RenderListBox.cpp
+++ b/WebCore/rendering/RenderListBox.cpp
@@ -277,7 +277,7 @@
RenderBlock::paintObject(paintInfo, tx, ty);
if (paintInfo.phase == PaintPhaseBlockBackground)
- paintScrollbar(paintInfo);
+ paintScrollbar(paintInfo, tx, ty);
else if (paintInfo.phase == PaintPhaseChildBlockBackground || paintInfo.phase == PaintPhaseChildBlockBackgrounds) {
int index = m_indexOffset;
while (index < listItemsSize && index <= m_indexOffset + numVisibleItems()) {
@@ -287,16 +287,15 @@
}
}
-void RenderListBox::paintScrollbar(PaintInfo& paintInfo)
+void RenderListBox::paintScrollbar(PaintInfo& paintInfo, int tx, int ty)
{
if (m_vBar) {
- IntRect absBounds = absoluteBoundingBoxRect();
- IntRect scrollRect(absBounds.right() - borderRight() - m_vBar->width(),
- absBounds.y() + borderTop(),
+ IntRect scrollRect(tx + width() - borderRight() - m_vBar->width(),
+ ty + borderTop(),
m_vBar->width(),
- absBounds.height() - (borderTop() + borderBottom()));
+ height() - (borderTop() + borderBottom()));
m_vBar->setFrameRect(scrollRect);
- m_vBar->paint(paintInfo.context, scrollRect);
+ m_vBar->paint(paintInfo.context, paintInfo.rect);
}
}
@@ -596,21 +595,19 @@
return clipRect;
}
-IntRect RenderListBox::windowClipRect(const Scrollbar*) const
-{
- FrameView* frameView = view()->frameView();
- if (!frameView)
- return IntRect();
-
- return frameView->windowClipRectForLayer(enclosingLayer(), true);
-}
-
bool RenderListBox::isActive() const
{
Page* page = document()->frame()->page();
return page && page->focusController()->isActive();
}
+void RenderListBox::invalidateScrollbarRect(Scrollbar* scrollbar, const IntRect& rect)
+{
+ IntRect scrollRect = rect;
+ scrollRect.move(width() - borderRight() - scrollbar->width(), borderTop());
+ repaintRectangle(scrollRect);
+}
+
bool RenderListBox::isScrollable() const
{
if (numVisibleItems() < numItems())
diff --git a/WebCore/rendering/RenderListBox.h b/WebCore/rendering/RenderListBox.h
index e305cbe..3eddd13 100644
--- a/WebCore/rendering/RenderListBox.h
+++ b/WebCore/rendering/RenderListBox.h
@@ -84,7 +84,7 @@
virtual bool shouldPanScroll() const { return true; }
virtual void panScroll(const IntPoint&);
- int scrollToward(const IntPoint&); // Returns the new index or -1 if no scroll occured
+ int scrollToward(const IntPoint&); // Returns the new index or -1 if no scroll occurred
virtual int verticalScrollbarWidth() const;
virtual int scrollLeft() const;
@@ -97,7 +97,7 @@
private:
// ScrollbarClient interface.
virtual void valueChanged(Scrollbar*);
- virtual IntRect windowClipRect(const Scrollbar*) const;
+ virtual void invalidateScrollbarRect(Scrollbar*, const IntRect&);
virtual bool isActive() const;
int itemHeight() const;
@@ -106,7 +106,7 @@
int numVisibleItems() const;
int numItems() const;
int listHeight() const;
- void paintScrollbar(PaintInfo&);
+ void paintScrollbar(PaintInfo&, int tx, int ty);
void paintItemForeground(PaintInfo&, int tx, int ty, int listIndex);
void paintItemBackground(PaintInfo&, int tx, int ty, int listIndex);
void scrollToRevealSelection();