Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2003 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 2003 Lars Knoll (knoll@kde.org) |
| 3 * Copyright (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) | 3 * Copyright (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) |
| 4 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved. | 4 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved. |
| 5 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> | 5 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> |
| 6 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> | 6 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> |
| 7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) | 7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) |
| 8 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved. | 8 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved. |
| 9 * Copyright (C) 2012 Intel Corporation. All rights reserved. | 9 * Copyright (C) 2012 Intel Corporation. All rights reserved. |
| 10 * | 10 * |
| (...skipping 3621 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3632 | 3632 |
| 3633 return cssValuePool().createValue(flexValue, CSSPrimitiveValue::CSS_FR); | 3633 return cssValuePool().createValue(flexValue, CSSPrimitiveValue::CSS_FR); |
| 3634 } | 3634 } |
| 3635 | 3635 |
| 3636 if (!validUnit(currentValue, FNonNeg | FLength | FPercent)) | 3636 if (!validUnit(currentValue, FNonNeg | FLength | FPercent)) |
| 3637 return nullptr; | 3637 return nullptr; |
| 3638 | 3638 |
| 3639 return createPrimitiveNumericValue(currentValue); | 3639 return createPrimitiveNumericValue(currentValue); |
| 3640 } | 3640 } |
| 3641 | 3641 |
| 3642 static bool containsOnlyDots(const String& string) | |
| 3643 { | |
| 3644 ASSERT(!string.isEmpty()); | |
| 3645 for (unsigned i = 0; i < string.length(); ++i) { | |
| 3646 if (string.characterAt(i) != '.') | |
| 3647 return false; | |
| 3648 } | |
| 3649 return true; | |
|
svillar
2015/06/05 10:38:09
I think it's better to do like LayoutText::contain
Manuel Rego
2015/06/05 11:20:10
Thanks for the pointer, I've followed a similar ap
| |
| 3650 } | |
| 3651 | |
| 3642 bool CSSPropertyParser::parseGridTemplateAreasRow(NamedGridAreaMap& gridAreaMap, const size_t rowCount, size_t& columnCount) | 3652 bool CSSPropertyParser::parseGridTemplateAreasRow(NamedGridAreaMap& gridAreaMap, const size_t rowCount, size_t& columnCount) |
| 3643 { | 3653 { |
| 3644 CSSParserValue* currentValue = m_valueList->current(); | 3654 CSSParserValue* currentValue = m_valueList->current(); |
| 3645 if (!currentValue || currentValue->unit != CSSPrimitiveValue::CSS_STRING) | 3655 if (!currentValue || currentValue->unit != CSSPrimitiveValue::CSS_STRING) |
| 3646 return false; | 3656 return false; |
| 3647 | 3657 |
| 3648 String gridRowNames = currentValue->string; | 3658 String gridRowNames = currentValue->string; |
| 3649 if (gridRowNames.isEmpty() || gridRowNames.containsOnlyWhitespace()) | 3659 if (gridRowNames.isEmpty() || gridRowNames.containsOnlyWhitespace()) |
| 3650 return false; | 3660 return false; |
| 3651 | 3661 |
| 3652 Vector<String> columnNames; | 3662 Vector<String> columnNames; |
| 3653 gridRowNames.split(' ', columnNames); | 3663 gridRowNames.split(' ', columnNames); |
| 3654 | 3664 |
| 3655 if (!columnCount) { | 3665 if (!columnCount) { |
| 3656 columnCount = columnNames.size(); | 3666 columnCount = columnNames.size(); |
| 3657 ASSERT(columnCount); | 3667 ASSERT(columnCount); |
| 3658 } else if (columnCount != columnNames.size()) { | 3668 } else if (columnCount != columnNames.size()) { |
| 3659 // The declaration is invalid is all the rows don't have the number of c olumns. | 3669 // The declaration is invalid is all the rows don't have the number of c olumns. |
| 3660 return false; | 3670 return false; |
| 3661 } | 3671 } |
| 3662 | 3672 |
| 3663 for (size_t currentCol = 0; currentCol < columnCount; ++currentCol) { | 3673 for (size_t currentCol = 0; currentCol < columnCount; ++currentCol) { |
| 3664 const String& gridAreaName = columnNames[currentCol]; | 3674 const String& gridAreaName = columnNames[currentCol]; |
| 3665 | 3675 |
| 3666 // Unamed areas are always valid (we consider them to be 1x1). | 3676 // Unamed areas are always valid (we consider them to be 1x1). |
| 3667 if (gridAreaName == ".") | 3677 if (containsOnlyDots(gridAreaName)) |
| 3668 continue; | 3678 continue; |
| 3669 | 3679 |
| 3670 // We handle several grid areas with the same name at once to simplify t he validation code. | 3680 // We handle several grid areas with the same name at once to simplify t he validation code. |
| 3671 size_t lookAheadCol; | 3681 size_t lookAheadCol; |
| 3672 for (lookAheadCol = currentCol; lookAheadCol < (columnCount - 1); ++look AheadCol) { | 3682 for (lookAheadCol = currentCol; lookAheadCol < (columnCount - 1); ++look AheadCol) { |
| 3673 if (columnNames[lookAheadCol + 1] != gridAreaName) | 3683 if (columnNames[lookAheadCol + 1] != gridAreaName) |
| 3674 break; | 3684 break; |
| 3675 } | 3685 } |
| 3676 | 3686 |
| 3677 NamedGridAreaMap::iterator gridAreaIt = gridAreaMap.find(gridAreaName); | 3687 NamedGridAreaMap::iterator gridAreaIt = gridAreaMap.find(gridAreaName); |
| (...skipping 4729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 8407 } | 8417 } |
| 8408 } | 8418 } |
| 8409 | 8419 |
| 8410 if (!list->length()) | 8420 if (!list->length()) |
| 8411 return nullptr; | 8421 return nullptr; |
| 8412 | 8422 |
| 8413 return list.release(); | 8423 return list.release(); |
| 8414 } | 8424 } |
| 8415 | 8425 |
| 8416 } // namespace blink | 8426 } // namespace blink |
| OLD | NEW |