LayoutTests:
authorandersca <andersca@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 17 Aug 2007 22:12:56 +0000 (22:12 +0000)
committerandersca <andersca@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 17 Aug 2007 22:12:56 +0000 (22:12 +0000)
        Reviewed by Dave Hyatt.

        <rdar://problem/5379040>
        REGRESSION (Tiger-Leopard): ADOBE: Safari calls NPP_SetWindow with bad values sometimes

        Add test.

        * plugins/netscape-plugin-setwindow-size-expected.txt: Added.
        * plugins/netscape-plugin-setwindow-size.html: Added.

WebCore:

        Reviewed by Dave Hyatt.

        <rdar://problem/5379040>
        REGRESSION (Tiger-Leopard): ADOBE: Safari calls NPP_SetWindow with bad values sometimes

        Instantiate plug-ins during the first layout instead of doing so when creating the renderer.
        This ensures that the plug-in widget will have a correct initial size.

        * html/HTMLEmbedElement.cpp:
        (WebCore::HTMLEmbedElement::getInstance):
        Force a layout if the plug-in doesn't have an instance.

        (WebCore::HTMLEmbedElement::attach):
        Pass true to updateWidget, causing it to only create a widget if it won't be a plug-in.

        * html/HTMLIFrameElement.cpp:
        (WebCore::HTMLIFrameElement::attach):
        Pass false to updateWidget, this will only create subframes anyway.

        * html/HTMLObjectElement.cpp:
        (WebCore::HTMLObjectElement::getInstance):
        Force a layout if the plug-in doesn't have an instance.

        (WebCore::HTMLObjectElement::attach):
        Pass true to updateWidget, causing it to only create a widget if it won't be a plug-in.

        * loader/FrameLoader.cpp:
        (WebCore::FrameLoader::loadPlugin):
        Get the size from the renderer and pass it to the client.

        * loader/FrameLoaderClient.h:
        * page/mac/WebCoreFrameBridge.h:
        * platform/graphics/svg/SVGImageEmptyClients.h:
        (WebCore::SVGEmptyFrameLoaderClient::createPlugin):
        Update declarations.

        * rendering/RenderPart.cpp:
        (WebCore::RenderPart::setWidget):
        No need to mark the renderer as dirty here.

        * rendering/RenderPartObject.h:
        * rendering/RenderPartObject.cpp:
        (WebCore::RenderPartObject::updateWidget):
        Add a parameter, onlyCreateNonPlugins. If this is true the widget
        will only be created if it's not a plug-in.

        (WebCore::RenderPartObject::layout):
        Call updateWidget here if m_widget is 0, causing the plug-in to be instantiated.

WebKit:

        Reviewed by Dave Hyatt.

        <rdar://problem/5379040>
        REGRESSION (Tiger-Leopard): ADOBE: Safari calls NPP_SetWindow with bad values sometimes

        Pass the right size when creating the views.

        * WebCoreSupport/WebFrameBridge.mm:
        (-[WebFrameBridge viewForPluginWithFrame:URL:attributeNames:attributeValues:MIMEType:DOMElement:loadManually:]):
        * WebCoreSupport/WebFrameLoaderClient.h:
        * WebCoreSupport/WebFrameLoaderClient.mm:
        (WebFrameLoaderClient::createPlugin):

WebKitTools:

        Reviewed by Dave Hyatt.

        <rdar://problem/5379040>
        REGRESSION (Tiger-Leopard): ADOBE: Safari calls NPP_SetWindow with bad values sometimes

        Add a way for the plug-in to dump the width and height when it gets its  NPP_SetWindow call.

        * DumpRenderTree/TestNetscapePlugIn.subproj/PluginObject.c:
        (pluginAllocate):
        * DumpRenderTree/TestNetscapePlugIn.subproj/PluginObject.h:
        * DumpRenderTree/TestNetscapePlugIn.subproj/main.c:
        (NPP_New):
        (NPP_SetWindow):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@25128 268f45cc-cd09-0410-ab3c-d52691b4dbfc

23 files changed:
LayoutTests/ChangeLog
LayoutTests/plugins/netscape-plugin-setwindow-size-expected.txt [new file with mode: 0644]
LayoutTests/plugins/netscape-plugin-setwindow-size.html [new file with mode: 0644]
WebCore/ChangeLog
WebCore/WebCore.xcodeproj/project.pbxproj
WebCore/html/HTMLEmbedElement.cpp
WebCore/html/HTMLIFrameElement.cpp
WebCore/html/HTMLObjectElement.cpp
WebCore/loader/FrameLoader.cpp
WebCore/loader/FrameLoaderClient.h
WebCore/page/mac/WebCoreFrameBridge.h
WebCore/platform/graphics/svg/SVGImageEmptyClients.h
WebCore/rendering/RenderPart.cpp
WebCore/rendering/RenderPartObject.cpp
WebCore/rendering/RenderPartObject.h
WebKit/ChangeLog
WebKit/WebCoreSupport/WebFrameBridge.mm
WebKit/WebCoreSupport/WebFrameLoaderClient.h
WebKit/WebCoreSupport/WebFrameLoaderClient.mm
WebKitTools/ChangeLog
WebKitTools/DumpRenderTree/TestNetscapePlugIn.subproj/PluginObject.c
WebKitTools/DumpRenderTree/TestNetscapePlugIn.subproj/PluginObject.h
WebKitTools/DumpRenderTree/TestNetscapePlugIn.subproj/main.c

index 6e4bb0b..be986a4 100644 (file)
@@ -1,3 +1,15 @@
+2007-08-17  Anders Carlsson  <andersca@apple.com>
+
+        Reviewed by Dave Hyatt.
+
+        <rdar://problem/5379040>
+        REGRESSION (Tiger-Leopard): ADOBE: Safari calls NPP_SetWindow with bad values sometimes
+        
+        Add test.
+        
+        * plugins/netscape-plugin-setwindow-size-expected.txt: Added.
+        * plugins/netscape-plugin-setwindow-size.html: Added.
+
 2007-08-17  Oliver Hunt  <oliver@apple.com>
 
         Reviewed by Maciej.
diff --git a/LayoutTests/plugins/netscape-plugin-setwindow-size-expected.txt b/LayoutTests/plugins/netscape-plugin-setwindow-size-expected.txt
new file mode 100644 (file)
index 0000000..d5b36a2
--- /dev/null
@@ -0,0 +1,3 @@
+PLUGIN: NPP_SetWindow: 800 200
+
+This tests that a plug-in with a percentage width gets a correct NPP_SetWindow the first time.
diff --git a/LayoutTests/plugins/netscape-plugin-setwindow-size.html b/LayoutTests/plugins/netscape-plugin-setwindow-size.html
new file mode 100644 (file)
index 0000000..40000a1
--- /dev/null
@@ -0,0 +1,13 @@
+<html>
+<head>
+<script>
+    if (window.layoutTestController)
+        layoutTestController.dumpAsText();
+</script>
+<body style="margin:0px;overflow:hidden">
+<embed id="testPlugin" type="application/x-webkit-test-netscape" logfirstsetwindow="true" width="100%" height="200"></embed>
+<div>
+    This tests that a plug-in with a percentage width gets a correct NPP_SetWindow the first time.
+</div>
+<body>
+</html>
index 589d4df..99875d2 100644 (file)
@@ -1,3 +1,54 @@
+2007-08-17  Anders Carlsson  <andersca@apple.com>
+
+        Reviewed by Dave Hyatt.
+        
+        <rdar://problem/5379040>
+        REGRESSION (Tiger-Leopard): ADOBE: Safari calls NPP_SetWindow with bad values sometimes
+
+        Instantiate plug-ins during the first layout instead of doing so when creating the renderer.
+        This ensures that the plug-in widget will have a correct initial size.
+        
+        * html/HTMLEmbedElement.cpp:
+        (WebCore::HTMLEmbedElement::getInstance):
+        Force a layout if the plug-in doesn't have an instance.
+        
+        (WebCore::HTMLEmbedElement::attach):
+        Pass true to updateWidget, causing it to only create a widget if it won't be a plug-in.
+        
+        * html/HTMLIFrameElement.cpp:        
+        (WebCore::HTMLIFrameElement::attach):
+        Pass false to updateWidget, this will only create subframes anyway.
+        
+        * html/HTMLObjectElement.cpp:
+        (WebCore::HTMLObjectElement::getInstance):
+        Force a layout if the plug-in doesn't have an instance.
+        
+        (WebCore::HTMLObjectElement::attach):
+        Pass true to updateWidget, causing it to only create a widget if it won't be a plug-in.
+        
+        * loader/FrameLoader.cpp:
+        (WebCore::FrameLoader::loadPlugin):
+        Get the size from the renderer and pass it to the client.
+        
+        * loader/FrameLoaderClient.h:
+        * page/mac/WebCoreFrameBridge.h:
+        * platform/graphics/svg/SVGImageEmptyClients.h:
+        (WebCore::SVGEmptyFrameLoaderClient::createPlugin):
+        Update declarations.
+        
+        * rendering/RenderPart.cpp:
+        (WebCore::RenderPart::setWidget):
+        No need to mark the renderer as dirty here.
+        
+        * rendering/RenderPartObject.h:
+        * rendering/RenderPartObject.cpp:
+        (WebCore::RenderPartObject::updateWidget):
+        Add a parameter, onlyCreateNonPlugins. If this is true the widget 
+        will only be created if it's not a plug-in.
+        
+        (WebCore::RenderPartObject::layout):
+        Call updateWidget here if m_widget is 0, causing the plug-in to be instantiated.
+        
 2007-08-17  Oliver Hunt  <oliver@apple.com>
 
         Reviewed by Maciej.
index 106d70c..eeaf101 100644 (file)
                0867D690FE84028FC02AAC07 /* Project object */ = {
                        isa = PBXProject;
                        buildConfigurationList = 149C284308902B11008A9EFC /* Build configuration list for PBXProject "WebCore" */;
+                       compatibilityVersion = "Xcode 2.4";
                        hasScannedForEncodings = 1;
                        knownRegions = (
                                English,
index 32b88cc..3af6a68 100644 (file)
@@ -65,6 +65,8 @@ KJS::Bindings::Instance *HTMLEmbedElement::getInstance() const
     if (m_instance)
         return m_instance.get();
     
+    document()->updateLayoutIgnorePendingStylesheets();
+
     RenderObject *r = renderer();
     if (!r) {
         Node *p = parentNode();
@@ -153,7 +155,7 @@ void HTMLEmbedElement::attach()
     HTMLPlugInElement::attach();
 
     if (renderer())
-        static_cast<RenderPartObject*>(renderer())->updateWidget();
+        static_cast<RenderPartObject*>(renderer())->updateWidget(true);
 }
 
 void HTMLEmbedElement::detach()
index 9a7ee10..13a6306 100644 (file)
@@ -121,7 +121,7 @@ void HTMLIFrameElement::attach()
     HTMLFrameElementBase::attach();
 
     if (RenderPartObject* renderPartObject = static_cast<RenderPartObject*>(renderer()))
-        renderPartObject->updateWidget();
+        renderPartObject->updateWidget(false);
 }
 
 bool HTMLIFrameElement::isURLAttribute(Attribute* attr) const
index a49f258..41959e2 100644 (file)
@@ -81,6 +81,7 @@ KJS::Bindings::Instance *HTMLObjectElement::getInstance() const
     if (m_instance)
         return m_instance.get();
 
+    document()->updateLayoutIgnorePendingStylesheets();
     RenderObject* r = renderer();
     if (r && r->isWidget()) {
         if (Widget* widget = static_cast<RenderWidget*>(r)->widget()) 
@@ -184,7 +185,7 @@ void HTMLObjectElement::attach()
                 // Set m_needWidgetUpdate to false before calling updateWidget because updateWidget may cause
                 // this method or recalcStyle (which also calls updateWidget) to be called.
                 m_needWidgetUpdate = false;
-                static_cast<RenderPartObject*>(renderer())->updateWidget();
+                static_cast<RenderPartObject*>(renderer())->updateWidget(true);
             } else {
                 m_needWidgetUpdate = true;
                 setChanged();
index 7120caf..69ed952 100644 (file)
@@ -1529,7 +1529,8 @@ bool FrameLoader::loadPlugin(RenderPart* renderer, const KURL& url, const String
             return false;
         }
 
-        widget = m_client->createPlugin(pluginElement, url, paramNames, paramValues, mimeType,
+        widget = m_client->createPlugin(IntSize(renderer->contentWidth(), renderer->contentHeight()), 
+                                        pluginElement, url, paramNames, paramValues, mimeType,
                                         m_frame->document()->isPluginDocument());
         if (widget) {
             renderer->setWidget(widget);
index 4a52eb4..109928e 100644 (file)
@@ -198,7 +198,7 @@ namespace WebCore {
 
         virtual Frame* createFrame(const KURL& url, const String& name, HTMLFrameOwnerElement* ownerElement,
                                    const String& referrer, bool allowsScrolling, int marginWidth, int marginHeight) = 0;
-        virtual Widget* createPlugin(Element*, const KURL&, const Vector<String>&, const Vector<String>&, const String&, bool loadManually) = 0;
+        virtual Widget* createPlugin(const IntSize&, Element*, const KURL&, const Vector<String>&, const Vector<String>&, const String&, bool loadManually) = 0;
         virtual void redirectDataToPlugin(Widget* pluginWidget) = 0;
         
         virtual Widget* createJavaAppletWidget(const IntSize&, Element*, const KURL& baseURL, const Vector<String>& paramNames, const Vector<String>& paramValues) = 0;
index 0c39093..c704191 100644 (file)
@@ -264,12 +264,13 @@ typedef enum ObjectElementType {
 
 - (void)setNeedsReapplyStyles;
 
-- (NSView *)viewForPluginWithURL:(NSURL *)URL
-                  attributeNames:(NSArray *)attributeNames
-                 attributeValues:(NSArray *)attributeValues
-                        MIMEType:(NSString *)MIMEType
-                      DOMElement:(DOMElement *)element
-                    loadManually:(BOOL)loadManually;
+- (NSView *)viewForPluginWithFrame:(NSRect)frame
+                               URL:(NSURL *)URL
+                    attributeNames:(NSArray *)attributeNames
+                   attributeValues:(NSArray *)attributeValues
+                          MIMEType:(NSString *)MIMEType
+                        DOMElement:(DOMElement *)element
+                      loadManually:(BOOL)loadManually;
 - (NSView *)viewForJavaAppletWithFrame:(NSRect)frame
                         attributeNames:(NSArray *)attributeNames
                        attributeValues:(NSArray *)attributeValues
index 20eb6cc..5119f9f 100644 (file)
@@ -264,7 +264,7 @@ public:
 
     virtual Frame* createFrame(const KURL& url, const String& name, HTMLFrameOwnerElement* ownerElement,
                                const String& referrer, bool allowsScrolling, int marginWidth, int marginHeight) { return 0; }
-    virtual Widget* createPlugin(Element*, const KURL&, const Vector<String>&, const Vector<String>&, const String&, bool) { return 0; }
+    virtual Widget* createPlugin(const IntSize&,Element*, const KURL&, const Vector<String>&, const Vector<String>&, const String&, bool) { return 0; }
     virtual Widget* createJavaAppletWidget(const IntSize&, Element*, const KURL&, const Vector<String>&, const Vector<String>&) { return 0; }
     
     virtual ObjectContentType objectContentType(const KURL& url, const String& mimeType) { return ObjectContentType(); }
index 7b454e9..698205c 100644 (file)
@@ -63,8 +63,6 @@ void RenderPart::setWidget(Widget* widget)
             static_cast<FrameView*>(widget)->ref();
         RenderWidget::setWidget(widget);
 
-        setNeedsLayoutAndPrefWidthsRecalc();
-
         // make sure the scrollbars are set correctly for restore
         // ### find better fix
         viewCleared();
index 1bed517..4dd956f 100644 (file)
@@ -29,6 +29,7 @@
 #include "EventHandler.h"
 #include "Frame.h"
 #include "FrameLoader.h"
+#include "FrameLoaderClient.h"
 #include "FrameTree.h"
 #include "FrameView.h"
 #include "HTMLEmbedElement.h"
@@ -100,16 +101,14 @@ static inline void mapClassIdToServiceType(const String& classId, String& servic
     // TODO: add more plugins here
 }
 
-void RenderPartObject::updateWidget()
+void RenderPartObject::updateWidget(bool onlyCreateNonPlugins)
 {
   String url;
   String serviceType;
   Vector<String> paramNames;
   Vector<String> paramValues;
   Frame* frame = m_view->frame();
-
-  setNeedsLayoutAndPrefWidthsRecalc();
-
+  
   if (element()->hasTagName(objectTag)) {
 
       HTMLObjectElement* o = static_cast<HTMLObjectElement*>(element());
@@ -217,6 +216,16 @@ void RenderPartObject::updateWidget()
               (child->isTextNode() && !static_cast<Text*>(child)->containsOnlyWhitespace()))
               m_hasFallbackContent = true;
       }
+      
+      if (onlyCreateNonPlugins) {
+          KURL completedURL;
+          if (!url.isEmpty())
+              completedURL = frame->loader()->completeURL(url);
+        
+          if (frame->loader()->client()->objectContentType(completedURL, serviceType) == ObjectContentPlugin)
+              return;
+      }
+      
       bool success = frame->loader()->requestObject(this, url, AtomicString(o->name()), serviceType, paramNames, paramValues);
       if (!success && m_hasFallbackContent)
           o->renderFallbackContent();
@@ -239,6 +248,16 @@ void RenderPartObject::updateWidget()
               paramValues.append(it->value().domString());
           }
       }
+      
+      if (onlyCreateNonPlugins) {
+          KURL completedURL;
+          if (!url.isEmpty())
+              completedURL = frame->loader()->completeURL(url);
+          
+          if (frame->loader()->client()->objectContentType(completedURL, serviceType) == ObjectContentPlugin)
+              return;
+      }
+      
       frame->loader()->requestObject(this, url, o->getAttribute(nameAttr), serviceType, paramNames, paramValues);
   }
 }
@@ -253,6 +272,9 @@ void RenderPartObject::layout()
 
     RenderPart::layout();
 
+    if (!m_widget)
+      updateWidget(false);
+    
     setNeedsLayout(false);
 }
 
index 6054564..e71131a 100644 (file)
@@ -36,7 +36,7 @@ public:
     virtual const char* renderName() const { return "RenderPartObject"; }
 
     virtual void layout();
-    virtual void updateWidget();
+    void updateWidget(bool onlyCreateNonPlugins);
 
     virtual void viewCleared();
 };
index a2ff8bd..4e84c06 100644 (file)
@@ -1,3 +1,18 @@
+2007-08-17  Anders Carlsson  <andersca@apple.com>
+
+        Reviewed by Dave Hyatt.
+
+        <rdar://problem/5379040> 
+        REGRESSION (Tiger-Leopard): ADOBE: Safari calls NPP_SetWindow with bad values sometimes
+        
+        Pass the right size when creating the views.
+        
+        * WebCoreSupport/WebFrameBridge.mm:
+        (-[WebFrameBridge viewForPluginWithFrame:URL:attributeNames:attributeValues:MIMEType:DOMElement:loadManually:]):
+        * WebCoreSupport/WebFrameLoaderClient.h:
+        * WebCoreSupport/WebFrameLoaderClient.mm:
+        (WebFrameLoaderClient::createPlugin):
+
 2007-08-13  Geoffrey Garen  <ggaren@apple.com>
 
         Reviewed by Dave Hyatt.
index a11c13b..8ec72a6 100644 (file)
@@ -432,12 +432,13 @@ NSString *WebPluginContainerKey =   @"WebPluginContainer";
     return nil;
 }
 
-- (NSView *)viewForPluginWithURL:(NSURL *)URL
-                  attributeNames:(NSArray *)attributeNames
-                 attributeValues:(NSArray *)attributeValues
-                        MIMEType:(NSString *)MIMEType
-                      DOMElement:(DOMElement *)element
-                    loadManually:(BOOL)loadManually
+- (NSView *)viewForPluginWithFrame:(NSRect)frame
+                               URL:(NSURL *)URL
+                    attributeNames:(NSArray *)attributeNames
+                   attributeValues:(NSArray *)attributeValues
+                          MIMEType:(NSString *)MIMEType
+                        DOMElement:(DOMElement *)element
+                      loadManually:(BOOL)loadManually
 {
     ASSERT([attributeNames count] == [attributeValues count]);
 
@@ -491,7 +492,7 @@ NSString *WebPluginContainerKey =   @"WebPluginContainer";
         }
 #ifndef __LP64__
         else if ([pluginPackage isKindOfClass:[WebNetscapePluginPackage class]]) {
-            WebNetscapePluginEmbeddedView *embeddedView = [[[WebNetscapePluginEmbeddedView alloc] initWithFrame:NSZeroRect
+            WebNetscapePluginEmbeddedView *embeddedView = [[[WebNetscapePluginEmbeddedView alloc] initWithFrame:frame
                                                            pluginPackage:(WebNetscapePluginPackage *)pluginPackage
                                                                      URL:URL
                                                                  baseURL:baseURL
@@ -517,7 +518,7 @@ NSString *WebPluginContainerKey =   @"WebPluginContainer";
                                                      pluginPageURL:pluginPageURL
                                                         pluginName:[pluginPackage name]
                                                           MIMEType:MIMEType];
-        WebNullPluginView *nullView = [[[WebNullPluginView alloc] initWithFrame:NSZeroRect error:error DOMElement:element] autorelease];
+        WebNullPluginView *nullView = [[[WebNullPluginView alloc] initWithFrame:frame error:error DOMElement:element] autorelease];
         view = nullView;
         [error release];
     }
index 2cb314f..66ac2b4 100644 (file)
@@ -184,7 +184,7 @@ private:
 
     virtual WebCore::Frame* createFrame(const WebCore::KURL& url, const WebCore::String& name, WebCore::HTMLFrameOwnerElement*,
                                         const WebCore::String& referrer, bool allowsScrolling, int marginWidth, int marginHeight);
-    virtual WebCore::Widget* createPlugin(WebCore::Element*, const WebCore::KURL&, const Vector<WebCore::String>&,
+    virtual WebCore::Widget* createPlugin(const WebCore::IntSize&, WebCore::Element*, const WebCore::KURL&, const Vector<WebCore::String>&,
                                           const Vector<WebCore::String>&, const WebCore::String&, bool);
     virtual void redirectDataToPlugin(WebCore::Widget* pluginWidget);
     
index e5610d2..a98c535 100644 (file)
@@ -1215,18 +1215,19 @@ static NSArray* nsArray(const Vector<String>& vector)
     return array;
 }
 
-Widget* WebFrameLoaderClient::createPlugin(Element* element, const KURL& url, const Vector<String>& paramNames,
+Widget* WebFrameLoaderClient::createPlugin(const IntSize& size, Element* element, const KURL& url, const Vector<String>& paramNames,
                                            const Vector<String>& paramValues, const String& mimeType, bool loadManually)
 {
     WebFrameBridge* bridge = m_webFrame->_private->bridge;
 
     BEGIN_BLOCK_OBJC_EXCEPTIONS;
-    return new Widget([bridge viewForPluginWithURL:url.getNSURL()
-                              attributeNames:nsArray(paramNames)
-                              attributeValues:nsArray(paramValues)
-                              MIMEType:mimeType
-                              DOMElement:[DOMElement _wrapElement:element]
-                              loadManually:loadManually]);
+    return new Widget([bridge viewForPluginWithFrame:NSMakeRect(0, 0, size.width(), size.height())
+                                                 URL:url.getNSURL()
+                                      attributeNames:nsArray(paramNames)
+                                     attributeValues:nsArray(paramValues)
+                                            MIMEType:mimeType
+                                          DOMElement:[DOMElement _wrapElement:element]
+                                        loadManually:loadManually]);
     END_BLOCK_OBJC_EXCEPTIONS;
 
     return 0;
index e7006d3..8860f5f 100644 (file)
@@ -1,3 +1,19 @@
+2007-08-17  Anders Carlsson  <andersca@apple.com>
+
+        Reviewed by Dave Hyatt.
+
+        <rdar://problem/5379040>
+        REGRESSION (Tiger-Leopard): ADOBE: Safari calls NPP_SetWindow with bad values sometimes
+
+        Add a way for the plug-in to dump the width and height when it gets its  NPP_SetWindow call.
+        
+        * DumpRenderTree/TestNetscapePlugIn.subproj/PluginObject.c:
+        (pluginAllocate):
+        * DumpRenderTree/TestNetscapePlugIn.subproj/PluginObject.h:
+        * DumpRenderTree/TestNetscapePlugIn.subproj/main.c:
+        (NPP_New):
+        (NPP_SetWindow):
+
 2007-08-16  Alice Liu  <alice.liu@apple.com>
 
         Reviewed by Maciej.
index 69b5ca0..f9c808f 100644 (file)
@@ -334,6 +334,7 @@ static NPObject *pluginAllocate(NPP npp, NPClass *theClass)
     newInstance->testObject = browser->createobject(npp, getTestClass());
     newInstance->eventLogging = FALSE;
     newInstance->logDestroy = FALSE;
+    newInstance->logSetWindow = FALSE;
     newInstance->returnErrorFromNewStream = FALSE;
     newInstance->stream = 0;
     
index a25b3d9..95abbf9 100644 (file)
@@ -39,6 +39,7 @@ typedef struct {
     NPObject header;
     NPP npp;
     NPBool eventLogging;
+    NPBool logSetWindow;
     NPBool logDestroy;
     NPBool returnErrorFromNewStream;
     NPObject* testObject;
index 017c07b..3e84c42 100644 (file)
@@ -83,6 +83,8 @@ NPError NPP_New(NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc, ch
             else if (strcasecmp(argn[i], "src") == 0 &&
                      strcasecmp(argv[i], "data:application/x-webkit-test-netscape,returnerrorfromnewstream") == 0)
                 obj->returnErrorFromNewStream = TRUE;
+            else if (strcasecmp(argn[i], "logfirstsetwindow") == 0)
+                obj->logSetWindow = TRUE;
         }
         
         instance->pdata = obj;
@@ -108,6 +110,15 @@ NPError NPP_Destroy(NPP instance, NPSavedData **save)
 
 NPError NPP_SetWindow(NPP instance, NPWindow *window)
 {
+    PluginObject *obj = instance->pdata;
+
+    if (obj) {
+        if (obj->logSetWindow) {
+            printf("PLUGIN: NPP_SetWindow: %d %d\n", window->width, window->height);
+            obj->logSetWindow = false;
+        }
+    }
+    
     return NPERR_NO_ERROR;
 }