Commit 4a68f1fc authored by Bugs Nash's avatar Bugs Nash Committed by Commit Bot

Deleted duplicate methods accidentally introduced in 578538

This patch deleted the duplicated methods accudentally introdued in
https://chromium-review.googlesource.com/c/578538/ when they were
supposed to be moved from CSSPropertyParser.cpp to
CSSPropertyGridTemplateAreasUtils.cpp but instead they were copied.

Bug: 668012
Change-Id: I3c7b32911fcc8ff64a200f1bdfb06cd17d15fd0a
Reviewed-on: https://chromium-review.googlesource.com/593371Reviewed-by: default avatarmeade_UTC10 <meade@chromium.org>
Commit-Queue: Bugs Nash <bugsnash@chromium.org>
Cr-Commit-Position: refs/heads/master@{#490716}
parent 205212fa
...@@ -39,6 +39,7 @@ ...@@ -39,6 +39,7 @@
#include "core/css/properties/CSSPropertyBorderImageUtils.h" #include "core/css/properties/CSSPropertyBorderImageUtils.h"
#include "core/css/properties/CSSPropertyDescriptor.h" #include "core/css/properties/CSSPropertyDescriptor.h"
#include "core/css/properties/CSSPropertyFontUtils.h" #include "core/css/properties/CSSPropertyFontUtils.h"
#include "core/css/properties/CSSPropertyGridTemplateAreasUtils.h"
#include "core/css/properties/CSSPropertyGridUtils.h" #include "core/css/properties/CSSPropertyGridUtils.h"
#include "core/css/properties/CSSPropertyLengthUtils.h" #include "core/css/properties/CSSPropertyLengthUtils.h"
#include "core/css/properties/CSSPropertyMarginUtils.h" #include "core/css/properties/CSSPropertyMarginUtils.h"
...@@ -446,116 +447,6 @@ static bool IsGridTrackFixedSized(const CSSValue& value) { ...@@ -446,116 +447,6 @@ static bool IsGridTrackFixedSized(const CSSValue& value) {
IsGridBreadthFixedSized(max_value); IsGridBreadthFixedSized(max_value);
} }
static Vector<String> ParseGridTemplateAreasColumnNames(
const String& grid_row_names) {
DCHECK(!grid_row_names.IsEmpty());
Vector<String> column_names;
// Using StringImpl to avoid checks and indirection in every call to
// String::operator[].
StringImpl& text = *grid_row_names.Impl();
StringBuilder area_name;
for (unsigned i = 0; i < text.length(); ++i) {
if (IsCSSSpace(text[i])) {
if (!area_name.IsEmpty()) {
column_names.push_back(area_name.ToString());
area_name.Clear();
}
continue;
}
if (text[i] == '.') {
if (area_name == ".")
continue;
if (!area_name.IsEmpty()) {
column_names.push_back(area_name.ToString());
area_name.Clear();
}
} else {
if (!IsNameCodePoint(text[i]))
return Vector<String>();
if (area_name == ".") {
column_names.push_back(area_name.ToString());
area_name.Clear();
}
}
area_name.Append(text[i]);
}
if (!area_name.IsEmpty())
column_names.push_back(area_name.ToString());
return column_names;
}
static bool ParseGridTemplateAreasRow(const String& grid_row_names,
NamedGridAreaMap& grid_area_map,
const size_t row_count,
size_t& column_count) {
if (grid_row_names.IsEmpty() || grid_row_names.ContainsOnlyWhitespace())
return false;
Vector<String> column_names =
ParseGridTemplateAreasColumnNames(grid_row_names);
if (row_count == 0) {
column_count = column_names.size();
if (column_count == 0)
return false;
} else if (column_count != column_names.size()) {
// The declaration is invalid if all the rows don't have the number of
// columns.
return false;
}
for (size_t current_column = 0; current_column < column_count;
++current_column) {
const String& grid_area_name = column_names[current_column];
// Unamed areas are always valid (we consider them to be 1x1).
if (grid_area_name == ".")
continue;
size_t look_ahead_column = current_column + 1;
while (look_ahead_column < column_count &&
column_names[look_ahead_column] == grid_area_name)
look_ahead_column++;
NamedGridAreaMap::iterator grid_area_it =
grid_area_map.find(grid_area_name);
if (grid_area_it == grid_area_map.end()) {
grid_area_map.insert(grid_area_name,
GridArea(GridSpan::TranslatedDefiniteGridSpan(
row_count, row_count + 1),
GridSpan::TranslatedDefiniteGridSpan(
current_column, look_ahead_column)));
} else {
GridArea& grid_area = grid_area_it->value;
// The following checks test that the grid area is a single filled-in
// rectangle.
// 1. The new row is adjacent to the previously parsed row.
if (row_count != grid_area.rows.EndLine())
return false;
// 2. The new area starts at the same position as the previously parsed
// area.
if (current_column != grid_area.columns.StartLine())
return false;
// 3. The new area ends at the same position as the previously parsed
// area.
if (look_ahead_column != grid_area.columns.EndLine())
return false;
grid_area.rows = GridSpan::TranslatedDefiniteGridSpan(
grid_area.rows.StartLine(), grid_area.rows.EndLine() + 1);
}
current_column = look_ahead_column - 1;
}
return true;
}
static CSSValue* ConsumeGridBreadth(CSSParserTokenRange& range, static CSSValue* ConsumeGridBreadth(CSSParserTokenRange& range,
CSSParserMode css_parser_mode) { CSSParserMode css_parser_mode) {
const CSSParserToken& token = range.Peek(); const CSSParserToken& token = range.Peek();
...@@ -1322,7 +1213,7 @@ bool CSSPropertyParser::ConsumeGridTemplateRowsAndAreasAndColumns( ...@@ -1322,7 +1213,7 @@ bool CSSPropertyParser::ConsumeGridTemplateRowsAndAreasAndColumns(
// Handle a template-area's row. // Handle a template-area's row.
if (range_.Peek().GetType() != kStringToken || if (range_.Peek().GetType() != kStringToken ||
!ParseGridTemplateAreasRow( !CSSPropertyGridTemplateAreasUtils::ParseGridTemplateAreasRow(
range_.ConsumeIncludingWhitespace().Value().ToString(), range_.ConsumeIncludingWhitespace().Value().ToString(),
grid_area_map, row_count, column_count)) grid_area_map, row_count, column_count))
return false; return false;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment