diff --git a/layout/base/nsIPresShell.h b/layout/base/nsIPresShell.h index 843d1e58690d..38a42a041be1 100644 --- a/layout/base/nsIPresShell.h +++ b/layout/base/nsIPresShell.h @@ -288,6 +288,10 @@ public: NS_IMETHOD CancelReflowCommand(nsIFrame* aTargetFrame, nsReflowType* aCmdType) = 0; NS_IMETHOD CancelAllReflowCommands() = 0; + /** + * Recreates the frames for a node + */ + NS_IMETHOD RecreateFramesFor(nsIContent* aContent) = 0; /** * Determine if it is safe to flush all pending notifications diff --git a/layout/base/nsPresShell.cpp b/layout/base/nsPresShell.cpp index bb00138c1429..e358aebd7a3d 100644 --- a/layout/base/nsPresShell.cpp +++ b/layout/base/nsPresShell.cpp @@ -1068,6 +1068,11 @@ public: NS_IMETHOD IsSafeToFlush(PRBool& aIsSafeToFlush); NS_IMETHOD FlushPendingNotifications(PRBool aUpdateViews); + /** + * Recreates the frames for a node + */ + NS_IMETHOD RecreateFramesFor(nsIContent* aContent); + /** * Post a request to handle a DOM event after Reflow has finished. */ @@ -3873,6 +3878,27 @@ PresShell::CancelAllReflowCommands() return NS_OK; } +NS_IMETHODIMP +PresShell::RecreateFramesFor(nsIContent* aContent) +{ + NS_ENSURE_TRUE(mPresContext, NS_ERROR_FAILURE); + + nsCOMPtr styleSet; + nsresult rv = GetStyleSet(getter_AddRefs(styleSet)); + NS_ENSURE_SUCCESS(rv, rv); + + nsCOMPtr frameConstruction; + rv = styleSet->GetStyleFrameConstruction(getter_AddRefs(frameConstruction)); + NS_ENSURE_SUCCESS(rv, rv); + + // Don't call RecreateFramesForContent since that is not exported and we want + // to keep the number of entrypoints down. + + nsStyleChangeList changeList; + changeList.AppendChange(nsnull, aContent, nsChangeHint_ReconstructFrame); + return frameConstruction->ProcessRestyledFrames(changeList, mPresContext); +} + NS_IMETHODIMP PresShell::ClearFrameRefs(nsIFrame* aFrame) { diff --git a/layout/base/public/nsIPresShell.h b/layout/base/public/nsIPresShell.h index 843d1e58690d..38a42a041be1 100644 --- a/layout/base/public/nsIPresShell.h +++ b/layout/base/public/nsIPresShell.h @@ -288,6 +288,10 @@ public: NS_IMETHOD CancelReflowCommand(nsIFrame* aTargetFrame, nsReflowType* aCmdType) = 0; NS_IMETHOD CancelAllReflowCommands() = 0; + /** + * Recreates the frames for a node + */ + NS_IMETHOD RecreateFramesFor(nsIContent* aContent) = 0; /** * Determine if it is safe to flush all pending notifications diff --git a/layout/html/base/src/nsPresShell.cpp b/layout/html/base/src/nsPresShell.cpp index bb00138c1429..e358aebd7a3d 100644 --- a/layout/html/base/src/nsPresShell.cpp +++ b/layout/html/base/src/nsPresShell.cpp @@ -1068,6 +1068,11 @@ public: NS_IMETHOD IsSafeToFlush(PRBool& aIsSafeToFlush); NS_IMETHOD FlushPendingNotifications(PRBool aUpdateViews); + /** + * Recreates the frames for a node + */ + NS_IMETHOD RecreateFramesFor(nsIContent* aContent); + /** * Post a request to handle a DOM event after Reflow has finished. */ @@ -3873,6 +3878,27 @@ PresShell::CancelAllReflowCommands() return NS_OK; } +NS_IMETHODIMP +PresShell::RecreateFramesFor(nsIContent* aContent) +{ + NS_ENSURE_TRUE(mPresContext, NS_ERROR_FAILURE); + + nsCOMPtr styleSet; + nsresult rv = GetStyleSet(getter_AddRefs(styleSet)); + NS_ENSURE_SUCCESS(rv, rv); + + nsCOMPtr frameConstruction; + rv = styleSet->GetStyleFrameConstruction(getter_AddRefs(frameConstruction)); + NS_ENSURE_SUCCESS(rv, rv); + + // Don't call RecreateFramesForContent since that is not exported and we want + // to keep the number of entrypoints down. + + nsStyleChangeList changeList; + changeList.AppendChange(nsnull, aContent, nsChangeHint_ReconstructFrame); + return frameConstruction->ProcessRestyledFrames(changeList, mPresContext); +} + NS_IMETHODIMP PresShell::ClearFrameRefs(nsIFrame* aFrame) {