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

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

Issue 1459373002: [css-grid] Refactor GridSpan to avoid pointers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Patch for landing Created 5 years 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) 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 2959 matching lines...) Expand 10 before | Expand all | Expand 10 after
2970 2970
2971 // We handle several grid areas with the same name at once to simplify t he validation code. 2971 // We handle several grid areas with the same name at once to simplify t he validation code.
2972 size_t lookAheadCol; 2972 size_t lookAheadCol;
2973 for (lookAheadCol = currentCol + 1; lookAheadCol < columnCount; ++lookAh eadCol) { 2973 for (lookAheadCol = currentCol + 1; lookAheadCol < columnCount; ++lookAh eadCol) {
2974 if (columnNames[lookAheadCol] != gridAreaName) 2974 if (columnNames[lookAheadCol] != gridAreaName)
2975 break; 2975 break;
2976 } 2976 }
2977 2977
2978 NamedGridAreaMap::iterator gridAreaIt = gridAreaMap.find(gridAreaName); 2978 NamedGridAreaMap::iterator gridAreaIt = gridAreaMap.find(gridAreaName);
2979 if (gridAreaIt == gridAreaMap.end()) { 2979 if (gridAreaIt == gridAreaMap.end()) {
2980 gridAreaMap.add(gridAreaName, GridCoordinate(GridSpan(rowCount, rowC ount + 1), GridSpan(currentCol, lookAheadCol))); 2980 gridAreaMap.add(gridAreaName, GridCoordinate(GridSpan::definiteGridS pan(rowCount, rowCount + 1), GridSpan::definiteGridSpan(currentCol, lookAheadCol )));
2981 } else { 2981 } else {
2982 GridCoordinate& gridCoordinate = gridAreaIt->value; 2982 GridCoordinate& gridCoordinate = gridAreaIt->value;
2983 2983
2984 // The following checks test that the grid area is a single filled-i n rectangle. 2984 // The following checks test that the grid area is a single filled-i n rectangle.
2985 // 1. The new row is adjacent to the previously parsed row. 2985 // 1. The new row is adjacent to the previously parsed row.
2986 if (rowCount != gridCoordinate.rows.resolvedFinalPosition.toInt()) 2986 if (rowCount != gridCoordinate.rows.resolvedFinalPosition().toInt())
2987 return false; 2987 return false;
2988 2988
2989 // 2. The new area starts at the same position as the previously par sed area. 2989 // 2. The new area starts at the same position as the previously par sed area.
2990 if (currentCol != gridCoordinate.columns.resolvedInitialPosition.toI nt()) 2990 if (currentCol != gridCoordinate.columns.resolvedInitialPosition().t oInt())
2991 return false; 2991 return false;
2992 2992
2993 // 3. The new area ends at the same position as the previously parse d area. 2993 // 3. The new area ends at the same position as the previously parse d area.
2994 if (lookAheadCol != gridCoordinate.columns.resolvedFinalPosition.toI nt()) 2994 if (lookAheadCol != gridCoordinate.columns.resolvedFinalPosition().t oInt())
2995 return false; 2995 return false;
2996 2996
2997 ++gridCoordinate.rows.resolvedFinalPosition; 2997 gridCoordinate.rows = GridSpan::definiteGridSpan(gridCoordinate.rows .resolvedInitialPosition(), gridCoordinate.rows.resolvedFinalPosition().next());
2998 } 2998 }
2999 currentCol = lookAheadCol - 1; 2999 currentCol = lookAheadCol - 1;
3000 } 3000 }
3001 3001
3002 m_valueList->next(); 3002 m_valueList->next();
3003 return true; 3003 return true;
3004 } 3004 }
3005 3005
3006 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseGridTemplateAreas() 3006 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseGridTemplateAreas()
3007 { 3007 {
(...skipping 2566 matching lines...) Expand 10 before | Expand all | Expand 10 after
5574 value = m_valueList->current(); 5574 value = m_valueList->current();
5575 if (commaConsumed && !value) 5575 if (commaConsumed && !value)
5576 return nullptr; 5576 return nullptr;
5577 } 5577 }
5578 if (!validPrimitive) 5578 if (!validPrimitive)
5579 return nullptr; 5579 return nullptr;
5580 return ret.release(); 5580 return ret.release();
5581 } 5581 }
5582 5582
5583 } // namespace blink 5583 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698