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

Side by Side Diff: Source/core/css/resolver/StyleResolver.cpp

Issue 14715014: Add parsing for named grid lines (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Patch for landing (fixed Elliott's comments) Created 7 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/css/CSSParser.cpp ('k') | Source/core/rendering/RenderGrid.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com) 3 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com)
4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com) 4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com)
5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved. 5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved.
6 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> 6 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org>
7 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> 7 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org>
8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
9 * Copyright (c) 2011, Code Aurora Forum. All rights reserved. 9 * Copyright (c) 2011, Code Aurora Forum. All rights reserved.
10 * Copyright (C) Research In Motion Limited 2011. All rights reserved. 10 * Copyright (C) Research In Motion Limited 2011. All rights reserved.
(...skipping 2306 matching lines...) Expand 10 before | Expand all | Expand 10 after
2317 2317
2318 if (trackSizes.isEmpty()) 2318 if (trackSizes.isEmpty())
2319 return false; 2319 return false;
2320 2320
2321 return true; 2321 return true;
2322 } 2322 }
2323 2323
2324 2324
2325 static bool createGridPosition(CSSValue* value, GridPosition& position) 2325 static bool createGridPosition(CSSValue* value, GridPosition& position)
2326 { 2326 {
2327 // For now, we only accept: 'auto' | <integer> | span && <integer>? 2327 // For now, we only accept: 'auto' | [ <integer> || <string> ] | span && <in teger>?
2328
2328 if (value->isPrimitiveValue()) { 2329 if (value->isPrimitiveValue()) {
2329 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); 2330 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
2330 if (primitiveValue->getIdent() == CSSValueAuto) 2331 ASSERT(primitiveValue->getIdent() == CSSValueAuto);
2331 return true;
2332
2333 if (primitiveValue->getIdent() == CSSValueSpan) {
2334 // If the <integer> is omitted, it defaults to '1'.
2335 position.setSpanPosition(1);
2336 return true;
2337 }
2338
2339 ASSERT(primitiveValue->isNumber());
2340 position.setIntegerPosition(primitiveValue->getIntValue());
2341 return true; 2332 return true;
2342 } 2333 }
2343 2334
2344 CSSValueList* values = toCSSValueList(value); 2335 CSSValueList* values = toCSSValueList(value);
2345 ASSERT(values->length() == 2); 2336 ASSERT(values->length());
2346 CSSPrimitiveValue* numericValue = toCSSPrimitiveValue(values->itemWithoutBou ndsCheck(1)); 2337
2347 ASSERT(numericValue->isNumber()); 2338 bool isSpanPosition = false;
2348 position.setSpanPosition(numericValue->getIntValue()); 2339 // The specification makes the <integer> optional, in which case it default to '1'.
2340 int gridLineNumber = 1;
2341 String gridLineName;
2342
2343 CSSValueListIterator it = values;
2344 CSSPrimitiveValue* currentValue = toCSSPrimitiveValue(it.value());
2345 if (currentValue->getIdent() == CSSValueSpan) {
2346 isSpanPosition = true;
2347 it.advance();
2348 currentValue = it.hasMore() ? toCSSPrimitiveValue(it.value()) : 0;
2349 }
2350
2351 if (currentValue && currentValue->isNumber()) {
2352 gridLineNumber = currentValue->getIntValue();
2353 it.advance();
2354 currentValue = it.hasMore() ? toCSSPrimitiveValue(it.value()) : 0;
2355 }
2356
2357 if (currentValue && currentValue->isString()) {
2358 gridLineName = currentValue->getStringValue();
2359 it.advance();
2360 }
2361
2362 ASSERT(!it.hasMore());
2363 if (isSpanPosition) {
2364 // FIXME: Implement named line with 'span'.
2365 ASSERT(gridLineName.isNull());
2366 position.setSpanPosition(gridLineNumber);
2367 } else
2368 position.setExplicitPosition(gridLineNumber, gridLineName);
2369
2349 return true; 2370 return true;
2350 } 2371 }
2351 2372
2352 static bool hasVariableReference(CSSValue* value) 2373 static bool hasVariableReference(CSSValue* value)
2353 { 2374 {
2354 if (value->isPrimitiveValue()) { 2375 if (value->isPrimitiveValue()) {
2355 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); 2376 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
2356 return primitiveValue->hasVariableReference(); 2377 return primitiveValue->hasVariableReference();
2357 } 2378 }
2358 2379
(...skipping 1475 matching lines...) Expand 10 before | Expand all | Expand 10 after
3834 info.addMember(m_state, "state"); 3855 info.addMember(m_state, "state");
3835 3856
3836 // FIXME: move this to a place where it would be called only once? 3857 // FIXME: move this to a place where it would be called only once?
3837 info.addMember(CSSDefaultStyleSheets::defaultStyle, "defaultStyle"); 3858 info.addMember(CSSDefaultStyleSheets::defaultStyle, "defaultStyle");
3838 info.addMember(CSSDefaultStyleSheets::defaultQuirksStyle, "defaultQuirksStyl e"); 3859 info.addMember(CSSDefaultStyleSheets::defaultQuirksStyle, "defaultQuirksStyl e");
3839 info.addMember(CSSDefaultStyleSheets::defaultPrintStyle, "defaultPrintStyle" ); 3860 info.addMember(CSSDefaultStyleSheets::defaultPrintStyle, "defaultPrintStyle" );
3840 info.addMember(CSSDefaultStyleSheets::defaultViewSourceStyle, "defaultViewSo urceStyle"); 3861 info.addMember(CSSDefaultStyleSheets::defaultViewSourceStyle, "defaultViewSo urceStyle");
3841 } 3862 }
3842 3863
3843 } // namespace WebCore 3864 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/css/CSSParser.cpp ('k') | Source/core/rendering/RenderGrid.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698