root/trunk/llmozlib2/build_mozilla/linden.patch

Revision 13, 56.0 kB (checked in by zen.linden, 2 years ago)

Memory management cleanup patch for mozilla on OSX and correction of README file for OSX

Code reviewed by Callum

  • layout/generic/nsObjectFrame.cpp

    old new  
    17841784  return rv; 
    17851785} 
    17861786 
    1787 NS_IMETHODIMP 
    1788 nsObjectFrame::Paint(nsPresContext*       aPresContext, 
    1789                      nsIRenderingContext& aRenderingContext, 
    1790                      const nsRect&        aDirtyRect, 
    1791                      nsFramePaintLayer    aWhichLayer, 
    1792                      PRUint32             aFlags) 
    1793 
    1794   if (!GetStyleVisibility()->IsVisibleOrCollapsed()) 
    1795     return NS_OK; 
    1796    
    1797   nsIFrame * child = mFrames.FirstChild(); 
    1798   if (child) {    // if we have children, we are probably not really a plugin 
    1799     nsObjectFrameSuper::Paint(aPresContext, aRenderingContext, aDirtyRect, aWhichLayer); 
    1800     return NS_OK; 
    1801   } 
    1802  
    1803   // If we are painting in Print Preview do nothing.... 
    1804   if (aPresContext->Type() == nsPresContext::eContext_PrintPreview) { 
    1805     return NS_OK; 
    1806   } 
    1807  
    1808   // determine if we are printing 
    1809   if (aPresContext->Type() == nsPresContext::eContext_Print) { 
    1810     // UNIX Plugins can't PP at this time, so draw an empty box 
    1811     // we only want to print on the content layer pass 
    1812     if (eFramePaintLayer_Content != aWhichLayer) 
    1813       return NS_OK; 
    1814  
    1815     // if we are printing, we need to get the correct nsIPluginInstance 
    1816     // for THIS content node in order to call ->Print() on the right plugin 
    1817  
     1787// set values for aPlugWin, aPlugPrint and aPlugInstance 
     1788nsresult 
     1789nsObjectFrame::SetupPrinting(nsIRenderingContext& aRenderingContext, 
     1790                             nsPresContext *aPresContext, 
     1791                             nsPluginWindow &aPlugWin, 
     1792                             nsPluginPrint  &aPlugPrint, 
     1793                             nsIPluginInstance *&aPlugInstance) { 
     1794  // We need to make sure we have the right frame for the plugin. This 
     1795  //   seems silly, but it is actually necessary on some pages. We  
     1796  //   will actually get a null mPluginInstanceOwner sometimes if we 
     1797  //   don't do this. 
    18181798    // first, we need to get the document 
    18191799    nsCOMPtr<nsIDocument> doc = mContent->GetDocument(); 
    18201800    NS_ENSURE_TRUE(doc, NS_ERROR_NULL_POINTER); 
     
    18371817      objectFrame = GetNextObjectFrame(aPresContext,frame); 
    18381818    NS_ENSURE_TRUE(objectFrame,NS_ERROR_FAILURE); 
    18391819 
    1840     // finally we can get our plugin instance 
    1841     nsCOMPtr<nsIPluginInstance> pi; 
    1842     if (NS_FAILED(objectFrame->GetPluginInstance(*getter_AddRefs(pi))) || !pi) 
     1820  // finally, get our plugin instance 
     1821  nsCOMPtr<nsIPluginInstance> tempPluginInstance; 
     1822  if (NS_FAILED(objectFrame->GetPluginInstance(*getter_AddRefs(tempPluginInstance))) || 
     1823      !tempPluginInstance) 
    18431824      return NS_ERROR_FAILURE; 
     1825  NS_IF_ADDREF(aPlugInstance = tempPluginInstance); 
    18441826 
    18451827    // now we need to setup the correct location for printing 
    1846     nsresult rv; 
    1847     nsPluginWindow    window; 
    18481828    nsPoint           origin; 
    18491829    float             t2p; 
    1850     window.window =  nsnull; 
     1830  aPlugWin.window = nsnull; 
    18511831 
    18521832    // prepare embedded mode printing struct 
    1853     nsPluginPrint npprint; 
    1854     npprint.mode = nsPluginMode_Embedded; 
     1833  aPlugPrint.mode = nsPluginMode_Embedded; 
    18551834 
    18561835    // we need to find out if we are windowless or not 
    18571836    PRBool windowless = PR_FALSE; 
    1858     pi->GetValue(nsPluginInstanceVariable_WindowlessBool, (void *)&windowless); 
    1859     window.type  =  windowless ? nsPluginWindowType_Drawable : nsPluginWindowType_Window; 
     1837  aPlugInstance->GetValue(nsPluginInstanceVariable_WindowlessBool, (void *)&windowless); 
     1838  aPlugWin.type  =  windowless ? nsPluginWindowType_Drawable : nsPluginWindowType_Window; 
    18601839 
    18611840    // Get the offset of the DC 
    18621841    nsTransform2D* rcTransform; 
     
    18681847 
    18691848    // set it all up 
    18701849    // XXX is windowless different? 
    1871     window.x = origin.x; 
    1872     window.y = origin.y; 
    1873     window.width = NSToCoordRound(mRect.width * t2p); 
    1874     window.height= NSToCoordRound(mRect.height * t2p); 
    1875     window.clipRect.bottom = 0; window.clipRect.top = 0; 
    1876     window.clipRect.left = 0; window.clipRect.right = 0; 
     1850  aPlugWin.x = origin.x; 
     1851  aPlugWin.y = origin.y; 
     1852  aPlugWin.width = NSToCoordRound(mRect.width * t2p); 
     1853  aPlugWin.height= NSToCoordRound(mRect.height * t2p); 
     1854  aPlugWin.clipRect.bottom = 0; aPlugWin.clipRect.top = 0; 
     1855  aPlugWin.clipRect.left = 0; aPlugWin.clipRect.right = 0; 
     1856  aPlugPrint.print.embedPrint.window = aPlugWin; 
     1857 
     1858  return NS_OK; 
     1859
     1860 
     1861NS_IMETHODIMP 
     1862nsObjectFrame::Paint(nsPresContext*       aPresContext, 
     1863                     nsIRenderingContext& aRenderingContext, 
     1864                     const nsRect&        aDirtyRect, 
     1865                     nsFramePaintLayer    aWhichLayer, 
     1866                     PRUint32             aFlags) 
     1867
     1868  if (!GetStyleVisibility()->IsVisibleOrCollapsed()) 
     1869    return NS_OK; 
     1870   
     1871  nsIFrame * child = mFrames.FirstChild(); 
     1872  if (child) {    // if we have children, we are probably not really a plugin 
     1873    nsObjectFrameSuper::Paint(aPresContext, aRenderingContext, aDirtyRect, aWhichLayer); 
     1874    return NS_OK; 
     1875  } 
     1876 
     1877  // If we are painting in Print Preview do nothing.... 
     1878  if (aPresContext->Type() == nsPresContext::eContext_PrintPreview) { 
     1879    return NS_OK; 
     1880  } 
     1881 
     1882  if (aPresContext->Type() == nsPresContext::eContext_Print) { 
     1883    // UNIX Plugins can't PP at this time, so draw an empty box 
     1884    // we only want to print on the content layer pass 
     1885    if (eFramePaintLayer_Content != aWhichLayer) 
     1886      return NS_OK; 
     1887 
     1888    // data to pass on to the plugin 
     1889    nsPluginPrint  npprint; 
     1890    nsPluginWindow window; 
     1891    nsCOMPtr<nsIPluginInstance> pi; 
     1892    nsresult rv; 
     1893 
     1894    // sets fields in the plugin structs and gets the plugin instance 
     1895    rv = SetupPrinting(aRenderingContext, aPresContext, window, npprint, (*getter_AddRefs(pi))); 
     1896    if (NS_FAILED(rv)) 
     1897      return rv; 
    18771898     
    18781899// XXX platform specific printing code 
    18791900#if defined(XP_MAC) && !TARGET_CARBON 
     
    18961917     
    18971918    window.window = &port; 
    18981919    npprint.print.embedPrint.platformPrint = (void*)window.window; 
    1899     npprint.print.embedPrint.window = window; 
    19001920    // send off print info to plugin 
    19011921    rv = pi->Print(&npprint); 
    19021922#elif defined(XP_UNIX) && !defined(XP_MACOSX) 
     
    19251945    window.y =   aDirtyRect.y; 
    19261946    window.width =   aDirtyRect.width; 
    19271947    window.height =   aDirtyRect.height; 
    1928     npprint.print.embedPrint.window        = window; 
    19291948    rv = pi->Print(&npprint); 
    19301949    if (NS_FAILED(rv)) { 
    19311950      PR_LOG(nsObjectFrameLM, PR_LOG_DEBUG, ("error: plugin returned failure %lx\n", (long)rv)); 
     
    19511970      return NS_OK;  // no dc implemented so quit 
    19521971 
    19531972    npprint.print.embedPrint.platformPrint = (void*)pDC; 
    1954     npprint.print.embedPrint.window = window; 
    19551973    // send off print info to plugin 
    19561974    rv = pi->Print(&npprint); 
    19571975 
     
    19651983#endif 
    19661984 
    19671985    // XXX Nav 4.x always sent a SetWindow call after print. Should we do the same? 
     1986    /* XXXjgaunt - commenting this out because we lost the frame in 
     1987                 - re-factoring. (setupPrinting()) 
     1988                 - Is this really necessary??? 
    19681989    nsDidReflowStatus status = NS_FRAME_REFLOW_FINISHED; // should we use a special status? 
    19691990    frame->DidReflow(shell->GetPresContext(), 
    19701991                     nsnull, status);  // DidReflow will take care of it 
     1992    */ 
    19711993 
    19721994    return rv;  // done with printing 
    19731995  } 
     
    19782000  if ((NS_FRAME_PAINT_LAYER_FOREGROUND == aWhichLayer) && mInstanceOwner) 
    19792001      mInstanceOwner->Paint(aDirtyRect); 
    19802002#elif defined (XP_WIN) || defined(XP_OS2) 
    1981   if (NS_FRAME_PAINT_LAYER_FOREGROUND == aWhichLayer) { 
    19822003    nsCOMPtr<nsIPluginInstance> inst; 
    19832004    GetPluginInstance(*getter_AddRefs(inst)); 
    1984     if (inst) { 
     2005  if (!inst) 
     2006    return NS_ERROR_FAILURE; 
    19852007      // Look if it's windowless 
    19862008      nsPluginWindow * window; 
    19872009      mInstanceOwner->GetWindow(window); 
    19882010 
    1989       if (window->type == nsPluginWindowType_Drawable) { 
     2011  if (window->type == nsPluginWindowType_Drawable && 
     2012      NS_FRAME_PAINT_LAYER_FOREGROUND == aWhichLayer) { 
    19902013        // check if we need to call SetWindow with updated parameters 
    19912014        PRBool doupdatewindow = PR_FALSE; 
    19922015 
     
    20582081#endif 
    20592082 
    20602083          inst->SetWindow(window);         
    2061         } 
    20622084 
    20632085        mInstanceOwner->Paint(aDirtyRect, hdc); 
    20642086      } 
    20652087    } 
     2088  else if (window->type == nsPluginWindowType_Window && 
     2089           eFramePaintLayer_Content == aWhichLayer) { 
     2090    // This section handles the case of being called from 
     2091    //   nsViewManager::RenderOffscreen(). That call is made 
     2092    //   from the nsCanvas impl as well as for some embedding 
     2093    //   applications. 
     2094    // We must set things up like we are printing and then 
     2095    //   have the plugin render to a DeviceContext created 
     2096    //   in RenderOffscreen() 
     2097    // We may also get here during regular operation. In that 
     2098    //   case the location we tell the plugin to print is 
     2099    //   merely it's own window. 
     2100 
     2101    // data to pass on to the plugin 
     2102    nsPluginPrint  npprint; 
     2103    nsPluginWindow window; 
     2104    nsCOMPtr<nsIPluginInstance> pi; 
     2105    nsresult rv; 
     2106 
     2107    // sets fields in the plugin structs and gets the plugin instance 
     2108    rv = SetupPrinting(aRenderingContext, aPresContext, window, npprint, (*getter_AddRefs(pi))); 
     2109    if (NS_FAILED(rv)) 
     2110      return rv; 
     2111 
     2112#ifdef XP_WIN 
     2113    // This will be the plugin's window's DC or one provided by RenderOffscreen 
     2114    PRUint32 pDC = 0; 
     2115    aRenderingContext.RetrieveCurrentNativeGraphicData((void**)&pDC); 
     2116    if (!pDC) 
     2117      return NS_OK;  // no dc implemented so quit 
     2118 
     2119    // set the context to print to 
     2120    npprint.print.embedPrint.platformPrint = (void*) pDC; 
     2121 
     2122    // tell the plugin to render to the DC - works for Flash, not for quicktime 
     2123    rv = pi->Print(&npprint); 
     2124 
     2125 // XXXjgaunt - try sending a WM_PRINTCLIENT w/ PRF_CLIENT in lparam and DC in wparam 
     2126/* 
     2127    nsPluginWindowHelper helper; 
     2128 
     2129    nsPluginEvent pPluginEvent; 
     2130    pPluginEvent.event  = WM_PRINTCLIENT; 
     2131    pPluginEvent.wParam = (PRUint32) pDC; 
     2132    pPluginEvent.lParam = PRF_CLIENT; 
     2133 
     2134    // call the WinProc with the HWND and the event (message,wparam,lparam) 
     2135    helper.LLSendEventToWindow((void*) &window, (void*) mInstanceOwner->GetPluginPort(), (void*) &pPluginEvent); 
     2136*/ 
     2137 
     2138#endif /* XP_WIN */ 
    20662139  } 
    20672140#endif /* !XP_MAC */ 
    20682141  DO_GLOBAL_REFLOW_COUNT_DSP("nsObjectFrame", &aRenderingContext); 
     
    20902163  } 
    20912164 
    20922165#ifdef XP_WIN 
     2166  // XXXjgaunt - added the windowless check 
     2167  PRBool windowless = PR_FALSE; 
     2168  nsCOMPtr<nsIPluginInstance> pluginInstance; 
     2169  GetPluginInstance(*getter_AddRefs(pluginInstance)); 
     2170 
     2171  if(pluginInstance) 
     2172    pluginInstance->GetValue(nsPluginInstanceVariable_WindowlessBool, 
     2173                             (void *)&windowless); 
     2174 
     2175  if (windowless) { 
    20932176  rv = nsObjectFrameSuper::HandleEvent(aPresContext, anEvent, anEventStatus); 
     2177  } 
     2178  else { 
     2179    *anEventStatus = mInstanceOwner->ProcessEvent(*anEvent); 
     2180    rv = *anEventStatus; 
     2181  } 
    20942182  return rv; 
    20952183#endif 
    20962184 
     
    38933981#endif 
    38943982 
    38953983#ifdef XP_WIN 
    3896   // this code supports windowless plugins 
    38973984  nsPluginEvent * pPluginEvent = (nsPluginEvent *)anEvent.nativeMsg; 
    38983985  // we can get synthetic events from the nsEventStateManager... these 
    38993986  // have no nativeMsg 
    39003987 
    3901   if (pPluginEvent) { 
    39023988    PRBool eventHandled = PR_FALSE; 
     3989  if (pPluginEvent) { 
     3990    // XXXjgaunt 
     3991    // Are we windowed? If so, pass the event on to the window 
     3992    PRBool windowless = PR_FALSE; 
     3993    mInstance->GetValue(nsPluginInstanceVariable_WindowlessBool, 
     3994                        (void *)&windowless); 
     3995 
     3996    if (windowless) { 
    39033997    mInstance->HandleEvent(pPluginEvent, &eventHandled); 
    39043998    if (eventHandled) 
    39053999      rv = nsEventStatus_eConsumeNoDefault; 
    39064000  } 
     4001    else { 
     4002      // set this here, but it could happen earlier. Right now the only 
     4003      //   case we need to set this is for certain types of embedding  
     4004      //   that need to translate mouse click locations from screen to 
     4005      //   client coordinates. 
     4006      // Default behavior would be to capture (PR_TRUE) 
     4007      nsPluginWindowHelper helper; 
     4008      if (anEvent.flags & NS_EVENT_FLAG_NO_MOUSE_CAPTURE) { 
     4009        helper.SetMouseCapture(mPluginWindow, PR_FALSE); 
     4010      } 
     4011      else { 
     4012        helper.SetMouseCapture(mPluginWindow, PR_TRUE); 
     4013      } 
     4014      // call the WinProc with the HWND and the event (message,wparam,lparam) 
     4015      helper.LLSendEventToWindow(mPluginWindow, (void*) GetPluginPort(), (void*) pPluginEvent); 
     4016      // XXXjgaunt - not sure if this is right, just following what was above 
     4017      rv = nsEventStatus_eConsumeNoDefault; 
     4018    } 
     4019  } 
    39074020#endif 
    39084021 
    39094022  return rv; 
  • layout/generic/nsObjectFrame.h

    old new  
    203203                           nsHTMLReflowMetrics& aMetrics, 
    204204                           const nsHTMLReflowState& aReflowState); 
    205205 
     206  // called from Paint() to collect functionality that is used in 
     207  //   mulitple places for drastically different purposes: Printing; 
     208  //   and painting to a different DC than associated with a  
     209  //   windowed plugin. 
     210  nsresult SetupPrinting(nsIRenderingContext& aRenderingContext, 
     211                         nsPresContext *aPresContext, 
     212                         nsPluginWindow &aPlugWin, 
     213                         nsPluginPrint  &aPlugPrint, 
     214                         nsIPluginInstance *&aPlugInstance); 
     215 
    206216  friend class nsPluginInstanceOwner; 
    207217private: 
    208218  nsPluginInstanceOwner *mInstanceOwner; 
  • modules/plugin/base/public/npapi.h

    old new  
    631631#define NPVERS_68K_HAS_LIVECONNECT        11 
    632632#define NPVERS_HAS_WINDOWLESS             11 
    633633#define NPVERS_HAS_XPCONNECT_SCRIPTING    13 
    634 #define NPVERS_HAS_NPRUNTIME_SCRIPTING    14 
    635 #define NPVERS_HAS_FORM_VALUES            15 
    636 #define NPVERS_HAS_POPUPS_ENABLED_STATE   16 
     634#define NPVERS_HAS_NPRUNTIME_SCRIPTING    14 
     635#define NPVERS_HAS_FORM_VALUES            15 
     636#define NPVERS_HAS_POPUPS_ENABLED_STATE   16 
    637637#define NPVERS_HAS_RESPONSE_HEADERS       17 
    638638 
    639639/*----------------------------------------------------------------------*/ 
  • modules/plugin/base/public/nsPluginNativeWindow.h

    old new  
    106106nsresult PLUG_NewPluginNativeWindow(nsPluginNativeWindow ** aPluginNativeWindow); 
    107107nsresult PLUG_DeletePluginNativeWindow(nsPluginNativeWindow * aPluginNativeWindow); 
    108108 
     109/** 
     110 * Allows access to platform specific window implementations. 
     111 * 
     112 * Because the platform specific definitions are in the implementation files 
     113 *   it isn't possible to call them directly (and probably a good thing at that). 
     114 *   This class allows access to those classes without revealing the details of 
     115 *   implementation underneath. 
     116 */ 
     117class nsPluginWindowHelper { 
     118public: 
     119  nsPluginWindowHelper() {} 
     120  virtual ~nsPluginWindowHelper() {} 
     121  /** 
     122   * The default behavior for mozilla's winowed plugins is to capture 
     123   *   the mouse input on a mouse down message and to release it on a mouse up. 
     124   *   this works fine if the input coordinates are in the right coordinate 
     125   *   system. But in some embedding cases it is necessary to translate the 
     126   *   actual screen coordinates that get passed in by the sytsem. This method 
     127   *   allows the embedding application to receive the mouse events first so as 
     128   *   to perform any coordinate translation that needs to happen. 
     129   * 
     130   * See the use of this in nsObjectFrame to see an example of it's use. 
     131   * 
     132   * @arg aNativeWindow - a pointer to the nsPluginNativeWindow(Win|Mac|Unix..) 
     133   *      for the plugin. If aMouseCapture is PR_FALSE, this window 
     134   *      will receive the mouse events. 
     135   * 
     136   * @arg aMouseCapture - PR_TRUE means mozilla will capture mouse events 
     137   *                      PR_FALSE means it won't. 
     138   */ 
     139  nsresult SetMouseCapture(void *aNativeWindow, PRBool aMouseCapture); 
     140 
     141  /** 
     142   * This allows a message to be sent directly to the plugin's window.  
     143   * 
     144   * @arg aNativeWindow - a pointer to the nsPluginNativeWindow(Win|Mac|Unix..) 
     145   *      for the plugin. 
     146   * 
     147   * @arg aPluginPort - a pointer to the platform dependant impl of the 
     148   *      nsPluginPort struct. On Windows this is a HWND. This is the handle 
     149   *      to the plugin's window that will recieve the message. 
     150   * 
     151   * @arg aNativeMessage - The native message for the platform. On windows 
     152   *      this is a nsPluginEvent pointer (event, wParam, lParam). This is 
     153   *      the message that will be sent to the plugin's window 
     154   */ 
     155  nsresult LLSendEventToWindow(void *aNativeWindow, void *aPluginPort, void *aNativeMsg); 
     156}; 
     157 
    109158#endif //_nsPluginNativeWindow_h_ 
  • modules/plugin/base/src/nsPluginNativeWindowWin.cpp

    old new  
    140140  nsIEventQueueService *GetEventService(); 
    141141  PluginWindowEvent * GetPluginWindowEvent(HWND aWnd, UINT aMsg, WPARAM aWParam, LPARAM aLParam); 
    142142 
     143  // XXXjgaunt 
     144  void SetMouseCapture(PRBool aCapture) { mCanCaptureMouse = aCapture; } 
     145  PRBool CanCaptureMouse() { return mCanCaptureMouse; } 
     146  PRBool CanReleaseMouse() { return mMouseCaptured; } 
     147  void MouseCaptured() { mMouseCaptured = PR_TRUE; } 
     148  void MouseReleased() { mMouseCaptured = PR_FALSE; } 
     149 
    143150private: 
    144151  WNDPROC mPluginWinProc; 
    145152  nsCOMPtr<nsIEventQueueService> mEventService; 
    146153  PluginWindowEvent mPluginWindowEvent; 
     154  PRBool mCanCaptureMouse; 
     155  PRBool mMouseCaptured; 
    147156 
    148157public: 
    149158  nsPluginType mPluginType; 
    150159}; 
    151160 
     161// XXXjgaunt 
     162// class nsPluginWindowHelper 
     163nsresult nsPluginWindowHelper::SetMouseCapture(void *aNativeWindow, PRBool aMouseCapture) { 
     164  nsPluginNativeWindowWin *nativeWin = (nsPluginNativeWindowWin *) aNativeWindow; 
     165  if (nativeWin) { 
     166    nativeWin->SetMouseCapture(aMouseCapture); 
     167    return NS_OK; 
     168  } 
     169  return NS_ERROR_FAILURE; 
     170} 
     171 
     172// on windows the incomimg pluginport is an HWND, nativemsg is (msg, wparam, lparam) 
     173nsresult nsPluginWindowHelper::LLSendEventToWindow(void *aNativeWindow, void *aPluginPort, void *aNativeMsg) 
     174{ 
     175  nsresult rv = NS_ERROR_FAILURE; 
     176  nsPluginNativeWindowWin *nativeWin = (nsPluginNativeWindowWin *) aNativeWindow; 
     177  if (nativeWin) { 
     178    nsPluginEvent *plugEvent = (nsPluginEvent *) aNativeMsg; 
     179    if (plugEvent) { 
     180      if (((nsPluginEvent *) aNativeMsg)->event == 0x0020) {  // the code for WM_SETCURSOR 
     181        // the wParam for SETCURSOR messages may be set to the parent window, not the plugin's window 
     182//        rv = PluginWndProc((HWND) aPluginPort, plugEvent->event, (PRUint32)aPluginPort, plugEvent->lParam); 
     183//        rv = SendMessage((HWND) aPluginPort, plugEvent->event, (PRUint32)aPluginPort, plugEvent->lParam); 
     184        rv = PostMessage((HWND) aPluginPort, plugEvent->event, (PRUint32)aPluginPort, plugEvent->lParam); 
     185      } 
     186      else { 
     187//        rv = PluginWndProc((HWND) aPluginPort, plugEvent->event, plugEvent->wParam, plugEvent->lParam); 
     188//        rv = SendMessage((HWND) aPluginPort, plugEvent->event, plugEvent->wParam, plugEvent->lParam); 
     189        rv = PostMessage((HWND) aPluginPort, plugEvent->event, plugEvent->wParam, plugEvent->lParam); 
     190      } 
     191    } 
     192  } 
     193  return rv; 
     194} 
     195 
    152196static PRBool sInMessageDispatch = PR_FALSE; 
    153197static UINT sLastMsg = 0; 
    154198 
     
    208252  if (!win) 
    209253    return TRUE; 
    210254 
    211   // check plugin myme type and cache whether it is Flash or not 
     255  // XXXjgaunt - so SendMessage() doesn't block 
     256  if (InSendMessage())  
     257    ReplyMessage(TRUE); 
     258 
     259  // check plugin mime-type and cache whether it is Flash or not 
    212260  // Flash will need special treatment later 
    213261  if (win->mPluginType == nsPluginType_Unknown) { 
    214262    nsCOMPtr<nsIPluginInstance> inst; 
     
    259307    case WM_RBUTTONDOWN: { 
    260308      nsCOMPtr<nsIWidget> widget; 
    261309      win->GetPluginWidget(getter_AddRefs(widget)); 
    262       if (widget) 
     310      if (widget && win->CanCaptureMouse()) { 
    263311        widget->CaptureMouse(PR_TRUE); 
     312        win->MouseCaptured(); 
     313      } 
    264314      break; 
    265315    } 
    266316    case WM_LBUTTONUP: 
     
    271321    case WM_RBUTTONUP: { 
    272322      nsCOMPtr<nsIWidget> widget; 
    273323      win->GetPluginWidget(getter_AddRefs(widget)); 
    274       if (widget) 
     324      if (widget && win->CanReleaseMouse()) { 
    275325        widget->CaptureMouse(PR_FALSE); 
     326        win->MouseReleased(); 
     327      } 
    276328      break; 
    277329    } 
    278330    case WM_KEYDOWN: 
     
    377429  mPluginWinProc = NULL; 
    378430  mPluginWindowEvent.SetIsAlloced(PR_FALSE); 
    379431  mPluginType = nsPluginType_Unknown; 
     432  mCanCaptureMouse = PR_TRUE; 
     433  mMouseCaptured = PR_FALSE; 
    380434} 
    381435 
    382436nsPluginNativeWindowWin::~nsPluginNativeWindowWin() 
  • view/src/nsViewManager.cpp

    old new  
    18751875    } 
    18761876 
    18771877    UpdateWidgetArea(widgetParent, nsRegion(damagedRect), nsnull); 
     1878 
    18781879  } else { 
    18791880    // Propagate the update to the root widget of the root view manager, since 
    18801881    // iframes, for example, can overlap each other and be translucent.  So we 
     
    20122013            // Make sure to not send WillPaint notifications while scrolling 
    20132014            nsViewManager* rootVM = RootViewManager(); 
    20142015 
     2016 
    20152017            nsIWidget *widget = mRootView->GetWidget(); 
    20162018            PRBool translucentWindow = PR_FALSE; 
    20172019            if (widget) 
     
    24292431  // Determine, for each view, whether it is or contains a ZPlaceholderView 
    24302432  ComputePlaceholderContainment(displayRoot); 
    24312433 
    2432   // Create the Z-ordered view tree 
    2433   PRBool paintFloats; 
    2434   if (aEventProcessing) { 
    2435     paintFloats = PR_TRUE; 
    2436   } else { 
    2437     paintFloats = displayRoot->GetFloating(); 
    2438   } 
     2434  // XXXjgaunt - Linden - Always paint floats 
     2435  PRBool paintFloats = PR_TRUE; 
    24392436 
    24402437  { 
    24412438    nsHashtable       PlaceholderHash; 
     
    35713568  nsAutoVoidArray displayList; 
    35723569  PLArenaPool displayArena; 
    35733570  PL_INIT_ARENA_POOL(&displayArena, "displayArena", 1024); 
     3571  // XXXjgaunt - Linden - fixes scrollbars, popups, iframes, framesets 
    35743572  BuildRenderingDisplayList(view, nsRegion(r), &displayList, displayArena, 
    3575                             PR_TRUE, PR_TRUE, suppressScrolling); 
     3573                            PR_TRUE, PR_FALSE, suppressScrolling); 
    35763574  RenderViews(view, *localcx, nsRegion(aRect), surface, displayList); 
    35773575  PL_FreeArenaPool(&displayArena); 
    35783576  PL_FinishArenaPool(&displayArena); 
     
    37103708                                        nsHashtable &aMapPlaceholderViewToZTreeNode, 
    37113709                                        PLArenaPool &aPool) 
    37123710{ 
     3711  // XXXjgaunt - Linden - always paint floats 
     3712  aPaintFloats = PR_TRUE; 
    37133713  PRBool retval = PR_FALSE; 
    37143714 
    37153715  aResult = nsnull; 
  • widget/public/nsGUIEvent.h

    old new  
    118118#define NS_EVENT_FLAG_SYSTEM_EVENT        0x0200 
    119119#define NS_EVENT_FLAG_STOP_DISPATCH_IMMEDIATELY 0x0400 // @see nsIDOM3Event::stopImmediatePropagation() 
    120120#define NS_EVENT_FLAG_DISPATCHING         0x0800 
     121#define NS_EVENT_FLAG_NO_MOUSE_CAPTURE    0x1000       // XXXjgaunt 
    121122 
    122123#define NS_PRIV_EVENT_UNTRUSTED_PERMITTED 0x8000 
    123124 
  • widget/public/nsIToolkit.idl

    old new  
    4343#include "prthread.h" 
    4444%} 
    4545 
     46interface nsIWidget; 
     47 
    4648[ptr] native PRThread(PRThread); 
    4749 
     50[uuid(792dc3f5-adc0-4ef7-a07d-e0fd9be8cc9f)] 
     51interface nsIToolkitObserver : nsISupports 
     52{ 
     53  /** 
     54   * Called after a native widget has been invalidated, either manually 
     55   * via nsIWidget::Invalidate or due to a widget being moved, shown or 
     56   * resized. We pass the coordinates of the rectangle that bounds the 
     57   * area that has been invalidated, relative to the origin of nsIWidget 
     58   * in pixels. 
     59   */ 
     60  void notifyInvalidated(in nsIWidget aWidget, in long x, in long y, in long width, in long height); 
     61}; 
    4862 
    4963[uuid(18032BD0-B265-11d1-AA2A-000000000000)] 
    5064interface nsIToolkit : nsISupports 
     
    5872   */ 
    5973  void Init(in PRThread aThread); 
    6074 
     75  void addObserver(in nsIToolkitObserver aObserver); 
     76  void removeObserver(in nsIToolkitObserver aObserver); 
    6177}; 
    6278 
    6379 
  • widget/public/nsITransferable.idl

    old new  
    5757 
    5858#define kURLMime                    "text/x-moz-url"        // data contains url\ntitle 
    5959#define kURLDataMime                "text/x-moz-url-data"   // data contains url only 
    60 #define kURLDescriptionMime         "text/x-moz-url-desc"   // data contains description 
     60#define kURLDescriptionMime         "text/x-moz-url-desc"   // data contains description 
    6161#define kURLPrivateMime             "text/x-moz-url-priv"   // same as kURLDataMime but for private uses 
    6262#define kNativeImageMime            "application/x-moz-nativeimage" 
    6363#define kNativeHTMLMime             "application/x-moz-nativehtml" 
  • widget/src/gtk2/nsAppShell.h

    old new  
    4343#include "nsIEventQueue.h" 
    4444#include "nsCOMPtr.h" 
    4545 
     46class nsIToolkit; 
     47 
    4648class nsAppShell : public nsIAppShell { 
    4749public: 
    4850 
  • widget/src/gtk2/nsToolkit.cpp

    old new  
    107107    return NS_OK; 
    108108} 
    109109 
     110//------------------------------------------------------------------------- 
     111// 
     112// 
     113//------------------------------------------------------------------------- 
     114NS_IMETHODIMP 
     115nsToolkit::AddObserver(nsIToolkitObserver* aObserver) 
     116{ 
     117    if (! aObserver) 
     118        return NS_ERROR_NULL_POINTER; 
     119 
     120    if (! mObservers.AppendObject(aObserver)) { 
     121        return NS_ERROR_FAILURE; 
     122    } 
     123 
     124    return NS_OK; 
     125} 
     126 
     127NS_IMETHODIMP 
     128nsToolkit::RemoveObserver(nsIToolkitObserver* aObserver) 
     129{ 
     130    if (! aObserver) 
     131        return NS_ERROR_NULL_POINTER; 
     132 
     133    mObservers.RemoveObject(aObserver); 
     134 
     135    return NS_OK; 
     136 
     137} 
     138 
     139void nsToolkit::NotifyInvalidated(nsIWidget* aWidget, int x, int y, int width, int height) 
     140{ 
     141    PRInt32 count = mObservers.Count(); 
     142    for (PRInt32 i = 0; i < count; ++i) 
     143        { 
     144            (void) mObservers[i]->NotifyInvalidated(aWidget, x, y, width, height); 
     145        } 
     146} 
    110147 
    111148//------------------------------------------------------------------------- 
    112149// 
  • widget/src/gtk2/nsToolkit.h

    old new  
    4141#define TOOLKIT_H 
    4242 
    4343#include "nsIToolkit.h" 
     44#include "nsCOMArray.h" 
    4445#include <gtk/gtk.h> 
    4546 
    4647/** 
     
    6263    void          CreateSharedGC(void); 
    6364    GdkGC         *GetSharedGC(void); 
    6465 
     66    NS_IMETHOD      AddObserver(nsIToolkitObserver* aObserver); 
     67    NS_IMETHOD      RemoveObserver(nsIToolkitObserver* aObserver); 
     68 
     69    void            NotifyInvalidated(nsIWidget* aWidget, int x, int y, 
     70                                      int width, int height); 
     71 
    6572private: 
    6673    GdkGC         *mSharedGC; 
     74    nsCOMArray<nsIToolkitObserver> mObservers; 
    6775}; 
    6876 
    6977 
  • widget/src/gtk2/nsWindow.cpp

    old new  
    322322        mLastDragMotionWindow = NULL; 
    323323    } 
    324324 
     325    NotifyInvalidated(nsRect(nsPoint(0, 0), mBounds.Size())); 
     326 
    325327    delete[] mTransparencyBitmap; 
    326328    mTransparencyBitmap = nsnull; 
    327329 
     
    467469 
    468470    if (!mShell && mDrawingarea) { 
    469471        moz_drawingarea_reparent(mDrawingarea, newParentWindow); 
     472        NotifyInvalidated(nsRect(nsPoint(0, 0), mBounds.Size())); 
    470473    } else { 
    471474        NS_NOTREACHED("nsWindow::SetParent - reparenting a non-child window"); 
    472475    } 
     
    575578        moz_drawingarea_move(mDrawingarea, aX, aY); 
    576579    } 
    577580 
     581    NotifyInvalidated(nsRect(nsPoint(0, 0), mBounds.Size())); 
     582 
    578583    return NS_OK; 
    579584} 
    580585 
     
    614619                gdk_window_lower(w->mDrawingarea->clip_window); 
    615620        } 
    616621    } 
     622 
     623    NotifyInvalidated(nsRect(nsPoint(0, 0), mBounds.Size())); 
     624 
    617625    return NS_OK; 
    618626} 
    619627 
     
    651659 
    652660    mSizeState = mSizeMode; 
    653661 
     662    NotifyInvalidated(nsRect(nsPoint(0, 0), mBounds.Size())); 
     663 
    654664    return rv; 
    655665} 
    656666 
     
    10031013NS_IMETHODIMP 
    10041014nsWindow::Validate() 
    10051015{ 
     1016    NotifyInvalidated(nsRect(nsPoint(0, 0), mBounds.Size())); 
     1017 
    10061018    // Get the update for this window and, well, just drop it on the 
    10071019    // floor. 
    1008     if (!mDrawingarea) 
    1009         return NS_OK; 
     1020    if (!mDrawingarea)  
     1021       return NS_OK; 
    10101022 
    10111023    GdkRegion *region = gdk_window_get_update_area(mDrawingarea->inner_window); 
    10121024 
     
    10211033{ 
    10221034    GdkRectangle rect; 
    10231035 
     1036    NotifyInvalidated(nsRect(nsPoint(0, 0), mBounds.Size())); 
     1037 
    10241038    rect.x = mBounds.x; 
    10251039    rect.y = mBounds.y; 
    10261040    rect.width = mBounds.width; 
     
    10541068    LOGDRAW(("Invalidate (rect) [%p]: %d %d %d %d (sync: %d)\n", (void *)this, 
    10551069             rect.x, rect.y, rect.width, rect.height, aIsSynchronous)); 
    10561070 
     1071    NotifyInvalidated(aRect); 
     1072 
    10571073    if (!mDrawingarea) 
    10581074        return NS_OK; 
    10591075 
     
    10621078    if (aIsSynchronous) 
    10631079        gdk_window_process_updates(mDrawingarea->inner_window, FALSE); 
    10641080 
     1081    NotifyInvalidated(aRect); 
     1082 
    10651083    return NS_OK; 
    10661084} 
    10671085 
     
    10821100 
    10831101        gdk_window_invalidate_region(mDrawingarea->inner_window, 
    10841102                                     region, FALSE); 
     1103 
     1104        NotifyInvalidated(nsRect(rect.x, rect.y, rect.width, rect.height)); 
    10851105    } 
    10861106    else { 
    10871107        LOGDRAW(("Invalidate (region) [%p] with empty region\n", 
     
    10941114NS_IMETHODIMP 
    10951115nsWindow::Update() 
    10961116{ 
     1117    NotifyInvalidated(nsRect(nsPoint(0, 0), mBounds.Size())); 
     1118 
    10971119    if (!mDrawingarea) 
    10981120        return NS_OK; 
    10991121 
    11001122    gdk_window_process_updates(mDrawingarea->inner_window, FALSE); 
     1123    NotifyInvalidated(nsRect(nsPoint(0, 0), mBounds.Size())); 
    11011124    return NS_OK; 
    11021125} 
    11031126 
     
    11121135                 PRInt32  aDy, 
    11131136                 nsRect  *aClipRect) 
    11141137{ 
     1138    NotifyInvalidated(nsRect(nsPoint(0, 0), mBounds.Size())); 
     1139 
    11151140    if (!mDrawingarea) 
    11161141        return NS_OK; 
    11171142 
     
    11281153 
    11291154    // Process all updates so that everything is drawn. 
    11301155    gdk_window_process_all_updates(); 
     1156 
     1157    NotifyInvalidated(nsRect(nsPoint(0, 0), mBounds.Size())); 
     1158 
    11311159    return NS_OK; 
    11321160} 
    11331161 
     
    11351163nsWindow::ScrollWidgets(PRInt32 aDx, 
    11361164                        PRInt32 aDy) 
    11371165{ 
     1166    NotifyInvalidated(nsRect(nsPoint(0, 0), mBounds.Size())); 
     1167 
    11381168    if (!mDrawingarea) 
    11391169        return NS_OK; 
    11401170 
    11411171    moz_drawingarea_scroll(mDrawingarea, aDx, aDy); 
     1172 
     1173    NotifyInvalidated(nsRect(nsPoint(0, 0), mBounds.Size())); 
     1174 
    11421175    return NS_OK; 
    11431176} 
    11441177 
     
    14651498    DispatchEvent(&event, status); 
    14661499 
    14671500    g_free(rects); 
     1501  
     1502    NotifyInvalidated(nsRect(nsPoint(0, 0), mBounds.Size())); 
    14681503 
    14691504    // check the return value! 
    14701505    return TRUE; 
     
    15131548         (void *)this, aAllocation->x, aAllocation->y, 
    15141549         aAllocation->width, aAllocation->height)); 
    15151550 
     1551    NotifyInvalidated(nsRect(nsPoint(0, 0), mBounds.Size())); 
     1552 
    15161553    nsRect rect(aAllocation->x, aAllocation->y, 
    15171554                aAllocation->width, aAllocation->height); 
    15181555 
     
    15281565 
    15291566    nsEventStatus status; 
    15301567    DispatchResizeEvent (rect, status); 
     1568  
     1569    NotifyInvalidated(nsRect(nsPoint(0, 0), mBounds.Size())); 
    15311570} 
    15321571 
    15331572void 
     
    23942433                       nsIToolkit       *aToolkit, 
    23952434                       nsWidgetInitData *aInitData) 
    23962435{ 
     2436    //    mToolkit = aToolkit; 
     2437 
    23972438    // only set the base parent if we're going to be a dialog or a 
    23982439    // toplevel 
    23992440    nsIWidget *baseParent = aInitData && 
     
    27262767    LOG(("nsWindow::NativeResize [%p] %d %d\n", (void *)this, 
    27272768         aWidth, aHeight)); 
    27282769 
     2770    NotifyInvalidated(nsRect(nsPoint(0, 0), mBounds.Size())); 
     2771 
    27292772    ResizeTransparencyBitmap(aWidth, aHeight); 
    27302773 
    27312774    // clear our resize flag 
     
    27512794                       PRInt32 aWidth, PRInt32 aHeight, 
    27522795                       PRBool  aRepaint) 
    27532796{ 
     2797    NotifyInvalidated(nsRect(nsPoint(0, 0), mBounds.Size())); 
     2798 
    27542799    mNeedsResize = PR_FALSE; 
    27552800    mNeedsMove = PR_FALSE; 
    27562801 
     
    27932838    else if (mDrawingarea) { 
    27942839        moz_drawingarea_move_resize(mDrawingarea, aX, aY, aWidth, aHeight); 
    27952840    } 
     2841 
     2842    NotifyInvalidated(nsRect(nsPoint(0, 0), mBounds.Size())); 
    27962843} 
    27972844 
    27982845void 
     
    28402887            moz_drawingarea_set_visibility(mDrawingarea, FALSE); 
    28412888        } 
    28422889    } 
     2890 
     2891    NotifyInvalidated(nsRect(nsPoint(0, 0), mBounds.Size())); 
    28432892} 
    28442893 
    28452894void 
     
    30153064 
    30163065    gtk_widget_shape_combine_mask(mShell, maskBitmap, 0, 0); 
    30173066    gdk_bitmap_unref(maskBitmap); 
     3067 
     3068    NotifyInvalidated(nsRect(nsPoint(0, 0), mBounds.Size())); 
    30183069} 
    30193070 
    30203071NS_IMETHODIMP 
  • widget/src/gtk2/nsWindow.h

    old new  
    3939#ifndef __nsWindow_h__ 
    4040 
    4141#include "nsCommonWidget.h" 
     42#include "nsToolkit.h" 
    4243 
    4344#include "mozcontainer.h" 
    4445#include "mozdrawingarea.h" 
     
    286287   NS_IMETHOD          UpdateTranslucentWindowAlpha(const nsRect& aRect, PRUint8* aAlphas); 
    287288#endif 
    288289 
     290protected: 
     291    void NotifyInvalidated(const nsRect& aRect) { 
     292        nsToolkit* tk = NS_STATIC_CAST(nsToolkit*, mToolkit); 
     293        if (tk) { 
     294            tk->NotifyInvalidated(this, aRect.x, aRect.y, aRect.width, aRect.height); 
     295        } 
     296    } 
     297 
     298    
    289299private: 
    290300    void               GetToplevelWidget(GtkWidget **aWidget); 
    291301    void               GetContainerWindow(nsWindow  **aWindow); 
  • widget/src/mac/nsToolkitBase.cpp

    old new  
    243243  } 
    244244} 
    245245 
     246NS_IMETHODIMP 
     247nsToolkitBase::AddObserver(nsIToolkitObserver* aObserver) 
     248{ 
     249    if (! aObserver) 
     250        return NS_ERROR_NULL_POINTER; 
     251 
     252    if (! mObservers.AppendObject(aObserver)) { 
     253        return NS_ERROR_FAILURE; 
     254    } 
     255 
     256    return NS_OK; 
     257} 
     258 
     259NS_IMETHODIMP 
     260nsToolkitBase::RemoveObserver(nsIToolkitObserver* aObserver) 
     261{ 
     262    if (! aObserver) 
     263        return NS_ERROR_NULL_POINTER; 
     264 
     265    mObservers.RemoveObject(aObserver); 
     266 
     267    return NS_OK; 
     268 
     269} 
     270 
     271void nsToolkitBase::NotifyInvalidated(nsIWidget* aWidget, int x, int y, int width, int height) 
     272{ 
     273        PRInt32 count = mObservers.Count(); 
     274        for (PRInt32 i = 0; i < count; ++i) 
     275        { 
     276                (void) mObservers[i]->NotifyInvalidated(aWidget, x, y, width, height); 
     277        } 
     278 
     279        //if (mObserver) 
     280        //      mObserver->NotifyInvalidated(aWidget, x, y, width, height); 
     281 
     282    
     283} 
     284 
     285 
    246286 
    247287#pragma mark - 
    248288 
  • widget/src/mac/nsToolkitBase.h

    old new  
    4343#include "nsIToolkit.h" 
    4444 
    4545#include "nsCOMPtr.h" 
     46#include "nsCOMArray.h" 
    4647#include "nsIEventQueueService.h" 
    4748 
    4849 
     
    5758   
    5859  static void       PostSleepWakeNotification(const char* aNotification); 
    5960 
     61         void       NotifyInvalidated(nsIWidget* aWidget, int x, int y, int width, int height); 
     62 
    6063protected: 
    6164 
    6265  virtual nsresult  InitEventQueue(PRThread * aThread) = 0; 
     
    7679 
    7780  CFRunLoopSourceRef   mSleepWakeNotificationRLS; 
    7881  io_object_t       mPowerNotifier; 
     82    //nsCOMPtr<nsIToolkitObserver> mObserver; 
     83    nsCOMArray<nsIToolkitObserver> mObservers; 
    7984}; 
    8085 
    8186extern nsToolkitBase* NS_CreateToolkitInstance(); 
  • widget/src/mac/nsWindow.cpp

    old new  
    292292 
    293293        mDestructorCalled = PR_TRUE; 
    294294 
     295    NotifyInvalidated(nsRect(nsPoint(0, 0), mBounds.Size())); 
     296 
    295297        //Destroy(); 
    296298 
    297299        if (mWindowRegion) 
     
    423425        NS_IF_RELEASE(mMenuBar); 
    424426        SetMenuBar(nsnull); 
    425427 
     428    NotifyInvalidated(nsRect(nsPoint(0, 0), mBounds.Size())); 
     429 
    426430        ReportDestroyEvent();   // beard: this seems to cause the window to be deleted. moved all release code to destructor. 
    427431 
    428432        return NS_OK; 
     
    533537NS_IMETHODIMP nsWindow::Show(PRBool bState) 
    534538{ 
    535539  mVisible = bState; 
     540  NotifyInvalidated(nsRect(nsPoint(0, 0), mBounds.Size())); 
    536541  return NS_OK; 
    537542} 
    538543 
     
    878883{ 
    879884        if ((mBounds.x != aX) || (mBounds.y != aY)) 
    880885        { 
     886                NotifyInvalidated(nsRect(nsPoint(0, 0), mBounds.Size())); 
     887 
    881888                // Invalidate the current location (unless it's the top-level window) 
    882889                if ((mParent != nsnull) && (!mIsTopWidgetWindow)) 
    883890                        Invalidate(PR_FALSE); 
     
    891898 
    892899                // Report the event 
    893900                ReportMoveEvent(); 
     901 
     902                NotifyInvalidated(nsRect(nsPoint(0, 0), mBounds.Size())); 
    894903        } 
    895904        return NS_OK; 
    896905} 
     
    902911//------------------------------------------------------------------------- 
    903912NS_IMETHODIMP nsWindow::Resize(PRInt32 aWidth, PRInt32 aHeight, PRBool aRepaint) 
    904913{ 
     914  NotifyInvalidated(nsRect(nsPoint(0, 0), mBounds.Size())); 
     915 
    905916  if ((mBounds.width != aWidth) || (mBounds.height != aHeight)) 
    906917  { 
     918 
    907919    // Set the bounds 
    908920    mBounds.width  = aWidth; 
    909921    mBounds.height = aHeight; 
     
    917929 
    918930    // Report the event 
    919931    ReportSizeEvent(); 
     932 
     933        NotifyInvalidated(nsRect(nsPoint(0, 0), mBounds.Size())); 
    920934  } 
    921935  else { 
    922936    // Recalculate the regions. We always need to do this, our parents may have 
     
    927941      Invalidate(PR_FALSE); 
    928942  } 
    929943 
     944  NotifyInvalidated(nsRect(nsPoint(0, 0), mBounds.Size())); 
     945 
    930946  return NS_OK; 
    931947} 
    932948 
     
    10511067        if ( aIsSynchronous ) 
    10521068          Update(); 
    10531069 
     1070        NotifyInvalidated(aRect); 
     1071 
    10541072        return NS_OK; 
    10551073} 
    10561074 
     
    10911109        if ( aIsSynchronous ) 
    10921110          Update(); 
    10931111 
     1112    PRInt32 x, y, width, height; 
     1113    NS_CONST_CAST(nsIRegion*, aRegion)->GetBoundingBox(&x, &y, &width, &height); 
     1114    NotifyInvalidated(nsRect(x, y, width, height)); 
     1115 
    10941116        return NS_OK; 
    10951117} 
    10961118 
     
    14691491 
    14701492  NS_ASSERTION(ValidateDrawingState(), "Bad drawing state"); 
    14711493 
     1494  NotifyInvalidated(nsRect(nsPoint(0, 0), mBounds.Size())); 
     1495 
    14721496  return NS_OK; 
    14731497} 
    14741498 
     
    17021726      ScrollBits(macRect,aDx,aDy); 
    17031727 
    17041728      EndDraw(); 
     1729           
     1730          NotifyInvalidated(scrollRect); 
    17051731    } 
    17061732  } 
    17071733 
  • widget/src/mac/nsWindow.h

    old new  
    4141#include "nsIPluginWidget.h" 
    4242#include "nsBaseWidget.h" 
    4343#include "nsDeleteObserver.h" 
     44#include "nsToolkit.h" 
    4445 
    4546#include "nsIWidget.h" 
    4647#include "nsIKBStateControl.h" 
     
    238239  void          CombineRects ( TRectArray & inRectArray ) ; 
    239240  void          SortRectsLeftToRight ( TRectArray & inRectArray ) ; 
    240241 
     242  void NotifyInvalidated(const nsRect& aRect) { 
     243        nsToolkit* tk = NS_STATIC_CAST(nsToolkit*, mToolkit); 
     244        if (tk) { 
     245          tk->NotifyInvalidated(this, aRect.x, aRect.y, aRect.width, aRect.height); 
     246    } 
     247  } 
     248 
    241249protected: 
    242250#if DEBUG 
    243251  const char*       gInstanceClassName; 
  • widget/src/windows/nsToolkit.cpp

    old new  
    734734  return nsnull; 
    735735} 
    736736 
     737NS_IMETHODIMP 
     738nsToolkit::AddObserver(nsIToolkitObserver* aObserver) 
     739{ 
     740    if (! aObserver) 
     741        return NS_ERROR_NULL_POINTER; 
     742 
     743    if (! mObservers.AppendObject(aObserver)) { 
     744        return NS_ERROR_FAILURE; 
     745    } 
     746 
     747    return NS_OK; 
     748} 
     749 
     750NS_IMETHODIMP 
     751nsToolkit::RemoveObserver(nsIToolkitObserver* aObserver) 
     752{ 
     753    if (! aObserver) 
     754        return NS_ERROR_NULL_POINTER; 
     755 
     756    mObservers.RemoveObject(aObserver); 
     757 
     758    return NS_OK; 
     759 
     760} 
     761 
     762void nsToolkit::NotifyInvalidated(nsIWidget* aWidget, int x, int y, int width, int height) 
     763{ 
     764        PRInt32 count = mObservers.Count(); 
     765        for (PRInt32 i = 0; i < count; ++i) 
     766        { 
     767                (void) mObservers[i]->NotifyInvalidated(aWidget, x, y, width, height); 
     768        } 
     769 
     770        //if (mObserver) 
     771        //      mObserver->NotifyInvalidated(aWidget, x, y, width, height); 
     772 
     773    
     774} 
     775 
    737776//------------------------------------------------------------------------- 
    738777// 
    739778// Register the window class for the internal window and create the window 
  • widget/src/windows/nsToolkit.h

    old new  
    4646#include "nsWindowAPI.h" 
    4747#include "nsITimer.h" 
    4848#include "nsCOMPtr.h" 
     49#include "nsCOMArray.h" 
     50 
     51#include <stdio.h> 
    4952 
    5053struct MethodInfo; 
    5154class nsIEventQueue; 
     
    8487            PRBool          UserIsMovingWindow(void); 
    8588            nsIEventQueue*  GetEventQueue(void); 
    8689 
     90            NS_IMETHOD      AddObserver(nsIToolkitObserver* aObserver); 
     91            NS_IMETHOD      RemoveObserver(nsIToolkitObserver* aObserver); 
     92 
    8793private: 
    8894                            ~nsToolkit(); 
    8995            void            CreateUIThread(void); 
    9096 
    9197public: 
     98            void            NotifyInvalidated(nsIWidget* aWidget, int x, int y, int width, int height); 
     99 
    92100    // Window procedure for the internal window 
    93101    static LRESULT CALLBACK WindowProc(HWND hWnd,  
    94102                                        UINT Msg,  
     
    100108    HWND        mDispatchWnd; 
    101109    // Thread Id of the "main" Gui thread. 
    102110    PRThread    *mGuiThread; 
     111    //nsCOMPtr<nsIToolkitObserver> mObserver; 
     112    nsCOMArray<nsIToolkitObserver> mObservers; 
    103113 
    104114public: 
    105115    static HINSTANCE mDllInstance; 
  • widget/src/windows/nsWindow.cpp

    old new  
    18321832    } 
    18331833#endif 
    18341834 
     1835    NotifyInvalidated(nsRect(nsPoint(0, 0), mBounds.Size())); 
     1836 
    18351837    VERIFY(::DestroyWindow(mWnd)); 
    18361838 
    18371839    mWnd = NULL; 
     
    18491851 
    18501852NS_IMETHODIMP nsWindow::SetParent(nsIWidget *aNewParent) 
    18511853{ 
     1854  NotifyInvalidated(nsRect(nsPoint(0, 0), mBounds.Size())); 
    18521855  if (aNewParent) { 
    18531856    HWND newParent = (HWND)aNewParent->GetNativeData(NS_NATIVE_WINDOW); 
    18541857    NS_ASSERTION(newParent, "Parent widget has a null native window handle"); 
    18551858    ::SetParent(mWnd, newParent); 
     1859    NotifyInvalidated(nsRect(nsPoint(0, 0), mBounds.Size())); 
    18561860 
    18571861    return NS_OK; 
    18581862  } 
     
    20092013                       SWP_NOZORDER | SWP_NOACTIVATE); 
    20102014      } 
    20112015    } 
     2016    NotifyInvalidated(nsRect(nsPoint(0, 0), mBounds.Size())); 
    20122017  } 
    20132018  mIsVisible = bState; 
    20142019 
     
    20562061  } 
    20572062 
    20582063  ::SetWindowPos(mWnd, behind, 0, 0, 0, 0, flags); 
     2064  NotifyInvalidated(nsRect(nsPoint(0, 0), mBounds.Size())); 
    20592065  return NS_OK; 
    20602066} 
    20612067 
     
    22682274    return NS_OK; 
    22692275  } 
    22702276 
     2277  NotifyInvalidated(nsRect(nsPoint(0, 0), mBounds.Size())); 
     2278 
    22712279  mBounds.x = aX; 
    22722280  mBounds.y = aY; 
    22732281 
     
    23102318 
    23112319    NS_IF_RELEASE(par); 
    23122320  } 
     2321  NotifyInvalidated(nsRect(nsPoint(0, 0), mBounds.Size())); 
    23132322  return NS_OK; 
    23142323} 
    23152324 
     
    23282337    ResizeTranslucentWindow(aWidth, aHeight); 
    23292338#endif 
    23302339 
     2340  NotifyInvalidated(nsRect(nsPoint(0, 0), mBounds.Size())); 
    23312341  // Set cached value for lightweight and printing 
    23322342  mBounds.width  = aWidth; 
    23332343  mBounds.height = aHeight; 
     
    23582368    NS_IF_RELEASE(par); 
    23592369  } 
    23602370 
     2371  NotifyInvalidated(nsRect(nsPoint(0, 0), mBounds.Size())); 
     2372 
    23612373  if (aRepaint) 
    23622374    Invalidate(PR_FALSE); 
    23632375 
     
    23802392    ResizeTranslucentWindow(aWidth, aHeight); 
    23812393#endif 
    23822394 
     2395  NotifyInvalidated(nsRect(nsPoint(0, 0), mBounds.Size())); 
     2396 
    23832397  // Set cached value for lightweight and printing 
    23842398  mBounds.x      = aX; 
    23852399  mBounds.y      = aY; 
     
    24112425    NS_IF_RELEASE(par); 
    24122426  } 
    24132427 
     2428  NotifyInvalidated(nsRect(nsPoint(0, 0), mBounds.Size())); 
     2429 
    24142430  if (aRepaint) 
    24152431    Invalidate(PR_FALSE); 
    24162432 
     
    32343250        VERIFY(::UpdateWindow(mWnd)); 
    32353251      } 
    32363252    } 
     3253 
     3254    NotifyInvalidated(nsRect(nsPoint(0,0), mBounds.Size())); 
    32373255  } 
    32383256  return NS_OK; 
    32393257} 
     
    32743292        VERIFY(::UpdateWindow(mWnd)); 
    32753293      } 
    32763294    } 
     3295 
     3296    NotifyInvalidated(aRect); 
    32773297  } 
    32783298  return NS_OK; 
    32793299} 
     
    33033323        rv = NS_ERROR_FAILURE; 
    33043324      } 
    33053325    } 
     3326 
     3327    PRInt32 x, y, width, height; 
     3328    NS_CONST_CAST(nsIRegion*, aRegion)->GetBoundingBox(&x, &y, &width, &height); 
     3329    NotifyInvalidated(nsRect(x, y, width, height)); 
    33063330  } 
    33073331  return rv; 
    33083332} 
     
    34443468 
    34453469  ::ScrollWindowEx(mWnd, aDx, aDy, (nsnull != aClipRect) ? &trect : NULL, NULL, 
    34463470                   NULL, NULL, SW_INVALIDATE | SW_SCROLLCHILDREN); 
     3471  NotifyInvalidated(nsRect(nsPoint(0, 0), mBounds.Size())); 
    34473472  ::UpdateWindow(mWnd); 
    34483473  return NS_OK; 
    34493474} 
     
    34533478  // Scroll the entire contents of the window + change the offset of any child windows 
    34543479  ::ScrollWindowEx(mWnd, aDx, aDy, NULL, NULL, NULL, 
    34553480                   NULL, SW_INVALIDATE | SW_SCROLLCHILDREN); 
     3481  NotifyInvalidated(nsRect(nsPoint(0, 0), mBounds.Size())); 
    34563482  ::UpdateWindow(mWnd); // Force synchronous generation of NS_PAINT 
    34573483  return NS_OK; 
    34583484} 
     
    34703496  // Child windows are not scrolled. 
    34713497  ::ScrollWindowEx(mWnd, aDx, aDy, &trect, NULL, NULL, 
    34723498                   NULL, SW_INVALIDATE); 
     3499  NotifyInvalidated(nsRect(nsPoint(0, 0), mBounds.Size())); 
    34733500  ::UpdateWindow(mWnd); // Force synchronous generation of NS_PAINT 
    34743501  return NS_OK; 
    34753502} 
     
    82708297      // Rollup if the event is outside the popup. 
    82718298      PRBool rollup = !nsWindow::EventIsInsideWindow(inMsg, (nsWindow*)gRollupWidget); 
    82728299 
     8300      // XXXjgaunt - Linden - to get events to the popup 
     8301      rollup = PR_FALSE; 
     8302 
    82738303      if (rollup && (inMsg == WM_MOUSEWHEEL || inMsg == uMSH_MOUSEWHEEL || 
    82748304                     inMsg == WM_MOUSEHWHEEL)) 
    82758305      { 
  • widget/src/windows/nsWindow.h

    old new  
    526526 
    527527  PRBool CanTakeFocus(); 
    528528 
     529  void NotifyInvalidated(const nsRect& aRect) { 
     530        nsToolkit* tk = NS_STATIC_CAST(nsToolkit*, mToolkit); 
     531        if (tk) { 
     532          tk->NotifyInvalidated(this, aRect.x, aRect.y, aRect.width, aRect.height); 
     533    } 
     534  } 
     535 
    529536private: 
    530537 
    531538 
  • xulrunner/installer/mac/Makefile.in

    old new  
    7979 
    8080# Syntax "chown_root <directory>" 
    8181# Should be equivalent to "chown -R root:admin <directory>" 
    82 CHOWN_ROOT ?= $(error CHOWN_ROOT must be set to a setuid script.) 
     82# MBW -- XXX -- turning this off, since it breaks us. 
     83#CHOWN_ROOT ?= $(error CHOWN_ROOT must be set to a setuid script.) 
    8384 
    8485# Syntax "chown_revert <directory>" 
    8586# Should be equivalent to "chown -R <getuid> <directory>" 
    86 CHOWN_REVERT ?= $(error CHOWN_REVERT must be set to a setuid script.) 
     87# MBW -- XXX -- turning this off, since it breaks us. 
     88#CHOWN_REVERT ?= $(error CHOWN_REVERT must be set to a setuid script.) 
    8789 
    8890# Do the real work here: we take $(DIST)/XUL.framework and make it into an 
    8991# installer .pkg bundle. The xulrunner/installer makefile will then pack the 
     
    9496        $(RM) -rf $(DIST)/$(STAGEPATH)xulrunner-pkg 
    9597        mkdir $(DIST)/$(STAGEPATH)xulrunner-pkg 
    9698        chmod -R a+rX,u+w,go-w,-s,-t $(DIST)/$(STAGEPATH)$(MOZ_PKG_APPNAME) 
     99# MBW -- XXX -- turning this off, since it breaks us. 
     100# create the package directory at least, so rsync doesn't die. 
     101        mkdir -p $(_ABS_DIST)/$(STAGEPATH)xulrunner-pkg/$(PKG_BASENAME).pkg/Contents/MacOS 
    97102# For some unknown reason, PackageMaker requires absolute paths to everything. 
    98       unset NEXT_ROOT; \ 
    99       $(CHOWN_ROOT) $(DIST)/$(STAGEPATH)$(MOZ_PKG_APPNAME) && \ 
    100         /Developer/Applications/Utilities/PackageMaker.app/Contents/MacOS/PackageMaker -build -v \ 
    101           -p $(_ABS_DIST)/$(STAGEPATH)xulrunner-pkg/$(PKG_BASENAME).pkg \ 
    102           -f $(_ABS_DIST)/$(STAGEPATH)$(MOZ_PKG_APPNAME) \ 
    103           -r $(_ABS_OBJDIR)/resource-stage \ 
    104           -i $(_ABS_OBJDIR)/Info.plist \ 
    105           -d $(_ABS_OBJDIR)/Description.plist > packagemaker.log; \ 
    106       SAVED=$$?; \ 
    107       if [ "$$SAVED" == "1" -a \ 
    108            `grep -c 'was completed with the following non-fatal errors' < packagemaker.log` -gt 0 ]; then \ 
    109         SAVED=0; \ 
    110       fi; \ 
    111       $(CHOWN_REVERT) $(DIST)/$(STAGEPATH)$(MOZ_PKG_APPNAME); \ 
    112       exit $$SAVED 
     103#     unset NEXT_ROOT; \ 
     104#     $(CHOWN_ROOT) $(DIST)/$(STAGEPATH)$(MOZ_PKG_APPNAME) && \ 
     105#       /Developer/Applications/Utilities/PackageMaker.app/Contents/MacOS/PackageMaker -build -v \ 
     106#         -p $(_ABS_DIST)/$(STAGEPATH)xulrunner-pkg/$(PKG_BASENAME).pkg \ 
     107#         -f $(_ABS_DIST)/$(STAGEPATH)$(MOZ_PKG_APPNAME) \ 
     108#         -r $(_ABS_OBJDIR)/resource-stage \ 
     109#         -i $(_ABS_OBJDIR)/Info.plist \ 
     110#         -d $(_ABS_OBJDIR)/Description.plist > packagemaker.log; \ 
     111#     SAVED=$$?; \ 
     112#     if [ "$$SAVED" == "1" -a \ 
     113#          `grep -c 'was completed with the following non-fatal errors' < packagemaker.log` -gt 0 ]; then \ 
     114#       SAVED=0; \ 
     115#     fi; \ 
     116#     $(CHOWN_REVERT) $(DIST)/$(STAGEPATH)$(MOZ_PKG_APPNAME); \ 
     117#     exit $$SAVED 
  • widget/src/mac/nsMacTSMMessagePump.cpp

    old new  
    172172        NS_ASSERTION(err==noErr, "nsMacTSMMessagePump::PositionToOffsetHandler: AEGetParamPtr[TSMRefcon] failed"); 
    173173        if (err!=noErr)  
    174174                return err; 
     175 
     176        if(NULL==eventHandler) 
     177                return errAEEventNotHandled; 
    175178         
    176179        // 
    177180        // Extract the Position parameter. 
     
    220223        NS_ASSERTION(err==noErr, "nsMacTSMMessagePump::OffsetToPositionHandler: AEGetParamPtr[TSMRefcon] failed."); 
    221224        if (err!=noErr)  
    222225                return err; 
     226 
     227        if(NULL==eventHandler) 
     228                return errAEEventNotHandled; 
    223229         
    224230        // 
    225231        // Extract the Offset parameter 
     
    264270  NS_ASSERTION(err==noErr, "nsMacTSMMessagePump::GetAppleEventTSMData: AEGetParamPtr[TSMRefcon] failed."); 
    265271  if (err) 
    266272    return err; 
     273 
     274  if(NULL==*outEventHandler) 
     275    return errAEEventNotHandled; 
    267276  
    268277  // 
    269278  // get text 
     
    438447  NS_ASSERTION(err==noErr, "nsMacTSMMessagePump::UnicodeGetSelectedTextHandler: AEGetParamPtr[TSMRefcon] failed."); 
    439448  if (err!=noErr)  
    440449    return err; 
     450 
     451  if(NULL==eventHandler) 
     452    return errAEEventNotHandled; 
    441453   
    442454  // 
    443455  // Extract the Offset parameter 
  • modules/plugin/base/src/nsPluginsDirDarwin.cpp

    old new  
    260260static char* p2cstrdup(StringPtr pstr) 
    261261{ 
    262262    int len = pstr[0]; 
    263     char* cstr = new char[len + 1]
     263    char* cstr = (char*)PR_Malloc((len + 1) * sizeof(char))
    264264    if (cstr != NULL) { 
    265265        ::BlockMoveData(pstr + 1, cstr, len); 
    266266        cstr[len] = '\0'; 
     
    373373 
    374374      // fill-in rest of info struct 
    375375      int variantCount = info.fVariantCount; 
    376       info.fMimeTypeArray      = new char*[variantCount]
    377       info.fExtensionArray     = new char*[variantCount]
     376      info.fMimeTypeArray      = (char **)PR_Malloc(variantCount * sizeof(char *))
     377      info.fExtensionArray     = (char **)PR_Malloc(variantCount * sizeof(char *))
    378378      if (mi.infoStrings) 
    379         info.fMimeDescriptionArray = new char*[variantCount]
     379        info.fMimeDescriptionArray = (char **)PR_Malloc(variantCount * sizeof(char *))
    380380 
    381381      short mimeIndex = 2, descriptionIndex = 2; 
    382382            for (int i = 0; i < variantCount; i++) { 
     
    403403{ 
    404404    if (info.fPluginInfoSize <= sizeof(nsPluginInfo))  
    405405        { 
    406             delete[] info.fName; 
    407             delete[] info.fDescription; 
     406 
     407            PR_Free(info.fName); 
     408            PR_Free(info.fDescription); 
    408409            int variantCount = info.fVariantCount; 
    409410            for (int i = 0; i < variantCount; i++)  
    410411                { 
    411                     delete[] info.fMimeTypeArray[i]
    412                     delete[] info.fExtensionArray[i]
    413                     delete[] info.fMimeDescriptionArray[i]
     412                    PR_Free(info.fMimeTypeArray[i])
     413                    PR_Free(info.fExtensionArray[i])
     414                    PR_Free(info.fMimeDescriptionArray[i])
    414415                } 
    415             delete[] info.fMimeTypeArray
    416             delete[] info.fMimeDescriptionArray
    417             delete[] info.fExtensionArray
    418             delete[] info.fFileName
    419             delete[] info.fFullPath
     416            PR_Free(info.fMimeTypeArray)
     417            PR_Free(info.fMimeDescriptionArray)
     418            PR_Free(info.fExtensionArray)
     419            PR_Free(info.fFileName)
     420            PL_strfree(info.fFullPath)
    420421        } 
    421422    return NS_OK; 
    422423} 
Note: See TracBrowser for help on using the browser.