diff --git a/browser/base/content/browser.js b/browser/base/content/browser.js index d20cb464f7f4..9856626404cf 100644 --- a/browser/base/content/browser.js +++ b/browser/base/content/browser.js @@ -1072,6 +1072,8 @@ function delayedStartup() sidebar.setAttribute("src", sidebarBox.getAttribute("src")); } + UpdateUrlbarSearchSplitterState(); + initPlacesDefaultQueries(); initBookmarksToolbar(); PlacesUtils.bookmarks.addObserver(gBookmarksObserver, false); @@ -2161,6 +2163,32 @@ function canonizeUrl(aTriggeringEvent, aPostDataRef) { gBrowser.userTypedValue = gURLBar.value; } +function UpdateUrlbarSearchSplitterState() +{ + var splitter = document.getElementById("urlbar-search-splitter"); + + var urlbar = document.getElementById("urlbar-container"); + var searchbar = document.getElementById("search-container"); + var ibefore = null; + if (urlbar.nextSibling == searchbar) + ibefore = searchbar; + else if (searchbar.nextSibling == urlbar) + ibefore = urlbar; + else if (splitter) + splitter.parentNode.removeChild(splitter); + + if (ibefore) { + if (!splitter) { + splitter = document.createElement("splitter"); + splitter.id = "urlbar-search-splitter"; + splitter.setAttribute("resizebefore", "flex"); + splitter.setAttribute("resizeafter", "flex"); + splitter.className = "chromeclass-toolbar-additional"; + } + urlbar.parentNode.insertBefore(splitter, ibefore); + } +} + function UpdatePageProxyState() { if (gURLBar && gURLBar.value != gLastValidURLStr) @@ -3213,6 +3241,10 @@ function BrowserCustomizeToolbar() var cmd = document.getElementById("cmd_CustomizeToolbars"); cmd.setAttribute("disabled", "true"); + var splitter = document.getElementById("urlbar-search-splitter"); + if (splitter) + splitter.parentNode.removeChild(splitter); + #ifdef TOOLBAR_CUSTOMIZATION_SHEET var sheetFrame = document.getElementById("customizeToolbarSheetIFrame"); sheetFrame.hidden = false; @@ -3246,6 +3278,8 @@ function BrowserToolboxCustomizeDone(aToolboxChanged) window.XULBrowserWindow.init(); } + UpdateUrlbarSearchSplitterState(); + // Update the urlbar var url = getWebNavigation().currentURI.spec; if (gURLBar) { diff --git a/layout/xul/base/src/nsSplitterFrame.cpp b/layout/xul/base/src/nsSplitterFrame.cpp index ba5984422d0a..7aec4bda8bad 100644 --- a/layout/xul/base/src/nsSplitterFrame.cpp +++ b/layout/xul/base/src/nsSplitterFrame.cpp @@ -145,7 +145,7 @@ public: void AddListener(nsPresContext* aPresContext); void RemoveListener(); - enum ResizeType { Closest, Farthest, Grow }; + enum ResizeType { Closest, Farthest, Flex, Grow }; enum State { Open, CollapsedBefore, CollapsedAfter, Dragging }; enum CollapseDirection { Before, After }; @@ -185,10 +185,14 @@ NS_IMPL_ISUPPORTS2(nsSplitterFrameInner, nsIDOMMouseListener, nsIDOMMouseMotionL nsSplitterFrameInner::ResizeType nsSplitterFrameInner::GetResizeBefore() { - if (mOuter->GetContent()-> - AttrValueIs(kNameSpaceID_None, nsGkAtoms::resizebefore, - NS_LITERAL_STRING("farthest"), eCaseMatters)) - return Farthest; + static nsIContent::AttrValuesArray strings[] = + {&nsGkAtoms::farthest, &nsGkAtoms::flex, nsnull}; + switch (mOuter->GetContent()->FindAttrValueIn(kNameSpaceID_None, + nsGkAtoms::resizebefore, + strings, eCaseMatters)) { + case 0: return Farthest; + case 1: return Flex; + } return Closest; } @@ -202,12 +206,13 @@ nsSplitterFrameInner::ResizeType nsSplitterFrameInner::GetResizeAfter() { static nsIContent::AttrValuesArray strings[] = - {&nsGkAtoms::farthest, &nsGkAtoms::grow, nsnull}; + {&nsGkAtoms::farthest, &nsGkAtoms::flex, &nsGkAtoms::grow, nsnull}; switch (mOuter->GetContent()->FindAttrValueIn(kNameSpaceID_None, nsGkAtoms::resizeafter, strings, eCaseMatters)) { case 0: return Farthest; - case 1: return Grow; + case 1: return Flex; + case 2: return Grow; } return Closest; } @@ -807,7 +812,7 @@ nsSplitterFrameInner::MouseDown(nsIDOMEvent* aMouseEvent) nsGkAtoms::_true, eCaseMatters) && !content->AttrValueIs(kNameSpaceID_None, nsGkAtoms::hidden, nsGkAtoms::_true, eCaseMatters)) { - if (count < childIndex) { + if (count < childIndex && (resizeBefore != Flex || flex > 0)) { mChildInfosBefore[mChildInfosBeforeCount].childElem = content; mChildInfosBefore[mChildInfosBeforeCount].min = isHorizontal ? minSize.width : minSize.height; mChildInfosBefore[mChildInfosBeforeCount].max = isHorizontal ? maxSize.width : maxSize.height; @@ -816,7 +821,7 @@ nsSplitterFrameInner::MouseDown(nsIDOMEvent* aMouseEvent) mChildInfosBefore[mChildInfosBeforeCount].index = count; mChildInfosBefore[mChildInfosBeforeCount].changed = mChildInfosBefore[mChildInfosBeforeCount].current; mChildInfosBeforeCount++; - } else if (count > childIndex) { + } else if (count > childIndex && (resizeAfter != Flex || flex > 0)) { mChildInfosAfter[mChildInfosAfterCount].childElem = content; mChildInfosAfter[mChildInfosAfterCount].min = isHorizontal ? minSize.width : minSize.height; mChildInfosAfter[mChildInfosAfterCount].max = isHorizontal ? maxSize.width : maxSize.height; @@ -848,9 +853,9 @@ nsSplitterFrameInner::MouseDown(nsIDOMEvent* aMouseEvent) mChildInfosBefore = temp; } - // if the resizebefore is closest we must reverse the list because the first child in the list - // is the Farthest we want the first child to be the closest. - if (resizeBefore == Closest) + // if resizebefore is not Farthest, reverse the list because the first child + // in the list is the farthest, and we want the first child to be the closest. + if (resizeBefore != Farthest) Reverse(mChildInfosBefore, mChildInfosBeforeCount); // if the resizeafter is the Farthest we must reverse the list because the first child in the list diff --git a/toolkit/content/customizeToolbar.js b/toolkit/content/customizeToolbar.js index fc29e4e46151..8b8c1d367ec3 100644 --- a/toolkit/content/customizeToolbar.js +++ b/toolkit/content/customizeToolbar.js @@ -339,13 +339,6 @@ function buildPalette() templateNode.flex = 1; wrapPaletteItem(templateNode, currentRow, null); - // Add the splitter item. - templateNode = document.createElementNS("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul", - "splitter"); - templateNode.id = "splitter"; - templateNode.className = "toolbar-splitter"; - wrapPaletteItem(templateNode, currentRow, null); - var rowSlot = 3; var currentItems = getCurrentItemIds(); @@ -487,8 +480,6 @@ function setWrapperType(aItem, aWrapper) aWrapper.setAttribute("type", "spring"); } else if (aItem.localName == "toolbarspacer") { aWrapper.setAttribute("type", "spacer"); - } else if (aItem.localName == "splitter") { - aWrapper.setAttribute("type", "splitter"); } else if (aItem.localName == "toolbaritem" && aItem.firstChild) { aWrapper.setAttribute("type", aItem.firstChild.localName); } @@ -707,8 +698,7 @@ function isSpecialItem(aElt) { return aElt.localName == "toolbarseparator" || aElt.localName == "toolbarspring" || - aElt.localName == "toolbarspacer" || - aElt.localName == "splitter"; + aElt.localName == "toolbarspacer"; } function isToolbarItem(aElt) @@ -717,8 +707,7 @@ function isToolbarItem(aElt) aElt.localName == "toolbaritem" || aElt.localName == "toolbarseparator" || aElt.localName == "toolbarspring" || - aElt.localName == "toolbarspacer" || - aElt.localName == "splitter"; + aElt.localName == "toolbarspacer"; } /////////////////////////////////////////////////////////////////////////// @@ -877,8 +866,7 @@ var toolbarDNDObserver = var currentRow = draggedPaletteWrapper.parentNode; if (draggedItemId != "separator" && draggedItemId != "spring" && - draggedItemId != "spacer" && - draggedItemId != "splitter") + draggedItemId != "spacer") { currentRow.removeChild(draggedPaletteWrapper); @@ -962,8 +950,7 @@ var paletteDNDObserver = var wrapperType = wrapper.getAttribute("type"); if (wrapperType != "separator" && wrapperType != "spacer" && - wrapperType != "spring" && - wrapperType != "splitter") { + wrapperType != "spring") { // Find the template node in the toolbox palette var templateNode = gToolbox.palette.firstChild; while (templateNode) { diff --git a/toolkit/content/widgets/toolbar.xml b/toolkit/content/widgets/toolbar.xml index 892facde2c86..cf04a7aa6726 100644 --- a/toolkit/content/widgets/toolbar.xml +++ b/toolkit/content/widgets/toolbar.xml @@ -138,8 +138,7 @@ node.localName == "toolbarbutton" || node.localName == "toolbarseparator" || node.localName == "toolbarspring" || - node.localName == "toolbarspacer" || - node.localName == "splitter") + node.localName == "toolbarspacer") { if (currentSet) currentSet += ","; @@ -150,8 +149,6 @@ currentSet += "spring"; else if (node.localName == "toolbarspacer") currentSet += "spacer"; - else if (node.localName == "splitter") - currentSet += "splitter"; else currentSet += node.id; } @@ -230,12 +227,6 @@ uniqueId = (new Date()).getTime()+this.childNodes.length; newItem.id = "spacer" + uniqueId; newItem.className = "chromeclass-toolbar-additional"; - } else if (aId == "splitter") { - newItem = document.createElementNS("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul", - "splitter"); - uniqueId = (new Date()).getTime()+this.childNodes.length; - newItem.id = "splitter" + uniqueId; - newItem.className = "toolbar-splitter chromeclass-toolbar-additional"; } else if (this.parentNode.localName == "toolbox") { // Attempt to locate an item with a matching id within palette. var paletteItem = this.parentNode.palette.firstChild; diff --git a/toolkit/locales/en-US/chrome/global/customizeToolbar.properties b/toolkit/locales/en-US/chrome/global/customizeToolbar.properties index d7f400db74e9..d985ceee0860 100644 --- a/toolkit/locales/en-US/chrome/global/customizeToolbar.properties +++ b/toolkit/locales/en-US/chrome/global/customizeToolbar.properties @@ -5,4 +5,3 @@ enterToolbarBlank=You must enter a name to create a new toolbar. separatorTitle=Separator springTitle=Flexible Space spacerTitle=Space -splitterTitle=Resizer \ No newline at end of file diff --git a/toolkit/themes/gnomestripe/global/toolbar.css b/toolkit/themes/gnomestripe/global/toolbar.css index 7fdfd7f8b9c1..8a81b3b75e68 100644 --- a/toolkit/themes/gnomestripe/global/toolbar.css +++ b/toolkit/themes/gnomestripe/global/toolbar.css @@ -129,11 +129,6 @@ toolbarpaletteitem[place="toolbar"] > toolbarspacer { height: 50px; } -.toolbarpaletteitem-box[type="splitter"][place="palette"] { - width: 8px; - height: 50px; -} - .toolbarpaletteitem-box[type="spacer"][place="palette"], .toolbarpaletteitem-box[type="spring"][place="palette"] { margin-bottom: 2px; diff --git a/toolkit/themes/pinstripe/global/toolbar.css b/toolkit/themes/pinstripe/global/toolbar.css index 66d0faba07fc..b8d002a0735c 100644 --- a/toolkit/themes/pinstripe/global/toolbar.css +++ b/toolkit/themes/pinstripe/global/toolbar.css @@ -142,11 +142,6 @@ toolbarpaletteitem[type="spacer"] { height: 50px; } -.toolbarpaletteitem-box[type="splitter"][place="palette"] { - width: 8px; - height: 50px; -} - .toolbarpaletteitem-box[type="spacer"][place="palette"], .toolbarpaletteitem-box[type="spring"][place="palette"] { margin-bottom: 2px; diff --git a/toolkit/themes/pmstripe/global/toolbar.css b/toolkit/themes/pmstripe/global/toolbar.css index 47daba58082a..49ec39726713 100755 --- a/toolkit/themes/pmstripe/global/toolbar.css +++ b/toolkit/themes/pmstripe/global/toolbar.css @@ -140,11 +140,6 @@ toolbarpaletteitem[place="toolbar"] > toolbarspacer { height: 50px; } -.toolbarpaletteitem-box[type="splitter"][place="palette"] { - width: 8px; - height: 50px; -} - .toolbarpaletteitem-box[type="spacer"][place="palette"], .toolbarpaletteitem-box[type="spring"][place="palette"] { margin-bottom: 2px; diff --git a/toolkit/themes/winstripe/global/toolbar.css b/toolkit/themes/winstripe/global/toolbar.css index 463762f567d6..9082cebc736c 100644 --- a/toolkit/themes/winstripe/global/toolbar.css +++ b/toolkit/themes/winstripe/global/toolbar.css @@ -135,11 +135,6 @@ toolbarpaletteitem[place="toolbar"] > toolbarspacer { height: 50px; } -.toolbarpaletteitem-box[type="splitter"][place="palette"] { - width: 8px; - height: 50px; -} - .toolbarpaletteitem-box[type="spacer"][place="palette"], .toolbarpaletteitem-box[type="spring"][place="palette"] { margin-bottom: 2px;