Backout bug 398928
authorenndeakin@sympatico.ca
Mon, 21 Apr 2008 09:53:30 -0700
changeset 14516 44824318b35cf8671f6ffd02cbc9f781c1fc0c63
parent 14515 838066d45ea5b61daa978f7d008a3ad3304f0ba6
child 14517 63d74cd618fe95982117c37b86d72ebc7915130a
push idunknown
push userunknown
push dateunknown
bugs398928
milestone1.9pre
Backout bug 398928
browser/base/content/browser.xul
content/base/src/nsGkAtomList.h
layout/xul/base/src/nsTitleBarFrame.cpp
toolkit/content/widgets/toolbar.xml
toolkit/content/xul.css
--- a/browser/base/content/browser.xul
+++ b/browser/base/content/browser.xul
@@ -233,17 +233,17 @@
   <tooltip id="btTooltip" noautohide="true"
            onpopupshowing="return BookmarksEventHandler.fillInBTTooltip(document.tooltipNode)">
     <vbox id="btTooltipTextBox" flex="1">
       <label id="btTitleText" />
       <label id="btUrlText" />
     </vbox>
   </tooltip>
 
-  <toolbox id="navigator-toolbox" type="drag" class="toolbox-top" mode="icons"
+  <toolbox id="navigator-toolbox" class="toolbox-top" mode="icons"
            defaultmode="icons">
     <!-- Menu -->
     <toolbar type="menubar" id="toolbar-menubar" class="chromeclass-menubar" customizable="true"
 #ifdef XP_MACOSX
              defaultset="menubar-items"
 #else
              defaultset="menubar-items,spring,throbber-box"
 #endif
--- a/content/base/src/nsGkAtomList.h
+++ b/content/base/src/nsGkAtomList.h
@@ -845,19 +845,16 @@ GK_ATOM(titlebar, "titlebar")
 GK_ATOM(titlebarcolor, "titlebarcolor")
 GK_ATOM(titletip, "titletip")
 GK_ATOM(toggled, "toggled")
 GK_ATOM(token, "token")
 GK_ATOM(tokenize, "tokenize")
 GK_ATOM(toolbar, "toolbar")
 GK_ATOM(toolbarbutton, "toolbarbutton")
 GK_ATOM(toolbaritem, "toolbaritem")
-GK_ATOM(toolbarseparator, "toolbarseparator")
-GK_ATOM(toolbarspacer, "toolbarspacer")
-GK_ATOM(toolbarspring, "toolbarspring")
 GK_ATOM(toolbox, "toolbox")
 GK_ATOM(tooltip, "tooltip")
 GK_ATOM(tooltiptext, "tooltiptext")
 GK_ATOM(top, "top")
 GK_ATOM(topmargin, "topmargin")
 GK_ATOM(toppadding, "toppadding")
 GK_ATOM(tr, "tr")
 GK_ATOM(trailing, "trailing")
--- a/layout/xul/base/src/nsTitleBarFrame.cpp
+++ b/layout/xul/base/src/nsTitleBarFrame.cpp
@@ -79,111 +79,26 @@ nsTitleBarFrame::Init(nsIContent*      a
 {
   nsresult rv = nsBoxFrame::Init(aContent, aParent, asPrevInFlow);
 
   CreateViewForFrame(PresContext(), this, GetStyleContext(), PR_TRUE);
 
   return rv;
 }
 
-class nsDisplayTitleBarRedirector : public nsDisplayWrapList {
-public:
-  nsDisplayTitleBarRedirector(nsIFrame* aFrame, nsDisplayItem* aItem,
-                              nsIFrame* aTargetFrame)
-    : nsDisplayWrapList(aFrame, aItem), mTargetFrame(aTargetFrame) {}
-  nsDisplayTitleBarRedirector(nsIFrame* aFrame, nsDisplayList* aList,
-                              nsIFrame* aTargetFrame)
-    : nsDisplayWrapList(aFrame, aList), mTargetFrame(aTargetFrame) {}
-  virtual nsIFrame* HitTest(nsDisplayListBuilder* aBuilder, nsPoint aPt,
-                            HitTestState* aState);
-  NS_DISPLAY_DECL_NAME("XULTitleBarRedirector")
-private:
-  nsIFrame* mTargetFrame;
-};
-
-nsIFrame* nsDisplayTitleBarRedirector::HitTest(nsDisplayListBuilder* aBuilder,
-                                               nsPoint aPt, HitTestState* aState)
-{
-  nsIFrame* frame = mList.HitTest(aBuilder, aPt, aState);
-  if (!frame)
-    return nsnull;
-
-  // We want a drag over a background-like child of the titlebar to move the
-  // window, which means that the event must be retargetted at the titlebar.
-  // However, other elements such as controls should receive events normally.
-  // Here, we look for tags that usually represent empty space. A loop that
-  // iterates up the parent chain is used so that these elements can still
-  // appear inside a non-background element, for instance an hbox that is
-  // inside a button should still be targetted as normal.
-  nsIFrame* foundframe = frame;
-  while (foundframe && foundframe != mTargetFrame) {
-    nsIContent* content = foundframe->GetContent();
-    if (content) {
-      // not a XUL element so target normally
-      if (content->GetNameSpaceID() != kNameSpaceID_XUL)
-        return frame;
-
-      nsIAtom* tag = content->Tag();
-      // if this is not a background-like element, use the original frame that
-      // was targetted, so that the event is processed as normal
-      if (tag != nsGkAtoms::box &&
-          tag != nsGkAtoms::hbox &&
-          tag != nsGkAtoms::vbox &&
-          tag != nsGkAtoms::spacer &&
-          tag != nsGkAtoms::toolbar &&
-          tag != nsGkAtoms::toolbaritem &&
-          tag != nsGkAtoms::toolbarspacer &&
-          tag != nsGkAtoms::toolbarspring &&
-          tag != nsGkAtoms::toolbarseparator)
-            return frame;
-    }
-
-    foundframe = foundframe->GetParent();
-  }
-
-  // retarget to the titlebar
-  return mTargetFrame;
-}
-
-class nsXULTitleBarWrapper : public nsDisplayWrapper
-{
-public:
-  nsXULTitleBarWrapper(nsIFrame* aTargetFrame)
-      : mTargetFrame(aTargetFrame) {}
-  virtual nsDisplayItem* WrapList(nsDisplayListBuilder* aBuilder,
-                                  nsIFrame* aFrame, nsDisplayList* aList) {
-    return new (aBuilder) nsDisplayTitleBarRedirector(aFrame, aList, mTargetFrame);
-  }
-  virtual nsDisplayItem* WrapItem(nsDisplayListBuilder* aBuilder,
-                                  nsDisplayItem* aItem) {
-    return new (aBuilder) nsDisplayTitleBarRedirector(aItem->GetUnderlyingFrame(),
-                                                      aItem, mTargetFrame);
-  }
-private:
-  nsIFrame* mTargetFrame;
-};
-
 NS_IMETHODIMP
 nsTitleBarFrame::BuildDisplayListForChildren(nsDisplayListBuilder*   aBuilder,
                                              const nsRect&           aDirtyRect,
                                              const nsDisplayListSet& aLists)
 {
   // override, since we don't want children to get events
   if (aBuilder->IsForEventDelivery()) {
-    if (mTrackingMouseMove ||
-        !mContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::allowevents,
+    if (!mContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::allowevents,
                                nsGkAtoms::_true, eCaseMatters))
       return NS_OK;
-
-   nsDisplayListCollection set;
-   nsresult rv = nsBoxFrame::BuildDisplayListForChildren(aBuilder, aDirtyRect, set);
-   NS_ENSURE_SUCCESS(rv, rv);
-
-   nsXULTitleBarWrapper wrapper(this);
-   return wrapper.WrapLists(aBuilder, this, set, aLists);
   }
   return nsBoxFrame::BuildDisplayListForChildren(aBuilder, aDirtyRect, aLists);
 }
 
 NS_IMETHODIMP
 nsTitleBarFrame::HandleEvent(nsPresContext* aPresContext,
                                       nsGUIEvent* aEvent,
                                       nsEventStatus* aEventStatus)
--- a/toolkit/content/widgets/toolbar.xml
+++ b/toolkit/content/widgets/toolbar.xml
@@ -64,23 +64,16 @@
             this.insertBefore(toolbar, this.toolbarset);
             return toolbar;
           ]]>
         </body>
       </method>
     </implementation>
   </binding>
   
-  <binding id="toolbox-drag" display="xul:titlebar"
-           extends="chrome://global/content/bindings/toolbar.xml#toolbox">
-    <content allowevents="true">
-      <children/>
-    </content>
-  </binding>
-
   <binding id="toolbar" extends="chrome://global/content/bindings/toolbar.xml#toolbar-base">
     <implementation implements="nsIAccessibleProvider">
       <property name="accessibleType" readonly="true">
         <getter>
           return Components.interfaces.nsIAccessibleProvider.XULToolbar;
         </getter>
       </property>
       <field name="firstPermanentChild">
--- a/toolkit/content/xul.css
+++ b/toolkit/content/xul.css
@@ -213,22 +213,16 @@ caption {
 }
 
 /******* toolbar *******/
 
 toolbox { 
   -moz-binding: url("chrome://global/content/bindings/toolbar.xml#toolbox");
   -moz-box-orient: vertical;
 }
-
-%ifdef XP_MACOSX
-toolbox[type="drag"] { 
-  -moz-binding: url("chrome://global/content/bindings/toolbar.xml#toolbox-drag");
-}
-%endif
   
 toolbar {
   -moz-binding: url("chrome://global/content/bindings/toolbar.xml#toolbar");
 }
 
 %ifdef XP_MACOSX
 toolbar[type="menubar"] {
   min-height: 0 !important;