diff --git a/layout/xul/nsTextBoxFrame.cpp b/layout/xul/nsTextBoxFrame.cpp index e1650e0d00..4c420f9323 100644 --- a/layout/xul/nsTextBoxFrame.cpp +++ b/layout/xul/nsTextBoxFrame.cpp @@ -230,7 +230,8 @@ nsTextBoxFrame::UpdateAttributes(nsIAtom* aAttribute, if (aAttribute == nullptr || aAttribute == nsGkAtoms::crop) { static nsIContent::AttrValuesArray strings[] = {&nsGkAtoms::left, &nsGkAtoms::start, &nsGkAtoms::center, - &nsGkAtoms::right, &nsGkAtoms::end, &nsGkAtoms::none, nullptr}; + &nsGkAtoms::right, &nsGkAtoms::end, &nsGkAtoms::none, + &nsGkAtoms::clip, nullptr}; CroppingStyle cropType; switch (mContent->FindAttrValueIn(kNameSpaceID_None, nsGkAtoms::crop, strings, eCaseMatters)) { @@ -248,6 +249,9 @@ nsTextBoxFrame::UpdateAttributes(nsIAtom* aAttribute, case 5: cropType = CropNone; break; + case 6: + cropType = CropClip; + break; default: cropType = CropAuto; break; @@ -647,7 +651,9 @@ nsTextBoxFrame::CalculateTitleForWidth(nsRenderingContext& aRenderingContext, } const nsDependentString& kEllipsis = nsContentUtils::GetLocalizedEllipsis(); - if (mCropType != CropNone) { + if (mCropType == CropClip) { + mCroppedTitle.Truncate(); + } else if (mCropType != CropNone) { // start with an ellipsis mCroppedTitle.Assign(kEllipsis); @@ -681,6 +687,7 @@ nsTextBoxFrame::CalculateTitleForWidth(nsRenderingContext& aRenderingContext, case CropAuto: case CropNone: case CropRight: + case CropClip: { ClusterIterator iter(mTitle.Data(), mTitle.Length()); const char16_t* dataBegin = iter; diff --git a/layout/xul/nsTextBoxFrame.h b/layout/xul/nsTextBoxFrame.h index e12b97b32d..4ca4013c4b 100644 --- a/layout/xul/nsTextBoxFrame.h +++ b/layout/xul/nsTextBoxFrame.h @@ -25,7 +25,7 @@ public: NS_IMETHOD DoXULLayout(nsBoxLayoutState& aBoxLayoutState) override; virtual void MarkIntrinsicISizesDirty() override; - enum CroppingStyle { CropNone, CropLeft, CropRight, CropCenter, CropAuto }; + enum CroppingStyle { CropNone, CropLeft, CropRight, CropCenter, CropClip, CropAuto }; friend nsIFrame* NS_NewTextBoxFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);