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