diff --git a/mozilla/content/base/src/nsRuleNode.cpp b/mozilla/content/base/src/nsRuleNode.cpp
index a9f2a179470..859041a81fd 100644
--- a/mozilla/content/base/src/nsRuleNode.cpp
+++ b/mozilla/content/base/src/nsRuleNode.cpp
@@ -2604,16 +2604,55 @@ nsRuleNode::ComputeDisplayData(nsStyleStruct* aStartStruct,
display->mFloats = parentDisplay->mFloats;
}
- // overflow: enum, auto, inherit
- if (eCSSUnit_Enumerated == displayData.mOverflow.GetUnit()) {
- display->mOverflow = displayData.mOverflow.GetIntValue();
+ // overflow-x: enum, auto, inherit
+ if (eCSSUnit_Enumerated == displayData.mOverflowX.GetUnit()) {
+ display->mOverflowX = displayData.mOverflowX.GetIntValue();
}
- else if (eCSSUnit_Auto == displayData.mOverflow.GetUnit()) {
- display->mOverflow = NS_STYLE_OVERFLOW_AUTO;
+ else if (eCSSUnit_Auto == displayData.mOverflowX.GetUnit()) {
+ display->mOverflowX = NS_STYLE_OVERFLOW_AUTO;
}
- else if (eCSSUnit_Inherit == displayData.mOverflow.GetUnit()) {
+ else if (eCSSUnit_Inherit == displayData.mOverflowX.GetUnit()) {
inherited = PR_TRUE;
- display->mOverflow = parentDisplay->mOverflow;
+ 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;
}
// clip property: length, auto, inherit
diff --git a/mozilla/content/base/src/nsStyleContext.cpp b/mozilla/content/base/src/nsStyleContext.cpp
index 80b6503a85d..1639d71ec00 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,7 +748,8 @@ void nsStyleContext::DumpRegressionData(nsPresContext* aPresContext, FILE* out,
(int)disp->mBreakType,
(int)disp->mBreakBefore,
(int)disp->mBreakAfter,
- (int)disp->mOverflow,
+ (int)disp->mOverflowX,
+ (int)disp->mOverflowY,
(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 79437d43c21..25493ac282f 100644
--- a/mozilla/content/html/content/src/nsGenericHTMLElement.cpp
+++ b/mozilla/content/html/content/src/nsGenericHTMLElement.cpp
@@ -3028,34 +3028,39 @@ nsGenericHTMLElement::MapScrollingAttributeInto(const nsMappedAttributes* aAttri
return;
// scrolling
- 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;
+ 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;
- 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;
+ default:
+ NS_NOTREACHED("unexpected value");
+ mappedValue = NS_STYLE_OVERFLOW_AUTO;
+ break;
+ }
+ overflowValues[i]->SetIntValue(mappedValue, eCSSUnit_Enumerated);
}
- 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 73e5e90ed3a..84df769f526 100644
--- a/mozilla/content/html/style/src/nsCSSDeclaration.cpp
+++ b/mozilla/content/html/style/src/nsCSSDeclaration.cpp
@@ -630,6 +630,14 @@ 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(' '));
@@ -969,6 +977,27 @@ 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) { \
@@ -1013,6 +1042,7 @@ 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);
@@ -1073,6 +1103,9 @@ 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;
}
}
@@ -1141,6 +1174,7 @@ 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);
@@ -1216,6 +1250,9 @@ 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 fe7a3bb0d83..ead908df86a 100644
--- a/mozilla/content/html/style/src/nsCSSDeclaration.h
+++ b/mozilla/content/html/style/src/nsCSSDeclaration.h
@@ -190,6 +190,8 @@ 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 58f254ef2d8..8a92cad5468 100644
--- a/mozilla/content/html/style/src/nsCSSParser.cpp
+++ b/mozilla/content/html/style/src/nsCSSParser.cpp
@@ -261,6 +261,7 @@ 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);
@@ -4024,6 +4025,8 @@ 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:
@@ -4157,6 +4160,7 @@ 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:
@@ -4443,9 +4447,10 @@ PRBool CSSParserImpl::ParseSingleValueProperty(nsresult& aErrorCode,
return ParseVariant(aErrorCode, aValue, VARIANT_HKL,
nsCSSProps::kBorderWidthKTable);
#endif
- case eCSSProperty_overflow:
+ case eCSSProperty_overflow_x:
+ case eCSSProperty_overflow_y:
return ParseVariant(aErrorCode, aValue, VARIANT_AHK,
- nsCSSProps::kOverflowKTable);
+ nsCSSProps::kOverflowSubKTable);
case eCSSProperty_padding_bottom:
case eCSSProperty_padding_end_value: // for internal use
case eCSSProperty_padding_left_value: // for internal use
@@ -5554,6 +5559,33 @@ 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 1470519b68b..a4cac3eaa95 100644
--- a/mozilla/content/html/style/src/nsCSSStruct.cpp
+++ b/mozilla/content/html/style/src/nsCSSStruct.cpp
@@ -487,7 +487,8 @@ nsCSSDisplay::nsCSSDisplay(const nsCSSDisplay& aCopy)
mFloat(aCopy.mFloat),
mClear(aCopy.mClear),
mClip(aCopy.mClip),
- mOverflow(aCopy.mOverflow),
+ mOverflowX(aCopy.mOverflowX),
+ mOverflowY(aCopy.mOverflowY),
mVisibility(aCopy.mVisibility),
mOpacity(aCopy.mOpacity),
// temp fix for bug 24000
@@ -523,7 +524,8 @@ void nsCSSDisplay::List(FILE* out, PRInt32 aIndent) const
fputs(NS_LossyConvertUCS2toASCII(buffer).get(), out);
mClip.List(out, eCSSProperty_clip);
buffer.SetLength(0);
- mOverflow.AppendToString(buffer, eCSSProperty_overflow);
+ mOverflowX.AppendToString(buffer, eCSSProperty_overflow_x);
+ mOverflowY.AppendToString(buffer, eCSSProperty_overflow_y);
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 a5a06ad9d83..ae641fcff59 100644
--- a/mozilla/content/html/style/src/nsCSSStruct.h
+++ b/mozilla/content/html/style/src/nsCSSStruct.h
@@ -234,7 +234,8 @@ struct nsCSSDisplay : public nsCSSStruct {
nsCSSValue mFloat;
nsCSSValue mClear;
nsCSSRect mClip;
- nsCSSValue mOverflow;
+ nsCSSValue mOverflowX;
+ nsCSSValue mOverflowY;
nsCSSValue mVisibility;
nsCSSValue mOpacity;
diff --git a/mozilla/content/html/style/src/nsComputedDOMStyle.cpp b/mozilla/content/html/style/src/nsComputedDOMStyle.cpp
index af6f875d0f8..dbdd5b85c35 100644
--- a/mozilla/content/html/style/src/nsComputedDOMStyle.cpp
+++ b/mozilla/content/html/style/src/nsComputedDOMStyle.cpp
@@ -2344,10 +2344,56 @@ nsComputedDOMStyle::GetOverflow(nsIFrame *aFrame,
const nsStyleDisplay* display = nsnull;
GetStyleData(eStyleStruct_Display, (const nsStyleStruct*&)display, aFrame);
- if (display && display->mOverflow != NS_STYLE_OVERFLOW_AUTO) {
+ 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) {
const nsAFlatCString& overflow =
- nsCSSProps::SearchKeywordTable(display->mOverflow,
- nsCSSProps::kOverflowKTable);
+ 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);
val->SetIdent(overflow);
} else {
val->SetIdent(nsLayoutAtoms::autoAtom);
@@ -3533,6 +3579,8 @@ 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 f5bff76c134..89ea422be79 100644
--- a/mozilla/content/html/style/src/nsComputedDOMStyle.h
+++ b/mozilla/content/html/style/src/nsComputedDOMStyle.h
@@ -272,6 +272,8 @@ 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 cf65efc5a68..0ade20aeea4 100644
--- a/mozilla/content/html/style/src/nsHTMLCSSStyleSheet.cpp
+++ b/mozilla/content/html/style/src/nsHTMLCSSStyleSheet.cpp
@@ -184,7 +184,8 @@ CSSDisablePropsRule::CommonMapRuleInfoInto(nsRuleData* aData)
aData->mDisplayData->mPosition = staticposition;
nsCSSValue visible(NS_STYLE_OVERFLOW_VISIBLE, eCSSUnit_Enumerated);
- aData->mDisplayData->mOverflow = visible;
+ aData->mDisplayData->mOverflowX = visible;
+ aData->mDisplayData->mOverflowY = 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 cae3293be7e..bdab54964bd 100644
--- a/mozilla/content/shared/public/nsCSSPropList.h
+++ b/mozilla/content/shared/public/nsCSSPropList.h
@@ -406,7 +406,9 @@ 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_DISPLAY(overflow, overflow, Overflow, Display, mOverflow, eCSSType_Value, PR_FALSE, kOverflowKTable)
+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_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 0da4a705dcc..57c70d3e45a 100644
--- a/mozilla/content/shared/public/nsCSSProps.h
+++ b/mozilla/content/shared/public/nsCSSProps.h
@@ -149,6 +149,7 @@ 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 167c0d8f2af..4d9fdf026d0 100644
--- a/mozilla/content/shared/public/nsStyleStruct.h
+++ b/mozilla/content/shared/public/nsStyleStruct.h
@@ -731,7 +731,8 @@ struct nsStyleDisplay : public nsStyleStruct {
PRUint8 mBreakType; // [reset] see nsStyleConsts.h NS_STYLE_CLEAR_*
PRPackedBool mBreakBefore; // [reset]
PRPackedBool mBreakAfter; // [reset]
- PRUint8 mOverflow; // [reset] see nsStyleConsts.h
+ PRUint8 mOverflowX; // [reset] see nsStyleConsts.h
+ PRUint8 mOverflowY; // [reset] see nsStyleConsts.h
PRUint8 mClipFlags; // [reset] see nsStyleConsts.h
PRBool IsBlockLevel() const {return (NS_STYLE_DISPLAY_BLOCK == mDisplay) ||
@@ -749,15 +750,18 @@ struct nsStyleDisplay : public nsStyleStruct {
(NS_STYLE_POSITION_RELATIVE == mPosition);}
PRBool IsScrollableOverflow() const {
- return mOverflow != NS_STYLE_OVERFLOW_VISIBLE &&
- mOverflow != NS_STYLE_OVERFLOW_CLIP;
+ // 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;
}
// For table elements that don't support scroll frame creation, we
// support 'overflow: hidden' to mean 'overflow: -moz-hidden-unscrollable'.
PRBool IsTableClip() const {
- return mOverflow == NS_STYLE_OVERFLOW_CLIP ||
- mOverflow == NS_STYLE_OVERFLOW_HIDDEN;
+ return mOverflowX == NS_STYLE_OVERFLOW_CLIP ||
+ (mOverflowX == NS_STYLE_OVERFLOW_HIDDEN &&
+ mOverflowY == NS_STYLE_OVERFLOW_HIDDEN);
}
};
diff --git a/mozilla/content/shared/src/nsCSSProps.cpp b/mozilla/content/shared/src/nsCSSProps.cpp
index e90497b114c..e9d144ce36e 100644
--- a/mozilla/content/shared/src/nsCSSProps.cpp
+++ b/mozilla/content/shared/src/nsCSSProps.cpp
@@ -679,6 +679,7 @@ 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,
@@ -686,6 +687,15 @@ 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,
@@ -1316,6 +1326,12 @@ 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 fe11994fb64..eb4e27f48c2 100644
--- a/mozilla/content/shared/src/nsStyleStruct.cpp
+++ b/mozilla/content/shared/src/nsStyleStruct.cpp
@@ -1102,7 +1102,8 @@ nsStyleDisplay::nsStyleDisplay()
mBreakType = NS_STYLE_CLEAR_NONE;
mBreakBefore = PR_FALSE;
mBreakAfter = PR_FALSE;
- mOverflow = NS_STYLE_OVERFLOW_VISIBLE;
+ mOverflowX = NS_STYLE_OVERFLOW_VISIBLE;
+ mOverflowY = NS_STYLE_OVERFLOW_VISIBLE;
mClipFlags = NS_STYLE_CLIP_AUTO;
mClip.SetRect(0,0,0,0);
mOpacity = 1.0f;
@@ -1119,7 +1120,8 @@ nsStyleDisplay::nsStyleDisplay(const nsStyleDisplay& aSource)
mBreakType = aSource.mBreakType;
mBreakBefore = aSource.mBreakBefore;
mBreakAfter = aSource.mBreakAfter;
- mOverflow = aSource.mOverflow;
+ mOverflowX = aSource.mOverflowX;
+ mOverflowY = aSource.mOverflowY;
mClipFlags = aSource.mClipFlags;
mClip = aSource.mClip;
mOpacity = aSource.mOpacity;
@@ -1133,7 +1135,8 @@ nsChangeHint nsStyleDisplay::CalcDifference(const nsStyleDisplay& aOther) const
|| mPosition != aOther.mPosition
|| mDisplay != aOther.mDisplay
|| (mFloats == NS_STYLE_FLOAT_NONE) != (aOther.mFloats == NS_STYLE_FLOAT_NONE)
- || mOverflow != aOther.mOverflow
+ || mOverflowX != aOther.mOverflowX
+ || mOverflowY != aOther.mOverflowY
// 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 da6eda5a6d9..d7d71bd2b9a 100644
--- a/mozilla/dom/public/idl/css/nsIDOMCSS2Properties.idl
+++ b/mozilla/dom/public/idl/css/nsIDOMCSS2Properties.idl
@@ -563,4 +563,11 @@ 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 00307187545..66a01c58761 100644
--- a/mozilla/layout/base/nsCSSFrameConstructor.cpp
+++ b/mozilla/layout/base/nsCSSFrameConstructor.cpp
@@ -3362,13 +3362,15 @@ nsCSSFrameConstructor::ConstructDocElementTableFrame(nsIPresShell* aPresS
static PRBool CheckOverflow(nsPresContext* aPresContext,
const nsStyleDisplay* aDisplay)
{
- if (aDisplay->mOverflow == NS_STYLE_OVERFLOW_VISIBLE)
+ if (aDisplay->mOverflowX == NS_STYLE_OVERFLOW_VISIBLE)
return PR_FALSE;
- if (aDisplay->mOverflow == NS_STYLE_OVERFLOW_CLIP)
- aPresContext->SetViewportOverflowOverride(NS_STYLE_OVERFLOW_HIDDEN);
+ if (aDisplay->mOverflowX == NS_STYLE_OVERFLOW_CLIP)
+ aPresContext->SetViewportOverflowOverride(NS_STYLE_OVERFLOW_HIDDEN,
+ NS_STYLE_OVERFLOW_HIDDEN);
else
- aPresContext->SetViewportOverflowOverride(aDisplay->mOverflow);
+ aPresContext->SetViewportOverflowOverride(aDisplay->mOverflowX,
+ aDisplay->mOverflowY);
return PR_TRUE;
}
@@ -3385,7 +3387,8 @@ nsIContent*
nsCSSFrameConstructor::PropagateScrollToViewport(nsPresContext* aPresContext)
{
// Set default
- aPresContext->SetViewportOverflowOverride(NS_STYLE_OVERFLOW_AUTO);
+ aPresContext->SetViewportOverflowOverride(NS_STYLE_OVERFLOW_AUTO,
+ 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 e3626a5629f..e28e6ff61cd 100644
--- a/mozilla/layout/base/nsPresContext.cpp
+++ b/mozilla/layout/base/nsPresContext.cpp
@@ -140,6 +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),
mCompatibilityMode(eCompatibility_FullStandards),
mImageAnimationModePref(imgIContainer::kNormalAnimMode),
mDefaultVariableFont("serif", NS_FONT_STYLE_NORMAL, NS_FONT_VARIANT_NORMAL,
@@ -165,8 +166,6 @@ nsPresContext::nsPresContext(nsPresContextType aType)
SetBackgroundImageDraw(PR_TRUE); // always draw the background
SetBackgroundColorDraw(PR_TRUE);
- mViewportStyleOverflow = NS_STYLE_OVERFLOW_AUTO;
-
mBackgroundColor = NS_RGB(0xFF, 0xFF, 0xFF);
mUseDocumentColors = PR_TRUE;
diff --git a/mozilla/layout/base/nsPresContext.h b/mozilla/layout/base/nsPresContext.h
index 48756c5a151..5f82a8b042d 100644
--- a/mozilla/layout/base/nsPresContext.h
+++ b/mozilla/layout/base/nsPresContext.h
@@ -431,11 +431,22 @@ public:
return mLanguageSpecificTransformType;
}
- void SetViewportOverflowOverride(PRUint8 aStyle)
+ struct ScrollbarStyles {
+ // Always one of NS_STYLE_OVERFLOW_SCROLL, NS_STYLE_OVERFLOW_HIDDEN,
+ // or NS_STYLE_OVERFLOW_AUTO.
+ PRUint8 mHorizontal, mVertical;
+ ScrollbarStyles(PRUint8 h, PRUint8 v) : mHorizontal(h), mVertical(v) {}
+ ScrollbarStyles() {}
+ };
+ void SetViewportOverflowOverride(PRUint8 aX, PRUint8 aY)
{
- mViewportStyleOverflow = aStyle;
+ mViewportStyleOverflow.mHorizontal = aX;
+ mViewportStyleOverflow.mVertical = aY;
+ }
+ ScrollbarStyles GetViewportOverflowOverride()
+ {
+ return mViewportStyleOverflow;
}
- PRUint8 GetViewportOverflowOverride() { return mViewportStyleOverflow; }
/**
* Set and get methods for controling the background drawing
@@ -644,8 +655,8 @@ protected:
nscolor mFocusBackgroundColor;
nscolor mFocusTextColor;
+ ScrollbarStyles mViewportStyleOverflow;
PRUint8 mFocusRingWidth;
- PRUint8 mViewportStyleOverflow;
nsCompatibility mCompatibilityMode;
PRUint16 mImageAnimationMode;
diff --git a/mozilla/layout/base/public/nsIScrollableFrame.h b/mozilla/layout/base/public/nsIScrollableFrame.h
index feb798e9210..206237138a1 100644
--- a/mozilla/layout/base/public/nsIScrollableFrame.h
+++ b/mozilla/layout/base/public/nsIScrollableFrame.h
@@ -42,10 +42,10 @@
#include "nsCoord.h"
#include "nsIViewManager.h"
#include "nsIScrollableViewProvider.h"
+#include "nsPresContext.h"
class nsIFrame;
class nsIBox;
-class nsPresContext;
class nsBoxLayoutState;
// IID for the nsIScrollableFrame interface
@@ -65,13 +65,7 @@ public:
NS_IMETHOD GetScrolledFrame(nsPresContext* aPresContext,
nsIFrame *&aScrolledFrame) const = 0;
- struct ScrollbarStyles {
- // one of NS_STYLE_OVERFLOW_SCROLL, NS_STYLE_OVERFLOW_HIDDEN,
- // NS_STYLE_OVERFLOW_AUTO
- PRUint8 mHorizontal, mVertical;
- ScrollbarStyles(PRUint8 h, PRUint8 v) : mHorizontal(h), mVertical(v) {}
- ScrollbarStyles() {}
- };
+ typedef nsPresContext::ScrollbarStyles ScrollbarStyles;
virtual ScrollbarStyles GetScrollbarStyles() const = 0;
diff --git a/mozilla/layout/base/public/nsPresContext.h b/mozilla/layout/base/public/nsPresContext.h
index 48756c5a151..5f82a8b042d 100644
--- a/mozilla/layout/base/public/nsPresContext.h
+++ b/mozilla/layout/base/public/nsPresContext.h
@@ -431,11 +431,22 @@ public:
return mLanguageSpecificTransformType;
}
- void SetViewportOverflowOverride(PRUint8 aStyle)
+ struct ScrollbarStyles {
+ // Always one of NS_STYLE_OVERFLOW_SCROLL, NS_STYLE_OVERFLOW_HIDDEN,
+ // or NS_STYLE_OVERFLOW_AUTO.
+ PRUint8 mHorizontal, mVertical;
+ ScrollbarStyles(PRUint8 h, PRUint8 v) : mHorizontal(h), mVertical(v) {}
+ ScrollbarStyles() {}
+ };
+ void SetViewportOverflowOverride(PRUint8 aX, PRUint8 aY)
{
- mViewportStyleOverflow = aStyle;
+ mViewportStyleOverflow.mHorizontal = aX;
+ mViewportStyleOverflow.mVertical = aY;
+ }
+ ScrollbarStyles GetViewportOverflowOverride()
+ {
+ return mViewportStyleOverflow;
}
- PRUint8 GetViewportOverflowOverride() { return mViewportStyleOverflow; }
/**
* Set and get methods for controling the background drawing
@@ -644,8 +655,8 @@ protected:
nscolor mFocusBackgroundColor;
nscolor mFocusTextColor;
+ ScrollbarStyles mViewportStyleOverflow;
PRUint8 mFocusRingWidth;
- PRUint8 mViewportStyleOverflow;
nsCompatibility mCompatibilityMode;
PRUint16 mImageAnimationMode;
diff --git a/mozilla/layout/base/src/nsPresContext.cpp b/mozilla/layout/base/src/nsPresContext.cpp
index e3626a5629f..e28e6ff61cd 100644
--- a/mozilla/layout/base/src/nsPresContext.cpp
+++ b/mozilla/layout/base/src/nsPresContext.cpp
@@ -140,6 +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),
mCompatibilityMode(eCompatibility_FullStandards),
mImageAnimationModePref(imgIContainer::kNormalAnimMode),
mDefaultVariableFont("serif", NS_FONT_STYLE_NORMAL, NS_FONT_VARIANT_NORMAL,
@@ -165,8 +166,6 @@ nsPresContext::nsPresContext(nsPresContextType aType)
SetBackgroundImageDraw(PR_TRUE); // always draw the background
SetBackgroundColorDraw(PR_TRUE);
- mViewportStyleOverflow = NS_STYLE_OVERFLOW_AUTO;
-
mBackgroundColor = NS_RGB(0xFF, 0xFF, 0xFF);
mUseDocumentColors = PR_TRUE;
diff --git a/mozilla/layout/forms/nsTextControlFrame.cpp b/mozilla/layout/forms/nsTextControlFrame.cpp
index 11575aa59f5..a651528597a 100644
--- a/mozilla/layout/forms/nsTextControlFrame.cpp
+++ b/mozilla/layout/forms/nsTextControlFrame.cpp
@@ -1636,9 +1636,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->mOverflow != NS_STYLE_OVERFLOW_AUTO && // this is the default
- disp->mOverflow != NS_STYLE_OVERFLOW_VISIBLE &&
- disp->mOverflow != NS_STYLE_OVERFLOW_CLIP) {
+ if (disp->mOverflowX != NS_STYLE_OVERFLOW_VISIBLE &&
+ disp->mOverflowX != 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 126be9814b4..e66f72d4ba4 100644
--- a/mozilla/layout/generic/nsBlockFrame.cpp
+++ b/mozilla/layout/generic/nsBlockFrame.cpp
@@ -909,7 +909,7 @@ nsBlockFrame::Reflow(nsPresContext* aPresContext,
}
if (NS_FRAME_IS_NOT_COMPLETE(state.mReflowStatus)) {
- if (NS_STYLE_OVERFLOW_CLIP == aReflowState.mStyleDisplay->mOverflow) {
+ if (NS_STYLE_OVERFLOW_CLIP == aReflowState.mStyleDisplay->mOverflowX) {
state.mReflowStatus = NS_FRAME_COMPLETE;
}
else {
@@ -1381,7 +1381,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->mOverflow) {
+ if (NS_STYLE_OVERFLOW_CLIP != aReflowState.mStyleDisplay->mOverflowX) {
for (line_iterator line = begin_lines(), line_end = end_lines();
line != line_end;
++line) {
@@ -5325,7 +5325,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->mOverflow) {
+ if (NS_STYLE_OVERFLOW_CLIP == disp->mOverflowX) {
aRenderingContext.PushState();
SetOverflowClipRect(aRenderingContext);
}
@@ -5339,7 +5339,7 @@ nsBlockFrame::Paint(nsPresContext* aPresContext,
PaintDecorationsAndChildren(aPresContext, aRenderingContext,
aDirtyRect, aWhichLayer, PR_TRUE);
- if (NS_STYLE_OVERFLOW_CLIP == disp->mOverflow)
+ if (NS_STYLE_OVERFLOW_CLIP == disp->mOverflowX)
aRenderingContext.PopState();
#if 0
diff --git a/mozilla/layout/generic/nsContainerFrame.cpp b/mozilla/layout/generic/nsContainerFrame.cpp
index 8f1005a5549..448c2a1dc21 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->mOverflow
+ || (NS_STYLE_OVERFLOW_VISIBLE == display->mOverflowX
&& (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->mOverflow == NS_STYLE_OVERFLOW_CLIP);
+ PRBool hasOverflowClip = isBlockLevel && (display->mOverflowX == 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->mOverflow == NS_STYLE_OVERFLOW_CLIP)) {
+ (display->mOverflowX == 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 e363f669351..449917e136e 100644
--- a/mozilla/layout/generic/nsFrameFrame.cpp
+++ b/mozilla/layout/generic/nsFrameFrame.cpp
@@ -617,6 +617,20 @@ nsSubDocumentFrame::GetDocShell(nsIDocShell **aDocShell)
return mFrameLoader->GetDocShell(aDocShell);
}
+inline PRInt32 ConvertOverflow(PRUint8 aOverflow)
+{
+ switch (aOverflow) {
+ case NS_STYLE_OVERFLOW_VISIBLE:
+ case NS_STYLE_OVERFLOW_AUTO:
+ return nsIScrollable::Scrollbar_Auto;
+ case NS_STYLE_OVERFLOW_HIDDEN:
+ case NS_STYLE_OVERFLOW_CLIP:
+ return nsIScrollable::Scrollbar_Never;
+ case NS_STYLE_OVERFLOW_SCROLL:
+ return nsIScrollable::Scrollbar_Always;
+ }
+}
+
nsresult
nsSubDocumentFrame::ShowDocShell()
{
@@ -645,34 +659,11 @@ nsSubDocumentFrame::ShowDocShell()
nsCOMPtr sc(do_QueryInterface(docShell));
if (sc) {
- PRInt32 scrolling = GetStyleDisplay()->mOverflow;
- PRInt32 scrollX, scrollY;
- switch (scrolling) {
- case NS_STYLE_OVERFLOW_VISIBLE:
- case NS_STYLE_OVERFLOW_AUTO:
- scrollX = scrollY = nsIScrollable::Scrollbar_Auto;
- break;
- case NS_STYLE_OVERFLOW_HIDDEN:
- case NS_STYLE_OVERFLOW_CLIP:
- scrollX = scrollY = nsIScrollable::Scrollbar_Never;
- break;
- case NS_STYLE_OVERFLOW_SCROLL:
- scrollX = scrollY = nsIScrollable::Scrollbar_Always;
- break;
- case NS_STYLE_OVERFLOW_SCROLLBARS_HORIZONTAL:
- scrollX = nsIScrollable::Scrollbar_Always;
- scrollY = nsIScrollable::Scrollbar_Never;
- break;
- case NS_STYLE_OVERFLOW_SCROLLBARS_VERTICAL:
- scrollX = nsIScrollable::Scrollbar_Never;
- scrollY = nsIScrollable::Scrollbar_Always;
- break;
- }
-
- sc->SetDefaultScrollbarPreferences(nsIScrollable::ScrollOrientation_Y,
- scrollX);
+ const nsStyleDisplay *disp = GetStyleDisplay();
sc->SetDefaultScrollbarPreferences(nsIScrollable::ScrollOrientation_X,
- scrollY);
+ ConvertOverflow(disp->mOverflowX));
+ sc->SetDefaultScrollbarPreferences(nsIScrollable::ScrollOrientation_Y,
+ ConvertOverflow(disp->mOverflowY));
}
PRInt32 itemType = nsIDocShellTreeItem::typeContent;
diff --git a/mozilla/layout/generic/nsGfxScrollFrame.cpp b/mozilla/layout/generic/nsGfxScrollFrame.cpp
index 00c7d8dc942..4ffa78b52a3 100644
--- a/mozilla/layout/generic/nsGfxScrollFrame.cpp
+++ b/mozilla/layout/generic/nsGfxScrollFrame.cpp
@@ -1200,26 +1200,6 @@ 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
{
@@ -1230,7 +1210,7 @@ nsGfxScrollFrameInner::GetScrollbarStylesFromFrame() const
parent->GetFirstChild(nsnull) ==
NS_STATIC_CAST(const nsIFrame*, mOuter)) {
nsPresContext *presContext = mOuter->GetPresContext();
- result = ConvertOverflow(presContext->GetViewportOverflowOverride());
+ result = presContext->GetViewportOverflowOverride();
nsCOMPtr container = presContext->GetContainer();
nsCOMPtr scrollable = do_QueryInterface(container);
@@ -1239,7 +1219,9 @@ nsGfxScrollFrameInner::GetScrollbarStylesFromFrame() const
HandleScrollPref(scrollable, nsIScrollable::ScrollOrientation_Y,
result.mVertical);
} else {
- result = ConvertOverflow(mOuter->GetStyleDisplay()->mOverflow);
+ const nsStyleDisplay *disp = mOuter->GetStyleDisplay();
+ result.mHorizontal = disp->mOverflowX;
+ result.mVertical = disp->mOverflowY;
}
NS_ASSERTION(result.mHorizontal != NS_STYLE_OVERFLOW_VISIBLE &&
diff --git a/mozilla/layout/generic/nsIScrollableFrame.h b/mozilla/layout/generic/nsIScrollableFrame.h
index feb798e9210..206237138a1 100644
--- a/mozilla/layout/generic/nsIScrollableFrame.h
+++ b/mozilla/layout/generic/nsIScrollableFrame.h
@@ -42,10 +42,10 @@
#include "nsCoord.h"
#include "nsIViewManager.h"
#include "nsIScrollableViewProvider.h"
+#include "nsPresContext.h"
class nsIFrame;
class nsIBox;
-class nsPresContext;
class nsBoxLayoutState;
// IID for the nsIScrollableFrame interface
@@ -65,13 +65,7 @@ public:
NS_IMETHOD GetScrolledFrame(nsPresContext* aPresContext,
nsIFrame *&aScrolledFrame) const = 0;
- struct ScrollbarStyles {
- // one of NS_STYLE_OVERFLOW_SCROLL, NS_STYLE_OVERFLOW_HIDDEN,
- // NS_STYLE_OVERFLOW_AUTO
- PRUint8 mHorizontal, mVertical;
- ScrollbarStyles(PRUint8 h, PRUint8 v) : mHorizontal(h), mVertical(v) {}
- ScrollbarStyles() {}
- };
+ typedef nsPresContext::ScrollbarStyles ScrollbarStyles;
virtual ScrollbarStyles GetScrollbarStyles() const = 0;
diff --git a/mozilla/layout/html/base/src/nsBlockFrame.cpp b/mozilla/layout/html/base/src/nsBlockFrame.cpp
index 126be9814b4..e66f72d4ba4 100644
--- a/mozilla/layout/html/base/src/nsBlockFrame.cpp
+++ b/mozilla/layout/html/base/src/nsBlockFrame.cpp
@@ -909,7 +909,7 @@ nsBlockFrame::Reflow(nsPresContext* aPresContext,
}
if (NS_FRAME_IS_NOT_COMPLETE(state.mReflowStatus)) {
- if (NS_STYLE_OVERFLOW_CLIP == aReflowState.mStyleDisplay->mOverflow) {
+ if (NS_STYLE_OVERFLOW_CLIP == aReflowState.mStyleDisplay->mOverflowX) {
state.mReflowStatus = NS_FRAME_COMPLETE;
}
else {
@@ -1381,7 +1381,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->mOverflow) {
+ if (NS_STYLE_OVERFLOW_CLIP != aReflowState.mStyleDisplay->mOverflowX) {
for (line_iterator line = begin_lines(), line_end = end_lines();
line != line_end;
++line) {
@@ -5325,7 +5325,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->mOverflow) {
+ if (NS_STYLE_OVERFLOW_CLIP == disp->mOverflowX) {
aRenderingContext.PushState();
SetOverflowClipRect(aRenderingContext);
}
@@ -5339,7 +5339,7 @@ nsBlockFrame::Paint(nsPresContext* aPresContext,
PaintDecorationsAndChildren(aPresContext, aRenderingContext,
aDirtyRect, aWhichLayer, PR_TRUE);
- if (NS_STYLE_OVERFLOW_CLIP == disp->mOverflow)
+ if (NS_STYLE_OVERFLOW_CLIP == disp->mOverflowX)
aRenderingContext.PopState();
#if 0
diff --git a/mozilla/layout/html/base/src/nsContainerFrame.cpp b/mozilla/layout/html/base/src/nsContainerFrame.cpp
index 8f1005a5549..448c2a1dc21 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->mOverflow
+ || (NS_STYLE_OVERFLOW_VISIBLE == display->mOverflowX
&& (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->mOverflow == NS_STYLE_OVERFLOW_CLIP);
+ PRBool hasOverflowClip = isBlockLevel && (display->mOverflowX == 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->mOverflow == NS_STYLE_OVERFLOW_CLIP)) {
+ (display->mOverflowX == 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 00c7d8dc942..4ffa78b52a3 100644
--- a/mozilla/layout/html/base/src/nsGfxScrollFrame.cpp
+++ b/mozilla/layout/html/base/src/nsGfxScrollFrame.cpp
@@ -1200,26 +1200,6 @@ 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
{
@@ -1230,7 +1210,7 @@ nsGfxScrollFrameInner::GetScrollbarStylesFromFrame() const
parent->GetFirstChild(nsnull) ==
NS_STATIC_CAST(const nsIFrame*, mOuter)) {
nsPresContext *presContext = mOuter->GetPresContext();
- result = ConvertOverflow(presContext->GetViewportOverflowOverride());
+ result = presContext->GetViewportOverflowOverride();
nsCOMPtr container = presContext->GetContainer();
nsCOMPtr scrollable = do_QueryInterface(container);
@@ -1239,7 +1219,9 @@ nsGfxScrollFrameInner::GetScrollbarStylesFromFrame() const
HandleScrollPref(scrollable, nsIScrollable::ScrollOrientation_Y,
result.mVertical);
} else {
- result = ConvertOverflow(mOuter->GetStyleDisplay()->mOverflow);
+ const nsStyleDisplay *disp = mOuter->GetStyleDisplay();
+ result.mHorizontal = disp->mOverflowX;
+ result.mVertical = disp->mOverflowY;
}
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 e363f669351..449917e136e 100644
--- a/mozilla/layout/html/document/src/nsFrameFrame.cpp
+++ b/mozilla/layout/html/document/src/nsFrameFrame.cpp
@@ -617,6 +617,20 @@ nsSubDocumentFrame::GetDocShell(nsIDocShell **aDocShell)
return mFrameLoader->GetDocShell(aDocShell);
}
+inline PRInt32 ConvertOverflow(PRUint8 aOverflow)
+{
+ switch (aOverflow) {
+ case NS_STYLE_OVERFLOW_VISIBLE:
+ case NS_STYLE_OVERFLOW_AUTO:
+ return nsIScrollable::Scrollbar_Auto;
+ case NS_STYLE_OVERFLOW_HIDDEN:
+ case NS_STYLE_OVERFLOW_CLIP:
+ return nsIScrollable::Scrollbar_Never;
+ case NS_STYLE_OVERFLOW_SCROLL:
+ return nsIScrollable::Scrollbar_Always;
+ }
+}
+
nsresult
nsSubDocumentFrame::ShowDocShell()
{
@@ -645,34 +659,11 @@ nsSubDocumentFrame::ShowDocShell()
nsCOMPtr sc(do_QueryInterface(docShell));
if (sc) {
- PRInt32 scrolling = GetStyleDisplay()->mOverflow;
- PRInt32 scrollX, scrollY;
- switch (scrolling) {
- case NS_STYLE_OVERFLOW_VISIBLE:
- case NS_STYLE_OVERFLOW_AUTO:
- scrollX = scrollY = nsIScrollable::Scrollbar_Auto;
- break;
- case NS_STYLE_OVERFLOW_HIDDEN:
- case NS_STYLE_OVERFLOW_CLIP:
- scrollX = scrollY = nsIScrollable::Scrollbar_Never;
- break;
- case NS_STYLE_OVERFLOW_SCROLL:
- scrollX = scrollY = nsIScrollable::Scrollbar_Always;
- break;
- case NS_STYLE_OVERFLOW_SCROLLBARS_HORIZONTAL:
- scrollX = nsIScrollable::Scrollbar_Always;
- scrollY = nsIScrollable::Scrollbar_Never;
- break;
- case NS_STYLE_OVERFLOW_SCROLLBARS_VERTICAL:
- scrollX = nsIScrollable::Scrollbar_Never;
- scrollY = nsIScrollable::Scrollbar_Always;
- break;
- }
-
- sc->SetDefaultScrollbarPreferences(nsIScrollable::ScrollOrientation_Y,
- scrollX);
+ const nsStyleDisplay *disp = GetStyleDisplay();
sc->SetDefaultScrollbarPreferences(nsIScrollable::ScrollOrientation_X,
- scrollY);
+ ConvertOverflow(disp->mOverflowX));
+ sc->SetDefaultScrollbarPreferences(nsIScrollable::ScrollOrientation_Y,
+ ConvertOverflow(disp->mOverflowY));
}
PRInt32 itemType = nsIDocShellTreeItem::typeContent;
diff --git a/mozilla/layout/html/forms/src/nsTextControlFrame.cpp b/mozilla/layout/html/forms/src/nsTextControlFrame.cpp
index 11575aa59f5..a651528597a 100644
--- a/mozilla/layout/html/forms/src/nsTextControlFrame.cpp
+++ b/mozilla/layout/html/forms/src/nsTextControlFrame.cpp
@@ -1636,9 +1636,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->mOverflow != NS_STYLE_OVERFLOW_AUTO && // this is the default
- disp->mOverflow != NS_STYLE_OVERFLOW_VISIBLE &&
- disp->mOverflow != NS_STYLE_OVERFLOW_CLIP) {
+ if (disp->mOverflowX != NS_STYLE_OVERFLOW_VISIBLE &&
+ disp->mOverflowX != 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 00307187545..66a01c58761 100644
--- a/mozilla/layout/html/style/src/nsCSSFrameConstructor.cpp
+++ b/mozilla/layout/html/style/src/nsCSSFrameConstructor.cpp
@@ -3362,13 +3362,15 @@ nsCSSFrameConstructor::ConstructDocElementTableFrame(nsIPresShell* aPresS
static PRBool CheckOverflow(nsPresContext* aPresContext,
const nsStyleDisplay* aDisplay)
{
- if (aDisplay->mOverflow == NS_STYLE_OVERFLOW_VISIBLE)
+ if (aDisplay->mOverflowX == NS_STYLE_OVERFLOW_VISIBLE)
return PR_FALSE;
- if (aDisplay->mOverflow == NS_STYLE_OVERFLOW_CLIP)
- aPresContext->SetViewportOverflowOverride(NS_STYLE_OVERFLOW_HIDDEN);
+ if (aDisplay->mOverflowX == NS_STYLE_OVERFLOW_CLIP)
+ aPresContext->SetViewportOverflowOverride(NS_STYLE_OVERFLOW_HIDDEN,
+ NS_STYLE_OVERFLOW_HIDDEN);
else
- aPresContext->SetViewportOverflowOverride(aDisplay->mOverflow);
+ aPresContext->SetViewportOverflowOverride(aDisplay->mOverflowX,
+ aDisplay->mOverflowY);
return PR_TRUE;
}
@@ -3385,7 +3387,8 @@ nsIContent*
nsCSSFrameConstructor::PropagateScrollToViewport(nsPresContext* aPresContext)
{
// Set default
- aPresContext->SetViewportOverflowOverride(NS_STYLE_OVERFLOW_AUTO);
+ aPresContext->SetViewportOverflowOverride(NS_STYLE_OVERFLOW_AUTO,
+ 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 73e5e90ed3a..84df769f526 100644
--- a/mozilla/layout/style/nsCSSDeclaration.cpp
+++ b/mozilla/layout/style/nsCSSDeclaration.cpp
@@ -630,6 +630,14 @@ 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(' '));
@@ -969,6 +977,27 @@ 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) { \
@@ -1013,6 +1042,7 @@ 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);
@@ -1073,6 +1103,9 @@ 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;
}
}
@@ -1141,6 +1174,7 @@ 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);
@@ -1216,6 +1250,9 @@ 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 fe7a3bb0d83..ead908df86a 100644
--- a/mozilla/layout/style/nsCSSDeclaration.h
+++ b/mozilla/layout/style/nsCSSDeclaration.h
@@ -190,6 +190,8 @@ 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 58f254ef2d8..8a92cad5468 100644
--- a/mozilla/layout/style/nsCSSParser.cpp
+++ b/mozilla/layout/style/nsCSSParser.cpp
@@ -261,6 +261,7 @@ 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);
@@ -4024,6 +4025,8 @@ 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:
@@ -4157,6 +4160,7 @@ 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:
@@ -4443,9 +4447,10 @@ PRBool CSSParserImpl::ParseSingleValueProperty(nsresult& aErrorCode,
return ParseVariant(aErrorCode, aValue, VARIANT_HKL,
nsCSSProps::kBorderWidthKTable);
#endif
- case eCSSProperty_overflow:
+ case eCSSProperty_overflow_x:
+ case eCSSProperty_overflow_y:
return ParseVariant(aErrorCode, aValue, VARIANT_AHK,
- nsCSSProps::kOverflowKTable);
+ nsCSSProps::kOverflowSubKTable);
case eCSSProperty_padding_bottom:
case eCSSProperty_padding_end_value: // for internal use
case eCSSProperty_padding_left_value: // for internal use
@@ -5554,6 +5559,33 @@ 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 cae3293be7e..bdab54964bd 100644
--- a/mozilla/layout/style/nsCSSPropList.h
+++ b/mozilla/layout/style/nsCSSPropList.h
@@ -406,7 +406,9 @@ 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_DISPLAY(overflow, overflow, Overflow, Display, mOverflow, eCSSType_Value, PR_FALSE, kOverflowKTable)
+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_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 e90497b114c..e9d144ce36e 100644
--- a/mozilla/layout/style/nsCSSProps.cpp
+++ b/mozilla/layout/style/nsCSSProps.cpp
@@ -679,6 +679,7 @@ 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,
@@ -686,6 +687,15 @@ 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,
@@ -1316,6 +1326,12 @@ 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 0da4a705dcc..57c70d3e45a 100644
--- a/mozilla/layout/style/nsCSSProps.h
+++ b/mozilla/layout/style/nsCSSProps.h
@@ -149,6 +149,7 @@ 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 1470519b68b..a4cac3eaa95 100644
--- a/mozilla/layout/style/nsCSSStruct.cpp
+++ b/mozilla/layout/style/nsCSSStruct.cpp
@@ -487,7 +487,8 @@ nsCSSDisplay::nsCSSDisplay(const nsCSSDisplay& aCopy)
mFloat(aCopy.mFloat),
mClear(aCopy.mClear),
mClip(aCopy.mClip),
- mOverflow(aCopy.mOverflow),
+ mOverflowX(aCopy.mOverflowX),
+ mOverflowY(aCopy.mOverflowY),
mVisibility(aCopy.mVisibility),
mOpacity(aCopy.mOpacity),
// temp fix for bug 24000
@@ -523,7 +524,8 @@ void nsCSSDisplay::List(FILE* out, PRInt32 aIndent) const
fputs(NS_LossyConvertUCS2toASCII(buffer).get(), out);
mClip.List(out, eCSSProperty_clip);
buffer.SetLength(0);
- mOverflow.AppendToString(buffer, eCSSProperty_overflow);
+ mOverflowX.AppendToString(buffer, eCSSProperty_overflow_x);
+ mOverflowY.AppendToString(buffer, eCSSProperty_overflow_y);
fputs(NS_LossyConvertUCS2toASCII(buffer).get(), out);
}
#endif
diff --git a/mozilla/layout/style/nsCSSStruct.h b/mozilla/layout/style/nsCSSStruct.h
index a5a06ad9d83..ae641fcff59 100644
--- a/mozilla/layout/style/nsCSSStruct.h
+++ b/mozilla/layout/style/nsCSSStruct.h
@@ -234,7 +234,8 @@ struct nsCSSDisplay : public nsCSSStruct {
nsCSSValue mFloat;
nsCSSValue mClear;
nsCSSRect mClip;
- nsCSSValue mOverflow;
+ nsCSSValue mOverflowX;
+ nsCSSValue mOverflowY;
nsCSSValue mVisibility;
nsCSSValue mOpacity;
diff --git a/mozilla/layout/style/nsComputedDOMStyle.cpp b/mozilla/layout/style/nsComputedDOMStyle.cpp
index af6f875d0f8..dbdd5b85c35 100644
--- a/mozilla/layout/style/nsComputedDOMStyle.cpp
+++ b/mozilla/layout/style/nsComputedDOMStyle.cpp
@@ -2344,10 +2344,56 @@ nsComputedDOMStyle::GetOverflow(nsIFrame *aFrame,
const nsStyleDisplay* display = nsnull;
GetStyleData(eStyleStruct_Display, (const nsStyleStruct*&)display, aFrame);
- if (display && display->mOverflow != NS_STYLE_OVERFLOW_AUTO) {
+ 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) {
const nsAFlatCString& overflow =
- nsCSSProps::SearchKeywordTable(display->mOverflow,
- nsCSSProps::kOverflowKTable);
+ 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);
val->SetIdent(overflow);
} else {
val->SetIdent(nsLayoutAtoms::autoAtom);
@@ -3533,6 +3579,8 @@ 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 f5bff76c134..89ea422be79 100644
--- a/mozilla/layout/style/nsComputedDOMStyle.h
+++ b/mozilla/layout/style/nsComputedDOMStyle.h
@@ -272,6 +272,8 @@ 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 cf65efc5a68..0ade20aeea4 100644
--- a/mozilla/layout/style/nsHTMLCSSStyleSheet.cpp
+++ b/mozilla/layout/style/nsHTMLCSSStyleSheet.cpp
@@ -184,7 +184,8 @@ CSSDisablePropsRule::CommonMapRuleInfoInto(nsRuleData* aData)
aData->mDisplayData->mPosition = staticposition;
nsCSSValue visible(NS_STYLE_OVERFLOW_VISIBLE, eCSSUnit_Enumerated);
- aData->mDisplayData->mOverflow = visible;
+ aData->mDisplayData->mOverflowX = visible;
+ aData->mDisplayData->mOverflowY = 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 a9f2a179470..859041a81fd 100644
--- a/mozilla/layout/style/nsRuleNode.cpp
+++ b/mozilla/layout/style/nsRuleNode.cpp
@@ -2604,16 +2604,55 @@ nsRuleNode::ComputeDisplayData(nsStyleStruct* aStartStruct,
display->mFloats = parentDisplay->mFloats;
}
- // overflow: enum, auto, inherit
- if (eCSSUnit_Enumerated == displayData.mOverflow.GetUnit()) {
- display->mOverflow = displayData.mOverflow.GetIntValue();
+ // overflow-x: enum, auto, inherit
+ if (eCSSUnit_Enumerated == displayData.mOverflowX.GetUnit()) {
+ display->mOverflowX = displayData.mOverflowX.GetIntValue();
}
- else if (eCSSUnit_Auto == displayData.mOverflow.GetUnit()) {
- display->mOverflow = NS_STYLE_OVERFLOW_AUTO;
+ else if (eCSSUnit_Auto == displayData.mOverflowX.GetUnit()) {
+ display->mOverflowX = NS_STYLE_OVERFLOW_AUTO;
}
- else if (eCSSUnit_Inherit == displayData.mOverflow.GetUnit()) {
+ else if (eCSSUnit_Inherit == displayData.mOverflowX.GetUnit()) {
inherited = PR_TRUE;
- display->mOverflow = parentDisplay->mOverflow;
+ 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;
}
// clip property: length, auto, inherit
diff --git a/mozilla/layout/style/nsStyleContext.cpp b/mozilla/layout/style/nsStyleContext.cpp
index 80b6503a85d..1639d71ec00 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,7 +748,8 @@ void nsStyleContext::DumpRegressionData(nsPresContext* aPresContext, FILE* out,
(int)disp->mBreakType,
(int)disp->mBreakBefore,
(int)disp->mBreakAfter,
- (int)disp->mOverflow,
+ (int)disp->mOverflowX,
+ (int)disp->mOverflowY,
(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 fe11994fb64..eb4e27f48c2 100644
--- a/mozilla/layout/style/nsStyleStruct.cpp
+++ b/mozilla/layout/style/nsStyleStruct.cpp
@@ -1102,7 +1102,8 @@ nsStyleDisplay::nsStyleDisplay()
mBreakType = NS_STYLE_CLEAR_NONE;
mBreakBefore = PR_FALSE;
mBreakAfter = PR_FALSE;
- mOverflow = NS_STYLE_OVERFLOW_VISIBLE;
+ mOverflowX = NS_STYLE_OVERFLOW_VISIBLE;
+ mOverflowY = NS_STYLE_OVERFLOW_VISIBLE;
mClipFlags = NS_STYLE_CLIP_AUTO;
mClip.SetRect(0,0,0,0);
mOpacity = 1.0f;
@@ -1119,7 +1120,8 @@ nsStyleDisplay::nsStyleDisplay(const nsStyleDisplay& aSource)
mBreakType = aSource.mBreakType;
mBreakBefore = aSource.mBreakBefore;
mBreakAfter = aSource.mBreakAfter;
- mOverflow = aSource.mOverflow;
+ mOverflowX = aSource.mOverflowX;
+ mOverflowY = aSource.mOverflowY;
mClipFlags = aSource.mClipFlags;
mClip = aSource.mClip;
mOpacity = aSource.mOpacity;
@@ -1133,7 +1135,8 @@ nsChangeHint nsStyleDisplay::CalcDifference(const nsStyleDisplay& aOther) const
|| mPosition != aOther.mPosition
|| mDisplay != aOther.mDisplay
|| (mFloats == NS_STYLE_FLOAT_NONE) != (aOther.mFloats == NS_STYLE_FLOAT_NONE)
- || mOverflow != aOther.mOverflow
+ || mOverflowX != aOther.mOverflowX
+ || mOverflowY != aOther.mOverflowY
// 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 167c0d8f2af..4d9fdf026d0 100644
--- a/mozilla/layout/style/nsStyleStruct.h
+++ b/mozilla/layout/style/nsStyleStruct.h
@@ -731,7 +731,8 @@ struct nsStyleDisplay : public nsStyleStruct {
PRUint8 mBreakType; // [reset] see nsStyleConsts.h NS_STYLE_CLEAR_*
PRPackedBool mBreakBefore; // [reset]
PRPackedBool mBreakAfter; // [reset]
- PRUint8 mOverflow; // [reset] see nsStyleConsts.h
+ PRUint8 mOverflowX; // [reset] see nsStyleConsts.h
+ PRUint8 mOverflowY; // [reset] see nsStyleConsts.h
PRUint8 mClipFlags; // [reset] see nsStyleConsts.h
PRBool IsBlockLevel() const {return (NS_STYLE_DISPLAY_BLOCK == mDisplay) ||
@@ -749,15 +750,18 @@ struct nsStyleDisplay : public nsStyleStruct {
(NS_STYLE_POSITION_RELATIVE == mPosition);}
PRBool IsScrollableOverflow() const {
- return mOverflow != NS_STYLE_OVERFLOW_VISIBLE &&
- mOverflow != NS_STYLE_OVERFLOW_CLIP;
+ // 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;
}
// For table elements that don't support scroll frame creation, we
// support 'overflow: hidden' to mean 'overflow: -moz-hidden-unscrollable'.
PRBool IsTableClip() const {
- return mOverflow == NS_STYLE_OVERFLOW_CLIP ||
- mOverflow == NS_STYLE_OVERFLOW_HIDDEN;
+ return mOverflowX == NS_STYLE_OVERFLOW_CLIP ||
+ (mOverflowX == NS_STYLE_OVERFLOW_HIDDEN &&
+ mOverflowY == NS_STYLE_OVERFLOW_HIDDEN);
}
};
diff --git a/mozilla/layout/xul/base/src/nsBoxFrame.cpp b/mozilla/layout/xul/base/src/nsBoxFrame.cpp
index 64e545631a2..810197be243 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->mOverflow) {
+ if (NS_STYLE_OVERFLOW_CLIP == disp->mOverflowX) {
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->mOverflow) {
+ if (!hasClipped && NS_STYLE_OVERFLOW_CLIP == disp->mOverflowX) {
// 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->mOverflow) {
+ if (NS_STYLE_OVERFLOW_CLIP == disp->mOverflowX) {
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->mOverflow) {
+ if (!hasClipped && NS_STYLE_OVERFLOW_CLIP == disp->mOverflowX) {
// 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.