diff --git a/content/base/src/nsStyleContext.cpp b/content/base/src/nsStyleContext.cpp index 7e147a9265e..436ba6f8b90 100644 --- a/content/base/src/nsStyleContext.cpp +++ b/content/base/src/nsStyleContext.cpp @@ -1496,16 +1496,33 @@ void StyleUserInterfaceImpl::ResetFrom(const nsStyleUserInterface* aParent, nsIP void StyleUserInterfaceImpl::SetFrom(const nsStyleUserInterface& aSource) { - nsCRT::memcpy((nsStyleUserInterface*)this, &aSource, sizeof(nsStyleUserInterface)); + mUserInput = aSource.mUserInput; + mUserModify = aSource.mUserModify; + mUserFocus = aSource.mUserFocus; + + mUserSelect = aSource.mUserSelect; + mKeyEquivalent = aSource.mKeyEquivalent; + mResizer = aSource.mResizer; + mBehavior = aSource.mBehavior; } void StyleUserInterfaceImpl::CopyTo(nsStyleUserInterface& aDest) const { - nsCRT::memcpy(&aDest, (const nsStyleUserInterface*)this, sizeof(nsStyleUserInterface)); + aDest.mUserInput = mUserInput; + aDest.mUserModify = mUserModify; + aDest.mUserFocus = mUserFocus; + + aDest.mUserSelect = mUserSelect; + aDest.mKeyEquivalent = mKeyEquivalent; + aDest.mResizer = mResizer; + aDest.mBehavior = mBehavior; } PRInt32 StyleUserInterfaceImpl::CalcDifference(const StyleUserInterfaceImpl& aOther) const { + if (mBehavior != aOther.mBehavior) + return NS_STYLE_HINT_FRAMECHANGE; + if ((mUserInput == aOther.mUserInput) && (mResizer == aOther.mResizer)) { if ((mUserModify == aOther.mUserModify) && diff --git a/content/html/style/src/nsCSSDeclaration.cpp b/content/html/style/src/nsCSSDeclaration.cpp index 362ace9cab0..806423123fa 100644 --- a/content/html/style/src/nsCSSDeclaration.cpp +++ b/content/html/style/src/nsCSSDeclaration.cpp @@ -796,7 +796,8 @@ nsCSSUserInterface::nsCSSUserInterface(const nsCSSUserInterface& aCopy) mUserSelect(aCopy.mUserSelect), mKeyEquivalent(nsnull), mUserFocus(aCopy.mUserFocus), - mResizer(aCopy.mResizer) + mResizer(aCopy.mResizer), + mBehavior(aCopy.mBehavior) { CSS_IF_COPY(mKeyEquivalent, nsCSSValueList); } @@ -827,6 +828,7 @@ void nsCSSUserInterface::List(FILE* out, PRInt32 aIndent) const } mUserFocus.AppendToString(buffer, eCSSProperty_user_focus); mResizer.AppendToString(buffer, eCSSProperty_resizer); + mBehavior.AppendToString(buffer, eCSSProperty_behavior); fputs(buffer, out); } @@ -1566,6 +1568,7 @@ CSSDeclarationImpl::AppendValue(nsCSSProperty aProperty, const nsCSSValue& aValu case eCSSProperty_key_equivalent: case eCSSProperty_user_focus: case eCSSProperty_resizer: + case eCSSProperty_behavior: CSS_ENSURE(UserInterface) { switch (aProperty) { case eCSSProperty_user_input: mUserInterface->mUserInput = aValue; break; @@ -1579,6 +1582,7 @@ CSSDeclarationImpl::AppendValue(nsCSSProperty aProperty, const nsCSSValue& aValu break; case eCSSProperty_user_focus: mUserInterface->mUserFocus = aValue; break; case eCSSProperty_resizer: mUserInterface->mResizer = aValue; break; + case eCSSProperty_behavior: mUserInterface->mBehavior = aValue; break; CSS_BOGUS_DEFAULT; // make compiler happy } } @@ -2269,6 +2273,7 @@ CSSDeclarationImpl::SetValueImportant(nsCSSProperty aProperty) case eCSSProperty_user_select: case eCSSProperty_user_focus: case eCSSProperty_resizer: + case eCSSProperty_behavior: if (nsnull != mUserInterface) { CSS_ENSURE_IMPORTANT(UserInterface) { switch (aProperty) { @@ -2277,6 +2282,7 @@ CSSDeclarationImpl::SetValueImportant(nsCSSProperty aProperty) CSS_CASE_IMPORTANT(eCSSProperty_user_select, mUserInterface->mUserSelect); CSS_CASE_IMPORTANT(eCSSProperty_user_focus, mUserInterface->mUserFocus); CSS_CASE_IMPORTANT(eCSSProperty_resizer, mUserInterface->mResizer); + CSS_CASE_IMPORTANT(eCSSProperty_behavior, mUserInterface->mBehavior); CSS_BOGUS_DEFAULT; // make compiler happy } } @@ -2954,6 +2960,7 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsCSSValue& aValue) case eCSSProperty_key_equivalent: case eCSSProperty_user_focus: case eCSSProperty_resizer: + case eCSSProperty_behavior: if (nsnull != mUserInterface) { switch (aProperty) { case eCSSProperty_user_input: aValue = mUserInterface->mUserInput; break; @@ -2966,6 +2973,8 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsCSSValue& aValue) break; case eCSSProperty_user_focus: aValue = mUserInterface->mUserFocus; break; case eCSSProperty_resizer: aValue = mUserInterface->mResizer; break; + case eCSSProperty_behavior: aValue = mUserInterface->mBehavior; break; + CSS_BOGUS_DEFAULT; // make compiler happy } } diff --git a/content/html/style/src/nsCSSParser.cpp b/content/html/style/src/nsCSSParser.cpp index 96a16ec7cd1..4d976bd7689 100644 --- a/content/html/style/src/nsCSSParser.cpp +++ b/content/html/style/src/nsCSSParser.cpp @@ -2838,6 +2838,8 @@ PRBool CSSParserImpl::ParseSingleValueProperty(PRInt32& aErrorCode, case eCSSProperty_background_y_position: return ParseVariant(aErrorCode, aValue, VARIANT_HKLP, kBackgroundXYPositionKTable); + case eCSSProperty_behavior: + return ParseVariant(aErrorCode, aValue, VARIANT_HUO, nsnull); case eCSSProperty_border_collapse: return ParseVariant(aErrorCode, aValue, VARIANT_HK, nsCSSProps::kBorderCollapseKTable); diff --git a/content/html/style/src/nsCSSPropList.h b/content/html/style/src/nsCSSPropList.h index e07c4095493..a71b13a4eee 100644 --- a/content/html/style/src/nsCSSPropList.h +++ b/content/html/style/src/nsCSSPropList.h @@ -56,6 +56,7 @@ CSS_PROP(background_position, VISUAL) CSS_PROP(background_repeat, VISUAL) CSS_PROP(background_x_position, VISUAL) CSS_PROP(background_y_position, VISUAL) +CSS_PROP(behavior, REFLOW) CSS_PROP(border, REFLOW) CSS_PROP(border_bottom, REFLOW) CSS_PROP(border_bottom_color, VISUAL) diff --git a/content/html/style/src/nsCSSStruct.cpp b/content/html/style/src/nsCSSStruct.cpp index 362ace9cab0..806423123fa 100644 --- a/content/html/style/src/nsCSSStruct.cpp +++ b/content/html/style/src/nsCSSStruct.cpp @@ -796,7 +796,8 @@ nsCSSUserInterface::nsCSSUserInterface(const nsCSSUserInterface& aCopy) mUserSelect(aCopy.mUserSelect), mKeyEquivalent(nsnull), mUserFocus(aCopy.mUserFocus), - mResizer(aCopy.mResizer) + mResizer(aCopy.mResizer), + mBehavior(aCopy.mBehavior) { CSS_IF_COPY(mKeyEquivalent, nsCSSValueList); } @@ -827,6 +828,7 @@ void nsCSSUserInterface::List(FILE* out, PRInt32 aIndent) const } mUserFocus.AppendToString(buffer, eCSSProperty_user_focus); mResizer.AppendToString(buffer, eCSSProperty_resizer); + mBehavior.AppendToString(buffer, eCSSProperty_behavior); fputs(buffer, out); } @@ -1566,6 +1568,7 @@ CSSDeclarationImpl::AppendValue(nsCSSProperty aProperty, const nsCSSValue& aValu case eCSSProperty_key_equivalent: case eCSSProperty_user_focus: case eCSSProperty_resizer: + case eCSSProperty_behavior: CSS_ENSURE(UserInterface) { switch (aProperty) { case eCSSProperty_user_input: mUserInterface->mUserInput = aValue; break; @@ -1579,6 +1582,7 @@ CSSDeclarationImpl::AppendValue(nsCSSProperty aProperty, const nsCSSValue& aValu break; case eCSSProperty_user_focus: mUserInterface->mUserFocus = aValue; break; case eCSSProperty_resizer: mUserInterface->mResizer = aValue; break; + case eCSSProperty_behavior: mUserInterface->mBehavior = aValue; break; CSS_BOGUS_DEFAULT; // make compiler happy } } @@ -2269,6 +2273,7 @@ CSSDeclarationImpl::SetValueImportant(nsCSSProperty aProperty) case eCSSProperty_user_select: case eCSSProperty_user_focus: case eCSSProperty_resizer: + case eCSSProperty_behavior: if (nsnull != mUserInterface) { CSS_ENSURE_IMPORTANT(UserInterface) { switch (aProperty) { @@ -2277,6 +2282,7 @@ CSSDeclarationImpl::SetValueImportant(nsCSSProperty aProperty) CSS_CASE_IMPORTANT(eCSSProperty_user_select, mUserInterface->mUserSelect); CSS_CASE_IMPORTANT(eCSSProperty_user_focus, mUserInterface->mUserFocus); CSS_CASE_IMPORTANT(eCSSProperty_resizer, mUserInterface->mResizer); + CSS_CASE_IMPORTANT(eCSSProperty_behavior, mUserInterface->mBehavior); CSS_BOGUS_DEFAULT; // make compiler happy } } @@ -2954,6 +2960,7 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsCSSValue& aValue) case eCSSProperty_key_equivalent: case eCSSProperty_user_focus: case eCSSProperty_resizer: + case eCSSProperty_behavior: if (nsnull != mUserInterface) { switch (aProperty) { case eCSSProperty_user_input: aValue = mUserInterface->mUserInput; break; @@ -2966,6 +2973,8 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsCSSValue& aValue) break; case eCSSProperty_user_focus: aValue = mUserInterface->mUserFocus; break; case eCSSProperty_resizer: aValue = mUserInterface->mResizer; break; + case eCSSProperty_behavior: aValue = mUserInterface->mBehavior; break; + CSS_BOGUS_DEFAULT; // make compiler happy } } diff --git a/content/html/style/src/nsCSSStyleRule.cpp b/content/html/style/src/nsCSSStyleRule.cpp index 8bd3fb0bd0f..569576f3ccd 100644 --- a/content/html/style/src/nsCSSStyleRule.cpp +++ b/content/html/style/src/nsCSSStyleRule.cpp @@ -2523,6 +2523,11 @@ MapDeclarationUIInto(nsICSSDeclaration* aDeclaration, ui->mUserSelect = parentUI->mUserSelect; } + // behavior: url, none + if (eCSSUnit_URL == ourUI->mBehavior.GetUnit()) { + ourUI->mBehavior.GetStringValue(ui->mBehavior); + } + // key-equivalent: none, enum XXX, inherit nsCSSValueList* keyEquiv = ourUI->mKeyEquivalent; if (keyEquiv) { diff --git a/content/html/style/src/nsDOMCSSDeclaration.cpp b/content/html/style/src/nsDOMCSSDeclaration.cpp index c69cad69e9e..f81a1c4dcab 100644 --- a/content/html/style/src/nsDOMCSSDeclaration.cpp +++ b/content/html/style/src/nsDOMCSSDeclaration.cpp @@ -296,6 +296,18 @@ nsDOMCSSDeclaration::SetBackgroundRepeat(const nsString& aBackgroundRepeat) return SetProperty("background-repeat", aBackgroundRepeat, ""); } +NS_IMETHODIMP +nsDOMCSSDeclaration::GetBehavior(nsString& aBehavior) +{ + return GetPropertyValue("behavior", aBehavior); +} + +NS_IMETHODIMP +nsDOMCSSDeclaration::SetBehavior(const nsString& aBehavior) +{ + return SetProperty("behavior", aBehavior, ""); +} + NS_IMETHODIMP nsDOMCSSDeclaration::GetBorder(nsString& aBorder) { diff --git a/content/html/style/src/nsICSSDeclaration.h b/content/html/style/src/nsICSSDeclaration.h index 3155fe03612..d7b809a577a 100644 --- a/content/html/style/src/nsICSSDeclaration.h +++ b/content/html/style/src/nsICSSDeclaration.h @@ -349,6 +349,7 @@ struct nsCSSUserInterface : public nsCSSStruct { // NEW nsCSSValueList* mKeyEquivalent; nsCSSValue mUserFocus; nsCSSValue mResizer; + nsCSSValue mBehavior; }; struct nsCSSAural : public nsCSSStruct { // NEW diff --git a/content/shared/public/nsCSSPropList.h b/content/shared/public/nsCSSPropList.h index e07c4095493..a71b13a4eee 100644 --- a/content/shared/public/nsCSSPropList.h +++ b/content/shared/public/nsCSSPropList.h @@ -56,6 +56,7 @@ CSS_PROP(background_position, VISUAL) CSS_PROP(background_repeat, VISUAL) CSS_PROP(background_x_position, VISUAL) CSS_PROP(background_y_position, VISUAL) +CSS_PROP(behavior, REFLOW) CSS_PROP(border, REFLOW) CSS_PROP(border_bottom, REFLOW) CSS_PROP(border_bottom_color, VISUAL) diff --git a/content/shared/src/nsCSSProps.cpp b/content/shared/src/nsCSSProps.cpp index 6316f338fc9..ced147a5b06 100644 --- a/content/shared/src/nsCSSProps.cpp +++ b/content/shared/src/nsCSSProps.cpp @@ -720,6 +720,9 @@ static const PRInt32 kBackgroundYPositionKTable[] = { case eCSSProperty_background_y_position: return SearchKeywordTable(aValue, kBackgroundYPositionKTable); + case eCSSProperty_behavior: + break; + case eCSSProperty_border: break; diff --git a/dom/public/css/nsIDOMCSS2Properties.h b/dom/public/css/nsIDOMCSS2Properties.h index 9c73ce81809..4d47e00b93f 100644 --- a/dom/public/css/nsIDOMCSS2Properties.h +++ b/dom/public/css/nsIDOMCSS2Properties.h @@ -59,6 +59,9 @@ public: NS_IMETHOD GetBackgroundRepeat(nsString& aBackgroundRepeat)=0; NS_IMETHOD SetBackgroundRepeat(const nsString& aBackgroundRepeat)=0; + NS_IMETHOD GetBehavior(nsString& aBehavior)=0; + NS_IMETHOD SetBehavior(const nsString& aBehavior)=0; + NS_IMETHOD GetBorder(nsString& aBorder)=0; NS_IMETHOD SetBorder(const nsString& aBorder)=0; @@ -424,6 +427,8 @@ public: NS_IMETHOD SetBackgroundPosition(const nsString& aBackgroundPosition); \ NS_IMETHOD GetBackgroundRepeat(nsString& aBackgroundRepeat); \ NS_IMETHOD SetBackgroundRepeat(const nsString& aBackgroundRepeat); \ + NS_IMETHOD GetBehavior(nsString& aBehavior); \ + NS_IMETHOD SetBehavior(const nsString& aBehavior); \ NS_IMETHOD GetBorder(nsString& aBorder); \ NS_IMETHOD SetBorder(const nsString& aBorder); \ NS_IMETHOD GetBorderCollapse(nsString& aBorderCollapse); \ @@ -674,6 +679,8 @@ public: NS_IMETHOD SetBackgroundPosition(const nsString& aBackgroundPosition) { return _to SetBackgroundPosition(aBackgroundPosition); } \ NS_IMETHOD GetBackgroundRepeat(nsString& aBackgroundRepeat) { return _to GetBackgroundRepeat(aBackgroundRepeat); } \ NS_IMETHOD SetBackgroundRepeat(const nsString& aBackgroundRepeat) { return _to SetBackgroundRepeat(aBackgroundRepeat); } \ + NS_IMETHOD GetBehavior(nsString& aBehavior) { return _to GetBehavior(aBehavior); } \ + NS_IMETHOD SetBehavior(const nsString& aBehavior) { return _to SetBehavior(aBehavior); } \ NS_IMETHOD GetBorder(nsString& aBorder) { return _to GetBorder(aBorder); } \ NS_IMETHOD SetBorder(const nsString& aBorder) { return _to SetBorder(aBorder); } \ NS_IMETHOD GetBorderCollapse(nsString& aBorderCollapse) { return _to GetBorderCollapse(aBorderCollapse); } \ diff --git a/dom/public/idl/css/CSS2Properties.idl b/dom/public/idl/css/CSS2Properties.idl index 4fbc8d8955d..f4e5bf40ae6 100644 --- a/dom/public/idl/css/CSS2Properties.idl +++ b/dom/public/idl/css/CSS2Properties.idl @@ -9,7 +9,8 @@ attribute wstring backgroundColor; attribute wstring backgroundImage; attribute wstring backgroundPosition; - attribute wstring backgroundRepeat; + attribute wstring backgroundRepeat; + attribute wstring behavior; attribute wstring border; attribute wstring borderCollapse; attribute wstring borderColor; diff --git a/dom/public/nsDOMPropEnums.h b/dom/public/nsDOMPropEnums.h index b981fe9f552..d1ea7078c60 100644 --- a/dom/public/nsDOMPropEnums.h +++ b/dom/public/nsDOMPropEnums.h @@ -56,7 +56,8 @@ enum nsDOMProp { NS_DOM_PROP_CSS2PROPERTIES_BACKGROUNDCOLOR, NS_DOM_PROP_CSS2PROPERTIES_BACKGROUNDIMAGE, NS_DOM_PROP_CSS2PROPERTIES_BACKGROUNDPOSITION, - NS_DOM_PROP_CSS2PROPERTIES_BACKGROUNDREPEAT, + NS_DOM_PROP_CSS2PROPERTIES_BACKGROUNDREPEAT, + NS_DOM_PROP_CSS2PROPERTIES_BEHAVIOR, NS_DOM_PROP_CSS2PROPERTIES_BORDER, NS_DOM_PROP_CSS2PROPERTIES_BORDERBOTTOM, NS_DOM_PROP_CSS2PROPERTIES_BORDERBOTTOMCOLOR, diff --git a/dom/public/nsDOMPropNames.h b/dom/public/nsDOMPropNames.h index 7faa68897ad..205a5809719 100644 --- a/dom/public/nsDOMPropNames.h +++ b/dom/public/nsDOMPropNames.h @@ -56,6 +56,7 @@ "css2properties.backgroundimage", \ "css2properties.backgroundposition", \ "css2properties.backgroundrepeat", \ + "css2properties.behavior", \ "css2properties.border", \ "css2properties.borderbottom", \ "css2properties.borderbottomcolor", \ diff --git a/dom/src/css/nsJSCSS2Properties.cpp b/dom/src/css/nsJSCSS2Properties.cpp index 740b5612fb6..5f0e1443c9c 100644 --- a/dom/src/css/nsJSCSS2Properties.cpp +++ b/dom/src/css/nsJSCSS2Properties.cpp @@ -53,122 +53,123 @@ enum CSS2Properties_slots { CSS2PROPERTIES_BACKGROUNDIMAGE = -5, CSS2PROPERTIES_BACKGROUNDPOSITION = -6, CSS2PROPERTIES_BACKGROUNDREPEAT = -7, - CSS2PROPERTIES_BORDER = -8, - CSS2PROPERTIES_BORDERCOLLAPSE = -9, - CSS2PROPERTIES_BORDERCOLOR = -10, - CSS2PROPERTIES_BORDERSPACING = -11, - CSS2PROPERTIES_BORDERSTYLE = -12, - CSS2PROPERTIES_BORDERTOP = -13, - CSS2PROPERTIES_BORDERRIGHT = -14, - CSS2PROPERTIES_BORDERBOTTOM = -15, - CSS2PROPERTIES_BORDERLEFT = -16, - CSS2PROPERTIES_BORDERTOPCOLOR = -17, - CSS2PROPERTIES_BORDERRIGHTCOLOR = -18, - CSS2PROPERTIES_BORDERBOTTOMCOLOR = -19, - CSS2PROPERTIES_BORDERLEFTCOLOR = -20, - CSS2PROPERTIES_BORDERTOPSTYLE = -21, - CSS2PROPERTIES_BORDERRIGHTSTYLE = -22, - CSS2PROPERTIES_BORDERBOTTOMSTYLE = -23, - CSS2PROPERTIES_BORDERLEFTSTYLE = -24, - CSS2PROPERTIES_BORDERTOPWIDTH = -25, - CSS2PROPERTIES_BORDERRIGHTWIDTH = -26, - CSS2PROPERTIES_BORDERBOTTOMWIDTH = -27, - CSS2PROPERTIES_BORDERLEFTWIDTH = -28, - CSS2PROPERTIES_BORDERWIDTH = -29, - CSS2PROPERTIES_BOTTOM = -30, - CSS2PROPERTIES_CAPTIONSIDE = -31, - CSS2PROPERTIES_CLEAR = -32, - CSS2PROPERTIES_CLIP = -33, - CSS2PROPERTIES_COLOR = -34, - CSS2PROPERTIES_CONTENT = -35, - CSS2PROPERTIES_COUNTERINCREMENT = -36, - CSS2PROPERTIES_COUNTERRESET = -37, - CSS2PROPERTIES_CUE = -38, - CSS2PROPERTIES_CUEAFTER = -39, - CSS2PROPERTIES_CUEBEFORE = -40, - CSS2PROPERTIES_CURSOR = -41, - CSS2PROPERTIES_DIRECTION = -42, - CSS2PROPERTIES_DISPLAY = -43, - CSS2PROPERTIES_ELEVATION = -44, - CSS2PROPERTIES_EMPTYCELLS = -45, - CSS2PROPERTIES_CSSFLOAT = -46, - CSS2PROPERTIES_FONT = -47, - CSS2PROPERTIES_FONTFAMILY = -48, - CSS2PROPERTIES_FONTSIZE = -49, - CSS2PROPERTIES_FONTSIZEADJUST = -50, - CSS2PROPERTIES_FONTSTRETCH = -51, - CSS2PROPERTIES_FONTSTYLE = -52, - CSS2PROPERTIES_FONTVARIANT = -53, - CSS2PROPERTIES_FONTWEIGHT = -54, - CSS2PROPERTIES_HEIGHT = -55, - CSS2PROPERTIES_LEFT = -56, - CSS2PROPERTIES_LETTERSPACING = -57, - CSS2PROPERTIES_LINEHEIGHT = -58, - CSS2PROPERTIES_LISTSTYLE = -59, - CSS2PROPERTIES_LISTSTYLEIMAGE = -60, - CSS2PROPERTIES_LISTSTYLEPOSITION = -61, - CSS2PROPERTIES_LISTSTYLETYPE = -62, - CSS2PROPERTIES_MARGIN = -63, - CSS2PROPERTIES_MARGINTOP = -64, - CSS2PROPERTIES_MARGINRIGHT = -65, - CSS2PROPERTIES_MARGINBOTTOM = -66, - CSS2PROPERTIES_MARGINLEFT = -67, - CSS2PROPERTIES_MARKEROFFSET = -68, - CSS2PROPERTIES_MARKS = -69, - CSS2PROPERTIES_MAXHEIGHT = -70, - CSS2PROPERTIES_MAXWIDTH = -71, - CSS2PROPERTIES_MINHEIGHT = -72, - CSS2PROPERTIES_MINWIDTH = -73, - CSS2PROPERTIES_ORPHANS = -74, - CSS2PROPERTIES_OUTLINE = -75, - CSS2PROPERTIES_OUTLINECOLOR = -76, - CSS2PROPERTIES_OUTLINESTYLE = -77, - CSS2PROPERTIES_OUTLINEWIDTH = -78, - CSS2PROPERTIES_OVERFLOW = -79, - CSS2PROPERTIES_PADDING = -80, - CSS2PROPERTIES_PADDINGTOP = -81, - CSS2PROPERTIES_PADDINGRIGHT = -82, - CSS2PROPERTIES_PADDINGBOTTOM = -83, - CSS2PROPERTIES_PADDINGLEFT = -84, - CSS2PROPERTIES_PAGE = -85, - CSS2PROPERTIES_PAGEBREAKAFTER = -86, - CSS2PROPERTIES_PAGEBREAKBEFORE = -87, - CSS2PROPERTIES_PAGEBREAKINSIDE = -88, - CSS2PROPERTIES_PAUSE = -89, - CSS2PROPERTIES_PAUSEAFTER = -90, - CSS2PROPERTIES_PAUSEBEFORE = -91, - CSS2PROPERTIES_PITCH = -92, - CSS2PROPERTIES_PITCHRANGE = -93, - CSS2PROPERTIES_PLAYDURING = -94, - CSS2PROPERTIES_POSITION = -95, - CSS2PROPERTIES_QUOTES = -96, - CSS2PROPERTIES_RICHNESS = -97, - CSS2PROPERTIES_RIGHT = -98, - CSS2PROPERTIES_SIZE = -99, - CSS2PROPERTIES_SPEAK = -100, - CSS2PROPERTIES_SPEAKHEADER = -101, - CSS2PROPERTIES_SPEAKNUMERAL = -102, - CSS2PROPERTIES_SPEAKPUNCTUATION = -103, - CSS2PROPERTIES_SPEECHRATE = -104, - CSS2PROPERTIES_STRESS = -105, - CSS2PROPERTIES_TABLELAYOUT = -106, - CSS2PROPERTIES_TEXTALIGN = -107, - CSS2PROPERTIES_TEXTDECORATION = -108, - CSS2PROPERTIES_TEXTINDENT = -109, - CSS2PROPERTIES_TEXTSHADOW = -110, - CSS2PROPERTIES_TEXTTRANSFORM = -111, - CSS2PROPERTIES_TOP = -112, - CSS2PROPERTIES_UNICODEBIDI = -113, - CSS2PROPERTIES_VERTICALALIGN = -114, - CSS2PROPERTIES_VISIBILITY = -115, - CSS2PROPERTIES_VOICEFAMILY = -116, - CSS2PROPERTIES_VOLUME = -117, - CSS2PROPERTIES_WHITESPACE = -118, - CSS2PROPERTIES_WIDOWS = -119, - CSS2PROPERTIES_WIDTH = -120, - CSS2PROPERTIES_WORDSPACING = -121, - CSS2PROPERTIES_ZINDEX = -122, - CSS2PROPERTIES_OPACITY = -123 + CSS2PROPERTIES_BEHAVIOR = -8, + CSS2PROPERTIES_BORDER = -9, + CSS2PROPERTIES_BORDERCOLLAPSE = -10, + CSS2PROPERTIES_BORDERCOLOR = -11, + CSS2PROPERTIES_BORDERSPACING = -12, + CSS2PROPERTIES_BORDERSTYLE = -13, + CSS2PROPERTIES_BORDERTOP = -14, + CSS2PROPERTIES_BORDERRIGHT = -15, + CSS2PROPERTIES_BORDERBOTTOM = -16, + CSS2PROPERTIES_BORDERLEFT = -17, + CSS2PROPERTIES_BORDERTOPCOLOR = -18, + CSS2PROPERTIES_BORDERRIGHTCOLOR = -19, + CSS2PROPERTIES_BORDERBOTTOMCOLOR = -20, + CSS2PROPERTIES_BORDERLEFTCOLOR = -21, + CSS2PROPERTIES_BORDERTOPSTYLE = -22, + CSS2PROPERTIES_BORDERRIGHTSTYLE = -23, + CSS2PROPERTIES_BORDERBOTTOMSTYLE = -24, + CSS2PROPERTIES_BORDERLEFTSTYLE = -25, + CSS2PROPERTIES_BORDERTOPWIDTH = -26, + CSS2PROPERTIES_BORDERRIGHTWIDTH = -27, + CSS2PROPERTIES_BORDERBOTTOMWIDTH = -28, + CSS2PROPERTIES_BORDERLEFTWIDTH = -29, + CSS2PROPERTIES_BORDERWIDTH = -30, + CSS2PROPERTIES_BOTTOM = -31, + CSS2PROPERTIES_CAPTIONSIDE = -32, + CSS2PROPERTIES_CLEAR = -33, + CSS2PROPERTIES_CLIP = -34, + CSS2PROPERTIES_COLOR = -35, + CSS2PROPERTIES_CONTENT = -36, + CSS2PROPERTIES_COUNTERINCREMENT = -37, + CSS2PROPERTIES_COUNTERRESET = -38, + CSS2PROPERTIES_CUE = -39, + CSS2PROPERTIES_CUEAFTER = -40, + CSS2PROPERTIES_CUEBEFORE = -41, + CSS2PROPERTIES_CURSOR = -42, + CSS2PROPERTIES_DIRECTION = -43, + CSS2PROPERTIES_DISPLAY = -44, + CSS2PROPERTIES_ELEVATION = -45, + CSS2PROPERTIES_EMPTYCELLS = -46, + CSS2PROPERTIES_CSSFLOAT = -47, + CSS2PROPERTIES_FONT = -48, + CSS2PROPERTIES_FONTFAMILY = -49, + CSS2PROPERTIES_FONTSIZE = -50, + CSS2PROPERTIES_FONTSIZEADJUST = -51, + CSS2PROPERTIES_FONTSTRETCH = -52, + CSS2PROPERTIES_FONTSTYLE = -53, + CSS2PROPERTIES_FONTVARIANT = -54, + CSS2PROPERTIES_FONTWEIGHT = -55, + CSS2PROPERTIES_HEIGHT = -56, + CSS2PROPERTIES_LEFT = -57, + CSS2PROPERTIES_LETTERSPACING = -58, + CSS2PROPERTIES_LINEHEIGHT = -59, + CSS2PROPERTIES_LISTSTYLE = -60, + CSS2PROPERTIES_LISTSTYLEIMAGE = -61, + CSS2PROPERTIES_LISTSTYLEPOSITION = -62, + CSS2PROPERTIES_LISTSTYLETYPE = -63, + CSS2PROPERTIES_MARGIN = -64, + CSS2PROPERTIES_MARGINTOP = -65, + CSS2PROPERTIES_MARGINRIGHT = -66, + CSS2PROPERTIES_MARGINBOTTOM = -67, + CSS2PROPERTIES_MARGINLEFT = -68, + CSS2PROPERTIES_MARKEROFFSET = -69, + CSS2PROPERTIES_MARKS = -70, + CSS2PROPERTIES_MAXHEIGHT = -71, + CSS2PROPERTIES_MAXWIDTH = -72, + CSS2PROPERTIES_MINHEIGHT = -73, + CSS2PROPERTIES_MINWIDTH = -74, + CSS2PROPERTIES_ORPHANS = -75, + CSS2PROPERTIES_OUTLINE = -76, + CSS2PROPERTIES_OUTLINECOLOR = -77, + CSS2PROPERTIES_OUTLINESTYLE = -78, + CSS2PROPERTIES_OUTLINEWIDTH = -79, + CSS2PROPERTIES_OVERFLOW = -80, + CSS2PROPERTIES_PADDING = -81, + CSS2PROPERTIES_PADDINGTOP = -82, + CSS2PROPERTIES_PADDINGRIGHT = -83, + CSS2PROPERTIES_PADDINGBOTTOM = -84, + CSS2PROPERTIES_PADDINGLEFT = -85, + CSS2PROPERTIES_PAGE = -86, + CSS2PROPERTIES_PAGEBREAKAFTER = -87, + CSS2PROPERTIES_PAGEBREAKBEFORE = -88, + CSS2PROPERTIES_PAGEBREAKINSIDE = -89, + CSS2PROPERTIES_PAUSE = -90, + CSS2PROPERTIES_PAUSEAFTER = -91, + CSS2PROPERTIES_PAUSEBEFORE = -92, + CSS2PROPERTIES_PITCH = -93, + CSS2PROPERTIES_PITCHRANGE = -94, + CSS2PROPERTIES_PLAYDURING = -95, + CSS2PROPERTIES_POSITION = -96, + CSS2PROPERTIES_QUOTES = -97, + CSS2PROPERTIES_RICHNESS = -98, + CSS2PROPERTIES_RIGHT = -99, + CSS2PROPERTIES_SIZE = -100, + CSS2PROPERTIES_SPEAK = -101, + CSS2PROPERTIES_SPEAKHEADER = -102, + CSS2PROPERTIES_SPEAKNUMERAL = -103, + CSS2PROPERTIES_SPEAKPUNCTUATION = -104, + CSS2PROPERTIES_SPEECHRATE = -105, + CSS2PROPERTIES_STRESS = -106, + CSS2PROPERTIES_TABLELAYOUT = -107, + CSS2PROPERTIES_TEXTALIGN = -108, + CSS2PROPERTIES_TEXTDECORATION = -109, + CSS2PROPERTIES_TEXTINDENT = -110, + CSS2PROPERTIES_TEXTSHADOW = -111, + CSS2PROPERTIES_TEXTTRANSFORM = -112, + CSS2PROPERTIES_TOP = -113, + CSS2PROPERTIES_UNICODEBIDI = -114, + CSS2PROPERTIES_VERTICALALIGN = -115, + CSS2PROPERTIES_VISIBILITY = -116, + CSS2PROPERTIES_VOICEFAMILY = -117, + CSS2PROPERTIES_VOLUME = -118, + CSS2PROPERTIES_WHITESPACE = -119, + CSS2PROPERTIES_WIDOWS = -120, + CSS2PROPERTIES_WIDTH = -121, + CSS2PROPERTIES_WORDSPACING = -122, + CSS2PROPERTIES_ZINDEX = -123, + CSS2PROPERTIES_OPACITY = -124 }; /***********************************************************************/ @@ -319,6 +320,24 @@ GetCSS2PropertiesProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp) } break; } + case CSS2PROPERTIES_BEHAVIOR: + { + PRBool ok = PR_FALSE; + secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_CSS2PROPERTIES_BEHAVIOR, PR_FALSE, &ok); + if (!ok) { + return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECURITY_ERR); + } + nsAutoString prop; + nsresult result = NS_OK; + result = a->GetBehavior(prop); + if (NS_SUCCEEDED(result)) { + nsJSUtils::nsConvertStringToJSVal(prop, cx, vp); + } + else { + return nsJSUtils::nsReportError(cx, obj, result); + } + break; + } case CSS2PROPERTIES_BORDER: { PRBool ok = PR_FALSE; @@ -2538,6 +2557,20 @@ SetCSS2PropertiesProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp) break; } + case CSS2PROPERTIES_BEHAVIOR: + { + PRBool ok = PR_FALSE; + secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_CSS2PROPERTIES_BEHAVIOR, PR_TRUE, &ok); + if (!ok) { + return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECURITY_ERR); + } + nsAutoString prop; + nsJSUtils::nsConvertJSValToString(prop, cx, *vp); + + a->SetBehavior(prop); + + break; + } case CSS2PROPERTIES_BORDER: { PRBool ok = PR_FALSE; @@ -4234,6 +4267,7 @@ static JSPropertySpec CSS2PropertiesProperties[] = {"backgroundImage", CSS2PROPERTIES_BACKGROUNDIMAGE, JSPROP_ENUMERATE}, {"backgroundPosition", CSS2PROPERTIES_BACKGROUNDPOSITION, JSPROP_ENUMERATE}, {"backgroundRepeat", CSS2PROPERTIES_BACKGROUNDREPEAT, JSPROP_ENUMERATE}, + {"behavior", CSS2PROPERTIES_BEHAVIOR, JSPROP_ENUMERATE}, {"border", CSS2PROPERTIES_BORDER, JSPROP_ENUMERATE}, {"borderCollapse", CSS2PROPERTIES_BORDERCOLLAPSE, JSPROP_ENUMERATE}, {"borderColor", CSS2PROPERTIES_BORDERCOLOR, JSPROP_ENUMERATE}, diff --git a/layout/base/nsCSSFrameConstructor.cpp b/layout/base/nsCSSFrameConstructor.cpp index 5f02f248c12..f9485eb7cd0 100644 --- a/layout/base/nsCSSFrameConstructor.cpp +++ b/layout/base/nsCSSFrameConstructor.cpp @@ -3734,6 +3734,17 @@ nsCSSFrameConstructor::CreateAnonymousFrames(nsIPresShell* aPresShell, nsIFrame* aNewFrame, nsFrameItems& aChildItems) { +/* + nsCOMPtr styleContext; + aNewFrame->GetStyleContext(getter_AddRefs(styleContext)); + + const nsStyleUserInterface* ui= (const nsStyleUserInterface*) + styleContext->GetStyleData(eStyleStruct_UserInterface); + + if (ui->mBehavior != "") + printf("The behavior is not the empty string!\n"); +*/ + // only these tags types can have anonymous content. We do this check for performance // reasons. If we did a query interface on every tag it would be very inefficient. if (aTag != nsHTMLAtoms::input && diff --git a/layout/base/public/nsIStyleContext.h b/layout/base/public/nsIStyleContext.h index 12f73de9b3e..7645815b6bb 100644 --- a/layout/base/public/nsIStyleContext.h +++ b/layout/base/public/nsIStyleContext.h @@ -293,6 +293,8 @@ struct nsStyleUserInterface: public nsStyleStruct { PRUint8 mUserFocus; // [inherited] (auto-select) PRUnichar mKeyEquivalent; // [reset] XXX what type should this be? PRUint8 mResizer; // [reset] + nsString mBehavior; // [reset] absolute url string + }; struct nsStylePrint: public nsStyleStruct { diff --git a/layout/base/src/nsStyleContext.cpp b/layout/base/src/nsStyleContext.cpp index 7e147a9265e..436ba6f8b90 100644 --- a/layout/base/src/nsStyleContext.cpp +++ b/layout/base/src/nsStyleContext.cpp @@ -1496,16 +1496,33 @@ void StyleUserInterfaceImpl::ResetFrom(const nsStyleUserInterface* aParent, nsIP void StyleUserInterfaceImpl::SetFrom(const nsStyleUserInterface& aSource) { - nsCRT::memcpy((nsStyleUserInterface*)this, &aSource, sizeof(nsStyleUserInterface)); + mUserInput = aSource.mUserInput; + mUserModify = aSource.mUserModify; + mUserFocus = aSource.mUserFocus; + + mUserSelect = aSource.mUserSelect; + mKeyEquivalent = aSource.mKeyEquivalent; + mResizer = aSource.mResizer; + mBehavior = aSource.mBehavior; } void StyleUserInterfaceImpl::CopyTo(nsStyleUserInterface& aDest) const { - nsCRT::memcpy(&aDest, (const nsStyleUserInterface*)this, sizeof(nsStyleUserInterface)); + aDest.mUserInput = mUserInput; + aDest.mUserModify = mUserModify; + aDest.mUserFocus = mUserFocus; + + aDest.mUserSelect = mUserSelect; + aDest.mKeyEquivalent = mKeyEquivalent; + aDest.mResizer = mResizer; + aDest.mBehavior = mBehavior; } PRInt32 StyleUserInterfaceImpl::CalcDifference(const StyleUserInterfaceImpl& aOther) const { + if (mBehavior != aOther.mBehavior) + return NS_STYLE_HINT_FRAMECHANGE; + if ((mUserInput == aOther.mUserInput) && (mResizer == aOther.mResizer)) { if ((mUserModify == aOther.mUserModify) && diff --git a/layout/html/style/src/nsCSSDeclaration.cpp b/layout/html/style/src/nsCSSDeclaration.cpp index 362ace9cab0..806423123fa 100644 --- a/layout/html/style/src/nsCSSDeclaration.cpp +++ b/layout/html/style/src/nsCSSDeclaration.cpp @@ -796,7 +796,8 @@ nsCSSUserInterface::nsCSSUserInterface(const nsCSSUserInterface& aCopy) mUserSelect(aCopy.mUserSelect), mKeyEquivalent(nsnull), mUserFocus(aCopy.mUserFocus), - mResizer(aCopy.mResizer) + mResizer(aCopy.mResizer), + mBehavior(aCopy.mBehavior) { CSS_IF_COPY(mKeyEquivalent, nsCSSValueList); } @@ -827,6 +828,7 @@ void nsCSSUserInterface::List(FILE* out, PRInt32 aIndent) const } mUserFocus.AppendToString(buffer, eCSSProperty_user_focus); mResizer.AppendToString(buffer, eCSSProperty_resizer); + mBehavior.AppendToString(buffer, eCSSProperty_behavior); fputs(buffer, out); } @@ -1566,6 +1568,7 @@ CSSDeclarationImpl::AppendValue(nsCSSProperty aProperty, const nsCSSValue& aValu case eCSSProperty_key_equivalent: case eCSSProperty_user_focus: case eCSSProperty_resizer: + case eCSSProperty_behavior: CSS_ENSURE(UserInterface) { switch (aProperty) { case eCSSProperty_user_input: mUserInterface->mUserInput = aValue; break; @@ -1579,6 +1582,7 @@ CSSDeclarationImpl::AppendValue(nsCSSProperty aProperty, const nsCSSValue& aValu break; case eCSSProperty_user_focus: mUserInterface->mUserFocus = aValue; break; case eCSSProperty_resizer: mUserInterface->mResizer = aValue; break; + case eCSSProperty_behavior: mUserInterface->mBehavior = aValue; break; CSS_BOGUS_DEFAULT; // make compiler happy } } @@ -2269,6 +2273,7 @@ CSSDeclarationImpl::SetValueImportant(nsCSSProperty aProperty) case eCSSProperty_user_select: case eCSSProperty_user_focus: case eCSSProperty_resizer: + case eCSSProperty_behavior: if (nsnull != mUserInterface) { CSS_ENSURE_IMPORTANT(UserInterface) { switch (aProperty) { @@ -2277,6 +2282,7 @@ CSSDeclarationImpl::SetValueImportant(nsCSSProperty aProperty) CSS_CASE_IMPORTANT(eCSSProperty_user_select, mUserInterface->mUserSelect); CSS_CASE_IMPORTANT(eCSSProperty_user_focus, mUserInterface->mUserFocus); CSS_CASE_IMPORTANT(eCSSProperty_resizer, mUserInterface->mResizer); + CSS_CASE_IMPORTANT(eCSSProperty_behavior, mUserInterface->mBehavior); CSS_BOGUS_DEFAULT; // make compiler happy } } @@ -2954,6 +2960,7 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsCSSValue& aValue) case eCSSProperty_key_equivalent: case eCSSProperty_user_focus: case eCSSProperty_resizer: + case eCSSProperty_behavior: if (nsnull != mUserInterface) { switch (aProperty) { case eCSSProperty_user_input: aValue = mUserInterface->mUserInput; break; @@ -2966,6 +2973,8 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsCSSValue& aValue) break; case eCSSProperty_user_focus: aValue = mUserInterface->mUserFocus; break; case eCSSProperty_resizer: aValue = mUserInterface->mResizer; break; + case eCSSProperty_behavior: aValue = mUserInterface->mBehavior; break; + CSS_BOGUS_DEFAULT; // make compiler happy } } diff --git a/layout/html/style/src/nsCSSFrameConstructor.cpp b/layout/html/style/src/nsCSSFrameConstructor.cpp index 5f02f248c12..f9485eb7cd0 100644 --- a/layout/html/style/src/nsCSSFrameConstructor.cpp +++ b/layout/html/style/src/nsCSSFrameConstructor.cpp @@ -3734,6 +3734,17 @@ nsCSSFrameConstructor::CreateAnonymousFrames(nsIPresShell* aPresShell, nsIFrame* aNewFrame, nsFrameItems& aChildItems) { +/* + nsCOMPtr styleContext; + aNewFrame->GetStyleContext(getter_AddRefs(styleContext)); + + const nsStyleUserInterface* ui= (const nsStyleUserInterface*) + styleContext->GetStyleData(eStyleStruct_UserInterface); + + if (ui->mBehavior != "") + printf("The behavior is not the empty string!\n"); +*/ + // only these tags types can have anonymous content. We do this check for performance // reasons. If we did a query interface on every tag it would be very inefficient. if (aTag != nsHTMLAtoms::input && diff --git a/layout/html/style/src/nsCSSParser.cpp b/layout/html/style/src/nsCSSParser.cpp index 96a16ec7cd1..4d976bd7689 100644 --- a/layout/html/style/src/nsCSSParser.cpp +++ b/layout/html/style/src/nsCSSParser.cpp @@ -2838,6 +2838,8 @@ PRBool CSSParserImpl::ParseSingleValueProperty(PRInt32& aErrorCode, case eCSSProperty_background_y_position: return ParseVariant(aErrorCode, aValue, VARIANT_HKLP, kBackgroundXYPositionKTable); + case eCSSProperty_behavior: + return ParseVariant(aErrorCode, aValue, VARIANT_HUO, nsnull); case eCSSProperty_border_collapse: return ParseVariant(aErrorCode, aValue, VARIANT_HK, nsCSSProps::kBorderCollapseKTable); diff --git a/layout/html/style/src/nsCSSPropList.h b/layout/html/style/src/nsCSSPropList.h index e07c4095493..a71b13a4eee 100644 --- a/layout/html/style/src/nsCSSPropList.h +++ b/layout/html/style/src/nsCSSPropList.h @@ -56,6 +56,7 @@ CSS_PROP(background_position, VISUAL) CSS_PROP(background_repeat, VISUAL) CSS_PROP(background_x_position, VISUAL) CSS_PROP(background_y_position, VISUAL) +CSS_PROP(behavior, REFLOW) CSS_PROP(border, REFLOW) CSS_PROP(border_bottom, REFLOW) CSS_PROP(border_bottom_color, VISUAL) diff --git a/layout/html/style/src/nsCSSProps.cpp b/layout/html/style/src/nsCSSProps.cpp index 6316f338fc9..ced147a5b06 100644 --- a/layout/html/style/src/nsCSSProps.cpp +++ b/layout/html/style/src/nsCSSProps.cpp @@ -720,6 +720,9 @@ static const PRInt32 kBackgroundYPositionKTable[] = { case eCSSProperty_background_y_position: return SearchKeywordTable(aValue, kBackgroundYPositionKTable); + case eCSSProperty_behavior: + break; + case eCSSProperty_border: break; diff --git a/layout/html/style/src/nsCSSStyleRule.cpp b/layout/html/style/src/nsCSSStyleRule.cpp index 8bd3fb0bd0f..569576f3ccd 100644 --- a/layout/html/style/src/nsCSSStyleRule.cpp +++ b/layout/html/style/src/nsCSSStyleRule.cpp @@ -2523,6 +2523,11 @@ MapDeclarationUIInto(nsICSSDeclaration* aDeclaration, ui->mUserSelect = parentUI->mUserSelect; } + // behavior: url, none + if (eCSSUnit_URL == ourUI->mBehavior.GetUnit()) { + ourUI->mBehavior.GetStringValue(ui->mBehavior); + } + // key-equivalent: none, enum XXX, inherit nsCSSValueList* keyEquiv = ourUI->mKeyEquivalent; if (keyEquiv) { diff --git a/layout/html/style/src/nsDOMCSSDeclaration.cpp b/layout/html/style/src/nsDOMCSSDeclaration.cpp index c69cad69e9e..f81a1c4dcab 100644 --- a/layout/html/style/src/nsDOMCSSDeclaration.cpp +++ b/layout/html/style/src/nsDOMCSSDeclaration.cpp @@ -296,6 +296,18 @@ nsDOMCSSDeclaration::SetBackgroundRepeat(const nsString& aBackgroundRepeat) return SetProperty("background-repeat", aBackgroundRepeat, ""); } +NS_IMETHODIMP +nsDOMCSSDeclaration::GetBehavior(nsString& aBehavior) +{ + return GetPropertyValue("behavior", aBehavior); +} + +NS_IMETHODIMP +nsDOMCSSDeclaration::SetBehavior(const nsString& aBehavior) +{ + return SetProperty("behavior", aBehavior, ""); +} + NS_IMETHODIMP nsDOMCSSDeclaration::GetBorder(nsString& aBorder) { diff --git a/layout/html/style/src/nsICSSDeclaration.h b/layout/html/style/src/nsICSSDeclaration.h index 3155fe03612..d7b809a577a 100644 --- a/layout/html/style/src/nsICSSDeclaration.h +++ b/layout/html/style/src/nsICSSDeclaration.h @@ -349,6 +349,7 @@ struct nsCSSUserInterface : public nsCSSStruct { // NEW nsCSSValueList* mKeyEquivalent; nsCSSValue mUserFocus; nsCSSValue mResizer; + nsCSSValue mBehavior; }; struct nsCSSAural : public nsCSSStruct { // NEW diff --git a/layout/style/nsCSSDeclaration.cpp b/layout/style/nsCSSDeclaration.cpp index 362ace9cab0..806423123fa 100644 --- a/layout/style/nsCSSDeclaration.cpp +++ b/layout/style/nsCSSDeclaration.cpp @@ -796,7 +796,8 @@ nsCSSUserInterface::nsCSSUserInterface(const nsCSSUserInterface& aCopy) mUserSelect(aCopy.mUserSelect), mKeyEquivalent(nsnull), mUserFocus(aCopy.mUserFocus), - mResizer(aCopy.mResizer) + mResizer(aCopy.mResizer), + mBehavior(aCopy.mBehavior) { CSS_IF_COPY(mKeyEquivalent, nsCSSValueList); } @@ -827,6 +828,7 @@ void nsCSSUserInterface::List(FILE* out, PRInt32 aIndent) const } mUserFocus.AppendToString(buffer, eCSSProperty_user_focus); mResizer.AppendToString(buffer, eCSSProperty_resizer); + mBehavior.AppendToString(buffer, eCSSProperty_behavior); fputs(buffer, out); } @@ -1566,6 +1568,7 @@ CSSDeclarationImpl::AppendValue(nsCSSProperty aProperty, const nsCSSValue& aValu case eCSSProperty_key_equivalent: case eCSSProperty_user_focus: case eCSSProperty_resizer: + case eCSSProperty_behavior: CSS_ENSURE(UserInterface) { switch (aProperty) { case eCSSProperty_user_input: mUserInterface->mUserInput = aValue; break; @@ -1579,6 +1582,7 @@ CSSDeclarationImpl::AppendValue(nsCSSProperty aProperty, const nsCSSValue& aValu break; case eCSSProperty_user_focus: mUserInterface->mUserFocus = aValue; break; case eCSSProperty_resizer: mUserInterface->mResizer = aValue; break; + case eCSSProperty_behavior: mUserInterface->mBehavior = aValue; break; CSS_BOGUS_DEFAULT; // make compiler happy } } @@ -2269,6 +2273,7 @@ CSSDeclarationImpl::SetValueImportant(nsCSSProperty aProperty) case eCSSProperty_user_select: case eCSSProperty_user_focus: case eCSSProperty_resizer: + case eCSSProperty_behavior: if (nsnull != mUserInterface) { CSS_ENSURE_IMPORTANT(UserInterface) { switch (aProperty) { @@ -2277,6 +2282,7 @@ CSSDeclarationImpl::SetValueImportant(nsCSSProperty aProperty) CSS_CASE_IMPORTANT(eCSSProperty_user_select, mUserInterface->mUserSelect); CSS_CASE_IMPORTANT(eCSSProperty_user_focus, mUserInterface->mUserFocus); CSS_CASE_IMPORTANT(eCSSProperty_resizer, mUserInterface->mResizer); + CSS_CASE_IMPORTANT(eCSSProperty_behavior, mUserInterface->mBehavior); CSS_BOGUS_DEFAULT; // make compiler happy } } @@ -2954,6 +2960,7 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsCSSValue& aValue) case eCSSProperty_key_equivalent: case eCSSProperty_user_focus: case eCSSProperty_resizer: + case eCSSProperty_behavior: if (nsnull != mUserInterface) { switch (aProperty) { case eCSSProperty_user_input: aValue = mUserInterface->mUserInput; break; @@ -2966,6 +2973,8 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsCSSValue& aValue) break; case eCSSProperty_user_focus: aValue = mUserInterface->mUserFocus; break; case eCSSProperty_resizer: aValue = mUserInterface->mResizer; break; + case eCSSProperty_behavior: aValue = mUserInterface->mBehavior; break; + CSS_BOGUS_DEFAULT; // make compiler happy } } diff --git a/layout/style/nsCSSParser.cpp b/layout/style/nsCSSParser.cpp index 96a16ec7cd1..4d976bd7689 100644 --- a/layout/style/nsCSSParser.cpp +++ b/layout/style/nsCSSParser.cpp @@ -2838,6 +2838,8 @@ PRBool CSSParserImpl::ParseSingleValueProperty(PRInt32& aErrorCode, case eCSSProperty_background_y_position: return ParseVariant(aErrorCode, aValue, VARIANT_HKLP, kBackgroundXYPositionKTable); + case eCSSProperty_behavior: + return ParseVariant(aErrorCode, aValue, VARIANT_HUO, nsnull); case eCSSProperty_border_collapse: return ParseVariant(aErrorCode, aValue, VARIANT_HK, nsCSSProps::kBorderCollapseKTable); diff --git a/layout/style/nsCSSPropList.h b/layout/style/nsCSSPropList.h index e07c4095493..a71b13a4eee 100644 --- a/layout/style/nsCSSPropList.h +++ b/layout/style/nsCSSPropList.h @@ -56,6 +56,7 @@ CSS_PROP(background_position, VISUAL) CSS_PROP(background_repeat, VISUAL) CSS_PROP(background_x_position, VISUAL) CSS_PROP(background_y_position, VISUAL) +CSS_PROP(behavior, REFLOW) CSS_PROP(border, REFLOW) CSS_PROP(border_bottom, REFLOW) CSS_PROP(border_bottom_color, VISUAL) diff --git a/layout/style/nsCSSProps.cpp b/layout/style/nsCSSProps.cpp index 6316f338fc9..ced147a5b06 100644 --- a/layout/style/nsCSSProps.cpp +++ b/layout/style/nsCSSProps.cpp @@ -720,6 +720,9 @@ static const PRInt32 kBackgroundYPositionKTable[] = { case eCSSProperty_background_y_position: return SearchKeywordTable(aValue, kBackgroundYPositionKTable); + case eCSSProperty_behavior: + break; + case eCSSProperty_border: break; diff --git a/layout/style/nsCSSStruct.cpp b/layout/style/nsCSSStruct.cpp index 362ace9cab0..806423123fa 100644 --- a/layout/style/nsCSSStruct.cpp +++ b/layout/style/nsCSSStruct.cpp @@ -796,7 +796,8 @@ nsCSSUserInterface::nsCSSUserInterface(const nsCSSUserInterface& aCopy) mUserSelect(aCopy.mUserSelect), mKeyEquivalent(nsnull), mUserFocus(aCopy.mUserFocus), - mResizer(aCopy.mResizer) + mResizer(aCopy.mResizer), + mBehavior(aCopy.mBehavior) { CSS_IF_COPY(mKeyEquivalent, nsCSSValueList); } @@ -827,6 +828,7 @@ void nsCSSUserInterface::List(FILE* out, PRInt32 aIndent) const } mUserFocus.AppendToString(buffer, eCSSProperty_user_focus); mResizer.AppendToString(buffer, eCSSProperty_resizer); + mBehavior.AppendToString(buffer, eCSSProperty_behavior); fputs(buffer, out); } @@ -1566,6 +1568,7 @@ CSSDeclarationImpl::AppendValue(nsCSSProperty aProperty, const nsCSSValue& aValu case eCSSProperty_key_equivalent: case eCSSProperty_user_focus: case eCSSProperty_resizer: + case eCSSProperty_behavior: CSS_ENSURE(UserInterface) { switch (aProperty) { case eCSSProperty_user_input: mUserInterface->mUserInput = aValue; break; @@ -1579,6 +1582,7 @@ CSSDeclarationImpl::AppendValue(nsCSSProperty aProperty, const nsCSSValue& aValu break; case eCSSProperty_user_focus: mUserInterface->mUserFocus = aValue; break; case eCSSProperty_resizer: mUserInterface->mResizer = aValue; break; + case eCSSProperty_behavior: mUserInterface->mBehavior = aValue; break; CSS_BOGUS_DEFAULT; // make compiler happy } } @@ -2269,6 +2273,7 @@ CSSDeclarationImpl::SetValueImportant(nsCSSProperty aProperty) case eCSSProperty_user_select: case eCSSProperty_user_focus: case eCSSProperty_resizer: + case eCSSProperty_behavior: if (nsnull != mUserInterface) { CSS_ENSURE_IMPORTANT(UserInterface) { switch (aProperty) { @@ -2277,6 +2282,7 @@ CSSDeclarationImpl::SetValueImportant(nsCSSProperty aProperty) CSS_CASE_IMPORTANT(eCSSProperty_user_select, mUserInterface->mUserSelect); CSS_CASE_IMPORTANT(eCSSProperty_user_focus, mUserInterface->mUserFocus); CSS_CASE_IMPORTANT(eCSSProperty_resizer, mUserInterface->mResizer); + CSS_CASE_IMPORTANT(eCSSProperty_behavior, mUserInterface->mBehavior); CSS_BOGUS_DEFAULT; // make compiler happy } } @@ -2954,6 +2960,7 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsCSSValue& aValue) case eCSSProperty_key_equivalent: case eCSSProperty_user_focus: case eCSSProperty_resizer: + case eCSSProperty_behavior: if (nsnull != mUserInterface) { switch (aProperty) { case eCSSProperty_user_input: aValue = mUserInterface->mUserInput; break; @@ -2966,6 +2973,8 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsCSSValue& aValue) break; case eCSSProperty_user_focus: aValue = mUserInterface->mUserFocus; break; case eCSSProperty_resizer: aValue = mUserInterface->mResizer; break; + case eCSSProperty_behavior: aValue = mUserInterface->mBehavior; break; + CSS_BOGUS_DEFAULT; // make compiler happy } } diff --git a/layout/style/nsCSSStyleRule.cpp b/layout/style/nsCSSStyleRule.cpp index 8bd3fb0bd0f..569576f3ccd 100644 --- a/layout/style/nsCSSStyleRule.cpp +++ b/layout/style/nsCSSStyleRule.cpp @@ -2523,6 +2523,11 @@ MapDeclarationUIInto(nsICSSDeclaration* aDeclaration, ui->mUserSelect = parentUI->mUserSelect; } + // behavior: url, none + if (eCSSUnit_URL == ourUI->mBehavior.GetUnit()) { + ourUI->mBehavior.GetStringValue(ui->mBehavior); + } + // key-equivalent: none, enum XXX, inherit nsCSSValueList* keyEquiv = ourUI->mKeyEquivalent; if (keyEquiv) { diff --git a/layout/style/nsDOMCSSDeclaration.cpp b/layout/style/nsDOMCSSDeclaration.cpp index c69cad69e9e..f81a1c4dcab 100644 --- a/layout/style/nsDOMCSSDeclaration.cpp +++ b/layout/style/nsDOMCSSDeclaration.cpp @@ -296,6 +296,18 @@ nsDOMCSSDeclaration::SetBackgroundRepeat(const nsString& aBackgroundRepeat) return SetProperty("background-repeat", aBackgroundRepeat, ""); } +NS_IMETHODIMP +nsDOMCSSDeclaration::GetBehavior(nsString& aBehavior) +{ + return GetPropertyValue("behavior", aBehavior); +} + +NS_IMETHODIMP +nsDOMCSSDeclaration::SetBehavior(const nsString& aBehavior) +{ + return SetProperty("behavior", aBehavior, ""); +} + NS_IMETHODIMP nsDOMCSSDeclaration::GetBorder(nsString& aBorder) { diff --git a/layout/style/nsStyleContext.cpp b/layout/style/nsStyleContext.cpp index 7e147a9265e..436ba6f8b90 100644 --- a/layout/style/nsStyleContext.cpp +++ b/layout/style/nsStyleContext.cpp @@ -1496,16 +1496,33 @@ void StyleUserInterfaceImpl::ResetFrom(const nsStyleUserInterface* aParent, nsIP void StyleUserInterfaceImpl::SetFrom(const nsStyleUserInterface& aSource) { - nsCRT::memcpy((nsStyleUserInterface*)this, &aSource, sizeof(nsStyleUserInterface)); + mUserInput = aSource.mUserInput; + mUserModify = aSource.mUserModify; + mUserFocus = aSource.mUserFocus; + + mUserSelect = aSource.mUserSelect; + mKeyEquivalent = aSource.mKeyEquivalent; + mResizer = aSource.mResizer; + mBehavior = aSource.mBehavior; } void StyleUserInterfaceImpl::CopyTo(nsStyleUserInterface& aDest) const { - nsCRT::memcpy(&aDest, (const nsStyleUserInterface*)this, sizeof(nsStyleUserInterface)); + aDest.mUserInput = mUserInput; + aDest.mUserModify = mUserModify; + aDest.mUserFocus = mUserFocus; + + aDest.mUserSelect = mUserSelect; + aDest.mKeyEquivalent = mKeyEquivalent; + aDest.mResizer = mResizer; + aDest.mBehavior = mBehavior; } PRInt32 StyleUserInterfaceImpl::CalcDifference(const StyleUserInterfaceImpl& aOther) const { + if (mBehavior != aOther.mBehavior) + return NS_STYLE_HINT_FRAMECHANGE; + if ((mUserInput == aOther.mUserInput) && (mResizer == aOther.mResizer)) { if ((mUserModify == aOther.mUserModify) &&