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

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

Issue 1451883002: [css-grid] Store lines instead of tracks in GridResolvedPosition (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed review comments Created 5 years, 1 month 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 2948 matching lines...) Expand 10 before | Expand all | Expand 10 after
2959 2959
2960 for (size_t currentCol = 0; currentCol < columnCount; ++currentCol) { 2960 for (size_t currentCol = 0; currentCol < columnCount; ++currentCol) {
2961 const String& gridAreaName = columnNames[currentCol]; 2961 const String& gridAreaName = columnNames[currentCol];
2962 2962
2963 // Unamed areas are always valid (we consider them to be 1x1). 2963 // Unamed areas are always valid (we consider them to be 1x1).
2964 if (gridAreaName == ".") 2964 if (gridAreaName == ".")
2965 continue; 2965 continue;
2966 2966
2967 // We handle several grid areas with the same name at once to simplify t he validation code. 2967 // We handle several grid areas with the same name at once to simplify t he validation code.
2968 size_t lookAheadCol; 2968 size_t lookAheadCol;
2969 for (lookAheadCol = currentCol; lookAheadCol < (columnCount - 1); ++look AheadCol) { 2969 for (lookAheadCol = currentCol; lookAheadCol < (columnCount - 1); ++look AheadCol) {
Timothy Loh 2015/11/18 06:41:37 Would it make sense to re-index lookAheadCol (i.e.
Manuel Rego 2015/11/18 08:39:15 Yeah, nice suggestion.
2970 if (columnNames[lookAheadCol + 1] != gridAreaName) 2970 if (columnNames[lookAheadCol + 1] != gridAreaName)
2971 break; 2971 break;
2972 } 2972 }
2973 2973
2974 NamedGridAreaMap::iterator gridAreaIt = gridAreaMap.find(gridAreaName); 2974 NamedGridAreaMap::iterator gridAreaIt = gridAreaMap.find(gridAreaName);
2975 if (gridAreaIt == gridAreaMap.end()) { 2975 if (gridAreaIt == gridAreaMap.end()) {
2976 gridAreaMap.add(gridAreaName, GridCoordinate(GridSpan(rowCount, rowC ount), GridSpan(currentCol, lookAheadCol))); 2976 gridAreaMap.add(gridAreaName, GridCoordinate(GridSpan(rowCount, rowC ount + 1), GridSpan(currentCol, lookAheadCol + 1)));
2977 } else { 2977 } else {
2978 GridCoordinate& gridCoordinate = gridAreaIt->value; 2978 GridCoordinate& gridCoordinate = gridAreaIt->value;
2979 2979
2980 // The following checks test that the grid area is a single filled-i n rectangle. 2980 // The following checks test that the grid area is a single filled-i n rectangle.
2981 // 1. The new row is adjacent to the previously parsed row. 2981 // 1. The new row is adjacent to the previously parsed row.
2982 if (rowCount != gridCoordinate.rows.resolvedFinalPosition.next().toI nt()) 2982 if (rowCount != gridCoordinate.rows.resolvedFinalPosition.toInt())
2983 return false; 2983 return false;
2984 2984
2985 // 2. The new area starts at the same position as the previously par sed area. 2985 // 2. The new area starts at the same position as the previously par sed area.
2986 if (currentCol != gridCoordinate.columns.resolvedInitialPosition.toI nt()) 2986 if (currentCol != gridCoordinate.columns.resolvedInitialPosition.toI nt())
2987 return false; 2987 return false;
2988 2988
2989 // 3. The new area ends at the same position as the previously parse d area. 2989 // 3. The new area ends at the same position as the previously parse d area.
2990 if (lookAheadCol != gridCoordinate.columns.resolvedFinalPosition.toI nt()) 2990 if (lookAheadCol != gridCoordinate.columns.resolvedFinalPosition.pre v().toInt())
2991 return false; 2991 return false;
2992 2992
2993 ++gridCoordinate.rows.resolvedFinalPosition; 2993 ++gridCoordinate.rows.resolvedFinalPosition;
2994 } 2994 }
2995 currentCol = lookAheadCol; 2995 currentCol = lookAheadCol;
2996 } 2996 }
2997 2997
2998 m_valueList->next(); 2998 m_valueList->next();
2999 return true; 2999 return true;
3000 } 3000 }
(...skipping 2877 matching lines...) Expand 10 before | Expand all | Expand 10 after
5878 return nullptr; 5878 return nullptr;
5879 a = args->next(); 5879 a = args->next();
5880 5880
5881 argNumber++; 5881 argNumber++;
5882 } 5882 }
5883 5883
5884 return transformValue.release(); 5884 return transformValue.release();
5885 } 5885 }
5886 5886
5887 } // namespace blink 5887 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698