mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 811177 - Keyboard should also work for designMode=on. r=yxl
This commit is contained in:
parent
0e2e7cd73d
commit
cea8aa6feb
@ -326,12 +326,13 @@ let FormAssistant = {
|
||||
break;
|
||||
}
|
||||
|
||||
if (target instanceof HTMLDocument ||
|
||||
// Bug 811177, we don't support editing the entire document.
|
||||
target instanceof HTMLBodyElement ||
|
||||
target == content) {
|
||||
break;
|
||||
}
|
||||
// Focusing on Window, Document or iFrame should focus body
|
||||
if (target instanceof HTMLHtmlElement)
|
||||
target = target.document.body;
|
||||
else if (target instanceof HTMLDocument)
|
||||
target = target.body;
|
||||
else if (target instanceof HTMLIFrameElement)
|
||||
target = target.contentDocument.body;
|
||||
|
||||
if (isContentEditable(target)) {
|
||||
this.showKeyboard(this.getTopLevelEditable(target));
|
||||
@ -628,24 +629,11 @@ let FormAssistant = {
|
||||
|
||||
getTopLevelEditable: function fa_getTopLevelEditable(element) {
|
||||
function retrieveTopLevelEditable(element) {
|
||||
// Retrieve the top element that is editable
|
||||
if (element instanceof HTMLHtmlElement)
|
||||
element = element.ownerDocument.body;
|
||||
else if (element instanceof HTMLDocument)
|
||||
element = element.body;
|
||||
|
||||
while (element && !isContentEditable(element))
|
||||
element = element.parentNode;
|
||||
|
||||
// Return the container frame if we are into a nested editable frame
|
||||
if (element &&
|
||||
element instanceof HTMLBodyElement &&
|
||||
element.ownerDocument.defaultView != content.document.defaultView)
|
||||
return element.ownerDocument.defaultView.frameElement;
|
||||
}
|
||||
|
||||
if (element instanceof HTMLIFrameElement)
|
||||
return element;
|
||||
}
|
||||
|
||||
return retrieveTopLevelEditable(element) || element;
|
||||
},
|
||||
@ -712,14 +700,6 @@ function isContentEditable(element) {
|
||||
if (element.isContentEditable || element.designMode == "on")
|
||||
return true;
|
||||
|
||||
// If a body element is editable and the body is the child of an
|
||||
// iframe we can assume this is an advanced HTML editor
|
||||
if (element instanceof HTMLIFrameElement &&
|
||||
element.contentDocument &&
|
||||
(element.contentDocument.body.isContentEditable ||
|
||||
element.contentDocument.designMode == "on"))
|
||||
return true;
|
||||
|
||||
return element.ownerDocument && element.ownerDocument.designMode == "on";
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user