icecat: add release icecat-140.10.1-1gnu1 for ecne
This commit is contained in:
parent
a5f93cb214
commit
ff85d7c623
1256 changed files with 63469 additions and 24141 deletions
|
|
@ -880,6 +880,8 @@ NS_IMPL_CYCLE_COLLECTING_RELEASE(CanvasRenderingContext2D)
|
|||
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_CLASS(CanvasRenderingContext2D)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(CanvasRenderingContext2D)
|
||||
tmp->RemoveShutdownObserver();
|
||||
tmp->OnShutdown();
|
||||
// Make sure we remove ourselves from the list of demotable contexts (raw
|
||||
// pointers), since we're logically destructed at this point.
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mCanvasElement)
|
||||
|
|
@ -2888,8 +2890,12 @@ void CanvasRenderingContext2D::GetLetterSpacing(nsACString& aLetterSpacing) {
|
|||
|
||||
void CanvasRenderingContext2D::SetLetterSpacing(
|
||||
const nsACString& aLetterSpacing) {
|
||||
ParseSpacing(aLetterSpacing, &CurrentState().letterSpacing,
|
||||
CurrentState().letterSpacingStr);
|
||||
nsAutoCString normalized;
|
||||
Maybe<float> value = ParseSpacing(aLetterSpacing, normalized);
|
||||
if (value) {
|
||||
CurrentState().letterSpacing = *value;
|
||||
CurrentState().letterSpacingStr = normalized;
|
||||
}
|
||||
}
|
||||
|
||||
void CanvasRenderingContext2D::GetWordSpacing(nsACString& aWordSpacing) {
|
||||
|
|
@ -2901,8 +2907,12 @@ void CanvasRenderingContext2D::GetWordSpacing(nsACString& aWordSpacing) {
|
|||
}
|
||||
|
||||
void CanvasRenderingContext2D::SetWordSpacing(const nsACString& aWordSpacing) {
|
||||
ParseSpacing(aWordSpacing, &CurrentState().wordSpacing,
|
||||
CurrentState().wordSpacingStr);
|
||||
nsAutoCString normalized;
|
||||
Maybe<float> value = ParseSpacing(aWordSpacing, normalized);
|
||||
if (value) {
|
||||
CurrentState().wordSpacing = *value;
|
||||
CurrentState().wordSpacingStr = normalized;
|
||||
}
|
||||
}
|
||||
|
||||
static GeckoFontMetrics GetFontMetricsFromCanvas(void* aContext) {
|
||||
|
|
@ -2933,9 +2943,8 @@ static GeckoFontMetrics GetFontMetricsFromCanvas(void* aContext) {
|
|||
0.0f};
|
||||
}
|
||||
|
||||
void CanvasRenderingContext2D::ParseSpacing(const nsACString& aSpacing,
|
||||
float* aValue,
|
||||
nsACString& aNormalized) {
|
||||
Maybe<float> CanvasRenderingContext2D::ParseSpacing(const nsACString& aSpacing,
|
||||
nsACString& aNormalized) {
|
||||
// Normalize whitespace in the string before trying to parse it, as we want
|
||||
// to store it in normalized form, and this allows a simple check against the
|
||||
// 'normal' keyword, which is not accepted.
|
||||
|
|
@ -2943,28 +2952,28 @@ void CanvasRenderingContext2D::ParseSpacing(const nsACString& aSpacing,
|
|||
normalized.CompressWhitespace(true, true);
|
||||
ToLowerCase(normalized);
|
||||
if (normalized.EqualsLiteral("normal")) {
|
||||
return;
|
||||
return Nothing();
|
||||
}
|
||||
float value;
|
||||
if (!Servo_ParseLengthWithoutStyleContext(&normalized, &value,
|
||||
GetFontMetricsFromCanvas, this)) {
|
||||
if (!GetPresShell()) {
|
||||
return;
|
||||
return Nothing();
|
||||
}
|
||||
// This will parse aSpacing as a <length-percentage>...
|
||||
RefPtr<const ComputedStyle> style =
|
||||
ResolveStyleForProperty(eCSSProperty_letter_spacing, aSpacing);
|
||||
if (!style) {
|
||||
return;
|
||||
return Nothing();
|
||||
}
|
||||
// ...but only <length> is allowed according to the canvas spec.
|
||||
if (!style->StyleText()->mLetterSpacing.IsLength()) {
|
||||
return;
|
||||
return Nothing();
|
||||
}
|
||||
value = style->StyleText()->mLetterSpacing.AsLength().ToCSSPixels();
|
||||
}
|
||||
aNormalized = normalized;
|
||||
*aValue = value;
|
||||
return Some(value);
|
||||
}
|
||||
|
||||
class CanvasUserSpaceMetrics final : public UserSpaceMetricsWithSize {
|
||||
|
|
@ -3434,6 +3443,11 @@ void CanvasRenderingContext2D::StrokeImpl(const gfx::Path& aPath) {
|
|||
return;
|
||||
}
|
||||
|
||||
const bool needBounds = NeedToCalculateBounds();
|
||||
if (!IsTargetValid()) {
|
||||
return;
|
||||
}
|
||||
|
||||
const ContextState* state = &CurrentState();
|
||||
StrokeOptions strokeOptions(state->lineWidth, CanvasToGfx(state->lineJoin),
|
||||
CanvasToGfx(state->lineCap), state->miterLimit,
|
||||
|
|
@ -3441,10 +3455,6 @@ void CanvasRenderingContext2D::StrokeImpl(const gfx::Path& aPath) {
|
|||
state->dashOffset);
|
||||
state = nullptr;
|
||||
|
||||
const bool needBounds = NeedToCalculateBounds();
|
||||
if (!IsTargetValid()) {
|
||||
return;
|
||||
}
|
||||
gfx::Rect bounds;
|
||||
if (needBounds) {
|
||||
bounds = aPath.GetStrokedBounds(strokeOptions, mTarget->GetTransform());
|
||||
|
|
@ -4695,6 +4705,7 @@ struct MOZ_STACK_CLASS CanvasBidiProcessor final
|
|||
}
|
||||
|
||||
mCtx->EnsureTarget();
|
||||
const bool needBounds = mCtx->NeedToCalculateBounds();
|
||||
if (!mCtx->IsTargetValid()) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -4709,7 +4720,7 @@ struct MOZ_STACK_CLASS CanvasBidiProcessor final
|
|||
const ContextState& state = mCtx->CurrentState();
|
||||
|
||||
gfx::Rect bounds;
|
||||
if (mCtx->NeedToCalculateBounds()) {
|
||||
if (needBounds) {
|
||||
bounds = ToRect(mBoundingBox);
|
||||
bounds.MoveBy(mPt / mAppUnitsPerDevPixel);
|
||||
if (style == Style::STROKE) {
|
||||
|
|
@ -4857,6 +4868,9 @@ UniquePtr<TextMetrics> CanvasRenderingContext2D::DrawOrMeasureText(
|
|||
canvasStyle = nsComputedDOMStyle::GetComputedStyle(mCanvasElement);
|
||||
}
|
||||
|
||||
// This is only needed to know if we can know the drawing bounding box easily.
|
||||
const bool doCalculateBounds = NeedToCalculateBounds();
|
||||
|
||||
// Get text direction, either from the property or inherited from context.
|
||||
const ContextState& state = CurrentState();
|
||||
bool isRTL;
|
||||
|
|
@ -4882,8 +4896,6 @@ UniquePtr<TextMetrics> CanvasRenderingContext2D::DrawOrMeasureText(
|
|||
MOZ_CRASH("unknown direction!");
|
||||
}
|
||||
|
||||
// This is only needed to know if we can know the drawing bounding box easily.
|
||||
const bool doCalculateBounds = NeedToCalculateBounds();
|
||||
if (presShell && presShell->IsDestroying()) {
|
||||
aError = NS_ERROR_FAILURE;
|
||||
return nullptr;
|
||||
|
|
@ -5163,50 +5175,54 @@ gfxFontGroup* CanvasRenderingContext2D::GetCurrentFontStyle() {
|
|||
nsPresContext* presContext =
|
||||
presShell ? presShell->GetPresContext() : nullptr;
|
||||
|
||||
// If we have a cached fontGroup, check that it is valid for the current
|
||||
// prescontext; if not, we need to discard and re-create it.
|
||||
RefPtr<gfxFontGroup>& fontGroup = CurrentState().fontGroup;
|
||||
if (fontGroup) {
|
||||
if (fontGroup->GetPresContext() != presContext) {
|
||||
fontGroup = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
if (!fontGroup) {
|
||||
ErrorResult err;
|
||||
constexpr auto kDefaultFontStyle = "10px sans-serif"_ns;
|
||||
const float kDefaultFontSize = 10.0;
|
||||
// If the font has already been set, we're re-creating the fontGroup
|
||||
// and should re-use the existing font attribute; if not, we initialize
|
||||
// it to the canvas default.
|
||||
const nsCString& currentFont = CurrentState().font;
|
||||
bool fontUpdated = SetFontInternal(
|
||||
currentFont.IsEmpty() ? kDefaultFontStyle : currentFont, err);
|
||||
if (err.Failed() || !fontUpdated) {
|
||||
err.SuppressException();
|
||||
// XXX Should we get a default lang from the prescontext or something?
|
||||
nsAtom* language = nsGkAtoms::x_western;
|
||||
bool explicitLanguage = false;
|
||||
gfxFontStyle style;
|
||||
style.size = kDefaultFontSize;
|
||||
int32_t perDevPixel, perCSSPixel;
|
||||
GetAppUnitsValues(&perDevPixel, &perCSSPixel);
|
||||
gfxFloat devToCssSize = gfxFloat(perDevPixel) / gfxFloat(perCSSPixel);
|
||||
const auto* sans =
|
||||
Servo_FontFamily_Generic(StyleGenericFontFamily::SansSerif);
|
||||
fontGroup = new gfxFontGroup(
|
||||
presContext, sans->families, &style, language, explicitLanguage,
|
||||
presContext ? presContext->GetTextPerfMetrics() : nullptr, nullptr,
|
||||
devToCssSize, StyleFontVariantEmoji::Normal);
|
||||
if (fontGroup) {
|
||||
CurrentState().font = kDefaultFontStyle;
|
||||
{
|
||||
// If we have a cached fontGroup, check that it is valid for the current
|
||||
// prescontext; if not, we need to discard and re-create it.
|
||||
RefPtr<gfxFontGroup>& fontGroup = CurrentState().fontGroup;
|
||||
if (fontGroup) {
|
||||
if (fontGroup->GetPresContext() != presContext) {
|
||||
fontGroup = nullptr;
|
||||
} else {
|
||||
NS_ERROR("Default canvas font is invalid");
|
||||
return fontGroup;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return fontGroup;
|
||||
ErrorResult err;
|
||||
constexpr auto kDefaultFontStyle = "10px sans-serif"_ns;
|
||||
const float kDefaultFontSize = 10.0;
|
||||
// If the font has already been set, we're re-creating the fontGroup
|
||||
// and should re-use the existing font attribute; if not, we initialize
|
||||
// it to the canvas default.
|
||||
nsAutoCString currentFont(CurrentState().font);
|
||||
if (currentFont.IsEmpty()) {
|
||||
currentFont = kDefaultFontStyle;
|
||||
}
|
||||
bool fontUpdated = SetFontInternal(currentFont, err);
|
||||
if (err.Failed() || !fontUpdated) {
|
||||
err.SuppressException();
|
||||
// XXX Should we get a default lang from the prescontext or something?
|
||||
nsAtom* language = nsGkAtoms::x_western;
|
||||
bool explicitLanguage = false;
|
||||
gfxFontStyle style;
|
||||
style.size = kDefaultFontSize;
|
||||
int32_t perDevPixel, perCSSPixel;
|
||||
GetAppUnitsValues(&perDevPixel, &perCSSPixel);
|
||||
gfxFloat devToCssSize = gfxFloat(perDevPixel) / gfxFloat(perCSSPixel);
|
||||
const auto* sans =
|
||||
Servo_FontFamily_Generic(StyleGenericFontFamily::SansSerif);
|
||||
CurrentState().fontGroup = new gfxFontGroup(
|
||||
presContext, sans->families, &style, language, explicitLanguage,
|
||||
presContext ? presContext->GetTextPerfMetrics() : nullptr, nullptr,
|
||||
devToCssSize, StyleFontVariantEmoji::Normal);
|
||||
if (CurrentState().fontGroup) {
|
||||
CurrentState().font = kDefaultFontStyle;
|
||||
} else {
|
||||
NS_ERROR("Default canvas font is invalid");
|
||||
}
|
||||
}
|
||||
|
||||
return CurrentState().fontGroup;
|
||||
}
|
||||
|
||||
//
|
||||
|
|
@ -5711,7 +5727,7 @@ void CanvasRenderingContext2D::DrawImage(const CanvasImageSource& aImage,
|
|||
HTMLVideoElement* video = HTMLVideoElement::FromNodeOrNull(element);
|
||||
if (video && mBufferProvider->IsAccelerated() &&
|
||||
mTarget->IsRecording() &&
|
||||
!(!NeedToApplyFilter() && NeedToDrawShadow())) {
|
||||
!(NeedToApplyFilter() || NeedToDrawShadow())) {
|
||||
res = nsLayoutUtils::SurfaceFromElement(
|
||||
video, sfeFlags, mTarget, /* aOptimizeSourceSurface */ false);
|
||||
surfaceDescriptor = MaybeGetSurfaceDescriptorForRemoteCanvas(res);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue