diff --git a/layout/generic/nsBlockReflowContext.cpp b/layout/generic/nsBlockReflowContext.cpp index 71bcc024fe71..01c9c92be880 100644 --- a/layout/generic/nsBlockReflowContext.cpp +++ b/layout/generic/nsBlockReflowContext.cpp @@ -24,6 +24,7 @@ #include "nsIPresContext.h" #include "nsIContent.h" #include "nsIStyleContext.h" +#include "nsIReflowCommand.h" #include "nsHTMLContainerFrame.h" #include "nsBlockFrame.h" #include "nsIDOMHTMLParagraphElement.h" @@ -141,6 +142,29 @@ nsBlockReflowContext::ReflowBlock(nsIFrame* aFrame, // Make sure we only incrementally reflow once mNextRCFrame = nsnull; } + else if (mOuterReflowState.reason == eReflowReason_StyleChange) { + reason = eReflowReason_StyleChange; + } + else { + if (mOuterReflowState.reason == eReflowReason_Incremental) { + // If the incremental reflow command is a StyleChanged reflow + // and it's target is the current block, then make sure we send + // StyleChange reflow reasons down to all the children so that + // they don't over-optimize their reflow. + nsIReflowCommand* rc = mOuterReflowState.reflowCommand; + if (rc) { + nsIReflowCommand::ReflowType type; + rc->GetType(type); + if (type == nsIReflowCommand::StyleChanged) { + nsIFrame* target; + rc->GetTarget(target); + if (target == mOuterReflowState.frame) { + reason = eReflowReason_StyleChange; + } + } + } + } + } // Setup reflow state for reflowing the frame // XXX subtract out vertical margin? diff --git a/layout/generic/nsLineLayout.cpp b/layout/generic/nsLineLayout.cpp index 7ad7f912c27e..2673e85d7710 100644 --- a/layout/generic/nsLineLayout.cpp +++ b/layout/generic/nsLineLayout.cpp @@ -28,7 +28,7 @@ #include "nsIRenderingContext.h" #include "nsLayoutAtoms.h" #include "nsPlaceholderFrame.h" - +#include "nsIReflowCommand.h" #include "nsIDocument.h" #include "nsIHTMLDocument.h" #include "nsIContent.h" @@ -833,6 +833,33 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame, // Make sure we only incrementally reflow once *aNextRCFrame = nsnull; } + else if (psd->mReflowState->reason == eReflowReason_StyleChange) { + reason = eReflowReason_StyleChange; + } + else { + const nsReflowState* rs = psd->mReflowState; + if (rs->reason == eReflowReason_Incremental) { + // If the incremental reflow command is a StyleChanged reflow and + // it's target is the current span, then make sure we send + // StyleChange reflow reasons down to the children so that they + // don't over-optimize their reflow. + nsIReflowCommand* rc = rs->reflowCommand; + if (rc) { + nsIReflowCommand::ReflowType type; + rc->GetType(type); + if (type == nsIReflowCommand::StyleChanged) { + nsIFrame* parentFrame = psd->mFrame + ? psd->mFrame->mFrame + : mBlockReflowState->frame; + nsIFrame* target; + rc->GetTarget(target); + if (target == parentFrame) { + reason = eReflowReason_StyleChange; + } + } + } + } + } // Setup reflow state for reflowing the frame nsHTMLReflowState reflowState(mPresContext, *psd->mReflowState, aFrame, diff --git a/layout/html/base/src/nsBlockReflowContext.cpp b/layout/html/base/src/nsBlockReflowContext.cpp index 71bcc024fe71..01c9c92be880 100644 --- a/layout/html/base/src/nsBlockReflowContext.cpp +++ b/layout/html/base/src/nsBlockReflowContext.cpp @@ -24,6 +24,7 @@ #include "nsIPresContext.h" #include "nsIContent.h" #include "nsIStyleContext.h" +#include "nsIReflowCommand.h" #include "nsHTMLContainerFrame.h" #include "nsBlockFrame.h" #include "nsIDOMHTMLParagraphElement.h" @@ -141,6 +142,29 @@ nsBlockReflowContext::ReflowBlock(nsIFrame* aFrame, // Make sure we only incrementally reflow once mNextRCFrame = nsnull; } + else if (mOuterReflowState.reason == eReflowReason_StyleChange) { + reason = eReflowReason_StyleChange; + } + else { + if (mOuterReflowState.reason == eReflowReason_Incremental) { + // If the incremental reflow command is a StyleChanged reflow + // and it's target is the current block, then make sure we send + // StyleChange reflow reasons down to all the children so that + // they don't over-optimize their reflow. + nsIReflowCommand* rc = mOuterReflowState.reflowCommand; + if (rc) { + nsIReflowCommand::ReflowType type; + rc->GetType(type); + if (type == nsIReflowCommand::StyleChanged) { + nsIFrame* target; + rc->GetTarget(target); + if (target == mOuterReflowState.frame) { + reason = eReflowReason_StyleChange; + } + } + } + } + } // Setup reflow state for reflowing the frame // XXX subtract out vertical margin? diff --git a/layout/html/base/src/nsLineLayout.cpp b/layout/html/base/src/nsLineLayout.cpp index 7ad7f912c27e..2673e85d7710 100644 --- a/layout/html/base/src/nsLineLayout.cpp +++ b/layout/html/base/src/nsLineLayout.cpp @@ -28,7 +28,7 @@ #include "nsIRenderingContext.h" #include "nsLayoutAtoms.h" #include "nsPlaceholderFrame.h" - +#include "nsIReflowCommand.h" #include "nsIDocument.h" #include "nsIHTMLDocument.h" #include "nsIContent.h" @@ -833,6 +833,33 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame, // Make sure we only incrementally reflow once *aNextRCFrame = nsnull; } + else if (psd->mReflowState->reason == eReflowReason_StyleChange) { + reason = eReflowReason_StyleChange; + } + else { + const nsReflowState* rs = psd->mReflowState; + if (rs->reason == eReflowReason_Incremental) { + // If the incremental reflow command is a StyleChanged reflow and + // it's target is the current span, then make sure we send + // StyleChange reflow reasons down to the children so that they + // don't over-optimize their reflow. + nsIReflowCommand* rc = rs->reflowCommand; + if (rc) { + nsIReflowCommand::ReflowType type; + rc->GetType(type); + if (type == nsIReflowCommand::StyleChanged) { + nsIFrame* parentFrame = psd->mFrame + ? psd->mFrame->mFrame + : mBlockReflowState->frame; + nsIFrame* target; + rc->GetTarget(target); + if (target == parentFrame) { + reason = eReflowReason_StyleChange; + } + } + } + } + } // Setup reflow state for reflowing the frame nsHTMLReflowState reflowState(mPresContext, *psd->mReflowState, aFrame,