mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-14 02:31:59 +00:00
Removed HaveFixedContent* methods from nsHTMLReflowState and updated code to match (fix bug #7993)
This commit is contained in:
parent
4dc3f15df3
commit
87e4c2d72f
@ -499,14 +499,6 @@ nsHTMLButtonControlFrame::Reflow(nsIPresContext& aPresContext,
|
||||
aDesiredSize.AddBorderPaddingToMaxElementSize(aReflowState.mComputedBorderPadding);
|
||||
}
|
||||
|
||||
// if we are constrained and the child is smaller, use the constrained values
|
||||
//if (aReflowState.HaveFixedContentWidth() && (aDesiredSize.width < aReflowState.computedWidth)) {
|
||||
// aDesiredSize.width = aReflowState.computedWidth;
|
||||
//}
|
||||
//if (aReflowState.HaveFixedContentHeight() && (aDesiredSize.height < aReflowState.computedHeight)) {
|
||||
// aDesiredSize.height = aReflowState.computedHeight;
|
||||
//}
|
||||
|
||||
aDesiredSize.ascent = aDesiredSize.height;
|
||||
aDesiredSize.descent = 0;
|
||||
|
||||
|
@ -1236,6 +1236,37 @@ nsBlockFrame::Reflow(nsIPresContext& aPresContext,
|
||||
return rv;
|
||||
}
|
||||
|
||||
static PRBool
|
||||
HaveAutoWidth(const nsHTMLReflowState& aReflowState)
|
||||
{
|
||||
if (NS_UNCONSTRAINEDSIZE == aReflowState.computedWidth) {
|
||||
return PR_TRUE;
|
||||
}
|
||||
const nsStylePosition* pos = aReflowState.mStylePosition;
|
||||
if (!pos) {
|
||||
return PR_TRUE;
|
||||
}
|
||||
for (;;) {
|
||||
nsStyleUnit widthUnit = pos->mWidth.GetUnit();
|
||||
if (eStyleUnit_Auto == widthUnit) {
|
||||
return PR_TRUE;
|
||||
}
|
||||
if (eStyleUnit_Inherit != widthUnit) {
|
||||
break;
|
||||
}
|
||||
const nsHTMLReflowState* prs = (const nsHTMLReflowState*)
|
||||
aReflowState.parentReflowState;
|
||||
if (!prs) {
|
||||
return PR_TRUE;
|
||||
}
|
||||
pos = prs->mStylePosition;
|
||||
if (!pos) {
|
||||
return PR_TRUE;
|
||||
}
|
||||
}
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
nsBlockFrame::ComputeFinalSize(const nsHTMLReflowState& aReflowState,
|
||||
nsBlockReflowState& aState,
|
||||
@ -1276,7 +1307,7 @@ nsBlockFrame::ComputeFinalSize(const nsHTMLReflowState& aReflowState,
|
||||
// Compute final width
|
||||
nscoord maxWidth = 0, maxHeight = 0;
|
||||
nscoord minWidth = aState.mKidXMost + borderPadding.right;
|
||||
if (!aState.mUnconstrainedWidth && aReflowState.HaveFixedContentWidth()) {
|
||||
if (!HaveAutoWidth(aReflowState)) {
|
||||
// Use style defined width
|
||||
aMetrics.width = borderPadding.left + aReflowState.computedWidth +
|
||||
borderPadding.right;
|
||||
|
@ -1236,6 +1236,37 @@ nsBlockFrame::Reflow(nsIPresContext& aPresContext,
|
||||
return rv;
|
||||
}
|
||||
|
||||
static PRBool
|
||||
HaveAutoWidth(const nsHTMLReflowState& aReflowState)
|
||||
{
|
||||
if (NS_UNCONSTRAINEDSIZE == aReflowState.computedWidth) {
|
||||
return PR_TRUE;
|
||||
}
|
||||
const nsStylePosition* pos = aReflowState.mStylePosition;
|
||||
if (!pos) {
|
||||
return PR_TRUE;
|
||||
}
|
||||
for (;;) {
|
||||
nsStyleUnit widthUnit = pos->mWidth.GetUnit();
|
||||
if (eStyleUnit_Auto == widthUnit) {
|
||||
return PR_TRUE;
|
||||
}
|
||||
if (eStyleUnit_Inherit != widthUnit) {
|
||||
break;
|
||||
}
|
||||
const nsHTMLReflowState* prs = (const nsHTMLReflowState*)
|
||||
aReflowState.parentReflowState;
|
||||
if (!prs) {
|
||||
return PR_TRUE;
|
||||
}
|
||||
pos = prs->mStylePosition;
|
||||
if (!pos) {
|
||||
return PR_TRUE;
|
||||
}
|
||||
}
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
nsBlockFrame::ComputeFinalSize(const nsHTMLReflowState& aReflowState,
|
||||
nsBlockReflowState& aState,
|
||||
@ -1276,7 +1307,7 @@ nsBlockFrame::ComputeFinalSize(const nsHTMLReflowState& aReflowState,
|
||||
// Compute final width
|
||||
nscoord maxWidth = 0, maxHeight = 0;
|
||||
nscoord minWidth = aState.mKidXMost + borderPadding.right;
|
||||
if (!aState.mUnconstrainedWidth && aReflowState.HaveFixedContentWidth()) {
|
||||
if (!HaveAutoWidth(aReflowState)) {
|
||||
// Use style defined width
|
||||
aMetrics.width = borderPadding.left + aReflowState.computedWidth +
|
||||
borderPadding.right;
|
||||
|
@ -1236,6 +1236,37 @@ nsBlockFrame::Reflow(nsIPresContext& aPresContext,
|
||||
return rv;
|
||||
}
|
||||
|
||||
static PRBool
|
||||
HaveAutoWidth(const nsHTMLReflowState& aReflowState)
|
||||
{
|
||||
if (NS_UNCONSTRAINEDSIZE == aReflowState.computedWidth) {
|
||||
return PR_TRUE;
|
||||
}
|
||||
const nsStylePosition* pos = aReflowState.mStylePosition;
|
||||
if (!pos) {
|
||||
return PR_TRUE;
|
||||
}
|
||||
for (;;) {
|
||||
nsStyleUnit widthUnit = pos->mWidth.GetUnit();
|
||||
if (eStyleUnit_Auto == widthUnit) {
|
||||
return PR_TRUE;
|
||||
}
|
||||
if (eStyleUnit_Inherit != widthUnit) {
|
||||
break;
|
||||
}
|
||||
const nsHTMLReflowState* prs = (const nsHTMLReflowState*)
|
||||
aReflowState.parentReflowState;
|
||||
if (!prs) {
|
||||
return PR_TRUE;
|
||||
}
|
||||
pos = prs->mStylePosition;
|
||||
if (!pos) {
|
||||
return PR_TRUE;
|
||||
}
|
||||
}
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
nsBlockFrame::ComputeFinalSize(const nsHTMLReflowState& aReflowState,
|
||||
nsBlockReflowState& aState,
|
||||
@ -1276,7 +1307,7 @@ nsBlockFrame::ComputeFinalSize(const nsHTMLReflowState& aReflowState,
|
||||
// Compute final width
|
||||
nscoord maxWidth = 0, maxHeight = 0;
|
||||
nscoord minWidth = aState.mKidXMost + borderPadding.right;
|
||||
if (!aState.mUnconstrainedWidth && aReflowState.HaveFixedContentWidth()) {
|
||||
if (!HaveAutoWidth(aReflowState)) {
|
||||
// Use style defined width
|
||||
aMetrics.width = borderPadding.left + aReflowState.computedWidth +
|
||||
borderPadding.right;
|
||||
|
@ -145,24 +145,6 @@ nsHTMLReflowState::Init(nsIPresContext& aPresContext)
|
||||
InitConstraints(aPresContext);
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsHTMLReflowState::HaveFixedContentWidth() const
|
||||
{
|
||||
const nsStylePosition* pos;
|
||||
frame->GetStyleData(eStyleStruct_Position, (const nsStyleStruct*&)pos);
|
||||
// What about 'inherit'?
|
||||
return eStyleUnit_Auto != pos->mWidth.GetUnit();
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsHTMLReflowState::HaveFixedContentHeight() const
|
||||
{
|
||||
const nsStylePosition* pos;
|
||||
frame->GetStyleData(eStyleStruct_Position, (const nsStyleStruct*&)pos);
|
||||
// What about 'inherit'?
|
||||
return eStyleUnit_Auto != pos->mHeight.GetUnit();
|
||||
}
|
||||
|
||||
const nsHTMLReflowState*
|
||||
nsHTMLReflowState::GetContainingBlockReflowState(const nsReflowState* aParentRS)
|
||||
{
|
||||
|
@ -973,8 +973,8 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame,
|
||||
parent->DeleteChildsNextInFlow(mPresContext, aFrame);
|
||||
}
|
||||
}
|
||||
if (firstLetterOK && !mFirstLetterStyleOK) {
|
||||
}
|
||||
//XXX if (firstLetterOK && !mFirstLetterStyleOK) {
|
||||
//XXX }
|
||||
|
||||
// See if we can place the frame. If we can't fit it, then we
|
||||
// return now.
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1236,6 +1236,37 @@ nsBlockFrame::Reflow(nsIPresContext& aPresContext,
|
||||
return rv;
|
||||
}
|
||||
|
||||
static PRBool
|
||||
HaveAutoWidth(const nsHTMLReflowState& aReflowState)
|
||||
{
|
||||
if (NS_UNCONSTRAINEDSIZE == aReflowState.computedWidth) {
|
||||
return PR_TRUE;
|
||||
}
|
||||
const nsStylePosition* pos = aReflowState.mStylePosition;
|
||||
if (!pos) {
|
||||
return PR_TRUE;
|
||||
}
|
||||
for (;;) {
|
||||
nsStyleUnit widthUnit = pos->mWidth.GetUnit();
|
||||
if (eStyleUnit_Auto == widthUnit) {
|
||||
return PR_TRUE;
|
||||
}
|
||||
if (eStyleUnit_Inherit != widthUnit) {
|
||||
break;
|
||||
}
|
||||
const nsHTMLReflowState* prs = (const nsHTMLReflowState*)
|
||||
aReflowState.parentReflowState;
|
||||
if (!prs) {
|
||||
return PR_TRUE;
|
||||
}
|
||||
pos = prs->mStylePosition;
|
||||
if (!pos) {
|
||||
return PR_TRUE;
|
||||
}
|
||||
}
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
nsBlockFrame::ComputeFinalSize(const nsHTMLReflowState& aReflowState,
|
||||
nsBlockReflowState& aState,
|
||||
@ -1276,7 +1307,7 @@ nsBlockFrame::ComputeFinalSize(const nsHTMLReflowState& aReflowState,
|
||||
// Compute final width
|
||||
nscoord maxWidth = 0, maxHeight = 0;
|
||||
nscoord minWidth = aState.mKidXMost + borderPadding.right;
|
||||
if (!aState.mUnconstrainedWidth && aReflowState.HaveFixedContentWidth()) {
|
||||
if (!HaveAutoWidth(aReflowState)) {
|
||||
// Use style defined width
|
||||
aMetrics.width = borderPadding.left + aReflowState.computedWidth +
|
||||
borderPadding.right;
|
||||
|
@ -1236,6 +1236,37 @@ nsBlockFrame::Reflow(nsIPresContext& aPresContext,
|
||||
return rv;
|
||||
}
|
||||
|
||||
static PRBool
|
||||
HaveAutoWidth(const nsHTMLReflowState& aReflowState)
|
||||
{
|
||||
if (NS_UNCONSTRAINEDSIZE == aReflowState.computedWidth) {
|
||||
return PR_TRUE;
|
||||
}
|
||||
const nsStylePosition* pos = aReflowState.mStylePosition;
|
||||
if (!pos) {
|
||||
return PR_TRUE;
|
||||
}
|
||||
for (;;) {
|
||||
nsStyleUnit widthUnit = pos->mWidth.GetUnit();
|
||||
if (eStyleUnit_Auto == widthUnit) {
|
||||
return PR_TRUE;
|
||||
}
|
||||
if (eStyleUnit_Inherit != widthUnit) {
|
||||
break;
|
||||
}
|
||||
const nsHTMLReflowState* prs = (const nsHTMLReflowState*)
|
||||
aReflowState.parentReflowState;
|
||||
if (!prs) {
|
||||
return PR_TRUE;
|
||||
}
|
||||
pos = prs->mStylePosition;
|
||||
if (!pos) {
|
||||
return PR_TRUE;
|
||||
}
|
||||
}
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
nsBlockFrame::ComputeFinalSize(const nsHTMLReflowState& aReflowState,
|
||||
nsBlockReflowState& aState,
|
||||
@ -1276,7 +1307,7 @@ nsBlockFrame::ComputeFinalSize(const nsHTMLReflowState& aReflowState,
|
||||
// Compute final width
|
||||
nscoord maxWidth = 0, maxHeight = 0;
|
||||
nscoord minWidth = aState.mKidXMost + borderPadding.right;
|
||||
if (!aState.mUnconstrainedWidth && aReflowState.HaveFixedContentWidth()) {
|
||||
if (!HaveAutoWidth(aReflowState)) {
|
||||
// Use style defined width
|
||||
aMetrics.width = borderPadding.left + aReflowState.computedWidth +
|
||||
borderPadding.right;
|
||||
|
@ -1236,6 +1236,37 @@ nsBlockFrame::Reflow(nsIPresContext& aPresContext,
|
||||
return rv;
|
||||
}
|
||||
|
||||
static PRBool
|
||||
HaveAutoWidth(const nsHTMLReflowState& aReflowState)
|
||||
{
|
||||
if (NS_UNCONSTRAINEDSIZE == aReflowState.computedWidth) {
|
||||
return PR_TRUE;
|
||||
}
|
||||
const nsStylePosition* pos = aReflowState.mStylePosition;
|
||||
if (!pos) {
|
||||
return PR_TRUE;
|
||||
}
|
||||
for (;;) {
|
||||
nsStyleUnit widthUnit = pos->mWidth.GetUnit();
|
||||
if (eStyleUnit_Auto == widthUnit) {
|
||||
return PR_TRUE;
|
||||
}
|
||||
if (eStyleUnit_Inherit != widthUnit) {
|
||||
break;
|
||||
}
|
||||
const nsHTMLReflowState* prs = (const nsHTMLReflowState*)
|
||||
aReflowState.parentReflowState;
|
||||
if (!prs) {
|
||||
return PR_TRUE;
|
||||
}
|
||||
pos = prs->mStylePosition;
|
||||
if (!pos) {
|
||||
return PR_TRUE;
|
||||
}
|
||||
}
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
nsBlockFrame::ComputeFinalSize(const nsHTMLReflowState& aReflowState,
|
||||
nsBlockReflowState& aState,
|
||||
@ -1276,7 +1307,7 @@ nsBlockFrame::ComputeFinalSize(const nsHTMLReflowState& aReflowState,
|
||||
// Compute final width
|
||||
nscoord maxWidth = 0, maxHeight = 0;
|
||||
nscoord minWidth = aState.mKidXMost + borderPadding.right;
|
||||
if (!aState.mUnconstrainedWidth && aReflowState.HaveFixedContentWidth()) {
|
||||
if (!HaveAutoWidth(aReflowState)) {
|
||||
// Use style defined width
|
||||
aMetrics.width = borderPadding.left + aReflowState.computedWidth +
|
||||
borderPadding.right;
|
||||
|
@ -244,13 +244,11 @@ nsHTMLImageLoader::GetDesiredSize(nsIPresContext* aPresContext,
|
||||
heightConstraint = aReflowState->computedHeight;
|
||||
|
||||
// Determine whether the image has fixed content width and height
|
||||
fixedContentWidth = aReflowState->HaveFixedContentWidth();
|
||||
fixedContentHeight = aReflowState->HaveFixedContentHeight();
|
||||
if (NS_INTRINSICSIZE == widthConstraint) {
|
||||
fixedContentWidth = PR_FALSE;
|
||||
if (NS_UNCONSTRAINEDSIZE != widthConstraint) {
|
||||
fixedContentWidth = PR_TRUE;
|
||||
}
|
||||
if (NS_INTRINSICSIZE == heightConstraint) {
|
||||
fixedContentHeight = PR_FALSE;
|
||||
if (NS_UNCONSTRAINEDSIZE != heightConstraint) {
|
||||
fixedContentHeight = PR_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -145,24 +145,6 @@ nsHTMLReflowState::Init(nsIPresContext& aPresContext)
|
||||
InitConstraints(aPresContext);
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsHTMLReflowState::HaveFixedContentWidth() const
|
||||
{
|
||||
const nsStylePosition* pos;
|
||||
frame->GetStyleData(eStyleStruct_Position, (const nsStyleStruct*&)pos);
|
||||
// What about 'inherit'?
|
||||
return eStyleUnit_Auto != pos->mWidth.GetUnit();
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsHTMLReflowState::HaveFixedContentHeight() const
|
||||
{
|
||||
const nsStylePosition* pos;
|
||||
frame->GetStyleData(eStyleStruct_Position, (const nsStyleStruct*&)pos);
|
||||
// What about 'inherit'?
|
||||
return eStyleUnit_Auto != pos->mHeight.GetUnit();
|
||||
}
|
||||
|
||||
const nsHTMLReflowState*
|
||||
nsHTMLReflowState::GetContainingBlockReflowState(const nsReflowState* aParentRS)
|
||||
{
|
||||
|
@ -233,13 +233,6 @@ struct nsHTMLReflowState : nsReflowState {
|
||||
nsIFrame* aFrame,
|
||||
const nsSize& aAvailableSpace);
|
||||
|
||||
/**
|
||||
* Returns PR_TRUE if the specified width or height has an value other
|
||||
* than 'auto'
|
||||
*/
|
||||
PRBool HaveFixedContentWidth() const;
|
||||
PRBool HaveFixedContentHeight() const;
|
||||
|
||||
/**
|
||||
* Get the containing block reflow state, starting from a frames
|
||||
* <B>parent</B> reflow state (the parent reflow state may or may not end
|
||||
|
@ -973,8 +973,8 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame,
|
||||
parent->DeleteChildsNextInFlow(mPresContext, aFrame);
|
||||
}
|
||||
}
|
||||
if (firstLetterOK && !mFirstLetterStyleOK) {
|
||||
}
|
||||
//XXX if (firstLetterOK && !mFirstLetterStyleOK) {
|
||||
//XXX }
|
||||
|
||||
// See if we can place the frame. If we can't fit it, then we
|
||||
// return now.
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -499,14 +499,6 @@ nsHTMLButtonControlFrame::Reflow(nsIPresContext& aPresContext,
|
||||
aDesiredSize.AddBorderPaddingToMaxElementSize(aReflowState.mComputedBorderPadding);
|
||||
}
|
||||
|
||||
// if we are constrained and the child is smaller, use the constrained values
|
||||
//if (aReflowState.HaveFixedContentWidth() && (aDesiredSize.width < aReflowState.computedWidth)) {
|
||||
// aDesiredSize.width = aReflowState.computedWidth;
|
||||
//}
|
||||
//if (aReflowState.HaveFixedContentHeight() && (aDesiredSize.height < aReflowState.computedHeight)) {
|
||||
// aDesiredSize.height = aReflowState.computedHeight;
|
||||
//}
|
||||
|
||||
aDesiredSize.ascent = aDesiredSize.height;
|
||||
aDesiredSize.descent = 0;
|
||||
|
||||
|
@ -467,14 +467,6 @@ nsLabelFrame::Reflow(nsIPresContext& aPresContext,
|
||||
aDesiredSize.AddBorderPaddingToMaxElementSize(borderPadding);
|
||||
}
|
||||
|
||||
// if we are constrained and the child is smaller, use the constrained values
|
||||
//if (aReflowState.HaveFixedContentWidth() && (aDesiredSize.width < aReflowState.computedWidth)) {
|
||||
// aDesiredSize.width = aReflowState.computedWidth;
|
||||
//}
|
||||
//if (aReflowState.HaveFixedContentHeight() && (aDesiredSize.height < aReflowState.computedHeight)) {
|
||||
// aDesiredSize.height = aReflowState.computedHeight;
|
||||
//}
|
||||
|
||||
aDesiredSize.ascent = aDesiredSize.height;
|
||||
aDesiredSize.descent = 0;
|
||||
|
||||
|
@ -86,13 +86,13 @@ nsColorPickerFrame :: GetDesiredSize(nsIPresContext* aPresContext,
|
||||
const int ATTR_NOTSET = -1;
|
||||
|
||||
nsSize styleSize;
|
||||
if (aReflowState.HaveFixedContentWidth()) {
|
||||
if (NS_UNCONSTRAINEDSIZE != aReflowState.computedWidth) {
|
||||
styleSize.width = aReflowState.computedWidth;
|
||||
}
|
||||
else {
|
||||
styleSize.width = CSS_NOTSET;
|
||||
}
|
||||
if (aReflowState.HaveFixedContentHeight()) {
|
||||
if (NS_UNCONSTRAINEDSIZE != aReflowState.computedHeight) {
|
||||
styleSize.height = aReflowState.computedHeight;
|
||||
}
|
||||
else {
|
||||
|
@ -86,13 +86,13 @@ nsFontPickerFrame :: GetDesiredSize(nsIPresContext* aPresContext,
|
||||
const int ATTR_NOTSET = -1;
|
||||
|
||||
nsSize styleSize;
|
||||
if (aReflowState.HaveFixedContentWidth()) {
|
||||
if (NS_UNCONSTRAINEDSIZE != aReflowState.computedWidth) {
|
||||
styleSize.width = aReflowState.computedWidth;
|
||||
}
|
||||
else {
|
||||
styleSize.width = CSS_NOTSET;
|
||||
}
|
||||
if (aReflowState.HaveFixedContentHeight()) {
|
||||
if (NS_UNCONSTRAINEDSIZE != aReflowState.computedHeight) {
|
||||
styleSize.height = aReflowState.computedHeight;
|
||||
}
|
||||
else {
|
||||
|
@ -86,13 +86,13 @@ nsSpinnerFrame :: GetDesiredSize(nsIPresContext* aPresContext,
|
||||
const int ATTR_NOTSET = -1;
|
||||
|
||||
nsSize styleSize;
|
||||
if (aReflowState.HaveFixedContentWidth()) {
|
||||
if (NS_UNCONSTRAINEDSIZE != aReflowState.computedWidth) {
|
||||
styleSize.width = aReflowState.computedWidth;
|
||||
}
|
||||
else {
|
||||
styleSize.width = CSS_NOTSET;
|
||||
}
|
||||
if (aReflowState.HaveFixedContentHeight()) {
|
||||
if (NS_UNCONSTRAINEDSIZE != aReflowState.computedHeight) {
|
||||
styleSize.height = aReflowState.computedHeight;
|
||||
}
|
||||
else {
|
||||
|
@ -401,13 +401,13 @@ nsTriStateCheckboxFrame :: GetDesiredSize(nsIPresContext* aPresContext,
|
||||
nsHTMLReflowMetrics& aDesiredLayoutSize)
|
||||
{
|
||||
nsSize styleSize;
|
||||
if (aReflowState.HaveFixedContentWidth()) {
|
||||
if (NS_UNCONSTRAINEDSIZE != aReflowState.computedWidth) {
|
||||
styleSize.width = aReflowState.computedWidth;
|
||||
}
|
||||
else {
|
||||
styleSize.width = CSS_NOTSET;
|
||||
}
|
||||
if (aReflowState.HaveFixedContentHeight()) {
|
||||
if (NS_UNCONSTRAINEDSIZE != aReflowState.computedHeight) {
|
||||
styleSize.height = aReflowState.computedHeight;
|
||||
}
|
||||
else {
|
||||
|
Loading…
Reference in New Issue
Block a user