Changeset 70265 in webkit


Ignore:
Timestamp:
Oct 21, 2010 2:40:47 PM (14 years ago)
Author:
Adam Roben
Message:

Invalidate the plugin's HWND when NPN_InvalidateRect is called

Fixes <http://webkit.org/b/48086> <rdar://problem/8482944> Silverlight
doesn't repaint in WebKit2

Reviewed by Anders Carlsson.

WebKit2:

  • WebProcess/Plugins/Netscape/NetscapePlugin.cpp:

(WebKit::NetscapePlugin::invalidate): Call platformInvalidate before
invalidating via the PluginController.

  • WebProcess/Plugins/Netscape/NetscapePlugin.h: Added platformInvalidate.
  • WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm:

(WebKit::NetscapePlugin::platformInvalidate):

  • WebProcess/Plugins/Netscape/qt/NetscapePluginQt.cpp:

(WebKit::NetscapePlugin::platformInvalidate):
Stubbed out.

  • WebProcess/Plugins/Netscape/win/NetscapePluginWin.cpp:

(WebKit::NetscapePlugin::platformInvalidate): If the plugin is
windowed, invalidate its HWND via ::InvalidateRect.

WebKitTools:

Test that the plugin's HWND is invalidated when NPN_InvalidateRect is
called

  • DumpRenderTree/TestNetscapePlugIn/PluginTest.cpp:

(PluginTest::NPN_InvalidateRect): Added. Calls through to the browser.
(executeScript): Added. Asks the browser to evaluate the script.

(PluginTest::waitUntilDone):
(PluginTest::notifyDone):
Added. Calls through to layoutTestController.

  • DumpRenderTree/TestNetscapePlugIn/PluginTest.h: Added
  • NPN_InvalidateRect and waitUntilDone/notifyDone.
  • DumpRenderTree/TestNetscapePlugIn/Tests/win/NPNInvalidateRectInvalidatesWindow.cpp: Added.

(TemporaryWindowMover::moveSucceeded):
(TemporaryWindowMover::TemporaryWindowMover):
(TemporaryWindowMover::~TemporaryWindowMover):
This class moves a window on-screen and shows it, then moves it back and hides it.

(NPNInvalidateRectInvalidatesWindow::NPNInvalidateRectInvalidatesWindow):
Initialize our members.
(NPNInvalidateRectInvalidatesWindow::~NPNInvalidateRectInvalidatesWindow):
Delete our window mover if it hasn't been deleted already.
(NPNInvalidateRectInvalidatesWindow::NPP_SetWindow): Subclass the
plugin HWND and move the test harness window on screen.
(NPNInvalidateRectInvalidatesWindow::wndProc): Call through to onPaint
when we get a WM_PAINT message.
(NPNInvalidateRectInvalidatesWindow::onPaint): Do the test and tell
LayoutTestController we're done.
(NPNInvalidateRectInvalidatesWindow::testInvalidateRect): Validate
ourselves, invalidate our lower-right quadrant via NPN_InvalidateRect,
then check that our HWND's invalid region is the rect that we
invalidated.

  • DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.vcproj:
  • Added NPNInvalidateRectInvalidatesWindow.

LayoutTests:

Test that the plugin's HWND is invalidated when NPN_InvalidateRect is
called

  • platform/win/plugins/npn-invalidate-rect-invalidates-window-expected.txt: Added.
  • platform/win/plugins/npn-invalidate-rect-invalidates-window.html: Added.
Location:
trunk
Files:
3 added
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r70263 r70265  
     12010-10-21  Adam Roben  <aroben@apple.com>
     2
     3        Test that the plugin's HWND is invalidated when NPN_InvalidateRect is
     4        called
     5
     6        Fixes <http://webkit.org/b/48086> <rdar://problem/8482944> Silverlight
     7        doesn't repaint in WebKit2
     8
     9        Reviewed by Anders Carlsson.
     10
     11        * platform/win/plugins/npn-invalidate-rect-invalidates-window-expected.txt: Added.
     12        * platform/win/plugins/npn-invalidate-rect-invalidates-window.html: Added.
     13
    1142010-10-21  David Hyatt  <hyatt@apple.com>
    215
  • trunk/WebKit2/ChangeLog

    r70261 r70265  
     12010-10-21  Adam Roben  <aroben@apple.com>
     2
     3        Invalidate the plugin's HWND when NPN_InvalidateRect is called
     4
     5        Fixes <http://webkit.org/b/48086> <rdar://problem/8482944> Silverlight
     6        doesn't repaint in WebKit2
     7
     8        Reviewed by Anders Carlsson.
     9
     10        * WebProcess/Plugins/Netscape/NetscapePlugin.cpp:
     11        (WebKit::NetscapePlugin::invalidate): Call platformInvalidate before
     12        invalidating via the PluginController.
     13
     14        * WebProcess/Plugins/Netscape/NetscapePlugin.h: Added platformInvalidate.
     15
     16        * WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm:
     17        (WebKit::NetscapePlugin::platformInvalidate):
     18        * WebProcess/Plugins/Netscape/qt/NetscapePluginQt.cpp:
     19        (WebKit::NetscapePlugin::platformInvalidate):
     20        Stubbed out.
     21
     22        * WebProcess/Plugins/Netscape/win/NetscapePluginWin.cpp:
     23        (WebKit::NetscapePlugin::platformInvalidate): If the plugin is
     24        windowed, invalidate its HWND via ::InvalidateRect.
     25
    1262010-10-21  Anders Carlsson  <andersca@apple.com>
    227
  • trunk/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp

    r70190 r70265  
    9696                       invalidRect->right - invalidRect->left, invalidRect->bottom - invalidRect->top);
    9797   
     98    if (platformInvalidate(rect))
     99        return;
     100
    98101    m_pluginController->invalidate(rect);
    99102}
  • trunk/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h

    r69155 r70265  
    113113    bool platformPostInitialize();
    114114    void platformDestroy();
     115    bool platformInvalidate(const WebCore::IntRect&);
    115116    void platformGeometryDidChange();
    116117    void platformPaint(WebCore::GraphicsContext*, const WebCore::IntRect& dirtyRect);
  • trunk/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm

    r69985 r70265  
    161161}
    162162
     163bool NetscapePlugin::platformInvalidate(const IntRect&)
     164{
     165    return false;
     166}
     167
    163168void NetscapePlugin::platformGeometryDidChange()
    164169{
  • trunk/WebKit2/WebProcess/Plugins/Netscape/qt/NetscapePluginQt.cpp

    r68988 r70265  
    4444{
    4545    notImplemented();
     46}
     47
     48bool NetscapePlugin::platformInvalidate(const IntRect&)
     49{
     50    notImplemented();
     51    return false;
    4652}
    4753
  • trunk/WebKit2/WebProcess/Plugins/Netscape/win/NetscapePluginWin.cpp

    r68988 r70265  
    9494}
    9595
     96bool NetscapePlugin::platformInvalidate(const IntRect& invalidRect)
     97{
     98    if (!m_isWindowed)
     99        return false;
     100
     101    RECT rect = invalidRect;
     102    ::InvalidateRect(m_window, &rect, FALSE);
     103    return true;
     104}
     105
    96106void NetscapePlugin::platformGeometryDidChange()
    97107{
  • trunk/WebKitTools/ChangeLog

    r70264 r70265  
     12010-10-21  Adam Roben  <aroben@apple.com>
     2
     3        Test that the plugin's HWND is invalidated when NPN_InvalidateRect is
     4        called
     5
     6        Test for <http://webkit.org/b/48086> <rdar://problem/8482944>
     7        Silverlight doesn't repaint in WebKit2
     8
     9        Reviewed by Anders Carlsson.
     10
     11        * DumpRenderTree/TestNetscapePlugIn/PluginTest.cpp:
     12        (PluginTest::NPN_InvalidateRect): Added. Calls through to the browser.
     13        (executeScript): Added. Asks the browser to evaluate the script.
     14
     15        (PluginTest::waitUntilDone):
     16        (PluginTest::notifyDone):
     17        Added. Calls through to layoutTestController.
     18
     19        * DumpRenderTree/TestNetscapePlugIn/PluginTest.h: Added
     20        * NPN_InvalidateRect and waitUntilDone/notifyDone.
     21
     22        * DumpRenderTree/TestNetscapePlugIn/Tests/win/NPNInvalidateRectInvalidatesWindow.cpp: Added.
     23        (TemporaryWindowMover::moveSucceeded):
     24        (TemporaryWindowMover::TemporaryWindowMover):
     25        (TemporaryWindowMover::~TemporaryWindowMover):
     26        This class moves a window on-screen and shows it, then moves it back and hides it.
     27
     28        (NPNInvalidateRectInvalidatesWindow::NPNInvalidateRectInvalidatesWindow):
     29        Initialize our members.
     30        (NPNInvalidateRectInvalidatesWindow::~NPNInvalidateRectInvalidatesWindow):
     31        Delete our window mover if it hasn't been deleted already.
     32        (NPNInvalidateRectInvalidatesWindow::NPP_SetWindow): Subclass the
     33        plugin HWND and move the test harness window on screen.
     34        (NPNInvalidateRectInvalidatesWindow::wndProc): Call through to onPaint
     35        when we get a WM_PAINT message.
     36        (NPNInvalidateRectInvalidatesWindow::onPaint): Do the test and tell
     37        LayoutTestController we're done.
     38        (NPNInvalidateRectInvalidatesWindow::testInvalidateRect): Validate
     39        ourselves, invalidate our lower-right quadrant via NPN_InvalidateRect,
     40        then check that our HWND's invalid region is the rect that we
     41        invalidated.
     42
     43        * DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.vcproj:
     44        * Added NPNInvalidateRectInvalidatesWindow.
     45
    1462010-10-21  Daniel Bates  <dbates@rim.com>
    247
  • trunk/WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginTest.cpp

    r68891 r70265  
    2727
    2828#include <assert.h>
     29#include <string.h>
    2930
    3031using namespace std;
     
    6667}
    6768
     69void PluginTest::NPN_InvalidateRect(NPRect* invalidRect)
     70{
     71    browser->invalidaterect(m_npp, invalidRect);
     72}
     73
    6874NPIdentifier PluginTest::NPN_GetStringIdentifier(const NPUTF8 *name)
    6975{
     
    9197}
    9298
     99static void executeScript(NPP npp, const char* script)
     100{
     101    NPObject* windowScriptObject;
     102    browser->getvalue(npp, NPNVWindowNPObject, &windowScriptObject);
     103
     104    NPString npScript;
     105    npScript.UTF8Characters = script;
     106    npScript.UTF8Length = strlen(script);
     107
     108    NPVariant browserResult;
     109    browser->evaluate(npp, windowScriptObject, &npScript, &browserResult);
     110    browser->releasevariantvalue(&browserResult);
     111}
     112
     113void PluginTest::waitUntilDone()
     114{
     115    executeScript(m_npp, "layoutTestController.waitUntilDone()");
     116}
     117
     118void PluginTest::notifyDone()
     119{
     120    executeScript(m_npp, "layoutTestController.notifyDone()");
     121}
     122
    93123void PluginTest::registerCreateTestFunction(const string& identifier, CreateTestFunction createTestFunction)
    94124{
  • trunk/WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginTest.h

    r68891 r70265  
    6161
    6262    // NPN functions.
     63    void NPN_InvalidateRect(NPRect* invalidRect);
    6364    NPIdentifier NPN_GetStringIdentifier(const NPUTF8* name);
    6465    NPIdentifier NPN_GetIntIdentifier(int32_t intid);
     
    8889
    8990    const std::string& identifier() const { return m_identifier; }
     91
     92    void waitUntilDone();
     93    void notifyDone();
    9094
    9195    // NPObject helper template.
  • trunk/WebKitTools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.vcproj

    r70190 r70265  
    399399                                </File>
    400400                                <File
     401                                        RelativePath="..\Tests\win\NPNInvalidateRectInvalidatesWindow.cpp"
     402                                        >
     403                                </File>
     404                                <File
    401405                                        RelativePath="..\Tests\win\WindowGeometryInitializedBeforeSetWindow.cpp"
    402406                                        >
Note: See TracChangeset for help on using the changeset viewer.