Bug 1213895: Part 1 - Correctly support crop="none" in XUL labels. r=neil
This commit is contained in:
@@ -228,7 +228,7 @@ nsTextBoxFrame::UpdateAttributes(nsIAtom* aAttribute,
|
||||
if (aAttribute == nullptr || aAttribute == nsGkAtoms::crop) {
|
||||
static nsIContent::AttrValuesArray strings[] =
|
||||
{&nsGkAtoms::left, &nsGkAtoms::start, &nsGkAtoms::center,
|
||||
&nsGkAtoms::right, &nsGkAtoms::end, nullptr};
|
||||
&nsGkAtoms::none, &nsGkAtoms::right, &nsGkAtoms::end, nullptr};
|
||||
CroppingStyle cropType;
|
||||
switch (mContent->FindAttrValueIn(kNameSpaceID_None, nsGkAtoms::crop,
|
||||
strings, eCaseMatters)) {
|
||||
@@ -240,12 +240,13 @@ nsTextBoxFrame::UpdateAttributes(nsIAtom* aAttribute,
|
||||
cropType = CropCenter;
|
||||
break;
|
||||
case 3:
|
||||
case 4:
|
||||
cropType = CropRight;
|
||||
break;
|
||||
default:
|
||||
cropType = CropNone;
|
||||
break;
|
||||
case 4:
|
||||
case 5:
|
||||
default:
|
||||
cropType = CropRight;
|
||||
break;
|
||||
}
|
||||
|
||||
if (cropType != mCropType) {
|
||||
@@ -647,6 +648,7 @@ nsTextBoxFrame::CalculateTitleForWidth(nsRenderingContext& aRenderingContext,
|
||||
}
|
||||
|
||||
const nsDependentString& kEllipsis = nsContentUtils::GetLocalizedEllipsis();
|
||||
if (mCropType != CropNone) {
|
||||
// start with an ellipsis
|
||||
mCroppedTitle.Assign(kEllipsis);
|
||||
|
||||
@@ -666,6 +668,10 @@ nsTextBoxFrame::CalculateTitleForWidth(nsRenderingContext& aRenderingContext,
|
||||
return titleWidth;
|
||||
|
||||
aWidth -= titleWidth;
|
||||
} else {
|
||||
mCroppedTitle.Truncate(0);
|
||||
titleWidth = 0;
|
||||
}
|
||||
|
||||
// XXX: This whole block should probably take surrogates into account
|
||||
// XXX and clusters!
|
||||
|
||||
Reference in New Issue
Block a user