зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1370034 - Add -moz-window-opacity property, style system parts (excluding stylo). r=dbaron
MozReview-Commit-ID: J2SPMzh0I9C --HG-- extra : rebase_source : b8c5f267f99fb7bab560af82a386cd3f3a9af5f3
This commit is contained in:
Родитель
6a5e557c75
Коммит
ccaf464b9e
|
@ -1501,6 +1501,20 @@ exports.CSS_PROPERTIES = {
|
||||||
"unset"
|
"unset"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"-moz-window-opacity": {
|
||||||
|
"isInherited": false,
|
||||||
|
"subproperties": [
|
||||||
|
"-moz-window-opacity"
|
||||||
|
],
|
||||||
|
"supports": [
|
||||||
|
7
|
||||||
|
],
|
||||||
|
"values": [
|
||||||
|
"inherit",
|
||||||
|
"initial",
|
||||||
|
"unset"
|
||||||
|
]
|
||||||
|
},
|
||||||
"-webkit-align-content": {
|
"-webkit-align-content": {
|
||||||
"isInherited": false,
|
"isInherited": false,
|
||||||
"subproperties": [
|
"subproperties": [
|
||||||
|
@ -3150,6 +3164,7 @@ exports.CSS_PROPERTIES = {
|
||||||
"will-change",
|
"will-change",
|
||||||
"-moz-window-dragging",
|
"-moz-window-dragging",
|
||||||
"-moz-window-shadow",
|
"-moz-window-shadow",
|
||||||
|
"-moz-window-opacity",
|
||||||
"word-break",
|
"word-break",
|
||||||
"word-spacing",
|
"word-spacing",
|
||||||
"overflow-wrap",
|
"overflow-wrap",
|
||||||
|
|
|
@ -459,6 +459,7 @@ RestyleManager::ChangeHintToString(nsChangeHint aHint)
|
||||||
"ReflowChangesSizeOrPosition", "UpdateComputedBSize",
|
"ReflowChangesSizeOrPosition", "UpdateComputedBSize",
|
||||||
"UpdateUsesOpacity", "UpdateBackgroundPosition",
|
"UpdateUsesOpacity", "UpdateBackgroundPosition",
|
||||||
"AddOrRemoveTransform", "CSSOverflowChange",
|
"AddOrRemoveTransform", "CSSOverflowChange",
|
||||||
|
"UpdateWidgetProperties"
|
||||||
};
|
};
|
||||||
static_assert(nsChangeHint_AllHints == (1 << ArrayLength(names)) - 1,
|
static_assert(nsChangeHint_AllHints == (1 << ArrayLength(names)) - 1,
|
||||||
"Name list doesn't match change hints.");
|
"Name list doesn't match change hints.");
|
||||||
|
@ -1713,6 +1714,9 @@ RestyleManager::ProcessRestyledFrames(nsStyleChangeList& aChangeList)
|
||||||
presContext->PresShell()->SynthesizeMouseMove(false);
|
presContext->PresShell()->SynthesizeMouseMove(false);
|
||||||
didUpdateCursor = true;
|
didUpdateCursor = true;
|
||||||
}
|
}
|
||||||
|
if (hint & nsChangeHint_UpdateWidgetProperties) {
|
||||||
|
frame->UpdateWidgetProperties();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -232,6 +232,12 @@ enum nsChangeHint : uint32_t {
|
||||||
*/
|
*/
|
||||||
nsChangeHint_CSSOverflowChange = 1 << 28,
|
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
|
// IMPORTANT NOTE: When adding a new hint, you will need to add it to
|
||||||
// one of:
|
// one of:
|
||||||
//
|
//
|
||||||
|
@ -247,7 +253,7 @@ enum nsChangeHint : uint32_t {
|
||||||
/**
|
/**
|
||||||
* Dummy hint value for all hints. It exists for compile time check.
|
* Dummy hint value for all hints. It exists for compile time check.
|
||||||
*/
|
*/
|
||||||
nsChangeHint_AllHints = (1 << 29) - 1,
|
nsChangeHint_AllHints = (1 << 30) - 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
// Redefine these operators to return nothing. This will catch any use
|
// Redefine these operators to return nothing. This will catch any use
|
||||||
|
@ -349,7 +355,8 @@ inline nsChangeHint operator^=(nsChangeHint& aLeft, nsChangeHint aRight)
|
||||||
nsChangeHint_UpdatePostTransformOverflow | \
|
nsChangeHint_UpdatePostTransformOverflow | \
|
||||||
nsChangeHint_UpdateTransformLayer | \
|
nsChangeHint_UpdateTransformLayer | \
|
||||||
nsChangeHint_UpdateUsesOpacity | \
|
nsChangeHint_UpdateUsesOpacity | \
|
||||||
nsChangeHint_AddOrRemoveTransform \
|
nsChangeHint_AddOrRemoveTransform | \
|
||||||
|
nsChangeHint_UpdateWidgetProperties \
|
||||||
)
|
)
|
||||||
|
|
||||||
// The change hints that are sometimes considered to be handled for descendants.
|
// The change hints that are sometimes considered to be handled for descendants.
|
||||||
|
|
|
@ -3934,6 +3934,8 @@ public:
|
||||||
*/
|
*/
|
||||||
bool IsScrolledOutOfView();
|
bool IsScrolledOutOfView();
|
||||||
|
|
||||||
|
virtual void UpdateWidgetProperties() {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return true iff this frame has one or more associated image requests.
|
* @return true iff this frame has one or more associated image requests.
|
||||||
* @see mozilla::css::ImageLoader.
|
* @see mozilla::css::ImageLoader.
|
||||||
|
|
|
@ -4494,6 +4494,16 @@ CSS_PROP_UIRESET(
|
||||||
kWindowShadowKTable,
|
kWindowShadowKTable,
|
||||||
CSS_PROP_NO_OFFSET,
|
CSS_PROP_NO_OFFSET,
|
||||||
eStyleAnimType_None)
|
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)
|
||||||
#endif // CSS_PROP_LIST_EXCLUDE_INTERNAL
|
#endif // CSS_PROP_LIST_EXCLUDE_INTERNAL
|
||||||
CSS_PROP_TEXT(
|
CSS_PROP_TEXT(
|
||||||
word-break,
|
word-break,
|
||||||
|
|
|
@ -4226,6 +4226,14 @@ nsComputedDOMStyle::DoGetWindowShadow()
|
||||||
return val.forget();
|
return val.forget();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
already_AddRefed<CSSValue>
|
||||||
|
nsComputedDOMStyle::DoGetWindowOpacity()
|
||||||
|
{
|
||||||
|
RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
|
||||||
|
val->SetNumber(StyleUIReset()->mWindowOpacity);
|
||||||
|
return val.forget();
|
||||||
|
}
|
||||||
|
|
||||||
already_AddRefed<CSSValue>
|
already_AddRefed<CSSValue>
|
||||||
nsComputedDOMStyle::DoGetWordBreak()
|
nsComputedDOMStyle::DoGetWordBreak()
|
||||||
{
|
{
|
||||||
|
|
|
@ -528,6 +528,7 @@ private:
|
||||||
already_AddRefed<CSSValue> DoGetUserModify();
|
already_AddRefed<CSSValue> DoGetUserModify();
|
||||||
already_AddRefed<CSSValue> DoGetUserSelect();
|
already_AddRefed<CSSValue> DoGetUserSelect();
|
||||||
already_AddRefed<CSSValue> DoGetWindowDragging();
|
already_AddRefed<CSSValue> DoGetWindowDragging();
|
||||||
|
already_AddRefed<CSSValue> DoGetWindowOpacity();
|
||||||
|
|
||||||
/* Column properties */
|
/* Column properties */
|
||||||
already_AddRefed<CSSValue> DoGetColumnCount();
|
already_AddRefed<CSSValue> DoGetColumnCount();
|
||||||
|
|
|
@ -305,6 +305,7 @@ COMPUTED_STYLE_PROP(_moz_user_modify, UserModify)
|
||||||
COMPUTED_STYLE_PROP(_moz_user_select, UserSelect)
|
COMPUTED_STYLE_PROP(_moz_user_select, UserSelect)
|
||||||
COMPUTED_STYLE_PROP(_moz_window_dragging, WindowDragging)
|
COMPUTED_STYLE_PROP(_moz_window_dragging, WindowDragging)
|
||||||
COMPUTED_STYLE_PROP(_moz_window_shadow, WindowShadow)
|
COMPUTED_STYLE_PROP(_moz_window_shadow, WindowShadow)
|
||||||
|
COMPUTED_STYLE_PROP(_moz_window_opacity, WindowOpacity)
|
||||||
|
|
||||||
/* ********************************** *\
|
/* ********************************** *\
|
||||||
* Implementations of -webkit- styles *
|
* Implementations of -webkit- styles *
|
||||||
|
|
|
@ -5275,6 +5275,12 @@ nsRuleNode::ComputeUIResetData(void* aStartStruct,
|
||||||
parentUI->mWindowShadow,
|
parentUI->mWindowShadow,
|
||||||
NS_STYLE_WINDOW_SHADOW_DEFAULT);
|
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);
|
||||||
|
|
||||||
COMPUTE_END_RESET(UIReset, ui)
|
COMPUTE_END_RESET(UIReset, ui)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4326,6 +4326,7 @@ nsStyleUIReset::nsStyleUIReset(const nsPresContext* aContext)
|
||||||
, mIMEMode(NS_STYLE_IME_MODE_AUTO)
|
, mIMEMode(NS_STYLE_IME_MODE_AUTO)
|
||||||
, mWindowDragging(StyleWindowDragging::Default)
|
, mWindowDragging(StyleWindowDragging::Default)
|
||||||
, mWindowShadow(NS_STYLE_WINDOW_SHADOW_DEFAULT)
|
, mWindowShadow(NS_STYLE_WINDOW_SHADOW_DEFAULT)
|
||||||
|
, mWindowOpacity(1.0)
|
||||||
{
|
{
|
||||||
MOZ_COUNT_CTOR(nsStyleUIReset);
|
MOZ_COUNT_CTOR(nsStyleUIReset);
|
||||||
}
|
}
|
||||||
|
@ -4336,6 +4337,7 @@ nsStyleUIReset::nsStyleUIReset(const nsStyleUIReset& aSource)
|
||||||
, mIMEMode(aSource.mIMEMode)
|
, mIMEMode(aSource.mIMEMode)
|
||||||
, mWindowDragging(aSource.mWindowDragging)
|
, mWindowDragging(aSource.mWindowDragging)
|
||||||
, mWindowShadow(aSource.mWindowShadow)
|
, mWindowShadow(aSource.mWindowShadow)
|
||||||
|
, mWindowOpacity(aSource.mWindowOpacity)
|
||||||
{
|
{
|
||||||
MOZ_COUNT_CTOR(nsStyleUIReset);
|
MOZ_COUNT_CTOR(nsStyleUIReset);
|
||||||
}
|
}
|
||||||
|
@ -4348,29 +4350,35 @@ nsStyleUIReset::~nsStyleUIReset()
|
||||||
nsChangeHint
|
nsChangeHint
|
||||||
nsStyleUIReset::CalcDifference(const nsStyleUIReset& aNewData) const
|
nsStyleUIReset::CalcDifference(const nsStyleUIReset& aNewData) const
|
||||||
{
|
{
|
||||||
// ignore mIMEMode
|
nsChangeHint hint = nsChangeHint(0);
|
||||||
|
|
||||||
if (mForceBrokenImageIcon != aNewData.mForceBrokenImageIcon) {
|
if (mForceBrokenImageIcon != aNewData.mForceBrokenImageIcon) {
|
||||||
return nsChangeHint_ReconstructFrame;
|
hint |= nsChangeHint_ReconstructFrame;
|
||||||
}
|
}
|
||||||
if (mWindowShadow != aNewData.mWindowShadow) {
|
if (mWindowShadow != aNewData.mWindowShadow) {
|
||||||
// We really need just an nsChangeHint_SyncFrameView, except
|
// We really need just an nsChangeHint_SyncFrameView, except
|
||||||
// on an ancestor of the frame, so we get that by doing a
|
// on an ancestor of the frame, so we get that by doing a
|
||||||
// reflow.
|
// reflow.
|
||||||
return NS_STYLE_HINT_REFLOW;
|
hint |= NS_STYLE_HINT_REFLOW;
|
||||||
}
|
}
|
||||||
if (mUserSelect != aNewData.mUserSelect) {
|
if (mUserSelect != aNewData.mUserSelect) {
|
||||||
return NS_STYLE_HINT_VISUAL;
|
hint |= NS_STYLE_HINT_VISUAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mWindowDragging != aNewData.mWindowDragging) {
|
if (mWindowDragging != aNewData.mWindowDragging) {
|
||||||
return nsChangeHint_SchedulePaint;
|
hint |= nsChangeHint_SchedulePaint;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mIMEMode != aNewData.mIMEMode) {
|
if (mWindowOpacity != aNewData.mWindowOpacity) {
|
||||||
return nsChangeHint_NeutralChange;
|
hint |= nsChangeHint_UpdateWidgetProperties;
|
||||||
}
|
}
|
||||||
|
|
||||||
return nsChangeHint(0);
|
if (!hint &&
|
||||||
|
mIMEMode != aNewData.mIMEMode) {
|
||||||
|
hint |= nsChangeHint_NeutralChange;
|
||||||
|
}
|
||||||
|
|
||||||
|
return hint;
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------
|
//-----------------------
|
||||||
|
|
|
@ -3228,6 +3228,7 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleUIReset
|
||||||
uint8_t mIMEMode; // [reset]
|
uint8_t mIMEMode; // [reset]
|
||||||
mozilla::StyleWindowDragging mWindowDragging; // [reset]
|
mozilla::StyleWindowDragging mWindowDragging; // [reset]
|
||||||
uint8_t mWindowShadow; // [reset]
|
uint8_t mWindowShadow; // [reset]
|
||||||
|
float mWindowOpacity; // [reset]
|
||||||
};
|
};
|
||||||
|
|
||||||
struct nsCursorImage
|
struct nsCursorImage
|
||||||
|
|
|
@ -115,6 +115,7 @@ const char *gInaccessibleProperties[] = {
|
||||||
"-moz-math-display", // parsed by UA sheets only
|
"-moz-math-display", // parsed by UA sheets only
|
||||||
"-moz-top-layer", // parsed by UA sheets only
|
"-moz-top-layer", // parsed by UA sheets only
|
||||||
"-moz-min-font-size-ratio", // parsed by UA sheets only
|
"-moz-min-font-size-ratio", // parsed by UA sheets only
|
||||||
|
"-moz-window-opacity", // chrome-only internal properties
|
||||||
"-moz-window-shadow" // chrome-only internal properties
|
"-moz-window-shadow" // chrome-only internal properties
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -7905,6 +7905,15 @@ if (false) {
|
||||||
invalid_values: []
|
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-context-properties"] = {
|
gCSSProperties["-moz-context-properties"] = {
|
||||||
//domProp: "MozContextProperties",
|
//domProp: "MozContextProperties",
|
||||||
inherited: true,
|
inherited: true,
|
||||||
|
|
Загрузка…
Ссылка в новой задаче