Backout bug 1291457 and bug 1370034 for bustage.

This commit is contained in:
Cameron McCormack 2017-06-19 13:55:15 +08:00
Родитель 904b949686
Коммит 1849ea4995
31 изменённых файлов: 175 добавлений и 858 удалений

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

@ -1054,54 +1054,7 @@ toolbarpaletteitem[place="palette"] > #downloads-button[indicator] > #downloads-
-moz-image-region: auto;
}
%ifdef MOZ_WIDGET_COCOA
/* On Mac, use the properties "-moz-window-transform" and "-moz-window-opacity"
instead of "transform" and "opacity" for these animations.
The -moz-window* properties apply to the whole window including the window's
shadow, and they don't affect the window's "shape", so the system doesn't
have to recompute the shadow shape during the animation. This makes them a
lot faster. In fact, Gecko no longer triggers shadow shape recomputations
for repaints.
These properties are not implemented on other platforms. */
#BMB_bookmarksPopup {
-moz-window-transform: scale(.4);
-moz-window-opacity: 0;
transition-property: -moz-window-transform, -moz-window-opacity;
transition-duration: 0.15s;
transition-timing-function: ease-out;
}
#BMB_bookmarksPopup[animate="open"] {
-moz-window-transform: none;
-moz-window-opacity: 1.0;
}
#BMB_bookmarksPopup[animate="cancel"] {
-moz-window-transform: none;
}
#BMB_bookmarksPopup[arrowposition="after_start"]:-moz-locale-dir(ltr),
#BMB_bookmarksPopup[arrowposition="after_end"]:-moz-locale-dir(rtl) {
-moz-window-transform-origin: 20px top;
}
#BMB_bookmarksPopup[arrowposition="after_end"]:-moz-locale-dir(ltr),
#BMB_bookmarksPopup[arrowposition="after_start"]:-moz-locale-dir(rtl) {
-moz-window-transform-origin: calc(100% - 20px) top;
}
#BMB_bookmarksPopup[arrowposition="before_start"]:-moz-locale-dir(ltr),
#BMB_bookmarksPopup[arrowposition="before_end"]:-moz-locale-dir(rtl) {
-moz-window-transform-origin: 20px bottom;
}
#BMB_bookmarksPopup[arrowposition="before_end"]:-moz-locale-dir(ltr),
#BMB_bookmarksPopup[arrowposition="before_start"]:-moz-locale-dir(rtl) {
-moz-window-transform-origin: calc(100% - 20px) bottom;
}
%elifndef MOZ_WIDGET_GTK
%ifndef MOZ_WIDGET_GTK
#BMB_bookmarksPopup {
transform: scale(.4);
@ -1139,6 +1092,7 @@ toolbarpaletteitem[place="palette"] > #downloads-button[indicator] > #downloads-
#BMB_bookmarksPopup[arrowposition="before_start"]:-moz-locale-dir(rtl) {
transform-origin: calc(100% - 20px) bottom;
}
%endif
/* Customize mode */

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

@ -1501,52 +1501,6 @@ exports.CSS_PROPERTIES = {
"unset"
]
},
"-moz-window-opacity": {
"isInherited": false,
"subproperties": [
"-moz-window-opacity"
],
"supports": [
7
],
"values": [
"inherit",
"initial",
"unset"
]
},
"-moz-window-transform": {
"isInherited": false,
"subproperties": [
"-moz-window-transform"
],
"supports": [],
"values": [
"inherit",
"initial",
"unset"
]
},
"-moz-window-transform-origin": {
"isInherited": false,
"subproperties": [
"-moz-window-transform-origin"
],
"supports": [
6,
8
],
"values": [
"bottom",
"center",
"inherit",
"initial",
"left",
"right",
"top",
"unset"
]
},
"-webkit-align-content": {
"isInherited": false,
"subproperties": [
@ -3196,9 +3150,6 @@ exports.CSS_PROPERTIES = {
"will-change",
"-moz-window-dragging",
"-moz-window-shadow",
"-moz-window-opacity",
"-moz-window-transform",
"-moz-window-transform-origin",
"word-break",
"word-spacing",
"overflow-wrap",

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

@ -696,8 +696,6 @@ private:
DECL_GFX_PREF(Live, "webrender.blob-images", WebRenderBlobImages, bool, false);
DECL_GFX_PREF(Live, "webrender.highlight-painted-layers", WebRenderHighlightPaintedLayers, bool, false);
DECL_GFX_PREF(Live, "widget.window-transforms.disabled", WindowTransformsDisabled, bool, false);
// WARNING:
// Please make sure that you've added your new preference to the list above in alphabetical order.
// Please do not just append it to the end of the list.

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

@ -459,7 +459,6 @@ RestyleManager::ChangeHintToString(nsChangeHint aHint)
"ReflowChangesSizeOrPosition", "UpdateComputedBSize",
"UpdateUsesOpacity", "UpdateBackgroundPosition",
"AddOrRemoveTransform", "CSSOverflowChange",
"UpdateWidgetProperties"
};
static_assert(nsChangeHint_AllHints == (1 << ArrayLength(names)) - 1,
"Name list doesn't match change hints.");
@ -1714,9 +1713,6 @@ RestyleManager::ProcessRestyledFrames(nsStyleChangeList& aChangeList)
presContext->PresShell()->SynthesizeMouseMove(false);
didUpdateCursor = true;
}
if (hint & nsChangeHint_UpdateWidgetProperties) {
frame->UpdateWidgetProperties();
}
}
}

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

@ -232,12 +232,6 @@ enum nsChangeHint : uint32_t {
*/
nsChangeHint_CSSOverflowChange = 1 << 28,
/**
* Indicates that nsIFrame::UpdateWidgetProperties needs to be called.
* This is used for -moz-window-* properties.
*/
nsChangeHint_UpdateWidgetProperties = 1 << 29,
// IMPORTANT NOTE: When adding a new hint, you will need to add it to
// one of:
//
@ -253,7 +247,7 @@ enum nsChangeHint : uint32_t {
/**
* Dummy hint value for all hints. It exists for compile time check.
*/
nsChangeHint_AllHints = (1 << 30) - 1,
nsChangeHint_AllHints = (1 << 29) - 1,
};
// Redefine these operators to return nothing. This will catch any use
@ -355,8 +349,7 @@ inline nsChangeHint operator^=(nsChangeHint& aLeft, nsChangeHint aRight)
nsChangeHint_UpdatePostTransformOverflow | \
nsChangeHint_UpdateTransformLayer | \
nsChangeHint_UpdateUsesOpacity | \
nsChangeHint_AddOrRemoveTransform | \
nsChangeHint_UpdateWidgetProperties \
nsChangeHint_AddOrRemoveTransform \
)
// The change hints that are sometimes considered to be handled for descendants.

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

@ -10479,86 +10479,6 @@ nsIFrame::IsScrolledOutOfView()
return IsFrameScrolledOutOfView(this);
}
gfx::Matrix
nsIFrame::ComputeWidgetTransform()
{
const nsStyleUIReset* uiReset = StyleUIReset();
if (!uiReset->mSpecifiedWindowTransform) {
return gfx::Matrix();
}
nsStyleTransformMatrix::TransformReferenceBox refBox;
refBox.Init(GetSize());
nsPresContext* presContext = PresContext();
int32_t appUnitsPerDevPixel = presContext->AppUnitsPerDevPixel();
RuleNodeCacheConditions dummy;
bool dummyBool;
gfx::Matrix4x4 matrix =
nsStyleTransformMatrix::ReadTransforms(uiReset->mSpecifiedWindowTransform->mHead,
StyleContext(),
presContext,
dummy,
refBox,
float(appUnitsPerDevPixel),
&dummyBool);
// Apply the -moz-window-transform-origin translation to the matrix.
Point transformOrigin =
nsStyleTransformMatrix::Convert2DPosition(uiReset->mWindowTransformOrigin,
refBox, appUnitsPerDevPixel);
matrix.ChangeBasis(Point3D(transformOrigin.x, transformOrigin.y, 0));
gfx::Matrix result2d;
if (!matrix.CanDraw2D(&result2d)) {
// FIXME: It would be preferable to reject non-2D transforms at parse time.
NS_WARNING("-moz-window-transform does not describe a 2D transform, "
"but only 2d transforms are supported");
return gfx::Matrix();
}
return result2d;
}
static already_AddRefed<nsIWidget>
GetWindowWidget(nsPresContext* aPresContext)
{
// We want to obtain the widget for the window. We can't use any of these
// methods: nsPresContext::GetRootWidget, nsPresContext::GetNearestWidget,
// nsIFrame::GetNearestWidget because those deal with child widgets and
// there is no parent widget connection between child widgets and the
// window widget that contains them.
nsCOMPtr<nsISupports> container = aPresContext->Document()->GetContainer();
nsCOMPtr<nsIBaseWindow> baseWindow = do_QueryInterface(container);
if (!baseWindow) {
return nullptr;
}
nsCOMPtr<nsIWidget> mainWidget;
baseWindow->GetMainWidget(getter_AddRefs(mainWidget));
return mainWidget.forget();
}
void
nsIFrame::UpdateWidgetProperties()
{
nsPresContext* presContext = PresContext();
if (presContext->IsRoot() || !presContext->IsChrome()) {
// Don't do anything for documents that aren't the root chrome document.
return;
}
nsIFrame* rootFrame =
presContext->FrameConstructor()->GetRootElementStyleFrame();
if (this != rootFrame) {
// Only the window's root style frame is relevant for widget properties.
return;
}
if (nsCOMPtr<nsIWidget> widget = GetWindowWidget(presContext)) {
widget->SetWindowOpacity(StyleUIReset()->mWindowOpacity);
widget->SetWindowTransform(ComputeWidgetTransform());
}
}
void
nsIFrame::DoUpdateStyleOfOwnedAnonBoxes(ServoStyleSet& aStyleSet,
nsStyleChangeList& aChangeList,

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

@ -3934,19 +3934,6 @@ public:
*/
bool IsScrolledOutOfView();
/**
* Computes a 2D matrix from the -moz-window-transform and
* -moz-window-transform-origin properties on aFrame.
* Values that don't result in a 2D matrix will be ignored and an identity
* matrix will be returned instead.
*/
Matrix ComputeWidgetTransform();
/**
* Applies the values from the -moz-window-* properties to the widget.
*/
virtual void UpdateWidgetProperties();
/**
* @return true iff this frame has one or more associated image requests.
* @see mozilla::css::ImageLoader.

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

@ -770,7 +770,6 @@ PropertySupportsVariant(nsCSSPropertyID aPropertyID, uint32_t aVariant)
case eCSSProperty__moz_outline_radius_topright:
case eCSSProperty__moz_outline_radius_bottomleft:
case eCSSProperty__moz_outline_radius_bottomright:
case eCSSProperty__moz_window_transform_origin:
supported = VARIANT_LP;
break;

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

@ -7073,18 +7073,47 @@ nsDisplayTransform::ComputePerspectiveMatrix(const nsIFrame* aFrame,
TransformReferenceBox refBox(cbFrame);
Point perspectiveOrigin =
nsStyleTransformMatrix::Convert2DPosition(cbDisplay->mPerspectiveOrigin,
refBox, aAppUnitsPerPixel);
/* Allows us to access named variables by index. */
Point3D perspectiveOrigin;
gfx::Float* coords[2] = {&perspectiveOrigin.x, &perspectiveOrigin.y};
TransformReferenceBox::DimensionGetter dimensionGetter[] =
{ &TransformReferenceBox::Width, &TransformReferenceBox::Height };
/* For both of the coordinates, if the value of perspective-origin is a
* percentage, it's relative to the size of the frame. Otherwise, if it's
* a distance, it's already computed for us!
*/
for (uint8_t index = 0; index < 2; ++index) {
/* If the -transform-origin specifies a percentage, take the percentage
* of the size of the box.
*/
const nsStyleCoord &coord = cbDisplay->mPerspectiveOrigin[index];
if (coord.GetUnit() == eStyleUnit_Calc) {
const nsStyleCoord::Calc *calc = coord.GetCalcValue();
*coords[index] =
NSAppUnitsToFloatPixels((refBox.*dimensionGetter[index])(), aAppUnitsPerPixel) *
calc->mPercent +
NSAppUnitsToFloatPixels(calc->mLength, aAppUnitsPerPixel);
} else if (coord.GetUnit() == eStyleUnit_Percent) {
*coords[index] =
NSAppUnitsToFloatPixels((refBox.*dimensionGetter[index])(), aAppUnitsPerPixel) *
coord.GetPercentValue();
} else {
MOZ_ASSERT(coord.GetUnit() == eStyleUnit_Coord, "unexpected unit");
*coords[index] =
NSAppUnitsToFloatPixels(coord.GetCoordValue(), aAppUnitsPerPixel);
}
}
/* GetOffsetTo computes the offset required to move from 0,0 in cbFrame to 0,0
* in aFrame. Although we actually want the inverse of this, it's faster to
* compute this way.
*/
nsPoint frameToCbOffset = -aFrame->GetOffsetTo(cbFrame);
Point frameToCbGfxOffset(
Point3D frameToCbGfxOffset(
NSAppUnitsToFloatPixels(frameToCbOffset.x, aAppUnitsPerPixel),
NSAppUnitsToFloatPixels(frameToCbOffset.y, aAppUnitsPerPixel));
NSAppUnitsToFloatPixels(frameToCbOffset.y, aAppUnitsPerPixel),
0.0f);
/* Move the perspective origin to be relative to aFrame, instead of relative
* to the containing block which is how it was specified in the style system.
@ -7094,7 +7123,7 @@ nsDisplayTransform::ComputePerspectiveMatrix(const nsIFrame* aFrame,
aOutMatrix._34 =
-1.0 / NSAppUnitsToFloatPixels(perspective, aAppUnitsPerPixel);
aOutMatrix.ChangeBasis(Point3D(perspectiveOrigin.x, perspectiveOrigin.y, 0));
aOutMatrix.ChangeBasis(perspectiveOrigin);
return true;
}

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

@ -4317,21 +4317,6 @@ StyleAnimationValue::ExtractComputedValue(nsCSSPropertyID aProperty,
break;
}
case eCSSProperty__moz_window_transform_origin: {
const nsStyleUIReset *styleUIReset =
static_cast<const nsStyleUIReset*>(styleStruct);
nsAutoPtr<nsCSSValuePair> pair(new nsCSSValuePair);
if (!StyleCoordToCSSValue(styleUIReset->mWindowTransformOrigin[0],
pair->mXValue) ||
!StyleCoordToCSSValue(styleUIReset->mWindowTransformOrigin[1],
pair->mYValue)) {
return false;
}
aComputedValue.SetAndAdoptCSSValuePairValue(pair.forget(),
eUnit_CSSValuePair);
break;
}
case eCSSProperty_stroke_dasharray: {
const nsStyleSVG *svg = static_cast<const nsStyleSVG*>(styleStruct);
if (!svg->mStrokeDasharray.IsEmpty()) {
@ -4609,31 +4594,6 @@ StyleAnimationValue::ExtractComputedValue(nsCSSPropertyID aProperty,
break;
}
case eCSSProperty__moz_window_transform: {
const nsStyleUIReset *uiReset =
static_cast<const nsStyleUIReset*>(styleStruct);
nsAutoPtr<nsCSSValueList> result;
if (uiReset->mSpecifiedWindowTransform) {
// Clone, and convert all lengths (not percents) to pixels.
nsCSSValueList **resultTail = getter_Transfers(result);
for (const nsCSSValueList *l = uiReset->mSpecifiedWindowTransform->mHead;
l; l = l->mNext) {
nsCSSValueList *clone = new nsCSSValueList;
*resultTail = clone;
resultTail = &clone->mNext;
SubstitutePixelValues(aStyleContext, l->mValue, clone->mValue);
}
} else {
result = new nsCSSValueList();
result->mValue.SetNoneValue();
}
aComputedValue.SetTransformValue(
new nsCSSValueSharedList(result.forget()));
break;
}
case eCSSProperty_font_variation_settings: {
auto font = static_cast<const nsStyleFont*>(styleStruct);
UniquePtr<nsCSSValuePairList> result;

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

@ -39,7 +39,7 @@ STYLE_STRUCTS = [("INHERITED",) + x for x in [
("TextReset", "nullptr", NORMAL_DEP + LENGTH_DEP + COLOR_DEP),
("Display", "nullptr", NORMAL_DEP + LENGTH_DEP),
("Content", "nullptr", NORMAL_DEP + LENGTH_DEP),
("UIReset", "nullptr", NORMAL_DEP + LENGTH_DEP),
("UIReset", "nullptr", NORMAL_DEP),
("Table", "nullptr", NORMAL_DEP),
("Margin", "nullptr", NORMAL_DEP + LENGTH_DEP),
("Padding", "nullptr", NORMAL_DEP + LENGTH_DEP),

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

@ -1042,8 +1042,7 @@ protected:
bool ParseListStyleType(nsCSSValue& aValue);
bool ParseMargin();
bool ParseClipPath(nsCSSValue& aValue);
bool ParseTransform(bool aIsPrefixed, nsCSSPropertyID aProperty,
bool aDisallowRelativeValues = false);
bool ParseTransform(bool aIsPrefixed, bool aDisallowRelativeValues = false);
bool ParseObjectPosition();
bool ParseOutline();
bool ParseOverflow();
@ -1386,7 +1385,7 @@ protected:
InfallibleTArray<nsCSSValue>& aOutput);
/* Functions for transform-origin/perspective-origin Parsing */
bool ParseTransformOrigin(nsCSSPropertyID aProperty);
bool ParseTransformOrigin(bool aPerspective);
/* Functions for filter parsing */
bool ParseFilter();
@ -1947,8 +1946,7 @@ CSSParserImpl::ParseTransformProperty(const nsAString& aPropValue,
css::ErrorReporter reporter(scanner, mSheet, mChildLoader, nullptr);
InitScanner(scanner, reporter, nullptr, nullptr, nullptr);
bool parsedOK = ParseTransform(false, eCSSProperty_transform,
aDisallowRelativeValues);
bool parsedOK = ParseTransform(false, aDisallowRelativeValues);
// We should now be at EOF
if (parsedOK && GetToken(true)) {
parsedOK = false;
@ -11869,14 +11867,13 @@ CSSParserImpl::ParsePropertyByFunction(nsCSSPropertyID aPropID)
case eCSSProperty_will_change:
return ParseWillChange();
case eCSSProperty_transform:
case eCSSProperty__moz_window_transform:
return ParseTransform(false, aPropID);
return ParseTransform(false);
case eCSSProperty__moz_transform:
return ParseTransform(true, eCSSProperty_transform);
return ParseTransform(true);
case eCSSProperty_transform_origin:
return ParseTransformOrigin(false);
case eCSSProperty_perspective_origin:
case eCSSProperty__moz_window_transform_origin:
return ParseTransformOrigin(aPropID);
return ParseTransformOrigin(true);
case eCSSProperty_transition:
return ParseTransition();
case eCSSProperty_animation:
@ -16235,15 +16232,9 @@ CSSParserImpl::ParseSingleTransform(bool aIsPrefixed,
/* Parses a transform property list by continuously reading in properties
* and constructing a matrix from it.
* aProperty can be transform or -moz-window-transform.
* FIXME: For -moz-window-transform, it would be nice to reject non-2d
* transforms at parse time, because the implementation only supports 2d
* transforms. Instead, at the moment, non-2d transforms are treated as the
* identity transform very late in the pipeline.
*/
bool
CSSParserImpl::ParseTransform(bool aIsPrefixed, nsCSSPropertyID aProperty,
bool aDisallowRelativeValues)
CSSParserImpl::ParseTransform(bool aIsPrefixed, bool aDisallowRelativeValues)
{
nsCSSValue value;
// 'inherit', 'initial', 'unset' and 'none' must be alone
@ -16265,7 +16256,7 @@ CSSParserImpl::ParseTransform(bool aIsPrefixed, nsCSSPropertyID aProperty,
cur = cur->mNext;
}
}
AppendValue(aProperty, value);
AppendValue(eCSSProperty_transform, value);
return true;
}
@ -16540,12 +16531,17 @@ CSSParserImpl::ParseShapeOutside(nsCSSValue& aValue)
aValue, nsCSSProps::kShapeOutsideShapeBoxKTable);
}
bool CSSParserImpl::ParseTransformOrigin(nsCSSPropertyID aProperty)
bool CSSParserImpl::ParseTransformOrigin(bool aPerspective)
{
nsCSSValuePair position;
if (!ParseBoxPositionValues(position, true))
return false;
nsCSSPropertyID prop = eCSSProperty_transform_origin;
if (aPerspective) {
prop = eCSSProperty_perspective_origin;
}
// Unlike many other uses of pairs, this position should always be stored
// as a pair, even if the values are the same, so it always serializes as
// a pair, and to keep the computation code simple.
@ -16554,10 +16550,10 @@ bool CSSParserImpl::ParseTransformOrigin(nsCSSPropertyID aProperty)
position.mXValue.GetUnit() == eCSSUnit_Unset) {
MOZ_ASSERT(position.mXValue == position.mYValue,
"inherit/initial/unset only half?");
AppendValue(aProperty, position.mXValue);
AppendValue(prop, position.mXValue);
} else {
nsCSSValue value;
if (aProperty != eCSSProperty_transform_origin) {
if (aPerspective) {
value.SetPairValue(position.mXValue, position.mYValue);
} else {
nsCSSValue depth;
@ -16571,7 +16567,7 @@ bool CSSParserImpl::ParseTransformOrigin(nsCSSPropertyID aProperty)
value.SetTripletValue(position.mXValue, position.mYValue, depth);
}
AppendValue(aProperty, value);
AppendValue(prop, value);
}
return true;
}

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

@ -4494,41 +4494,6 @@ CSS_PROP_UIRESET(
kWindowShadowKTable,
CSS_PROP_NO_OFFSET,
eStyleAnimType_None)
CSS_PROP_UIRESET(
-moz-window-opacity,
_moz_window_opacity,
CSS_PROP_DOMPROP_PREFIXED(WindowOpacity),
CSS_PROPERTY_INTERNAL | CSS_PROPERTY_PARSE_VALUE,
"",
VARIANT_HN,
nullptr,
offsetof(nsStyleUIReset, mWindowOpacity),
eStyleAnimType_float)
CSS_PROP_UIRESET(
-moz-window-transform,
_moz_window_transform,
CSS_PROP_DOMPROP_PREFIXED(WindowTransform),
CSS_PROPERTY_INTERNAL |
CSS_PROPERTY_PARSE_FUNCTION |
CSS_PROPERTY_GETCS_NEEDS_LAYOUT_FLUSH,
"",
0,
nullptr,
offsetof(nsStyleUIReset, mSpecifiedWindowTransform),
eStyleAnimType_Custom)
CSS_PROP_UIRESET(
-moz-window-transform-origin,
_moz_window_transform_origin,
CSS_PROP_DOMPROP_PREFIXED(WindowTransformOrigin),
CSS_PROPERTY_INTERNAL |
CSS_PROPERTY_PARSE_FUNCTION |
CSS_PROPERTY_STORES_CALC |
CSS_PROPERTY_GETCS_NEEDS_LAYOUT_FLUSH,
"",
0,
kImageLayerPositionKTable,
CSS_PROP_NO_OFFSET,
eStyleAnimType_Custom)
#endif // CSS_PROP_LIST_EXCLUDE_INTERNAL
CSS_PROP_TEXT(
word-break,

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

@ -1536,11 +1536,57 @@ nsComputedDOMStyle::DoGetTransformStyle()
return val.forget();
}
/* If the property is "none", hand back "none" wrapped in a value.
* Otherwise, compute the aggregate transform matrix and hands it back in a
* "matrix" wrapper.
*/
already_AddRefed<CSSValue>
nsComputedDOMStyle::DoGetTransform()
{
/* First, get the display data. We'll need it. */
const nsStyleDisplay* display = StyleDisplay();
return GetTransformValue(display->mSpecifiedTransform);
/* If there are no transforms, then we should construct a single-element
* entry and hand it back.
*/
if (!display->mSpecifiedTransform) {
RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
/* Set it to "none." */
val->SetIdent(eCSSKeyword_none);
return val.forget();
}
/* Otherwise, we need to compute the current value of the transform matrix,
* store it in a string, and hand it back to the caller.
*/
/* Use the inner frame for the reference box. If we don't have an inner
* frame we use empty dimensions to allow us to continue (and percentage
* values in the transform will simply give broken results).
* TODO: There is no good way for us to represent the case where there's no
* frame, which is problematic. The reason is that when we have percentage
* transforms, there are a total of four stored matrix entries that influence
* the transform based on the size of the element. However, this poses a
* problem, because only two of these values can be explicitly referenced
* using the named transforms. Until a real solution is found, we'll just
* use this approach.
*/
nsStyleTransformMatrix::TransformReferenceBox refBox(mInnerFrame,
nsSize(0, 0));
RuleNodeCacheConditions dummy;
bool dummyBool;
gfx::Matrix4x4 matrix =
nsStyleTransformMatrix::ReadTransforms(display->mSpecifiedTransform->mHead,
mStyleContext,
mStyleContext->PresContext(),
dummy,
refBox,
float(mozilla::AppUnitsPerCSSPixel()),
&dummyBool);
return MatrixToCSSValue(matrix);
}
already_AddRefed<CSSValue>
@ -4180,41 +4226,6 @@ nsComputedDOMStyle::DoGetWindowShadow()
return val.forget();
}
already_AddRefed<CSSValue>
nsComputedDOMStyle::DoGetWindowOpacity()
{
RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
val->SetNumber(StyleUIReset()->mWindowOpacity);
return val.forget();
}
already_AddRefed<CSSValue>
nsComputedDOMStyle::DoGetWindowTransform()
{
const nsStyleUIReset* uiReset = StyleUIReset();
return GetTransformValue(uiReset->mSpecifiedWindowTransform);
}
already_AddRefed<CSSValue>
nsComputedDOMStyle::DoGetWindowTransformOrigin()
{
RefPtr<nsDOMCSSValueList> valueList = GetROCSSValueList(false);
const nsStyleUIReset* uiReset = StyleUIReset();
RefPtr<nsROCSSPrimitiveValue> originX = new nsROCSSPrimitiveValue;
SetValueToCoord(originX, uiReset->mWindowTransformOrigin[0], false,
&nsComputedDOMStyle::GetFrameBoundsWidthForTransform);
valueList->AppendCSSValue(originX.forget());
RefPtr<nsROCSSPrimitiveValue> originY = new nsROCSSPrimitiveValue;
SetValueToCoord(originY, uiReset->mWindowTransformOrigin[1], false,
&nsComputedDOMStyle::GetFrameBoundsHeightForTransform);
valueList->AppendCSSValue(originY.forget());
return valueList.forget();
}
already_AddRefed<CSSValue>
nsComputedDOMStyle::DoGetWordBreak()
{
@ -5852,56 +5863,6 @@ nsComputedDOMStyle::GetSVGPaintFor(bool aFill)
return val.forget();
}
/* If the property is "none", hand back "none" wrapped in a value.
* Otherwise, compute the aggregate transform matrix and hands it back in a
* "matrix" wrapper.
*/
already_AddRefed<CSSValue>
nsComputedDOMStyle::GetTransformValue(nsCSSValueSharedList* aSpecifiedTransform)
{
/* If there are no transforms, then we should construct a single-element
* entry and hand it back.
*/
if (!aSpecifiedTransform) {
RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
/* Set it to "none." */
val->SetIdent(eCSSKeyword_none);
return val.forget();
}
/* Otherwise, we need to compute the current value of the transform matrix,
* store it in a string, and hand it back to the caller.
*/
/* Use the inner frame for the reference box. If we don't have an inner
* frame we use empty dimensions to allow us to continue (and percentage
* values in the transform will simply give broken results).
* TODO: There is no good way for us to represent the case where there's no
* frame, which is problematic. The reason is that when we have percentage
* transforms, there are a total of four stored matrix entries that influence
* the transform based on the size of the element. However, this poses a
* problem, because only two of these values can be explicitly referenced
* using the named transforms. Until a real solution is found, we'll just
* use this approach.
*/
nsStyleTransformMatrix::TransformReferenceBox refBox(mInnerFrame,
nsSize(0, 0));
RuleNodeCacheConditions dummy;
bool dummyBool;
gfx::Matrix4x4 matrix =
nsStyleTransformMatrix::ReadTransforms(aSpecifiedTransform->mHead,
mStyleContext,
mStyleContext->PresContext(),
dummy,
refBox,
float(mozilla::AppUnitsPerCSSPixel()),
&dummyBool);
return MatrixToCSSValue(matrix);
}
already_AddRefed<CSSValue>
nsComputedDOMStyle::DoGetFill()
{

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

@ -214,8 +214,6 @@ private:
already_AddRefed<CSSValue> GetSVGPaintFor(bool aFill);
already_AddRefed<CSSValue> GetTransformValue(nsCSSValueSharedList* aSpecifiedTransform);
// Appends all aLineNames (may be empty) space-separated to aResult.
void AppendGridLineNames(nsString& aResult,
const nsTArray<nsString>& aLineNames);
@ -530,9 +528,6 @@ private:
already_AddRefed<CSSValue> DoGetUserModify();
already_AddRefed<CSSValue> DoGetUserSelect();
already_AddRefed<CSSValue> DoGetWindowDragging();
already_AddRefed<CSSValue> DoGetWindowOpacity();
already_AddRefed<CSSValue> DoGetWindowTransform();
already_AddRefed<CSSValue> DoGetWindowTransformOrigin();
/* Column properties */
already_AddRefed<CSSValue> DoGetColumnCount();

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

@ -305,9 +305,6 @@ COMPUTED_STYLE_PROP(_moz_user_modify, UserModify)
COMPUTED_STYLE_PROP(_moz_user_select, UserSelect)
COMPUTED_STYLE_PROP(_moz_window_dragging, WindowDragging)
COMPUTED_STYLE_PROP(_moz_window_shadow, WindowShadow)
COMPUTED_STYLE_PROP(_moz_window_opacity, WindowOpacity)
COMPUTED_STYLE_PROP(_moz_window_transform, WindowTransform)
COMPUTED_STYLE_PROP(_moz_window_transform_origin, WindowTransformOrigin)
/* ********************************** *\
* Implementations of -webkit- styles *

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

@ -1740,47 +1740,6 @@ SetFactor(const nsCSSValue& aValue, float& aField, RuleNodeCacheConditions& aCon
NS_NOTREACHED("SetFactor: inappropriate unit");
}
static void
SetTransformValue(const nsCSSValue& aValue,
RefPtr<nsCSSValueSharedList>& aField,
RuleNodeCacheConditions& aConditions,
nsCSSValueSharedList* const aParentValue)
{
/* Convert the nsCSSValueList into an nsTArray<nsTransformFunction *>. */
switch (aValue.GetUnit()) {
case eCSSUnit_Null:
break;
case eCSSUnit_Initial:
case eCSSUnit_Unset:
case eCSSUnit_None:
aField = nullptr;
break;
case eCSSUnit_Inherit:
aField = aParentValue;
aConditions.SetUncacheable();
break;
case eCSSUnit_SharedList: {
nsCSSValueSharedList* list = aValue.GetSharedListValue();
nsCSSValueList* head = list->mHead;
MOZ_ASSERT(head, "transform list must have at least one item");
// can get a _None in here from transform animation
if (head->mValue.GetUnit() == eCSSUnit_None) {
MOZ_ASSERT(head->mNext == nullptr, "none must be alone");
aField = nullptr;
} else {
aField = list;
}
break;
}
default:
MOZ_ASSERT(false, "unrecognized transform unit");
}
}
void*
nsRuleNode::operator new(size_t sz, nsPresContext* aPresContext)
{
@ -5316,34 +5275,6 @@ nsRuleNode::ComputeUIResetData(void* aStartStruct,
parentUI->mWindowShadow,
NS_STYLE_WINDOW_SHADOW_DEFAULT);
// -moz-window-opacity: factor, inherit, initial
SetFactor(*aRuleData->ValueForWindowOpacity(),
ui->mWindowOpacity, conditions,
parentUI->mWindowOpacity, 1.0f,
SETFCT_OPACITY | SETFCT_UNSET_INITIAL);
// -moz-window-transform
SetTransformValue(*aRuleData->ValueForWindowTransform(),
ui->mSpecifiedWindowTransform, conditions,
parentUI->mSpecifiedWindowTransform);
// -moz-window-transform-origin
const nsCSSValue* windowTransformOriginValue =
aRuleData->ValueForWindowTransformOrigin();
if (windowTransformOriginValue->GetUnit() != eCSSUnit_Null) {
mozilla::DebugOnly<bool> result =
SetPairCoords(*windowTransformOriginValue,
ui->mWindowTransformOrigin[0],
ui->mWindowTransformOrigin[1],
parentUI->mWindowTransformOrigin[0],
parentUI->mWindowTransformOrigin[1],
SETCOORD_LPH | SETCOORD_INITIAL_HALF |
SETCOORD_BOX_POSITION | SETCOORD_STORE_CALC |
SETCOORD_UNSET_INITIAL,
aContext, mPresContext, conditions);
NS_ASSERTION(result, "Malformed -moz-window-transform-origin parse!");
}
COMPUTE_END_RESET(UIReset, ui)
}
@ -6411,9 +6342,40 @@ nsRuleNode::ComputeDisplayData(void* aStartStruct,
}
}
SetTransformValue(*aRuleData->ValueForTransform(),
display->mSpecifiedTransform, conditions,
parentDisplay->mSpecifiedTransform);
/* Convert the nsCSSValueList into an nsTArray<nsTransformFunction *>. */
const nsCSSValue* transformValue = aRuleData->ValueForTransform();
switch (transformValue->GetUnit()) {
case eCSSUnit_Null:
break;
case eCSSUnit_Initial:
case eCSSUnit_Unset:
case eCSSUnit_None:
display->mSpecifiedTransform = nullptr;
break;
case eCSSUnit_Inherit:
display->mSpecifiedTransform = parentDisplay->mSpecifiedTransform;
conditions.SetUncacheable();
break;
case eCSSUnit_SharedList: {
nsCSSValueSharedList* list = transformValue->GetSharedListValue();
nsCSSValueList* head = list->mHead;
MOZ_ASSERT(head, "transform list must have at least one item");
// can get a _None in here from transform animation
if (head->mValue.GetUnit() == eCSSUnit_None) {
MOZ_ASSERT(head->mNext == nullptr, "none must be alone");
display->mSpecifiedTransform = nullptr;
} else {
display->mSpecifiedTransform = list;
}
break;
}
default:
MOZ_ASSERT(false, "unrecognized transform unit");
}
/* Convert the nsCSSValueList into a will-change bitfield for fast lookup */
const nsCSSValue* willChangeValue = aRuleData->ValueForWillChange();

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

@ -4326,10 +4326,6 @@ nsStyleUIReset::nsStyleUIReset(const nsPresContext* aContext)
, mIMEMode(NS_STYLE_IME_MODE_AUTO)
, mWindowDragging(StyleWindowDragging::Default)
, mWindowShadow(NS_STYLE_WINDOW_SHADOW_DEFAULT)
, mWindowOpacity(1.0)
, mSpecifiedWindowTransform(nullptr)
, mWindowTransformOrigin{ {0.5f, eStyleUnit_Percent}, // Transform is centered on origin
{0.5f, eStyleUnit_Percent} }
{
MOZ_COUNT_CTOR(nsStyleUIReset);
}
@ -4340,10 +4336,6 @@ nsStyleUIReset::nsStyleUIReset(const nsStyleUIReset& aSource)
, mIMEMode(aSource.mIMEMode)
, mWindowDragging(aSource.mWindowDragging)
, mWindowShadow(aSource.mWindowShadow)
, mWindowOpacity(aSource.mWindowOpacity)
, mSpecifiedWindowTransform(aSource.mSpecifiedWindowTransform)
, mWindowTransformOrigin{ aSource.mWindowTransformOrigin[0],
aSource.mWindowTransformOrigin[1] }
{
MOZ_COUNT_CTOR(nsStyleUIReset);
}
@ -4351,62 +4343,34 @@ nsStyleUIReset::nsStyleUIReset(const nsStyleUIReset& aSource)
nsStyleUIReset::~nsStyleUIReset()
{
MOZ_COUNT_DTOR(nsStyleUIReset);
// See the nsStyleDisplay destructor for why we're doing this.
if (mSpecifiedWindowTransform && ServoStyleSet::IsInServoTraversal()) {
bool alwaysProxy =
#ifdef DEBUG
true;
#else
false;
#endif
NS_ReleaseOnMainThread(mSpecifiedWindowTransform.forget(), alwaysProxy);
}
}
nsChangeHint
nsStyleUIReset::CalcDifference(const nsStyleUIReset& aNewData) const
{
nsChangeHint hint = nsChangeHint(0);
// ignore mIMEMode
if (mForceBrokenImageIcon != aNewData.mForceBrokenImageIcon) {
hint |= nsChangeHint_ReconstructFrame;
return nsChangeHint_ReconstructFrame;
}
if (mWindowShadow != aNewData.mWindowShadow) {
// We really need just an nsChangeHint_SyncFrameView, except
// on an ancestor of the frame, so we get that by doing a
// reflow.
hint |= NS_STYLE_HINT_REFLOW;
return NS_STYLE_HINT_REFLOW;
}
if (mUserSelect != aNewData.mUserSelect) {
hint |= NS_STYLE_HINT_VISUAL;
return NS_STYLE_HINT_VISUAL;
}
if (mWindowDragging != aNewData.mWindowDragging) {
hint |= nsChangeHint_SchedulePaint;
return nsChangeHint_SchedulePaint;
}
if (mWindowOpacity != aNewData.mWindowOpacity ||
!mSpecifiedWindowTransform != !aNewData.mSpecifiedWindowTransform ||
(mSpecifiedWindowTransform &&
*mSpecifiedWindowTransform != *aNewData.mSpecifiedWindowTransform)) {
hint |= nsChangeHint_UpdateWidgetProperties;
} else {
for (uint8_t index = 0; index < 3; ++index) {
if (mWindowTransformOrigin[index] !=
aNewData.mWindowTransformOrigin[index]) {
hint |= nsChangeHint_UpdateWidgetProperties;
break;
}
}
if (mIMEMode != aNewData.mIMEMode) {
return nsChangeHint_NeutralChange;
}
if (!hint &&
mIMEMode != aNewData.mIMEMode) {
hint |= nsChangeHint_NeutralChange;
}
return hint;
return nsChangeHint(0);
}
//-----------------------

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

@ -3228,9 +3228,6 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleUIReset
uint8_t mIMEMode; // [reset]
mozilla::StyleWindowDragging mWindowDragging; // [reset]
uint8_t mWindowShadow; // [reset]
float mWindowOpacity; // [reset]
RefPtr<nsCSSValueSharedList> mSpecifiedWindowTransform; // [reset]
nsStyleCoord mWindowTransformOrigin[2]; // [reset] percent, coord, calc
};
struct nsCursorImage

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

@ -1007,39 +1007,6 @@ ReadTransforms(const nsCSSValueList* aList,
return result;
}
Point
Convert2DPosition(nsStyleCoord const (&aValue)[2],
TransformReferenceBox& aRefBox,
int32_t aAppUnitsPerDevPixel)
{
float position[2];
nsStyleTransformMatrix::TransformReferenceBox::DimensionGetter dimensionGetter[] =
{ &nsStyleTransformMatrix::TransformReferenceBox::Width,
&nsStyleTransformMatrix::TransformReferenceBox::Height };
for (uint8_t index = 0; index < 2; ++index) {
const nsStyleCoord& value = aValue[index];
if (value.GetUnit() == eStyleUnit_Calc) {
const nsStyleCoord::Calc *calc = value.GetCalcValue();
position[index] =
NSAppUnitsToFloatPixels((aRefBox.*dimensionGetter[index])(), aAppUnitsPerDevPixel) *
calc->mPercent +
NSAppUnitsToFloatPixels(calc->mLength, aAppUnitsPerDevPixel);
} else if (value.GetUnit() == eStyleUnit_Percent) {
position[index] =
NSAppUnitsToFloatPixels((aRefBox.*dimensionGetter[index])(), aAppUnitsPerDevPixel) *
value.GetPercentValue();
} else {
MOZ_ASSERT(value.GetUnit() == eStyleUnit_Coord,
"unexpected unit");
position[index] =
NSAppUnitsToFloatPixels(value.GetCoordValue(),
aAppUnitsPerDevPixel);
}
}
return Point(position[0], position[1]);
}
/*
* The relevant section of the transitions specification:
* http://dev.w3.org/csswg/css3-transitions/#animation-of-property-types-

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

@ -205,14 +205,6 @@ namespace nsStyleTransformMatrix {
float aAppUnitsPerMatrixUnit,
bool* aContains3dTransform);
/**
* Given two nsStyleCoord values, compute the 2d position with respect to the
* given TransformReferenceBox that these values describe, in device pixels.
*/
mozilla::gfx::Point Convert2DPosition(nsStyleCoord const (&aValue)[2],
TransformReferenceBox& aRefBox,
int32_t aAppUnitsPerDevPixel);
// Shear type for decomposition.
enum class ShearType {
XYSHEAR,

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

@ -115,9 +115,6 @@ const char *gInaccessibleProperties[] = {
"-moz-math-display", // parsed by UA sheets only
"-moz-top-layer", // parsed by UA sheets only
"-moz-min-font-size-ratio", // parsed by UA sheets only
"-moz-window-opacity", // chrome-only internal properties
"-moz-window-transform", // chrome-only internal properties
"-moz-window-transform-origin", // chrome-only internal properties
"-moz-window-shadow" // chrome-only internal properties
};

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

@ -7905,111 +7905,6 @@ if (false) {
invalid_values: []
};
gCSSProperties["-moz-window-opacity"] = {
// domProp: "MozWindowOpacity",
inherited: false,
type: CSS_TYPE_LONGHAND,
initial_values: [ "1", "17", "397.376", "3e1", "3e+1", "3e0", "3e+0", "3e-0" ],
other_values: [ "0", "0.4", "0.0000", "-3", "3e-1" ],
invalid_values: [ "0px", "1px", "20%", "default", "auto" ]
};
gCSSProperties["-moz-window-transform"] = {
// domProp: "MozWindowTransform",
inherited: false,
type: CSS_TYPE_LONGHAND,
prerequisites: { "width": "300px", "height": "50px" },
initial_values: [ "none" ],
other_values: [ "translatex(1px)", "translatex(4em)",
"translatex(-4px)", "translatex(3px)",
"translatex(0px) translatex(1px) translatex(2px) translatex(3px) translatex(4px)",
"translatey(4em)", "translate(3px)", "translate(10px, -3px)",
"rotate(45deg)", "rotate(45grad)", "rotate(45rad)",
"rotate(0.25turn)", "rotate(0)", "scalex(10)", "scaley(10)",
"scale(10)", "scale(10, 20)", "skewx(30deg)", "skewx(0)",
"skewy(0)", "skewx(30grad)", "skewx(30rad)", "skewx(0.08turn)",
"skewy(30deg)", "skewy(30grad)", "skewy(30rad)", "skewy(0.08turn)",
"rotate(45deg) scale(2, 1)", "skewx(45deg) skewx(-50grad)",
"translate(0, 0) scale(1, 1) skewx(0) skewy(0) matrix(1, 0, 0, 1, 0, 0)",
"translatex(50%)", "translatey(50%)", "translate(50%)",
"translate(3%, 5px)", "translate(5px, 3%)",
"matrix(1, 2, 3, 4, 5, 6)",
/* valid calc() values */
"translatex(calc(5px + 10%))",
"translatey(calc(0.25 * 5px + 10% / 3))",
"translate(calc(5px - 10% * 3))",
"translate(calc(5px - 3 * 10%), 50px)",
"translate(-50px, calc(5px - 10% * 3))",
"translatez(1px)", "translatez(4em)", "translatez(-4px)",
"translatez(0px)", "translatez(2px) translatez(5px)",
"translate3d(3px, 4px, 5px)", "translate3d(2em, 3px, 1em)",
"translatex(2px) translate3d(4px, 5px, 6px) translatey(1px)",
"scale3d(4, 4, 4)", "scale3d(-2, 3, -7)", "scalez(4)",
"scalez(-6)", "rotate3d(2, 3, 4, 45deg)",
"rotate3d(-3, 7, 0, 12rad)", "rotatex(15deg)", "rotatey(-12grad)",
"rotatez(72rad)", "rotatex(0.125turn)",
"perspective(0px)", "perspective(1000px)",
"matrix3d(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16)",
],
invalid_values: ["1px", "#0000ff", "red", "auto",
"translatex(1)", "translatey(1)", "translate(2)",
"translate(-3, -4)",
"translatex(1px 1px)", "translatex(translatex(1px))",
"translatex(#0000ff)", "translatex(red)", "translatey()",
"matrix(1px, 2px, 3px, 4px, 5px, 6px)", "scale(150%)",
"skewx(red)", "matrix(1%, 0, 0, 0, 0px, 0px)",
"matrix(0, 1%, 2, 3, 4px,5px)", "matrix(0, 1, 2%, 3, 4px, 5px)",
"matrix(0, 1, 2, 3%, 4%, 5%)", "matrix(1, 2, 3, 4, 5px, 6%)",
"matrix(1, 2, 3, 4, 5%, 6px)", "matrix(1, 2, 3, 4, 5%, 6%)",
"matrix(1, 2, 3, 4, 5px, 6em)",
/* invalid calc() values */
"translatey(-moz-min(5px,10%))",
"translatex(-moz-max(5px,10%))",
"translate(10px, calc(min(5px,10%)))",
"translate(calc(max(5px,10%)), 10%)",
"matrix(1, 0, 0, 1, max(5px * 3), calc(10% - 3px))",
"perspective(-10px)", "matrix3d(dinosaur)",
"matrix3d(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17)",
"matrix3d(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15)",
"matrix3d(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15%, 16)",
"matrix3d(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16px)",
"rotatey(words)", "rotatex(7)", "translate3d(3px, 4px, 1px, 7px)",
"matrix3d(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13px, 14em, 15px, 16)",
"matrix3d(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 20%, 10%, 15, 16)"
],
};
gCSSProperties["-moz-window-transform-origin"] = {
// domProp: "MozWindowTransformOrigin",
inherited: false,
type: CSS_TYPE_LONGHAND,
/* no subproperties */
prerequisites: { "width": "10px", "height": "10px", "display": "block"},
initial_values: [ "50% 50%", "center", "center center" ],
other_values: [ "25% 25%", "6px 5px", "20% 3em", "0 0", "0in 1in",
"top", "bottom","top left", "top right",
"top center", "center left", "center right",
"bottom left", "bottom right", "bottom center",
"20% center", "6px center", "13in bottom",
"left 50px", "right 13%", "center 40px",
"calc(20px)",
"calc(20px) 10px",
"10px calc(20px)",
"calc(20px) 25%",
"25% calc(20px)",
"calc(20px) calc(20px)",
"calc(20px + 1em) calc(20px / 2)",
"calc(20px + 50%) calc(50% - 10px)",
"calc(-20px) calc(-50%)",
"calc(-20%) calc(-50%)"
],
invalid_values: ["red", "auto", "none", "0.5 0.5", "40px #0000ff",
"border", "center red", "right diagonal",
"#00ffff bottom", "0px calc(0px + rubbish)",
"0px 0px calc(0px + rubbish)", "6px 5px 5px",
"top center 10px"]
};
gCSSProperties["-moz-context-properties"] = {
//domProp: "MozContextProperties",
inherited: true,

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

@ -456,15 +456,6 @@ nsMenuPopupFrame::IsLeafDynamic() const
!parentContent->HasAttr(kNameSpaceID_None, nsGkAtoms::sizetopopup));
}
void
nsMenuPopupFrame::UpdateWidgetProperties()
{
if (nsIWidget* widget = GetWidget()) {
widget->SetWindowOpacity(StyleUIReset()->mWindowOpacity);
widget->SetWindowTransform(ComputeWidgetTransform());
}
}
void
nsMenuPopupFrame::LayoutPopup(nsBoxLayoutState& aState, nsIFrame* aParentMenu,
nsIFrame* aAnchor, bool aSizedToPopup)

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

@ -248,8 +248,6 @@ public:
virtual bool IsLeafDynamic() const override;
virtual void UpdateWidgetProperties() override;
// layout, position and display the popup as needed
void LayoutPopup(nsBoxLayoutState& aState, nsIFrame* aParentMenu,
nsIFrame* aAnchor, bool aSizedToPopup);

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

@ -4779,8 +4779,6 @@ pref("widget.content.allow-gtk-dark-theme", false);
#endif
#endif
pref("widget.window-transforms.disabled", false);
#ifdef XP_WIN
// Whether to disable the automatic detection and use of direct2d.
pref("gfx.direct2d.disabled", false);

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

@ -443,74 +443,7 @@ panel[type="arrow"] {
-moz-binding: url("chrome://global/content/bindings/popup.xml#arrowpanel");
}
%ifdef MOZ_WIDGET_COCOA
/* On Mac, use the properties "-moz-window-transform" and "-moz-window-opacity"
instead of "transform" and "opacity" for these animations.
The -moz-window* properties apply to the whole window including the window's
shadow, and they don't affect the window's "shape", so the system doesn't
have to recompute the shadow shape during the animation. This makes them a
lot faster. In fact, Gecko no longer triggers shadow shape recomputations
for repaints.
These properties are not implemented on other platforms. */
panel[type="arrow"]:not([animate="false"]) {
-moz-window-transform: scale(.4);
-moz-window-opacity: 0;
transition-property: -moz-window-transform, -moz-window-opacity;
transition-duration: 0.15s;
transition-timing-function: ease-out;
}
panel[type="arrow"][animate="open"] {
-moz-window-transform: none;
-moz-window-opacity: 1.0;
}
panel[type="arrow"][animate="cancel"] {
-moz-window-transform: none;
}
panel[arrowposition="after_start"]:-moz-locale-dir(ltr),
panel[arrowposition="after_end"]:-moz-locale-dir(rtl) {
-moz-window-transform-origin: 20px top;
}
panel[arrowposition="after_end"]:-moz-locale-dir(ltr),
panel[arrowposition="after_start"]:-moz-locale-dir(rtl) {
-moz-window-transform-origin: calc(100% - 20px) top;
}
panel[arrowposition="before_start"]:-moz-locale-dir(ltr),
panel[arrowposition="before_end"]:-moz-locale-dir(rtl) {
-moz-window-transform-origin: 20px bottom;
}
panel[arrowposition="before_end"]:-moz-locale-dir(ltr),
panel[arrowposition="before_start"]:-moz-locale-dir(rtl) {
-moz-window-transform-origin: calc(100% - 20px) bottom;
}
panel[arrowposition="start_before"]:-moz-locale-dir(ltr),
panel[arrowposition="end_before"]:-moz-locale-dir(rtl) {
-moz-window-transform-origin: right 20px;
}
panel[arrowposition="start_after"]:-moz-locale-dir(ltr),
panel[arrowposition="end_after"]:-moz-locale-dir(rtl) {
-moz-window-transform-origin: right calc(100% - 20px);
}
panel[arrowposition="end_before"]:-moz-locale-dir(ltr),
panel[arrowposition="start_before"]:-moz-locale-dir(rtl) {
-moz-window-transform-origin: left 20px;
}
panel[arrowposition="end_after"]:-moz-locale-dir(ltr),
panel[arrowposition="start_after"]:-moz-locale-dir(rtl) {
-moz-window-transform-origin: left calc(100% - 20px);
}
%elifndef MOZ_WIDGET_GTK
%ifndef MOZ_WIDGET_GTK
panel[type="arrow"]:not([animate="false"]) {
transform: scale(.4);

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

@ -3767,6 +3767,12 @@ NSEvent* gLastDragMouseDownEvent = nil;
{
CGContextRef cgContext = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort];
[self drawRect:aRect inContext:cgContext];
// If we're a transparent window and our contents have changed, we need
// to make sure the shadow is updated to the new contents.
if ([[self window] isKindOfClass:[BaseWindow class]]) {
[(BaseWindow*)[self window] deferredInvalidateShadow];
}
}
- (void)drawRect:(NSRect)aRect inContext:(CGContextRef)aContext

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

@ -41,6 +41,9 @@ typedef struct _nsCocoaWindowList {
NSColor* mActiveTitlebarColor;
NSColor* mInactiveTitlebarColor;
// Shadow
BOOL mScheduledShadowInvalidation;
// Invalidation disabling
BOOL mDisabledNeedsDisplay;
@ -66,6 +69,8 @@ typedef struct _nsCocoaWindowList {
- (void)setTitlebarColor:(NSColor*)aColor forActiveWindow:(BOOL)aActive;
- (NSColor*)titlebarColorForActiveWindow:(BOOL)aActive;
- (void)deferredInvalidateShadow;
- (void)invalidateShadow;
- (float)getDPI;
- (void)mouseEntered:(NSEvent*)aEvent;
@ -310,8 +315,6 @@ public:
virtual nsTransparencyMode GetTransparencyMode() override;
virtual void SetTransparencyMode(nsTransparencyMode aMode) override;
virtual void SetWindowShadowStyle(int32_t aStyle) override;
virtual void SetWindowOpacity(float aOpacity) override;
virtual void SetWindowTransform(const mozilla::gfx::Matrix& aTransform) override;
virtual void SetShowsToolbarButton(bool aShow) override;
virtual void SetShowsFullScreenButton(bool aShow) override;
virtual void SetWindowAnimationType(WindowAnimationType aType) override;
@ -415,7 +418,6 @@ protected:
bool mInReportMoveEvent; // true if in a call to ReportMoveEvent().
bool mInResize; // true if in a call to DoResize().
bool mWindowTransformIsIdentity;
int32_t mNumModalDescendents;
InputContext mInputContext;

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

@ -36,7 +36,6 @@
#include "nsIPresShell.h"
#include "gfxPlatform.h"
#include "gfxPrefs.h"
#include "qcms.h"
#include "mozilla/AutoRestore.h"
@ -85,7 +84,6 @@ extern "C" {
extern CGSConnection _CGSDefaultConnection(void);
extern CGError CGSSetWindowShadowAndRimParameters(const CGSConnection cid, CGSWindow wid, float standardDeviation, float density, int offsetX, int offsetY, unsigned int flags);
extern CGError CGSSetWindowBackgroundBlurRadius(CGSConnection cid, CGSWindow wid, NSUInteger blur);
extern CGError CGSSetWindowTransform(CGSConnection cid, CGSWindow wid, CGAffineTransform transform);
}
#define NS_APPSHELLSERVICE_CONTRACTID "@mozilla.org/appshell/appShellService;1"
@ -129,7 +127,6 @@ nsCocoaWindow::nsCocoaWindow()
, mIsAnimationSuppressed(false)
, mInReportMoveEvent(false)
, mInResize(false)
, mWindowTransformIsIdentity(true)
, mNumModalDescendents(0)
{
if ([NSWindow respondsToSelector:@selector(setAllowsAutomaticWindowTabbing:)]) {
@ -2167,89 +2164,6 @@ nsCocoaWindow::SetWindowShadowStyle(int32_t aStyle)
NS_OBJC_END_TRY_ABORT_BLOCK;
}
void
nsCocoaWindow::SetWindowOpacity(float aOpacity)
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
if (!mWindow) {
return;
}
[mWindow setAlphaValue:(CGFloat)aOpacity];
NS_OBJC_END_TRY_ABORT_BLOCK;
}
static inline CGAffineTransform
GfxMatrixToCGAffineTransform(const gfx::Matrix& m)
{
CGAffineTransform t;
t.a = m._11;
t.b = m._12;
t.c = m._21;
t.d = m._22;
t.tx = m._31;
t.ty = m._32;
return t;
}
void
nsCocoaWindow::SetWindowTransform(const gfx::Matrix& aTransform)
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
if (!mWindow) {
return;
}
if (gfxPrefs::WindowTransformsDisabled()) {
// CGSSetWindowTransform is a private API. In case calling it causes
// problems either now or in the future, we'll want to have an easy kill
// switch. So we allow disabling it with a pref.
return;
}
gfx::Matrix transform = aTransform;
// aTransform is a transform that should be applied to the window relative
// to its regular position: If aTransform._31 is 100, then we want the
// window to be displayed 100 pixels to the right of its regular position.
// The transform that CGSSetWindowTransform accepts has a different meaning:
// It's used to answer the question "For the screen pixel at x,y (with the
// origin at the top left), what pixel in the window's buffer (again with
// origin top left) should be displayed at that position?"
// In the example above, this means that we need to call
// CGSSetWindowTransform with a horizontal translation of -windowPos.x - 100.
// So we need to invert the transform and adjust it by the window's position.
if (!transform.Invert()) {
// Treat non-invertible transforms as the identity transform.
transform = gfx::Matrix();
}
bool isIdentity = transform.IsIdentity();
if (isIdentity && mWindowTransformIsIdentity) {
return;
}
transform.PreTranslate(-mBounds.x, -mBounds.y);
// We also need to account for the backing scale factor: aTransform is given
// in device pixels, but CGSSetWindowTransform works with logical display
// pixels.
CGFloat backingScale = BackingScaleFactor();
transform.PreScale(backingScale, backingScale);
transform.PostScale(1 / backingScale, 1 / backingScale);
CGSConnection cid = _CGSDefaultConnection();
CGSSetWindowTransform(cid, [mWindow windowNumber],
GfxMatrixToCGAffineTransform(transform));
mWindowTransformIsIdentity = isIdentity;
NS_OBJC_END_TRY_ABORT_BLOCK;
}
void nsCocoaWindow::SetShowsToolbarButton(bool aShow)
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
@ -3000,6 +2914,7 @@ static NSMutableSet *gSwizzledFrameViewClasses = nil;
mState = nil;
mActiveTitlebarColor = nil;
mInactiveTitlebarColor = nil;
mScheduledShadowInvalidation = NO;
mDisabledNeedsDisplay = NO;
mDPI = GetDPI(self);
mTrackingArea = nil;
@ -3149,6 +3064,21 @@ static const NSString* kStateCollectionBehavior = @"collectionBehavior";
return aActive ? mActiveTitlebarColor : mInactiveTitlebarColor;
}
- (void)deferredInvalidateShadow
{
if (mScheduledShadowInvalidation || [self isOpaque] || ![self hasShadow])
return;
[self performSelector:@selector(invalidateShadow) withObject:nil afterDelay:0];
mScheduledShadowInvalidation = YES;
}
- (void)invalidateShadow
{
[super invalidateShadow];
mScheduledShadowInvalidation = NO;
}
- (float)getDPI
{
return mDPI;

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

@ -1105,22 +1105,6 @@ class nsIWidget : public nsISupports
*/
virtual void SetWindowShadowStyle(int32_t aStyle) = 0;
/**
* Set the opacity of the window.
* Values need to be between 0.0f (invisible) and 1.0f (fully opaque).
*
* Ignored on child widgets and on non-Mac platforms.
*/
virtual void SetWindowOpacity(float aOpacity) {}
/**
* Set the transform of the window. Values are in device pixels,
* the origin is the top left corner of the window.
*
* Ignored on child widgets and on non-Mac platforms.
*/
virtual void SetWindowTransform(const mozilla::gfx::Matrix& aTransform) {}
/*
* On Mac OS X, this method shows or hides the pill button in the titlebar
* that's used to collapse the toolbar.