Bug 1175492 - unpref transform-origin percentage handling for SVG elements r=jwatt

This commit is contained in:
Robert Longson 2015-09-15 22:10:48 +01:00
Родитель 0a7461bd0a
Коммит 0c7534f0a8
9 изменённых файлов: 35 добавлений и 34 удалений

Просмотреть файл

@ -552,7 +552,7 @@ nsDisplayListBuilder::AddAnimationsAndTransitionsToLayer(Layer* aLayer,
// XXX Performance here isn't ideal for SVG. We'd prefer to avoid resolving
// the dimensions of refBox. That said, we only get here if there are CSS
// animations or transitions on this element, and that is likely to be a
// lot rarer that transforms on SVG (the frequency of which drives the need
// lot rarer than transforms on SVG (the frequency of which drives the need
// for TransformReferenceBox).
TransformReferenceBox refBox(aFrame);
nsRect bounds(0, 0, refBox.Width(), refBox.Height());
@ -4726,7 +4726,7 @@ nsDisplayTransform::nsDisplayTransform(nsDisplayListBuilder* aBuilder,
Init(aBuilder);
}
/* Returns the delta specified by the -moz-transform-origin property.
/* Returns the delta specified by the -transform-origin property.
* This is a positive delta, meaning that it indicates the direction to move
* to get from (0, 0) of the frame to the transform origin. This function is
* called off the main thread.
@ -4744,7 +4744,7 @@ nsDisplayTransform::GetDeltaToTransformOrigin(const nsIFrame* aFrame,
return Point3D();
}
/* For both of the coordinates, if the value of -moz-transform is a
/* For both of the coordinates, if the value of -transform is a
* percentage, it's relative to the size of the frame. Otherwise, if it's
* a distance, it's already computed for us!
*/
@ -4768,7 +4768,7 @@ nsDisplayTransform::GetDeltaToTransformOrigin(const nsIFrame* aFrame,
{ &TransformReferenceBox::X, &TransformReferenceBox::Y };
for (uint8_t index = 0; index < 2; ++index) {
/* If the -moz-transform-origin specifies a percentage, take the percentage
/* If the -transform-origin specifies a percentage, take the percentage
* of the size of the box.
*/
const nsStyleCoord &coord = display->mTransformOrigin[index];
@ -4841,7 +4841,7 @@ nsDisplayTransform::GetDeltaToPerspectiveOrigin(const nsIFrame* aFrame,
{ &TransformReferenceBox::Width, &TransformReferenceBox::Height };
for (uint8_t index = 0; index < 2; ++index) {
/* If the -moz-transform-origin specifies a percentage, take the percentage
/* If the -transform-origin specifies a percentage, take the percentage
* of the size of the box.
*/
const nsStyleCoord &coord = display->mPerspectiveOrigin[index];
@ -4893,7 +4893,7 @@ nsDisplayTransform::FrameTransformProperties::FrameTransformProperties(const nsI
}
}
/* Wraps up the -moz-transform matrix in a change-of-basis matrix pair that
/* Wraps up the -transform matrix in a change-of-basis matrix pair that
* translates from local coordinate space to transform coordinate space, then
* hands it back.
*/
@ -4988,7 +4988,7 @@ nsDisplayTransform::GetResultingTransformMatrixInternal(const FrameTransformProp
result = result * perspective;
}
/* Account for the -moz-transform-origin property by translating the
/* Account for the -transform-origin property by translating the
* coordinate space to the new origin.
*/
Point3D newOrigin =

Просмотреть файл

@ -143,7 +143,7 @@ typedef nsStyleTransformMatrix::TransformReferenceBox TransformReferenceBox;
/* static */ bool nsLayoutUtils::sInvalidationDebuggingIsEnabled;
/* static */ bool nsLayoutUtils::sCSSVariablesEnabled;
/* static */ bool nsLayoutUtils::sInterruptibleReflowEnabled;
/* static */ bool nsLayoutUtils::sSVGTransformOriginEnabled;
/* static */ bool nsLayoutUtils::sSVGTransformBoxEnabled;
static ViewID sScrollIdCounter = FrameMetrics::START_SCROLL_ID;
@ -7256,8 +7256,8 @@ nsLayoutUtils::Initialize()
"layout.css.variables.enabled");
Preferences::AddBoolVarCache(&sInterruptibleReflowEnabled,
"layout.interruptible-reflow.enabled");
Preferences::AddBoolVarCache(&sSVGTransformOriginEnabled,
"svg.transform-origin.enabled");
Preferences::AddBoolVarCache(&sSVGTransformBoxEnabled,
"svg.transform-box.enabled");
Preferences::RegisterCallback(GridEnabledPrefChangeCallback,
GRID_ENABLED_PREF_NAME);

Просмотреть файл

@ -2386,8 +2386,8 @@ public:
return sFontSizeInflationDisabledInMasterProcess;
}
static bool SVGTransformOriginEnabled() {
return sSVGTransformOriginEnabled;
static bool SVGTransformBoxEnabled() {
return sSVGTransformBoxEnabled;
}
/**
@ -2782,7 +2782,7 @@ private:
static bool sInvalidationDebuggingIsEnabled;
static bool sCSSVariablesEnabled;
static bool sInterruptibleReflowEnabled;
static bool sSVGTransformOriginEnabled;
static bool sSVGTransformBoxEnabled;
/**
* Helper function for LogTestDataForPaint().

Просмотреть файл

@ -45,12 +45,12 @@ random == rotate-1f.html rotate-1-ref.html
# to look the same.
== rotate-2a.html rotate-2-ref.html
== rotate-2b.html rotate-2-ref.html
# -moz-transform-origin: We should NOT get the same images when using different
# -moz-transform-origins.
# -transform-origin: We should NOT get the same images when using different
# -transform-origins.
!= origin-1a.html origin-1-ref.html
!= origin-1b.html origin-1-ref.html
# -moz-transform-origin: We should get the same images when using equivalent
# -moz-transform-origins.
# -transform-origin: We should get the same images when using equivalent
# -transform-origins.
== origin-2a.html origin-2-ref.html
== origin-2b.html origin-2-ref.html
== origin-2c.html origin-2-ref.html
@ -124,14 +124,14 @@ skip-if(B2G||Mulet) == stresstest-1.html stresstest-1-ref.html # bug 773482 # In
== table-2b.html table-2-ref.html
# Bug 722463
== inline-1a.html inline-1-ref.html
pref(svg.transform-origin.enabled,true) == transform-box-svg-1a.svg transform-box-svg-1-ref.svg
pref(svg.transform-origin.enabled,true) == transform-box-svg-1b.svg transform-box-svg-1-ref.svg
pref(svg.transform-origin.enabled,true) == transform-box-svg-2a.svg transform-box-svg-2-ref.svg
pref(svg.transform-origin.enabled,true) == transform-box-svg-2b.svg transform-box-svg-2-ref.svg
pref(svg.transform-origin.enabled,true) == transform-origin-svg-1a.svg transform-origin-svg-1-ref.svg
pref(svg.transform-origin.enabled,true) == transform-origin-svg-1b.svg transform-origin-svg-1-ref.svg
pref(svg.transform-origin.enabled,true) == transform-origin-svg-2a.svg transform-origin-svg-2-ref.svg
pref(svg.transform-origin.enabled,true) == transform-origin-svg-2b.svg transform-origin-svg-2-ref.svg
pref(svg.transform-box.enabled,true) == transform-box-svg-1a.svg transform-box-svg-1-ref.svg
pref(svg.transform-box.enabled,true) == transform-box-svg-1b.svg transform-box-svg-1-ref.svg
pref(svg.transform-box.enabled,true) == transform-box-svg-2a.svg transform-box-svg-2-ref.svg
pref(svg.transform-box.enabled,true) == transform-box-svg-2b.svg transform-box-svg-2-ref.svg
== transform-origin-svg-1a.svg transform-origin-svg-1-ref.svg
== transform-origin-svg-1b.svg transform-origin-svg-1-ref.svg
== transform-origin-svg-2a.svg transform-origin-svg-2-ref.svg
== transform-origin-svg-2b.svg transform-origin-svg-2-ref.svg
# Bug 1122526
== animate-layer-scale-inherit-1.html animate-layer-scale-inherit-1-ref.html
== animate-layer-scale-inherit-2.html animate-layer-scale-inherit-2-ref.html

Просмотреть файл

@ -3336,7 +3336,7 @@ CSS_PROP_DISPLAY(
transform_box,
TransformBox,
CSS_PROPERTY_PARSE_VALUE,
"svg.transform-origin.enabled",
"svg.transform-box.enabled",
VARIANT_HK,
kTransformBoxKTable,
CSS_PROP_NO_OFFSET,

Просмотреть файл

@ -50,11 +50,12 @@ TransformReferenceBox::EnsureDimensionsAreCached()
mIsCached = true;
if (mFrame->GetStateBits() & NS_FRAME_SVG_LAYOUT) {
if (!nsLayoutUtils::SVGTransformOriginEnabled()) {
if (!nsLayoutUtils::SVGTransformBoxEnabled()) {
mX = -mFrame->GetPosition().x;
mY = -mFrame->GetPosition().y;
mWidth = 0;
mHeight = 0;
Size contextSize = nsSVGUtils::GetContextSize(mFrame);
mWidth = nsPresContext::CSSPixelsToAppUnits(contextSize.width);
mHeight = nsPresContext::CSSPixelsToAppUnits(contextSize.height);
} else
if (mFrame->StyleDisplay()->mTransformBox ==
NS_STYLE_TRANSFORM_BOX_FILL_BOX) {
@ -80,7 +81,7 @@ TransformReferenceBox::EnsureDimensionsAreCached()
NS_STYLE_TRANSFORM_BOX_BORDER_BOX,
"Unexpected value for 'transform-box'");
// Percentages in transforms resolve against the width/height of the
// nearest viewport (or it's viewBox if one is applied), and the
// nearest viewport (or its viewBox if one is applied), and the
// transform is relative to {0,0} in current user space.
mX = -mFrame->GetPosition().x;
mY = -mFrame->GetPosition().y;

Просмотреть файл

@ -5337,7 +5337,7 @@ if (SpecialPowers.getBoolPref("svg.paint-order.enabled")) {
};
}
if (SpecialPowers.getBoolPref("svg.transform-origin.enabled")) {
if (SpecialPowers.getBoolPref("svg.transform-box.enabled")) {
gCSSProperties["transform-box"] = {
domProp: "transformBox",
inherited: false,

Просмотреть файл

@ -75,7 +75,7 @@ var gProps = {
"layout.css.isolation.enabled": [ "isolation"],
"layout.css.masking.enabled": ["mask-type"],
"layout.css.touch_action.enabled": ["touch-action"],
"svg.transform-origin.enabled": ["transform-box"]
"svg.transform-box.enabled": ["transform-box"]
};
var gCS = getComputedStyle(document.body, "");

Просмотреть файл

@ -2571,9 +2571,9 @@ pref("svg.marker-improvements.enabled", true);
pref("svg.new-getBBox.enabled", false);
#ifdef RELEASE_BUILD
pref("svg.transform-origin.enabled", false);
pref("svg.transform-box.enabled", false);
#else
pref("svg.transform-origin.enabled", true);
pref("svg.transform-box.enabled", true);
#endif // RELEASE_BUILD
// Default font types and sizes by locale