1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-22 11:37:57 +01:00

Deal with some Buffer.findScrollable corner cases.

--HG--
extra : rebase_source : 6acbaac21f3098ab357ceddcd796e6566a61a6d9
This commit is contained in:
Kris Maglione
2010-12-21 14:03:09 -05:00
parent 21ddb65595
commit 9511624649
3 changed files with 12 additions and 3 deletions

View File

@@ -1144,6 +1144,8 @@ const Buffer = Module("buffer", {
findScrollable: function findScrollable(dir, horizontal) {
function find(elem) {
while (!(elem instanceof Element) && elem.parentNode)
elem = elem.parentNode;
for (; elem && elem.parentNode instanceof Element; elem = elem.parentNode)
if (Buffer.isScrollable(elem, dir, horizontal))
break;

View File

@@ -675,7 +675,7 @@ unlet s:cpo_save
lines.__defineGetter__("last", function () this[this.length - 1]);
for (let item in (isArray(items) ? array.iterValues : iter)(items)) {
if (item.length > width && (!lines.length || lines.last.length)) {
if (item.length > width && (!lines.length || lines.last.length > 1)) {
lines.push([prefix]);
width = WIDTH - prefix.length;
prefix = " \\ ";

View File

@@ -318,9 +318,16 @@ const Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference])
* @returns {Object}
*/
computedStyle: function computedStyle(node) {
while (node instanceof Ci.nsIDOMText && node.parentNode)
while (!(node instanceof Ci.nsIDOMElement) && node.parentNode)
node = node.parentNode;
try {
return node.ownerDocument.defaultView.getComputedStyle(node, null);
}
catch (e) {
util.reportError(e);
util.dump(String(node));
return {};
}
},
/**