зеркало из https://github.com/mozilla/pjs.git
Fix for bug 30958: Reflow commands are now processed asynchronously all the time. The semantics of the API for queuing and processing reflow commands has changed. Now, AppendReflowCommand() initiates an asynchronous reflow event and all reflow command processing happens when that event fires. It is no longer possible for consumers outside the presentation shell to call ProcessReflowCommands() synchronously. Because of this change, reflow locks are no longer needed and have been removed.
This commit is contained in:
Родитель
b2b414421e
Коммит
ae1909623b
|
@ -4847,7 +4847,7 @@ nsresult nsEditor::BeginUpdateViewBatch()
|
|||
rv = GetPresShell(getter_AddRefs(presShell));
|
||||
if (NS_SUCCEEDED(rv) && presShell)
|
||||
{
|
||||
presShell->BeginBatchingReflows();
|
||||
presShell->BeginReflowBatching();
|
||||
}
|
||||
}
|
||||
mUpdateCount++;
|
||||
|
@ -4885,7 +4885,7 @@ nsresult nsEditor::EndUpdateViewBatch()
|
|||
#else
|
||||
mViewManager->EndUpdateViewBatch(NS_VMREFRESH_IMMEDIATE);
|
||||
#endif
|
||||
presShell->EndBatchingReflows(PR_TRUE);
|
||||
presShell->EndReflowBatching(PR_TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -4847,7 +4847,7 @@ nsresult nsEditor::BeginUpdateViewBatch()
|
|||
rv = GetPresShell(getter_AddRefs(presShell));
|
||||
if (NS_SUCCEEDED(rv) && presShell)
|
||||
{
|
||||
presShell->BeginBatchingReflows();
|
||||
presShell->BeginReflowBatching();
|
||||
}
|
||||
}
|
||||
mUpdateCount++;
|
||||
|
@ -4885,7 +4885,7 @@ nsresult nsEditor::EndUpdateViewBatch()
|
|||
#else
|
||||
mViewManager->EndUpdateViewBatch(NS_VMREFRESH_IMMEDIATE);
|
||||
#endif
|
||||
presShell->EndBatchingReflows(PR_TRUE);
|
||||
presShell->EndReflowBatching(PR_TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -761,11 +761,9 @@ FrameManager::HandlePLEvent(CantRenderReplacedElementEvent* aEvent) {
|
|||
|
||||
// Notify the style system and then process any reflow commands that
|
||||
// are generated
|
||||
nsCOMPtr<nsIPresContext> presContext;
|
||||
frameManager->mPresShell->EnterReflowLock();
|
||||
nsCOMPtr<nsIPresContext> presContext;
|
||||
frameManager->mPresShell->GetPresContext(getter_AddRefs(presContext));
|
||||
frameManager->mStyleSet->CantRenderReplacedElement(presContext, aEvent->mFrame);
|
||||
frameManager->mPresShell->ExitReflowLock(PR_TRUE);
|
||||
frameManager->mStyleSet->CantRenderReplacedElement(presContext, aEvent->mFrame);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -163,11 +163,7 @@ public:
|
|||
* GetFrameSelection will return the Frame based selection API you
|
||||
* cannot go back and forth anymore with QI with nsIDOM sel and nsIFrame sel.
|
||||
*/
|
||||
NS_IMETHOD GetFrameSelection(nsIFrameSelection** aSelection) = 0;
|
||||
|
||||
NS_IMETHOD EnterReflowLock() = 0;
|
||||
|
||||
NS_IMETHOD ExitReflowLock(PRBool aTryToReflow) = 0;
|
||||
NS_IMETHOD GetFrameSelection(nsIFrameSelection** aSelection) = 0;
|
||||
|
||||
// Make shell be a document observer
|
||||
NS_IMETHOD BeginObservingDocument() = 0;
|
||||
|
@ -262,7 +258,19 @@ public:
|
|||
*/
|
||||
NS_IMETHOD AppendReflowCommand(nsIReflowCommand* aReflowCommand) = 0;
|
||||
NS_IMETHOD CancelReflowCommand(nsIFrame* aTargetFrame, nsIReflowCommand::ReflowType* aCmdType) = 0;
|
||||
NS_IMETHOD ProcessReflowCommands(PRBool aInterruptible) = 0;
|
||||
|
||||
/**
|
||||
* Flush all pending notifications such that the presentation is
|
||||
* in sync with the content.
|
||||
*/
|
||||
NS_IMETHOD FlushPendingNotifications() = 0;
|
||||
|
||||
/**
|
||||
* Reflow batching
|
||||
*/
|
||||
NS_IMETHOD BeginReflowBatching() = 0;
|
||||
NS_IMETHOD EndReflowBatching(PRBool aFlushPendingReflows) = 0;
|
||||
NS_IMETHOD GetReflowBatchingStatus(PRBool* aIsBatching) = 0;
|
||||
|
||||
NS_IMETHOD ClearFrameRefs(nsIFrame* aFrame) = 0;
|
||||
|
||||
|
@ -392,26 +400,6 @@ public:
|
|||
NS_IMETHOD GetHistoryState(nsILayoutHistoryState** aLayoutHistoryState) = 0;
|
||||
NS_IMETHOD SetHistoryState(nsILayoutHistoryState* aLayoutHistoryState) = 0;
|
||||
|
||||
/**
|
||||
* Get/Set the status that indicates whether the presshell knows about a
|
||||
* pending reflow event
|
||||
*/
|
||||
NS_IMETHOD GetReflowEventStatus(PRBool* aPending) = 0;
|
||||
NS_IMETHOD SetReflowEventStatus(PRBool aPending) = 0;
|
||||
|
||||
/**
|
||||
* Reflow batching
|
||||
*/
|
||||
NS_IMETHOD BeginBatchingReflows() = 0;
|
||||
NS_IMETHOD EndBatchingReflows(PRBool aFlushPendingReflows) = 0;
|
||||
NS_IMETHOD GetReflowBatchingStatus(PRBool* aIsBatching) = 0;
|
||||
|
||||
/**
|
||||
* Flush all pending notifications such that the presentation is
|
||||
* in sync with the content.
|
||||
*/
|
||||
NS_IMETHOD FlushPendingNotifications() = 0;
|
||||
|
||||
/**
|
||||
* Determine if reflow is currently locked
|
||||
* @param aIsReflowLocked returns PR_TRUE if reflow is locked, PR_FALSE otherwise
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -163,11 +163,7 @@ public:
|
|||
* GetFrameSelection will return the Frame based selection API you
|
||||
* cannot go back and forth anymore with QI with nsIDOM sel and nsIFrame sel.
|
||||
*/
|
||||
NS_IMETHOD GetFrameSelection(nsIFrameSelection** aSelection) = 0;
|
||||
|
||||
NS_IMETHOD EnterReflowLock() = 0;
|
||||
|
||||
NS_IMETHOD ExitReflowLock(PRBool aTryToReflow) = 0;
|
||||
NS_IMETHOD GetFrameSelection(nsIFrameSelection** aSelection) = 0;
|
||||
|
||||
// Make shell be a document observer
|
||||
NS_IMETHOD BeginObservingDocument() = 0;
|
||||
|
@ -262,7 +258,19 @@ public:
|
|||
*/
|
||||
NS_IMETHOD AppendReflowCommand(nsIReflowCommand* aReflowCommand) = 0;
|
||||
NS_IMETHOD CancelReflowCommand(nsIFrame* aTargetFrame, nsIReflowCommand::ReflowType* aCmdType) = 0;
|
||||
NS_IMETHOD ProcessReflowCommands(PRBool aInterruptible) = 0;
|
||||
|
||||
/**
|
||||
* Flush all pending notifications such that the presentation is
|
||||
* in sync with the content.
|
||||
*/
|
||||
NS_IMETHOD FlushPendingNotifications() = 0;
|
||||
|
||||
/**
|
||||
* Reflow batching
|
||||
*/
|
||||
NS_IMETHOD BeginReflowBatching() = 0;
|
||||
NS_IMETHOD EndReflowBatching(PRBool aFlushPendingReflows) = 0;
|
||||
NS_IMETHOD GetReflowBatchingStatus(PRBool* aIsBatching) = 0;
|
||||
|
||||
NS_IMETHOD ClearFrameRefs(nsIFrame* aFrame) = 0;
|
||||
|
||||
|
@ -392,26 +400,6 @@ public:
|
|||
NS_IMETHOD GetHistoryState(nsILayoutHistoryState** aLayoutHistoryState) = 0;
|
||||
NS_IMETHOD SetHistoryState(nsILayoutHistoryState* aLayoutHistoryState) = 0;
|
||||
|
||||
/**
|
||||
* Get/Set the status that indicates whether the presshell knows about a
|
||||
* pending reflow event
|
||||
*/
|
||||
NS_IMETHOD GetReflowEventStatus(PRBool* aPending) = 0;
|
||||
NS_IMETHOD SetReflowEventStatus(PRBool aPending) = 0;
|
||||
|
||||
/**
|
||||
* Reflow batching
|
||||
*/
|
||||
NS_IMETHOD BeginBatchingReflows() = 0;
|
||||
NS_IMETHOD EndBatchingReflows(PRBool aFlushPendingReflows) = 0;
|
||||
NS_IMETHOD GetReflowBatchingStatus(PRBool* aIsBatching) = 0;
|
||||
|
||||
/**
|
||||
* Flush all pending notifications such that the presentation is
|
||||
* in sync with the content.
|
||||
*/
|
||||
NS_IMETHOD FlushPendingNotifications() = 0;
|
||||
|
||||
/**
|
||||
* Determine if reflow is currently locked
|
||||
* @param aIsReflowLocked returns PR_TRUE if reflow is locked, PR_FALSE otherwise
|
||||
|
|
|
@ -530,11 +530,6 @@ nsFrameImageLoader::NotifyError(nsIImageRequest *aImageRequest,
|
|||
void
|
||||
nsFrameImageLoader::NotifyFrames(PRBool aIsSizeUpdate)
|
||||
{
|
||||
nsIPresShell* shell;
|
||||
mPresContext->GetShell(&shell);
|
||||
if (shell) {
|
||||
shell->EnterReflowLock();
|
||||
}
|
||||
|
||||
PerFrameData* pfd = mFrames;
|
||||
while (nsnull != pfd) {
|
||||
|
@ -552,11 +547,7 @@ nsFrameImageLoader::NotifyFrames(PRBool aIsSizeUpdate)
|
|||
}
|
||||
pfd = pfd->mNext;
|
||||
}
|
||||
|
||||
if (shell) {
|
||||
shell->ExitReflowLock(PR_TRUE);
|
||||
NS_RELEASE(shell);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -6256,9 +6256,6 @@ nsBlockFrame::ReflowDirtyChild(nsIPresShell* aPresShell, nsIFrame* aChild)
|
|||
line->MarkDirty();
|
||||
line = line->mNext;
|
||||
}
|
||||
#ifdef DEBUG_nisheeth
|
||||
NS_ASSERTION(0, "nsBlockFrame::ReflowDirtyChild: Marked all lines dirty.");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -6256,9 +6256,6 @@ nsBlockFrame::ReflowDirtyChild(nsIPresShell* aPresShell, nsIFrame* aChild)
|
|||
line->MarkDirty();
|
||||
line = line->mNext;
|
||||
}
|
||||
#ifdef DEBUG_nisheeth
|
||||
NS_ASSERTION(0, "nsBlockFrame::ReflowDirtyChild: Marked all lines dirty.");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -6256,9 +6256,6 @@ nsBlockFrame::ReflowDirtyChild(nsIPresShell* aPresShell, nsIFrame* aChild)
|
|||
line->MarkDirty();
|
||||
line = line->mNext;
|
||||
}
|
||||
#ifdef DEBUG_nisheeth
|
||||
NS_ASSERTION(0, "nsBlockFrame::ReflowDirtyChild: Marked all lines dirty.");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -763,15 +763,19 @@ nsBulletFrame::UpdateBulletCB(nsIPresContext* aPresContext,
|
|||
// a reflow of the bullet frame.
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
rv = aPresContext->GetShell(getter_AddRefs(shell));
|
||||
if (NS_SUCCEEDED(rv) && shell) {
|
||||
nsIReflowCommand* cmd;
|
||||
rv = NS_NewHTMLReflowCommand(&cmd, aFrame,
|
||||
nsIReflowCommand::ContentChanged);
|
||||
if (NS_OK == rv) {
|
||||
shell->EnterReflowLock();
|
||||
shell->AppendReflowCommand(cmd);
|
||||
NS_RELEASE(cmd);
|
||||
shell->ExitReflowLock(PR_TRUE);
|
||||
if (NS_SUCCEEDED(rv) && shell) {
|
||||
nsIFrame* parent;
|
||||
aFrame->GetParent(&parent);
|
||||
if (parent) {
|
||||
// Mark the bullet frame dirty and ask its parent to reflow it.
|
||||
nsFrameState state;
|
||||
aFrame->GetFrameState(&state);
|
||||
state |= NS_FRAME_IS_DIRTY;
|
||||
aFrame->SetFrameState(state);
|
||||
parent->ReflowDirtyChild(shell, aFrame);
|
||||
}
|
||||
else {
|
||||
NS_ASSERTION(0, "No parent to pass the reflow request up to.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6256,9 +6256,6 @@ nsBlockFrame::ReflowDirtyChild(nsIPresShell* aPresShell, nsIFrame* aChild)
|
|||
line->MarkDirty();
|
||||
line = line->mNext;
|
||||
}
|
||||
#ifdef DEBUG_nisheeth
|
||||
NS_ASSERTION(0, "nsBlockFrame::ReflowDirtyChild: Marked all lines dirty.");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -6256,9 +6256,6 @@ nsBlockFrame::ReflowDirtyChild(nsIPresShell* aPresShell, nsIFrame* aChild)
|
|||
line->MarkDirty();
|
||||
line = line->mNext;
|
||||
}
|
||||
#ifdef DEBUG_nisheeth
|
||||
NS_ASSERTION(0, "nsBlockFrame::ReflowDirtyChild: Marked all lines dirty.");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -6256,9 +6256,6 @@ nsBlockFrame::ReflowDirtyChild(nsIPresShell* aPresShell, nsIFrame* aChild)
|
|||
line->MarkDirty();
|
||||
line = line->mNext;
|
||||
}
|
||||
#ifdef DEBUG_nisheeth
|
||||
NS_ASSERTION(0, "nsBlockFrame::ReflowDirtyChild: Marked all lines dirty.");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -763,15 +763,19 @@ nsBulletFrame::UpdateBulletCB(nsIPresContext* aPresContext,
|
|||
// a reflow of the bullet frame.
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
rv = aPresContext->GetShell(getter_AddRefs(shell));
|
||||
if (NS_SUCCEEDED(rv) && shell) {
|
||||
nsIReflowCommand* cmd;
|
||||
rv = NS_NewHTMLReflowCommand(&cmd, aFrame,
|
||||
nsIReflowCommand::ContentChanged);
|
||||
if (NS_OK == rv) {
|
||||
shell->EnterReflowLock();
|
||||
shell->AppendReflowCommand(cmd);
|
||||
NS_RELEASE(cmd);
|
||||
shell->ExitReflowLock(PR_TRUE);
|
||||
if (NS_SUCCEEDED(rv) && shell) {
|
||||
nsIFrame* parent;
|
||||
aFrame->GetParent(&parent);
|
||||
if (parent) {
|
||||
// Mark the bullet frame dirty and ask its parent to reflow it.
|
||||
nsFrameState state;
|
||||
aFrame->GetFrameState(&state);
|
||||
state |= NS_FRAME_IS_DIRTY;
|
||||
aFrame->SetFrameState(state);
|
||||
parent->ReflowDirtyChild(shell, aFrame);
|
||||
}
|
||||
else {
|
||||
NS_ASSERTION(0, "No parent to pass the reflow request up to.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -761,11 +761,9 @@ FrameManager::HandlePLEvent(CantRenderReplacedElementEvent* aEvent) {
|
|||
|
||||
// Notify the style system and then process any reflow commands that
|
||||
// are generated
|
||||
nsCOMPtr<nsIPresContext> presContext;
|
||||
frameManager->mPresShell->EnterReflowLock();
|
||||
nsCOMPtr<nsIPresContext> presContext;
|
||||
frameManager->mPresShell->GetPresContext(getter_AddRefs(presContext));
|
||||
frameManager->mStyleSet->CantRenderReplacedElement(presContext, aEvent->mFrame);
|
||||
frameManager->mPresShell->ExitReflowLock(PR_TRUE);
|
||||
frameManager->mStyleSet->CantRenderReplacedElement(presContext, aEvent->mFrame);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -1413,12 +1413,8 @@ nsGfxTextControlFrame::CreateSubDoc(nsRect *aSizeOfSubdocContainer)
|
|||
nsCOMPtr<nsIPresShell> shell;
|
||||
rv = mFramePresContext->GetShell(getter_AddRefs(shell));
|
||||
if (NS_FAILED(rv)) { return rv; }
|
||||
if (!shell) { return NS_ERROR_NULL_POINTER; }
|
||||
rv = shell->EnterReflowLock();
|
||||
if (NS_FAILED(rv)) { return rv; }
|
||||
rv = shell->AppendReflowCommand(cmd);
|
||||
// must do this next line regardless of result of AppendReflowCommand
|
||||
shell->ExitReflowLock(PR_TRUE);
|
||||
if (!shell) { return NS_ERROR_NULL_POINTER; }
|
||||
rv = shell->AppendReflowCommand(cmd);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
|
|
@ -745,7 +745,7 @@ nsTreeRowGroupFrame::PositionChanged(nsIPresContext* aPresContext, PRInt32 aOldI
|
|||
// Ensure all reflows happen first.
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
aPresContext->GetShell(getter_AddRefs(shell));
|
||||
shell->ProcessReflowCommands(PR_FALSE);
|
||||
shell->FlushPendingNotifications();
|
||||
}
|
||||
|
||||
PRInt32 loseRows = delta;
|
||||
|
@ -1431,7 +1431,7 @@ void nsTreeRowGroupFrame::OnContentAdded(nsIPresContext* aPresContext)
|
|||
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
aPresContext->GetShell(getter_AddRefs(shell));
|
||||
shell->ProcessReflowCommands(PR_FALSE);
|
||||
shell->FlushPendingNotifications();
|
||||
}
|
||||
|
||||
void nsTreeRowGroupFrame::OnContentInserted(nsIPresContext* aPresContext, nsIFrame* aNextSibling, PRInt32 aIndex)
|
||||
|
@ -1507,7 +1507,7 @@ void nsTreeRowGroupFrame::OnContentRemoved(nsIPresContext* aPresContext,
|
|||
// deal with cleaning out the content chain.
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
aPresContext->GetShell(getter_AddRefs(shell));
|
||||
shell->ProcessReflowCommands(PR_FALSE);
|
||||
shell->FlushPendingNotifications();
|
||||
|
||||
return; // All frames got deleted anyway by the pos change.
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче