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

Side by Side Diff: sky/engine/core/css/resolver/StyleBuilderCustom.cpp

Issue 689853003: Remove CSS Grid Layout and grid media queries. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 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) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 3 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
4 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com) 4 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com)
5 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com) 5 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com)
6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved. 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved.
7 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> 7 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org>
8 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> 8 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org>
9 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 9 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
10 * Copyright (c) 2011, Code Aurora Forum. All rights reserved. 10 * Copyright (c) 2011, Code Aurora Forum. All rights reserved.
(...skipping 29 matching lines...) Expand all
40 40
41 #include "core/CSSPropertyNames.h" 41 #include "core/CSSPropertyNames.h"
42 #include "core/CSSValueKeywords.h" 42 #include "core/CSSValueKeywords.h"
43 #include "core/StyleBuilderFunctions.h" 43 #include "core/StyleBuilderFunctions.h"
44 #include "core/StylePropertyShorthand.h" 44 #include "core/StylePropertyShorthand.h"
45 #include "core/css/BasicShapeFunctions.h" 45 #include "core/css/BasicShapeFunctions.h"
46 #include "core/css/CSSAspectRatioValue.h" 46 #include "core/css/CSSAspectRatioValue.h"
47 #include "core/css/CSSCursorImageValue.h" 47 #include "core/css/CSSCursorImageValue.h"
48 #include "core/css/CSSFontValue.h" 48 #include "core/css/CSSFontValue.h"
49 #include "core/css/CSSGradientValue.h" 49 #include "core/css/CSSGradientValue.h"
50 #include "core/css/CSSGridTemplateAreasValue.h"
51 #include "core/css/CSSHelper.h" 50 #include "core/css/CSSHelper.h"
52 #include "core/css/CSSImageSetValue.h" 51 #include "core/css/CSSImageSetValue.h"
53 #include "core/css/CSSLineBoxContainValue.h" 52 #include "core/css/CSSLineBoxContainValue.h"
54 #include "core/css/parser/BisonCSSParser.h" 53 #include "core/css/parser/BisonCSSParser.h"
55 #include "core/css/CSSPrimitiveValueMappings.h" 54 #include "core/css/CSSPrimitiveValueMappings.h"
56 #include "core/css/CSSPropertyMetadata.h" 55 #include "core/css/CSSPropertyMetadata.h"
57 #include "core/css/Pair.h" 56 #include "core/css/Pair.h"
58 #include "core/css/StylePropertySet.h" 57 #include "core/css/StylePropertySet.h"
59 #include "core/css/StyleRule.h" 58 #include "core/css/StyleRule.h"
60 #include "core/css/resolver/ElementStyleResources.h" 59 #include "core/css/resolver/ElementStyleResources.h"
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); 111 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
113 // As per the spec, 'color: currentColor' is treated as 'color: inherit' 112 // As per the spec, 'color: currentColor' is treated as 'color: inherit'
114 if (primitiveValue->getValueID() == CSSValueCurrentcolor) { 113 if (primitiveValue->getValueID() == CSSValueCurrentcolor) {
115 applyInheritCSSPropertyColor(state); 114 applyInheritCSSPropertyColor(state);
116 return; 115 return;
117 } 116 }
118 117
119 state.style()->setColor(StyleBuilderConverter::convertColor(state, value)); 118 state.style()->setColor(StyleBuilderConverter::convertColor(state, value));
120 } 119 }
121 120
122 void StyleBuilderFunctions::applyInitialCSSPropertyJustifyItems(StyleResolverSta te& state)
123 {
124 state.style()->setJustifyItems(RenderStyle::initialJustifyItems());
125 state.style()->setJustifyItemsOverflowAlignment(RenderStyle::initialJustifyI temsOverflowAlignment());
126 state.style()->setJustifyItemsPositionType(RenderStyle::initialJustifyItemsP ositionType());
127 }
128
129 void StyleBuilderFunctions::applyInheritCSSPropertyJustifyItems(StyleResolverSta te& state)
130 {
131 state.style()->setJustifyItems(state.parentStyle()->justifyItems());
132 state.style()->setJustifyItemsOverflowAlignment(state.parentStyle()->justify ItemsOverflowAlignment());
133 state.style()->setJustifyItemsPositionType(state.parentStyle()->justifyItems PositionType());
134 }
135
136 void StyleBuilderFunctions::applyValueCSSPropertyJustifyItems(StyleResolverState & state, CSSValue* value)
137 {
138
139 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
140 if (Pair* pairValue = primitiveValue->getPairValue()) {
141 if (pairValue->first()->getValueID() == CSSValueLegacy) {
142 state.style()->setJustifyItemsPositionType(LegacyPosition);
143 state.style()->setJustifyItems(*pairValue->second());
144 } else {
145 state.style()->setJustifyItems(*pairValue->first());
146 state.style()->setJustifyItemsOverflowAlignment(*pairValue->second() );
147 }
148 } else {
149 state.style()->setJustifyItems(*primitiveValue);
150 }
151 }
152
153 void StyleBuilderFunctions::applyInitialCSSPropertyCursor(StyleResolverState& st ate) 121 void StyleBuilderFunctions::applyInitialCSSPropertyCursor(StyleResolverState& st ate)
154 { 122 {
155 state.style()->clearCursorList(); 123 state.style()->clearCursorList();
156 state.style()->setCursor(RenderStyle::initialCursor()); 124 state.style()->setCursor(RenderStyle::initialCursor());
157 } 125 }
158 126
159 void StyleBuilderFunctions::applyInheritCSSPropertyCursor(StyleResolverState& st ate) 127 void StyleBuilderFunctions::applyInheritCSSPropertyCursor(StyleResolverState& st ate)
160 { 128 {
161 state.style()->setCursor(state.parentStyle()->cursor()); 129 state.style()->setCursor(state.parentStyle()->cursor());
162 state.style()->setCursorList(state.parentStyle()->cursors()); 130 state.style()->setCursorList(state.parentStyle()->cursors());
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 void StyleBuilderFunctions::applyInheritCSSPropertyFontSize(StyleResolverState& state) 182 void StyleBuilderFunctions::applyInheritCSSPropertyFontSize(StyleResolverState& state)
215 { 183 {
216 state.fontBuilder().setFontSizeInherit(state.parentFontDescription()); 184 state.fontBuilder().setFontSizeInherit(state.parentFontDescription());
217 } 185 }
218 186
219 void StyleBuilderFunctions::applyValueCSSPropertyFontSize(StyleResolverState& st ate, CSSValue* value) 187 void StyleBuilderFunctions::applyValueCSSPropertyFontSize(StyleResolverState& st ate, CSSValue* value)
220 { 188 {
221 state.fontBuilder().setFontSizeValue(value, state.parentStyle(), state.rootE lementStyle()); 189 state.fontBuilder().setFontSizeValue(value, state.parentStyle(), state.rootE lementStyle());
222 } 190 }
223 191
224 void StyleBuilderFunctions::applyInitialCSSPropertyGridTemplateAreas(StyleResolv erState& state)
225 {
226 state.style()->setNamedGridArea(RenderStyle::initialNamedGridArea());
227 state.style()->setNamedGridAreaRowCount(RenderStyle::initialNamedGridAreaCou nt());
228 state.style()->setNamedGridAreaColumnCount(RenderStyle::initialNamedGridArea Count());
229 }
230
231 void StyleBuilderFunctions::applyInheritCSSPropertyGridTemplateAreas(StyleResolv erState& state)
232 {
233 state.style()->setNamedGridArea(state.parentStyle()->namedGridArea());
234 state.style()->setNamedGridAreaRowCount(state.parentStyle()->namedGridAreaRo wCount());
235 state.style()->setNamedGridAreaColumnCount(state.parentStyle()->namedGridAre aColumnCount());
236 }
237
238 void StyleBuilderFunctions::applyValueCSSPropertyGridTemplateAreas(StyleResolver State& state, CSSValue* value)
239 {
240 if (value->isPrimitiveValue()) {
241 // FIXME: Shouldn't we clear the grid-area values
242 ASSERT(toCSSPrimitiveValue(value)->getValueID() == CSSValueNone);
243 return;
244 }
245
246 CSSGridTemplateAreasValue* gridTemplateAreasValue = toCSSGridTemplateAreasVa lue(value);
247 const NamedGridAreaMap& newNamedGridAreas = gridTemplateAreasValue->gridArea Map();
248
249 NamedGridLinesMap namedGridColumnLines = state.style()->namedGridColumnLines ();
250 NamedGridLinesMap namedGridRowLines = state.style()->namedGridRowLines();
251 StyleBuilderConverter::createImplicitNamedGridLinesFromGridArea(newNamedGrid Areas, namedGridColumnLines, ForColumns);
252 StyleBuilderConverter::createImplicitNamedGridLinesFromGridArea(newNamedGrid Areas, namedGridRowLines, ForRows);
253 state.style()->setNamedGridColumnLines(namedGridColumnLines);
254 state.style()->setNamedGridRowLines(namedGridRowLines);
255
256 state.style()->setNamedGridArea(newNamedGridAreas);
257 state.style()->setNamedGridAreaRowCount(gridTemplateAreasValue->rowCount());
258 state.style()->setNamedGridAreaColumnCount(gridTemplateAreasValue->columnCou nt());
259 }
260
261 void StyleBuilderFunctions::applyValueCSSPropertyLineHeight(StyleResolverState& state, CSSValue* value) 192 void StyleBuilderFunctions::applyValueCSSPropertyLineHeight(StyleResolverState& state, CSSValue* value)
262 { 193 {
263 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); 194 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
264 Length lineHeight; 195 Length lineHeight;
265 196
266 if (primitiveValue->getValueID() == CSSValueNormal) { 197 if (primitiveValue->getValueID() == CSSValueNormal) {
267 lineHeight = RenderStyle::initialLineHeight(); 198 lineHeight = RenderStyle::initialLineHeight();
268 } else if (primitiveValue->isLength()) { 199 } else if (primitiveValue->isLength()) {
269 float multiplier = state.style()->effectiveZoom(); 200 float multiplier = state.style()->effectiveZoom();
270 if (LocalFrame* frame = state.document().frame()) 201 if (LocalFrame* frame = state.document().frame())
(...skipping 763 matching lines...) Expand 10 before | Expand all | Expand 10 after
1034 if (perspectiveValue >= 0.0f) 965 if (perspectiveValue >= 0.0f)
1035 state.style()->setPerspective(perspectiveValue); 966 state.style()->setPerspective(perspectiveValue);
1036 } 967 }
1037 968
1038 void StyleBuilderFunctions::applyValueCSSPropertyWebkitTextOrientation(StyleReso lverState& state, CSSValue* value) 969 void StyleBuilderFunctions::applyValueCSSPropertyWebkitTextOrientation(StyleReso lverState& state, CSSValue* value)
1039 { 970 {
1040 if (value->isPrimitiveValue()) 971 if (value->isPrimitiveValue())
1041 state.setTextOrientation(*toCSSPrimitiveValue(value)); 972 state.setTextOrientation(*toCSSPrimitiveValue(value));
1042 } 973 }
1043 974
1044 void StyleBuilderFunctions::applyValueCSSPropertyGridAutoFlow(StyleResolverState & state, CSSValue* value)
1045 {
1046 ASSERT(value->isValueList());
1047 CSSValueList* list = toCSSValueList(value);
1048
1049 CSSPrimitiveValue* first = list->length() >= 1 ? toCSSPrimitiveValue(list->i tem(0)) : nullptr;
1050
1051 if (!first) {
1052 applyInitialCSSPropertyGridAutoFlow(state);
1053 return;
1054 }
1055
1056 CSSPrimitiveValue* second = list->length() == 2 ? toCSSPrimitiveValue(list-> item(1)) : nullptr;
1057
1058 GridAutoFlow autoFlow = RenderStyle::initialGridAutoFlow();
1059 switch (first->getValueID()) {
1060 case CSSValueRow:
1061 if (second) {
1062 if (second->getValueID() == CSSValueDense)
1063 autoFlow = AutoFlowRowDense;
1064 else
1065 autoFlow = AutoFlowStackRow;
1066 } else {
1067 autoFlow = AutoFlowRow;
1068 }
1069 break;
1070 case CSSValueColumn:
1071 if (second) {
1072 if (second->getValueID() == CSSValueDense)
1073 autoFlow = AutoFlowColumnDense;
1074 else
1075 autoFlow = AutoFlowStackColumn;
1076 } else {
1077 autoFlow = AutoFlowColumn;
1078 }
1079 break;
1080 case CSSValueDense:
1081 if (second && second->getValueID() == CSSValueColumn)
1082 autoFlow = AutoFlowColumnDense;
1083 else
1084 autoFlow = AutoFlowRowDense;
1085 break;
1086 case CSSValueStack:
1087 if (second && second->getValueID() == CSSValueColumn)
1088 autoFlow = AutoFlowStackColumn;
1089 else
1090 autoFlow = AutoFlowStackRow;
1091 break;
1092 default:
1093 ASSERT_NOT_REACHED();
1094 break;
1095 }
1096
1097 state.style()->setGridAutoFlow(autoFlow);
1098 }
1099
1100 } // namespace blink 975 } // namespace blink
OLDNEW
« no previous file with comments | « sky/engine/core/css/resolver/StyleBuilderConverter.cpp ('k') | sky/engine/core/frame/PRESUBMIT.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698