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

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: Added tests Created 7 years, 4 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.
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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 CSSPropertyListStylePosition, 140 CSSPropertyListStylePosition,
140 CSSPropertyListStyleType, 141 CSSPropertyListStyleType,
141 CSSPropertyMarginBottom, 142 CSSPropertyMarginBottom,
142 CSSPropertyMarginLeft, 143 CSSPropertyMarginLeft,
143 CSSPropertyMarginRight, 144 CSSPropertyMarginRight,
144 CSSPropertyMarginTop, 145 CSSPropertyMarginTop,
145 CSSPropertyMaxHeight, 146 CSSPropertyMaxHeight,
146 CSSPropertyMaxWidth, 147 CSSPropertyMaxWidth,
147 CSSPropertyMinHeight, 148 CSSPropertyMinHeight,
148 CSSPropertyMinWidth, 149 CSSPropertyMinWidth,
150 CSSPropertyNavDown,
151 CSSPropertyNavLeft,
152 CSSPropertyNavRight,
153 CSSPropertyNavUp,
149 CSSPropertyMixBlendMode, 154 CSSPropertyMixBlendMode,
150 CSSPropertyOpacity, 155 CSSPropertyOpacity,
151 CSSPropertyOrphans, 156 CSSPropertyOrphans,
152 CSSPropertyOutlineColor, 157 CSSPropertyOutlineColor,
153 CSSPropertyOutlineOffset, 158 CSSPropertyOutlineOffset,
154 CSSPropertyOutlineStyle, 159 CSSPropertyOutlineStyle,
155 CSSPropertyOutlineWidth, 160 CSSPropertyOutlineWidth,
156 CSSPropertyOverflowWrap, 161 CSSPropertyOverflowWrap,
157 CSSPropertyOverflowX, 162 CSSPropertyOverflowX,
158 CSSPropertyOverflowY, 163 CSSPropertyOverflowY,
(...skipping 1255 matching lines...) Expand 10 before | Expand all | Expand 10 after
1414 1419
1415 RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); 1420 RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
1416 for (CounterDirectiveMap::const_iterator it = map->begin(); it != map->end() ; ++it) { 1421 for (CounterDirectiveMap::const_iterator it = map->begin(); it != map->end() ; ++it) {
1417 list->append(cssValuePool().createValue(it->key, CSSPrimitiveValue::CSS_ STRING)); 1422 list->append(cssValuePool().createValue(it->key, CSSPrimitiveValue::CSS_ STRING));
1418 short number = propertyID == CSSPropertyCounterIncrement ? it->value.inc rementValue() : it->value.resetValue(); 1423 short number = propertyID == CSSPropertyCounterIncrement ? it->value.inc rementValue() : it->value.resetValue();
1419 list->append(cssValuePool().createValue((double)number, CSSPrimitiveValu e::CSS_NUMBER)); 1424 list->append(cssValuePool().createValue((double)number, CSSPrimitiveValu e::CSS_NUMBER));
1420 } 1425 }
1421 return list.release(); 1426 return list.release();
1422 } 1427 }
1423 1428
1429 static PassRefPtr<CSSValue> navDirectionToCSSValue(const StyleNavigationValue& n avValue)
1430 {
1431 RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
1432 list->append(cssValuePool().createValue(navValue.id().string(), CSSPrimitive Value::CSS_STRING));
1433 list->append(cssValuePool().createValue(navValue.target().string(), CSSPrimi tiveValue::CSS_STRING));
1434
1435 return list.release();
1436 }
1437
1424 static void logUnimplementedPropertyID(CSSPropertyID propertyID) 1438 static void logUnimplementedPropertyID(CSSPropertyID propertyID)
1425 { 1439 {
1426 DEFINE_STATIC_LOCAL(HashSet<CSSPropertyID>, propertyIDSet, ()); 1440 DEFINE_STATIC_LOCAL(HashSet<CSSPropertyID>, propertyIDSet, ());
1427 if (!propertyIDSet.add(propertyID).isNewEntry) 1441 if (!propertyIDSet.add(propertyID).isNewEntry)
1428 return; 1442 return;
1429 1443
1430 LOG_ERROR("WebKit does not yet implement getComputedStyle for '%s'.", getPro pertyName(propertyID)); 1444 LOG_ERROR("WebKit does not yet implement getComputedStyle for '%s'.", getPro pertyName(propertyID));
1431 } 1445 }
1432 1446
1433 static PassRefPtr<CSSValueList> fontFamilyFromStyle(RenderStyle* style) 1447 static PassRefPtr<CSSValueList> fontFamilyFromStyle(RenderStyle* style)
(...skipping 623 matching lines...) Expand 10 before | Expand all | Expand 10 after
2057 if (marginBottom.isFixed() || !renderer || !renderer->isBox()) 2071 if (marginBottom.isFixed() || !renderer || !renderer->isBox())
2058 return zoomAdjustedPixelValueForLength(marginBottom, style.get() ); 2072 return zoomAdjustedPixelValueForLength(marginBottom, style.get() );
2059 return zoomAdjustedPixelValue(toRenderBox(renderer)->marginBottom(), style.get()); 2073 return zoomAdjustedPixelValue(toRenderBox(renderer)->marginBottom(), style.get());
2060 } 2074 }
2061 case CSSPropertyMarginLeft: { 2075 case CSSPropertyMarginLeft: {
2062 Length marginLeft = style->marginLeft(); 2076 Length marginLeft = style->marginLeft();
2063 if (marginLeft.isFixed() || !renderer || !renderer->isBox()) 2077 if (marginLeft.isFixed() || !renderer || !renderer->isBox())
2064 return zoomAdjustedPixelValueForLength(marginLeft, style.get()); 2078 return zoomAdjustedPixelValueForLength(marginLeft, style.get());
2065 return zoomAdjustedPixelValue(toRenderBox(renderer)->marginLeft(), s tyle.get()); 2079 return zoomAdjustedPixelValue(toRenderBox(renderer)->marginLeft(), s tyle.get());
2066 } 2080 }
2081 case CSSPropertyNavDown:
2082 return navDirectionToCSSValue(style->navDown());
2083 case CSSPropertyNavLeft:
2084 return navDirectionToCSSValue(style->navLeft());
2085 case CSSPropertyNavRight:
2086 return navDirectionToCSSValue(style->navRight());
2087 case CSSPropertyNavUp:
2088 return navDirectionToCSSValue(style->navUp());
2067 case CSSPropertyWebkitMarqueeDirection: 2089 case CSSPropertyWebkitMarqueeDirection:
2068 return cssValuePool().createValue(style->marqueeDirection()); 2090 return cssValuePool().createValue(style->marqueeDirection());
2069 case CSSPropertyWebkitMarqueeIncrement: 2091 case CSSPropertyWebkitMarqueeIncrement:
2070 return cssValuePool().createValue(style->marqueeIncrement()); 2092 return cssValuePool().createValue(style->marqueeIncrement());
2071 case CSSPropertyWebkitMarqueeRepetition: 2093 case CSSPropertyWebkitMarqueeRepetition:
2072 if (style->marqueeLoopCount() < 0) 2094 if (style->marqueeLoopCount() < 0)
2073 return cssValuePool().createIdentifierValue(CSSValueInfinite); 2095 return cssValuePool().createIdentifierValue(CSSValueInfinite);
2074 return cssValuePool().createValue(style->marqueeLoopCount(), CSSPrim itiveValue::CSS_NUMBER); 2096 return cssValuePool().createValue(style->marqueeLoopCount(), CSSPrim itiveValue::CSS_NUMBER);
2075 case CSSPropertyWebkitMarqueeStyle: 2097 case CSSPropertyWebkitMarqueeStyle:
2076 return cssValuePool().createValue(style->marqueeBehavior()); 2098 return cssValuePool().createValue(style->marqueeBehavior());
(...skipping 991 matching lines...) Expand 10 before | Expand all | Expand 10 after
3068 static const CSSPropertyID propertiesAfterSlashSeperator[3] = { CSSPropertyB ackgroundSize, CSSPropertyBackgroundOrigin, 3090 static const CSSPropertyID propertiesAfterSlashSeperator[3] = { CSSPropertyB ackgroundSize, CSSPropertyBackgroundOrigin,
3069 CSSPropertyB ackgroundClip }; 3091 CSSPropertyB ackgroundClip };
3070 3092
3071 RefPtr<CSSValueList> list = CSSValueList::createSlashSeparated(); 3093 RefPtr<CSSValueList> list = CSSValueList::createSlashSeparated();
3072 list->append(getCSSPropertyValuesForShorthandProperties(StylePropertyShortha nd(CSSPropertyBackground, propertiesBeforeSlashSeperator, WTF_ARRAY_LENGTH(prope rtiesBeforeSlashSeperator)))); 3094 list->append(getCSSPropertyValuesForShorthandProperties(StylePropertyShortha nd(CSSPropertyBackground, propertiesBeforeSlashSeperator, WTF_ARRAY_LENGTH(prope rtiesBeforeSlashSeperator))));
3073 list->append(getCSSPropertyValuesForShorthandProperties(StylePropertyShortha nd(CSSPropertyBackground, propertiesAfterSlashSeperator, WTF_ARRAY_LENGTH(proper tiesAfterSlashSeperator)))); 3095 list->append(getCSSPropertyValuesForShorthandProperties(StylePropertyShortha nd(CSSPropertyBackground, propertiesAfterSlashSeperator, WTF_ARRAY_LENGTH(proper tiesAfterSlashSeperator))));
3074 return list.release(); 3096 return list.release();
3075 } 3097 }
3076 3098
3077 } // namespace WebCore 3099 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698