Changeset 78010 in webkit


Ignore:
Timestamp:
Feb 8, 2011 7:30:30 PM (13 years ago)
Author:
commit-queue@webkit.org
Message:

2011-02-08 Sailesh Agrawal <sail@chromium.org>

Reviewed by Kenneth Russell.

Invalidate rect doesn't work for windowless plugins on Chromium
https://bugs.webkit.org/show_bug.cgi?id=53117

Added a test to make sure that NPN_InvalidateRect() works correctly for windowless plugins.

  • plugins/invalidate_rect-expected.txt: Added.
  • plugins/invalidate_rect.html: Added.

2011-02-08 Sailesh Agrawal <sail@chromium.org>

Reviewed by Kenneth Russell.

Invalidate rect doesn't work for windowless plugins on Chromium
https://bugs.webkit.org/show_bug.cgi?id=53117

Invalidate rect for windowless plugins wasn't working if the web page was composited.

The problem was that the invalidate call was causing simply dirtying the LayerChromium layers. Since the plugin was windowless this didn't cause the plugin to be repainted.

Fix was to copy the invalidate code from WebCore/plugins/PluginView.cpp/PluginView::invalidateWindowlessPluginRect() which does the correct thing.

Tested my fix on Windows and Mac and verified that the movie on http://apple.com/appltv correctly plays. Verified that windowed plugins still correctly draw as well.

  • src/WebPluginContainerImpl.cpp: (WebKit::WebPluginContainerImpl::invalidateRect):

2011-02-08 Sailesh Agrawal <sail@chromium.org>

Reviewed by Kenneth Russell.

Invalidate rect doesn't work for windowless plugins on Chromium
https://bugs.webkit.org/show_bug.cgi?id=53117

Added two new utility methods.

  • layoutTestController.displayInvalidatedRegion() does a paint of any area that has been invalidated. This is different from layoutTestController.display() which explicitly invalidates the entire page then paints.
  • plugin.invalidateRect(left, top, right, bottom) - invalidates the given rect This is used to test that invalidating a rect correctly causes a repaint of the plugin.
  • DumpRenderTree/LayoutTestController.cpp: (displayInvalidatedRegionCallback): (LayoutTestController::staticFunctions):
  • DumpRenderTree/LayoutTestController.h:
  • DumpRenderTree/TestNetscapePlugIn/PluginObject.cpp: (invalidateRect): (pluginInvoke):
  • DumpRenderTree/chromium/LayoutTestController.cpp: (LayoutTestController::LayoutTestController): (LayoutTestController::displayInvalidatedRegion):
  • DumpRenderTree/chromium/LayoutTestController.h:
  • Scripts/webkitpy/layout_tests/port/chromium_gpu.py:
Location:
trunk
Files:
2 added
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r78008 r78010  
     12011-02-08  Sailesh Agrawal  <sail@chromium.org>
     2
     3        Reviewed by Kenneth Russell.
     4
     5        Invalidate rect doesn't work for windowless plugins on Chromium
     6        https://bugs.webkit.org/show_bug.cgi?id=53117
     7
     8        Added a test to make sure that NPN_InvalidateRect() works correctly for windowless plugins.
     9
     10        * plugins/invalidate_rect-expected.txt: Added.
     11        * plugins/invalidate_rect.html: Added.
     12
    1132011-02-08  Mihai Parparita  <mihaip@chromium.org>
    214
  • trunk/LayoutTests/platform/chromium/test_expectations.txt

    r78006 r78010  
    32443244BUG_LOISLO : fast/invalid/residual-style.html = TEXT
    32453245BUG_LOIDLO : html5lib/runner.html = TEXT
     3246
     3247BUGWK54051 MAC : plugins/invalidate_rect.html = FAIL
  • trunk/Source/WebKit/chromium/ChangeLog

    r77963 r78010  
     12011-02-08  Sailesh Agrawal  <sail@chromium.org>
     2
     3        Reviewed by Kenneth Russell.
     4
     5        Invalidate rect doesn't work for windowless plugins on Chromium
     6        https://bugs.webkit.org/show_bug.cgi?id=53117
     7
     8        Invalidate rect for windowless plugins wasn't working if the web page was composited.
     9
     10        The problem was that the invalidate call was causing simply dirtying the LayerChromium layers. Since the plugin was windowless this didn't cause the plugin to be repainted.
     11
     12        Fix was to copy the invalidate code from WebCore/plugins/PluginView.cpp/PluginView::invalidateWindowlessPluginRect() which does the correct thing.
     13
     14        Tested my fix on Windows and Mac and verified that the movie on http://apple.com/appltv correctly plays. Verified that windowed plugins still correctly draw as well.
     15
     16        * src/WebPluginContainerImpl.cpp:
     17        (WebKit::WebPluginContainerImpl::invalidateRect):
     18
    1192011-02-08  Adam Barth  <abarth@webkit.org>
    220
  • trunk/Source/WebKit/chromium/src/WebPluginContainerImpl.cpp

    r77660 r78010  
    130130        return;
    131131
    132     IntRect damageRect = convertToContainingWindow(rect);
    133 
    134     // Get our clip rect and intersect with it to ensure we don't invalidate
    135     // too much.
    136     IntRect clipRect = parent()->windowClipRect();
    137     damageRect.intersect(clipRect);
    138 
    139     parent()->hostWindow()->invalidateContentsAndWindow(damageRect, false /*immediate*/);
     132    RenderBox* renderer = toRenderBox(m_element->renderer());
     133
     134    IntRect dirtyRect = rect;
     135    dirtyRect.move(renderer->borderLeft() + renderer->paddingLeft(),
     136                   renderer->borderTop() + renderer->paddingTop());
     137    renderer->repaintRectangle(dirtyRect);
    140138}
    141139
  • trunk/Tools/ChangeLog

    r77998 r78010  
     12011-02-08  Sailesh Agrawal  <sail@chromium.org>
     2
     3        Reviewed by Kenneth Russell.
     4
     5        Invalidate rect doesn't work for windowless plugins on Chromium
     6        https://bugs.webkit.org/show_bug.cgi?id=53117
     7
     8        Added two new utility methods.
     9        - layoutTestController.displayInvalidatedRegion() does a paint of any area that has been invalidated. This is different from layoutTestController.display() which explicitly invalidates the entire page then paints.
     10        - plugin.invalidateRect(left, top, right, bottom) - invalidates the given rect
     11        This is used to test that invalidating a rect correctly causes a repaint of the plugin.
     12
     13        * DumpRenderTree/LayoutTestController.cpp:
     14        (displayInvalidatedRegionCallback):
     15        (LayoutTestController::staticFunctions):
     16        * DumpRenderTree/LayoutTestController.h:
     17        * DumpRenderTree/TestNetscapePlugIn/PluginObject.cpp:
     18        (invalidateRect):
     19        (pluginInvoke):
     20        * DumpRenderTree/chromium/LayoutTestController.cpp:
     21        (LayoutTestController::LayoutTestController):
     22        (LayoutTestController::displayInvalidatedRegion):
     23        * DumpRenderTree/chromium/LayoutTestController.h:
     24        * Scripts/webkitpy/layout_tests/port/chromium_gpu.py:
     25
    1262011-02-08  Dirk Pranke  <dpranke@chromium.org>
    227
  • trunk/Tools/DumpRenderTree/LayoutTestController.cpp

    r75966 r78010  
    446446}
    447447
     448static JSValueRef displayInvalidatedRegionCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
     449{
     450    // Has mac & windows implementation
     451    LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
     452    // LayoutTestController::display() only renders the invalidated region so
     453    // we can just use that.
     454    controller->display();
     455
     456    return JSValueMakeUndefined(context);
     457}
     458
    448459static JSValueRef encodeHostNameCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
    449460{
     
    19811992        { "dispatchPendingLoadRequests", dispatchPendingLoadRequestsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    19821993        { "display", displayCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
     1994        { "displayInvalidatedRegion", displayInvalidatedRegionCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    19831995        { "dumpApplicationCacheDelegateCallbacks", dumpApplicationCacheDelegateCallbacksCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    19841996        { "dumpAsText", dumpAsTextCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
  • trunk/Tools/DumpRenderTree/LayoutTestController.h

    r75966 r78010  
    6060    void dispatchPendingLoadRequests();
    6161    void display();
     62    void displayInvalidatedRegion();
    6263    void execCommand(JSStringRef name, JSStringRef value);
    6364    bool findString(JSContextRef, JSStringRef, JSObjectRef optionsArray);
  • trunk/Tools/DumpRenderTree/TestNetscapePlugIn/PluginObject.cpp

    r73226 r78010  
    200200    ID_RESIZE_TO,
    201201    ID_NORMALIZE,
     202    ID_INVALIDATE_RECT,
    202203    NUM_METHOD_IDENTIFIERS
    203204};
     
    240241    "setStatus",
    241242    "resizeTo",
    242     "normalize"
     243    "normalize",
     244    "invalidateRect"
    243245};
    244246
     
    987989}
    988990
     991static bool invalidateRect(PluginObject* obj, const NPVariant* args, uint32_t argCount, NPVariant* result)
     992{
     993    if (argCount != 4)
     994        return false;
     995
     996    NPRect rect;
     997    rect.left = NPVARIANT_TO_DOUBLE(args[0]);
     998    rect.top = NPVARIANT_TO_DOUBLE(args[1]);
     999    rect.right = NPVARIANT_TO_DOUBLE(args[2]);
     1000    rect.bottom = NPVARIANT_TO_DOUBLE(args[3]);
     1001   
     1002    browser->invalidaterect(obj->npp, &rect);
     1003    return true;
     1004}
    9891005
    9901006static bool pluginInvoke(NPObject* header, NPIdentifier name, const NPVariant* args, uint32_t argCount, NPVariant* result)
     
    11021118    if (name == pluginMethodIdentifiers[ID_NORMALIZE])
    11031119        return normalizeOverride(plugin, args, argCount, result);
     1120    if (name == pluginMethodIdentifiers[ID_INVALIDATE_RECT])
     1121        return invalidateRect(plugin, args, argCount, result);
    11041122
    11051123    return false;
  • trunk/Tools/DumpRenderTree/chromium/LayoutTestController.cpp

    r77875 r78010  
    9090    bindMethod("disableImageLoading", &LayoutTestController::disableImageLoading);
    9191    bindMethod("display", &LayoutTestController::display);
     92    bindMethod("displayInvalidatedRegion", &LayoutTestController::displayInvalidatedRegion);
    9293    bindMethod("dumpAsText", &LayoutTestController::dumpAsText);
    9394    bindMethod("dumpBackForwardList", &LayoutTestController::dumpBackForwardList);
     
    10851086}
    10861087
     1088void LayoutTestController::displayInvalidatedRegion(const CppArgumentList& arguments, CppVariant* result)
     1089{
     1090    WebViewHost* host = m_shell->webViewHost();
     1091    host->paintInvalidatedRegion();
     1092    host->displayRepaintMask();
     1093    result->setNull();
     1094}
     1095
    10871096void LayoutTestController::testRepaint(const CppArgumentList&, CppVariant* result)
    10881097{
  • trunk/Tools/DumpRenderTree/chromium/LayoutTestController.h

    r76620 r78010  
    251251    void setMainFrameIsFirstResponder(const CppArgumentList&, CppVariant*);
    252252    void display(const CppArgumentList&, CppVariant*);
     253    void displayInvalidatedRegion(const CppArgumentList&, CppVariant*);
    253254    void testRepaint(const CppArgumentList&, CppVariant*);
    254255    void repaintSweepHorizontally(const CppArgumentList&, CppVariant*);
  • trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium_gpu.py

    r77666 r78010  
    7979            # in running the tests there.
    8080            paths += ['fast/canvas', 'canvas/philip']
     81        # invalidate_rect.html tests a bug in the compositor.
     82        # See https://bugs.webkit.org/show_bug.cgi?id=53117
     83        paths += ['plugins/invalidate_rect.html']
    8184    return test_files.find(port, paths)
    8285
Note: See TracChangeset for help on using the changeset viewer.