From 94249780e93c8cb7d7fc66022abae26826396f42 Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Tue, 23 Aug 2011 20:40:16 -0400 Subject: [PATCH] objectToString stuff. --- common/modules/config.jsm | 13 +++++++++---- common/modules/dom.jsm | 10 +++++++++- common/modules/template.jsm | 2 +- common/modules/util.jsm | 6 ++++-- 4 files changed, 23 insertions(+), 8 deletions(-) diff --git a/common/modules/config.jsm b/common/modules/config.jsm index 5120728e..55040b05 100644 --- a/common/modules/config.jsm +++ b/common/modules/config.jsm @@ -1013,13 +1013,18 @@ var ConfigBase = Class("ConfigBase", { HelpWarning /* The indicator for a warning */ \ color: red; font-weight: bold; - HelpXML;;;FontCode /* Highlighted XML */ \ - color: #C5F779; background-color: #444444; font-family: Terminus, Fixed, monospace; - HelpXMLBlock { white-space: pre; color: #C5F779; background-color: #444444; + HelpXML;;;FontCode { + /* Highlighted XML */ + white-space: pre; + display: inline-block; + color: #C5F779; + background-color: #444444; border: 1px dashed #aaaaaa; + font-family: Terminus, Fixed, monospace; + } + HelpXMLBlock;;;HelpXML { display: block; margin-left: 2em; - font-family: Terminus, Fixed, monospace; } HelpXMLAttribute color: #C5F779; HelpXMLAttribute::after color: #E5E5E5; content: "="; diff --git a/common/modules/dom.jsm b/common/modules/dom.jsm index 0ca67d74..05311d9f 100644 --- a/common/modules/dom.jsm +++ b/common/modules/dom.jsm @@ -464,7 +464,7 @@ var DOM = Class("DOM", { try { let hasChildren = elem.firstChild && (!/^\s*$/.test(elem.firstChild) || elem.firstChild.nextSibling) if (color) - res.push(<{ + res.push(<{ namespaced(elem)} { template.map(array.iterValues(elem.attributes), function (attr) @@ -724,7 +724,15 @@ var DOM = Class("DOM", { let force = false; if (rect) for (let parent in this.ancestors.items) { + if (!parent[0].clientWidth || !parent[0].clientHeight) + continue; + let isect = util.intersection(rect, parent.viewport); + + if (parent[0].clientWidth < rect.width && isect.width || + parent[0].clientHeight < rect.height && isect.height) + continue; + force = Math.round(isect.width - rect.width) || Math.round(isect.height - rect.height); if (force) break; diff --git a/common/modules/template.jsm b/common/modules/template.jsm index 31f22c7d..b15e92e5 100644 --- a/common/modules/template.jsm +++ b/common/modules/template.jsm @@ -302,7 +302,7 @@ var Template = Module("Template", { return {arg}; case "object": if (arg instanceof Ci.nsIDOMElement) - return util.objectToString(arg, false); + return util.objectToString(arg, true); // for java packages value.toString() would crash so badly // that we cannot even try/catch it if (/^\[JavaPackage.*\]$/.test(arg)) diff --git a/common/modules/util.jsm b/common/modules/util.jsm index 63fb0c3b..9a050046 100644 --- a/common/modules/util.jsm +++ b/common/modules/util.jsm @@ -885,8 +885,10 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]), if (!hasValue) { if (isArray(i) && i.length == 2) [i, value] = i; - else + else { var noVal = true; + value = i; + } } value = template.highlight(value, true, 150); @@ -895,7 +897,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]), i = parseInt(i); else if (/^[A-Z_]+$/.test(i)) i = ""; - keys.push([i, <>{key}{noVal ? "" : <>: {value}} ]); + keys.push([i, noVal ? value : <>{key}: {value} ]); } } catch (e) {