Bug 1194121 - Skip UpdateCommands() from initializing collapse to avoid sync IPC during app startup. r=jst
This commit is contained in:
@@ -166,8 +166,7 @@ public:
|
|||||||
|
|
||||||
nsDocViewerSelectionListener()
|
nsDocViewerSelectionListener()
|
||||||
: mDocViewer(nullptr)
|
: mDocViewer(nullptr)
|
||||||
, mGotSelectionState(false)
|
, mSelectionWasCollapsed(true)
|
||||||
, mSelectionWasCollapsed(false)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -177,8 +176,7 @@ protected:
|
|||||||
|
|
||||||
virtual ~nsDocViewerSelectionListener() {}
|
virtual ~nsDocViewerSelectionListener() {}
|
||||||
|
|
||||||
nsDocumentViewer* mDocViewer;
|
nsDocumentViewer* mDocViewer;
|
||||||
bool mGotSelectionState;
|
|
||||||
bool mSelectionWasCollapsed;
|
bool mSelectionWasCollapsed;
|
||||||
|
|
||||||
};
|
};
|
||||||
@@ -3572,13 +3570,13 @@ NS_IMETHODIMP nsDocViewerSelectionListener::NotifySelectionChanged(nsIDOMDocumen
|
|||||||
|
|
||||||
bool selectionCollapsed;
|
bool selectionCollapsed;
|
||||||
selection->GetIsCollapsed(&selectionCollapsed);
|
selection->GetIsCollapsed(&selectionCollapsed);
|
||||||
// we only call UpdateCommands when the selection changes from collapsed
|
// We only call UpdateCommands when the selection changes from collapsed to
|
||||||
// to non-collapsed or vice versa. We might need another update string
|
// non-collapsed or vice versa, however we skip the initializing collapse. We
|
||||||
// for simple selection changes, but that would be expenseive.
|
// might need another update string for simple selection changes, but that
|
||||||
if (!mGotSelectionState || mSelectionWasCollapsed != selectionCollapsed)
|
// would be expenseive.
|
||||||
|
if (mSelectionWasCollapsed != selectionCollapsed)
|
||||||
{
|
{
|
||||||
domWindow->UpdateCommands(NS_LITERAL_STRING("select"), selection, aReason);
|
domWindow->UpdateCommands(NS_LITERAL_STRING("select"), selection, aReason);
|
||||||
mGotSelectionState = true;
|
|
||||||
mSelectionWasCollapsed = selectionCollapsed;
|
mSelectionWasCollapsed = selectionCollapsed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user