relanding bug 400327 since it doesn't look to be the source of the regression

This commit is contained in:
jonas%sicking.cc 2007-11-15 03:38:18 +00:00
Родитель 46ace9e29f
Коммит d8a768c905
9 изменённых файлов: 56 добавлений и 60 удалений

Просмотреть файл

@ -1072,6 +1072,8 @@ function delayedStartup()
sidebar.setAttribute("src", sidebarBox.getAttribute("src")); sidebar.setAttribute("src", sidebarBox.getAttribute("src"));
} }
UpdateUrlbarSearchSplitterState();
initPlacesDefaultQueries(); initPlacesDefaultQueries();
initBookmarksToolbar(); initBookmarksToolbar();
PlacesUtils.bookmarks.addObserver(gBookmarksObserver, false); PlacesUtils.bookmarks.addObserver(gBookmarksObserver, false);
@ -2161,6 +2163,32 @@ function canonizeUrl(aTriggeringEvent, aPostDataRef) {
gBrowser.userTypedValue = gURLBar.value; 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() function UpdatePageProxyState()
{ {
if (gURLBar && gURLBar.value != gLastValidURLStr) if (gURLBar && gURLBar.value != gLastValidURLStr)
@ -3213,6 +3241,10 @@ function BrowserCustomizeToolbar()
var cmd = document.getElementById("cmd_CustomizeToolbars"); var cmd = document.getElementById("cmd_CustomizeToolbars");
cmd.setAttribute("disabled", "true"); cmd.setAttribute("disabled", "true");
var splitter = document.getElementById("urlbar-search-splitter");
if (splitter)
splitter.parentNode.removeChild(splitter);
#ifdef TOOLBAR_CUSTOMIZATION_SHEET #ifdef TOOLBAR_CUSTOMIZATION_SHEET
var sheetFrame = document.getElementById("customizeToolbarSheetIFrame"); var sheetFrame = document.getElementById("customizeToolbarSheetIFrame");
sheetFrame.hidden = false; sheetFrame.hidden = false;
@ -3246,6 +3278,8 @@ function BrowserToolboxCustomizeDone(aToolboxChanged)
window.XULBrowserWindow.init(); window.XULBrowserWindow.init();
} }
UpdateUrlbarSearchSplitterState();
// Update the urlbar // Update the urlbar
var url = getWebNavigation().currentURI.spec; var url = getWebNavigation().currentURI.spec;
if (gURLBar) { if (gURLBar) {

Просмотреть файл

@ -145,7 +145,7 @@ public:
void AddListener(nsPresContext* aPresContext); void AddListener(nsPresContext* aPresContext);
void RemoveListener(); void RemoveListener();
enum ResizeType { Closest, Farthest, Grow }; enum ResizeType { Closest, Farthest, Flex, Grow };
enum State { Open, CollapsedBefore, CollapsedAfter, Dragging }; enum State { Open, CollapsedBefore, CollapsedAfter, Dragging };
enum CollapseDirection { Before, After }; enum CollapseDirection { Before, After };
@ -185,10 +185,14 @@ NS_IMPL_ISUPPORTS2(nsSplitterFrameInner, nsIDOMMouseListener, nsIDOMMouseMotionL
nsSplitterFrameInner::ResizeType nsSplitterFrameInner::ResizeType
nsSplitterFrameInner::GetResizeBefore() nsSplitterFrameInner::GetResizeBefore()
{ {
if (mOuter->GetContent()-> static nsIContent::AttrValuesArray strings[] =
AttrValueIs(kNameSpaceID_None, nsGkAtoms::resizebefore, {&nsGkAtoms::farthest, &nsGkAtoms::flex, nsnull};
NS_LITERAL_STRING("farthest"), eCaseMatters)) switch (mOuter->GetContent()->FindAttrValueIn(kNameSpaceID_None,
return Farthest; nsGkAtoms::resizebefore,
strings, eCaseMatters)) {
case 0: return Farthest;
case 1: return Flex;
}
return Closest; return Closest;
} }
@ -202,12 +206,13 @@ nsSplitterFrameInner::ResizeType
nsSplitterFrameInner::GetResizeAfter() nsSplitterFrameInner::GetResizeAfter()
{ {
static nsIContent::AttrValuesArray strings[] = static nsIContent::AttrValuesArray strings[] =
{&nsGkAtoms::farthest, &nsGkAtoms::grow, nsnull}; {&nsGkAtoms::farthest, &nsGkAtoms::flex, &nsGkAtoms::grow, nsnull};
switch (mOuter->GetContent()->FindAttrValueIn(kNameSpaceID_None, switch (mOuter->GetContent()->FindAttrValueIn(kNameSpaceID_None,
nsGkAtoms::resizeafter, nsGkAtoms::resizeafter,
strings, eCaseMatters)) { strings, eCaseMatters)) {
case 0: return Farthest; case 0: return Farthest;
case 1: return Grow; case 1: return Flex;
case 2: return Grow;
} }
return Closest; return Closest;
} }
@ -807,7 +812,7 @@ nsSplitterFrameInner::MouseDown(nsIDOMEvent* aMouseEvent)
nsGkAtoms::_true, eCaseMatters) && nsGkAtoms::_true, eCaseMatters) &&
!content->AttrValueIs(kNameSpaceID_None, nsGkAtoms::hidden, !content->AttrValueIs(kNameSpaceID_None, nsGkAtoms::hidden,
nsGkAtoms::_true, eCaseMatters)) { nsGkAtoms::_true, eCaseMatters)) {
if (count < childIndex) { if (count < childIndex && (resizeBefore != Flex || flex > 0)) {
mChildInfosBefore[mChildInfosBeforeCount].childElem = content; mChildInfosBefore[mChildInfosBeforeCount].childElem = content;
mChildInfosBefore[mChildInfosBeforeCount].min = isHorizontal ? minSize.width : minSize.height; mChildInfosBefore[mChildInfosBeforeCount].min = isHorizontal ? minSize.width : minSize.height;
mChildInfosBefore[mChildInfosBeforeCount].max = isHorizontal ? maxSize.width : maxSize.height; mChildInfosBefore[mChildInfosBeforeCount].max = isHorizontal ? maxSize.width : maxSize.height;
@ -816,7 +821,7 @@ nsSplitterFrameInner::MouseDown(nsIDOMEvent* aMouseEvent)
mChildInfosBefore[mChildInfosBeforeCount].index = count; mChildInfosBefore[mChildInfosBeforeCount].index = count;
mChildInfosBefore[mChildInfosBeforeCount].changed = mChildInfosBefore[mChildInfosBeforeCount].current; mChildInfosBefore[mChildInfosBeforeCount].changed = mChildInfosBefore[mChildInfosBeforeCount].current;
mChildInfosBeforeCount++; mChildInfosBeforeCount++;
} else if (count > childIndex) { } else if (count > childIndex && (resizeAfter != Flex || flex > 0)) {
mChildInfosAfter[mChildInfosAfterCount].childElem = content; mChildInfosAfter[mChildInfosAfterCount].childElem = content;
mChildInfosAfter[mChildInfosAfterCount].min = isHorizontal ? minSize.width : minSize.height; mChildInfosAfter[mChildInfosAfterCount].min = isHorizontal ? minSize.width : minSize.height;
mChildInfosAfter[mChildInfosAfterCount].max = isHorizontal ? maxSize.width : maxSize.height; mChildInfosAfter[mChildInfosAfterCount].max = isHorizontal ? maxSize.width : maxSize.height;
@ -848,9 +853,9 @@ nsSplitterFrameInner::MouseDown(nsIDOMEvent* aMouseEvent)
mChildInfosBefore = temp; mChildInfosBefore = temp;
} }
// if the resizebefore is closest we must reverse the list because the first child in the list // if resizebefore is not Farthest, reverse the list because the first child
// is the Farthest we want the first child to be the closest. // in the list is the farthest, and we want the first child to be the closest.
if (resizeBefore == Closest) if (resizeBefore != Farthest)
Reverse(mChildInfosBefore, mChildInfosBeforeCount); Reverse(mChildInfosBefore, mChildInfosBeforeCount);
// if the resizeafter is the Farthest we must reverse the list because the first child in the list // if the resizeafter is the Farthest we must reverse the list because the first child in the list

Просмотреть файл

@ -339,13 +339,6 @@ function buildPalette()
templateNode.flex = 1; templateNode.flex = 1;
wrapPaletteItem(templateNode, currentRow, null); 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 rowSlot = 3;
var currentItems = getCurrentItemIds(); var currentItems = getCurrentItemIds();
@ -487,8 +480,6 @@ function setWrapperType(aItem, aWrapper)
aWrapper.setAttribute("type", "spring"); aWrapper.setAttribute("type", "spring");
} else if (aItem.localName == "toolbarspacer") { } else if (aItem.localName == "toolbarspacer") {
aWrapper.setAttribute("type", "spacer"); aWrapper.setAttribute("type", "spacer");
} else if (aItem.localName == "splitter") {
aWrapper.setAttribute("type", "splitter");
} else if (aItem.localName == "toolbaritem" && aItem.firstChild) { } else if (aItem.localName == "toolbaritem" && aItem.firstChild) {
aWrapper.setAttribute("type", aItem.firstChild.localName); aWrapper.setAttribute("type", aItem.firstChild.localName);
} }
@ -707,8 +698,7 @@ function isSpecialItem(aElt)
{ {
return aElt.localName == "toolbarseparator" || return aElt.localName == "toolbarseparator" ||
aElt.localName == "toolbarspring" || aElt.localName == "toolbarspring" ||
aElt.localName == "toolbarspacer" || aElt.localName == "toolbarspacer";
aElt.localName == "splitter";
} }
function isToolbarItem(aElt) function isToolbarItem(aElt)
@ -717,8 +707,7 @@ function isToolbarItem(aElt)
aElt.localName == "toolbaritem" || aElt.localName == "toolbaritem" ||
aElt.localName == "toolbarseparator" || aElt.localName == "toolbarseparator" ||
aElt.localName == "toolbarspring" || aElt.localName == "toolbarspring" ||
aElt.localName == "toolbarspacer" || aElt.localName == "toolbarspacer";
aElt.localName == "splitter";
} }
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
@ -877,8 +866,7 @@ var toolbarDNDObserver =
var currentRow = draggedPaletteWrapper.parentNode; var currentRow = draggedPaletteWrapper.parentNode;
if (draggedItemId != "separator" && if (draggedItemId != "separator" &&
draggedItemId != "spring" && draggedItemId != "spring" &&
draggedItemId != "spacer" && draggedItemId != "spacer")
draggedItemId != "splitter")
{ {
currentRow.removeChild(draggedPaletteWrapper); currentRow.removeChild(draggedPaletteWrapper);
@ -962,8 +950,7 @@ var paletteDNDObserver =
var wrapperType = wrapper.getAttribute("type"); var wrapperType = wrapper.getAttribute("type");
if (wrapperType != "separator" && if (wrapperType != "separator" &&
wrapperType != "spacer" && wrapperType != "spacer" &&
wrapperType != "spring" && wrapperType != "spring") {
wrapperType != "splitter") {
// Find the template node in the toolbox palette // Find the template node in the toolbox palette
var templateNode = gToolbox.palette.firstChild; var templateNode = gToolbox.palette.firstChild;
while (templateNode) { while (templateNode) {

Просмотреть файл

@ -138,8 +138,7 @@
node.localName == "toolbarbutton" || node.localName == "toolbarbutton" ||
node.localName == "toolbarseparator" || node.localName == "toolbarseparator" ||
node.localName == "toolbarspring" || node.localName == "toolbarspring" ||
node.localName == "toolbarspacer" || node.localName == "toolbarspacer")
node.localName == "splitter")
{ {
if (currentSet) if (currentSet)
currentSet += ","; currentSet += ",";
@ -150,8 +149,6 @@
currentSet += "spring"; currentSet += "spring";
else if (node.localName == "toolbarspacer") else if (node.localName == "toolbarspacer")
currentSet += "spacer"; currentSet += "spacer";
else if (node.localName == "splitter")
currentSet += "splitter";
else else
currentSet += node.id; currentSet += node.id;
} }
@ -230,12 +227,6 @@
uniqueId = (new Date()).getTime()+this.childNodes.length; uniqueId = (new Date()).getTime()+this.childNodes.length;
newItem.id = "spacer" + uniqueId; newItem.id = "spacer" + uniqueId;
newItem.className = "chromeclass-toolbar-additional"; 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") { } else if (this.parentNode.localName == "toolbox") {
// Attempt to locate an item with a matching id within palette. // Attempt to locate an item with a matching id within palette.
var paletteItem = this.parentNode.palette.firstChild; var paletteItem = this.parentNode.palette.firstChild;

Просмотреть файл

@ -5,4 +5,3 @@ enterToolbarBlank=You must enter a name to create a new toolbar.
separatorTitle=Separator separatorTitle=Separator
springTitle=Flexible Space springTitle=Flexible Space
spacerTitle=Space spacerTitle=Space
splitterTitle=Resizer

Просмотреть файл

@ -129,11 +129,6 @@ toolbarpaletteitem[place="toolbar"] > toolbarspacer {
height: 50px; height: 50px;
} }
.toolbarpaletteitem-box[type="splitter"][place="palette"] {
width: 8px;
height: 50px;
}
.toolbarpaletteitem-box[type="spacer"][place="palette"], .toolbarpaletteitem-box[type="spacer"][place="palette"],
.toolbarpaletteitem-box[type="spring"][place="palette"] { .toolbarpaletteitem-box[type="spring"][place="palette"] {
margin-bottom: 2px; margin-bottom: 2px;

Просмотреть файл

@ -142,11 +142,6 @@ toolbarpaletteitem[type="spacer"] {
height: 50px; height: 50px;
} }
.toolbarpaletteitem-box[type="splitter"][place="palette"] {
width: 8px;
height: 50px;
}
.toolbarpaletteitem-box[type="spacer"][place="palette"], .toolbarpaletteitem-box[type="spacer"][place="palette"],
.toolbarpaletteitem-box[type="spring"][place="palette"] { .toolbarpaletteitem-box[type="spring"][place="palette"] {
margin-bottom: 2px; margin-bottom: 2px;

Просмотреть файл

@ -140,11 +140,6 @@ toolbarpaletteitem[place="toolbar"] > toolbarspacer {
height: 50px; height: 50px;
} }
.toolbarpaletteitem-box[type="splitter"][place="palette"] {
width: 8px;
height: 50px;
}
.toolbarpaletteitem-box[type="spacer"][place="palette"], .toolbarpaletteitem-box[type="spacer"][place="palette"],
.toolbarpaletteitem-box[type="spring"][place="palette"] { .toolbarpaletteitem-box[type="spring"][place="palette"] {
margin-bottom: 2px; margin-bottom: 2px;

Просмотреть файл

@ -135,11 +135,6 @@ toolbarpaletteitem[place="toolbar"] > toolbarspacer {
height: 50px; height: 50px;
} }
.toolbarpaletteitem-box[type="splitter"][place="palette"] {
width: 8px;
height: 50px;
}
.toolbarpaletteitem-box[type="spacer"][place="palette"], .toolbarpaletteitem-box[type="spacer"][place="palette"],
.toolbarpaletteitem-box[type="spring"][place="palette"] { .toolbarpaletteitem-box[type="spring"][place="palette"] {
margin-bottom: 2px; margin-bottom: 2px;