зеркало из https://github.com/mozilla/pjs.git
Remove hacks no longer needed since text inputs became reflow roots (instead of using the IncrementalDamageConstrained hack. b=241833 r+sr=rbs
This commit is contained in:
Родитель
a348600c38
Коммит
44f599fd12
|
@ -1833,17 +1833,6 @@ nsBlockFrame::FindLineFor(nsIFrame* aFrame)
|
|||
return line_end;
|
||||
}
|
||||
|
||||
// SEC: added GetCurrentLine() for bug 45152
|
||||
// we need a way for line layout to know what line is being reflowed,
|
||||
// but we don't want to expose the innards of nsBlockReflowState.
|
||||
nsresult
|
||||
nsBlockFrame::GetCurrentLine(nsBlockReflowState *aState, nsLineBox ** aOutCurrentLine)
|
||||
{
|
||||
if (!aState || !aOutCurrentLine) return NS_ERROR_FAILURE;
|
||||
*aOutCurrentLine = aState->mCurrentLine;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Propagate reflow "damage" from from earlier lines to the current
|
||||
* line. The reflow damage comes from the following sources:
|
||||
|
@ -2454,10 +2443,7 @@ nsBlockFrame::ReflowLine(nsBlockReflowState& aState,
|
|||
|
||||
// We don't really know what changed in the line, so use the union
|
||||
// of the old and new combined areas
|
||||
// SEC: added "aLine->IsForceInvalidate()" for bug 45152
|
||||
if (aDamageDirtyArea || aLine->IsForceInvalidate()) {
|
||||
aLine->SetForceInvalidate(PR_FALSE); // doing the invalidate now, force flag to off
|
||||
|
||||
if (aDamageDirtyArea) {
|
||||
nsRect dirtyRect;
|
||||
dirtyRect.UnionRect(oldCombinedArea, aLine->GetCombinedArea());
|
||||
#ifdef NOISY_BLOCK_INVALIDATE
|
||||
|
|
|
@ -273,15 +273,6 @@ public:
|
|||
return mFlags.mLineWrapped;
|
||||
}
|
||||
|
||||
// mLineWrapped bit
|
||||
void SetForceInvalidate(PRBool aOn) {
|
||||
NS_ASSERTION((PR_FALSE==aOn || PR_TRUE==aOn), "somebody is playing fast and loose with bools and bits!");
|
||||
mFlags.mForceInvalidate = aOn;
|
||||
}
|
||||
PRBool IsForceInvalidate() const {
|
||||
return mFlags.mForceInvalidate;
|
||||
}
|
||||
|
||||
// mResizeReflowOptimizationDisabled bit
|
||||
void DisableResizeReflowOptimization() {
|
||||
mFlags.mResizeReflowOptimizationDisabled = PR_TRUE;
|
||||
|
@ -420,11 +411,10 @@ public:
|
|||
PRUint32 mImpactedByFloat : 1;
|
||||
PRUint32 mHasPercentageChild : 1;
|
||||
PRUint32 mLineWrapped: 1;
|
||||
PRUint32 mForceInvalidate: 1; // default 0 = means this line handles it's own invalidation. 1 = always invalidate this entire line
|
||||
PRUint32 mResizeReflowOptimizationDisabled: 1; // default 0 = means that the opt potentially applies to this line. 1 = never skip reflowing this line for a resize reflow
|
||||
PRUint32 mBreakType : 4;
|
||||
|
||||
PRUint32 mChildCount : 20;
|
||||
PRUint32 mChildCount : 21;
|
||||
};
|
||||
|
||||
struct ExtraData {
|
||||
|
|
|
@ -40,7 +40,6 @@
|
|||
* ***** END LICENSE BLOCK ***** */
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsLineLayout.h"
|
||||
#include "nsBlockFrame.h"
|
||||
#include "nsInlineFrame.h"
|
||||
#include "nsStyleConsts.h"
|
||||
#include "nsHTMLContainerFrame.h"
|
||||
|
@ -997,40 +996,6 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame,
|
|||
return rv;
|
||||
}
|
||||
|
||||
// SEC: added this next block for bug 45152
|
||||
// text frames don't know how to invalidate themselves on initial reflow. Do it for them here.
|
||||
// This only shows up in textareas, so do a quick check to see if we're inside one
|
||||
if (eReflowReason_Initial == reflowState.reason)
|
||||
{
|
||||
if (nsLayoutAtoms::textFrame == frameType)
|
||||
{ // aFrame is a text frame, see if it's inside a text control
|
||||
// although this is a bit slow, the frame tree shouldn't be too deep, it's only called
|
||||
// for the text frame's initial reflow (once in the text frame's lifetime)
|
||||
// and we don't make any expensive calls.
|
||||
// Doing it this way shields us from knowing anything about the frame structure inside a text control.
|
||||
PRBool inTextControl = PR_FALSE;
|
||||
for (nsIFrame *parentFrame = aFrame->GetParent(); parentFrame;
|
||||
parentFrame = parentFrame->GetParent())
|
||||
{
|
||||
if (nsLayoutAtoms::textInputFrame == parentFrame->GetType())
|
||||
{
|
||||
inTextControl = PR_TRUE; // found it
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (inTextControl)
|
||||
{
|
||||
nsLineBox *currentLine=nsnull;
|
||||
// use localResult because a failure here should not be propagated to my caller
|
||||
nsresult localResult = nsBlockFrame::GetCurrentLine(mBlockRS, ¤tLine);
|
||||
if (NS_SUCCEEDED(localResult) && currentLine) {
|
||||
currentLine->SetForceInvalidate(PR_TRUE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// end fix for bug 45152
|
||||
|
||||
pfd->mJustificationNumSpaces = mTextJustificationNumSpaces;
|
||||
pfd->mJustificationNumLetters = mTextJustificationNumLetters;
|
||||
|
||||
|
@ -2860,18 +2825,6 @@ nsLineLayout::HorizontalAlignFrames(nsRect& aLineBounds,
|
|||
|
||||
case NS_STYLE_TEXT_ALIGN_RIGHT:
|
||||
case NS_STYLE_TEXT_ALIGN_MOZ_RIGHT:
|
||||
{
|
||||
// fix for bug 50758
|
||||
// right-aligned text in a text control doesn't know how to paint itself
|
||||
// so we force the invalidate here. Getting the current line is quick,
|
||||
// and at worst we're invalidating more of the line (and just that line) than we need to.
|
||||
nsLineBox *currentLine=nsnull;
|
||||
// use localResult because a failure here should not be propagated to my caller
|
||||
nsresult localResult = nsBlockFrame::GetCurrentLine(mBlockRS, ¤tLine);
|
||||
if (NS_SUCCEEDED(localResult) && currentLine) {
|
||||
currentLine->SetForceInvalidate(PR_TRUE);
|
||||
}
|
||||
}
|
||||
dx = remainingWidth;
|
||||
break;
|
||||
|
||||
|
|
|
@ -1833,17 +1833,6 @@ nsBlockFrame::FindLineFor(nsIFrame* aFrame)
|
|||
return line_end;
|
||||
}
|
||||
|
||||
// SEC: added GetCurrentLine() for bug 45152
|
||||
// we need a way for line layout to know what line is being reflowed,
|
||||
// but we don't want to expose the innards of nsBlockReflowState.
|
||||
nsresult
|
||||
nsBlockFrame::GetCurrentLine(nsBlockReflowState *aState, nsLineBox ** aOutCurrentLine)
|
||||
{
|
||||
if (!aState || !aOutCurrentLine) return NS_ERROR_FAILURE;
|
||||
*aOutCurrentLine = aState->mCurrentLine;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Propagate reflow "damage" from from earlier lines to the current
|
||||
* line. The reflow damage comes from the following sources:
|
||||
|
@ -2454,10 +2443,7 @@ nsBlockFrame::ReflowLine(nsBlockReflowState& aState,
|
|||
|
||||
// We don't really know what changed in the line, so use the union
|
||||
// of the old and new combined areas
|
||||
// SEC: added "aLine->IsForceInvalidate()" for bug 45152
|
||||
if (aDamageDirtyArea || aLine->IsForceInvalidate()) {
|
||||
aLine->SetForceInvalidate(PR_FALSE); // doing the invalidate now, force flag to off
|
||||
|
||||
if (aDamageDirtyArea) {
|
||||
nsRect dirtyRect;
|
||||
dirtyRect.UnionRect(oldCombinedArea, aLine->GetCombinedArea());
|
||||
#ifdef NOISY_BLOCK_INVALIDATE
|
||||
|
|
|
@ -273,15 +273,6 @@ public:
|
|||
return mFlags.mLineWrapped;
|
||||
}
|
||||
|
||||
// mLineWrapped bit
|
||||
void SetForceInvalidate(PRBool aOn) {
|
||||
NS_ASSERTION((PR_FALSE==aOn || PR_TRUE==aOn), "somebody is playing fast and loose with bools and bits!");
|
||||
mFlags.mForceInvalidate = aOn;
|
||||
}
|
||||
PRBool IsForceInvalidate() const {
|
||||
return mFlags.mForceInvalidate;
|
||||
}
|
||||
|
||||
// mResizeReflowOptimizationDisabled bit
|
||||
void DisableResizeReflowOptimization() {
|
||||
mFlags.mResizeReflowOptimizationDisabled = PR_TRUE;
|
||||
|
@ -420,11 +411,10 @@ public:
|
|||
PRUint32 mImpactedByFloat : 1;
|
||||
PRUint32 mHasPercentageChild : 1;
|
||||
PRUint32 mLineWrapped: 1;
|
||||
PRUint32 mForceInvalidate: 1; // default 0 = means this line handles it's own invalidation. 1 = always invalidate this entire line
|
||||
PRUint32 mResizeReflowOptimizationDisabled: 1; // default 0 = means that the opt potentially applies to this line. 1 = never skip reflowing this line for a resize reflow
|
||||
PRUint32 mBreakType : 4;
|
||||
|
||||
PRUint32 mChildCount : 20;
|
||||
PRUint32 mChildCount : 21;
|
||||
};
|
||||
|
||||
struct ExtraData {
|
||||
|
|
|
@ -40,7 +40,6 @@
|
|||
* ***** END LICENSE BLOCK ***** */
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsLineLayout.h"
|
||||
#include "nsBlockFrame.h"
|
||||
#include "nsInlineFrame.h"
|
||||
#include "nsStyleConsts.h"
|
||||
#include "nsHTMLContainerFrame.h"
|
||||
|
@ -997,40 +996,6 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame,
|
|||
return rv;
|
||||
}
|
||||
|
||||
// SEC: added this next block for bug 45152
|
||||
// text frames don't know how to invalidate themselves on initial reflow. Do it for them here.
|
||||
// This only shows up in textareas, so do a quick check to see if we're inside one
|
||||
if (eReflowReason_Initial == reflowState.reason)
|
||||
{
|
||||
if (nsLayoutAtoms::textFrame == frameType)
|
||||
{ // aFrame is a text frame, see if it's inside a text control
|
||||
// although this is a bit slow, the frame tree shouldn't be too deep, it's only called
|
||||
// for the text frame's initial reflow (once in the text frame's lifetime)
|
||||
// and we don't make any expensive calls.
|
||||
// Doing it this way shields us from knowing anything about the frame structure inside a text control.
|
||||
PRBool inTextControl = PR_FALSE;
|
||||
for (nsIFrame *parentFrame = aFrame->GetParent(); parentFrame;
|
||||
parentFrame = parentFrame->GetParent())
|
||||
{
|
||||
if (nsLayoutAtoms::textInputFrame == parentFrame->GetType())
|
||||
{
|
||||
inTextControl = PR_TRUE; // found it
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (inTextControl)
|
||||
{
|
||||
nsLineBox *currentLine=nsnull;
|
||||
// use localResult because a failure here should not be propagated to my caller
|
||||
nsresult localResult = nsBlockFrame::GetCurrentLine(mBlockRS, ¤tLine);
|
||||
if (NS_SUCCEEDED(localResult) && currentLine) {
|
||||
currentLine->SetForceInvalidate(PR_TRUE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// end fix for bug 45152
|
||||
|
||||
pfd->mJustificationNumSpaces = mTextJustificationNumSpaces;
|
||||
pfd->mJustificationNumLetters = mTextJustificationNumLetters;
|
||||
|
||||
|
@ -2860,18 +2825,6 @@ nsLineLayout::HorizontalAlignFrames(nsRect& aLineBounds,
|
|||
|
||||
case NS_STYLE_TEXT_ALIGN_RIGHT:
|
||||
case NS_STYLE_TEXT_ALIGN_MOZ_RIGHT:
|
||||
{
|
||||
// fix for bug 50758
|
||||
// right-aligned text in a text control doesn't know how to paint itself
|
||||
// so we force the invalidate here. Getting the current line is quick,
|
||||
// and at worst we're invalidating more of the line (and just that line) than we need to.
|
||||
nsLineBox *currentLine=nsnull;
|
||||
// use localResult because a failure here should not be propagated to my caller
|
||||
nsresult localResult = nsBlockFrame::GetCurrentLine(mBlockRS, ¤tLine);
|
||||
if (NS_SUCCEEDED(localResult) && currentLine) {
|
||||
currentLine->SetForceInvalidate(PR_TRUE);
|
||||
}
|
||||
}
|
||||
dx = remainingWidth;
|
||||
break;
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче