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

Unified Diff: Source/core/css/resolver/StyleResolver.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: Implementation of CSS3 nav-up/down/left/right properties from CSS3 UI Created 7 years, 6 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/resolver/StyleResolver.cpp
diff --git a/Source/core/css/resolver/StyleResolver.cpp b/Source/core/css/resolver/StyleResolver.cpp
index 87e23ed306e135e387b2d810eef1cf2e700852d8..e1aafbd93c1539bbe961dd61b885008b8d0d4ba0 100644
--- a/Source/core/css/resolver/StyleResolver.cpp
+++ b/Source/core/css/resolver/StyleResolver.cpp
@@ -9,6 +9,7 @@
* Copyright (c) 2011, Code Aurora Forum. All rights reserved.
* Copyright (C) Research In Motion Limited 2011. All rights reserved.
* Copyright (C) 2012 Google Inc. All rights reserved.
+ * Copyright (C) 2013 Opera Software ASA. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -2695,6 +2696,31 @@ void StyleResolver::applyProperty(CSSPropertyID id, CSSValue* value)
break;
// CSS3 Properties
+ case CSSPropertyNavDown:
+ case CSSPropertyNavLeft:
+ case CSSPropertyNavRight:
+ case CSSPropertyNavUp: {
+ NavDirSetter setter = getNavDirSetterForProperty(id);
+
+ if (isInitial) {
+ (m_state.style()->*setter)(StyleNavigationValue());
+ } else if (primitiveValue) {
+ (m_state.style()->*setter)(StyleNavigationValue(primitiveValue->getStringValue()));
+ } else if (value->isValueList()) {
+ AtomicString vals[2];
+ CSSValueListIterator iterator = value;
+
+ for (int i = 0; i < 2 && iterator.hasMore(); iterator.advance()) {
+ CSSValue* item = iterator.value();
+ if (!item->isPrimitiveValue())
+ continue;
+ vals[i++] = (static_cast<CSSPrimitiveValue*>(item))->getStringValue();
+ }
+
+ (m_state.style()->*setter)(StyleNavigationValue(vals[0], vals[1]));
esprehn 2013/06/20 19:45:10 You should do this the other way around instead of
Krzysztof Olczyk 2013/07/22 14:14:16 Done.
+ }
+ return;
+ }
case CSSPropertyTextShadow:
case CSSPropertyBoxShadow:
case CSSPropertyWebkitBoxShadow: {
@@ -3540,6 +3566,24 @@ void StyleResolver::loadPendingShaders()
m_state.setHasPendingShaders(false);
}
+StyleResolver::NavDirSetter StyleResolver::getNavDirSetterForProperty(CSSPropertyID id)
+{
+ switch (id) {
+ case CSSPropertyNavDown:
+ return &RenderStyle::setNavDown;
+ case CSSPropertyNavLeft:
+ return &RenderStyle::setNavLeft;
+ case CSSPropertyNavRight:
+ return &RenderStyle::setNavRight;
+ case CSSPropertyNavUp:
+ return &RenderStyle::setNavUp;
+ default:
+ ASSERT_NOT_REACHED();
+ return 0;
+ }
+}
+
+
PassRefPtr<StyleImage> StyleResolver::loadPendingImage(StylePendingImage* pendingImage)
{
CachedResourceLoader* cachedResourceLoader = m_state.document()->cachedResourceLoader();

Powered by Google App Engine
This is Rietveld 408576698