Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(209)

Unified Diff: third_party/WebKit/Source/core/css/ComputedStyleCSSValueMapping.cpp

Issue 1919813002: Implementation of CSS3 nav-up/down/left/right properties from CSS3 UI Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/css/ComputedStyleCSSValueMapping.cpp
diff --git a/third_party/WebKit/Source/core/css/ComputedStyleCSSValueMapping.cpp b/third_party/WebKit/Source/core/css/ComputedStyleCSSValueMapping.cpp
index 098c11f63e382eb7aacbf9ab8cdc2a79368075b0..457f287f00142af67224b31f309d1d83a5caebe4 100644
--- a/third_party/WebKit/Source/core/css/ComputedStyleCSSValueMapping.cpp
+++ b/third_party/WebKit/Source/core/css/ComputedStyleCSSValueMapping.cpp
@@ -1326,6 +1326,50 @@ static RawPtr<CSSValue> valueForScrollSnapCoordinate(const Vector<LengthPoint>&
return list.release();
}
+static RawPtr<CSSValue> valueForNavigationDirection(const ComputedStyle& style, CSSPropertyID propertyID)
fs 2016/05/18 15:55:04 RawPtr<T> is no more. Use T* here and in all other
+{
+ StyleNavigationValue navValue;
+
+ switch (propertyID) {
+ case CSSPropertyNavUp:
+ navValue = style.navUp();
+ break;
+ case CSSPropertyNavDown:
+ navValue = style.navDown();
+ break;
+ case CSSPropertyNavLeft:
+ navValue = style.navLeft();
+ break;
+ case CSSPropertyNavRight:
+ navValue = style.navRight();
+ break;
+ default:
+ ASSERT_NOT_REACHED();
+ break;
+ }
+
+ if (navValue.isAuto())
+ return cssValuePool().createIdentifierValue(CSSValueAuto);
+
+ String selectorText = "#";
+ selectorText.append(navValue.id());
+ RawPtr<CSSValue> idSel = CSSStringValue::create(selectorText);
fs 2016/05/18 15:55:04 This should be a hash (not a string) - doesn't loo
+ RawPtr<CSSValue> target;
+ if (navValue.navigationTarget() == TargetName)
+ target = CSSStringValue::create(navValue.targetName());
+ else if (navValue.navigationTarget() == Root)
+ target = cssValuePool().createIdentifierValue(CSSValueRoot);
+ else if (navValue.navigationTarget() == Current)
+ target = cssValuePool().createIdentifierValue(CSSValueCurrent);
+ else
+ ASSERT_NOT_REACHED();
+
+ RawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
+ list->append(idSel);
+ list->append(target);
+ return list.release();
+}
+
static EBreak mapToPageBreakValue(EBreak genericBreakValue)
{
switch (genericBreakValue) {
@@ -1837,8 +1881,15 @@ RawPtr<CSSValue> ComputedStyleCSSValueMapping::get(CSSPropertyID propertyID, con
return zoomAdjustedPixelValueForLength(marginLeft, style);
return zoomAdjustedPixelValue(toLayoutBox(layoutObject)->marginLeft(), style);
}
+ case CSSPropertyNavDown:
+ case CSSPropertyNavLeft:
+ case CSSPropertyNavRight:
+ case CSSPropertyNavUp:
+ return valueForNavigationDirection(style, propertyID);
+
case CSSPropertyWebkitUserModify:
return cssValuePool().createValue(style.userModify());
+
case CSSPropertyMaxHeight: {
const Length& maxHeight = style.maxHeight();
if (maxHeight.isMaxSizeNone())

Powered by Google App Engine
This is Rietveld 408576698