From 565357f6d2e756f385113f99ee2b43aa1253486a Mon Sep 17 00:00:00 2001 From: "dbaron%dbaron.org" Date: Thu, 26 Aug 2004 22:35:38 +0000 Subject: [PATCH] Backout the CSS parts of bug 72747 to see if that fixes the Tp regression. git-svn-id: svn://10.0.0.236/trunk@161357 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/content/base/src/nsRuleNode.cpp | 53 +++--------------- mozilla/content/base/src/nsStyleContext.cpp | 5 +- .../html/content/src/nsGenericHTMLElement.cpp | 55 +++++++++---------- .../html/style/src/nsCSSDeclaration.cpp | 37 ------------- .../content/html/style/src/nsCSSDeclaration.h | 2 - .../content/html/style/src/nsCSSParser.cpp | 36 +----------- .../content/html/style/src/nsCSSStruct.cpp | 6 +- mozilla/content/html/style/src/nsCSSStruct.h | 3 +- .../html/style/src/nsComputedDOMStyle.cpp | 54 +----------------- .../html/style/src/nsComputedDOMStyle.h | 2 - .../html/style/src/nsHTMLCSSStyleSheet.cpp | 3 +- mozilla/content/shared/public/nsCSSPropList.h | 4 +- mozilla/content/shared/public/nsCSSProps.h | 1 - mozilla/content/shared/public/nsStyleStruct.h | 14 ++--- mozilla/content/shared/src/nsCSSProps.cpp | 16 ------ mozilla/content/shared/src/nsStyleStruct.cpp | 9 +-- .../public/idl/css/nsIDOMCSS2Properties.idl | 7 --- mozilla/layout/base/nsCSSFrameConstructor.cpp | 13 ++--- mozilla/layout/base/nsPresContext.cpp | 2 +- mozilla/layout/base/nsPresContext.h | 9 ++- mozilla/layout/base/public/nsPresContext.h | 9 ++- mozilla/layout/base/src/nsPresContext.cpp | 2 +- mozilla/layout/forms/nsTextControlFrame.cpp | 4 +- mozilla/layout/generic/nsBlockFrame.cpp | 8 +-- mozilla/layout/generic/nsContainerFrame.cpp | 6 +- mozilla/layout/generic/nsFrameFrame.cpp | 20 ++++++- mozilla/layout/generic/nsGfxScrollFrame.cpp | 26 +++++++-- mozilla/layout/html/base/src/nsBlockFrame.cpp | 8 +-- .../layout/html/base/src/nsContainerFrame.cpp | 6 +- .../layout/html/base/src/nsGfxScrollFrame.cpp | 26 +++++++-- .../layout/html/document/src/nsFrameFrame.cpp | 20 ++++++- .../html/forms/src/nsTextControlFrame.cpp | 4 +- .../html/style/src/nsCSSFrameConstructor.cpp | 13 ++--- mozilla/layout/style/nsCSSDeclaration.cpp | 37 ------------- mozilla/layout/style/nsCSSDeclaration.h | 2 - mozilla/layout/style/nsCSSParser.cpp | 36 +----------- mozilla/layout/style/nsCSSPropList.h | 4 +- mozilla/layout/style/nsCSSProps.cpp | 16 ------ mozilla/layout/style/nsCSSProps.h | 1 - mozilla/layout/style/nsCSSStruct.cpp | 6 +- mozilla/layout/style/nsCSSStruct.h | 3 +- mozilla/layout/style/nsComputedDOMStyle.cpp | 54 +----------------- mozilla/layout/style/nsComputedDOMStyle.h | 2 - mozilla/layout/style/nsHTMLCSSStyleSheet.cpp | 3 +- mozilla/layout/style/nsRuleNode.cpp | 53 +++--------------- mozilla/layout/style/nsStyleContext.cpp | 5 +- mozilla/layout/style/nsStyleStruct.cpp | 9 +-- mozilla/layout/style/nsStyleStruct.h | 14 ++--- mozilla/layout/xul/base/src/nsBoxFrame.cpp | 8 +-- 49 files changed, 199 insertions(+), 537 deletions(-) diff --git a/mozilla/content/base/src/nsRuleNode.cpp b/mozilla/content/base/src/nsRuleNode.cpp index 2c0a7cafc20..70b8ddb1114 100644 --- a/mozilla/content/base/src/nsRuleNode.cpp +++ b/mozilla/content/base/src/nsRuleNode.cpp @@ -2614,55 +2614,16 @@ nsRuleNode::ComputeDisplayData(nsStyleStruct* aStartStruct, display->mFloats = parentDisplay->mFloats; } - // overflow-x: enum, auto, inherit - if (eCSSUnit_Enumerated == displayData.mOverflowX.GetUnit()) { - display->mOverflowX = displayData.mOverflowX.GetIntValue(); + // overflow: enum, auto, inherit + if (eCSSUnit_Enumerated == displayData.mOverflow.GetUnit()) { + display->mOverflow = displayData.mOverflow.GetIntValue(); } - else if (eCSSUnit_Auto == displayData.mOverflowX.GetUnit()) { - display->mOverflowX = NS_STYLE_OVERFLOW_AUTO; + else if (eCSSUnit_Auto == displayData.mOverflow.GetUnit()) { + display->mOverflow = NS_STYLE_OVERFLOW_AUTO; } - else if (eCSSUnit_Inherit == displayData.mOverflowX.GetUnit()) { + else if (eCSSUnit_Inherit == displayData.mOverflow.GetUnit()) { inherited = PR_TRUE; - display->mOverflowX = parentDisplay->mOverflowX; - } - - // overflow-y: enum, auto, inherit - if (eCSSUnit_Enumerated == displayData.mOverflowY.GetUnit()) { - display->mOverflowY = displayData.mOverflowY.GetIntValue(); - } - else if (eCSSUnit_Auto == displayData.mOverflowY.GetUnit()) { - display->mOverflowY = NS_STYLE_OVERFLOW_AUTO; - } - else if (eCSSUnit_Inherit == displayData.mOverflowY.GetUnit()) { - inherited = PR_TRUE; - display->mOverflowY = parentDisplay->mOverflowY; - } - - // CSS3 overflow-x and overflow-y require some fixup as well in some - // cases. NS_STYLE_OVERFLOW_VISIBLE and NS_STYLE_OVERFLOW_CLIP are - // meaningful only when used in both dimensions. - if (display->mOverflowX != display->mOverflowY && - (display->mOverflowX == NS_STYLE_OVERFLOW_VISIBLE || - display->mOverflowX == NS_STYLE_OVERFLOW_CLIP || - display->mOverflowY == NS_STYLE_OVERFLOW_VISIBLE || - display->mOverflowY == NS_STYLE_OVERFLOW_CLIP)) { - // We can't store in the rule tree since a more specific rule might - // change these conditions. - inherited = PR_TRUE; - - // NS_STYLE_OVERFLOW_CLIP is a deprecated value, so if it's specified - // in only one dimension, convert it to NS_STYLE_OVERFLOW_HIDDEN. - if (display->mOverflowX == NS_STYLE_OVERFLOW_CLIP) - display->mOverflowX = NS_STYLE_OVERFLOW_HIDDEN; - if (display->mOverflowY == NS_STYLE_OVERFLOW_CLIP) - display->mOverflowY = NS_STYLE_OVERFLOW_HIDDEN; - - // If 'visible' is specified but doesn't match the other dimension, it - // turns into 'auto'. - if (display->mOverflowX == NS_STYLE_OVERFLOW_VISIBLE) - display->mOverflowX = NS_STYLE_OVERFLOW_AUTO; - if (display->mOverflowY == NS_STYLE_OVERFLOW_VISIBLE) - display->mOverflowY = NS_STYLE_OVERFLOW_AUTO; + display->mOverflow = parentDisplay->mOverflow; } // clip property: length, auto, inherit diff --git a/mozilla/content/base/src/nsStyleContext.cpp b/mozilla/content/base/src/nsStyleContext.cpp index 1639d71ec00..80b6503a85d 100644 --- a/mozilla/content/base/src/nsStyleContext.cpp +++ b/mozilla/content/base/src/nsStyleContext.cpp @@ -740,7 +740,7 @@ void nsStyleContext::DumpRegressionData(nsPresContext* aPresContext, FILE* out, // DISPLAY IndentBy(out,aIndent); const nsStyleDisplay* disp = GetStyleDisplay(); - fprintf(out, "\n", + fprintf(out, "\n", (int)disp->mPosition, (int)disp->mDisplay, (float)disp->mOpacity, @@ -748,8 +748,7 @@ void nsStyleContext::DumpRegressionData(nsPresContext* aPresContext, FILE* out, (int)disp->mBreakType, (int)disp->mBreakBefore, (int)disp->mBreakAfter, - (int)disp->mOverflowX, - (int)disp->mOverflowY, + (int)disp->mOverflow, (int)disp->mClipFlags, (long)disp->mClip.x, (long)disp->mClip.y, diff --git a/mozilla/content/html/content/src/nsGenericHTMLElement.cpp b/mozilla/content/html/content/src/nsGenericHTMLElement.cpp index 25493ac282f..79437d43c21 100644 --- a/mozilla/content/html/content/src/nsGenericHTMLElement.cpp +++ b/mozilla/content/html/content/src/nsGenericHTMLElement.cpp @@ -3028,39 +3028,34 @@ nsGenericHTMLElement::MapScrollingAttributeInto(const nsMappedAttributes* aAttri return; // scrolling - nsCSSValue* overflowValues[2] = { - &aData->mDisplayData->mOverflowX, - &aData->mDisplayData->mOverflowY, - }; - for (PRInt32 i = 0; i < NS_ARRAY_LENGTH(overflowValues); ++i) { - if (overflowValues[i]->GetUnit() == eCSSUnit_Null) { - const nsAttrValue* value = aAttributes->GetAttr(nsHTMLAtoms::scrolling); - if (value && value->Type() == nsAttrValue::eEnum) { - PRInt32 mappedValue; - switch (value->GetEnumValue()) { - case NS_STYLE_FRAME_ON: - case NS_STYLE_FRAME_SCROLL: - case NS_STYLE_FRAME_YES: - mappedValue = NS_STYLE_OVERFLOW_SCROLL; - break; + if (aData->mDisplayData->mOverflow.GetUnit() == eCSSUnit_Null) { + const nsAttrValue* value = aAttributes->GetAttr(nsHTMLAtoms::scrolling); + if (value && value->Type() == nsAttrValue::eEnum) { + PRInt32 mappedValue; + switch (value->GetEnumValue()) { + case NS_STYLE_FRAME_ON: + case NS_STYLE_FRAME_SCROLL: + case NS_STYLE_FRAME_YES: + mappedValue = NS_STYLE_OVERFLOW_SCROLL; + break; - case NS_STYLE_FRAME_OFF: - case NS_STYLE_FRAME_NOSCROLL: - case NS_STYLE_FRAME_NO: - mappedValue = NS_STYLE_OVERFLOW_HIDDEN; - break; - - case NS_STYLE_FRAME_AUTO: - mappedValue = NS_STYLE_OVERFLOW_AUTO; - break; + case NS_STYLE_FRAME_OFF: + case NS_STYLE_FRAME_NOSCROLL: + case NS_STYLE_FRAME_NO: + mappedValue = NS_STYLE_OVERFLOW_HIDDEN; + break; + + case NS_STYLE_FRAME_AUTO: + mappedValue = NS_STYLE_OVERFLOW_AUTO; + break; - default: - NS_NOTREACHED("unexpected value"); - mappedValue = NS_STYLE_OVERFLOW_AUTO; - break; - } - overflowValues[i]->SetIntValue(mappedValue, eCSSUnit_Enumerated); + default: + NS_NOTREACHED("unexpected value"); + mappedValue = NS_STYLE_OVERFLOW_AUTO; + break; } + aData->mDisplayData->mOverflow.SetIntValue(mappedValue, + eCSSUnit_Enumerated); } } } diff --git a/mozilla/content/html/style/src/nsCSSDeclaration.cpp b/mozilla/content/html/style/src/nsCSSDeclaration.cpp index 84df769f526..73e5e90ed3a 100644 --- a/mozilla/content/html/style/src/nsCSSDeclaration.cpp +++ b/mozilla/content/html/style/src/nsCSSDeclaration.cpp @@ -630,14 +630,6 @@ nsCSSDeclaration::GetValue(nsCSSProperty aProperty, aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_list_style_image, aValue); break; - case eCSSProperty_overflow: { - nsCSSValue xValue, yValue; - GetValueOrImportantValue(eCSSProperty_overflow_x, xValue); - GetValueOrImportantValue(eCSSProperty_overflow_y, yValue); - if (xValue == yValue) - AppendValueToString(eCSSProperty_overflow_x, aValue); - break; - } case eCSSProperty_pause: { if (AppendValueToString(eCSSProperty_pause_after, aValue)) { aValue.Append(PRUnichar(' ')); @@ -977,27 +969,6 @@ nsCSSDeclaration::UseBackgroundPosition(nsAString & aString, aBgPositionY = 0; } -void -nsCSSDeclaration::TryOverflowShorthand(nsAString & aString, - PRInt32 & aOverflowX, - PRInt32 & aOverflowY) const -{ - PRBool isImportant; - if (aOverflowX && aOverflowY && - AllPropertiesSameImportance(aOverflowX, aOverflowY, - 0, 0, 0, 0, isImportant)) { - nsCSSValue xValue, yValue; - GetValueOrImportantValue(eCSSProperty_overflow_x, xValue); - GetValueOrImportantValue(eCSSProperty_overflow_y, yValue); - if (xValue == yValue) { - AppendCSSValueToString(eCSSProperty_overflow_x, xValue, aString); - AppendImportanceToString(isImportant, aString); - aString.AppendLiteral("; "); - aOverflowX = aOverflowY = 0; - } - } -} - #define NS_CASE_OUTPUT_PROPERTY_VALUE(_prop, _index) \ case _prop: \ if (_index) { \ @@ -1042,7 +1013,6 @@ nsCSSDeclaration::ToString(nsAString& aString) const PRInt32 paddingTop = 0, paddingBottom = 0, paddingLeft = 0, paddingRight = 0; PRInt32 bgColor = 0, bgImage = 0, bgRepeat = 0, bgAttachment = 0; PRInt32 bgPositionX = 0, bgPositionY = 0; - PRInt32 overflowX = 0, overflowY = 0; PRUint32 borderPropertiesSet = 0, finalBorderPropertiesToSet = 0; for (index = 0; index < count; index++) { nsCSSProperty property = OrderValueAt(index); @@ -1103,9 +1073,6 @@ nsCSSDeclaration::ToString(nsAString& aString) const case eCSSProperty_background_x_position: bgPositionX = index+1; break; case eCSSProperty_background_y_position: bgPositionY = index+1; break; - case eCSSProperty_overflow_x: overflowX = index+1; break; - case eCSSProperty_overflow_y: overflowY = index+1; break; - default: break; } } @@ -1174,7 +1141,6 @@ nsCSSDeclaration::ToString(nsAString& aString) const TryBackgroundShorthand(aString, bgColor, bgImage, bgRepeat, bgAttachment, bgPositionX, bgPositionY); - TryOverflowShorthand(aString, overflowX, overflowY); for (index = 0; index < count; index++) { nsCSSProperty property = OrderValueAt(index); @@ -1250,9 +1216,6 @@ nsCSSDeclaration::ToString(nsAString& aString) const break; } - NS_CASE_OUTPUT_PROPERTY_VALUE(eCSSProperty_overflow_x, overflowX) - NS_CASE_OUTPUT_PROPERTY_VALUE(eCSSProperty_overflow_y, overflowY) - case eCSSProperty_margin_left_ltr_source: case eCSSProperty_margin_left_rtl_source: case eCSSProperty_margin_right_ltr_source: diff --git a/mozilla/content/html/style/src/nsCSSDeclaration.h b/mozilla/content/html/style/src/nsCSSDeclaration.h index ead908df86a..fe7a3bb0d83 100644 --- a/mozilla/content/html/style/src/nsCSSDeclaration.h +++ b/mozilla/content/html/style/src/nsCSSDeclaration.h @@ -190,8 +190,6 @@ private: void UseBackgroundPosition(nsAString & aString, PRInt32 & aBgPositionX, PRInt32 & aBgPositionY) const; - void TryOverflowShorthand(nsAString & aString, - PRInt32 & aOverflowX, PRInt32 & aOverflowY) const; PRBool AllPropertiesSameImportance(PRInt32 aFirst, PRInt32 aSecond, PRInt32 aThird, PRInt32 aFourth, diff --git a/mozilla/content/html/style/src/nsCSSParser.cpp b/mozilla/content/html/style/src/nsCSSParser.cpp index 8a92cad5468..58f254ef2d8 100644 --- a/mozilla/content/html/style/src/nsCSSParser.cpp +++ b/mozilla/content/html/style/src/nsCSSParser.cpp @@ -261,7 +261,6 @@ protected: #ifdef ENABLE_OUTLINE PRBool ParseOutline(nsresult& aErrorCode); #endif - PRBool ParseOverflow(nsresult& aErrorCode); PRBool ParsePadding(nsresult& aErrorCode); PRBool ParsePause(nsresult& aErrorCode); PRBool ParsePlayDuring(nsresult& aErrorCode); @@ -4025,8 +4024,6 @@ PRBool CSSParserImpl::ParseProperty(nsresult& aErrorCode, case eCSSProperty__moz_outline: return ParseOutline(aErrorCode); #endif - case eCSSProperty_overflow: - return ParseOverflow(aErrorCode); case eCSSProperty_padding: return ParsePadding(aErrorCode); case eCSSProperty_padding_end: @@ -4160,7 +4157,6 @@ PRBool CSSParserImpl::ParseSingleValueProperty(nsresult& aErrorCode, case eCSSProperty__moz_outline: case eCSSProperty__moz_outline_radius: #endif - case eCSSProperty_overflow: case eCSSProperty_padding: case eCSSProperty_padding_end: case eCSSProperty_padding_left: @@ -4447,10 +4443,9 @@ PRBool CSSParserImpl::ParseSingleValueProperty(nsresult& aErrorCode, return ParseVariant(aErrorCode, aValue, VARIANT_HKL, nsCSSProps::kBorderWidthKTable); #endif - case eCSSProperty_overflow_x: - case eCSSProperty_overflow_y: + case eCSSProperty_overflow: return ParseVariant(aErrorCode, aValue, VARIANT_AHK, - nsCSSProps::kOverflowSubKTable); + nsCSSProps::kOverflowKTable); case eCSSProperty_padding_bottom: case eCSSProperty_padding_end_value: // for internal use case eCSSProperty_padding_left_value: // for internal use @@ -5559,33 +5554,6 @@ PRBool CSSParserImpl::ParseOutline(nsresult& aErrorCode) } #endif -PRBool CSSParserImpl::ParseOverflow(nsresult& aErrorCode) -{ - nsCSSValue overflow; - if (!ParseVariant(aErrorCode, overflow, VARIANT_AHK, - nsCSSProps::kOverflowKTable) || - !ExpectEndProperty(aErrorCode, PR_TRUE)) - return PR_FALSE; - - nsCSSValue overflowX(overflow); - nsCSSValue overflowY(overflow); - if (eCSSUnit_Enumerated == overflow.GetUnit()) - switch(overflow.GetIntValue()) { - case NS_STYLE_OVERFLOW_SCROLLBARS_HORIZONTAL: - overflowX.SetIntValue(NS_STYLE_OVERFLOW_SCROLL, eCSSUnit_Enumerated); - overflowY.SetIntValue(NS_STYLE_OVERFLOW_HIDDEN, eCSSUnit_Enumerated); - break; - case NS_STYLE_OVERFLOW_SCROLLBARS_VERTICAL: - overflowX.SetIntValue(NS_STYLE_OVERFLOW_HIDDEN, eCSSUnit_Enumerated); - overflowY.SetIntValue(NS_STYLE_OVERFLOW_SCROLL, eCSSUnit_Enumerated); - break; - } - AppendValue(eCSSProperty_overflow_x, overflowX); - AppendValue(eCSSProperty_overflow_y, overflowY); - aErrorCode = NS_OK; - return PR_TRUE; -} - PRBool CSSParserImpl::ParsePadding(nsresult& aErrorCode) { static const nsCSSProperty kPaddingSideIDs[] = { diff --git a/mozilla/content/html/style/src/nsCSSStruct.cpp b/mozilla/content/html/style/src/nsCSSStruct.cpp index a4cac3eaa95..1470519b68b 100644 --- a/mozilla/content/html/style/src/nsCSSStruct.cpp +++ b/mozilla/content/html/style/src/nsCSSStruct.cpp @@ -487,8 +487,7 @@ nsCSSDisplay::nsCSSDisplay(const nsCSSDisplay& aCopy) mFloat(aCopy.mFloat), mClear(aCopy.mClear), mClip(aCopy.mClip), - mOverflowX(aCopy.mOverflowX), - mOverflowY(aCopy.mOverflowY), + mOverflow(aCopy.mOverflow), mVisibility(aCopy.mVisibility), mOpacity(aCopy.mOpacity), // temp fix for bug 24000 @@ -524,8 +523,7 @@ void nsCSSDisplay::List(FILE* out, PRInt32 aIndent) const fputs(NS_LossyConvertUCS2toASCII(buffer).get(), out); mClip.List(out, eCSSProperty_clip); buffer.SetLength(0); - mOverflowX.AppendToString(buffer, eCSSProperty_overflow_x); - mOverflowY.AppendToString(buffer, eCSSProperty_overflow_y); + mOverflow.AppendToString(buffer, eCSSProperty_overflow); fputs(NS_LossyConvertUCS2toASCII(buffer).get(), out); } #endif diff --git a/mozilla/content/html/style/src/nsCSSStruct.h b/mozilla/content/html/style/src/nsCSSStruct.h index ae641fcff59..a5a06ad9d83 100644 --- a/mozilla/content/html/style/src/nsCSSStruct.h +++ b/mozilla/content/html/style/src/nsCSSStruct.h @@ -234,8 +234,7 @@ struct nsCSSDisplay : public nsCSSStruct { nsCSSValue mFloat; nsCSSValue mClear; nsCSSRect mClip; - nsCSSValue mOverflowX; - nsCSSValue mOverflowY; + nsCSSValue mOverflow; nsCSSValue mVisibility; nsCSSValue mOpacity; diff --git a/mozilla/content/html/style/src/nsComputedDOMStyle.cpp b/mozilla/content/html/style/src/nsComputedDOMStyle.cpp index dbdd5b85c35..af6f875d0f8 100644 --- a/mozilla/content/html/style/src/nsComputedDOMStyle.cpp +++ b/mozilla/content/html/style/src/nsComputedDOMStyle.cpp @@ -2344,56 +2344,10 @@ nsComputedDOMStyle::GetOverflow(nsIFrame *aFrame, const nsStyleDisplay* display = nsnull; GetStyleData(eStyleStruct_Display, (const nsStyleStruct*&)display, aFrame); - if (display && display->mOverflowX == display->mOverflowY) { - if (display->mOverflowX != NS_STYLE_OVERFLOW_AUTO) { - const nsAFlatCString& overflow = - nsCSSProps::SearchKeywordTable(display->mOverflowX, - nsCSSProps::kOverflowKTable); - val->SetIdent(overflow); - } else { - val->SetIdent(nsLayoutAtoms::autoAtom); - } - } // XXX else what? - - return CallQueryInterface(val, aValue); -} - -nsresult -nsComputedDOMStyle::GetOverflowX(nsIFrame *aFrame, - nsIDOMCSSValue** aValue) -{ - nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); - - const nsStyleDisplay* display = nsnull; - GetStyleData(eStyleStruct_Display, (const nsStyleStruct*&)display, aFrame); - - if (display && display->mOverflowX != NS_STYLE_OVERFLOW_AUTO) { + if (display && display->mOverflow != NS_STYLE_OVERFLOW_AUTO) { const nsAFlatCString& overflow = - nsCSSProps::SearchKeywordTable(display->mOverflowX, - nsCSSProps::kOverflowSubKTable); - val->SetIdent(overflow); - } else { - val->SetIdent(nsLayoutAtoms::autoAtom); - } - - return CallQueryInterface(val, aValue); -} - -nsresult -nsComputedDOMStyle::GetOverflowY(nsIFrame *aFrame, - nsIDOMCSSValue** aValue) -{ - nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); - - const nsStyleDisplay* display = nsnull; - GetStyleData(eStyleStruct_Display, (const nsStyleStruct*&)display, aFrame); - - if (display && display->mOverflowY != NS_STYLE_OVERFLOW_AUTO) { - const nsAFlatCString& overflow = - nsCSSProps::SearchKeywordTable(display->mOverflowY, - nsCSSProps::kOverflowSubKTable); + nsCSSProps::SearchKeywordTable(display->mOverflow, + nsCSSProps::kOverflowKTable); val->SetIdent(overflow); } else { val->SetIdent(nsLayoutAtoms::autoAtom); @@ -3579,8 +3533,6 @@ nsComputedDOMStyle::GetQueryablePropertyMap(PRUint32* aLength) // COMPUTED_STYLE_MAP_ENTRY(outline_style, OutlineStyle), // COMPUTED_STYLE_MAP_ENTRY(outline_width, OutlineWidth), COMPUTED_STYLE_MAP_ENTRY(overflow, Overflow), - COMPUTED_STYLE_MAP_ENTRY(overflow_x, OverflowX), - COMPUTED_STYLE_MAP_ENTRY(overflow_y, OverflowY), //// COMPUTED_STYLE_MAP_ENTRY(padding, Padding), COMPUTED_STYLE_MAP_ENTRY(padding_bottom, PaddingBottom), COMPUTED_STYLE_MAP_ENTRY(padding_left, PaddingLeft), diff --git a/mozilla/content/html/style/src/nsComputedDOMStyle.h b/mozilla/content/html/style/src/nsComputedDOMStyle.h index 89ea422be79..f5bff76c134 100644 --- a/mozilla/content/html/style/src/nsComputedDOMStyle.h +++ b/mozilla/content/html/style/src/nsComputedDOMStyle.h @@ -272,8 +272,6 @@ private: nsresult GetPosition(nsIFrame *aFrame, nsIDOMCSSValue** aValue); nsresult GetClip(nsIFrame *aFrame, nsIDOMCSSValue** aValue); nsresult GetOverflow(nsIFrame *aFrame, nsIDOMCSSValue** aValue); - nsresult GetOverflowX(nsIFrame *aFrame, nsIDOMCSSValue** aValue); - nsresult GetOverflowY(nsIFrame *aFrame, nsIDOMCSSValue** aValue); /* User interface properties */ nsresult GetCursor(nsIFrame *aFrame, nsIDOMCSSValue** aValue); diff --git a/mozilla/content/html/style/src/nsHTMLCSSStyleSheet.cpp b/mozilla/content/html/style/src/nsHTMLCSSStyleSheet.cpp index 0ade20aeea4..cf65efc5a68 100644 --- a/mozilla/content/html/style/src/nsHTMLCSSStyleSheet.cpp +++ b/mozilla/content/html/style/src/nsHTMLCSSStyleSheet.cpp @@ -184,8 +184,7 @@ CSSDisablePropsRule::CommonMapRuleInfoInto(nsRuleData* aData) aData->mDisplayData->mPosition = staticposition; nsCSSValue visible(NS_STYLE_OVERFLOW_VISIBLE, eCSSUnit_Enumerated); - aData->mDisplayData->mOverflowX = visible; - aData->mDisplayData->mOverflowY = visible; + aData->mDisplayData->mOverflow = visible; // Nobody will care about 'break-before' or 'break-after', since // they only apply to blocks (assuming we implement them correctly). diff --git a/mozilla/content/shared/public/nsCSSPropList.h b/mozilla/content/shared/public/nsCSSPropList.h index bdab54964bd..cae3293be7e 100644 --- a/mozilla/content/shared/public/nsCSSPropList.h +++ b/mozilla/content/shared/public/nsCSSPropList.h @@ -406,9 +406,7 @@ CSS_PROP_SHORTHAND(-moz-outline, _moz_outline, MozOutline) // XXX This is tempo CSS_PROP_OUTLINE(-moz-outline-color, _moz_outline_color, MozOutlineColor, Margin, mOutlineColor, eCSSType_Value, PR_FALSE, kOutlineColorKTable) // XXX bug 48973 CSS_PROP_OUTLINE(-moz-outline-style, _moz_outline_style, MozOutlineStyle, Margin, mOutlineStyle, eCSSType_Value, PR_FALSE, kBorderStyleKTable) // XXX bug 48973 CSS_PROP_OUTLINE(-moz-outline-width, _moz_outline_width, MozOutlineWidth, Margin, mOutlineWidth, eCSSType_Value, PR_TRUE, kBorderWidthKTable) // XXX bug 48973 -CSS_PROP_SHORTHAND(overflow, overflow, Overflow) -CSS_PROP_DISPLAY(overflow-x, overflow_x, OverflowX, Display, mOverflowX, eCSSType_Value, PR_FALSE, kOverflowSubKTable) -CSS_PROP_DISPLAY(overflow-y, overflow_y, OverflowY, Display, mOverflowY, eCSSType_Value, PR_FALSE, kOverflowSubKTable) +CSS_PROP_DISPLAY(overflow, overflow, Overflow, Display, mOverflow, eCSSType_Value, PR_FALSE, kOverflowKTable) CSS_PROP_SHORTHAND(padding, padding, Padding) CSS_PROP_PADDING(padding-bottom, padding_bottom, PaddingBottom, Margin, mPadding.mBottom, eCSSType_Value, PR_TRUE, nsnull) CSS_PROP_SHORTHAND(-moz-padding-end, padding_end, MozPaddingEnd) diff --git a/mozilla/content/shared/public/nsCSSProps.h b/mozilla/content/shared/public/nsCSSProps.h index 57c70d3e45a..0da4a705dcc 100644 --- a/mozilla/content/shared/public/nsCSSProps.h +++ b/mozilla/content/shared/public/nsCSSProps.h @@ -149,7 +149,6 @@ public: static const PRInt32 kListStyleKTable[]; static const PRInt32 kOutlineColorKTable[]; static const PRInt32 kOverflowKTable[]; - static const PRInt32 kOverflowSubKTable[]; static const PRInt32 kPageBreakKTable[]; static const PRInt32 kPageBreakInsideKTable[]; static const PRInt32 kPageMarksKTable[]; diff --git a/mozilla/content/shared/public/nsStyleStruct.h b/mozilla/content/shared/public/nsStyleStruct.h index 4d9fdf026d0..4a4dddf2431 100644 --- a/mozilla/content/shared/public/nsStyleStruct.h +++ b/mozilla/content/shared/public/nsStyleStruct.h @@ -731,8 +731,7 @@ struct nsStyleDisplay : public nsStyleStruct { PRUint8 mBreakType; // [reset] see nsStyleConsts.h NS_STYLE_CLEAR_* PRPackedBool mBreakBefore; // [reset] PRPackedBool mBreakAfter; // [reset] - PRUint8 mOverflowX; // [reset] see nsStyleConsts.h - PRUint8 mOverflowY; // [reset] see nsStyleConsts.h + PRUint8 mOverflow; // [reset] see nsStyleConsts.h PRUint8 mClipFlags; // [reset] see nsStyleConsts.h PRBool IsBlockLevel() const {return (NS_STYLE_DISPLAY_BLOCK == mDisplay) || @@ -750,18 +749,15 @@ struct nsStyleDisplay : public nsStyleStruct { (NS_STYLE_POSITION_RELATIVE == mPosition);} PRBool IsScrollableOverflow() const { - // mOverflowX and mOverflowY always match when one of them is - // NS_STYLE_OVERFLOW_VISIBLE or NS_STYLE_OVERFLOW_CLIP. - return mOverflowX != NS_STYLE_OVERFLOW_VISIBLE && - mOverflowX != NS_STYLE_OVERFLOW_CLIP; + return mOverflow != NS_STYLE_OVERFLOW_VISIBLE && + mOverflow != NS_STYLE_OVERFLOW_CLIP; } // For table elements that don't support scroll frame creation, we // support 'overflow: hidden' to mean 'overflow: -moz-hidden-unscrollable'. PRBool IsTableClip() const { - return mOverflowX == NS_STYLE_OVERFLOW_CLIP || - (mOverflowX == NS_STYLE_OVERFLOW_HIDDEN && - mOverflowY == NS_STYLE_OVERFLOW_HIDDEN); + return mOverflow == NS_STYLE_OVERFLOW_CLIP || + mOverflow == NS_STYLE_OVERFLOW_HIDDEN; } }; diff --git a/mozilla/content/shared/src/nsCSSProps.cpp b/mozilla/content/shared/src/nsCSSProps.cpp index e9d144ce36e..e90497b114c 100644 --- a/mozilla/content/shared/src/nsCSSProps.cpp +++ b/mozilla/content/shared/src/nsCSSProps.cpp @@ -679,7 +679,6 @@ const PRInt32 nsCSSProps::kOverflowKTable[] = { eCSSKeyword_visible, NS_STYLE_OVERFLOW_VISIBLE, eCSSKeyword_hidden, NS_STYLE_OVERFLOW_HIDDEN, eCSSKeyword_scroll, NS_STYLE_OVERFLOW_SCROLL, - // Deprecated: eCSSKeyword__moz_scrollbars_none, NS_STYLE_OVERFLOW_HIDDEN, eCSSKeyword__moz_scrollbars_horizontal, NS_STYLE_OVERFLOW_SCROLLBARS_HORIZONTAL, eCSSKeyword__moz_scrollbars_vertical, NS_STYLE_OVERFLOW_SCROLLBARS_VERTICAL, @@ -687,15 +686,6 @@ const PRInt32 nsCSSProps::kOverflowKTable[] = { -1,-1 }; -const PRInt32 nsCSSProps::kOverflowSubKTable[] = { - eCSSKeyword_visible, NS_STYLE_OVERFLOW_VISIBLE, - eCSSKeyword_hidden, NS_STYLE_OVERFLOW_HIDDEN, - eCSSKeyword_scroll, NS_STYLE_OVERFLOW_SCROLL, - // Deprecated: - eCSSKeyword__moz_hidden_unscrollable, NS_STYLE_OVERFLOW_CLIP, - -1,-1 -}; - const PRInt32 nsCSSProps::kPageBreakKTable[] = { eCSSKeyword_always, NS_STYLE_PAGE_BREAK_ALWAYS, eCSSKeyword_avoid, NS_STYLE_PAGE_BREAK_AVOID, @@ -1326,12 +1316,6 @@ static const nsCSSProperty gMozOutlineSubpropTable[] = { eCSSProperty_UNKNOWN }; -static const nsCSSProperty gOverflowSubpropTable[] = { - eCSSProperty_overflow_x, - eCSSProperty_overflow_y, - eCSSProperty_UNKNOWN -}; - static const nsCSSProperty gPaddingSubpropTable[] = { // Code relies on these being in top-right-bottom-left order. eCSSProperty_padding_top, diff --git a/mozilla/content/shared/src/nsStyleStruct.cpp b/mozilla/content/shared/src/nsStyleStruct.cpp index eb4e27f48c2..fe11994fb64 100644 --- a/mozilla/content/shared/src/nsStyleStruct.cpp +++ b/mozilla/content/shared/src/nsStyleStruct.cpp @@ -1102,8 +1102,7 @@ nsStyleDisplay::nsStyleDisplay() mBreakType = NS_STYLE_CLEAR_NONE; mBreakBefore = PR_FALSE; mBreakAfter = PR_FALSE; - mOverflowX = NS_STYLE_OVERFLOW_VISIBLE; - mOverflowY = NS_STYLE_OVERFLOW_VISIBLE; + mOverflow = NS_STYLE_OVERFLOW_VISIBLE; mClipFlags = NS_STYLE_CLIP_AUTO; mClip.SetRect(0,0,0,0); mOpacity = 1.0f; @@ -1120,8 +1119,7 @@ nsStyleDisplay::nsStyleDisplay(const nsStyleDisplay& aSource) mBreakType = aSource.mBreakType; mBreakBefore = aSource.mBreakBefore; mBreakAfter = aSource.mBreakAfter; - mOverflowX = aSource.mOverflowX; - mOverflowY = aSource.mOverflowY; + mOverflow = aSource.mOverflow; mClipFlags = aSource.mClipFlags; mClip = aSource.mClip; mOpacity = aSource.mOpacity; @@ -1135,8 +1133,7 @@ nsChangeHint nsStyleDisplay::CalcDifference(const nsStyleDisplay& aOther) const || mPosition != aOther.mPosition || mDisplay != aOther.mDisplay || (mFloats == NS_STYLE_FLOAT_NONE) != (aOther.mFloats == NS_STYLE_FLOAT_NONE) - || mOverflowX != aOther.mOverflowX - || mOverflowY != aOther.mOverflowY + || mOverflow != aOther.mOverflow // might need to create a view to handle change from 1.0 to partial opacity || (mOpacity != aOther.mOpacity && ((mOpacity < 1.0) != (aOther.mOpacity < 1.0)))) diff --git a/mozilla/dom/public/idl/css/nsIDOMCSS2Properties.idl b/mozilla/dom/public/idl/css/nsIDOMCSS2Properties.idl index d7d71bd2b9a..da6eda5a6d9 100644 --- a/mozilla/dom/public/idl/css/nsIDOMCSS2Properties.idl +++ b/mozilla/dom/public/idl/css/nsIDOMCSS2Properties.idl @@ -563,11 +563,4 @@ interface nsIDOMNSCSS2Properties : nsIDOMCSS2Properties attribute DOMString opacity; // raises(DOMException) on setting - /* Mozilla extensions */ - attribute DOMString overflowX; - // raises(DOMException) on setting - - attribute DOMString overflowY; - // raises(DOMException) on setting - }; diff --git a/mozilla/layout/base/nsCSSFrameConstructor.cpp b/mozilla/layout/base/nsCSSFrameConstructor.cpp index 8831a728542..5e1e5403a37 100644 --- a/mozilla/layout/base/nsCSSFrameConstructor.cpp +++ b/mozilla/layout/base/nsCSSFrameConstructor.cpp @@ -3344,15 +3344,13 @@ nsCSSFrameConstructor::ConstructDocElementTableFrame(nsIPresShell* aPresS static PRBool CheckOverflow(nsPresContext* aPresContext, const nsStyleDisplay* aDisplay) { - if (aDisplay->mOverflowX == NS_STYLE_OVERFLOW_VISIBLE) + if (aDisplay->mOverflow == NS_STYLE_OVERFLOW_VISIBLE) return PR_FALSE; - if (aDisplay->mOverflowX == NS_STYLE_OVERFLOW_CLIP) - aPresContext->SetViewportOverflowOverride(NS_STYLE_OVERFLOW_HIDDEN, - NS_STYLE_OVERFLOW_HIDDEN); + if (aDisplay->mOverflow == NS_STYLE_OVERFLOW_CLIP) + aPresContext->SetViewportOverflowOverride(NS_STYLE_OVERFLOW_HIDDEN); else - aPresContext->SetViewportOverflowOverride(aDisplay->mOverflowX, - aDisplay->mOverflowY); + aPresContext->SetViewportOverflowOverride(aDisplay->mOverflow); return PR_TRUE; } @@ -3369,8 +3367,7 @@ nsIContent* nsCSSFrameConstructor::PropagateScrollToViewport(nsPresContext* aPresContext) { // Set default - aPresContext->SetViewportOverflowOverride(NS_STYLE_OVERFLOW_AUTO, - NS_STYLE_OVERFLOW_AUTO); + aPresContext->SetViewportOverflowOverride(NS_STYLE_OVERFLOW_AUTO); // We never mess with the viewport scroll state // when printing or in print preview diff --git a/mozilla/layout/base/nsPresContext.cpp b/mozilla/layout/base/nsPresContext.cpp index e28e6ff61cd..0fb1ceeb4f9 100644 --- a/mozilla/layout/base/nsPresContext.cpp +++ b/mozilla/layout/base/nsPresContext.cpp @@ -140,7 +140,7 @@ static NS_DEFINE_CID(kSelectionImageService, NS_SELECTIONIMAGESERVICE_CID); nsPresContext::nsPresContext(nsPresContextType aType) : mType(aType), - mViewportStyleOverflow(NS_STYLE_OVERFLOW_AUTO, NS_STYLE_OVERFLOW_AUTO), + mViewportStyleOverflow(NS_STYLE_OVERFLOW_AUTO), mCompatibilityMode(eCompatibility_FullStandards), mImageAnimationModePref(imgIContainer::kNormalAnimMode), mDefaultVariableFont("serif", NS_FONT_STYLE_NORMAL, NS_FONT_VARIANT_NORMAL, diff --git a/mozilla/layout/base/nsPresContext.h b/mozilla/layout/base/nsPresContext.h index 8aa8364312f..dc9e5dd9339 100644 --- a/mozilla/layout/base/nsPresContext.h +++ b/mozilla/layout/base/nsPresContext.h @@ -438,12 +438,11 @@ public: ScrollbarStyles(PRUint8 h, PRUint8 v) : mHorizontal(h), mVertical(v) {} ScrollbarStyles() {} }; - void SetViewportOverflowOverride(PRUint8 aX, PRUint8 aY) + void SetViewportOverflowOverride(PRUint8 aOverflow) { - mViewportStyleOverflow.mHorizontal = aX; - mViewportStyleOverflow.mVertical = aY; + mViewportStyleOverflow = aOverflow; } - ScrollbarStyles GetViewportOverflowOverride() + PRUint8 GetViewportOverflowOverride() { return mViewportStyleOverflow; } @@ -655,7 +654,7 @@ protected: nscolor mFocusBackgroundColor; nscolor mFocusTextColor; - ScrollbarStyles mViewportStyleOverflow; + PRUint8 mViewportStyleOverflow; PRUint8 mFocusRingWidth; nsCompatibility mCompatibilityMode; diff --git a/mozilla/layout/base/public/nsPresContext.h b/mozilla/layout/base/public/nsPresContext.h index 8aa8364312f..dc9e5dd9339 100644 --- a/mozilla/layout/base/public/nsPresContext.h +++ b/mozilla/layout/base/public/nsPresContext.h @@ -438,12 +438,11 @@ public: ScrollbarStyles(PRUint8 h, PRUint8 v) : mHorizontal(h), mVertical(v) {} ScrollbarStyles() {} }; - void SetViewportOverflowOverride(PRUint8 aX, PRUint8 aY) + void SetViewportOverflowOverride(PRUint8 aOverflow) { - mViewportStyleOverflow.mHorizontal = aX; - mViewportStyleOverflow.mVertical = aY; + mViewportStyleOverflow = aOverflow; } - ScrollbarStyles GetViewportOverflowOverride() + PRUint8 GetViewportOverflowOverride() { return mViewportStyleOverflow; } @@ -655,7 +654,7 @@ protected: nscolor mFocusBackgroundColor; nscolor mFocusTextColor; - ScrollbarStyles mViewportStyleOverflow; + PRUint8 mViewportStyleOverflow; PRUint8 mFocusRingWidth; nsCompatibility mCompatibilityMode; diff --git a/mozilla/layout/base/src/nsPresContext.cpp b/mozilla/layout/base/src/nsPresContext.cpp index e28e6ff61cd..0fb1ceeb4f9 100644 --- a/mozilla/layout/base/src/nsPresContext.cpp +++ b/mozilla/layout/base/src/nsPresContext.cpp @@ -140,7 +140,7 @@ static NS_DEFINE_CID(kSelectionImageService, NS_SELECTIONIMAGESERVICE_CID); nsPresContext::nsPresContext(nsPresContextType aType) : mType(aType), - mViewportStyleOverflow(NS_STYLE_OVERFLOW_AUTO, NS_STYLE_OVERFLOW_AUTO), + mViewportStyleOverflow(NS_STYLE_OVERFLOW_AUTO), mCompatibilityMode(eCompatibility_FullStandards), mImageAnimationModePref(imgIContainer::kNormalAnimMode), mDefaultVariableFont("serif", NS_FONT_STYLE_NORMAL, NS_FONT_VARIANT_NORMAL, diff --git a/mozilla/layout/forms/nsTextControlFrame.cpp b/mozilla/layout/forms/nsTextControlFrame.cpp index 3b0243152b8..69d5ee342dd 100644 --- a/mozilla/layout/forms/nsTextControlFrame.cpp +++ b/mozilla/layout/forms/nsTextControlFrame.cpp @@ -1637,8 +1637,8 @@ nsTextControlFrame::CreateAnonymousContent(nsPresContext* aPresContext, // setting -moz-hidden-unscrollable overflow (NS_STYLE_OVERFLOW_CLIP) // doesn't paint the caret for some reason. const nsStyleDisplay* disp = GetStyleDisplay(); - if (disp->mOverflowX != NS_STYLE_OVERFLOW_VISIBLE && - disp->mOverflowX != NS_STYLE_OVERFLOW_CLIP) { + if (disp->mOverflow != NS_STYLE_OVERFLOW_VISIBLE && + disp->mOverflow != NS_STYLE_OVERFLOW_CLIP) { rv = divContent->SetAttr(kNameSpaceID_None, nsHTMLAtoms::style, NS_LITERAL_STRING("overflow: inherit;"), PR_FALSE); diff --git a/mozilla/layout/generic/nsBlockFrame.cpp b/mozilla/layout/generic/nsBlockFrame.cpp index 79a528fc5b2..da6a7e6f985 100644 --- a/mozilla/layout/generic/nsBlockFrame.cpp +++ b/mozilla/layout/generic/nsBlockFrame.cpp @@ -910,7 +910,7 @@ nsBlockFrame::Reflow(nsPresContext* aPresContext, } if (NS_FRAME_IS_NOT_COMPLETE(state.mReflowStatus)) { - if (NS_STYLE_OVERFLOW_CLIP == aReflowState.mStyleDisplay->mOverflowX) { + if (NS_STYLE_OVERFLOW_CLIP == aReflowState.mStyleDisplay->mOverflow) { state.mReflowStatus = NS_FRAME_COMPLETE; } else { @@ -1382,7 +1382,7 @@ nsBlockFrame::ComputeCombinedArea(const nsHTMLReflowState& aReflowState, // XXX_perf: This can be done incrementally. It is currently one of // the things that makes incremental reflow O(N^2). nsRect area(0, 0, aMetrics.width, aMetrics.height); - if (NS_STYLE_OVERFLOW_CLIP != aReflowState.mStyleDisplay->mOverflowX) { + if (NS_STYLE_OVERFLOW_CLIP != aReflowState.mStyleDisplay->mOverflow) { for (line_iterator line = begin_lines(), line_end = end_lines(); line != line_end; ++line) { @@ -5326,7 +5326,7 @@ nsBlockFrame::Paint(nsPresContext* aPresContext, // If overflow is hidden then set the clip rect so that children don't // leak out of us. Note that because overflow'-clip' only applies to // the content area we do this after painting the border and background - if (NS_STYLE_OVERFLOW_CLIP == disp->mOverflowX) { + if (NS_STYLE_OVERFLOW_CLIP == disp->mOverflow) { aRenderingContext.PushState(); SetOverflowClipRect(aRenderingContext); } @@ -5340,7 +5340,7 @@ nsBlockFrame::Paint(nsPresContext* aPresContext, PaintDecorationsAndChildren(aPresContext, aRenderingContext, aDirtyRect, aWhichLayer, PR_TRUE); - if (NS_STYLE_OVERFLOW_CLIP == disp->mOverflowX) + if (NS_STYLE_OVERFLOW_CLIP == disp->mOverflow) aRenderingContext.PopState(); #if 0 diff --git a/mozilla/layout/generic/nsContainerFrame.cpp b/mozilla/layout/generic/nsContainerFrame.cpp index 448c2a1dc21..8f1005a5549 100644 --- a/mozilla/layout/generic/nsContainerFrame.cpp +++ b/mozilla/layout/generic/nsContainerFrame.cpp @@ -650,7 +650,7 @@ SyncFrameViewGeometryDependentProperties(nsPresContext* aPresContext, const nsStyleVisibility* vis = aStyleContext->GetStyleVisibility(); if ((nsViewVisibility_kShow == aView->GetVisibility() && NS_STYLE_VISIBILITY_HIDDEN == vis->mVisible) - || (NS_STYLE_OVERFLOW_VISIBLE == display->mOverflowX + || (NS_STYLE_OVERFLOW_VISIBLE == display->mOverflow && (kidState & NS_FRAME_OUTSIDE_CHILDREN) != 0)) { viewHasTransparentContent = PR_TRUE; } @@ -671,7 +671,7 @@ SyncFrameViewGeometryDependentProperties(nsPresContext* aPresContext, // in the style context... PRBool isBlockLevel = display->IsBlockLevel() || (kidState & NS_FRAME_OUT_OF_FLOW); PRBool hasClip = display->IsAbsolutelyPositioned() && (display->mClipFlags & NS_STYLE_CLIP_RECT); - PRBool hasOverflowClip = isBlockLevel && (display->mOverflowX == NS_STYLE_OVERFLOW_CLIP); + PRBool hasOverflowClip = isBlockLevel && (display->mOverflow == NS_STYLE_OVERFLOW_CLIP); if (hasClip || hasOverflowClip) { nsSize frameSize = aFrame->GetSize(); nsRect clipRect; @@ -922,7 +922,7 @@ nsContainerFrame::FrameNeedsView(nsIFrame* aFrame) // block-level, but we can't trust that the style context 'display' value is // set correctly if ((display->IsBlockLevel() || display->IsFloating()) && - (display->mOverflowX == NS_STYLE_OVERFLOW_CLIP)) { + (display->mOverflow == NS_STYLE_OVERFLOW_CLIP)) { // XXX Check for the frame being a block frame and only force a view // in that case, because adding a view for box frames seems to cause // problems for XUL... diff --git a/mozilla/layout/generic/nsFrameFrame.cpp b/mozilla/layout/generic/nsFrameFrame.cpp index 449917e136e..be636dab9a7 100644 --- a/mozilla/layout/generic/nsFrameFrame.cpp +++ b/mozilla/layout/generic/nsFrameFrame.cpp @@ -659,11 +659,25 @@ nsSubDocumentFrame::ShowDocShell() nsCOMPtr sc(do_QueryInterface(docShell)); if (sc) { - const nsStyleDisplay *disp = GetStyleDisplay(); + nsPresContext::ScrollbarStyles pref; + PRUint8 overflow = GetStyleDisplay()->mOverflow; + switch (overflow) { + case NS_STYLE_OVERFLOW_SCROLLBARS_VERTICAL: + pref.mHorizontal = NS_STYLE_OVERFLOW_HIDDEN; + pref.mVertical = NS_STYLE_OVERFLOW_SCROLL; + break; + case NS_STYLE_OVERFLOW_SCROLLBARS_HORIZONTAL: + pref.mHorizontal = NS_STYLE_OVERFLOW_SCROLL; + pref.mVertical = NS_STYLE_OVERFLOW_HIDDEN; + break; + default: + pref.mHorizontal = overflow; + pref.mVertical = overflow; + } sc->SetDefaultScrollbarPreferences(nsIScrollable::ScrollOrientation_X, - ConvertOverflow(disp->mOverflowX)); + ConvertOverflow(pref.mHorizontal)); sc->SetDefaultScrollbarPreferences(nsIScrollable::ScrollOrientation_Y, - ConvertOverflow(disp->mOverflowY)); + ConvertOverflow(pref.mVertical)); } PRInt32 itemType = nsIDocShellTreeItem::typeContent; diff --git a/mozilla/layout/generic/nsGfxScrollFrame.cpp b/mozilla/layout/generic/nsGfxScrollFrame.cpp index acc5d19579a..d3d53904690 100644 --- a/mozilla/layout/generic/nsGfxScrollFrame.cpp +++ b/mozilla/layout/generic/nsGfxScrollFrame.cpp @@ -1157,6 +1157,26 @@ static void HandleScrollPref(nsIScrollable *aScrollable, PRInt32 aOrientation, } } +static nsGfxScrollFrameInner::ScrollbarStyles +ConvertOverflow(PRUint8 aOverflow) +{ + nsGfxScrollFrameInner::ScrollbarStyles result; + switch (aOverflow) { + case NS_STYLE_OVERFLOW_SCROLLBARS_VERTICAL: + result.mHorizontal = NS_STYLE_OVERFLOW_HIDDEN; + result.mVertical = NS_STYLE_OVERFLOW_SCROLL; + break; + case NS_STYLE_OVERFLOW_SCROLLBARS_HORIZONTAL: + result.mHorizontal = NS_STYLE_OVERFLOW_SCROLL; + result.mVertical = NS_STYLE_OVERFLOW_HIDDEN; + break; + default: + result.mHorizontal = aOverflow; + result.mVertical = aOverflow; + } + return result; +} + nsGfxScrollFrameInner::ScrollbarStyles nsGfxScrollFrameInner::GetScrollbarStylesFromFrame() const { @@ -1167,7 +1187,7 @@ nsGfxScrollFrameInner::GetScrollbarStylesFromFrame() const parent->GetFirstChild(nsnull) == NS_STATIC_CAST(const nsIFrame*, mOuter)) { nsPresContext *presContext = mOuter->GetPresContext(); - result = presContext->GetViewportOverflowOverride(); + result = ConvertOverflow(presContext->GetViewportOverflowOverride()); nsCOMPtr container = presContext->GetContainer(); nsCOMPtr scrollable = do_QueryInterface(container); @@ -1176,9 +1196,7 @@ nsGfxScrollFrameInner::GetScrollbarStylesFromFrame() const HandleScrollPref(scrollable, nsIScrollable::ScrollOrientation_Y, result.mVertical); } else { - const nsStyleDisplay *disp = mOuter->GetStyleDisplay(); - result.mHorizontal = disp->mOverflowX; - result.mVertical = disp->mOverflowY; + result = ConvertOverflow(mOuter->GetStyleDisplay()->mOverflow); } NS_ASSERTION(result.mHorizontal != NS_STYLE_OVERFLOW_VISIBLE && diff --git a/mozilla/layout/html/base/src/nsBlockFrame.cpp b/mozilla/layout/html/base/src/nsBlockFrame.cpp index 79a528fc5b2..da6a7e6f985 100644 --- a/mozilla/layout/html/base/src/nsBlockFrame.cpp +++ b/mozilla/layout/html/base/src/nsBlockFrame.cpp @@ -910,7 +910,7 @@ nsBlockFrame::Reflow(nsPresContext* aPresContext, } if (NS_FRAME_IS_NOT_COMPLETE(state.mReflowStatus)) { - if (NS_STYLE_OVERFLOW_CLIP == aReflowState.mStyleDisplay->mOverflowX) { + if (NS_STYLE_OVERFLOW_CLIP == aReflowState.mStyleDisplay->mOverflow) { state.mReflowStatus = NS_FRAME_COMPLETE; } else { @@ -1382,7 +1382,7 @@ nsBlockFrame::ComputeCombinedArea(const nsHTMLReflowState& aReflowState, // XXX_perf: This can be done incrementally. It is currently one of // the things that makes incremental reflow O(N^2). nsRect area(0, 0, aMetrics.width, aMetrics.height); - if (NS_STYLE_OVERFLOW_CLIP != aReflowState.mStyleDisplay->mOverflowX) { + if (NS_STYLE_OVERFLOW_CLIP != aReflowState.mStyleDisplay->mOverflow) { for (line_iterator line = begin_lines(), line_end = end_lines(); line != line_end; ++line) { @@ -5326,7 +5326,7 @@ nsBlockFrame::Paint(nsPresContext* aPresContext, // If overflow is hidden then set the clip rect so that children don't // leak out of us. Note that because overflow'-clip' only applies to // the content area we do this after painting the border and background - if (NS_STYLE_OVERFLOW_CLIP == disp->mOverflowX) { + if (NS_STYLE_OVERFLOW_CLIP == disp->mOverflow) { aRenderingContext.PushState(); SetOverflowClipRect(aRenderingContext); } @@ -5340,7 +5340,7 @@ nsBlockFrame::Paint(nsPresContext* aPresContext, PaintDecorationsAndChildren(aPresContext, aRenderingContext, aDirtyRect, aWhichLayer, PR_TRUE); - if (NS_STYLE_OVERFLOW_CLIP == disp->mOverflowX) + if (NS_STYLE_OVERFLOW_CLIP == disp->mOverflow) aRenderingContext.PopState(); #if 0 diff --git a/mozilla/layout/html/base/src/nsContainerFrame.cpp b/mozilla/layout/html/base/src/nsContainerFrame.cpp index 448c2a1dc21..8f1005a5549 100644 --- a/mozilla/layout/html/base/src/nsContainerFrame.cpp +++ b/mozilla/layout/html/base/src/nsContainerFrame.cpp @@ -650,7 +650,7 @@ SyncFrameViewGeometryDependentProperties(nsPresContext* aPresContext, const nsStyleVisibility* vis = aStyleContext->GetStyleVisibility(); if ((nsViewVisibility_kShow == aView->GetVisibility() && NS_STYLE_VISIBILITY_HIDDEN == vis->mVisible) - || (NS_STYLE_OVERFLOW_VISIBLE == display->mOverflowX + || (NS_STYLE_OVERFLOW_VISIBLE == display->mOverflow && (kidState & NS_FRAME_OUTSIDE_CHILDREN) != 0)) { viewHasTransparentContent = PR_TRUE; } @@ -671,7 +671,7 @@ SyncFrameViewGeometryDependentProperties(nsPresContext* aPresContext, // in the style context... PRBool isBlockLevel = display->IsBlockLevel() || (kidState & NS_FRAME_OUT_OF_FLOW); PRBool hasClip = display->IsAbsolutelyPositioned() && (display->mClipFlags & NS_STYLE_CLIP_RECT); - PRBool hasOverflowClip = isBlockLevel && (display->mOverflowX == NS_STYLE_OVERFLOW_CLIP); + PRBool hasOverflowClip = isBlockLevel && (display->mOverflow == NS_STYLE_OVERFLOW_CLIP); if (hasClip || hasOverflowClip) { nsSize frameSize = aFrame->GetSize(); nsRect clipRect; @@ -922,7 +922,7 @@ nsContainerFrame::FrameNeedsView(nsIFrame* aFrame) // block-level, but we can't trust that the style context 'display' value is // set correctly if ((display->IsBlockLevel() || display->IsFloating()) && - (display->mOverflowX == NS_STYLE_OVERFLOW_CLIP)) { + (display->mOverflow == NS_STYLE_OVERFLOW_CLIP)) { // XXX Check for the frame being a block frame and only force a view // in that case, because adding a view for box frames seems to cause // problems for XUL... diff --git a/mozilla/layout/html/base/src/nsGfxScrollFrame.cpp b/mozilla/layout/html/base/src/nsGfxScrollFrame.cpp index acc5d19579a..d3d53904690 100644 --- a/mozilla/layout/html/base/src/nsGfxScrollFrame.cpp +++ b/mozilla/layout/html/base/src/nsGfxScrollFrame.cpp @@ -1157,6 +1157,26 @@ static void HandleScrollPref(nsIScrollable *aScrollable, PRInt32 aOrientation, } } +static nsGfxScrollFrameInner::ScrollbarStyles +ConvertOverflow(PRUint8 aOverflow) +{ + nsGfxScrollFrameInner::ScrollbarStyles result; + switch (aOverflow) { + case NS_STYLE_OVERFLOW_SCROLLBARS_VERTICAL: + result.mHorizontal = NS_STYLE_OVERFLOW_HIDDEN; + result.mVertical = NS_STYLE_OVERFLOW_SCROLL; + break; + case NS_STYLE_OVERFLOW_SCROLLBARS_HORIZONTAL: + result.mHorizontal = NS_STYLE_OVERFLOW_SCROLL; + result.mVertical = NS_STYLE_OVERFLOW_HIDDEN; + break; + default: + result.mHorizontal = aOverflow; + result.mVertical = aOverflow; + } + return result; +} + nsGfxScrollFrameInner::ScrollbarStyles nsGfxScrollFrameInner::GetScrollbarStylesFromFrame() const { @@ -1167,7 +1187,7 @@ nsGfxScrollFrameInner::GetScrollbarStylesFromFrame() const parent->GetFirstChild(nsnull) == NS_STATIC_CAST(const nsIFrame*, mOuter)) { nsPresContext *presContext = mOuter->GetPresContext(); - result = presContext->GetViewportOverflowOverride(); + result = ConvertOverflow(presContext->GetViewportOverflowOverride()); nsCOMPtr container = presContext->GetContainer(); nsCOMPtr scrollable = do_QueryInterface(container); @@ -1176,9 +1196,7 @@ nsGfxScrollFrameInner::GetScrollbarStylesFromFrame() const HandleScrollPref(scrollable, nsIScrollable::ScrollOrientation_Y, result.mVertical); } else { - const nsStyleDisplay *disp = mOuter->GetStyleDisplay(); - result.mHorizontal = disp->mOverflowX; - result.mVertical = disp->mOverflowY; + result = ConvertOverflow(mOuter->GetStyleDisplay()->mOverflow); } NS_ASSERTION(result.mHorizontal != NS_STYLE_OVERFLOW_VISIBLE && diff --git a/mozilla/layout/html/document/src/nsFrameFrame.cpp b/mozilla/layout/html/document/src/nsFrameFrame.cpp index 449917e136e..be636dab9a7 100644 --- a/mozilla/layout/html/document/src/nsFrameFrame.cpp +++ b/mozilla/layout/html/document/src/nsFrameFrame.cpp @@ -659,11 +659,25 @@ nsSubDocumentFrame::ShowDocShell() nsCOMPtr sc(do_QueryInterface(docShell)); if (sc) { - const nsStyleDisplay *disp = GetStyleDisplay(); + nsPresContext::ScrollbarStyles pref; + PRUint8 overflow = GetStyleDisplay()->mOverflow; + switch (overflow) { + case NS_STYLE_OVERFLOW_SCROLLBARS_VERTICAL: + pref.mHorizontal = NS_STYLE_OVERFLOW_HIDDEN; + pref.mVertical = NS_STYLE_OVERFLOW_SCROLL; + break; + case NS_STYLE_OVERFLOW_SCROLLBARS_HORIZONTAL: + pref.mHorizontal = NS_STYLE_OVERFLOW_SCROLL; + pref.mVertical = NS_STYLE_OVERFLOW_HIDDEN; + break; + default: + pref.mHorizontal = overflow; + pref.mVertical = overflow; + } sc->SetDefaultScrollbarPreferences(nsIScrollable::ScrollOrientation_X, - ConvertOverflow(disp->mOverflowX)); + ConvertOverflow(pref.mHorizontal)); sc->SetDefaultScrollbarPreferences(nsIScrollable::ScrollOrientation_Y, - ConvertOverflow(disp->mOverflowY)); + ConvertOverflow(pref.mVertical)); } PRInt32 itemType = nsIDocShellTreeItem::typeContent; diff --git a/mozilla/layout/html/forms/src/nsTextControlFrame.cpp b/mozilla/layout/html/forms/src/nsTextControlFrame.cpp index 3b0243152b8..69d5ee342dd 100644 --- a/mozilla/layout/html/forms/src/nsTextControlFrame.cpp +++ b/mozilla/layout/html/forms/src/nsTextControlFrame.cpp @@ -1637,8 +1637,8 @@ nsTextControlFrame::CreateAnonymousContent(nsPresContext* aPresContext, // setting -moz-hidden-unscrollable overflow (NS_STYLE_OVERFLOW_CLIP) // doesn't paint the caret for some reason. const nsStyleDisplay* disp = GetStyleDisplay(); - if (disp->mOverflowX != NS_STYLE_OVERFLOW_VISIBLE && - disp->mOverflowX != NS_STYLE_OVERFLOW_CLIP) { + if (disp->mOverflow != NS_STYLE_OVERFLOW_VISIBLE && + disp->mOverflow != NS_STYLE_OVERFLOW_CLIP) { rv = divContent->SetAttr(kNameSpaceID_None, nsHTMLAtoms::style, NS_LITERAL_STRING("overflow: inherit;"), PR_FALSE); diff --git a/mozilla/layout/html/style/src/nsCSSFrameConstructor.cpp b/mozilla/layout/html/style/src/nsCSSFrameConstructor.cpp index 8831a728542..5e1e5403a37 100644 --- a/mozilla/layout/html/style/src/nsCSSFrameConstructor.cpp +++ b/mozilla/layout/html/style/src/nsCSSFrameConstructor.cpp @@ -3344,15 +3344,13 @@ nsCSSFrameConstructor::ConstructDocElementTableFrame(nsIPresShell* aPresS static PRBool CheckOverflow(nsPresContext* aPresContext, const nsStyleDisplay* aDisplay) { - if (aDisplay->mOverflowX == NS_STYLE_OVERFLOW_VISIBLE) + if (aDisplay->mOverflow == NS_STYLE_OVERFLOW_VISIBLE) return PR_FALSE; - if (aDisplay->mOverflowX == NS_STYLE_OVERFLOW_CLIP) - aPresContext->SetViewportOverflowOverride(NS_STYLE_OVERFLOW_HIDDEN, - NS_STYLE_OVERFLOW_HIDDEN); + if (aDisplay->mOverflow == NS_STYLE_OVERFLOW_CLIP) + aPresContext->SetViewportOverflowOverride(NS_STYLE_OVERFLOW_HIDDEN); else - aPresContext->SetViewportOverflowOverride(aDisplay->mOverflowX, - aDisplay->mOverflowY); + aPresContext->SetViewportOverflowOverride(aDisplay->mOverflow); return PR_TRUE; } @@ -3369,8 +3367,7 @@ nsIContent* nsCSSFrameConstructor::PropagateScrollToViewport(nsPresContext* aPresContext) { // Set default - aPresContext->SetViewportOverflowOverride(NS_STYLE_OVERFLOW_AUTO, - NS_STYLE_OVERFLOW_AUTO); + aPresContext->SetViewportOverflowOverride(NS_STYLE_OVERFLOW_AUTO); // We never mess with the viewport scroll state // when printing or in print preview diff --git a/mozilla/layout/style/nsCSSDeclaration.cpp b/mozilla/layout/style/nsCSSDeclaration.cpp index 84df769f526..73e5e90ed3a 100644 --- a/mozilla/layout/style/nsCSSDeclaration.cpp +++ b/mozilla/layout/style/nsCSSDeclaration.cpp @@ -630,14 +630,6 @@ nsCSSDeclaration::GetValue(nsCSSProperty aProperty, aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_list_style_image, aValue); break; - case eCSSProperty_overflow: { - nsCSSValue xValue, yValue; - GetValueOrImportantValue(eCSSProperty_overflow_x, xValue); - GetValueOrImportantValue(eCSSProperty_overflow_y, yValue); - if (xValue == yValue) - AppendValueToString(eCSSProperty_overflow_x, aValue); - break; - } case eCSSProperty_pause: { if (AppendValueToString(eCSSProperty_pause_after, aValue)) { aValue.Append(PRUnichar(' ')); @@ -977,27 +969,6 @@ nsCSSDeclaration::UseBackgroundPosition(nsAString & aString, aBgPositionY = 0; } -void -nsCSSDeclaration::TryOverflowShorthand(nsAString & aString, - PRInt32 & aOverflowX, - PRInt32 & aOverflowY) const -{ - PRBool isImportant; - if (aOverflowX && aOverflowY && - AllPropertiesSameImportance(aOverflowX, aOverflowY, - 0, 0, 0, 0, isImportant)) { - nsCSSValue xValue, yValue; - GetValueOrImportantValue(eCSSProperty_overflow_x, xValue); - GetValueOrImportantValue(eCSSProperty_overflow_y, yValue); - if (xValue == yValue) { - AppendCSSValueToString(eCSSProperty_overflow_x, xValue, aString); - AppendImportanceToString(isImportant, aString); - aString.AppendLiteral("; "); - aOverflowX = aOverflowY = 0; - } - } -} - #define NS_CASE_OUTPUT_PROPERTY_VALUE(_prop, _index) \ case _prop: \ if (_index) { \ @@ -1042,7 +1013,6 @@ nsCSSDeclaration::ToString(nsAString& aString) const PRInt32 paddingTop = 0, paddingBottom = 0, paddingLeft = 0, paddingRight = 0; PRInt32 bgColor = 0, bgImage = 0, bgRepeat = 0, bgAttachment = 0; PRInt32 bgPositionX = 0, bgPositionY = 0; - PRInt32 overflowX = 0, overflowY = 0; PRUint32 borderPropertiesSet = 0, finalBorderPropertiesToSet = 0; for (index = 0; index < count; index++) { nsCSSProperty property = OrderValueAt(index); @@ -1103,9 +1073,6 @@ nsCSSDeclaration::ToString(nsAString& aString) const case eCSSProperty_background_x_position: bgPositionX = index+1; break; case eCSSProperty_background_y_position: bgPositionY = index+1; break; - case eCSSProperty_overflow_x: overflowX = index+1; break; - case eCSSProperty_overflow_y: overflowY = index+1; break; - default: break; } } @@ -1174,7 +1141,6 @@ nsCSSDeclaration::ToString(nsAString& aString) const TryBackgroundShorthand(aString, bgColor, bgImage, bgRepeat, bgAttachment, bgPositionX, bgPositionY); - TryOverflowShorthand(aString, overflowX, overflowY); for (index = 0; index < count; index++) { nsCSSProperty property = OrderValueAt(index); @@ -1250,9 +1216,6 @@ nsCSSDeclaration::ToString(nsAString& aString) const break; } - NS_CASE_OUTPUT_PROPERTY_VALUE(eCSSProperty_overflow_x, overflowX) - NS_CASE_OUTPUT_PROPERTY_VALUE(eCSSProperty_overflow_y, overflowY) - case eCSSProperty_margin_left_ltr_source: case eCSSProperty_margin_left_rtl_source: case eCSSProperty_margin_right_ltr_source: diff --git a/mozilla/layout/style/nsCSSDeclaration.h b/mozilla/layout/style/nsCSSDeclaration.h index ead908df86a..fe7a3bb0d83 100644 --- a/mozilla/layout/style/nsCSSDeclaration.h +++ b/mozilla/layout/style/nsCSSDeclaration.h @@ -190,8 +190,6 @@ private: void UseBackgroundPosition(nsAString & aString, PRInt32 & aBgPositionX, PRInt32 & aBgPositionY) const; - void TryOverflowShorthand(nsAString & aString, - PRInt32 & aOverflowX, PRInt32 & aOverflowY) const; PRBool AllPropertiesSameImportance(PRInt32 aFirst, PRInt32 aSecond, PRInt32 aThird, PRInt32 aFourth, diff --git a/mozilla/layout/style/nsCSSParser.cpp b/mozilla/layout/style/nsCSSParser.cpp index 8a92cad5468..58f254ef2d8 100644 --- a/mozilla/layout/style/nsCSSParser.cpp +++ b/mozilla/layout/style/nsCSSParser.cpp @@ -261,7 +261,6 @@ protected: #ifdef ENABLE_OUTLINE PRBool ParseOutline(nsresult& aErrorCode); #endif - PRBool ParseOverflow(nsresult& aErrorCode); PRBool ParsePadding(nsresult& aErrorCode); PRBool ParsePause(nsresult& aErrorCode); PRBool ParsePlayDuring(nsresult& aErrorCode); @@ -4025,8 +4024,6 @@ PRBool CSSParserImpl::ParseProperty(nsresult& aErrorCode, case eCSSProperty__moz_outline: return ParseOutline(aErrorCode); #endif - case eCSSProperty_overflow: - return ParseOverflow(aErrorCode); case eCSSProperty_padding: return ParsePadding(aErrorCode); case eCSSProperty_padding_end: @@ -4160,7 +4157,6 @@ PRBool CSSParserImpl::ParseSingleValueProperty(nsresult& aErrorCode, case eCSSProperty__moz_outline: case eCSSProperty__moz_outline_radius: #endif - case eCSSProperty_overflow: case eCSSProperty_padding: case eCSSProperty_padding_end: case eCSSProperty_padding_left: @@ -4447,10 +4443,9 @@ PRBool CSSParserImpl::ParseSingleValueProperty(nsresult& aErrorCode, return ParseVariant(aErrorCode, aValue, VARIANT_HKL, nsCSSProps::kBorderWidthKTable); #endif - case eCSSProperty_overflow_x: - case eCSSProperty_overflow_y: + case eCSSProperty_overflow: return ParseVariant(aErrorCode, aValue, VARIANT_AHK, - nsCSSProps::kOverflowSubKTable); + nsCSSProps::kOverflowKTable); case eCSSProperty_padding_bottom: case eCSSProperty_padding_end_value: // for internal use case eCSSProperty_padding_left_value: // for internal use @@ -5559,33 +5554,6 @@ PRBool CSSParserImpl::ParseOutline(nsresult& aErrorCode) } #endif -PRBool CSSParserImpl::ParseOverflow(nsresult& aErrorCode) -{ - nsCSSValue overflow; - if (!ParseVariant(aErrorCode, overflow, VARIANT_AHK, - nsCSSProps::kOverflowKTable) || - !ExpectEndProperty(aErrorCode, PR_TRUE)) - return PR_FALSE; - - nsCSSValue overflowX(overflow); - nsCSSValue overflowY(overflow); - if (eCSSUnit_Enumerated == overflow.GetUnit()) - switch(overflow.GetIntValue()) { - case NS_STYLE_OVERFLOW_SCROLLBARS_HORIZONTAL: - overflowX.SetIntValue(NS_STYLE_OVERFLOW_SCROLL, eCSSUnit_Enumerated); - overflowY.SetIntValue(NS_STYLE_OVERFLOW_HIDDEN, eCSSUnit_Enumerated); - break; - case NS_STYLE_OVERFLOW_SCROLLBARS_VERTICAL: - overflowX.SetIntValue(NS_STYLE_OVERFLOW_HIDDEN, eCSSUnit_Enumerated); - overflowY.SetIntValue(NS_STYLE_OVERFLOW_SCROLL, eCSSUnit_Enumerated); - break; - } - AppendValue(eCSSProperty_overflow_x, overflowX); - AppendValue(eCSSProperty_overflow_y, overflowY); - aErrorCode = NS_OK; - return PR_TRUE; -} - PRBool CSSParserImpl::ParsePadding(nsresult& aErrorCode) { static const nsCSSProperty kPaddingSideIDs[] = { diff --git a/mozilla/layout/style/nsCSSPropList.h b/mozilla/layout/style/nsCSSPropList.h index bdab54964bd..cae3293be7e 100644 --- a/mozilla/layout/style/nsCSSPropList.h +++ b/mozilla/layout/style/nsCSSPropList.h @@ -406,9 +406,7 @@ CSS_PROP_SHORTHAND(-moz-outline, _moz_outline, MozOutline) // XXX This is tempo CSS_PROP_OUTLINE(-moz-outline-color, _moz_outline_color, MozOutlineColor, Margin, mOutlineColor, eCSSType_Value, PR_FALSE, kOutlineColorKTable) // XXX bug 48973 CSS_PROP_OUTLINE(-moz-outline-style, _moz_outline_style, MozOutlineStyle, Margin, mOutlineStyle, eCSSType_Value, PR_FALSE, kBorderStyleKTable) // XXX bug 48973 CSS_PROP_OUTLINE(-moz-outline-width, _moz_outline_width, MozOutlineWidth, Margin, mOutlineWidth, eCSSType_Value, PR_TRUE, kBorderWidthKTable) // XXX bug 48973 -CSS_PROP_SHORTHAND(overflow, overflow, Overflow) -CSS_PROP_DISPLAY(overflow-x, overflow_x, OverflowX, Display, mOverflowX, eCSSType_Value, PR_FALSE, kOverflowSubKTable) -CSS_PROP_DISPLAY(overflow-y, overflow_y, OverflowY, Display, mOverflowY, eCSSType_Value, PR_FALSE, kOverflowSubKTable) +CSS_PROP_DISPLAY(overflow, overflow, Overflow, Display, mOverflow, eCSSType_Value, PR_FALSE, kOverflowKTable) CSS_PROP_SHORTHAND(padding, padding, Padding) CSS_PROP_PADDING(padding-bottom, padding_bottom, PaddingBottom, Margin, mPadding.mBottom, eCSSType_Value, PR_TRUE, nsnull) CSS_PROP_SHORTHAND(-moz-padding-end, padding_end, MozPaddingEnd) diff --git a/mozilla/layout/style/nsCSSProps.cpp b/mozilla/layout/style/nsCSSProps.cpp index e9d144ce36e..e90497b114c 100644 --- a/mozilla/layout/style/nsCSSProps.cpp +++ b/mozilla/layout/style/nsCSSProps.cpp @@ -679,7 +679,6 @@ const PRInt32 nsCSSProps::kOverflowKTable[] = { eCSSKeyword_visible, NS_STYLE_OVERFLOW_VISIBLE, eCSSKeyword_hidden, NS_STYLE_OVERFLOW_HIDDEN, eCSSKeyword_scroll, NS_STYLE_OVERFLOW_SCROLL, - // Deprecated: eCSSKeyword__moz_scrollbars_none, NS_STYLE_OVERFLOW_HIDDEN, eCSSKeyword__moz_scrollbars_horizontal, NS_STYLE_OVERFLOW_SCROLLBARS_HORIZONTAL, eCSSKeyword__moz_scrollbars_vertical, NS_STYLE_OVERFLOW_SCROLLBARS_VERTICAL, @@ -687,15 +686,6 @@ const PRInt32 nsCSSProps::kOverflowKTable[] = { -1,-1 }; -const PRInt32 nsCSSProps::kOverflowSubKTable[] = { - eCSSKeyword_visible, NS_STYLE_OVERFLOW_VISIBLE, - eCSSKeyword_hidden, NS_STYLE_OVERFLOW_HIDDEN, - eCSSKeyword_scroll, NS_STYLE_OVERFLOW_SCROLL, - // Deprecated: - eCSSKeyword__moz_hidden_unscrollable, NS_STYLE_OVERFLOW_CLIP, - -1,-1 -}; - const PRInt32 nsCSSProps::kPageBreakKTable[] = { eCSSKeyword_always, NS_STYLE_PAGE_BREAK_ALWAYS, eCSSKeyword_avoid, NS_STYLE_PAGE_BREAK_AVOID, @@ -1326,12 +1316,6 @@ static const nsCSSProperty gMozOutlineSubpropTable[] = { eCSSProperty_UNKNOWN }; -static const nsCSSProperty gOverflowSubpropTable[] = { - eCSSProperty_overflow_x, - eCSSProperty_overflow_y, - eCSSProperty_UNKNOWN -}; - static const nsCSSProperty gPaddingSubpropTable[] = { // Code relies on these being in top-right-bottom-left order. eCSSProperty_padding_top, diff --git a/mozilla/layout/style/nsCSSProps.h b/mozilla/layout/style/nsCSSProps.h index 57c70d3e45a..0da4a705dcc 100644 --- a/mozilla/layout/style/nsCSSProps.h +++ b/mozilla/layout/style/nsCSSProps.h @@ -149,7 +149,6 @@ public: static const PRInt32 kListStyleKTable[]; static const PRInt32 kOutlineColorKTable[]; static const PRInt32 kOverflowKTable[]; - static const PRInt32 kOverflowSubKTable[]; static const PRInt32 kPageBreakKTable[]; static const PRInt32 kPageBreakInsideKTable[]; static const PRInt32 kPageMarksKTable[]; diff --git a/mozilla/layout/style/nsCSSStruct.cpp b/mozilla/layout/style/nsCSSStruct.cpp index a4cac3eaa95..1470519b68b 100644 --- a/mozilla/layout/style/nsCSSStruct.cpp +++ b/mozilla/layout/style/nsCSSStruct.cpp @@ -487,8 +487,7 @@ nsCSSDisplay::nsCSSDisplay(const nsCSSDisplay& aCopy) mFloat(aCopy.mFloat), mClear(aCopy.mClear), mClip(aCopy.mClip), - mOverflowX(aCopy.mOverflowX), - mOverflowY(aCopy.mOverflowY), + mOverflow(aCopy.mOverflow), mVisibility(aCopy.mVisibility), mOpacity(aCopy.mOpacity), // temp fix for bug 24000 @@ -524,8 +523,7 @@ void nsCSSDisplay::List(FILE* out, PRInt32 aIndent) const fputs(NS_LossyConvertUCS2toASCII(buffer).get(), out); mClip.List(out, eCSSProperty_clip); buffer.SetLength(0); - mOverflowX.AppendToString(buffer, eCSSProperty_overflow_x); - mOverflowY.AppendToString(buffer, eCSSProperty_overflow_y); + mOverflow.AppendToString(buffer, eCSSProperty_overflow); fputs(NS_LossyConvertUCS2toASCII(buffer).get(), out); } #endif diff --git a/mozilla/layout/style/nsCSSStruct.h b/mozilla/layout/style/nsCSSStruct.h index ae641fcff59..a5a06ad9d83 100644 --- a/mozilla/layout/style/nsCSSStruct.h +++ b/mozilla/layout/style/nsCSSStruct.h @@ -234,8 +234,7 @@ struct nsCSSDisplay : public nsCSSStruct { nsCSSValue mFloat; nsCSSValue mClear; nsCSSRect mClip; - nsCSSValue mOverflowX; - nsCSSValue mOverflowY; + nsCSSValue mOverflow; nsCSSValue mVisibility; nsCSSValue mOpacity; diff --git a/mozilla/layout/style/nsComputedDOMStyle.cpp b/mozilla/layout/style/nsComputedDOMStyle.cpp index dbdd5b85c35..af6f875d0f8 100644 --- a/mozilla/layout/style/nsComputedDOMStyle.cpp +++ b/mozilla/layout/style/nsComputedDOMStyle.cpp @@ -2344,56 +2344,10 @@ nsComputedDOMStyle::GetOverflow(nsIFrame *aFrame, const nsStyleDisplay* display = nsnull; GetStyleData(eStyleStruct_Display, (const nsStyleStruct*&)display, aFrame); - if (display && display->mOverflowX == display->mOverflowY) { - if (display->mOverflowX != NS_STYLE_OVERFLOW_AUTO) { - const nsAFlatCString& overflow = - nsCSSProps::SearchKeywordTable(display->mOverflowX, - nsCSSProps::kOverflowKTable); - val->SetIdent(overflow); - } else { - val->SetIdent(nsLayoutAtoms::autoAtom); - } - } // XXX else what? - - return CallQueryInterface(val, aValue); -} - -nsresult -nsComputedDOMStyle::GetOverflowX(nsIFrame *aFrame, - nsIDOMCSSValue** aValue) -{ - nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); - - const nsStyleDisplay* display = nsnull; - GetStyleData(eStyleStruct_Display, (const nsStyleStruct*&)display, aFrame); - - if (display && display->mOverflowX != NS_STYLE_OVERFLOW_AUTO) { + if (display && display->mOverflow != NS_STYLE_OVERFLOW_AUTO) { const nsAFlatCString& overflow = - nsCSSProps::SearchKeywordTable(display->mOverflowX, - nsCSSProps::kOverflowSubKTable); - val->SetIdent(overflow); - } else { - val->SetIdent(nsLayoutAtoms::autoAtom); - } - - return CallQueryInterface(val, aValue); -} - -nsresult -nsComputedDOMStyle::GetOverflowY(nsIFrame *aFrame, - nsIDOMCSSValue** aValue) -{ - nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); - - const nsStyleDisplay* display = nsnull; - GetStyleData(eStyleStruct_Display, (const nsStyleStruct*&)display, aFrame); - - if (display && display->mOverflowY != NS_STYLE_OVERFLOW_AUTO) { - const nsAFlatCString& overflow = - nsCSSProps::SearchKeywordTable(display->mOverflowY, - nsCSSProps::kOverflowSubKTable); + nsCSSProps::SearchKeywordTable(display->mOverflow, + nsCSSProps::kOverflowKTable); val->SetIdent(overflow); } else { val->SetIdent(nsLayoutAtoms::autoAtom); @@ -3579,8 +3533,6 @@ nsComputedDOMStyle::GetQueryablePropertyMap(PRUint32* aLength) // COMPUTED_STYLE_MAP_ENTRY(outline_style, OutlineStyle), // COMPUTED_STYLE_MAP_ENTRY(outline_width, OutlineWidth), COMPUTED_STYLE_MAP_ENTRY(overflow, Overflow), - COMPUTED_STYLE_MAP_ENTRY(overflow_x, OverflowX), - COMPUTED_STYLE_MAP_ENTRY(overflow_y, OverflowY), //// COMPUTED_STYLE_MAP_ENTRY(padding, Padding), COMPUTED_STYLE_MAP_ENTRY(padding_bottom, PaddingBottom), COMPUTED_STYLE_MAP_ENTRY(padding_left, PaddingLeft), diff --git a/mozilla/layout/style/nsComputedDOMStyle.h b/mozilla/layout/style/nsComputedDOMStyle.h index 89ea422be79..f5bff76c134 100644 --- a/mozilla/layout/style/nsComputedDOMStyle.h +++ b/mozilla/layout/style/nsComputedDOMStyle.h @@ -272,8 +272,6 @@ private: nsresult GetPosition(nsIFrame *aFrame, nsIDOMCSSValue** aValue); nsresult GetClip(nsIFrame *aFrame, nsIDOMCSSValue** aValue); nsresult GetOverflow(nsIFrame *aFrame, nsIDOMCSSValue** aValue); - nsresult GetOverflowX(nsIFrame *aFrame, nsIDOMCSSValue** aValue); - nsresult GetOverflowY(nsIFrame *aFrame, nsIDOMCSSValue** aValue); /* User interface properties */ nsresult GetCursor(nsIFrame *aFrame, nsIDOMCSSValue** aValue); diff --git a/mozilla/layout/style/nsHTMLCSSStyleSheet.cpp b/mozilla/layout/style/nsHTMLCSSStyleSheet.cpp index 0ade20aeea4..cf65efc5a68 100644 --- a/mozilla/layout/style/nsHTMLCSSStyleSheet.cpp +++ b/mozilla/layout/style/nsHTMLCSSStyleSheet.cpp @@ -184,8 +184,7 @@ CSSDisablePropsRule::CommonMapRuleInfoInto(nsRuleData* aData) aData->mDisplayData->mPosition = staticposition; nsCSSValue visible(NS_STYLE_OVERFLOW_VISIBLE, eCSSUnit_Enumerated); - aData->mDisplayData->mOverflowX = visible; - aData->mDisplayData->mOverflowY = visible; + aData->mDisplayData->mOverflow = visible; // Nobody will care about 'break-before' or 'break-after', since // they only apply to blocks (assuming we implement them correctly). diff --git a/mozilla/layout/style/nsRuleNode.cpp b/mozilla/layout/style/nsRuleNode.cpp index 2c0a7cafc20..70b8ddb1114 100644 --- a/mozilla/layout/style/nsRuleNode.cpp +++ b/mozilla/layout/style/nsRuleNode.cpp @@ -2614,55 +2614,16 @@ nsRuleNode::ComputeDisplayData(nsStyleStruct* aStartStruct, display->mFloats = parentDisplay->mFloats; } - // overflow-x: enum, auto, inherit - if (eCSSUnit_Enumerated == displayData.mOverflowX.GetUnit()) { - display->mOverflowX = displayData.mOverflowX.GetIntValue(); + // overflow: enum, auto, inherit + if (eCSSUnit_Enumerated == displayData.mOverflow.GetUnit()) { + display->mOverflow = displayData.mOverflow.GetIntValue(); } - else if (eCSSUnit_Auto == displayData.mOverflowX.GetUnit()) { - display->mOverflowX = NS_STYLE_OVERFLOW_AUTO; + else if (eCSSUnit_Auto == displayData.mOverflow.GetUnit()) { + display->mOverflow = NS_STYLE_OVERFLOW_AUTO; } - else if (eCSSUnit_Inherit == displayData.mOverflowX.GetUnit()) { + else if (eCSSUnit_Inherit == displayData.mOverflow.GetUnit()) { inherited = PR_TRUE; - display->mOverflowX = parentDisplay->mOverflowX; - } - - // overflow-y: enum, auto, inherit - if (eCSSUnit_Enumerated == displayData.mOverflowY.GetUnit()) { - display->mOverflowY = displayData.mOverflowY.GetIntValue(); - } - else if (eCSSUnit_Auto == displayData.mOverflowY.GetUnit()) { - display->mOverflowY = NS_STYLE_OVERFLOW_AUTO; - } - else if (eCSSUnit_Inherit == displayData.mOverflowY.GetUnit()) { - inherited = PR_TRUE; - display->mOverflowY = parentDisplay->mOverflowY; - } - - // CSS3 overflow-x and overflow-y require some fixup as well in some - // cases. NS_STYLE_OVERFLOW_VISIBLE and NS_STYLE_OVERFLOW_CLIP are - // meaningful only when used in both dimensions. - if (display->mOverflowX != display->mOverflowY && - (display->mOverflowX == NS_STYLE_OVERFLOW_VISIBLE || - display->mOverflowX == NS_STYLE_OVERFLOW_CLIP || - display->mOverflowY == NS_STYLE_OVERFLOW_VISIBLE || - display->mOverflowY == NS_STYLE_OVERFLOW_CLIP)) { - // We can't store in the rule tree since a more specific rule might - // change these conditions. - inherited = PR_TRUE; - - // NS_STYLE_OVERFLOW_CLIP is a deprecated value, so if it's specified - // in only one dimension, convert it to NS_STYLE_OVERFLOW_HIDDEN. - if (display->mOverflowX == NS_STYLE_OVERFLOW_CLIP) - display->mOverflowX = NS_STYLE_OVERFLOW_HIDDEN; - if (display->mOverflowY == NS_STYLE_OVERFLOW_CLIP) - display->mOverflowY = NS_STYLE_OVERFLOW_HIDDEN; - - // If 'visible' is specified but doesn't match the other dimension, it - // turns into 'auto'. - if (display->mOverflowX == NS_STYLE_OVERFLOW_VISIBLE) - display->mOverflowX = NS_STYLE_OVERFLOW_AUTO; - if (display->mOverflowY == NS_STYLE_OVERFLOW_VISIBLE) - display->mOverflowY = NS_STYLE_OVERFLOW_AUTO; + display->mOverflow = parentDisplay->mOverflow; } // clip property: length, auto, inherit diff --git a/mozilla/layout/style/nsStyleContext.cpp b/mozilla/layout/style/nsStyleContext.cpp index 1639d71ec00..80b6503a85d 100644 --- a/mozilla/layout/style/nsStyleContext.cpp +++ b/mozilla/layout/style/nsStyleContext.cpp @@ -740,7 +740,7 @@ void nsStyleContext::DumpRegressionData(nsPresContext* aPresContext, FILE* out, // DISPLAY IndentBy(out,aIndent); const nsStyleDisplay* disp = GetStyleDisplay(); - fprintf(out, "\n", + fprintf(out, "\n", (int)disp->mPosition, (int)disp->mDisplay, (float)disp->mOpacity, @@ -748,8 +748,7 @@ void nsStyleContext::DumpRegressionData(nsPresContext* aPresContext, FILE* out, (int)disp->mBreakType, (int)disp->mBreakBefore, (int)disp->mBreakAfter, - (int)disp->mOverflowX, - (int)disp->mOverflowY, + (int)disp->mOverflow, (int)disp->mClipFlags, (long)disp->mClip.x, (long)disp->mClip.y, diff --git a/mozilla/layout/style/nsStyleStruct.cpp b/mozilla/layout/style/nsStyleStruct.cpp index eb4e27f48c2..fe11994fb64 100644 --- a/mozilla/layout/style/nsStyleStruct.cpp +++ b/mozilla/layout/style/nsStyleStruct.cpp @@ -1102,8 +1102,7 @@ nsStyleDisplay::nsStyleDisplay() mBreakType = NS_STYLE_CLEAR_NONE; mBreakBefore = PR_FALSE; mBreakAfter = PR_FALSE; - mOverflowX = NS_STYLE_OVERFLOW_VISIBLE; - mOverflowY = NS_STYLE_OVERFLOW_VISIBLE; + mOverflow = NS_STYLE_OVERFLOW_VISIBLE; mClipFlags = NS_STYLE_CLIP_AUTO; mClip.SetRect(0,0,0,0); mOpacity = 1.0f; @@ -1120,8 +1119,7 @@ nsStyleDisplay::nsStyleDisplay(const nsStyleDisplay& aSource) mBreakType = aSource.mBreakType; mBreakBefore = aSource.mBreakBefore; mBreakAfter = aSource.mBreakAfter; - mOverflowX = aSource.mOverflowX; - mOverflowY = aSource.mOverflowY; + mOverflow = aSource.mOverflow; mClipFlags = aSource.mClipFlags; mClip = aSource.mClip; mOpacity = aSource.mOpacity; @@ -1135,8 +1133,7 @@ nsChangeHint nsStyleDisplay::CalcDifference(const nsStyleDisplay& aOther) const || mPosition != aOther.mPosition || mDisplay != aOther.mDisplay || (mFloats == NS_STYLE_FLOAT_NONE) != (aOther.mFloats == NS_STYLE_FLOAT_NONE) - || mOverflowX != aOther.mOverflowX - || mOverflowY != aOther.mOverflowY + || mOverflow != aOther.mOverflow // might need to create a view to handle change from 1.0 to partial opacity || (mOpacity != aOther.mOpacity && ((mOpacity < 1.0) != (aOther.mOpacity < 1.0)))) diff --git a/mozilla/layout/style/nsStyleStruct.h b/mozilla/layout/style/nsStyleStruct.h index 4d9fdf026d0..4a4dddf2431 100644 --- a/mozilla/layout/style/nsStyleStruct.h +++ b/mozilla/layout/style/nsStyleStruct.h @@ -731,8 +731,7 @@ struct nsStyleDisplay : public nsStyleStruct { PRUint8 mBreakType; // [reset] see nsStyleConsts.h NS_STYLE_CLEAR_* PRPackedBool mBreakBefore; // [reset] PRPackedBool mBreakAfter; // [reset] - PRUint8 mOverflowX; // [reset] see nsStyleConsts.h - PRUint8 mOverflowY; // [reset] see nsStyleConsts.h + PRUint8 mOverflow; // [reset] see nsStyleConsts.h PRUint8 mClipFlags; // [reset] see nsStyleConsts.h PRBool IsBlockLevel() const {return (NS_STYLE_DISPLAY_BLOCK == mDisplay) || @@ -750,18 +749,15 @@ struct nsStyleDisplay : public nsStyleStruct { (NS_STYLE_POSITION_RELATIVE == mPosition);} PRBool IsScrollableOverflow() const { - // mOverflowX and mOverflowY always match when one of them is - // NS_STYLE_OVERFLOW_VISIBLE or NS_STYLE_OVERFLOW_CLIP. - return mOverflowX != NS_STYLE_OVERFLOW_VISIBLE && - mOverflowX != NS_STYLE_OVERFLOW_CLIP; + return mOverflow != NS_STYLE_OVERFLOW_VISIBLE && + mOverflow != NS_STYLE_OVERFLOW_CLIP; } // For table elements that don't support scroll frame creation, we // support 'overflow: hidden' to mean 'overflow: -moz-hidden-unscrollable'. PRBool IsTableClip() const { - return mOverflowX == NS_STYLE_OVERFLOW_CLIP || - (mOverflowX == NS_STYLE_OVERFLOW_HIDDEN && - mOverflowY == NS_STYLE_OVERFLOW_HIDDEN); + return mOverflow == NS_STYLE_OVERFLOW_CLIP || + mOverflow == NS_STYLE_OVERFLOW_HIDDEN; } }; diff --git a/mozilla/layout/xul/base/src/nsBoxFrame.cpp b/mozilla/layout/xul/base/src/nsBoxFrame.cpp index e2f19886c7b..6c39e7bbf54 100644 --- a/mozilla/layout/xul/base/src/nsBoxFrame.cpp +++ b/mozilla/layout/xul/base/src/nsBoxFrame.cpp @@ -1630,7 +1630,7 @@ nsBoxFrame::PaintChildren(nsPresContext* aPresContext, // If overflow is hidden then set the clip rect so that children // don't leak out of us - if (NS_STYLE_OVERFLOW_CLIP == disp->mOverflowX) { + if (NS_STYLE_OVERFLOW_CLIP == disp->mOverflow) { nsMargin im(0,0,0,0); GetInset(im); r.Deflate(im); @@ -1643,7 +1643,7 @@ nsBoxFrame::PaintChildren(nsPresContext* aPresContext, nsIFrame* frame = nsnull; kid->GetFrame(&frame); - if (!hasClipped && NS_STYLE_OVERFLOW_CLIP == disp->mOverflowX) { + if (!hasClipped && NS_STYLE_OVERFLOW_CLIP == disp->mOverflow) { // if we haven't already clipped and we should // check to see if the child is in out bounds. If not then // we begin clipping. @@ -1672,7 +1672,7 @@ nsBoxFrame::PaintChildren(nsPresContext* aPresContext, nscoord onePixel = aPresContext->IntScaledPixelsToTwips(1); GetContentRect(r); - if (NS_STYLE_OVERFLOW_CLIP == disp->mOverflowX) { + if (NS_STYLE_OVERFLOW_CLIP == disp->mOverflow) { GetDebugMargin(debugMargin); PixelMarginToTwips(aPresContext, debugMargin); r.Deflate(debugMargin); @@ -1682,7 +1682,7 @@ nsBoxFrame::PaintChildren(nsPresContext* aPresContext, GetChildBox(&kid); while (nsnull != kid) { - if (!hasClipped && NS_STYLE_OVERFLOW_CLIP == disp->mOverflowX) { + if (!hasClipped && NS_STYLE_OVERFLOW_CLIP == disp->mOverflow) { // if we haven't already clipped and we should // check to see if the child is in out bounds. If not then // we begin clipping.