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

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: Fixed compilation error in mac and crash in linux/window that were reported by trybots. Created 6 years, 2 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.
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
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 1204 matching lines...) Expand 10 before | Expand all | Expand 10 after
1369 1374
1370 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated() ; 1375 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated() ;
1371 for (CounterDirectiveMap::const_iterator it = map->begin(); it != map->end() ; ++it) { 1376 for (CounterDirectiveMap::const_iterator it = map->begin(); it != map->end() ; ++it) {
1372 list->append(cssValuePool().createValue(it->key, CSSPrimitiveValue::CSS_ STRING)); 1377 list->append(cssValuePool().createValue(it->key, CSSPrimitiveValue::CSS_ STRING));
1373 short number = propertyID == CSSPropertyCounterIncrement ? it->value.inc rementValue() : it->value.resetValue(); 1378 short number = propertyID == CSSPropertyCounterIncrement ? it->value.inc rementValue() : it->value.resetValue();
1374 list->append(cssValuePool().createValue((double)number, CSSPrimitiveValu e::CSS_NUMBER)); 1379 list->append(cssValuePool().createValue((double)number, CSSPrimitiveValu e::CSS_NUMBER));
1375 } 1380 }
1376 return list.release(); 1381 return list.release();
1377 } 1382 }
1378 1383
1384 static PassRefPtrWillBeRawPtr<CSSValue> valueForNavigationDirection(const Render Style& style, CSSPropertyID propertyID)
1385 {
1386 StyleNavigationValue navValue;
1387
1388 switch (propertyID) {
1389 case CSSPropertyNavUp:
1390 navValue = style.navUp();
1391 break;
1392 case CSSPropertyNavDown:
1393 navValue = style.navDown();
1394 break;
1395 case CSSPropertyNavLeft:
1396 navValue = style.navLeft();
1397 break;
1398 case CSSPropertyNavRight:
1399 navValue = style.navRight();
1400 break;
1401 default:
1402 ASSERT_NOT_REACHED();
1403 break;
1404 }
1405
1406 if (navValue.isAuto())
1407 return cssValuePool().createIdentifierValue(CSSValueAuto);
1408
1409 String selectorText = "#";
1410 selectorText.append(navValue.id());
1411 RefPtrWillBeRawPtr<CSSPrimitiveValue> idSel = cssValuePool().createValue(sel ectorText, CSSPrimitiveValue::CSS_STRING);
1412 RefPtrWillBeRawPtr<CSSPrimitiveValue> target;
1413 if (navValue.navigationTarget() == TargetName)
1414 target = cssValuePool().createValue(navValue.targetName(), CSSPrimitiveV alue::CSS_STRING);
1415 else if (navValue.navigationTarget() == Root)
1416 target = cssValuePool().createValue(CSSValueRoot);
1417 else if (navValue.navigationTarget() == Current)
1418 target = cssValuePool().createValue(CSSValueCurrent);
1419 else
1420 ASSERT_NOT_REACHED();
1421
1422 RefPtrWillBeRawPtr<CSSValueList> value = CSSValueList::createSpaceSeparated( );
1423 value->append(idSel);
1424 value->append(target);
1425 return value;
1426 }
1427
1379 static void logUnimplementedPropertyID(CSSPropertyID propertyID) 1428 static void logUnimplementedPropertyID(CSSPropertyID propertyID)
1380 { 1429 {
1381 DEFINE_STATIC_LOCAL(HashSet<CSSPropertyID>, propertyIDSet, ()); 1430 DEFINE_STATIC_LOCAL(HashSet<CSSPropertyID>, propertyIDSet, ());
1382 if (!propertyIDSet.add(propertyID).isNewEntry) 1431 if (!propertyIDSet.add(propertyID).isNewEntry)
1383 return; 1432 return;
1384 1433
1385 WTF_LOG_ERROR("WebKit does not yet implement getComputedStyle for '%s'.", ge tPropertyName(propertyID)); 1434 WTF_LOG_ERROR("WebKit does not yet implement getComputedStyle for '%s'.", ge tPropertyName(propertyID));
1386 } 1435 }
1387 1436
1388 static PassRefPtrWillBeRawPtr<CSSValueList> valueForFontFamily(RenderStyle& styl e) 1437 static PassRefPtrWillBeRawPtr<CSSValueList> valueForFontFamily(RenderStyle& styl e)
(...skipping 663 matching lines...) Expand 10 before | Expand all | Expand 10 after
2052 if (marginBottom.isFixed() || !renderer || !renderer->isBox()) 2101 if (marginBottom.isFixed() || !renderer || !renderer->isBox())
2053 return zoomAdjustedPixelValueForLength(marginBottom, *style); 2102 return zoomAdjustedPixelValueForLength(marginBottom, *style);
2054 return zoomAdjustedPixelValue(toRenderBox(renderer)->marginBottom(), *style); 2103 return zoomAdjustedPixelValue(toRenderBox(renderer)->marginBottom(), *style);
2055 } 2104 }
2056 case CSSPropertyMarginLeft: { 2105 case CSSPropertyMarginLeft: {
2057 Length marginLeft = style->marginLeft(); 2106 Length marginLeft = style->marginLeft();
2058 if (marginLeft.isFixed() || !renderer || !renderer->isBox()) 2107 if (marginLeft.isFixed() || !renderer || !renderer->isBox())
2059 return zoomAdjustedPixelValueForLength(marginLeft, *style); 2108 return zoomAdjustedPixelValueForLength(marginLeft, *style);
2060 return zoomAdjustedPixelValue(toRenderBox(renderer)->marginLeft(), * style); 2109 return zoomAdjustedPixelValue(toRenderBox(renderer)->marginLeft(), * style);
2061 } 2110 }
2111 case CSSPropertyNavDown:
2112 case CSSPropertyNavLeft:
2113 case CSSPropertyNavRight:
2114 case CSSPropertyNavUp:
2115 return valueForNavigationDirection(*style, propertyID);
2062 case CSSPropertyWebkitUserModify: 2116 case CSSPropertyWebkitUserModify:
2063 return cssValuePool().createValue(style->userModify()); 2117 return cssValuePool().createValue(style->userModify());
2064 case CSSPropertyMaxHeight: { 2118 case CSSPropertyMaxHeight: {
2065 const Length& maxHeight = style->maxHeight(); 2119 const Length& maxHeight = style->maxHeight();
2066 if (maxHeight.isMaxSizeNone()) 2120 if (maxHeight.isMaxSizeNone())
2067 return cssValuePool().createIdentifierValue(CSSValueNone); 2121 return cssValuePool().createIdentifierValue(CSSValueNone);
2068 return zoomAdjustedPixelValueForLength(maxHeight, *style); 2122 return zoomAdjustedPixelValueForLength(maxHeight, *style);
2069 } 2123 }
2070 case CSSPropertyMaxWidth: { 2124 case CSSPropertyMaxWidth: {
2071 const Length& maxWidth = style->maxWidth(); 2125 const Length& maxWidth = style->maxWidth();
(...skipping 931 matching lines...) Expand 10 before | Expand all | Expand 10 after
3003 return list.release(); 3057 return list.release();
3004 } 3058 }
3005 3059
3006 void CSSComputedStyleDeclaration::trace(Visitor* visitor) 3060 void CSSComputedStyleDeclaration::trace(Visitor* visitor)
3007 { 3061 {
3008 visitor->trace(m_node); 3062 visitor->trace(m_node);
3009 CSSStyleDeclaration::trace(visitor); 3063 CSSStyleDeclaration::trace(visitor);
3010 } 3064 }
3011 3065
3012 } // namespace blink 3066 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698