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

Unified Diff: Source/core/css/CSSComputedStyleDeclaration.cpp

Issue 17450016: Implementation of CSS3 nav-up/down/left/right properties from CSS3 UI. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fixed compilation error in mac and crash in linux/window that were reported by trybots. Created 6 years, 3 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: Source/core/css/CSSComputedStyleDeclaration.cpp
diff --git a/Source/core/css/CSSComputedStyleDeclaration.cpp b/Source/core/css/CSSComputedStyleDeclaration.cpp
index 182e7eef70833261cced751674f735f167dc3214..c0156c11f69ab6ad4dc826a84bdae854f62a6016 100644
--- a/Source/core/css/CSSComputedStyleDeclaration.cpp
+++ b/Source/core/css/CSSComputedStyleDeclaration.cpp
@@ -4,6 +4,7 @@
* Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org>
* Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com>
* Copyright (C) 2011 Sencha, Inc. All rights reserved.
+ * Copyright (C) 2014 Opera Software ASA. All rights reserved.
Timothy Loh 2014/10/01 13:14:53 I haven't seen these headers changed in a long tim
rune 2014/10/01 13:40:49 We shouldn't change it. Add the generic Chromium c
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -152,6 +153,10 @@ static const CSSPropertyID staticComputableProperties[] = {
CSSPropertyMaxWidth,
CSSPropertyMinHeight,
CSSPropertyMinWidth,
+ CSSPropertyNavDown,
+ CSSPropertyNavLeft,
+ CSSPropertyNavRight,
+ CSSPropertyNavUp,
CSSPropertyMixBlendMode,
CSSPropertyObjectFit,
CSSPropertyObjectPosition,
@@ -1376,6 +1381,50 @@ static PassRefPtrWillBeRawPtr<CSSValue> valueForCounterDirectives(const RenderSt
return list.release();
}
+static PassRefPtrWillBeRawPtr<CSSValue> valueForNavigationDirection(const RenderStyle& style, CSSPropertyID propertyID)
+{
+ 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());
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> idSel = cssValuePool().createValue(selectorText, CSSPrimitiveValue::CSS_STRING);
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> target;
+ if (navValue.navigationTarget() == TargetName)
+ target = cssValuePool().createValue(navValue.targetName(), CSSPrimitiveValue::CSS_STRING);
+ else if (navValue.navigationTarget() == Root)
+ target = cssValuePool().createValue(CSSValueRoot);
+ else if (navValue.navigationTarget() == Current)
+ target = cssValuePool().createValue(CSSValueCurrent);
+ else
+ ASSERT_NOT_REACHED();
+
+ RefPtrWillBeRawPtr<CSSValueList> value = CSSValueList::createSpaceSeparated();
+ value->append(idSel);
+ value->append(target);
+ return value;
+}
+
static void logUnimplementedPropertyID(CSSPropertyID propertyID)
{
DEFINE_STATIC_LOCAL(HashSet<CSSPropertyID>, propertyIDSet, ());
@@ -2059,6 +2108,11 @@ PassRefPtrWillBeRawPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValu
return zoomAdjustedPixelValueForLength(marginLeft, *style);
return zoomAdjustedPixelValue(toRenderBox(renderer)->marginLeft(), *style);
}
+ case CSSPropertyNavDown:
+ case CSSPropertyNavLeft:
+ case CSSPropertyNavRight:
+ case CSSPropertyNavUp:
+ return valueForNavigationDirection(*style, propertyID);
case CSSPropertyWebkitUserModify:
return cssValuePool().createValue(style->userModify());
case CSSPropertyMaxHeight: {

Powered by Google App Engine
This is Rietveld 408576698