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:
Markus Stange 2017-06-18 21:04:40 -04:00
Родитель 6a5e557c75
Коммит ccaf464b9e
13 изменённых файлов: 83 добавлений и 10 удалений

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

@ -1501,6 +1501,20 @@ exports.CSS_PROPERTIES = {
"unset"
]
},
"-moz-window-opacity": {
"isInherited": false,
"subproperties": [
"-moz-window-opacity"
],
"supports": [
7
],
"values": [
"inherit",
"initial",
"unset"
]
},
"-webkit-align-content": {
"isInherited": false,
"subproperties": [
@ -3150,6 +3164,7 @@ exports.CSS_PROPERTIES = {
"will-change",
"-moz-window-dragging",
"-moz-window-shadow",
"-moz-window-opacity",
"word-break",
"word-spacing",
"overflow-wrap",

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

@ -459,6 +459,7 @@ 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.");
@ -1713,6 +1714,9 @@ RestyleManager::ProcessRestyledFrames(nsStyleChangeList& aChangeList)
presContext->PresShell()->SynthesizeMouseMove(false);
didUpdateCursor = true;
}
if (hint & nsChangeHint_UpdateWidgetProperties) {
frame->UpdateWidgetProperties();
}
}
}

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

@ -232,6 +232,12 @@ 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:
//
@ -247,7 +253,7 @@ enum nsChangeHint : uint32_t {
/**
* 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
@ -349,7 +355,8 @@ inline nsChangeHint operator^=(nsChangeHint& aLeft, nsChangeHint aRight)
nsChangeHint_UpdatePostTransformOverflow | \
nsChangeHint_UpdateTransformLayer | \
nsChangeHint_UpdateUsesOpacity | \
nsChangeHint_AddOrRemoveTransform \
nsChangeHint_AddOrRemoveTransform | \
nsChangeHint_UpdateWidgetProperties \
)
// The change hints that are sometimes considered to be handled for descendants.

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

@ -3934,6 +3934,8 @@ public:
*/
bool IsScrolledOutOfView();
virtual void UpdateWidgetProperties() {}
/**
* @return true iff this frame has one or more associated image requests.
* @see mozilla::css::ImageLoader.

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

@ -4494,6 +4494,16 @@ 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)
#endif // CSS_PROP_LIST_EXCLUDE_INTERNAL
CSS_PROP_TEXT(
word-break,

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

@ -4226,6 +4226,14 @@ 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::DoGetWordBreak()
{

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

@ -528,6 +528,7 @@ private:
already_AddRefed<CSSValue> DoGetUserModify();
already_AddRefed<CSSValue> DoGetUserSelect();
already_AddRefed<CSSValue> DoGetWindowDragging();
already_AddRefed<CSSValue> DoGetWindowOpacity();
/* Column properties */
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_window_dragging, WindowDragging)
COMPUTED_STYLE_PROP(_moz_window_shadow, WindowShadow)
COMPUTED_STYLE_PROP(_moz_window_opacity, WindowOpacity)
/* ********************************** *\
* Implementations of -webkit- styles *

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

@ -5275,6 +5275,12 @@ 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);
COMPUTE_END_RESET(UIReset, ui)
}

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

@ -4326,6 +4326,7 @@ nsStyleUIReset::nsStyleUIReset(const nsPresContext* aContext)
, mIMEMode(NS_STYLE_IME_MODE_AUTO)
, mWindowDragging(StyleWindowDragging::Default)
, mWindowShadow(NS_STYLE_WINDOW_SHADOW_DEFAULT)
, mWindowOpacity(1.0)
{
MOZ_COUNT_CTOR(nsStyleUIReset);
}
@ -4336,6 +4337,7 @@ nsStyleUIReset::nsStyleUIReset(const nsStyleUIReset& aSource)
, mIMEMode(aSource.mIMEMode)
, mWindowDragging(aSource.mWindowDragging)
, mWindowShadow(aSource.mWindowShadow)
, mWindowOpacity(aSource.mWindowOpacity)
{
MOZ_COUNT_CTOR(nsStyleUIReset);
}
@ -4348,29 +4350,35 @@ nsStyleUIReset::~nsStyleUIReset()
nsChangeHint
nsStyleUIReset::CalcDifference(const nsStyleUIReset& aNewData) const
{
// ignore mIMEMode
nsChangeHint hint = nsChangeHint(0);
if (mForceBrokenImageIcon != aNewData.mForceBrokenImageIcon) {
return nsChangeHint_ReconstructFrame;
hint |= 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.
return NS_STYLE_HINT_REFLOW;
hint |= NS_STYLE_HINT_REFLOW;
}
if (mUserSelect != aNewData.mUserSelect) {
return NS_STYLE_HINT_VISUAL;
hint |= NS_STYLE_HINT_VISUAL;
}
if (mWindowDragging != aNewData.mWindowDragging) {
return nsChangeHint_SchedulePaint;
hint |= nsChangeHint_SchedulePaint;
}
if (mIMEMode != aNewData.mIMEMode) {
return nsChangeHint_NeutralChange;
if (mWindowOpacity != aNewData.mWindowOpacity) {
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]
mozilla::StyleWindowDragging mWindowDragging; // [reset]
uint8_t mWindowShadow; // [reset]
float mWindowOpacity; // [reset]
};
struct nsCursorImage

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

@ -115,6 +115,7 @@ 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-shadow" // chrome-only internal properties
};

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

@ -7905,6 +7905,15 @@ 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-context-properties"] = {
//domProp: "MozContextProperties",
inherited: true,