Created
February 12, 2013 03:12
-
-
Save esprehn/4759966 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/Source/WebCore/css/CSSComputedStyleDeclaration.cpp b/Source/WebCore/css/CSSComputedStyleDeclaration.cpp | |
index c43a48f..ca14687 100644 | |
--- a/Source/WebCore/css/CSSComputedStyleDeclaration.cpp | |
+++ b/Source/WebCore/css/CSSComputedStyleDeclaration.cpp | |
@@ -2743,6 +2743,11 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(CSSPropert | |
case CSSPropertyUnicodeRange: | |
break; | |
+ // FIXME: Implement these for getComputedStyle. | |
+ case CSSPropertyWebkitOverflowAttachmentX: | |
+ case CSSPropertyWebkitOverflowAttachmentY: | |
+ break; | |
+ | |
/* Other unimplemented properties */ | |
case CSSPropertyPage: // for @page | |
case CSSPropertyQuotes: // FIXME: needs implementation | |
diff --git a/Source/WebCore/css/CSSParser.cpp b/Source/WebCore/css/CSSParser.cpp | |
index 2098b1e..ff8503d 100644 | |
--- a/Source/WebCore/css/CSSParser.cpp | |
+++ b/Source/WebCore/css/CSSParser.cpp | |
@@ -683,6 +683,14 @@ static inline bool isValidKeywordPropertyAndValue(CSSPropertyID propertyId, int | |
if (valueID == CSSValueVisible || valueID == CSSValueHidden || valueID == CSSValueScroll || valueID == CSSValueAuto || valueID == CSSValueOverlay || valueID == CSSValueWebkitMarquee || valueID == CSSValueWebkitPagedX || valueID == CSSValueWebkitPagedY) | |
return true; | |
break; | |
+ case CSSPropertyWebkitOverflowAttachmentX: | |
+ if (valueID == CSSValueStart || valueID == CSSValueEnd) | |
+ return true; | |
+ break; | |
+ case CSSPropertyWebkitOverflowAttachmentY: | |
+ if (valueID == CSSValueBefore || valueID == CSSValueAfter) | |
+ return true; | |
+ break; | |
case CSSPropertyPageBreakAfter: // auto | always | avoid | left | right | inherit | |
case CSSPropertyPageBreakBefore: | |
case CSSPropertyWebkitColumnBreakAfter: | |
@@ -1003,6 +1011,8 @@ static inline bool isKeywordPropertyID(CSSPropertyID propertyId) | |
case CSSPropertyOverflowWrap: | |
case CSSPropertyOverflowX: | |
case CSSPropertyOverflowY: | |
+ case CSSPropertyWebkitOverflowAttachmentX: | |
+ case CSSPropertyWebkitOverflowAttachmentY: | |
case CSSPropertyPageBreakAfter: | |
case CSSPropertyPageBreakBefore: | |
case CSSPropertyPageBreakInside: | |
diff --git a/Source/WebCore/css/CSSPrimitiveValueMappings.h b/Source/WebCore/css/CSSPrimitiveValueMappings.h | |
index 532e99c..0653681 100644 | |
--- a/Source/WebCore/css/CSSPrimitiveValueMappings.h | |
+++ b/Source/WebCore/css/CSSPrimitiveValueMappings.h | |
@@ -881,6 +881,60 @@ template<> inline CSSPrimitiveValue::operator EBoxSizing() const | |
return BORDER_BOX; | |
} | |
+template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EOverflowAttachmentX e) | |
+ : CSSValue(PrimitiveClass) | |
+{ | |
+ m_primitiveUnitType = CSS_IDENT; | |
+ switch (e) { | |
+ case OverflowAttachmentStart: | |
+ m_value.ident = CSSValueStart; | |
+ break; | |
+ case OverflowAttachmentEnd: | |
+ m_value.ident = CSSValueEnd; | |
+ break; | |
+ } | |
+} | |
+ | |
+template<> inline CSSPrimitiveValue::operator EOverflowAttachmentX() const | |
+{ | |
+ switch (m_value.ident) { | |
+ case CSSValueStart: | |
+ return OverflowAttachmentStart; | |
+ case CSSValueEnd: | |
+ return OverflowAttachmentEnd; | |
+ } | |
+ | |
+ ASSERT_NOT_REACHED(); | |
+ return OverflowAttachmentStart; | |
+} | |
+ | |
+template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EOverflowAttachmentY e) | |
+ : CSSValue(PrimitiveClass) | |
+{ | |
+ m_primitiveUnitType = CSS_IDENT; | |
+ switch (e) { | |
+ case OverflowAttachmentBefore: | |
+ m_value.ident = CSSValueBefore; | |
+ break; | |
+ case OverflowAttachmentAfter: | |
+ m_value.ident = CSSValueAfter; | |
+ break; | |
+ } | |
+} | |
+ | |
+template<> inline CSSPrimitiveValue::operator EOverflowAttachmentY() const | |
+{ | |
+ switch (m_value.ident) { | |
+ case CSSValueBefore: | |
+ return OverflowAttachmentBefore; | |
+ case CSSValueAfter: | |
+ return OverflowAttachmentAfter; | |
+ } | |
+ | |
+ ASSERT_NOT_REACHED(); | |
+ return OverflowAttachmentBefore; | |
+} | |
+ | |
template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EBoxDirection e) | |
: CSSValue(PrimitiveClass) | |
{ | |
diff --git a/Source/WebCore/css/CSSProperty.cpp b/Source/WebCore/css/CSSProperty.cpp | |
index 3a402cf..0158093 100644 | |
--- a/Source/WebCore/css/CSSProperty.cpp | |
+++ b/Source/WebCore/css/CSSProperty.cpp | |
@@ -458,6 +458,8 @@ bool CSSProperty::isInheritedProperty(CSSPropertyID propertyID) | |
case CSSPropertyOverflowWrap: | |
case CSSPropertyOverflowX: | |
case CSSPropertyOverflowY: | |
+ case CSSPropertyWebkitOverflowAttachmentX: | |
+ case CSSPropertyWebkitOverflowAttachmentY: | |
case CSSPropertyPadding: | |
case CSSPropertyPaddingBottom: | |
case CSSPropertyPaddingLeft: | |
diff --git a/Source/WebCore/css/CSSPropertyNames.in b/Source/WebCore/css/CSSPropertyNames.in | |
index ac3fde5..db39558 100644 | |
--- a/Source/WebCore/css/CSSPropertyNames.in | |
+++ b/Source/WebCore/css/CSSPropertyNames.in | |
@@ -349,6 +349,8 @@ z-index | |
-webkit-min-logical-height | |
-webkit-nbsp-mode | |
-webkit-order | |
+-webkit-overflow-attachment-x | |
+-webkit-overflow-attachment-y | |
-webkit-padding-after | |
-webkit-padding-before | |
-webkit-padding-end | |
diff --git a/Source/WebCore/css/StyleBuilder.cpp b/Source/WebCore/css/StyleBuilder.cpp | |
index 4d878b2..5eb2e1b 100644 | |
--- a/Source/WebCore/css/StyleBuilder.cpp | |
+++ b/Source/WebCore/css/StyleBuilder.cpp | |
@@ -1896,6 +1896,8 @@ StyleBuilder::StyleBuilder() | |
setPropertyHandler(CSSPropertyOutlineColor, ApplyPropertyColor<NoInheritFromParent, &RenderStyle::outlineColor, &RenderStyle::setOutlineColor, &RenderStyle::setVisitedLinkOutlineColor, &RenderStyle::color>::createHandler()); | |
setPropertyHandler(CSSPropertyOutlineOffset, ApplyPropertyComputeLength<int, &RenderStyle::outlineOffset, &RenderStyle::setOutlineOffset, &RenderStyle::initialOutlineOffset>::createHandler()); | |
setPropertyHandler(CSSPropertyOutlineStyle, ApplyPropertyOutlineStyle::createHandler()); | |
+ setPropertyHandler(CSSPropertyWebkitOverflowAttachmentX, ApplyPropertyDefault<EOverflowAttachmentX, &RenderStyle::overflowAttachmentX, EOverflowAttachmentX, &RenderStyle::setOverflowAttachmentX, EOverflowAttachmentX, &RenderStyle::initialOverflowAttachmentX>::createHandler()); | |
+ setPropertyHandler(CSSPropertyWebkitOverflowAttachmentY, ApplyPropertyDefault<EOverflowAttachmentY, &RenderStyle::overflowAttachmentY, EOverflowAttachmentY, &RenderStyle::setOverflowAttachmentY, EOverflowAttachmentY, &RenderStyle::initialOverflowAttachmentY>::createHandler()); | |
setPropertyHandler(CSSPropertyOutlineWidth, ApplyPropertyComputeLength<unsigned short, &RenderStyle::outlineWidth, &RenderStyle::setOutlineWidth, &RenderStyle::initialOutlineWidth, NormalDisabled, ThicknessEnabled>::createHandler()); | |
setPropertyHandler(CSSPropertyOverflow, ApplyPropertyExpanding<ExpandValue, CSSPropertyOverflowX, CSSPropertyOverflowY>::createHandler()); | |
setPropertyHandler(CSSPropertyOverflowWrap, ApplyPropertyDefault<EOverflowWrap, &RenderStyle::overflowWrap, EOverflowWrap, &RenderStyle::setOverflowWrap, EOverflowWrap, &RenderStyle::initialOverflowWrap>::createHandler()); | |
diff --git a/Source/WebCore/rendering/RenderLayer.cpp b/Source/WebCore/rendering/RenderLayer.cpp | |
index e8d03ea..888dc0a 100644 | |
--- a/Source/WebCore/rendering/RenderLayer.cpp | |
+++ b/Source/WebCore/rendering/RenderLayer.cpp | |
@@ -3085,7 +3085,8 @@ void RenderLayer::updateScrollInfoAfterLayout() | |
return; | |
m_scrollDimensionsDirty = true; | |
- IntSize originalScrollOffset = scrollOffset(); | |
+ IntPoint originalPosition = IntPoint(scrollOffset()); | |
+ IntPoint originalMaxPosition = maximumScrollPosition(); | |
computeScrollDimensions(); | |
@@ -3099,8 +3100,17 @@ void RenderLayer::updateScrollInfoAfterLayout() | |
updateScrollbarsAfterLayout(); | |
- if (originalScrollOffset != scrollOffset()) | |
- scrollToOffsetWithoutAnimation(IntPoint(scrollOffset())); | |
+ IntPoint newPosition = IntPoint(scrollOffset()); | |
+ | |
+ // FIXME: Make this handle vertical writing mode and rtl. | |
+ // FIXME: We should support a spacing value so being close to the end is the same as touching it. | |
+ if (box->style()->overflowAttachmentY() == OverflowAttachmentAfter && (!box->everHadLayout() || scrollPosition().y() == originalMaxPosition.y())) | |
+ newPosition.setY(maximumScrollPosition().y()); | |
+ if (box->style()->overflowAttachmentX() == OverflowAttachmentEnd && (!box->everHadLayout() || scrollPosition().x() == originalMaxPosition.x())) | |
+ newPosition.setX(maximumScrollPosition().x()); | |
+ | |
+ if (originalPosition != newPosition) | |
+ scrollToOffsetWithoutAnimation(newPosition); | |
#if USE(ACCELERATED_COMPOSITING) | |
// Composited scrolling may need to be enabled or disabled if the amount of overflow changed. | |
diff --git a/Source/WebCore/rendering/style/RenderStyle.h b/Source/WebCore/rendering/style/RenderStyle.h | |
index 02cf0c9..9e37179 100644 | |
--- a/Source/WebCore/rendering/style/RenderStyle.h | |
+++ b/Source/WebCore/rendering/style/RenderStyle.h | |
@@ -532,6 +532,9 @@ public: | |
EOverflow overflowX() const { return static_cast<EOverflow>(noninherited_flags._overflowX); } | |
EOverflow overflowY() const { return static_cast<EOverflow>(noninherited_flags._overflowY); } | |
+ EOverflowAttachmentX overflowAttachmentX() const { return static_cast<EOverflowAttachmentX>(rareNonInheritedData->m_overflowAttachmentX); } | |
+ EOverflowAttachmentY overflowAttachmentY() const { return static_cast<EOverflowAttachmentY>(rareNonInheritedData->m_overflowAttachmentY); } | |
+ | |
EVisibility visibility() const { return static_cast<EVisibility>(inherited_flags._visibility); } | |
EVerticalAlign verticalAlign() const { return static_cast<EVerticalAlign>(noninherited_flags._vertical_align); } | |
Length verticalAlignLength() const { return m_box->verticalAlign(); } | |
@@ -1066,6 +1069,9 @@ public: | |
void setOutlineStyle(EBorderStyle v) { SET_VAR(m_background, m_outline.m_style, v); } | |
void setOutlineColor(const Color& v) { SET_BORDERVALUE_COLOR(m_background, m_outline, v); } | |
+ void setOverflowAttachmentX(EOverflowAttachmentX value) { SET_VAR(rareNonInheritedData, m_overflowAttachmentX, value); } | |
+ void setOverflowAttachmentY(EOverflowAttachmentY value) { SET_VAR(rareNonInheritedData, m_overflowAttachmentY, value); } | |
+ | |
void setOverflowX(EOverflow v) { noninherited_flags._overflowX = v; } | |
void setOverflowY(EOverflow v) { noninherited_flags._overflowY = v; } | |
void setVisibility(EVisibility v) { inherited_flags._visibility = v; } | |
@@ -1534,6 +1540,8 @@ public: | |
static EListStyleType initialListStyleType() { return Disc; } | |
static EOverflow initialOverflowX() { return OVISIBLE; } | |
static EOverflow initialOverflowY() { return OVISIBLE; } | |
+ static EOverflowAttachmentX initialOverflowAttachmentX() { return OverflowAttachmentStart; } | |
+ static EOverflowAttachmentY initialOverflowAttachmentY() { return OverflowAttachmentBefore; } | |
static EPageBreak initialPageBreak() { return PBAUTO; } | |
static EPosition initialPosition() { return StaticPosition; } | |
static ETableLayout initialTableLayout() { return TAUTO; } | |
diff --git a/Source/WebCore/rendering/style/RenderStyleConstants.h b/Source/WebCore/rendering/style/RenderStyleConstants.h | |
index 8c2c0b5..0619f85 100644 | |
--- a/Source/WebCore/rendering/style/RenderStyleConstants.h | |
+++ b/Source/WebCore/rendering/style/RenderStyleConstants.h | |
@@ -122,6 +122,14 @@ enum EOverflow { | |
OVISIBLE, OHIDDEN, OSCROLL, OAUTO, OOVERLAY, OMARQUEE, OPAGEDX, OPAGEDY | |
}; | |
+enum EOverflowAttachmentX { | |
+ OverflowAttachmentStart, OverflowAttachmentEnd | |
+}; | |
+ | |
+enum EOverflowAttachmentY { | |
+ OverflowAttachmentBefore, OverflowAttachmentAfter | |
+}; | |
+ | |
enum EVerticalAlign { | |
BASELINE, MIDDLE, SUB, SUPER, TEXT_TOP, | |
TEXT_BOTTOM, TOP, BOTTOM, BASELINE_MIDDLE, LENGTH | |
diff --git a/Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp b/Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp | |
index b5a6eff..2557cfc 100644 | |
--- a/Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp | |
+++ b/Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp | |
@@ -77,6 +77,8 @@ StyleRareNonInheritedData::StyleRareNonInheritedData() | |
, m_appearance(RenderStyle::initialAppearance()) | |
, m_borderFit(RenderStyle::initialBorderFit()) | |
, m_textCombine(RenderStyle::initialTextCombine()) | |
+ , m_overflowAttachmentX(OverflowAttachmentStart) | |
+ , m_overflowAttachmentY(OverflowAttachmentBefore) | |
#if ENABLE(CSS3_TEXT) | |
, m_textDecorationStyle(RenderStyle::initialTextDecorationStyle()) | |
#endif // CSS3_TEXT | |
diff --git a/Source/WebCore/rendering/style/StyleRareNonInheritedData.h b/Source/WebCore/rendering/style/StyleRareNonInheritedData.h | |
index c4ac0f6..a77c4af 100644 | |
--- a/Source/WebCore/rendering/style/StyleRareNonInheritedData.h | |
+++ b/Source/WebCore/rendering/style/StyleRareNonInheritedData.h | |
@@ -179,6 +179,9 @@ public: | |
unsigned m_borderFit : 1; // EBorderFit | |
unsigned m_textCombine : 1; // CSS3 text-combine properties | |
+ unsigned m_overflowAttachmentX : 1; // EOverflowAttachmentX | |
+ unsigned m_overflowAttachmentY : 1; // EOverflowAttachmentY | |
+ | |
#if ENABLE(CSS3_TEXT) | |
unsigned m_textDecorationStyle : 3; // TextDecorationStyle | |
#endif // CSS3_TEXT |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment