зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1241275 - Change the way -moz-window-dragging works. r=heycam,roc
This adds the value -moz-window-dragging: default as the initial value of the property, and makes it a [reset] property. This allows us to change the way the window dragging region is calculated: Elements with -moz-window-dragging: no-drag will now always be undraggable, even if they are overlapped by -moz-window-dragging: drag elements. That way we can keep the region calculation simple and don't have to add code to respect z-ordering. --HG-- extra : commitid : GX3ApAyzKi7 extra : rebase_source : 61cab4e535c6c5da75fe79eb1886b6c5b7d136ea extra : amend_source : 0f461782b8f65eca1009c2f6c192b5b80b908233
This commit is contained in:
Родитель
43657b1388
Коммит
77d52c0a79
|
@ -1181,6 +1181,13 @@ nsDisplayListBuilder::AdjustWindowDraggingRegion(nsIFrame* aFrame)
|
|||
return;
|
||||
}
|
||||
|
||||
const nsStyleUIReset* styleUI = aFrame->StyleUIReset();
|
||||
if (styleUI->mWindowDragging == NS_STYLE_WINDOW_DRAGGING_DEFAULT) {
|
||||
// This frame has the default value and doesn't influence the window
|
||||
// dragging region.
|
||||
return;
|
||||
}
|
||||
|
||||
LayoutDeviceToLayoutDeviceMatrix4x4 referenceFrameToRootReferenceFrame;
|
||||
|
||||
// The const_cast is for nsLayoutUtils::GetTransformToAncestor.
|
||||
|
@ -1230,16 +1237,23 @@ nsDisplayListBuilder::AdjustWindowDraggingRegion(nsIFrame* aFrame)
|
|||
transformedDevPixelBorderBox.Round();
|
||||
LayoutDeviceIntRect transformedDevPixelBorderBoxInt;
|
||||
if (transformedDevPixelBorderBox.ToIntRect(&transformedDevPixelBorderBoxInt)) {
|
||||
const nsStyleUserInterface* styleUI = aFrame->StyleUserInterface();
|
||||
if (styleUI->mWindowDragging == NS_STYLE_WINDOW_DRAGGING_DRAG) {
|
||||
mWindowDraggingRegion.OrWith(transformedDevPixelBorderBoxInt);
|
||||
} else {
|
||||
mWindowDraggingRegion.SubOut(transformedDevPixelBorderBoxInt);
|
||||
mWindowNoDraggingRegion.OrWith(transformedDevPixelBorderBoxInt);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
LayoutDeviceIntRegion
|
||||
nsDisplayListBuilder::GetWindowDraggingRegion() const
|
||||
{
|
||||
LayoutDeviceIntRegion result;
|
||||
result.Sub(mWindowDraggingRegion, mWindowNoDraggingRegion);;
|
||||
return result;
|
||||
}
|
||||
|
||||
const uint32_t gWillChangeAreaMultiplier = 3;
|
||||
static uint32_t GetWillChangeCost(const nsSize& aSize) {
|
||||
// There's significant overhead for each layer created from Gecko
|
||||
|
|
|
@ -614,11 +614,12 @@ public:
|
|||
* Adjusts mWindowDraggingRegion to take into account aFrame. If aFrame's
|
||||
* -moz-window-dragging value is |drag|, its border box is added to the
|
||||
* collected dragging region; if the value is |no-drag|, the border box is
|
||||
* subtracted from the region.
|
||||
* subtracted from the region; if the value is |default|, that frame does
|
||||
* not influence the window dragging region.
|
||||
*/
|
||||
void AdjustWindowDraggingRegion(nsIFrame* aFrame);
|
||||
|
||||
const LayoutDeviceIntRegion& GetWindowDraggingRegion() { return mWindowDraggingRegion; }
|
||||
LayoutDeviceIntRegion GetWindowDraggingRegion() const;
|
||||
|
||||
/**
|
||||
* Allocate memory in our arena. It will only be freed when this display list
|
||||
|
@ -1227,6 +1228,7 @@ private:
|
|||
nsRegion mWindowExcludeGlassRegion;
|
||||
nsRegion mWindowOpaqueRegion;
|
||||
LayoutDeviceIntRegion mWindowDraggingRegion;
|
||||
LayoutDeviceIntRegion mWindowNoDraggingRegion;
|
||||
// The display item for the Windows window glass background, if any
|
||||
nsDisplayItem* mGlassDisplayItem;
|
||||
// When encountering inactive layers, we need to hoist scroll info items
|
||||
|
|
|
@ -3674,7 +3674,7 @@ CSS_PROP_POSITION(
|
|||
kWidthKTable,
|
||||
offsetof(nsStylePosition, mWidth),
|
||||
eStyleAnimType_Coord)
|
||||
CSS_PROP_USERINTERFACE(
|
||||
CSS_PROP_UIRESET(
|
||||
-moz-window-dragging,
|
||||
_moz_window_dragging,
|
||||
CSS_PROP_DOMPROP_PREFIXED(WindowDragging),
|
||||
|
|
|
@ -2116,6 +2116,7 @@ const KTableEntry nsCSSProps::kWidthKTable[] = {
|
|||
};
|
||||
|
||||
const KTableEntry nsCSSProps::kWindowDraggingKTable[] = {
|
||||
{ eCSSKeyword_default, NS_STYLE_WINDOW_DRAGGING_DEFAULT },
|
||||
{ eCSSKeyword_drag, NS_STYLE_WINDOW_DRAGGING_DRAG },
|
||||
{ eCSSKeyword_no_drag, NS_STYLE_WINDOW_DRAGGING_NO_DRAG },
|
||||
{ eCSSKeyword_UNKNOWN, -1 }
|
||||
|
|
|
@ -3844,7 +3844,7 @@ nsComputedDOMStyle::DoGetWindowDragging()
|
|||
{
|
||||
RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
|
||||
val->SetIdent(
|
||||
nsCSSProps::ValueToKeywordEnum(StyleUserInterface()->mWindowDragging,
|
||||
nsCSSProps::ValueToKeywordEnum(StyleUIReset()->mWindowDragging,
|
||||
nsCSSProps::kWindowDraggingKTable));
|
||||
return val.forget();
|
||||
}
|
||||
|
|
|
@ -4863,13 +4863,6 @@ nsRuleNode::ComputeUserInterfaceData(void* aStartStruct,
|
|||
parentUI->mUserFocus,
|
||||
NS_STYLE_USER_FOCUS_NONE, 0, 0, 0, 0);
|
||||
|
||||
// -moz-window-dragging: enum, inherit, initial
|
||||
SetDiscrete(*aRuleData->ValueForWindowDragging(),
|
||||
ui->mWindowDragging, conditions,
|
||||
SETDSC_ENUMERATED | SETDSC_UNSET_INHERIT,
|
||||
parentUI->mWindowDragging,
|
||||
NS_STYLE_WINDOW_DRAGGING_NO_DRAG, 0, 0, 0, 0);
|
||||
|
||||
COMPUTE_END_INHERITED(UserInterface, ui)
|
||||
}
|
||||
|
||||
|
@ -4905,6 +4898,13 @@ nsRuleNode::ComputeUIResetData(void* aStartStruct,
|
|||
parentUI->mForceBrokenImageIcon,
|
||||
0, 0, 0, 0, 0);
|
||||
|
||||
// -moz-window-dragging: enum, inherit, initial
|
||||
SetDiscrete(*aRuleData->ValueForWindowDragging(),
|
||||
ui->mWindowDragging, conditions,
|
||||
SETDSC_ENUMERATED | SETDSC_UNSET_INITIAL,
|
||||
parentUI->mWindowDragging,
|
||||
NS_STYLE_WINDOW_DRAGGING_DEFAULT, 0, 0, 0, 0);
|
||||
|
||||
// -moz-window-shadow: enum, inherit, initial
|
||||
SetDiscrete(*aRuleData->ValueForWindowShadow(),
|
||||
ui->mWindowShadow, conditions,
|
||||
|
|
|
@ -120,8 +120,9 @@ enum class StyleBoxSizing : uint8_t {
|
|||
#define NS_STYLE_USER_MODIFY_WRITE_ONLY 2
|
||||
|
||||
// -moz-window-dragging
|
||||
#define NS_STYLE_WINDOW_DRAGGING_DRAG 0
|
||||
#define NS_STYLE_WINDOW_DRAGGING_NO_DRAG 1
|
||||
#define NS_STYLE_WINDOW_DRAGGING_DEFAULT 0
|
||||
#define NS_STYLE_WINDOW_DRAGGING_DRAG 1
|
||||
#define NS_STYLE_WINDOW_DRAGGING_NO_DRAG 2
|
||||
|
||||
// box-align
|
||||
#define NS_STYLE_BOX_ALIGN_STRETCH 0
|
||||
|
|
|
@ -3789,7 +3789,6 @@ nsStyleUserInterface::nsStyleUserInterface(void)
|
|||
mUserInput = NS_STYLE_USER_INPUT_AUTO;
|
||||
mUserModify = NS_STYLE_USER_MODIFY_READ_ONLY;
|
||||
mUserFocus = NS_STYLE_USER_FOCUS_NONE;
|
||||
mWindowDragging = NS_STYLE_WINDOW_DRAGGING_NO_DRAG;
|
||||
|
||||
mCursor = NS_STYLE_CURSOR_AUTO; // fix for bugzilla bug 51113
|
||||
|
||||
|
@ -3801,7 +3800,6 @@ nsStyleUserInterface::nsStyleUserInterface(const nsStyleUserInterface& aSource)
|
|||
mUserInput(aSource.mUserInput),
|
||||
mUserModify(aSource.mUserModify),
|
||||
mUserFocus(aSource.mUserFocus),
|
||||
mWindowDragging(aSource.mWindowDragging),
|
||||
mCursor(aSource.mCursor)
|
||||
{
|
||||
MOZ_COUNT_CTOR(nsStyleUserInterface);
|
||||
|
@ -3841,10 +3839,6 @@ nsChangeHint nsStyleUserInterface::CalcDifference(const nsStyleUserInterface& aO
|
|||
NS_UpdateHint(hint, nsChangeHint_NeutralChange);
|
||||
}
|
||||
|
||||
if (mWindowDragging != aOther.mWindowDragging) {
|
||||
NS_UpdateHint(hint, nsChangeHint_SchedulePaint);
|
||||
}
|
||||
|
||||
return hint;
|
||||
}
|
||||
|
||||
|
@ -3873,6 +3867,7 @@ nsStyleUIReset::nsStyleUIReset(void)
|
|||
mUserSelect = NS_STYLE_USER_SELECT_AUTO;
|
||||
mForceBrokenImageIcon = 0;
|
||||
mIMEMode = NS_STYLE_IME_MODE_AUTO;
|
||||
mWindowDragging = NS_STYLE_WINDOW_DRAGGING_DEFAULT;
|
||||
mWindowShadow = NS_STYLE_WINDOW_SHADOW_DEFAULT;
|
||||
}
|
||||
|
||||
|
@ -3882,6 +3877,7 @@ nsStyleUIReset::nsStyleUIReset(const nsStyleUIReset& aSource)
|
|||
mUserSelect = aSource.mUserSelect;
|
||||
mForceBrokenImageIcon = aSource.mForceBrokenImageIcon;
|
||||
mIMEMode = aSource.mIMEMode;
|
||||
mWindowDragging = aSource.mWindowDragging;
|
||||
mWindowShadow = aSource.mWindowShadow;
|
||||
}
|
||||
|
||||
|
@ -3903,6 +3899,11 @@ nsChangeHint nsStyleUIReset::CalcDifference(const nsStyleUIReset& aOther) const
|
|||
}
|
||||
if (mUserSelect != aOther.mUserSelect)
|
||||
return NS_STYLE_HINT_VISUAL;
|
||||
|
||||
if (mWindowDragging != aOther.mWindowDragging) {
|
||||
return nsChangeHint_SchedulePaint;
|
||||
}
|
||||
|
||||
return NS_STYLE_HINT_NONE;
|
||||
}
|
||||
|
||||
|
|
|
@ -2951,6 +2951,7 @@ struct nsStyleUIReset
|
|||
uint8_t mUserSelect; // [reset] (selection-style)
|
||||
uint8_t mForceBrokenImageIcon; // [reset] (0 if not forcing, otherwise forcing)
|
||||
uint8_t mIMEMode; // [reset]
|
||||
uint8_t mWindowDragging; // [reset]
|
||||
uint8_t mWindowShadow; // [reset]
|
||||
};
|
||||
|
||||
|
@ -3017,7 +3018,6 @@ struct nsStyleUserInterface
|
|||
uint8_t mUserInput; // [inherited]
|
||||
uint8_t mUserModify; // [inherited] (modify-content)
|
||||
uint8_t mUserFocus; // [inherited] (auto-select)
|
||||
uint8_t mWindowDragging; // [inherited]
|
||||
|
||||
uint8_t mCursor; // [inherited] See nsStyleConsts.h
|
||||
|
||||
|
|
|
@ -4434,10 +4434,10 @@ var gCSSProperties = {
|
|||
},
|
||||
"-moz-window-dragging": {
|
||||
domProp: "MozWindowDragging",
|
||||
inherited: true,
|
||||
inherited: false,
|
||||
type: CSS_TYPE_LONGHAND,
|
||||
initial_values: [ "no-drag" ],
|
||||
other_values: [ "drag" ],
|
||||
initial_values: [ "default" ],
|
||||
other_values: [ "drag", "no-drag" ],
|
||||
invalid_values: [ "none" ]
|
||||
},
|
||||
"align-content": {
|
||||
|
|
Загрузка…
Ссылка в новой задаче