mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-29 11:57:32 +09:00
Merge remote-tracking branch 'origin/tracking' into custom
This commit is contained in:
commit
a30e0e7448
6 changed files with 172 additions and 11 deletions
|
|
@ -2094,7 +2094,10 @@ CanvasRenderingContext2D::GetInputStream(const char* aMimeType,
|
|||
|
||||
bool PoisonData = Preferences::GetBool("canvas.poisondata",false);
|
||||
if (PoisonData) {
|
||||
srand(time(NULL));
|
||||
int PoisonInterval = Preferences::GetInt("canvas.poisondata.interval", 300);
|
||||
PoisonInterval = (PoisonInterval < 1) ? 1 : (PoisonInterval > 28800) ? 28800 : PoisonInterval;
|
||||
unsigned int epoch = time(nullptr);
|
||||
srand(epoch / PoisonInterval);
|
||||
// Image buffer is always a packed BGRA array (BGRX -> BGR[FF])
|
||||
// so always 4-byte pixels.
|
||||
// GetImageBuffer => SurfaceToPackedBGRA [=> ConvertBGRXToBGRA]
|
||||
|
|
@ -5787,9 +5790,13 @@ CanvasRenderingContext2D::GetImageDataArray(JSContext* aCx,
|
|||
|
||||
MOZ_ASSERT(aWidth && aHeight);
|
||||
|
||||
bool PoisonData = Preferences::GetBool("canvas.poisondata",false);
|
||||
if (PoisonData)
|
||||
srand(time(NULL));
|
||||
bool PoisonData = Preferences::GetBool("canvas.poisondata", false);
|
||||
if (PoisonData) {
|
||||
int PoisonInterval = Preferences::GetInt("canvas.poisondata.interval", 300);
|
||||
PoisonInterval = (PoisonInterval < 1) ? 1 : (PoisonInterval > 28800) ? 28800 : PoisonInterval;
|
||||
unsigned int epoch = time(nullptr);
|
||||
srand(epoch / PoisonInterval);
|
||||
}
|
||||
|
||||
CheckedInt<uint32_t> len = CheckedInt<uint32_t>(aWidth) * aHeight * 4;
|
||||
if (!len.isValid() || len.value() > INT32_MAX) {
|
||||
|
|
|
|||
|
|
@ -7758,6 +7758,26 @@ const UnitInfo UnitData[] = {
|
|||
{ STR_WITH_LEN("vh"), eCSSUnit_ViewportHeight, VARIANT_LENGTH },
|
||||
{ STR_WITH_LEN("vmin"), eCSSUnit_ViewportMin, VARIANT_LENGTH },
|
||||
{ STR_WITH_LEN("vmax"), eCSSUnit_ViewportMax, VARIANT_LENGTH },
|
||||
{ STR_WITH_LEN("svw"), eCSSUnit_SmallViewportWidth, VARIANT_LENGTH },
|
||||
{ STR_WITH_LEN("svh"), eCSSUnit_SmallViewportHeight, VARIANT_LENGTH },
|
||||
{ STR_WITH_LEN("svmin"), eCSSUnit_SmallViewportMin, VARIANT_LENGTH },
|
||||
{ STR_WITH_LEN("svmax"), eCSSUnit_SmallViewportMax, VARIANT_LENGTH },
|
||||
{ STR_WITH_LEN("lvw"), eCSSUnit_LargeViewportWidth, VARIANT_LENGTH },
|
||||
{ STR_WITH_LEN("lvh"), eCSSUnit_LargeViewportHeight, VARIANT_LENGTH },
|
||||
{ STR_WITH_LEN("lvmin"), eCSSUnit_LargeViewportMin, VARIANT_LENGTH },
|
||||
{ STR_WITH_LEN("lvmax"), eCSSUnit_LargeViewportMax, VARIANT_LENGTH },
|
||||
{ STR_WITH_LEN("dvw"), eCSSUnit_DynamicViewportWidth, VARIANT_LENGTH },
|
||||
{ STR_WITH_LEN("dvh"), eCSSUnit_DynamicViewportHeight, VARIANT_LENGTH },
|
||||
{ STR_WITH_LEN("dvmin"), eCSSUnit_DynamicViewportMin, VARIANT_LENGTH },
|
||||
{ STR_WITH_LEN("dvmax"), eCSSUnit_DynamicViewportMax, VARIANT_LENGTH },
|
||||
{ STR_WITH_LEN("vb"), eCSSUnit_ViewportBlock, VARIANT_LENGTH },
|
||||
{ STR_WITH_LEN("vi"), eCSSUnit_ViewportInline, VARIANT_LENGTH },
|
||||
{ STR_WITH_LEN("svb"), eCSSUnit_SmallViewportBlock, VARIANT_LENGTH },
|
||||
{ STR_WITH_LEN("svi"), eCSSUnit_SmallViewportInline, VARIANT_LENGTH },
|
||||
{ STR_WITH_LEN("lvb"), eCSSUnit_LargeViewportBlock, VARIANT_LENGTH },
|
||||
{ STR_WITH_LEN("lvi"), eCSSUnit_LargeViewportInline, VARIANT_LENGTH },
|
||||
{ STR_WITH_LEN("dvb"), eCSSUnit_DynamicViewportBlock, VARIANT_LENGTH },
|
||||
{ STR_WITH_LEN("dvi"), eCSSUnit_DynamicViewportInline, VARIANT_LENGTH },
|
||||
{ STR_WITH_LEN("pc"), eCSSUnit_Pica, VARIANT_LENGTH },
|
||||
{ STR_WITH_LEN("q"), eCSSUnit_Quarter, VARIANT_LENGTH },
|
||||
{ STR_WITH_LEN("deg"), eCSSUnit_Degree, VARIANT_ANGLE },
|
||||
|
|
@ -7797,10 +7817,30 @@ CSSParserImpl::TranslateDimension(nsCSSValue& aValue,
|
|||
}
|
||||
|
||||
if (!mViewportUnitsEnabled &&
|
||||
(eCSSUnit_ViewportWidth == units ||
|
||||
(eCSSUnit_ViewportWidth == units ||
|
||||
eCSSUnit_ViewportHeight == units ||
|
||||
eCSSUnit_ViewportMin == units ||
|
||||
eCSSUnit_ViewportMax == units)) {
|
||||
eCSSUnit_ViewportMin == units ||
|
||||
eCSSUnit_ViewportMax == units ||
|
||||
eCSSUnit_SmallViewportWidth == units ||
|
||||
eCSSUnit_SmallViewportHeight == units ||
|
||||
eCSSUnit_SmallViewportMin == units ||
|
||||
eCSSUnit_SmallViewportMax == units ||
|
||||
eCSSUnit_LargeViewportWidth == units ||
|
||||
eCSSUnit_LargeViewportHeight == units ||
|
||||
eCSSUnit_LargeViewportMin == units ||
|
||||
eCSSUnit_LargeViewportMax == units ||
|
||||
eCSSUnit_DynamicViewportWidth == units ||
|
||||
eCSSUnit_DynamicViewportHeight == units ||
|
||||
eCSSUnit_DynamicViewportMin == units ||
|
||||
eCSSUnit_DynamicViewportMax == units ||
|
||||
eCSSUnit_ViewportBlock == units ||
|
||||
eCSSUnit_ViewportInline == units ||
|
||||
eCSSUnit_SmallViewportInline == units ||
|
||||
eCSSUnit_SmallViewportBlock == units ||
|
||||
eCSSUnit_LargeViewportBlock == units ||
|
||||
eCSSUnit_LargeViewportInline == units ||
|
||||
eCSSUnit_DynamicViewportBlock == units ||
|
||||
eCSSUnit_DynamicViewportInline == units )) {
|
||||
// Viewport units aren't allowed right now, probably because we're
|
||||
// inside an @page declaration. Fail.
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -2002,6 +2002,28 @@ nsCSSValue::AppendToString(nsCSSPropertyID aProperty, nsAString& aResult,
|
|||
case eCSSUnit_ViewportMin: aResult.AppendLiteral("vmin"); break;
|
||||
case eCSSUnit_ViewportMax: aResult.AppendLiteral("vmax"); break;
|
||||
|
||||
case eCSSUnit_SmallViewportWidth: aResult.AppendLiteral("svw"); break;
|
||||
case eCSSUnit_SmallViewportHeight: aResult.AppendLiteral("svh"); break;
|
||||
case eCSSUnit_SmallViewportMin: aResult.AppendLiteral("svmin"); break;
|
||||
case eCSSUnit_SmallViewportMax: aResult.AppendLiteral("svmax"); break;
|
||||
case eCSSUnit_LargeViewportWidth: aResult.AppendLiteral("lvw"); break;
|
||||
case eCSSUnit_LargeViewportHeight: aResult.AppendLiteral("lvh"); break;
|
||||
case eCSSUnit_LargeViewportMin: aResult.AppendLiteral("lvmin"); break;
|
||||
case eCSSUnit_LargeViewportMax: aResult.AppendLiteral("lvmax"); break;
|
||||
case eCSSUnit_DynamicViewportWidth: aResult.AppendLiteral("dvw"); break;
|
||||
case eCSSUnit_DynamicViewportHeight: aResult.AppendLiteral("dvh"); break;
|
||||
case eCSSUnit_DynamicViewportMin: aResult.AppendLiteral("dvmin"); break;
|
||||
case eCSSUnit_DynamicViewportMax: aResult.AppendLiteral("dvmax"); break;
|
||||
|
||||
case eCSSUnit_ViewportBlock: aResult.AppendLiteral("vb"); break;
|
||||
case eCSSUnit_ViewportInline: aResult.AppendLiteral("vi"); break;
|
||||
case eCSSUnit_SmallViewportBlock: aResult.AppendLiteral("svb"); break;
|
||||
case eCSSUnit_SmallViewportInline: aResult.AppendLiteral("svi"); break;
|
||||
case eCSSUnit_LargeViewportBlock: aResult.AppendLiteral("lvb"); break;
|
||||
case eCSSUnit_LargeViewportInline: aResult.AppendLiteral("lvi"); break;
|
||||
case eCSSUnit_DynamicViewportBlock: aResult.AppendLiteral("dvb"); break;
|
||||
case eCSSUnit_DynamicViewportInline: aResult.AppendLiteral("dvi"); break;
|
||||
|
||||
case eCSSUnit_EM: aResult.AppendLiteral("em"); break;
|
||||
case eCSSUnit_XHeight: aResult.AppendLiteral("ex"); break;
|
||||
case eCSSUnit_Char: aResult.AppendLiteral("ch"); break;
|
||||
|
|
@ -2175,6 +2197,26 @@ nsCSSValue::SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const
|
|||
case eCSSUnit_ViewportHeight:
|
||||
case eCSSUnit_ViewportMin:
|
||||
case eCSSUnit_ViewportMax:
|
||||
case eCSSUnit_SmallViewportWidth:
|
||||
case eCSSUnit_SmallViewportHeight:
|
||||
case eCSSUnit_SmallViewportMin:
|
||||
case eCSSUnit_SmallViewportMax:
|
||||
case eCSSUnit_LargeViewportWidth:
|
||||
case eCSSUnit_LargeViewportHeight:
|
||||
case eCSSUnit_LargeViewportMin:
|
||||
case eCSSUnit_LargeViewportMax:
|
||||
case eCSSUnit_DynamicViewportWidth:
|
||||
case eCSSUnit_DynamicViewportHeight:
|
||||
case eCSSUnit_DynamicViewportMin:
|
||||
case eCSSUnit_DynamicViewportMax:
|
||||
case eCSSUnit_ViewportBlock:
|
||||
case eCSSUnit_ViewportInline:
|
||||
case eCSSUnit_SmallViewportBlock:
|
||||
case eCSSUnit_SmallViewportInline:
|
||||
case eCSSUnit_LargeViewportBlock:
|
||||
case eCSSUnit_LargeViewportInline:
|
||||
case eCSSUnit_DynamicViewportBlock:
|
||||
case eCSSUnit_DynamicViewportInline:
|
||||
case eCSSUnit_EM:
|
||||
case eCSSUnit_XHeight:
|
||||
case eCSSUnit_Char:
|
||||
|
|
|
|||
|
|
@ -534,6 +534,29 @@ enum nsCSSUnit {
|
|||
eCSSUnit_ViewportMin = 702, // (float) smaller of ViewportWidth and ViewportHeight
|
||||
eCSSUnit_ViewportMax = 703, // (float) larger of ViewportWidth and ViewportHeight
|
||||
|
||||
eCSSUnit_SmallViewportWidth = 704, // (float) 1% of the width of the small viewport
|
||||
eCSSUnit_SmallViewportHeight = 705, // (float) 1% of the height of the small viewport
|
||||
eCSSUnit_SmallViewportMin = 706, // (float) smaller of SmallViewportWidth and SmallViewportHeight
|
||||
eCSSUnit_SmallViewportMax = 707, // (float) larger of SmallViewportWidth and SmallViewportHeight
|
||||
eCSSUnit_LargeViewportWidth = 708, // (float) 1% of the width of the large viewport
|
||||
eCSSUnit_LargeViewportHeight = 709, // (float) 1% of the height of the large viewport
|
||||
eCSSUnit_LargeViewportMin = 710, // (float) smaller of LargeViewportWidth and LargeViewportHeight
|
||||
eCSSUnit_LargeViewportMax = 711, // (float) larger of LargeViewportWidth and LargeViewportHeight
|
||||
eCSSUnit_DynamicViewportWidth = 712, // (float) 1% of the width of the dynamic viewport
|
||||
eCSSUnit_DynamicViewportHeight = 713, // (float) 1% of the height of the dynamic viewport
|
||||
eCSSUnit_DynamicViewportMin = 714, // (float) smaller of DynamicViewportWidth and DynamicViewportHeight
|
||||
eCSSUnit_DynamicViewportMax = 715, // (float) larger of DynamicViewportWidth and DynamicViewportHeight
|
||||
|
||||
// Logical viewport units
|
||||
eCSSUnit_ViewportBlock = 716, // (float) 1% of the size of the initial containing block in the box's block axis
|
||||
eCSSUnit_ViewportInline = 717, // (float) 1% of the size of the initial containing block in the box's inline axis
|
||||
eCSSUnit_SmallViewportBlock = 718, // (float) 1% of the size of the small viewport in the box's block axis
|
||||
eCSSUnit_SmallViewportInline = 719, // (float) 1% of the size of the small viewport in the box's inline axis
|
||||
eCSSUnit_LargeViewportBlock = 720, // (float) 1% of the size of the large viewport in the box's block axis
|
||||
eCSSUnit_LargeViewportInline = 721, // (float) 1% of the size of the small viewport in the box's inline axis
|
||||
eCSSUnit_DynamicViewportBlock = 722, // (float) 1% of the size of the dynamic viewport in the box's block axis
|
||||
eCSSUnit_DynamicViewportInline = 723, // (float) 1% of the size of the small viewport in the box's inline axis
|
||||
|
||||
// Font relative measure
|
||||
eCSSUnit_EM = 800, // (float) == current font size
|
||||
eCSSUnit_XHeight = 801, // (float) distance from top of lower case x to baseline
|
||||
|
|
|
|||
|
|
@ -511,24 +511,70 @@ static nscoord CalcLengthWith(const nsCSSValue& aValue,
|
|||
// and allows us not to need an additional code path, in exchange
|
||||
// for an increased cost to dynamic changes to the viewport size
|
||||
// when viewport units are in use.
|
||||
case eCSSUnit_ViewportWidth: {
|
||||
case eCSSUnit_ViewportWidth:
|
||||
case eCSSUnit_SmallViewportWidth:
|
||||
case eCSSUnit_LargeViewportWidth:
|
||||
case eCSSUnit_DynamicViewportWidth: {
|
||||
nscoord viewportWidth = CalcViewportUnitsScale(aPresContext).width;
|
||||
return ScaleViewportCoordTrunc(aValue, viewportWidth);
|
||||
}
|
||||
case eCSSUnit_ViewportHeight: {
|
||||
case eCSSUnit_ViewportHeight:
|
||||
case eCSSUnit_SmallViewportHeight:
|
||||
case eCSSUnit_LargeViewportHeight:
|
||||
case eCSSUnit_DynamicViewportHeight: {
|
||||
nscoord viewportHeight = CalcViewportUnitsScale(aPresContext).height;
|
||||
return ScaleViewportCoordTrunc(aValue, viewportHeight);
|
||||
}
|
||||
case eCSSUnit_ViewportMin: {
|
||||
case eCSSUnit_ViewportMin:
|
||||
case eCSSUnit_SmallViewportMin:
|
||||
case eCSSUnit_LargeViewportMin:
|
||||
case eCSSUnit_DynamicViewportMin: {
|
||||
nsSize vuScale(CalcViewportUnitsScale(aPresContext));
|
||||
nscoord viewportMin = min(vuScale.width, vuScale.height);
|
||||
return ScaleViewportCoordTrunc(aValue, viewportMin);
|
||||
}
|
||||
case eCSSUnit_ViewportMax: {
|
||||
case eCSSUnit_ViewportMax:
|
||||
case eCSSUnit_SmallViewportMax:
|
||||
case eCSSUnit_LargeViewportMax:
|
||||
case eCSSUnit_DynamicViewportMax: {
|
||||
nsSize vuScale(CalcViewportUnitsScale(aPresContext));
|
||||
nscoord viewportMax = max(vuScale.width, vuScale.height);
|
||||
return ScaleViewportCoordTrunc(aValue, viewportMax);
|
||||
}
|
||||
case eCSSUnit_ViewportBlock:
|
||||
case eCSSUnit_SmallViewportBlock:
|
||||
case eCSSUnit_LargeViewportBlock:
|
||||
case eCSSUnit_DynamicViewportBlock: {
|
||||
// Assume non-vertical writing mode if the style context is unavailable.
|
||||
if (aStyleContext) {
|
||||
WritingMode wm(aStyleContext);
|
||||
bool vertical = wm.IsVertical();
|
||||
aConditions.SetWritingModeDependency(wm.GetBits());
|
||||
if (vertical) {
|
||||
nscoord viewportWidth = CalcViewportUnitsScale(aPresContext).width;
|
||||
return ScaleViewportCoordTrunc(aValue, viewportWidth);
|
||||
}
|
||||
}
|
||||
nscoord viewportHeight = CalcViewportUnitsScale(aPresContext).height;
|
||||
return ScaleViewportCoordTrunc(aValue, viewportHeight);
|
||||
}
|
||||
case eCSSUnit_ViewportInline:
|
||||
case eCSSUnit_SmallViewportInline:
|
||||
case eCSSUnit_LargeViewportInline:
|
||||
case eCSSUnit_DynamicViewportInline: {
|
||||
// Assume non-vertical writing mode if the style context is unavailable.
|
||||
if (aStyleContext) {
|
||||
WritingMode wm(aStyleContext);
|
||||
bool vertical = wm.IsVertical();
|
||||
aConditions.SetWritingModeDependency(wm.GetBits());
|
||||
if (vertical) {
|
||||
nscoord viewportHeight = CalcViewportUnitsScale(aPresContext).height;
|
||||
return ScaleViewportCoordTrunc(aValue, viewportHeight);
|
||||
}
|
||||
}
|
||||
nscoord viewportWidth = CalcViewportUnitsScale(aPresContext).width;
|
||||
return ScaleViewportCoordTrunc(aValue, viewportWidth);
|
||||
}
|
||||
// While we could deal with 'rem' units correctly by simply not
|
||||
// caching any data that uses them in the rule tree, it's valuable
|
||||
// to store them in the rule tree (for faster dynamic changes of
|
||||
|
|
|
|||
|
|
@ -4312,6 +4312,9 @@ pref("canvas.image.cache.limit", 0);
|
|||
// Allow track-fobics to deliberately poison canvas data for
|
||||
// toDataURL() and getImageData()
|
||||
pref("canvas.poisondata", false);
|
||||
// Rotate randomness of data poisoning every n seconds. Default 5 minutes.
|
||||
// Valid range [1..28800] (1s-8h).
|
||||
pref("canvas.poisondata.interval", 300);
|
||||
|
||||
// WebGL prefs
|
||||
pref("gl.msaa-level", 2);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue