mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 400327, use a different mechanism for the spliiter, insert it when the url and search fields are adjacent, r=mano,neil,sr=neil,a=schrep
This commit is contained in:
parent
11bc4bf9d9
commit
e9884990d0
@ -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) {
|
||||
|
@ -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
|
||||
|
@ -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) {
|
||||
|
@ -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;
|
||||
|
@ -5,4 +5,3 @@ enterToolbarBlank=You must enter a name to create a new toolbar.
|
||||
separatorTitle=Separator
|
||||
springTitle=Flexible Space
|
||||
spacerTitle=Space
|
||||
splitterTitle=Resizer
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user