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

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: Rebased once again to master, fixed layout test. 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) 2013 Opera Software ASA. All rights reserved.
fs 2014/04/14 12:32:01 Update year. (In all files where it's been added.)
Krzysztof Olczyk 2014/04/17 13:48:40 Done.
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 1190 matching lines...) Expand 10 before | Expand all | Expand 10 after
1355 1360
1356 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated() ; 1361 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated() ;
1357 for (CounterDirectiveMap::const_iterator it = map->begin(); it != map->end() ; ++it) { 1362 for (CounterDirectiveMap::const_iterator it = map->begin(); it != map->end() ; ++it) {
1358 list->append(cssValuePool().createValue(it->key, CSSPrimitiveValue::CSS_ STRING)); 1363 list->append(cssValuePool().createValue(it->key, CSSPrimitiveValue::CSS_ STRING));
1359 short number = propertyID == CSSPropertyCounterIncrement ? it->value.inc rementValue() : it->value.resetValue(); 1364 short number = propertyID == CSSPropertyCounterIncrement ? it->value.inc rementValue() : it->value.resetValue();
1360 list->append(cssValuePool().createValue((double)number, CSSPrimitiveValu e::CSS_NUMBER)); 1365 list->append(cssValuePool().createValue((double)number, CSSPrimitiveValu e::CSS_NUMBER));
1361 } 1366 }
1362 return list.release(); 1367 return list.release();
1363 } 1368 }
1364 1369
1370 static PassRefPtr<CSSValue> valueForNavigationDirection(const RenderStyle& style , CSSPropertyID propertyID)
fs 2014/04/14 12:32:01 The return type should now be PassRefPtrWillBeRawP
Krzysztof Olczyk 2014/04/17 13:48:40 Done.
1371 {
1372 StyleNavigationValue navValue;
1373
1374 if (StyleNavigationData* navigationData = style.navigation()) {
1375 switch (propertyID) {
1376 case CSSPropertyNavUp:
1377 navValue = navigationData->up();
1378 break;
1379 case CSSPropertyNavDown:
1380 navValue = navigationData->down();
1381 break;
1382 case CSSPropertyNavLeft:
1383 navValue = navigationData->left();
1384 break;
1385 case CSSPropertyNavRight:
1386 navValue = navigationData->right();
1387 break;
1388 default:
1389 ASSERT_NOT_REACHED();
1390 break;
1391 }
1392 }
1393 RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
fs 2014/04/14 12:32:01 ...WillBeRawPtr (like above.)
Krzysztof Olczyk 2014/04/17 13:48:40 Done.
1394 list->append(cssValuePool().createValue(navValue.id(), CSSPrimitiveValue::CS S_STRING));
fs 2014/04/14 12:32:01 Spec says: "Computed value: as specified", so I'd
Krzysztof Olczyk 2014/04/17 13:48:40 Done.
1395 list->append(cssValuePool().createValue(navValue.target(), CSSPrimitiveValue ::CSS_STRING));
1396
1397 return list.release();
1398 }
1399
1365 static void logUnimplementedPropertyID(CSSPropertyID propertyID) 1400 static void logUnimplementedPropertyID(CSSPropertyID propertyID)
1366 { 1401 {
1367 DEFINE_STATIC_LOCAL(HashSet<CSSPropertyID>, propertyIDSet, ()); 1402 DEFINE_STATIC_LOCAL(HashSet<CSSPropertyID>, propertyIDSet, ());
1368 if (!propertyIDSet.add(propertyID).isNewEntry) 1403 if (!propertyIDSet.add(propertyID).isNewEntry)
1369 return; 1404 return;
1370 1405
1371 WTF_LOG_ERROR("WebKit does not yet implement getComputedStyle for '%s'.", ge tPropertyName(propertyID)); 1406 WTF_LOG_ERROR("WebKit does not yet implement getComputedStyle for '%s'.", ge tPropertyName(propertyID));
1372 } 1407 }
1373 1408
1374 static PassRefPtrWillBeRawPtr<CSSValueList> valueForFontFamily(RenderStyle& styl e) 1409 static PassRefPtrWillBeRawPtr<CSSValueList> valueForFontFamily(RenderStyle& styl e)
(...skipping 694 matching lines...) Expand 10 before | Expand all | Expand 10 after
2069 if (marginBottom.isFixed() || !renderer || !renderer->isBox()) 2104 if (marginBottom.isFixed() || !renderer || !renderer->isBox())
2070 return zoomAdjustedPixelValueForLength(marginBottom, *style); 2105 return zoomAdjustedPixelValueForLength(marginBottom, *style);
2071 return zoomAdjustedPixelValue(toRenderBox(renderer)->marginBottom(), *style); 2106 return zoomAdjustedPixelValue(toRenderBox(renderer)->marginBottom(), *style);
2072 } 2107 }
2073 case CSSPropertyMarginLeft: { 2108 case CSSPropertyMarginLeft: {
2074 Length marginLeft = style->marginLeft(); 2109 Length marginLeft = style->marginLeft();
2075 if (marginLeft.isFixed() || !renderer || !renderer->isBox()) 2110 if (marginLeft.isFixed() || !renderer || !renderer->isBox())
2076 return zoomAdjustedPixelValueForLength(marginLeft, *style); 2111 return zoomAdjustedPixelValueForLength(marginLeft, *style);
2077 return zoomAdjustedPixelValue(toRenderBox(renderer)->marginLeft(), * style); 2112 return zoomAdjustedPixelValue(toRenderBox(renderer)->marginLeft(), * style);
2078 } 2113 }
2114 case CSSPropertyNavDown:
2115 case CSSPropertyNavLeft:
2116 case CSSPropertyNavRight:
2117 case CSSPropertyNavUp:
2118 return valueForNavigationDirection(*style, propertyID);
2079 case CSSPropertyWebkitUserModify: 2119 case CSSPropertyWebkitUserModify:
2080 return cssValuePool().createValue(style->userModify()); 2120 return cssValuePool().createValue(style->userModify());
2081 case CSSPropertyMaxHeight: { 2121 case CSSPropertyMaxHeight: {
2082 const Length& maxHeight = style->maxHeight(); 2122 const Length& maxHeight = style->maxHeight();
2083 if (maxHeight.isUndefined()) 2123 if (maxHeight.isUndefined())
2084 return cssValuePool().createIdentifierValue(CSSValueNone); 2124 return cssValuePool().createIdentifierValue(CSSValueNone);
2085 return zoomAdjustedPixelValueForLength(maxHeight, *style); 2125 return zoomAdjustedPixelValueForLength(maxHeight, *style);
2086 } 2126 }
2087 case CSSPropertyMaxWidth: { 2127 case CSSPropertyMaxWidth: {
2088 const Length& maxWidth = style->maxWidth(); 2128 const Length& maxWidth = style->maxWidth();
(...skipping 958 matching lines...) Expand 10 before | Expand all | Expand 10 after
3047 static const CSSPropertyID propertiesAfterSlashSeperator[3] = { CSSPropertyB ackgroundSize, CSSPropertyBackgroundOrigin, 3087 static const CSSPropertyID propertiesAfterSlashSeperator[3] = { CSSPropertyB ackgroundSize, CSSPropertyBackgroundOrigin,
3048 CSSPropertyB ackgroundClip }; 3088 CSSPropertyB ackgroundClip };
3049 3089
3050 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSlashSeparated() ; 3090 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSlashSeparated() ;
3051 list->append(valuesForShorthandProperty(StylePropertyShorthand(CSSPropertyBa ckground, propertiesBeforeSlashSeperator, WTF_ARRAY_LENGTH(propertiesBeforeSlash Seperator)))); 3091 list->append(valuesForShorthandProperty(StylePropertyShorthand(CSSPropertyBa ckground, propertiesBeforeSlashSeperator, WTF_ARRAY_LENGTH(propertiesBeforeSlash Seperator))));
3052 list->append(valuesForShorthandProperty(StylePropertyShorthand(CSSPropertyBa ckground, propertiesAfterSlashSeperator, WTF_ARRAY_LENGTH(propertiesAfterSlashSe perator)))); 3092 list->append(valuesForShorthandProperty(StylePropertyShorthand(CSSPropertyBa ckground, propertiesAfterSlashSeperator, WTF_ARRAY_LENGTH(propertiesAfterSlashSe perator))));
3053 return list.release(); 3093 return list.release();
3054 } 3094 }
3055 3095
3056 } // namespace WebCore 3096 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698