fixing caret usages. hiding caret now is done by giving the stack destructor a caret * not a presshell
This commit is contained in:
Родитель
a14d4fbfb0
Коммит
5d7b303285
|
@ -4991,7 +4991,13 @@ nsresult nsEditor::EndUpdateViewBatch()
|
||||||
if (NS_FAILED(rv) || !selCon)
|
if (NS_FAILED(rv) || !selCon)
|
||||||
return rv?rv:NS_ERROR_FAILURE;
|
return rv?rv:NS_ERROR_FAILURE;
|
||||||
|
|
||||||
StCaretHider caretHider(selCon);
|
nsCOMPtr<nsIPresShell> ps = do_QueryReferent(mPresShellWeak);
|
||||||
|
nsCOMPtr<nsICaret> caret;
|
||||||
|
if (ps)
|
||||||
|
rv = ps->GetCaret(getter_AddRefs(caret));
|
||||||
|
if (NS_FAILED(rv) ||!caret)
|
||||||
|
return rv?rv:NS_ERROR_FAILURE;
|
||||||
|
StCaretHider caretHider(caret);
|
||||||
|
|
||||||
nsCOMPtr<nsIDOMSelection>selection;
|
nsCOMPtr<nsIDOMSelection>selection;
|
||||||
nsresult selectionResult = GetSelection(getter_AddRefs(selection));
|
nsresult selectionResult = GetSelection(getter_AddRefs(selection));
|
||||||
|
|
|
@ -308,40 +308,31 @@ nsHTMLEditor::~nsHTMLEditor()
|
||||||
selection->RemoveSelectionListener(listener);
|
selection->RemoveSelectionListener(listener);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Don't use getDocument here, because we have no way of knowing if
|
nsCOMPtr<nsIDOMEventReceiver> erP;
|
||||||
// Init() was ever called. So we need to get the document ourselves,
|
result = GetDOMEventReceiver(getter_AddRefs(erP));
|
||||||
// if it exists.
|
if (NS_SUCCEEDED(result) && erP)
|
||||||
if (mDocWeak)
|
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsIDOMDocument> doc = do_QueryReferent(mDocWeak);
|
if (mKeyListenerP) {
|
||||||
if (doc)
|
erP->RemoveEventListenerByIID(mKeyListenerP, NS_GET_IID(nsIDOMKeyListener));
|
||||||
{
|
}
|
||||||
nsCOMPtr<nsIDOMEventReceiver> erP = do_QueryInterface(doc, &result);
|
if (mMouseListenerP) {
|
||||||
if (NS_SUCCEEDED(result) && erP)
|
erP->RemoveEventListenerByIID(mMouseListenerP, NS_GET_IID(nsIDOMMouseListener));
|
||||||
{
|
}
|
||||||
if (mKeyListenerP) {
|
if (mTextListenerP) {
|
||||||
erP->RemoveEventListenerByIID(mKeyListenerP, NS_GET_IID(nsIDOMKeyListener));
|
erP->RemoveEventListenerByIID(mTextListenerP, NS_GET_IID(nsIDOMTextListener));
|
||||||
}
|
}
|
||||||
if (mMouseListenerP) {
|
if (mCompositionListenerP) {
|
||||||
erP->RemoveEventListenerByIID(mMouseListenerP, NS_GET_IID(nsIDOMMouseListener));
|
erP->RemoveEventListenerByIID(mCompositionListenerP, NS_GET_IID(nsIDOMCompositionListener));
|
||||||
}
|
}
|
||||||
if (mTextListenerP) {
|
if (mFocusListenerP) {
|
||||||
erP->RemoveEventListenerByIID(mTextListenerP, NS_GET_IID(nsIDOMTextListener));
|
erP->RemoveEventListenerByIID(mFocusListenerP, NS_GET_IID(nsIDOMFocusListener));
|
||||||
}
|
}
|
||||||
if (mCompositionListenerP) {
|
if (mDragListenerP) {
|
||||||
erP->RemoveEventListenerByIID(mCompositionListenerP, NS_GET_IID(nsIDOMCompositionListener));
|
erP->RemoveEventListenerByIID(mDragListenerP, NS_GET_IID(nsIDOMDragListener));
|
||||||
}
|
|
||||||
if (mFocusListenerP) {
|
|
||||||
erP->RemoveEventListenerByIID(mFocusListenerP, NS_GET_IID(nsIDOMFocusListener));
|
|
||||||
}
|
|
||||||
if (mDragListenerP) {
|
|
||||||
erP->RemoveEventListenerByIID(mDragListenerP, NS_GET_IID(nsIDOMDragListener));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
NS_NOTREACHED("~nsTextEditor");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
NS_NOTREACHED("~nsTextEditor");
|
||||||
|
|
||||||
NS_IF_RELEASE(mTypeInState);
|
NS_IF_RELEASE(mTypeInState);
|
||||||
}
|
}
|
||||||
|
@ -599,32 +590,9 @@ printf("nsTextEditor.cpp: failed to get TextEvent Listener\n");
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
// get the DOM event receiver
|
|
||||||
nsCOMPtr<nsIDOMDocument> domdoc;
|
|
||||||
nsEditor::GetDocument(getter_AddRefs(domdoc));
|
|
||||||
nsCOMPtr<nsIDOMEventReceiver> erP;
|
nsCOMPtr<nsIDOMEventReceiver> erP;
|
||||||
nsCOMPtr<nsIDOMElement> rootElement;
|
result = GetDOMEventReceiver(getter_AddRefs(erP));
|
||||||
GetRootElement(getter_AddRefs(rootElement));
|
|
||||||
//now hack to make sure we are not anonymous content if we are grab the parent of root element for our observer
|
|
||||||
|
|
||||||
nsCOMPtr<nsIContent> content = do_QueryInterface(rootElement);
|
|
||||||
if (content)
|
|
||||||
{
|
|
||||||
nsCOMPtr<nsIContent> parent;
|
|
||||||
if (NS_SUCCEEDED(content->GetParent(*getter_AddRefs(parent))) && parent)
|
|
||||||
{
|
|
||||||
PRInt32 index;
|
|
||||||
if (NS_FAILED(parent->IndexOf(content, index)) || index<0 )
|
|
||||||
{
|
|
||||||
rootElement = do_QueryInterface(parent); //this will put listener on the form element basically
|
|
||||||
result = rootElement->QueryInterface(NS_GET_IID(nsIDOMEventReceiver), getter_AddRefs(erP));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
rootElement = 0;//let the event receiver work on the document instead of the root element
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!rootElement && domdoc)
|
|
||||||
result = domdoc->QueryInterface(NS_GET_IID(nsIDOMEventReceiver), getter_AddRefs(erP));
|
|
||||||
//end hack
|
//end hack
|
||||||
if (NS_FAILED(result)) {
|
if (NS_FAILED(result)) {
|
||||||
HandleEventListenerError();
|
HandleEventListenerError();
|
||||||
|
@ -2189,6 +2157,64 @@ nsresult nsHTMLEditor::GetAbsoluteOffsetsForPoints(nsIDOMNode *aInStartNode,
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nsresult
|
||||||
|
nsHTMLEditor::GetDOMEventReceiver(nsIDOMEventReceiver **aEventReceiver)
|
||||||
|
{
|
||||||
|
if (!aEventReceiver)
|
||||||
|
return NS_ERROR_NULL_POINTER;
|
||||||
|
|
||||||
|
*aEventReceiver = 0;
|
||||||
|
|
||||||
|
nsCOMPtr<nsIDOMElement> rootElement;
|
||||||
|
|
||||||
|
nsresult result = GetRootElement(getter_AddRefs(rootElement));
|
||||||
|
|
||||||
|
if (NS_FAILED(result))
|
||||||
|
return result;
|
||||||
|
|
||||||
|
if (!rootElement)
|
||||||
|
return NS_ERROR_FAILURE;
|
||||||
|
|
||||||
|
// Now hack to make sure we are not anonymous content.
|
||||||
|
// If we are grab the parent of root element for our observer.
|
||||||
|
|
||||||
|
nsCOMPtr<nsIContent> content = do_QueryInterface(rootElement);
|
||||||
|
|
||||||
|
if (content)
|
||||||
|
{
|
||||||
|
nsCOMPtr<nsIContent> parent;
|
||||||
|
if (NS_SUCCEEDED(content->GetParent(*getter_AddRefs(parent))) && parent)
|
||||||
|
{
|
||||||
|
PRInt32 index;
|
||||||
|
if (NS_FAILED(parent->IndexOf(content, index)) || index < 0 )
|
||||||
|
{
|
||||||
|
rootElement = do_QueryInterface(parent); //this will put listener on the form element basically
|
||||||
|
result = rootElement->QueryInterface(NS_GET_IID(nsIDOMEventReceiver), (void **)aEventReceiver);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
rootElement = 0; // Let the event receiver work on the document instead of the root element
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
rootElement = 0;
|
||||||
|
|
||||||
|
if (!rootElement && mDocWeak)
|
||||||
|
{
|
||||||
|
// Don't use getDocument here, because we have no way of knowing if
|
||||||
|
// Init() was ever called. So we need to get the document ourselves,
|
||||||
|
// if it exists.
|
||||||
|
|
||||||
|
nsCOMPtr<nsIDOMDocument> domdoc = do_QueryReferent(mDocWeak);
|
||||||
|
|
||||||
|
if (!domdoc)
|
||||||
|
return NS_ERROR_FAILURE;
|
||||||
|
|
||||||
|
result = domdoc->QueryInterface(NS_GET_IID(nsIDOMEventReceiver), (void **)aEventReceiver);
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsHTMLEditor::SetCaretToDocumentStart()
|
nsHTMLEditor::SetCaretToDocumentStart()
|
||||||
{
|
{
|
||||||
|
@ -3592,7 +3618,7 @@ nsHTMLEditor::GetSelectedElement(const nsString& aTagName, nsIDOMElement** aRetu
|
||||||
res = enumerator->CurrentItem(getter_AddRefs(currentItem));
|
res = enumerator->CurrentItem(getter_AddRefs(currentItem));
|
||||||
if ((NS_SUCCEEDED(res)) && currentItem)
|
if ((NS_SUCCEEDED(res)) && currentItem)
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsIDOMRange> range( do_QueryInterface(currentItem) );
|
nsCOMPtr<nsIDOMRange> currange( do_QueryInterface(currentItem) );
|
||||||
nsCOMPtr<nsIContentIterator> iter;
|
nsCOMPtr<nsIContentIterator> iter;
|
||||||
res = nsComponentManager::CreateInstance(kCContentIteratorCID, nsnull,
|
res = nsComponentManager::CreateInstance(kCContentIteratorCID, nsnull,
|
||||||
NS_GET_IID(nsIContentIterator),
|
NS_GET_IID(nsIContentIterator),
|
||||||
|
@ -3600,7 +3626,7 @@ nsHTMLEditor::GetSelectedElement(const nsString& aTagName, nsIDOMElement** aRetu
|
||||||
// XXX: ERROR_HANDLING XPCOM usage
|
// XXX: ERROR_HANDLING XPCOM usage
|
||||||
if ((NS_SUCCEEDED(res)) && iter)
|
if ((NS_SUCCEEDED(res)) && iter)
|
||||||
{
|
{
|
||||||
iter->Init(range);
|
iter->Init(currange);
|
||||||
// loop through the content iterator for each content node
|
// loop through the content iterator for each content node
|
||||||
nsCOMPtr<nsIContent> content;
|
nsCOMPtr<nsIContent> content;
|
||||||
while (NS_ENUMERATOR_FALSE == iter->IsDone())
|
while (NS_ENUMERATOR_FALSE == iter->IsDone())
|
||||||
|
@ -5131,6 +5157,7 @@ NS_IMETHODIMP nsHTMLEditor::OutputToString(nsString& aOutputString,
|
||||||
wc = (PRUint32)wrapColumn;
|
wc = (PRUint32)wrapColumn;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
printf("Editor: getting output with wrapcol = %d (GetBodyWrapWidth returned %d\n", wc, wrapColumn);
|
||||||
return selection->ToString(aFormatType, aFlags, wc, aOutputString);
|
return selection->ToString(aFormatType, aFlags, wc, aOutputString);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,6 +42,7 @@
|
||||||
|
|
||||||
class nsIDOMKeyEvent;
|
class nsIDOMKeyEvent;
|
||||||
class nsITransferable;
|
class nsITransferable;
|
||||||
|
class nsIDOMEventReceiver;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The HTML editor implementation.<br>
|
* The HTML editor implementation.<br>
|
||||||
|
@ -545,7 +546,8 @@ protected:
|
||||||
nsresult GetFirstEditableChild( nsIDOMNode *aNode, nsCOMPtr<nsIDOMNode> *aOutFirstChild);
|
nsresult GetFirstEditableChild( nsIDOMNode *aNode, nsCOMPtr<nsIDOMNode> *aOutFirstChild);
|
||||||
nsresult GetLastEditableChild( nsIDOMNode *aNode, nsCOMPtr<nsIDOMNode> *aOutLastChild);
|
nsresult GetLastEditableChild( nsIDOMNode *aNode, nsCOMPtr<nsIDOMNode> *aOutLastChild);
|
||||||
|
|
||||||
|
nsresult GetDOMEventReceiver(nsIDOMEventReceiver **aEventReceiver);
|
||||||
|
|
||||||
// Data members
|
// Data members
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
|
|
@ -4991,7 +4991,13 @@ nsresult nsEditor::EndUpdateViewBatch()
|
||||||
if (NS_FAILED(rv) || !selCon)
|
if (NS_FAILED(rv) || !selCon)
|
||||||
return rv?rv:NS_ERROR_FAILURE;
|
return rv?rv:NS_ERROR_FAILURE;
|
||||||
|
|
||||||
StCaretHider caretHider(selCon);
|
nsCOMPtr<nsIPresShell> ps = do_QueryReferent(mPresShellWeak);
|
||||||
|
nsCOMPtr<nsICaret> caret;
|
||||||
|
if (ps)
|
||||||
|
rv = ps->GetCaret(getter_AddRefs(caret));
|
||||||
|
if (NS_FAILED(rv) ||!caret)
|
||||||
|
return rv?rv:NS_ERROR_FAILURE;
|
||||||
|
StCaretHider caretHider(caret);
|
||||||
|
|
||||||
nsCOMPtr<nsIDOMSelection>selection;
|
nsCOMPtr<nsIDOMSelection>selection;
|
||||||
nsresult selectionResult = GetSelection(getter_AddRefs(selection));
|
nsresult selectionResult = GetSelection(getter_AddRefs(selection));
|
||||||
|
|
|
@ -308,40 +308,31 @@ nsHTMLEditor::~nsHTMLEditor()
|
||||||
selection->RemoveSelectionListener(listener);
|
selection->RemoveSelectionListener(listener);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Don't use getDocument here, because we have no way of knowing if
|
nsCOMPtr<nsIDOMEventReceiver> erP;
|
||||||
// Init() was ever called. So we need to get the document ourselves,
|
result = GetDOMEventReceiver(getter_AddRefs(erP));
|
||||||
// if it exists.
|
if (NS_SUCCEEDED(result) && erP)
|
||||||
if (mDocWeak)
|
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsIDOMDocument> doc = do_QueryReferent(mDocWeak);
|
if (mKeyListenerP) {
|
||||||
if (doc)
|
erP->RemoveEventListenerByIID(mKeyListenerP, NS_GET_IID(nsIDOMKeyListener));
|
||||||
{
|
}
|
||||||
nsCOMPtr<nsIDOMEventReceiver> erP = do_QueryInterface(doc, &result);
|
if (mMouseListenerP) {
|
||||||
if (NS_SUCCEEDED(result) && erP)
|
erP->RemoveEventListenerByIID(mMouseListenerP, NS_GET_IID(nsIDOMMouseListener));
|
||||||
{
|
}
|
||||||
if (mKeyListenerP) {
|
if (mTextListenerP) {
|
||||||
erP->RemoveEventListenerByIID(mKeyListenerP, NS_GET_IID(nsIDOMKeyListener));
|
erP->RemoveEventListenerByIID(mTextListenerP, NS_GET_IID(nsIDOMTextListener));
|
||||||
}
|
}
|
||||||
if (mMouseListenerP) {
|
if (mCompositionListenerP) {
|
||||||
erP->RemoveEventListenerByIID(mMouseListenerP, NS_GET_IID(nsIDOMMouseListener));
|
erP->RemoveEventListenerByIID(mCompositionListenerP, NS_GET_IID(nsIDOMCompositionListener));
|
||||||
}
|
}
|
||||||
if (mTextListenerP) {
|
if (mFocusListenerP) {
|
||||||
erP->RemoveEventListenerByIID(mTextListenerP, NS_GET_IID(nsIDOMTextListener));
|
erP->RemoveEventListenerByIID(mFocusListenerP, NS_GET_IID(nsIDOMFocusListener));
|
||||||
}
|
}
|
||||||
if (mCompositionListenerP) {
|
if (mDragListenerP) {
|
||||||
erP->RemoveEventListenerByIID(mCompositionListenerP, NS_GET_IID(nsIDOMCompositionListener));
|
erP->RemoveEventListenerByIID(mDragListenerP, NS_GET_IID(nsIDOMDragListener));
|
||||||
}
|
|
||||||
if (mFocusListenerP) {
|
|
||||||
erP->RemoveEventListenerByIID(mFocusListenerP, NS_GET_IID(nsIDOMFocusListener));
|
|
||||||
}
|
|
||||||
if (mDragListenerP) {
|
|
||||||
erP->RemoveEventListenerByIID(mDragListenerP, NS_GET_IID(nsIDOMDragListener));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
NS_NOTREACHED("~nsTextEditor");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
NS_NOTREACHED("~nsTextEditor");
|
||||||
|
|
||||||
NS_IF_RELEASE(mTypeInState);
|
NS_IF_RELEASE(mTypeInState);
|
||||||
}
|
}
|
||||||
|
@ -599,32 +590,9 @@ printf("nsTextEditor.cpp: failed to get TextEvent Listener\n");
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
// get the DOM event receiver
|
|
||||||
nsCOMPtr<nsIDOMDocument> domdoc;
|
|
||||||
nsEditor::GetDocument(getter_AddRefs(domdoc));
|
|
||||||
nsCOMPtr<nsIDOMEventReceiver> erP;
|
nsCOMPtr<nsIDOMEventReceiver> erP;
|
||||||
nsCOMPtr<nsIDOMElement> rootElement;
|
result = GetDOMEventReceiver(getter_AddRefs(erP));
|
||||||
GetRootElement(getter_AddRefs(rootElement));
|
|
||||||
//now hack to make sure we are not anonymous content if we are grab the parent of root element for our observer
|
|
||||||
|
|
||||||
nsCOMPtr<nsIContent> content = do_QueryInterface(rootElement);
|
|
||||||
if (content)
|
|
||||||
{
|
|
||||||
nsCOMPtr<nsIContent> parent;
|
|
||||||
if (NS_SUCCEEDED(content->GetParent(*getter_AddRefs(parent))) && parent)
|
|
||||||
{
|
|
||||||
PRInt32 index;
|
|
||||||
if (NS_FAILED(parent->IndexOf(content, index)) || index<0 )
|
|
||||||
{
|
|
||||||
rootElement = do_QueryInterface(parent); //this will put listener on the form element basically
|
|
||||||
result = rootElement->QueryInterface(NS_GET_IID(nsIDOMEventReceiver), getter_AddRefs(erP));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
rootElement = 0;//let the event receiver work on the document instead of the root element
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!rootElement && domdoc)
|
|
||||||
result = domdoc->QueryInterface(NS_GET_IID(nsIDOMEventReceiver), getter_AddRefs(erP));
|
|
||||||
//end hack
|
//end hack
|
||||||
if (NS_FAILED(result)) {
|
if (NS_FAILED(result)) {
|
||||||
HandleEventListenerError();
|
HandleEventListenerError();
|
||||||
|
@ -2189,6 +2157,64 @@ nsresult nsHTMLEditor::GetAbsoluteOffsetsForPoints(nsIDOMNode *aInStartNode,
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nsresult
|
||||||
|
nsHTMLEditor::GetDOMEventReceiver(nsIDOMEventReceiver **aEventReceiver)
|
||||||
|
{
|
||||||
|
if (!aEventReceiver)
|
||||||
|
return NS_ERROR_NULL_POINTER;
|
||||||
|
|
||||||
|
*aEventReceiver = 0;
|
||||||
|
|
||||||
|
nsCOMPtr<nsIDOMElement> rootElement;
|
||||||
|
|
||||||
|
nsresult result = GetRootElement(getter_AddRefs(rootElement));
|
||||||
|
|
||||||
|
if (NS_FAILED(result))
|
||||||
|
return result;
|
||||||
|
|
||||||
|
if (!rootElement)
|
||||||
|
return NS_ERROR_FAILURE;
|
||||||
|
|
||||||
|
// Now hack to make sure we are not anonymous content.
|
||||||
|
// If we are grab the parent of root element for our observer.
|
||||||
|
|
||||||
|
nsCOMPtr<nsIContent> content = do_QueryInterface(rootElement);
|
||||||
|
|
||||||
|
if (content)
|
||||||
|
{
|
||||||
|
nsCOMPtr<nsIContent> parent;
|
||||||
|
if (NS_SUCCEEDED(content->GetParent(*getter_AddRefs(parent))) && parent)
|
||||||
|
{
|
||||||
|
PRInt32 index;
|
||||||
|
if (NS_FAILED(parent->IndexOf(content, index)) || index < 0 )
|
||||||
|
{
|
||||||
|
rootElement = do_QueryInterface(parent); //this will put listener on the form element basically
|
||||||
|
result = rootElement->QueryInterface(NS_GET_IID(nsIDOMEventReceiver), (void **)aEventReceiver);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
rootElement = 0; // Let the event receiver work on the document instead of the root element
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
rootElement = 0;
|
||||||
|
|
||||||
|
if (!rootElement && mDocWeak)
|
||||||
|
{
|
||||||
|
// Don't use getDocument here, because we have no way of knowing if
|
||||||
|
// Init() was ever called. So we need to get the document ourselves,
|
||||||
|
// if it exists.
|
||||||
|
|
||||||
|
nsCOMPtr<nsIDOMDocument> domdoc = do_QueryReferent(mDocWeak);
|
||||||
|
|
||||||
|
if (!domdoc)
|
||||||
|
return NS_ERROR_FAILURE;
|
||||||
|
|
||||||
|
result = domdoc->QueryInterface(NS_GET_IID(nsIDOMEventReceiver), (void **)aEventReceiver);
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsHTMLEditor::SetCaretToDocumentStart()
|
nsHTMLEditor::SetCaretToDocumentStart()
|
||||||
{
|
{
|
||||||
|
@ -3592,7 +3618,7 @@ nsHTMLEditor::GetSelectedElement(const nsString& aTagName, nsIDOMElement** aRetu
|
||||||
res = enumerator->CurrentItem(getter_AddRefs(currentItem));
|
res = enumerator->CurrentItem(getter_AddRefs(currentItem));
|
||||||
if ((NS_SUCCEEDED(res)) && currentItem)
|
if ((NS_SUCCEEDED(res)) && currentItem)
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsIDOMRange> range( do_QueryInterface(currentItem) );
|
nsCOMPtr<nsIDOMRange> currange( do_QueryInterface(currentItem) );
|
||||||
nsCOMPtr<nsIContentIterator> iter;
|
nsCOMPtr<nsIContentIterator> iter;
|
||||||
res = nsComponentManager::CreateInstance(kCContentIteratorCID, nsnull,
|
res = nsComponentManager::CreateInstance(kCContentIteratorCID, nsnull,
|
||||||
NS_GET_IID(nsIContentIterator),
|
NS_GET_IID(nsIContentIterator),
|
||||||
|
@ -3600,7 +3626,7 @@ nsHTMLEditor::GetSelectedElement(const nsString& aTagName, nsIDOMElement** aRetu
|
||||||
// XXX: ERROR_HANDLING XPCOM usage
|
// XXX: ERROR_HANDLING XPCOM usage
|
||||||
if ((NS_SUCCEEDED(res)) && iter)
|
if ((NS_SUCCEEDED(res)) && iter)
|
||||||
{
|
{
|
||||||
iter->Init(range);
|
iter->Init(currange);
|
||||||
// loop through the content iterator for each content node
|
// loop through the content iterator for each content node
|
||||||
nsCOMPtr<nsIContent> content;
|
nsCOMPtr<nsIContent> content;
|
||||||
while (NS_ENUMERATOR_FALSE == iter->IsDone())
|
while (NS_ENUMERATOR_FALSE == iter->IsDone())
|
||||||
|
@ -5131,6 +5157,7 @@ NS_IMETHODIMP nsHTMLEditor::OutputToString(nsString& aOutputString,
|
||||||
wc = (PRUint32)wrapColumn;
|
wc = (PRUint32)wrapColumn;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
printf("Editor: getting output with wrapcol = %d (GetBodyWrapWidth returned %d\n", wc, wrapColumn);
|
||||||
return selection->ToString(aFormatType, aFlags, wc, aOutputString);
|
return selection->ToString(aFormatType, aFlags, wc, aOutputString);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,6 +42,7 @@
|
||||||
|
|
||||||
class nsIDOMKeyEvent;
|
class nsIDOMKeyEvent;
|
||||||
class nsITransferable;
|
class nsITransferable;
|
||||||
|
class nsIDOMEventReceiver;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The HTML editor implementation.<br>
|
* The HTML editor implementation.<br>
|
||||||
|
@ -545,7 +546,8 @@ protected:
|
||||||
nsresult GetFirstEditableChild( nsIDOMNode *aNode, nsCOMPtr<nsIDOMNode> *aOutFirstChild);
|
nsresult GetFirstEditableChild( nsIDOMNode *aNode, nsCOMPtr<nsIDOMNode> *aOutFirstChild);
|
||||||
nsresult GetLastEditableChild( nsIDOMNode *aNode, nsCOMPtr<nsIDOMNode> *aOutLastChild);
|
nsresult GetLastEditableChild( nsIDOMNode *aNode, nsCOMPtr<nsIDOMNode> *aOutLastChild);
|
||||||
|
|
||||||
|
nsresult GetDOMEventReceiver(nsIDOMEventReceiver **aEventReceiver);
|
||||||
|
|
||||||
// Data members
|
// Data members
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче