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

Side by Side Diff: third_party/WebKit/Source/core/css/ComputedStyleCSSValueMapping.cpp

Issue 1919813002: Implementation of CSS3 nav-up/down/left/right properties from CSS3 UI Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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) 2015 Google Inc. All rights reserved. 7 * Copyright (C) 2015 Google Inc. All rights reserved.
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public 10 * modify it under the terms of the GNU Lesser General Public
(...skipping 1308 matching lines...) Expand 10 before | Expand all | Expand 10 after
1319 for (auto& coordinate : coordinates) { 1319 for (auto& coordinate : coordinates) {
1320 auto pair = CSSValueList::createSpaceSeparated(); 1320 auto pair = CSSValueList::createSpaceSeparated();
1321 pair->append(zoomAdjustedPixelValueForLength(coordinate.x(), style)); 1321 pair->append(zoomAdjustedPixelValueForLength(coordinate.x(), style));
1322 pair->append(zoomAdjustedPixelValueForLength(coordinate.y(), style)); 1322 pair->append(zoomAdjustedPixelValueForLength(coordinate.y(), style));
1323 list->append(pair); 1323 list->append(pair);
1324 } 1324 }
1325 1325
1326 return list.release(); 1326 return list.release();
1327 } 1327 }
1328 1328
1329 static RawPtr<CSSValue> valueForNavigationDirection(const ComputedStyle& style, CSSPropertyID propertyID)
fs 2016/05/18 15:55:04 RawPtr<T> is no more. Use T* here and in all other
1330 {
1331 StyleNavigationValue navValue;
1332
1333 switch (propertyID) {
1334 case CSSPropertyNavUp:
1335 navValue = style.navUp();
1336 break;
1337 case CSSPropertyNavDown:
1338 navValue = style.navDown();
1339 break;
1340 case CSSPropertyNavLeft:
1341 navValue = style.navLeft();
1342 break;
1343 case CSSPropertyNavRight:
1344 navValue = style.navRight();
1345 break;
1346 default:
1347 ASSERT_NOT_REACHED();
1348 break;
1349 }
1350
1351 if (navValue.isAuto())
1352 return cssValuePool().createIdentifierValue(CSSValueAuto);
1353
1354 String selectorText = "#";
1355 selectorText.append(navValue.id());
1356 RawPtr<CSSValue> idSel = CSSStringValue::create(selectorText);
fs 2016/05/18 15:55:04 This should be a hash (not a string) - doesn't loo
1357 RawPtr<CSSValue> target;
1358 if (navValue.navigationTarget() == TargetName)
1359 target = CSSStringValue::create(navValue.targetName());
1360 else if (navValue.navigationTarget() == Root)
1361 target = cssValuePool().createIdentifierValue(CSSValueRoot);
1362 else if (navValue.navigationTarget() == Current)
1363 target = cssValuePool().createIdentifierValue(CSSValueCurrent);
1364 else
1365 ASSERT_NOT_REACHED();
1366
1367 RawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
1368 list->append(idSel);
1369 list->append(target);
1370 return list.release();
1371 }
1372
1329 static EBreak mapToPageBreakValue(EBreak genericBreakValue) 1373 static EBreak mapToPageBreakValue(EBreak genericBreakValue)
1330 { 1374 {
1331 switch (genericBreakValue) { 1375 switch (genericBreakValue) {
1332 case BreakAvoidColumn: 1376 case BreakAvoidColumn:
1333 case BreakColumn: 1377 case BreakColumn:
1334 case BreakRecto: 1378 case BreakRecto:
1335 case BreakVerso: 1379 case BreakVerso:
1336 return BreakAuto; 1380 return BreakAuto;
1337 case BreakPage: 1381 case BreakPage:
1338 return BreakAlways; 1382 return BreakAlways;
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after
1830 if (marginBottom.isFixed() || !layoutObject || !layoutObject->isBox()) 1874 if (marginBottom.isFixed() || !layoutObject || !layoutObject->isBox())
1831 return zoomAdjustedPixelValueForLength(marginBottom, style); 1875 return zoomAdjustedPixelValueForLength(marginBottom, style);
1832 return zoomAdjustedPixelValue(toLayoutBox(layoutObject)->marginBottom(), style); 1876 return zoomAdjustedPixelValue(toLayoutBox(layoutObject)->marginBottom(), style);
1833 } 1877 }
1834 case CSSPropertyMarginLeft: { 1878 case CSSPropertyMarginLeft: {
1835 Length marginLeft = style.marginLeft(); 1879 Length marginLeft = style.marginLeft();
1836 if (marginLeft.isFixed() || !layoutObject || !layoutObject->isBox()) 1880 if (marginLeft.isFixed() || !layoutObject || !layoutObject->isBox())
1837 return zoomAdjustedPixelValueForLength(marginLeft, style); 1881 return zoomAdjustedPixelValueForLength(marginLeft, style);
1838 return zoomAdjustedPixelValue(toLayoutBox(layoutObject)->marginLeft(), s tyle); 1882 return zoomAdjustedPixelValue(toLayoutBox(layoutObject)->marginLeft(), s tyle);
1839 } 1883 }
1884 case CSSPropertyNavDown:
1885 case CSSPropertyNavLeft:
1886 case CSSPropertyNavRight:
1887 case CSSPropertyNavUp:
1888 return valueForNavigationDirection(style, propertyID);
1889
1840 case CSSPropertyWebkitUserModify: 1890 case CSSPropertyWebkitUserModify:
1841 return cssValuePool().createValue(style.userModify()); 1891 return cssValuePool().createValue(style.userModify());
1892
1842 case CSSPropertyMaxHeight: { 1893 case CSSPropertyMaxHeight: {
1843 const Length& maxHeight = style.maxHeight(); 1894 const Length& maxHeight = style.maxHeight();
1844 if (maxHeight.isMaxSizeNone()) 1895 if (maxHeight.isMaxSizeNone())
1845 return cssValuePool().createIdentifierValue(CSSValueNone); 1896 return cssValuePool().createIdentifierValue(CSSValueNone);
1846 return zoomAdjustedPixelValueForLength(maxHeight, style); 1897 return zoomAdjustedPixelValueForLength(maxHeight, style);
1847 } 1898 }
1848 case CSSPropertyMaxWidth: { 1899 case CSSPropertyMaxWidth: {
1849 const Length& maxWidth = style.maxWidth(); 1900 const Length& maxWidth = style.maxWidth();
1850 if (maxWidth.isMaxSizeNone()) 1901 if (maxWidth.isMaxSizeNone())
1851 return cssValuePool().createIdentifierValue(CSSValueNone); 1902 return cssValuePool().createIdentifierValue(CSSValueNone);
(...skipping 906 matching lines...) Expand 10 before | Expand all | Expand 10 after
2758 case CSSPropertyAll: 2809 case CSSPropertyAll:
2759 return nullptr; 2810 return nullptr;
2760 default: 2811 default:
2761 break; 2812 break;
2762 } 2813 }
2763 ASSERT_NOT_REACHED(); 2814 ASSERT_NOT_REACHED();
2764 return nullptr; 2815 return nullptr;
2765 } 2816 }
2766 2817
2767 } // namespace blink 2818 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698