OLD | NEW |
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 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 Color color = state.parentStyle()->color(); | 160 Color color = state.parentStyle()->color(); |
161 if (state.applyPropertyToRegularStyle()) | 161 if (state.applyPropertyToRegularStyle()) |
162 state.style()->setColor(color); | 162 state.style()->setColor(color); |
163 if (state.applyPropertyToVisitedLinkStyle()) | 163 if (state.applyPropertyToVisitedLinkStyle()) |
164 state.style()->setVisitedLinkColor(color); | 164 state.style()->setVisitedLinkColor(color); |
165 } | 165 } |
166 | 166 |
167 void StyleBuilderFunctions::applyValueCSSPropertyColor(StyleResolverState& state
, const CSSValue& value) | 167 void StyleBuilderFunctions::applyValueCSSPropertyColor(StyleResolverState& state
, const CSSValue& value) |
168 { | 168 { |
169 // As per the spec, 'color: currentColor' is treated as 'color: inherit' | 169 // As per the spec, 'color: currentColor' is treated as 'color: inherit' |
170 if (value.isPrimitiveValue() && toCSSPrimitiveValue(value).getValueID() == C
SSValueCurrentcolor) { | 170 if (value.isIdentifierValue() && toCSSIdentifierValue(value).getValueID() ==
CSSValueCurrentcolor) { |
171 applyInheritCSSPropertyColor(state); | 171 applyInheritCSSPropertyColor(state); |
172 return; | 172 return; |
173 } | 173 } |
174 | 174 |
175 if (state.applyPropertyToRegularStyle()) | 175 if (state.applyPropertyToRegularStyle()) |
176 state.style()->setColor(StyleBuilderConverter::convertColor(state, value
)); | 176 state.style()->setColor(StyleBuilderConverter::convertColor(state, value
)); |
177 if (state.applyPropertyToVisitedLinkStyle()) | 177 if (state.applyPropertyToVisitedLinkStyle()) |
178 state.style()->setVisitedLinkColor(StyleBuilderConverter::convertColor(s
tate, value, true)); | 178 state.style()->setVisitedLinkColor(StyleBuilderConverter::convertColor(s
tate, value, true)); |
179 } | 179 } |
180 | 180 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 SVGElement* svgElement = toSVGElement(element); | 223 SVGElement* svgElement = toSVGElement(element); |
224 svgElement->setCursorImageValue(&image); | 224 svgElement->setCursorImageValue(&image); |
225 cursorElement->addClient(svgElement); | 225 cursorElement->addClient(svgElement); |
226 | 226 |
227 // Elements with SVG cursors are not allowed to share style. | 227 // Elements with SVG cursors are not allowed to share style. |
228 state.style()->setUnique(); | 228 state.style()->setUnique(); |
229 } | 229 } |
230 | 230 |
231 state.style()->addCursor(state.styleImage(CSSPropertyCursor, ima
ge), hotSpotSpecified, hotSpot); | 231 state.style()->addCursor(state.styleImage(CSSPropertyCursor, ima
ge), hotSpotSpecified, hotSpot); |
232 } else { | 232 } else { |
233 state.style()->setCursor(toCSSPrimitiveValue(item).convertTo<ECu
rsor>()); | 233 state.style()->setCursor(toCSSIdentifierValue(item).convertTo<EC
ursor>()); |
234 } | 234 } |
235 } | 235 } |
236 } else { | 236 } else { |
237 state.style()->setCursor(toCSSPrimitiveValue(value).convertTo<ECursor>()
); | 237 state.style()->setCursor(toCSSIdentifierValue(value).convertTo<ECursor>(
)); |
238 } | 238 } |
239 } | 239 } |
240 | 240 |
241 void StyleBuilderFunctions::applyValueCSSPropertyDirection(StyleResolverState& s
tate, const CSSValue& value) | 241 void StyleBuilderFunctions::applyValueCSSPropertyDirection(StyleResolverState& s
tate, const CSSValue& value) |
242 { | 242 { |
243 state.style()->setDirection(toCSSPrimitiveValue(value).convertTo<TextDirecti
on>()); | 243 state.style()->setDirection(toCSSIdentifierValue(value).convertTo<TextDirect
ion>()); |
244 } | 244 } |
245 | 245 |
246 void StyleBuilderFunctions::applyInitialCSSPropertyGridTemplateAreas(StyleResolv
erState& state) | 246 void StyleBuilderFunctions::applyInitialCSSPropertyGridTemplateAreas(StyleResolv
erState& state) |
247 { | 247 { |
248 state.style()->setNamedGridArea(ComputedStyle::initialNamedGridArea()); | 248 state.style()->setNamedGridArea(ComputedStyle::initialNamedGridArea()); |
249 state.style()->setNamedGridAreaRowCount(ComputedStyle::initialNamedGridAreaC
ount()); | 249 state.style()->setNamedGridAreaRowCount(ComputedStyle::initialNamedGridAreaC
ount()); |
250 state.style()->setNamedGridAreaColumnCount(ComputedStyle::initialNamedGridAr
eaCount()); | 250 state.style()->setNamedGridAreaColumnCount(ComputedStyle::initialNamedGridAr
eaCount()); |
251 } | 251 } |
252 | 252 |
253 void StyleBuilderFunctions::applyInheritCSSPropertyGridTemplateAreas(StyleResolv
erState& state) | 253 void StyleBuilderFunctions::applyInheritCSSPropertyGridTemplateAreas(StyleResolv
erState& state) |
254 { | 254 { |
255 state.style()->setNamedGridArea(state.parentStyle()->namedGridArea()); | 255 state.style()->setNamedGridArea(state.parentStyle()->namedGridArea()); |
256 state.style()->setNamedGridAreaRowCount(state.parentStyle()->namedGridAreaRo
wCount()); | 256 state.style()->setNamedGridAreaRowCount(state.parentStyle()->namedGridAreaRo
wCount()); |
257 state.style()->setNamedGridAreaColumnCount(state.parentStyle()->namedGridAre
aColumnCount()); | 257 state.style()->setNamedGridAreaColumnCount(state.parentStyle()->namedGridAre
aColumnCount()); |
258 } | 258 } |
259 | 259 |
260 void StyleBuilderFunctions::applyValueCSSPropertyGridTemplateAreas(StyleResolver
State& state, const CSSValue& value) | 260 void StyleBuilderFunctions::applyValueCSSPropertyGridTemplateAreas(StyleResolver
State& state, const CSSValue& value) |
261 { | 261 { |
262 if (value.isPrimitiveValue()) { | 262 if (value.isIdentifierValue()) { |
263 // FIXME: Shouldn't we clear the grid-area values | 263 // FIXME: Shouldn't we clear the grid-area values |
264 DCHECK_EQ(toCSSPrimitiveValue(value).getValueID(), CSSValueNone); | 264 DCHECK_EQ(toCSSIdentifierValue(value).getValueID(), CSSValueNone); |
265 return; | 265 return; |
266 } | 266 } |
267 | 267 |
268 const CSSGridTemplateAreasValue& gridTemplateAreasValue = toCSSGridTemplateA
reasValue(value); | 268 const CSSGridTemplateAreasValue& gridTemplateAreasValue = toCSSGridTemplateA
reasValue(value); |
269 const NamedGridAreaMap& newNamedGridAreas = gridTemplateAreasValue.gridAreaM
ap(); | 269 const NamedGridAreaMap& newNamedGridAreas = gridTemplateAreasValue.gridAreaM
ap(); |
270 | 270 |
271 NamedGridLinesMap namedGridColumnLines; | 271 NamedGridLinesMap namedGridColumnLines; |
272 NamedGridLinesMap namedGridRowLines; | 272 NamedGridLinesMap namedGridRowLines; |
273 StyleBuilderConverter::convertOrderedNamedGridLinesMapToNamedGridLinesMap(st
ate.style()->orderedNamedGridColumnLines(), namedGridColumnLines); | 273 StyleBuilderConverter::convertOrderedNamedGridLinesMapToNamedGridLinesMap(st
ate.style()->orderedNamedGridColumnLines(), namedGridColumnLines); |
274 StyleBuilderConverter::convertOrderedNamedGridLinesMapToNamedGridLinesMap(st
ate.style()->orderedNamedGridRowLines(), namedGridRowLines); | 274 StyleBuilderConverter::convertOrderedNamedGridLinesMapToNamedGridLinesMap(st
ate.style()->orderedNamedGridRowLines(), namedGridRowLines); |
(...skipping 19 matching lines...) Expand all Loading... |
294 } | 294 } |
295 | 295 |
296 void StyleBuilderFunctions::applyInheritCSSPropertyOutlineStyle(StyleResolverSta
te& state) | 296 void StyleBuilderFunctions::applyInheritCSSPropertyOutlineStyle(StyleResolverSta
te& state) |
297 { | 297 { |
298 state.style()->setOutlineStyleIsAuto(state.parentStyle()->outlineStyleIsAuto
()); | 298 state.style()->setOutlineStyleIsAuto(state.parentStyle()->outlineStyleIsAuto
()); |
299 state.style()->setOutlineStyle(state.parentStyle()->outlineStyle()); | 299 state.style()->setOutlineStyle(state.parentStyle()->outlineStyle()); |
300 } | 300 } |
301 | 301 |
302 void StyleBuilderFunctions::applyValueCSSPropertyOutlineStyle(StyleResolverState
& state, const CSSValue& value) | 302 void StyleBuilderFunctions::applyValueCSSPropertyOutlineStyle(StyleResolverState
& state, const CSSValue& value) |
303 { | 303 { |
304 const CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(value); | 304 const CSSIdentifierValue& identifierValue = toCSSIdentifierValue(value); |
305 state.style()->setOutlineStyleIsAuto(primitiveValue.convertTo<OutlineIsAuto>
()); | 305 state.style()->setOutlineStyleIsAuto(identifierValue.convertTo<OutlineIsAuto
>()); |
306 state.style()->setOutlineStyle(primitiveValue.convertTo<EBorderStyle>()); | 306 state.style()->setOutlineStyle(identifierValue.convertTo<EBorderStyle>()); |
307 } | 307 } |
308 | 308 |
309 void StyleBuilderFunctions::applyValueCSSPropertyResize(StyleResolverState& stat
e, const CSSValue& value) | 309 void StyleBuilderFunctions::applyValueCSSPropertyResize(StyleResolverState& stat
e, const CSSValue& value) |
310 { | 310 { |
311 const CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(value); | 311 const CSSIdentifierValue& identifierValue = toCSSIdentifierValue(value); |
312 | 312 |
313 EResize r = RESIZE_NONE; | 313 EResize r = RESIZE_NONE; |
314 if (primitiveValue.getValueID() == CSSValueAuto) { | 314 if (identifierValue.getValueID() == CSSValueAuto) { |
315 if (Settings* settings = state.document().settings()) | 315 if (Settings* settings = state.document().settings()) |
316 r = settings->textAreasAreResizable() ? RESIZE_BOTH : RESIZE_NONE; | 316 r = settings->textAreasAreResizable() ? RESIZE_BOTH : RESIZE_NONE; |
317 } else { | 317 } else { |
318 r = primitiveValue.convertTo<EResize>(); | 318 r = identifierValue.convertTo<EResize>(); |
319 } | 319 } |
320 state.style()->setResize(r); | 320 state.style()->setResize(r); |
321 } | 321 } |
322 | 322 |
323 static float mmToPx(float mm) { return mm * cssPixelsPerMillimeter; } | 323 static float mmToPx(float mm) { return mm * cssPixelsPerMillimeter; } |
324 static float inchToPx(float inch) { return inch * cssPixelsPerInch; } | 324 static float inchToPx(float inch) { return inch * cssPixelsPerInch; } |
325 static FloatSize getPageSizeFromName(const CSSPrimitiveValue& pageSizeName) | 325 static FloatSize getPageSizeFromName(const CSSIdentifierValue& pageSizeName) |
326 { | 326 { |
327 switch (pageSizeName.getValueID()) { | 327 switch (pageSizeName.getValueID()) { |
328 case CSSValueA5: | 328 case CSSValueA5: |
329 return FloatSize(mmToPx(148), mmToPx(210)); | 329 return FloatSize(mmToPx(148), mmToPx(210)); |
330 case CSSValueA4: | 330 case CSSValueA4: |
331 return FloatSize(mmToPx(210), mmToPx(297)); | 331 return FloatSize(mmToPx(210), mmToPx(297)); |
332 case CSSValueA3: | 332 case CSSValueA3: |
333 return FloatSize(mmToPx(297), mmToPx(420)); | 333 return FloatSize(mmToPx(297), mmToPx(420)); |
334 case CSSValueB5: | 334 case CSSValueB5: |
335 return FloatSize(mmToPx(176), mmToPx(250)); | 335 return FloatSize(mmToPx(176), mmToPx(250)); |
(...skipping 14 matching lines...) Expand all Loading... |
350 void StyleBuilderFunctions::applyInitialCSSPropertySize(StyleResolverState&) { } | 350 void StyleBuilderFunctions::applyInitialCSSPropertySize(StyleResolverState&) { } |
351 void StyleBuilderFunctions::applyInheritCSSPropertySize(StyleResolverState&) { } | 351 void StyleBuilderFunctions::applyInheritCSSPropertySize(StyleResolverState&) { } |
352 void StyleBuilderFunctions::applyValueCSSPropertySize(StyleResolverState& state,
const CSSValue& value) | 352 void StyleBuilderFunctions::applyValueCSSPropertySize(StyleResolverState& state,
const CSSValue& value) |
353 { | 353 { |
354 state.style()->resetPageSizeType(); | 354 state.style()->resetPageSizeType(); |
355 FloatSize size; | 355 FloatSize size; |
356 PageSizeType pageSizeType = PAGE_SIZE_AUTO; | 356 PageSizeType pageSizeType = PAGE_SIZE_AUTO; |
357 const CSSValueList& list = toCSSValueList(value); | 357 const CSSValueList& list = toCSSValueList(value); |
358 if (list.length() == 2) { | 358 if (list.length() == 2) { |
359 // <length>{2} | <page-size> <orientation> | 359 // <length>{2} | <page-size> <orientation> |
360 const CSSPrimitiveValue& first = toCSSPrimitiveValue(list.item(0)); | 360 const CSSValue& first = list.item(0); |
361 const CSSPrimitiveValue& second = toCSSPrimitiveValue(list.item(1)); | 361 const CSSValue& second = list.item(1); |
362 if (first.isLength()) { | 362 if (first.isPrimitiveValue() && toCSSPrimitiveValue(first).isLength()) { |
363 // <length>{2} | 363 // <length>{2} |
364 size = FloatSize(first.computeLength<float>(state.cssToLengthConvers
ionData().copyWithAdjustedZoom(1.0)), | 364 size = FloatSize(toCSSPrimitiveValue(first).computeLength<float>(sta
te.cssToLengthConversionData().copyWithAdjustedZoom(1.0)), |
365 second.computeLength<float>(state.cssToLengthConversionData().co
pyWithAdjustedZoom(1.0))); | 365 toCSSPrimitiveValue(second).computeLength<float>(state.cssToLeng
thConversionData().copyWithAdjustedZoom(1.0))); |
366 } else { | 366 } else { |
367 // <page-size> <orientation> | 367 // <page-size> <orientation> |
368 size = getPageSizeFromName(first); | 368 size = getPageSizeFromName(toCSSIdentifierValue(first)); |
369 | 369 |
370 DCHECK(second.getValueID() == CSSValueLandscape || second.getValueID
() == CSSValuePortrait); | 370 DCHECK(toCSSIdentifierValue(second).getValueID() == CSSValueLandscap
e || toCSSIdentifierValue(second).getValueID() == CSSValuePortrait); |
371 if (second.getValueID() == CSSValueLandscape) | 371 if (toCSSIdentifierValue(second).getValueID() == CSSValueLandscape) |
372 size = size.transposedSize(); | 372 size = size.transposedSize(); |
373 } | 373 } |
374 pageSizeType = PAGE_SIZE_RESOLVED; | 374 pageSizeType = PAGE_SIZE_RESOLVED; |
375 } else { | 375 } else { |
376 DCHECK_EQ(list.length(), 1U); | 376 DCHECK_EQ(list.length(), 1U); |
377 // <length> | auto | <page-size> | [ portrait | landscape] | 377 // <length> | auto | <page-size> | [ portrait | landscape] |
378 const CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(list.item(
0)); | 378 const CSSValue& first = list.item(0); |
379 if (primitiveValue.isLength()) { | 379 if (first.isPrimitiveValue() && toCSSPrimitiveValue(first).isLength()) { |
380 // <length> | 380 // <length> |
381 pageSizeType = PAGE_SIZE_RESOLVED; | 381 pageSizeType = PAGE_SIZE_RESOLVED; |
382 float width = primitiveValue.computeLength<float>(state.cssToLengthC
onversionData().copyWithAdjustedZoom(1.0)); | 382 float width = toCSSPrimitiveValue(first).computeLength<float>(state.
cssToLengthConversionData().copyWithAdjustedZoom(1.0)); |
383 size = FloatSize(width, width); | 383 size = FloatSize(width, width); |
384 } else { | 384 } else { |
385 switch (primitiveValue.getValueID()) { | 385 const CSSIdentifierValue& ident = toCSSIdentifierValue(first); |
| 386 switch (ident.getValueID()) { |
386 case CSSValueAuto: | 387 case CSSValueAuto: |
387 pageSizeType = PAGE_SIZE_AUTO; | 388 pageSizeType = PAGE_SIZE_AUTO; |
388 break; | 389 break; |
389 case CSSValuePortrait: | 390 case CSSValuePortrait: |
390 pageSizeType = PAGE_SIZE_AUTO_PORTRAIT; | 391 pageSizeType = PAGE_SIZE_AUTO_PORTRAIT; |
391 break; | 392 break; |
392 case CSSValueLandscape: | 393 case CSSValueLandscape: |
393 pageSizeType = PAGE_SIZE_AUTO_LANDSCAPE; | 394 pageSizeType = PAGE_SIZE_AUTO_LANDSCAPE; |
394 break; | 395 break; |
395 default: | 396 default: |
396 // <page-size> | 397 // <page-size> |
397 pageSizeType = PAGE_SIZE_RESOLVED; | 398 pageSizeType = PAGE_SIZE_RESOLVED; |
398 size = getPageSizeFromName(primitiveValue); | 399 size = getPageSizeFromName(ident); |
399 } | 400 } |
400 } | 401 } |
401 } | 402 } |
402 state.style()->setPageSizeType(pageSizeType); | 403 state.style()->setPageSizeType(pageSizeType); |
403 state.style()->setPageSize(size); | 404 state.style()->setPageSize(size); |
404 } | 405 } |
405 | 406 |
406 void StyleBuilderFunctions::applyInitialCSSPropertySnapHeight(StyleResolverState
& state) | 407 void StyleBuilderFunctions::applyInitialCSSPropertySnapHeight(StyleResolverState
& state) |
407 { | 408 { |
408 state.style()->setSnapHeightUnit(0); | 409 state.style()->setSnapHeightUnit(0); |
(...skipping 23 matching lines...) Expand all Loading... |
432 DCHECK_EQ(list.length(), 2U); | 433 DCHECK_EQ(list.length(), 2U); |
433 const CSSPrimitiveValue& second = toCSSPrimitiveValue(list.item(1)); | 434 const CSSPrimitiveValue& second = toCSSPrimitiveValue(list.item(1)); |
434 DCHECK(second.isNumber()); | 435 DCHECK(second.isNumber()); |
435 int position = second.getIntValue(); | 436 int position = second.getIntValue(); |
436 DCHECK(position > 0 && position <= 100); | 437 DCHECK(position > 0 && position <= 100); |
437 state.style()->setSnapHeightPosition(position); | 438 state.style()->setSnapHeightPosition(position); |
438 } | 439 } |
439 | 440 |
440 void StyleBuilderFunctions::applyValueCSSPropertyTextAlign(StyleResolverState& s
tate, const CSSValue& value) | 441 void StyleBuilderFunctions::applyValueCSSPropertyTextAlign(StyleResolverState& s
tate, const CSSValue& value) |
441 { | 442 { |
442 const CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(value); | 443 if (value.isIdentifierValue() && toCSSIdentifierValue(value).getValueID() !=
CSSValueWebkitMatchParent) { |
443 if (primitiveValue.isValueID() && primitiveValue.getValueID() != CSSValueWeb
kitMatchParent) { | |
444 // Special case for th elements - UA stylesheet text-align does not appl
y if parent's computed value for text-align is not its initial value | 444 // Special case for th elements - UA stylesheet text-align does not appl
y if parent's computed value for text-align is not its initial value |
445 // https://html.spec.whatwg.org/multipage/rendering.html#tables-2 | 445 // https://html.spec.whatwg.org/multipage/rendering.html#tables-2 |
446 if (primitiveValue.getValueID() == CSSValueInternalCenter && state.paren
tStyle()->textAlign() != ComputedStyle::initialTextAlign()) | 446 const CSSIdentifierValue& identValue = toCSSIdentifierValue(value); |
| 447 if (identValue.getValueID() == CSSValueInternalCenter && state.parentSty
le()->textAlign() != ComputedStyle::initialTextAlign()) |
447 state.style()->setTextAlign(state.parentStyle()->textAlign()); | 448 state.style()->setTextAlign(state.parentStyle()->textAlign()); |
448 else | 449 else |
449 state.style()->setTextAlign(primitiveValue.convertTo<ETextAlign>()); | 450 state.style()->setTextAlign(identValue.convertTo<ETextAlign>()); |
450 } | 451 } |
451 else if (state.parentStyle()->textAlign() == TASTART) | 452 else if (state.parentStyle()->textAlign() == TASTART) |
452 state.style()->setTextAlign(state.parentStyle()->isLeftToRightDirection(
) ? LEFT : RIGHT); | 453 state.style()->setTextAlign(state.parentStyle()->isLeftToRightDirection(
) ? LEFT : RIGHT); |
453 else if (state.parentStyle()->textAlign() == TAEND) | 454 else if (state.parentStyle()->textAlign() == TAEND) |
454 state.style()->setTextAlign(state.parentStyle()->isLeftToRightDirection(
) ? RIGHT : LEFT); | 455 state.style()->setTextAlign(state.parentStyle()->isLeftToRightDirection(
) ? RIGHT : LEFT); |
455 else | 456 else |
456 state.style()->setTextAlign(state.parentStyle()->textAlign()); | 457 state.style()->setTextAlign(state.parentStyle()->textAlign()); |
457 } | 458 } |
458 | 459 |
459 void StyleBuilderFunctions::applyInheritCSSPropertyTextIndent(StyleResolverState
& state) | 460 void StyleBuilderFunctions::applyInheritCSSPropertyTextIndent(StyleResolverState
& state) |
(...skipping 10 matching lines...) Expand all Loading... |
470 state.style()->setTextIndentType(ComputedStyle::initialTextIndentType()); | 471 state.style()->setTextIndentType(ComputedStyle::initialTextIndentType()); |
471 } | 472 } |
472 | 473 |
473 void StyleBuilderFunctions::applyValueCSSPropertyTextIndent(StyleResolverState&
state, const CSSValue& value) | 474 void StyleBuilderFunctions::applyValueCSSPropertyTextIndent(StyleResolverState&
state, const CSSValue& value) |
474 { | 475 { |
475 Length lengthOrPercentageValue; | 476 Length lengthOrPercentageValue; |
476 TextIndentLine textIndentLineValue = ComputedStyle::initialTextIndentLine(); | 477 TextIndentLine textIndentLineValue = ComputedStyle::initialTextIndentLine(); |
477 TextIndentType textIndentTypeValue = ComputedStyle::initialTextIndentType(); | 478 TextIndentType textIndentTypeValue = ComputedStyle::initialTextIndentType(); |
478 | 479 |
479 for (auto& listValue : toCSSValueList(value)) { | 480 for (auto& listValue : toCSSValueList(value)) { |
480 const CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(listValue.
get()); | 481 if (listValue->isPrimitiveValue()) { |
481 if (!primitiveValue->getValueID()) | 482 lengthOrPercentageValue = toCSSPrimitiveValue(*listValue).convertToL
ength(state.cssToLengthConversionData()); |
482 lengthOrPercentageValue = primitiveValue->convertToLength(state.cssT
oLengthConversionData()); | 483 } else if (toCSSIdentifierValue(*listValue).getValueID() == CSSValueEach
Line) { |
483 else if (primitiveValue->getValueID() == CSSValueEachLine) | |
484 textIndentLineValue = TextIndentEachLine; | 484 textIndentLineValue = TextIndentEachLine; |
485 else if (primitiveValue->getValueID() == CSSValueHanging) | 485 } else if (toCSSIdentifierValue(*listValue).getValueID() == CSSValueHang
ing) { |
486 textIndentTypeValue = TextIndentHanging; | 486 textIndentTypeValue = TextIndentHanging; |
487 else | 487 } else { |
488 NOTREACHED(); | 488 NOTREACHED(); |
| 489 } |
489 } | 490 } |
490 | 491 |
491 state.style()->setTextIndent(lengthOrPercentageValue); | 492 state.style()->setTextIndent(lengthOrPercentageValue); |
492 state.style()->setTextIndentLine(textIndentLineValue); | 493 state.style()->setTextIndentLine(textIndentLineValue); |
493 state.style()->setTextIndentType(textIndentTypeValue); | 494 state.style()->setTextIndentType(textIndentTypeValue); |
494 } | 495 } |
495 | 496 |
496 void StyleBuilderFunctions::applyValueCSSPropertyTransform(StyleResolverState& s
tate, const CSSValue& value) | 497 void StyleBuilderFunctions::applyValueCSSPropertyTransform(StyleResolverState& s
tate, const CSSValue& value) |
497 { | 498 { |
498 // FIXME: We should just make this a converter | 499 // FIXME: We should just make this a converter |
499 TransformOperations operations; | 500 TransformOperations operations; |
500 TransformBuilder::createTransformOperations(value, state.cssToLengthConversi
onData(), operations); | 501 TransformBuilder::createTransformOperations(value, state.cssToLengthConversi
onData(), operations); |
501 state.style()->setTransform(operations); | 502 state.style()->setTransform(operations); |
502 } | 503 } |
503 | 504 |
504 void StyleBuilderFunctions::applyInheritCSSPropertyVerticalAlign(StyleResolverSt
ate& state) | 505 void StyleBuilderFunctions::applyInheritCSSPropertyVerticalAlign(StyleResolverSt
ate& state) |
505 { | 506 { |
506 EVerticalAlign verticalAlign = state.parentStyle()->verticalAlign(); | 507 EVerticalAlign verticalAlign = state.parentStyle()->verticalAlign(); |
507 state.style()->setVerticalAlign(verticalAlign); | 508 state.style()->setVerticalAlign(verticalAlign); |
508 if (verticalAlign == VerticalAlignLength) | 509 if (verticalAlign == VerticalAlignLength) |
509 state.style()->setVerticalAlignLength(state.parentStyle()->getVerticalAl
ignLength()); | 510 state.style()->setVerticalAlignLength(state.parentStyle()->getVerticalAl
ignLength()); |
510 } | 511 } |
511 | 512 |
512 void StyleBuilderFunctions::applyValueCSSPropertyVerticalAlign(StyleResolverStat
e& state, const CSSValue& value) | 513 void StyleBuilderFunctions::applyValueCSSPropertyVerticalAlign(StyleResolverStat
e& state, const CSSValue& value) |
513 { | 514 { |
514 const CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(value); | 515 if (value.isIdentifierValue()) |
515 | 516 state.style()->setVerticalAlign(toCSSIdentifierValue(value).convertTo<EV
erticalAlign>()); |
516 if (primitiveValue.getValueID()) | |
517 state.style()->setVerticalAlign(primitiveValue.convertTo<EVerticalAlign>
()); | |
518 else | 517 else |
519 state.style()->setVerticalAlignLength(primitiveValue.convertToLength(sta
te.cssToLengthConversionData())); | 518 state.style()->setVerticalAlignLength(toCSSPrimitiveValue(value).convert
ToLength(state.cssToLengthConversionData())); |
520 } | 519 } |
521 | 520 |
522 static void resetEffectiveZoom(StyleResolverState& state) | 521 static void resetEffectiveZoom(StyleResolverState& state) |
523 { | 522 { |
524 // Reset the zoom in effect. This allows the setZoom method to accurately co
mpute a new zoom in effect. | 523 // Reset the zoom in effect. This allows the setZoom method to accurately co
mpute a new zoom in effect. |
525 state.setEffectiveZoom(state.parentStyle() ? state.parentStyle()->effectiveZ
oom() : ComputedStyle::initialZoom()); | 524 state.setEffectiveZoom(state.parentStyle() ? state.parentStyle()->effectiveZ
oom() : ComputedStyle::initialZoom()); |
526 } | 525 } |
527 | 526 |
528 void StyleBuilderFunctions::applyInitialCSSPropertyZoom(StyleResolverState& stat
e) | 527 void StyleBuilderFunctions::applyInitialCSSPropertyZoom(StyleResolverState& stat
e) |
529 { | 528 { |
530 resetEffectiveZoom(state); | 529 resetEffectiveZoom(state); |
531 state.setZoom(ComputedStyle::initialZoom()); | 530 state.setZoom(ComputedStyle::initialZoom()); |
532 } | 531 } |
533 | 532 |
534 void StyleBuilderFunctions::applyInheritCSSPropertyZoom(StyleResolverState& stat
e) | 533 void StyleBuilderFunctions::applyInheritCSSPropertyZoom(StyleResolverState& stat
e) |
535 { | 534 { |
536 resetEffectiveZoom(state); | 535 resetEffectiveZoom(state); |
537 state.setZoom(state.parentStyle()->zoom()); | 536 state.setZoom(state.parentStyle()->zoom()); |
538 } | 537 } |
539 | 538 |
540 void StyleBuilderFunctions::applyValueCSSPropertyZoom(StyleResolverState& state,
const CSSValue& value) | 539 void StyleBuilderFunctions::applyValueCSSPropertyZoom(StyleResolverState& state,
const CSSValue& value) |
541 { | 540 { |
542 SECURITY_DCHECK(value.isPrimitiveValue()); | 541 SECURITY_DCHECK(value.isPrimitiveValue() || value.isIdentifierValue()); |
543 const CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(value); | |
544 | 542 |
545 if (primitiveValue.getValueID() == CSSValueNormal) { | 543 if (value.isIdentifierValue()) { |
546 resetEffectiveZoom(state); | 544 const CSSIdentifierValue& identifierValue = toCSSIdentifierValue(value); |
547 state.setZoom(ComputedStyle::initialZoom()); | 545 if (identifierValue.getValueID() == CSSValueNormal) { |
548 } else if (primitiveValue.getValueID() == CSSValueReset) { | 546 resetEffectiveZoom(state); |
549 state.setEffectiveZoom(ComputedStyle::initialZoom()); | 547 state.setZoom(ComputedStyle::initialZoom()); |
550 state.setZoom(ComputedStyle::initialZoom()); | 548 } else if (identifierValue.getValueID() == CSSValueReset) { |
551 } else if (primitiveValue.getValueID() == CSSValueDocument) { | 549 state.setEffectiveZoom(ComputedStyle::initialZoom()); |
552 float docZoom = state.rootElementStyle() ? state.rootElementStyle()->zoo
m() : ComputedStyle::initialZoom(); | 550 state.setZoom(ComputedStyle::initialZoom()); |
553 state.setEffectiveZoom(docZoom); | 551 } else if (identifierValue.getValueID() == CSSValueDocument) { |
554 state.setZoom(docZoom); | 552 float docZoom = state.rootElementStyle() ? state.rootElementStyle()-
>zoom() : ComputedStyle::initialZoom(); |
555 } else if (primitiveValue.isPercentage()) { | 553 state.setEffectiveZoom(docZoom); |
556 resetEffectiveZoom(state); | 554 state.setZoom(docZoom); |
557 if (float percent = primitiveValue.getFloatValue()) | 555 } |
558 state.setZoom(percent / 100.0f); | 556 } else if (value.isPrimitiveValue()) { |
559 } else if (primitiveValue.isNumber()) { | 557 const CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(value); |
560 resetEffectiveZoom(state); | 558 if (primitiveValue.isPercentage()) { |
561 if (float number = primitiveValue.getFloatValue()) | 559 resetEffectiveZoom(state); |
562 state.setZoom(number); | 560 if (float percent = primitiveValue.getFloatValue()) |
| 561 state.setZoom(percent / 100.0f); |
| 562 } else if (primitiveValue.isNumber()) { |
| 563 resetEffectiveZoom(state); |
| 564 if (float number = primitiveValue.getFloatValue()) |
| 565 state.setZoom(number); |
| 566 } |
563 } | 567 } |
564 } | 568 } |
565 | 569 |
566 void StyleBuilderFunctions::applyValueCSSPropertyWebkitBorderImage(StyleResolver
State& state, const CSSValue& value) | 570 void StyleBuilderFunctions::applyValueCSSPropertyWebkitBorderImage(StyleResolver
State& state, const CSSValue& value) |
567 { | 571 { |
568 NinePieceImage image; | 572 NinePieceImage image; |
569 CSSToStyleMap::mapNinePieceImage(state, CSSPropertyWebkitBorderImage, value,
image); | 573 CSSToStyleMap::mapNinePieceImage(state, CSSPropertyWebkitBorderImage, value,
image); |
570 state.style()->setBorderImage(image); | 574 state.style()->setBorderImage(image); |
571 } | 575 } |
572 | 576 |
(...skipping 10 matching lines...) Expand all Loading... |
583 state.style()->setTextEmphasisMark(state.parentStyle()->getTextEmphasisMark(
)); | 587 state.style()->setTextEmphasisMark(state.parentStyle()->getTextEmphasisMark(
)); |
584 state.style()->setTextEmphasisCustomMark(state.parentStyle()->textEmphasisCu
stomMark()); | 588 state.style()->setTextEmphasisCustomMark(state.parentStyle()->textEmphasisCu
stomMark()); |
585 } | 589 } |
586 | 590 |
587 void StyleBuilderFunctions::applyValueCSSPropertyWebkitTextEmphasisStyle(StyleRe
solverState& state, const CSSValue& value) | 591 void StyleBuilderFunctions::applyValueCSSPropertyWebkitTextEmphasisStyle(StyleRe
solverState& state, const CSSValue& value) |
588 { | 592 { |
589 if (value.isValueList()) { | 593 if (value.isValueList()) { |
590 const CSSValueList& list = toCSSValueList(value); | 594 const CSSValueList& list = toCSSValueList(value); |
591 DCHECK_EQ(list.length(), 2U); | 595 DCHECK_EQ(list.length(), 2U); |
592 for (unsigned i = 0; i < 2; ++i) { | 596 for (unsigned i = 0; i < 2; ++i) { |
593 const CSSPrimitiveValue& value = toCSSPrimitiveValue(list.item(i)); | 597 const CSSIdentifierValue& value = toCSSIdentifierValue(list.item(i))
; |
594 if (value.getValueID() == CSSValueFilled || value.getValueID() == CS
SValueOpen) | 598 if (value.getValueID() == CSSValueFilled || value.getValueID() == CS
SValueOpen) |
595 state.style()->setTextEmphasisFill(value.convertTo<TextEmphasisF
ill>()); | 599 state.style()->setTextEmphasisFill(value.convertTo<TextEmphasisF
ill>()); |
596 else | 600 else |
597 state.style()->setTextEmphasisMark(value.convertTo<TextEmphasisM
ark>()); | 601 state.style()->setTextEmphasisMark(value.convertTo<TextEmphasisM
ark>()); |
598 } | 602 } |
599 state.style()->setTextEmphasisCustomMark(nullAtom); | 603 state.style()->setTextEmphasisCustomMark(nullAtom); |
600 return; | 604 return; |
601 } | 605 } |
602 | 606 |
603 if (value.isStringValue()) { | 607 if (value.isStringValue()) { |
604 state.style()->setTextEmphasisFill(TextEmphasisFillFilled); | 608 state.style()->setTextEmphasisFill(TextEmphasisFillFilled); |
605 state.style()->setTextEmphasisMark(TextEmphasisMarkCustom); | 609 state.style()->setTextEmphasisMark(TextEmphasisMarkCustom); |
606 state.style()->setTextEmphasisCustomMark(AtomicString(toCSSStringValue(v
alue).value())); | 610 state.style()->setTextEmphasisCustomMark(AtomicString(toCSSStringValue(v
alue).value())); |
607 return; | 611 return; |
608 } | 612 } |
609 | 613 |
610 const CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(value); | 614 const CSSIdentifierValue& identifierValue = toCSSIdentifierValue(value); |
611 | 615 |
612 state.style()->setTextEmphasisCustomMark(nullAtom); | 616 state.style()->setTextEmphasisCustomMark(nullAtom); |
613 | 617 |
614 if (primitiveValue.getValueID() == CSSValueFilled || primitiveValue.getValue
ID() == CSSValueOpen) { | 618 if (identifierValue.getValueID() == CSSValueFilled || identifierValue.getVal
ueID() == CSSValueOpen) { |
615 state.style()->setTextEmphasisFill(primitiveValue.convertTo<TextEmphasis
Fill>()); | 619 state.style()->setTextEmphasisFill(identifierValue.convertTo<TextEmphasi
sFill>()); |
616 state.style()->setTextEmphasisMark(TextEmphasisMarkAuto); | 620 state.style()->setTextEmphasisMark(TextEmphasisMarkAuto); |
617 } else { | 621 } else { |
618 state.style()->setTextEmphasisFill(TextEmphasisFillFilled); | 622 state.style()->setTextEmphasisFill(TextEmphasisFillFilled); |
619 state.style()->setTextEmphasisMark(primitiveValue.convertTo<TextEmphasis
Mark>()); | 623 state.style()->setTextEmphasisMark(identifierValue.convertTo<TextEmphasi
sMark>()); |
620 } | 624 } |
621 } | 625 } |
622 | 626 |
623 void StyleBuilderFunctions::applyInitialCSSPropertyWillChange(StyleResolverState
& state) | 627 void StyleBuilderFunctions::applyInitialCSSPropertyWillChange(StyleResolverState
& state) |
624 { | 628 { |
625 state.style()->setWillChangeContents(false); | 629 state.style()->setWillChangeContents(false); |
626 state.style()->setWillChangeScrollPosition(false); | 630 state.style()->setWillChangeScrollPosition(false); |
627 state.style()->setWillChangeProperties(Vector<CSSPropertyID>()); | 631 state.style()->setWillChangeProperties(Vector<CSSPropertyID>()); |
628 state.style()->setSubtreeWillChangeContents(state.parentStyle()->subtreeWill
ChangeContents()); | 632 state.style()->setSubtreeWillChangeContents(state.parentStyle()->subtreeWill
ChangeContents()); |
629 } | 633 } |
630 | 634 |
631 void StyleBuilderFunctions::applyInheritCSSPropertyWillChange(StyleResolverState
& state) | 635 void StyleBuilderFunctions::applyInheritCSSPropertyWillChange(StyleResolverState
& state) |
632 { | 636 { |
633 state.style()->setWillChangeContents(state.parentStyle()->willChangeContents
()); | 637 state.style()->setWillChangeContents(state.parentStyle()->willChangeContents
()); |
634 state.style()->setWillChangeScrollPosition(state.parentStyle()->willChangeSc
rollPosition()); | 638 state.style()->setWillChangeScrollPosition(state.parentStyle()->willChangeSc
rollPosition()); |
635 state.style()->setWillChangeProperties(state.parentStyle()->willChangeProper
ties()); | 639 state.style()->setWillChangeProperties(state.parentStyle()->willChangeProper
ties()); |
636 state.style()->setSubtreeWillChangeContents(state.parentStyle()->subtreeWill
ChangeContents()); | 640 state.style()->setSubtreeWillChangeContents(state.parentStyle()->subtreeWill
ChangeContents()); |
637 } | 641 } |
638 | 642 |
639 void StyleBuilderFunctions::applyValueCSSPropertyWillChange(StyleResolverState&
state, const CSSValue& value) | 643 void StyleBuilderFunctions::applyValueCSSPropertyWillChange(StyleResolverState&
state, const CSSValue& value) |
640 { | 644 { |
641 bool willChangeContents = false; | 645 bool willChangeContents = false; |
642 bool willChangeScrollPosition = false; | 646 bool willChangeScrollPosition = false; |
643 Vector<CSSPropertyID> willChangeProperties; | 647 Vector<CSSPropertyID> willChangeProperties; |
644 | 648 |
645 if (value.isPrimitiveValue()) { | 649 if (value.isIdentifierValue()) { |
646 DCHECK_EQ(toCSSPrimitiveValue(value).getValueID(), CSSValueAuto); | 650 DCHECK_EQ(toCSSIdentifierValue(value).getValueID(), CSSValueAuto); |
647 } else { | 651 } else { |
648 DCHECK(value.isValueList()); | 652 DCHECK(value.isValueList()); |
649 for (auto& willChangeValue : toCSSValueList(value)) { | 653 for (auto& willChangeValue : toCSSValueList(value)) { |
650 if (willChangeValue->isCustomIdentValue()) | 654 if (willChangeValue->isCustomIdentValue()) |
651 willChangeProperties.append(toCSSCustomIdentValue(*willChangeVal
ue).valueAsPropertyID()); | 655 willChangeProperties.append(toCSSCustomIdentValue(*willChangeVal
ue).valueAsPropertyID()); |
652 else if (toCSSPrimitiveValue(*willChangeValue).getValueID() == CSSVa
lueContents) | 656 else if (toCSSIdentifierValue(*willChangeValue).getValueID() == CSSV
alueContents) |
653 willChangeContents = true; | 657 willChangeContents = true; |
654 else if (toCSSPrimitiveValue(*willChangeValue).getValueID() == CSSVa
lueScrollPosition) | 658 else if (toCSSIdentifierValue(*willChangeValue).getValueID() == CSSV
alueScrollPosition) |
655 willChangeScrollPosition = true; | 659 willChangeScrollPosition = true; |
656 else | 660 else |
657 NOTREACHED(); | 661 NOTREACHED(); |
658 } | 662 } |
659 } | 663 } |
660 state.style()->setWillChangeContents(willChangeContents); | 664 state.style()->setWillChangeContents(willChangeContents); |
661 state.style()->setWillChangeScrollPosition(willChangeScrollPosition); | 665 state.style()->setWillChangeScrollPosition(willChangeScrollPosition); |
662 state.style()->setWillChangeProperties(willChangeProperties); | 666 state.style()->setWillChangeProperties(willChangeProperties); |
663 state.style()->setSubtreeWillChangeContents(willChangeContents || state.pare
ntStyle()->subtreeWillChangeContents()); | 667 state.style()->setSubtreeWillChangeContents(willChangeContents || state.pare
ntStyle()->subtreeWillChangeContents()); |
664 } | 668 } |
665 | 669 |
666 void StyleBuilderFunctions::applyInitialCSSPropertyContent(StyleResolverState& s
tate) | 670 void StyleBuilderFunctions::applyInitialCSSPropertyContent(StyleResolverState& s
tate) |
667 { | 671 { |
668 state.style()->setContent(nullptr); | 672 state.style()->setContent(nullptr); |
669 } | 673 } |
670 | 674 |
671 void StyleBuilderFunctions::applyInheritCSSPropertyContent(StyleResolverState&) | 675 void StyleBuilderFunctions::applyInheritCSSPropertyContent(StyleResolverState&) |
672 { | 676 { |
673 // FIXME: In CSS3, it will be possible to inherit content. In CSS2 it is not
. This | 677 // FIXME: In CSS3, it will be possible to inherit content. In CSS2 it is not
. This |
674 // note is a reminder that eventually "inherit" needs to be supported. | 678 // note is a reminder that eventually "inherit" needs to be supported. |
675 } | 679 } |
676 | 680 |
677 void StyleBuilderFunctions::applyValueCSSPropertyContent(StyleResolverState& sta
te, const CSSValue& value) | 681 void StyleBuilderFunctions::applyValueCSSPropertyContent(StyleResolverState& sta
te, const CSSValue& value) |
678 { | 682 { |
679 if (value.isPrimitiveValue()) { | 683 if (value.isIdentifierValue()) { |
680 DCHECK(toCSSPrimitiveValue(value).getValueID() == CSSValueNormal || toCS
SPrimitiveValue(value).getValueID() == CSSValueNone); | 684 DCHECK(toCSSIdentifierValue(value).getValueID() == CSSValueNormal || toC
SSIdentifierValue(value).getValueID() == CSSValueNone); |
681 state.style()->setContent(nullptr); | 685 state.style()->setContent(nullptr); |
682 return; | 686 return; |
683 } | 687 } |
684 | 688 |
685 ContentData* firstContent = nullptr; | 689 ContentData* firstContent = nullptr; |
686 ContentData* prevContent = nullptr; | 690 ContentData* prevContent = nullptr; |
687 for (auto& item : toCSSValueList(value)) { | 691 for (auto& item : toCSSValueList(value)) { |
688 ContentData* nextContent = nullptr; | 692 ContentData* nextContent = nullptr; |
689 if (item->isImageGeneratorValue() || item->isImageSetValue() || item->is
ImageValue()) { | 693 if (item->isImageGeneratorValue() || item->isImageSetValue() || item->is
ImageValue()) { |
690 nextContent = ContentData::create(state.styleImage(CSSPropertyConten
t, *item)); | 694 nextContent = ContentData::create(state.styleImage(CSSPropertyConten
t, *item)); |
691 } else if (item->isCounterValue()) { | 695 } else if (item->isCounterValue()) { |
692 const CSSCounterValue* counterValue = toCSSCounterValue(item.get()); | 696 const CSSCounterValue* counterValue = toCSSCounterValue(item.get()); |
693 EListStyleType listStyleType = NoneListStyle; | 697 EListStyleType listStyleType = NoneListStyle; |
694 CSSValueID listStyleIdent = counterValue->listStyle(); | 698 CSSValueID listStyleIdent = counterValue->listStyle(); |
695 if (listStyleIdent != CSSValueNone) | 699 if (listStyleIdent != CSSValueNone) |
696 listStyleType = static_cast<EListStyleType>(listStyleIdent - CSS
ValueDisc); | 700 listStyleType = static_cast<EListStyleType>(listStyleIdent - CSS
ValueDisc); |
697 std::unique_ptr<CounterContent> counter = wrapUnique(new CounterCont
ent(AtomicString(counterValue->identifier()), listStyleType, AtomicString(counte
rValue->separator()))); | 701 std::unique_ptr<CounterContent> counter = wrapUnique(new CounterCont
ent(AtomicString(counterValue->identifier()), listStyleType, AtomicString(counte
rValue->separator()))); |
698 nextContent = ContentData::create(std::move(counter)); | 702 nextContent = ContentData::create(std::move(counter)); |
699 } else if (item->isPrimitiveValue()) { | 703 } else if (item->isIdentifierValue()) { |
700 QuoteType quoteType; | 704 QuoteType quoteType; |
701 switch (toCSSPrimitiveValue(*item).getValueID()) { | 705 switch (toCSSIdentifierValue(*item).getValueID()) { |
702 default: | 706 default: |
703 NOTREACHED(); | 707 NOTREACHED(); |
704 case CSSValueOpenQuote: | 708 case CSSValueOpenQuote: |
705 quoteType = OPEN_QUOTE; | 709 quoteType = OPEN_QUOTE; |
706 break; | 710 break; |
707 case CSSValueCloseQuote: | 711 case CSSValueCloseQuote: |
708 quoteType = CLOSE_QUOTE; | 712 quoteType = CLOSE_QUOTE; |
709 break; | 713 break; |
710 case CSSValueNoOpenQuote: | 714 case CSSValueNoOpenQuote: |
711 quoteType = NO_OPEN_QUOTE; | 715 quoteType = NO_OPEN_QUOTE; |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
745 prevContent->setNext(nextContent); | 749 prevContent->setNext(nextContent); |
746 | 750 |
747 prevContent = nextContent; | 751 prevContent = nextContent; |
748 } | 752 } |
749 DCHECK(firstContent); | 753 DCHECK(firstContent); |
750 state.style()->setContent(firstContent); | 754 state.style()->setContent(firstContent); |
751 } | 755 } |
752 | 756 |
753 void StyleBuilderFunctions::applyValueCSSPropertyWebkitLocale(StyleResolverState
& state, const CSSValue& value) | 757 void StyleBuilderFunctions::applyValueCSSPropertyWebkitLocale(StyleResolverState
& state, const CSSValue& value) |
754 { | 758 { |
755 if (value.isPrimitiveValue()) { | 759 if (value.isIdentifierValue()) { |
756 DCHECK_EQ(toCSSPrimitiveValue(value).getValueID(), CSSValueAuto); | 760 DCHECK_EQ(toCSSIdentifierValue(value).getValueID(), CSSValueAuto); |
757 state.fontBuilder().setLocale(nullptr); | 761 state.fontBuilder().setLocale(nullptr); |
758 } else { | 762 } else { |
759 state.fontBuilder().setLocale(LayoutLocale::get(AtomicString(toCSSString
Value(value).value()))); | 763 state.fontBuilder().setLocale(LayoutLocale::get(AtomicString(toCSSString
Value(value).value()))); |
760 } | 764 } |
761 } | 765 } |
762 | 766 |
763 void StyleBuilderFunctions::applyInitialCSSPropertyWebkitAppRegion(StyleResolver
State&) | 767 void StyleBuilderFunctions::applyInitialCSSPropertyWebkitAppRegion(StyleResolver
State&) |
764 { | 768 { |
765 } | 769 } |
766 | 770 |
767 void StyleBuilderFunctions::applyInheritCSSPropertyWebkitAppRegion(StyleResolver
State&) | 771 void StyleBuilderFunctions::applyInheritCSSPropertyWebkitAppRegion(StyleResolver
State&) |
768 { | 772 { |
769 } | 773 } |
770 | 774 |
771 void StyleBuilderFunctions::applyValueCSSPropertyWebkitAppRegion(StyleResolverSt
ate& state, const CSSValue& value) | 775 void StyleBuilderFunctions::applyValueCSSPropertyWebkitAppRegion(StyleResolverSt
ate& state, const CSSValue& value) |
772 { | 776 { |
773 const CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(value); | 777 const CSSIdentifierValue& identifierValue = toCSSIdentifierValue(value); |
774 state.style()->setDraggableRegionMode(primitiveValue.getValueID() == CSSValu
eDrag ? DraggableRegionDrag : DraggableRegionNoDrag); | 778 state.style()->setDraggableRegionMode(identifierValue.getValueID() == CSSVal
ueDrag ? DraggableRegionDrag : DraggableRegionNoDrag); |
775 state.document().setHasAnnotatedRegions(true); | 779 state.document().setHasAnnotatedRegions(true); |
776 } | 780 } |
777 | 781 |
778 void StyleBuilderFunctions::applyValueCSSPropertyWritingMode(StyleResolverState&
state, const CSSValue& value) | 782 void StyleBuilderFunctions::applyValueCSSPropertyWritingMode(StyleResolverState&
state, const CSSValue& value) |
779 { | 783 { |
780 state.setWritingMode(toCSSPrimitiveValue(value).convertTo<WritingMode>()); | 784 state.setWritingMode(toCSSIdentifierValue(value).convertTo<WritingMode>()); |
781 } | 785 } |
782 | 786 |
783 void StyleBuilderFunctions::applyValueCSSPropertyWebkitWritingMode(StyleResolver
State& state, const CSSValue& value) | 787 void StyleBuilderFunctions::applyValueCSSPropertyWebkitWritingMode(StyleResolver
State& state, const CSSValue& value) |
784 { | 788 { |
785 state.setWritingMode(toCSSPrimitiveValue(value).convertTo<WritingMode>()); | 789 state.setWritingMode(toCSSIdentifierValue(value).convertTo<WritingMode>()); |
786 } | 790 } |
787 | 791 |
788 void StyleBuilderFunctions::applyValueCSSPropertyTextOrientation(StyleResolverSt
ate& state, const CSSValue& value) | 792 void StyleBuilderFunctions::applyValueCSSPropertyTextOrientation(StyleResolverSt
ate& state, const CSSValue& value) |
789 { | 793 { |
790 state.setTextOrientation(toCSSPrimitiveValue(value).convertTo<TextOrientatio
n>()); | 794 state.setTextOrientation(toCSSIdentifierValue(value).convertTo<TextOrientati
on>()); |
791 } | 795 } |
792 | 796 |
793 void StyleBuilderFunctions::applyValueCSSPropertyWebkitTextOrientation(StyleReso
lverState& state, const CSSValue& value) | 797 void StyleBuilderFunctions::applyValueCSSPropertyWebkitTextOrientation(StyleReso
lverState& state, const CSSValue& value) |
794 { | 798 { |
795 state.setTextOrientation(toCSSPrimitiveValue(value).convertTo<TextOrientatio
n>()); | 799 state.setTextOrientation(toCSSIdentifierValue(value).convertTo<TextOrientati
on>()); |
796 } | 800 } |
797 | 801 |
798 void StyleBuilderFunctions::applyValueCSSPropertyVariable(StyleResolverState& st
ate, const CSSValue& value) | 802 void StyleBuilderFunctions::applyValueCSSPropertyVariable(StyleResolverState& st
ate, const CSSValue& value) |
799 { | 803 { |
800 const CSSCustomPropertyDeclaration& declaration = toCSSCustomPropertyDeclara
tion(value); | 804 const CSSCustomPropertyDeclaration& declaration = toCSSCustomPropertyDeclara
tion(value); |
801 const AtomicString& name = declaration.name(); | 805 const AtomicString& name = declaration.name(); |
802 const PropertyRegistry::Registration* registration = nullptr; | 806 const PropertyRegistry::Registration* registration = nullptr; |
803 const PropertyRegistry* registry = state.document().propertyRegistry(); | 807 const PropertyRegistry* registry = state.document().propertyRegistry(); |
804 if (registry) | 808 if (registry) |
805 registration = registry->registration(name); | 809 registration = registry->registration(name); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
853 EBaselineShift baselineShift = parentSvgStyle.baselineShift(); | 857 EBaselineShift baselineShift = parentSvgStyle.baselineShift(); |
854 SVGComputedStyle& svgStyle = state.style()->accessSVGStyle(); | 858 SVGComputedStyle& svgStyle = state.style()->accessSVGStyle(); |
855 svgStyle.setBaselineShift(baselineShift); | 859 svgStyle.setBaselineShift(baselineShift); |
856 if (baselineShift == BS_LENGTH) | 860 if (baselineShift == BS_LENGTH) |
857 svgStyle.setBaselineShiftValue(parentSvgStyle.baselineShiftValue()); | 861 svgStyle.setBaselineShiftValue(parentSvgStyle.baselineShiftValue()); |
858 } | 862 } |
859 | 863 |
860 void StyleBuilderFunctions::applyValueCSSPropertyBaselineShift(StyleResolverStat
e& state, const CSSValue& value) | 864 void StyleBuilderFunctions::applyValueCSSPropertyBaselineShift(StyleResolverStat
e& state, const CSSValue& value) |
861 { | 865 { |
862 SVGComputedStyle& svgStyle = state.style()->accessSVGStyle(); | 866 SVGComputedStyle& svgStyle = state.style()->accessSVGStyle(); |
863 const CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(value); | 867 if (!value.isIdentifierValue()) { |
864 if (!primitiveValue.isValueID()) { | |
865 svgStyle.setBaselineShift(BS_LENGTH); | 868 svgStyle.setBaselineShift(BS_LENGTH); |
866 svgStyle.setBaselineShiftValue(StyleBuilderConverter::convertLength(stat
e, primitiveValue)); | 869 svgStyle.setBaselineShiftValue(StyleBuilderConverter::convertLength(stat
e, toCSSPrimitiveValue(value))); |
867 return; | 870 return; |
868 } | 871 } |
869 switch (primitiveValue.getValueID()) { | 872 switch (toCSSIdentifierValue(value).getValueID()) { |
870 case CSSValueBaseline: | 873 case CSSValueBaseline: |
871 svgStyle.setBaselineShift(BS_LENGTH); | 874 svgStyle.setBaselineShift(BS_LENGTH); |
872 svgStyle.setBaselineShiftValue(Length(Fixed)); | 875 svgStyle.setBaselineShiftValue(Length(Fixed)); |
873 return; | 876 return; |
874 case CSSValueSub: | 877 case CSSValueSub: |
875 svgStyle.setBaselineShift(BS_SUB); | 878 svgStyle.setBaselineShift(BS_SUB); |
876 return; | 879 return; |
877 case CSSValueSuper: | 880 case CSSValueSuper: |
878 svgStyle.setBaselineShift(BS_SUPER); | 881 svgStyle.setBaselineShift(BS_SUPER); |
879 return; | 882 return; |
880 default: | 883 default: |
881 NOTREACHED(); | 884 NOTREACHED(); |
882 } | 885 } |
883 } | 886 } |
884 | 887 |
885 void StyleBuilderFunctions::applyInheritCSSPropertyPosition(StyleResolverState&
state) | 888 void StyleBuilderFunctions::applyInheritCSSPropertyPosition(StyleResolverState&
state) |
886 { | 889 { |
887 if (!state.parentNode()->isDocumentNode()) | 890 if (!state.parentNode()->isDocumentNode()) |
888 state.style()->setPosition(state.parentStyle()->position()); | 891 state.style()->setPosition(state.parentStyle()->position()); |
889 } | 892 } |
890 | 893 |
891 } // namespace blink | 894 } // namespace blink |
OLD | NEW |