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

Side by Side 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: Applied code review suggestions. Also rebased. Created 6 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004 Zack Rusin <zack@kde.org> 2 * Copyright (C) 2004 Zack Rusin <zack@kde.org>
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved. 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved.
4 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> 4 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org>
5 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> 5 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com>
6 * Copyright (C) 2011 Sencha, Inc. All rights reserved. 6 * Copyright (C) 2011 Sencha, Inc. All rights reserved.
7 * Copyright (C) 2014 Opera Software ASA. All rights reserved.
7 * 8 *
8 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public 10 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either 11 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version. 12 * version 2 of the License, or (at your option) any later version.
12 * 13 *
13 * This library is distributed in the hope that it will be useful, 14 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details. 17 * Lesser General Public License for more details.
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 CSSPropertyListStylePosition, 146 CSSPropertyListStylePosition,
146 CSSPropertyListStyleType, 147 CSSPropertyListStyleType,
147 CSSPropertyMarginBottom, 148 CSSPropertyMarginBottom,
148 CSSPropertyMarginLeft, 149 CSSPropertyMarginLeft,
149 CSSPropertyMarginRight, 150 CSSPropertyMarginRight,
150 CSSPropertyMarginTop, 151 CSSPropertyMarginTop,
151 CSSPropertyMaxHeight, 152 CSSPropertyMaxHeight,
152 CSSPropertyMaxWidth, 153 CSSPropertyMaxWidth,
153 CSSPropertyMinHeight, 154 CSSPropertyMinHeight,
154 CSSPropertyMinWidth, 155 CSSPropertyMinWidth,
156 CSSPropertyNavDown,
157 CSSPropertyNavLeft,
158 CSSPropertyNavRight,
159 CSSPropertyNavUp,
155 CSSPropertyMixBlendMode, 160 CSSPropertyMixBlendMode,
156 CSSPropertyObjectFit, 161 CSSPropertyObjectFit,
157 CSSPropertyObjectPosition, 162 CSSPropertyObjectPosition,
158 CSSPropertyOpacity, 163 CSSPropertyOpacity,
159 CSSPropertyOrphans, 164 CSSPropertyOrphans,
160 CSSPropertyOutlineColor, 165 CSSPropertyOutlineColor,
161 CSSPropertyOutlineOffset, 166 CSSPropertyOutlineOffset,
162 CSSPropertyOutlineStyle, 167 CSSPropertyOutlineStyle,
163 CSSPropertyOutlineWidth, 168 CSSPropertyOutlineWidth,
164 CSSPropertyOverflowWrap, 169 CSSPropertyOverflowWrap,
(...skipping 1189 matching lines...) Expand 10 before | Expand all | Expand 10 after
1354 1359
1355 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated() ; 1360 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated() ;
1356 for (CounterDirectiveMap::const_iterator it = map->begin(); it != map->end() ; ++it) { 1361 for (CounterDirectiveMap::const_iterator it = map->begin(); it != map->end() ; ++it) {
1357 list->append(cssValuePool().createValue(it->key, CSSPrimitiveValue::CSS_ STRING)); 1362 list->append(cssValuePool().createValue(it->key, CSSPrimitiveValue::CSS_ STRING));
1358 short number = propertyID == CSSPropertyCounterIncrement ? it->value.inc rementValue() : it->value.resetValue(); 1363 short number = propertyID == CSSPropertyCounterIncrement ? it->value.inc rementValue() : it->value.resetValue();
1359 list->append(cssValuePool().createValue((double)number, CSSPrimitiveValu e::CSS_NUMBER)); 1364 list->append(cssValuePool().createValue((double)number, CSSPrimitiveValu e::CSS_NUMBER));
1360 } 1365 }
1361 return list.release(); 1366 return list.release();
1362 } 1367 }
1363 1368
1369 static PassRefPtrWillBeRawPtr<CSSValue> valueForNavigationDirection(const Render Style& style, CSSPropertyID propertyID)
1370 {
1371 StyleNavigationValue navValue;
1372
1373 switch (propertyID) {
1374 case CSSPropertyNavUp:
1375 navValue = style.navUp();
1376 break;
1377 case CSSPropertyNavDown:
1378 navValue = style.navDown();
1379 break;
1380 case CSSPropertyNavLeft:
1381 navValue = style.navLeft();
1382 break;
1383 case CSSPropertyNavRight:
1384 navValue = style.navRight();
1385 break;
1386 default:
1387 ASSERT_NOT_REACHED();
1388 break;
1389 }
1390
1391 if (navValue.isAuto())
1392 return cssValuePool().createIdentifierValue(CSSValueAuto);
1393
1394 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated() ;
1395 list->append(cssValuePool().createValue(navValue.id(), CSSPrimitiveValue::CS S_STRING));
fs 2014/04/17 15:33:48 What does this end up serializing to?
Krzysztof Olczyk 2014/09/30 15:41:46 Right, it would have been converted to string with
1396 list->append(cssValuePool().createValue(navValue.target(), CSSPrimitiveValue ::CSS_STRING));
1397
1398 return list;
1399 }
1400
1364 static void logUnimplementedPropertyID(CSSPropertyID propertyID) 1401 static void logUnimplementedPropertyID(CSSPropertyID propertyID)
1365 { 1402 {
1366 DEFINE_STATIC_LOCAL(HashSet<CSSPropertyID>, propertyIDSet, ()); 1403 DEFINE_STATIC_LOCAL(HashSet<CSSPropertyID>, propertyIDSet, ());
1367 if (!propertyIDSet.add(propertyID).isNewEntry) 1404 if (!propertyIDSet.add(propertyID).isNewEntry)
1368 return; 1405 return;
1369 1406
1370 WTF_LOG_ERROR("WebKit does not yet implement getComputedStyle for '%s'.", ge tPropertyName(propertyID)); 1407 WTF_LOG_ERROR("WebKit does not yet implement getComputedStyle for '%s'.", ge tPropertyName(propertyID));
1371 } 1408 }
1372 1409
1373 static PassRefPtrWillBeRawPtr<CSSValueList> valueForFontFamily(RenderStyle& styl e) 1410 static PassRefPtrWillBeRawPtr<CSSValueList> valueForFontFamily(RenderStyle& styl e)
(...skipping 694 matching lines...) Expand 10 before | Expand all | Expand 10 after
2068 if (marginBottom.isFixed() || !renderer || !renderer->isBox()) 2105 if (marginBottom.isFixed() || !renderer || !renderer->isBox())
2069 return zoomAdjustedPixelValueForLength(marginBottom, *style); 2106 return zoomAdjustedPixelValueForLength(marginBottom, *style);
2070 return zoomAdjustedPixelValue(toRenderBox(renderer)->marginBottom(), *style); 2107 return zoomAdjustedPixelValue(toRenderBox(renderer)->marginBottom(), *style);
2071 } 2108 }
2072 case CSSPropertyMarginLeft: { 2109 case CSSPropertyMarginLeft: {
2073 Length marginLeft = style->marginLeft(); 2110 Length marginLeft = style->marginLeft();
2074 if (marginLeft.isFixed() || !renderer || !renderer->isBox()) 2111 if (marginLeft.isFixed() || !renderer || !renderer->isBox())
2075 return zoomAdjustedPixelValueForLength(marginLeft, *style); 2112 return zoomAdjustedPixelValueForLength(marginLeft, *style);
2076 return zoomAdjustedPixelValue(toRenderBox(renderer)->marginLeft(), * style); 2113 return zoomAdjustedPixelValue(toRenderBox(renderer)->marginLeft(), * style);
2077 } 2114 }
2115 case CSSPropertyNavDown:
2116 case CSSPropertyNavLeft:
2117 case CSSPropertyNavRight:
2118 case CSSPropertyNavUp:
2119 return valueForNavigationDirection(*style, propertyID);
2078 case CSSPropertyWebkitUserModify: 2120 case CSSPropertyWebkitUserModify:
2079 return cssValuePool().createValue(style->userModify()); 2121 return cssValuePool().createValue(style->userModify());
2080 case CSSPropertyMaxHeight: { 2122 case CSSPropertyMaxHeight: {
2081 const Length& maxHeight = style->maxHeight(); 2123 const Length& maxHeight = style->maxHeight();
2082 if (maxHeight.isUndefined()) 2124 if (maxHeight.isUndefined())
2083 return cssValuePool().createIdentifierValue(CSSValueNone); 2125 return cssValuePool().createIdentifierValue(CSSValueNone);
2084 return zoomAdjustedPixelValueForLength(maxHeight, *style); 2126 return zoomAdjustedPixelValueForLength(maxHeight, *style);
2085 } 2127 }
2086 case CSSPropertyMaxWidth: { 2128 case CSSPropertyMaxWidth: {
2087 const Length& maxWidth = style->maxWidth(); 2129 const Length& maxWidth = style->maxWidth();
(...skipping 956 matching lines...) Expand 10 before | Expand all | Expand 10 after
3044 static const CSSPropertyID propertiesAfterSlashSeperator[3] = { CSSPropertyB ackgroundSize, CSSPropertyBackgroundOrigin, 3086 static const CSSPropertyID propertiesAfterSlashSeperator[3] = { CSSPropertyB ackgroundSize, CSSPropertyBackgroundOrigin,
3045 CSSPropertyB ackgroundClip }; 3087 CSSPropertyB ackgroundClip };
3046 3088
3047 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSlashSeparated() ; 3089 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSlashSeparated() ;
3048 list->append(valuesForShorthandProperty(StylePropertyShorthand(CSSPropertyBa ckground, propertiesBeforeSlashSeperator, WTF_ARRAY_LENGTH(propertiesBeforeSlash Seperator)))); 3090 list->append(valuesForShorthandProperty(StylePropertyShorthand(CSSPropertyBa ckground, propertiesBeforeSlashSeperator, WTF_ARRAY_LENGTH(propertiesBeforeSlash Seperator))));
3049 list->append(valuesForShorthandProperty(StylePropertyShorthand(CSSPropertyBa ckground, propertiesAfterSlashSeperator, WTF_ARRAY_LENGTH(propertiesAfterSlashSe perator)))); 3091 list->append(valuesForShorthandProperty(StylePropertyShorthand(CSSPropertyBa ckground, propertiesAfterSlashSeperator, WTF_ARRAY_LENGTH(propertiesAfterSlashSe perator))));
3050 return list.release(); 3092 return list.release();
3051 } 3093 }
3052 3094
3053 } // namespace WebCore 3095 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698