mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-03 20:49:27 +00:00
b=202166 Edit actions place caret on invalid position
r=jfrancis sr=kin
This commit is contained in:
parent
12a288b564
commit
e0c7f637b2
@ -3752,6 +3752,17 @@ nsEditor::IsContainer(nsIDOMNode *aNode)
|
||||
return mDTD->IsContainer(tagEnum);
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsEditor::IsTextInDirtyFrameVisible(nsIDOMNode *aNode)
|
||||
{
|
||||
// virtual method
|
||||
//
|
||||
// If this is a simple non-html editor,
|
||||
// the best we can do is to assume it's visible.
|
||||
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsEditor::IsEditable(nsIDOMNode *aNode)
|
||||
{
|
||||
@ -3778,7 +3789,14 @@ nsEditor::IsEditable(nsIDOMNode *aNode)
|
||||
nsFrameState fs;
|
||||
resultFrame->GetFrameState(&fs);
|
||||
if ((fs & NS_FRAME_IS_DIRTY)) // we can only trust width data for undirty frames
|
||||
return PR_TRUE; // assume all text nodes with dirty frames are editable
|
||||
{
|
||||
// In the past a comment said:
|
||||
// "assume all text nodes with dirty frames are editable"
|
||||
// Nowadays we use a virtual function, that assumes TRUE
|
||||
// in the simple editor world,
|
||||
// and uses enhanced logic to find out in the HTML world.
|
||||
return IsTextInDirtyFrameVisible(aNode);
|
||||
}
|
||||
nsRect rect;
|
||||
resultFrame->GetRect(rect);
|
||||
if (rect.width > 0)
|
||||
|
@ -474,6 +474,8 @@ public:
|
||||
/** returns PR_TRUE if aNode is an editable node */
|
||||
PRBool IsEditable(nsIDOMNode *aNode);
|
||||
|
||||
virtual PRBool IsTextInDirtyFrameVisible(nsIDOMNode *aNode);
|
||||
|
||||
/** returns PR_TRUE if aNode is a MozEditorBogus node */
|
||||
PRBool IsMozEditorBogusNode(nsIDOMNode *aNode);
|
||||
|
||||
|
@ -5412,6 +5412,21 @@ nsHTMLEditor::GetLastEditableLeaf( nsIDOMNode *aNode, nsCOMPtr<nsIDOMNode> *aOut
|
||||
return res;
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsHTMLEditor::IsTextInDirtyFrameVisible(nsIDOMNode *aNode)
|
||||
{
|
||||
PRBool isEmptyTextNode;
|
||||
nsresult res = IsVisTextNode(aNode, &isEmptyTextNode, PR_FALSE);
|
||||
if (NS_FAILED(res))
|
||||
{
|
||||
// We are following the historical decision:
|
||||
// if we don't know, we say it's visible...
|
||||
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
return !isEmptyTextNode;
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
@ -496,6 +496,8 @@ public:
|
||||
// aSelection is optional -- if null, we get current seletion
|
||||
nsresult CollapseSelectionToDeepestNonTableFirstChild(nsISelection *aSelection, nsIDOMNode *aNode);
|
||||
|
||||
virtual PRBool IsTextInDirtyFrameVisible(nsIDOMNode *aNode);
|
||||
|
||||
nsresult IsVisTextNode( nsIDOMNode *aNode,
|
||||
PRBool *outIsEmptyNode,
|
||||
PRBool aSafeToAskFrames);
|
||||
|
Loading…
x
Reference in New Issue
Block a user