Merge remote-tracking branch 'origin/tracking' into custom

This commit is contained in:
roytam1 2023-02-08 16:57:53 +08:00
commit 553e7438ac
4 changed files with 22 additions and 3 deletions

View file

@ -39,6 +39,7 @@ GK_ATOM(_moz_resizing, "_moz_resizing")
GK_ATOM(mozallowfullscreen, "mozallowfullscreen") GK_ATOM(mozallowfullscreen, "mozallowfullscreen")
GK_ATOM(moztype, "_moz-type") GK_ATOM(moztype, "_moz-type")
GK_ATOM(mozdirty, "_moz_dirty") GK_ATOM(mozdirty, "_moz_dirty")
GK_ATOM(_is_cropped, "_is_cropped")
GK_ATOM(mozdisallowselectionprint, "mozdisallowselectionprint") GK_ATOM(mozdisallowselectionprint, "mozdisallowselectionprint")
GK_ATOM(mozdonotsend, "moz-do-not-send") GK_ATOM(mozdonotsend, "moz-do-not-send")
GK_ATOM(mozeditorbogusnode, "_moz_editor_bogus_node") GK_ATOM(mozeditorbogusnode, "_moz_editor_bogus_node")

View file

@ -26,6 +26,8 @@ static VPXDecoder::Codec MimeTypeToCodec(const nsACString& aMimeType)
{ {
if (aMimeType.EqualsLiteral("video/webm; codecs=vp8")) { if (aMimeType.EqualsLiteral("video/webm; codecs=vp8")) {
return VPXDecoder::Codec::VP8; return VPXDecoder::Codec::VP8;
} else if (aMimeType.EqualsLiteral("video/vp8")) {
return VPXDecoder::Codec::VP8;
} else if (aMimeType.EqualsLiteral("video/webm; codecs=vp9")) { } else if (aMimeType.EqualsLiteral("video/webm; codecs=vp9")) {
return VPXDecoder::Codec::VP9; return VPXDecoder::Codec::VP9;
} else if (aMimeType.EqualsLiteral("video/vp9")) { } else if (aMimeType.EqualsLiteral("video/vp9")) {
@ -222,6 +224,8 @@ VPXDecoder::IsVPX(const nsACString& aMimeType, uint8_t aCodecMask)
{ {
return ((aCodecMask & VPXDecoder::VP8) && return ((aCodecMask & VPXDecoder::VP8) &&
aMimeType.EqualsLiteral("video/webm; codecs=vp8")) || aMimeType.EqualsLiteral("video/webm; codecs=vp8")) ||
((aCodecMask & VPXDecoder::VP8) &&
aMimeType.EqualsLiteral("video/vp8")) ||
((aCodecMask & VPXDecoder::VP9) && ((aCodecMask & VPXDecoder::VP9) &&
aMimeType.EqualsLiteral("video/webm; codecs=vp9")) || aMimeType.EqualsLiteral("video/webm; codecs=vp9")) ||
((aCodecMask & VPXDecoder::VP9) && ((aCodecMask & VPXDecoder::VP9) &&

View file

@ -230,7 +230,8 @@ nsTextBoxFrame::UpdateAttributes(nsIAtom* aAttribute,
if (aAttribute == nullptr || aAttribute == nsGkAtoms::crop) { if (aAttribute == nullptr || aAttribute == nsGkAtoms::crop) {
static nsIContent::AttrValuesArray strings[] = static nsIContent::AttrValuesArray strings[] =
{&nsGkAtoms::left, &nsGkAtoms::start, &nsGkAtoms::center, {&nsGkAtoms::left, &nsGkAtoms::start, &nsGkAtoms::center,
&nsGkAtoms::right, &nsGkAtoms::end, &nsGkAtoms::none, nullptr}; &nsGkAtoms::right, &nsGkAtoms::end, &nsGkAtoms::none,
&nsGkAtoms::clip, nullptr};
CroppingStyle cropType; CroppingStyle cropType;
switch (mContent->FindAttrValueIn(kNameSpaceID_None, nsGkAtoms::crop, switch (mContent->FindAttrValueIn(kNameSpaceID_None, nsGkAtoms::crop,
strings, eCaseMatters)) { strings, eCaseMatters)) {
@ -248,6 +249,9 @@ nsTextBoxFrame::UpdateAttributes(nsIAtom* aAttribute,
case 5: case 5:
cropType = CropNone; cropType = CropNone;
break; break;
case 6:
cropType = CropClip;
break;
default: default:
cropType = CropAuto; cropType = CropAuto;
break; break;
@ -625,6 +629,10 @@ nsTextBoxFrame::CalculateTitleForWidth(nsRenderingContext& aRenderingContext,
{ {
DrawTarget* drawTarget = aRenderingContext.GetDrawTarget(); DrawTarget* drawTarget = aRenderingContext.GetDrawTarget();
if (mContent->HasAttr(kNameSpaceID_None, nsGkAtoms::_is_cropped)) {
mContent->UnsetAttr(kNameSpaceID_None, nsGkAtoms::_is_cropped, true);
}
if (mTitle.IsEmpty()) { if (mTitle.IsEmpty()) {
mCroppedTitle.Truncate(); mCroppedTitle.Truncate();
return 0; return 0;
@ -647,7 +655,9 @@ nsTextBoxFrame::CalculateTitleForWidth(nsRenderingContext& aRenderingContext,
} }
const nsDependentString& kEllipsis = nsContentUtils::GetLocalizedEllipsis(); const nsDependentString& kEllipsis = nsContentUtils::GetLocalizedEllipsis();
if (mCropType != CropNone) { if (mCropType == CropClip) {
mCroppedTitle.Truncate();
} else if (mCropType != CropNone) {
// start with an ellipsis // start with an ellipsis
mCroppedTitle.Assign(kEllipsis); mCroppedTitle.Assign(kEllipsis);
@ -681,6 +691,7 @@ nsTextBoxFrame::CalculateTitleForWidth(nsRenderingContext& aRenderingContext,
case CropAuto: case CropAuto:
case CropNone: case CropNone:
case CropRight: case CropRight:
case CropClip:
{ {
ClusterIterator iter(mTitle.Data(), mTitle.Length()); ClusterIterator iter(mTitle.Data(), mTitle.Length());
const char16_t* dataBegin = iter; const char16_t* dataBegin = iter;
@ -824,6 +835,9 @@ nsTextBoxFrame::CalculateTitleForWidth(nsRenderingContext& aRenderingContext,
break; break;
} }
mContent->SetAttr(kNameSpaceID_None, nsGkAtoms::_is_cropped,
NS_LITERAL_STRING("true"), true);
return nsLayoutUtils::AppUnitWidthOfStringBidi(mCroppedTitle, this, *fm, return nsLayoutUtils::AppUnitWidthOfStringBidi(mCroppedTitle, this, *fm,
aRenderingContext); aRenderingContext);
} }

View file

@ -25,7 +25,7 @@ public:
NS_IMETHOD DoXULLayout(nsBoxLayoutState& aBoxLayoutState) override; NS_IMETHOD DoXULLayout(nsBoxLayoutState& aBoxLayoutState) override;
virtual void MarkIntrinsicISizesDirty() 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); friend nsIFrame* NS_NewTextBoxFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);