Bug 944836 - Add CSS property -moz-window-dragging: drag | no-drag. r=dbaron
authorMarkus Stange <mstange@themasta.com>
Thu, 18 Sep 2014 10:52:25 +0200
changeset 206027 aa6432518ad1
parent 206026 0d0aeccf45d9
child 206028 1c9e801f66aa
push id27511
push userkwierso@gmail.com
push dateThu, 18 Sep 2014 22:38:08 +0000
treeherdermozilla-central@c8e325eee9e1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdbaron
bugs944836
milestone35.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 944836 - Add CSS property -moz-window-dragging: drag | no-drag. r=dbaron
layout/style/nsCSSKeywordList.h
layout/style/nsCSSPropList.h
layout/style/nsCSSProps.cpp
layout/style/nsCSSProps.h
layout/style/nsComputedDOMStyle.cpp
layout/style/nsComputedDOMStyle.h
layout/style/nsComputedDOMStylePropertyList.h
layout/style/nsRuleNode.cpp
layout/style/nsStyleConsts.h
layout/style/nsStyleStruct.cpp
layout/style/nsStyleStruct.h
layout/style/test/property_database.js
--- a/layout/style/nsCSSKeywordList.h
+++ b/layout/style/nsCSSKeywordList.h
@@ -225,16 +225,17 @@ CSS_KEY(digits, digits)
 CSS_KEY(disabled, disabled)
 CSS_KEY(disc, disc)
 CSS_KEY(disclosure-closed, disclosure_closed)
 CSS_KEY(disclosure-open, disclosure_open)
 CSS_KEY(discretionary-ligatures, discretionary_ligatures)
 CSS_KEY(dotted, dotted)
 CSS_KEY(double, double)
 CSS_KEY(double-struck, double_struck)
+CSS_KEY(drag, drag)
 CSS_KEY(drop-shadow, drop_shadow)
 CSS_KEY(e-resize, e_resize)
 CSS_KEY(ease, ease)
 CSS_KEY(ease-in, ease_in)
 CSS_KEY(ease-in-out, ease_in_out)
 CSS_KEY(ease-out, ease_out)
 CSS_KEY(element, element)
 CSS_KEY(elements, elements)
@@ -365,16 +366,17 @@ CSS_KEY(multiply, multiply)
 CSS_KEY(n-resize, n_resize)
 CSS_KEY(narrower, narrower)
 CSS_KEY(ne-resize, ne_resize)
 CSS_KEY(nesw-resize, nesw_resize)
 CSS_KEY(no-close-quote, no_close_quote)
 CSS_KEY(no-common-ligatures, no_common_ligatures)
 CSS_KEY(no-contextual, no_contextual)
 CSS_KEY(no-discretionary-ligatures, no_discretionary_ligatures)
+CSS_KEY(no-drag, no_drag)
 CSS_KEY(no-drop, no_drop)
 CSS_KEY(no-historical-ligatures, no_historical_ligatures)
 CSS_KEY(no-open-quote, no_open_quote)
 CSS_KEY(no-repeat, no_repeat)
 CSS_KEY(none, none)
 CSS_KEY(normal, normal)
 CSS_KEY(not-allowed, not_allowed)
 CSS_KEY(nowrap, nowrap)
--- a/layout/style/nsCSSPropList.h
+++ b/layout/style/nsCSSPropList.h
@@ -3381,16 +3381,26 @@ CSS_PROP_POSITION(
         CSS_PROPERTY_STORES_CALC |
         CSS_PROPERTY_UNITLESS_LENGTH_QUIRK |
         CSS_PROPERTY_GETCS_NEEDS_LAYOUT_FLUSH,
     "",
     VARIANT_AHKLP | VARIANT_CALC,
     kWidthKTable,
     offsetof(nsStylePosition, mWidth),
     eStyleAnimType_Coord)
+CSS_PROP_USERINTERFACE(
+    -moz-window-dragging,
+    _moz_window_dragging,
+    CSS_PROP_DOMPROP_PREFIXED(WindowDragging),
+    CSS_PROPERTY_PARSE_VALUE,
+    "",
+    VARIANT_HK,
+    kWindowDraggingKTable,
+    CSS_PROP_NO_OFFSET,
+    eStyleAnimType_None)
 CSS_PROP_UIRESET(
     -moz-window-shadow,
     _moz_window_shadow,
     CSS_PROP_DOMPROP_PREFIXED(WindowShadow),
     CSS_PROPERTY_PARSE_VALUE,
     "",
     VARIANT_HK,
     kWindowShadowKTable,
--- a/layout/style/nsCSSProps.cpp
+++ b/layout/style/nsCSSProps.cpp
@@ -1777,16 +1777,22 @@ const KTableValue nsCSSProps::kWhitespac
 const KTableValue nsCSSProps::kWidthKTable[] = {
   eCSSKeyword__moz_max_content, NS_STYLE_WIDTH_MAX_CONTENT,
   eCSSKeyword__moz_min_content, NS_STYLE_WIDTH_MIN_CONTENT,
   eCSSKeyword__moz_fit_content, NS_STYLE_WIDTH_FIT_CONTENT,
   eCSSKeyword__moz_available, NS_STYLE_WIDTH_AVAILABLE,
   eCSSKeyword_UNKNOWN,-1
 };
 
+const KTableValue nsCSSProps::kWindowDraggingKTable[] = {
+  eCSSKeyword_drag, NS_STYLE_WINDOW_DRAGGING_DRAG,
+  eCSSKeyword_no_drag, NS_STYLE_WINDOW_DRAGGING_NO_DRAG,
+  eCSSKeyword_UNKNOWN,-1
+};
+
 const KTableValue nsCSSProps::kWindowShadowKTable[] = {
   eCSSKeyword_none, NS_STYLE_WINDOW_SHADOW_NONE,
   eCSSKeyword_default, NS_STYLE_WINDOW_SHADOW_DEFAULT,
   eCSSKeyword_menu, NS_STYLE_WINDOW_SHADOW_MENU,
   eCSSKeyword_tooltip, NS_STYLE_WINDOW_SHADOW_TOOLTIP,
   eCSSKeyword_sheet, NS_STYLE_WINDOW_SHADOW_SHEET,
   eCSSKeyword_UNKNOWN,-1
 };
--- a/layout/style/nsCSSProps.h
+++ b/layout/style/nsCSSProps.h
@@ -645,16 +645,17 @@ public:
   static const KTableValue kUserInputKTable[];
   static const KTableValue kUserModifyKTable[];
   static const KTableValue kUserSelectKTable[];
   static const KTableValue kVerticalAlignKTable[];
   static const KTableValue kVisibilityKTable[];
   static const KTableValue kVolumeKTable[];
   static const KTableValue kWhitespaceKTable[];
   static const KTableValue kWidthKTable[]; // also min-width, max-width
+  static const KTableValue kWindowDraggingKTable[];
   static const KTableValue kWindowShadowKTable[];
   static const KTableValue kWordBreakKTable[];
   static const KTableValue kWordWrapKTable[];
   static const KTableValue kWritingModeKTable[];
   static const KTableValue kHyphensKTable[];
   static const KTableValue kCounterSystemKTable[];
   static const KTableValue kCounterRangeKTable[];
   static const KTableValue kCounterSpeakAsKTable[];
--- a/layout/style/nsComputedDOMStyle.cpp
+++ b/layout/style/nsComputedDOMStyle.cpp
@@ -3294,16 +3294,26 @@ nsComputedDOMStyle::DoGetWhiteSpace()
   nsROCSSPrimitiveValue *val = new nsROCSSPrimitiveValue;
   val->SetIdent(
     nsCSSProps::ValueToKeywordEnum(StyleText()->mWhiteSpace,
                                    nsCSSProps::kWhitespaceKTable));
   return val;
 }
 
 CSSValue*
+nsComputedDOMStyle::DoGetWindowDragging()
+{
+  nsROCSSPrimitiveValue *val = new nsROCSSPrimitiveValue;
+  val->SetIdent(
+    nsCSSProps::ValueToKeywordEnum(StyleUserInterface()->mWindowDragging,
+                                   nsCSSProps::kWindowDraggingKTable));
+  return val;
+}
+
+CSSValue*
 nsComputedDOMStyle::DoGetWindowShadow()
 {
   nsROCSSPrimitiveValue *val = new nsROCSSPrimitiveValue;
   val->SetIdent(
     nsCSSProps::ValueToKeywordEnum(StyleUIReset()->mWindowShadow,
                                    nsCSSProps::kWindowShadowKTable));
   return val;
 }
--- a/layout/style/nsComputedDOMStyle.h
+++ b/layout/style/nsComputedDOMStyle.h
@@ -433,16 +433,17 @@ private:
   /* User interface properties */
   mozilla::dom::CSSValue* DoGetCursor();
   mozilla::dom::CSSValue* DoGetForceBrokenImageIcon();
   mozilla::dom::CSSValue* DoGetIMEMode();
   mozilla::dom::CSSValue* DoGetUserFocus();
   mozilla::dom::CSSValue* DoGetUserInput();
   mozilla::dom::CSSValue* DoGetUserModify();
   mozilla::dom::CSSValue* DoGetUserSelect();
+  mozilla::dom::CSSValue* DoGetWindowDragging();
 
   /* Column properties */
   mozilla::dom::CSSValue* DoGetColumnCount();
   mozilla::dom::CSSValue* DoGetColumnFill();
   mozilla::dom::CSSValue* DoGetColumnWidth();
   mozilla::dom::CSSValue* DoGetColumnGap();
   mozilla::dom::CSSValue* DoGetColumnRuleWidth();
   mozilla::dom::CSSValue* DoGetColumnRuleStyle();
--- a/layout/style/nsComputedDOMStylePropertyList.h
+++ b/layout/style/nsComputedDOMStylePropertyList.h
@@ -269,16 +269,17 @@ COMPUTED_STYLE_PROP(text_align_last,    
 COMPUTED_STYLE_PROP(text_decoration_color,         TextDecorationColor)
 COMPUTED_STYLE_PROP(text_decoration_line,          TextDecorationLine)
 COMPUTED_STYLE_PROP(text_decoration_style,         TextDecorationStyle)
 COMPUTED_STYLE_PROP(text_size_adjust,              TextSizeAdjust)
 COMPUTED_STYLE_PROP(user_focus,                    UserFocus)
 COMPUTED_STYLE_PROP(user_input,                    UserInput)
 COMPUTED_STYLE_PROP(user_modify,                   UserModify)
 COMPUTED_STYLE_PROP(user_select,                   UserSelect)
+COMPUTED_STYLE_PROP(_moz_window_dragging,          WindowDragging)
 COMPUTED_STYLE_PROP(_moz_window_shadow,            WindowShadow)
 
 /* ***************************** *\
  * Implementations of SVG styles *
 \* ***************************** */
 
 COMPUTED_STYLE_PROP(clip_path,                     ClipPath)
 COMPUTED_STYLE_PROP(clip_rule,                     ClipRule)
--- a/layout/style/nsRuleNode.cpp
+++ b/layout/style/nsRuleNode.cpp
@@ -4623,16 +4623,23 @@ nsRuleNode::ComputeUserInterfaceData(voi
 
   // user-focus: enum, inherit, initial
   SetDiscrete(*aRuleData->ValueForUserFocus(),
               ui->mUserFocus, canStoreInRuleTree,
               SETDSC_ENUMERATED | SETDSC_UNSET_INHERIT,
               parentUI->mUserFocus,
               NS_STYLE_USER_FOCUS_NONE, 0, 0, 0, 0);
 
+  // -moz-window-dragging: enum, inherit, initial
+  SetDiscrete(*aRuleData->ValueForWindowDragging(),
+              ui->mWindowDragging, canStoreInRuleTree,
+              SETDSC_ENUMERATED | SETDSC_UNSET_INHERIT,
+              parentUI->mWindowDragging,
+              NS_STYLE_WINDOW_DRAGGING_NO_DRAG, 0, 0, 0, 0);
+
   COMPUTE_END_INHERITED(UserInterface, ui)
 }
 
 const void*
 nsRuleNode::ComputeUIResetData(void* aStartStruct,
                                const nsRuleData* aRuleData,
                                nsStyleContext* aContext,
                                nsRuleNode* aHighestNode,
--- a/layout/style/nsStyleConsts.h
+++ b/layout/style/nsStyleConsts.h
@@ -100,16 +100,20 @@ static inline mozilla::css::Side operato
 #define NS_STYLE_USER_INPUT_DISABLED  2
 #define NS_STYLE_USER_INPUT_AUTO      3
 
 // user-modify
 #define NS_STYLE_USER_MODIFY_READ_ONLY   0
 #define NS_STYLE_USER_MODIFY_READ_WRITE  1
 #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
+
 // box-align
 #define NS_STYLE_BOX_ALIGN_STRETCH     0
 #define NS_STYLE_BOX_ALIGN_START       1
 #define NS_STYLE_BOX_ALIGN_CENTER      2
 #define NS_STYLE_BOX_ALIGN_BASELINE    3
 #define NS_STYLE_BOX_ALIGN_END         4
 
 // box-pack
--- a/layout/style/nsStyleStruct.cpp
+++ b/layout/style/nsStyleStruct.cpp
@@ -3320,27 +3320,29 @@ nsCursorImage::operator=(const nsCursorI
 }
 
 nsStyleUserInterface::nsStyleUserInterface(void) 
 { 
   MOZ_COUNT_CTOR(nsStyleUserInterface);
   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
 
   mCursorArrayLength = 0;
   mCursorArray = nullptr;
 }
 
 nsStyleUserInterface::nsStyleUserInterface(const nsStyleUserInterface& aSource) :
   mUserInput(aSource.mUserInput),
   mUserModify(aSource.mUserModify),
   mUserFocus(aSource.mUserFocus),
+  mWindowDragging(aSource.mWindowDragging),
   mCursor(aSource.mCursor)
 { 
   MOZ_COUNT_CTOR(nsStyleUserInterface);
   CopyCursorArrayFrom(aSource);
 }
 
 nsStyleUserInterface::~nsStyleUserInterface(void) 
 { 
@@ -3370,16 +3372,20 @@ nsChangeHint nsStyleUserInterface::CalcD
       NS_UpdateHint(hint, nsChangeHint_NeutralChange);
     }
   }
 
   if (mUserFocus != aOther.mUserFocus) {
     NS_UpdateHint(hint, nsChangeHint_NeutralChange);
   }
 
+  if (mWindowDragging != aOther.mWindowDragging) {
+    NS_UpdateHint(hint, nsChangeHint_SchedulePaint);
+  }
+
   return hint;
 }
 
 void
 nsStyleUserInterface::CopyCursorArrayFrom(const nsStyleUserInterface& aSource)
 {
   mCursorArray = nullptr;
   mCursorArrayLength = 0;
--- a/layout/style/nsStyleStruct.h
+++ b/layout/style/nsStyleStruct.h
@@ -2593,16 +2593,17 @@ struct nsStyleUserInterface {
     // nsChangeHint_ClearAncestorIntrinsics as inherited hints.
     return NS_CombineHint(nsChangeHint_NeedReflow,
                           nsChangeHint_ClearAncestorIntrinsics);
   }
 
   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
 
   uint32_t mCursorArrayLength;
   nsCursorImage *mCursorArray;// [inherited] The specified URL values
                               //   and coordinates.  Takes precedence over
                               //   mCursor.  Zero-length array is represented
                               //   by null pointer.
--- a/layout/style/test/property_database.js
+++ b/layout/style/test/property_database.js
@@ -1778,16 +1778,24 @@ var gCSSProperties = {
   "-moz-user-select": {
     domProp: "MozUserSelect",
     inherited: false,
     type: CSS_TYPE_LONGHAND,
     initial_values: [ "auto" ],
     other_values: [ "none", "text", "element", "elements", "all", "toggle", "tri-state", "-moz-all", "-moz-none" ],
     invalid_values: []
   },
+  "-moz-window-dragging": {
+    domProp: "MozWindowDragging",
+    inherited: true,
+    type: CSS_TYPE_LONGHAND,
+    initial_values: [ "no-drag" ],
+    other_values: [ "drag" ],
+    invalid_values: [ "none" ]
+  },
   "-moz-window-shadow": {
     domProp: "MozWindowShadow",
     inherited: false,
     type: CSS_TYPE_LONGHAND,
     initial_values: [ "default" ],
     other_values: [ "none", "menu", "tooltip", "sheet" ],
     invalid_values: []
   },