| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc.
All rights reserved. | 3 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc.
All rights reserved. |
| 4 * Copyright (C) 2013 Google Inc. All rights reserved. | 4 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 5 * | 5 * |
| 6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
| 7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
| 8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
| 9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
| 10 * | 10 * |
| (...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 374 scope.fontDescription().setWeight(scope.fontDescription().lighterWeight()); | 374 scope.fontDescription().setWeight(scope.fontDescription().lighterWeight()); |
| 375 } | 375 } |
| 376 | 376 |
| 377 void FontBuilder::setStretch(FontStretch fontStretch) | 377 void FontBuilder::setStretch(FontStretch fontStretch) |
| 378 { | 378 { |
| 379 FontDescriptionChangeScope scope(this); | 379 FontDescriptionChangeScope scope(this); |
| 380 | 380 |
| 381 scope.fontDescription().setStretch(fontStretch); | 381 scope.fontDescription().setStretch(fontStretch); |
| 382 } | 382 } |
| 383 | 383 |
| 384 void FontBuilder::setFontVariantLigaturesInitial() | |
| 385 { | |
| 386 FontDescriptionChangeScope scope(this); | |
| 387 | |
| 388 scope.fontDescription().setCommonLigaturesState(FontDescription::NormalLigat
uresState); | |
| 389 scope.fontDescription().setDiscretionaryLigaturesState(FontDescription::Norm
alLigaturesState); | |
| 390 scope.fontDescription().setHistoricalLigaturesState(FontDescription::NormalL
igaturesState); | |
| 391 scope.fontDescription().setContextualLigaturesState(FontDescription::NormalL
igaturesState); | |
| 392 } | |
| 393 | |
| 394 void FontBuilder::setFontVariantLigaturesInherit(const FontDescription& parentFo
ntDescription) | |
| 395 { | |
| 396 FontDescriptionChangeScope scope(this); | |
| 397 | |
| 398 scope.fontDescription().setCommonLigaturesState(parentFontDescription.common
LigaturesState()); | |
| 399 scope.fontDescription().setDiscretionaryLigaturesState(parentFontDescription
.discretionaryLigaturesState()); | |
| 400 scope.fontDescription().setHistoricalLigaturesState(parentFontDescription.hi
storicalLigaturesState()); | |
| 401 scope.fontDescription().setContextualLigaturesState(parentFontDescription.hi
storicalLigaturesState()); | |
| 402 } | |
| 403 | |
| 404 void FontBuilder::setFontVariantLigaturesValue(CSSValue* value) | |
| 405 { | |
| 406 FontDescriptionChangeScope scope(this); | |
| 407 | |
| 408 FontDescription::LigaturesState commonLigaturesState = FontDescription::Norm
alLigaturesState; | |
| 409 FontDescription::LigaturesState discretionaryLigaturesState = FontDescriptio
n::NormalLigaturesState; | |
| 410 FontDescription::LigaturesState historicalLigaturesState = FontDescription::
NormalLigaturesState; | |
| 411 FontDescription::LigaturesState contextualLigaturesState = FontDescription::
NormalLigaturesState; | |
| 412 | |
| 413 if (value->isValueList()) { | |
| 414 CSSValueList* valueList = toCSSValueList(value); | |
| 415 for (size_t i = 0; i < valueList->length(); ++i) { | |
| 416 CSSValue* item = valueList->item(i); | |
| 417 ASSERT(item->isPrimitiveValue()); | |
| 418 if (item->isPrimitiveValue()) { | |
| 419 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(item); | |
| 420 switch (primitiveValue->getValueID()) { | |
| 421 case CSSValueNoCommonLigatures: | |
| 422 commonLigaturesState = FontDescription::DisabledLigaturesSta
te; | |
| 423 break; | |
| 424 case CSSValueCommonLigatures: | |
| 425 commonLigaturesState = FontDescription::EnabledLigaturesStat
e; | |
| 426 break; | |
| 427 case CSSValueNoDiscretionaryLigatures: | |
| 428 discretionaryLigaturesState = FontDescription::DisabledLigat
uresState; | |
| 429 break; | |
| 430 case CSSValueDiscretionaryLigatures: | |
| 431 discretionaryLigaturesState = FontDescription::EnabledLigatu
resState; | |
| 432 break; | |
| 433 case CSSValueNoHistoricalLigatures: | |
| 434 historicalLigaturesState = FontDescription::DisabledLigature
sState; | |
| 435 break; | |
| 436 case CSSValueHistoricalLigatures: | |
| 437 historicalLigaturesState = FontDescription::EnabledLigatures
State; | |
| 438 break; | |
| 439 case CSSValueNoContextual: | |
| 440 contextualLigaturesState = FontDescription::DisabledLigature
sState; | |
| 441 break; | |
| 442 case CSSValueContextual: | |
| 443 contextualLigaturesState = FontDescription::EnabledLigatures
State; | |
| 444 break; | |
| 445 default: | |
| 446 ASSERT_NOT_REACHED(); | |
| 447 break; | |
| 448 } | |
| 449 } | |
| 450 } | |
| 451 } | |
| 452 #if ENABLE(ASSERT) | |
| 453 else { | |
| 454 ASSERT_WITH_SECURITY_IMPLICATION(value->isPrimitiveValue()); | |
| 455 ASSERT(toCSSPrimitiveValue(value)->getValueID() == CSSValueNormal); | |
| 456 } | |
| 457 #endif | |
| 458 | |
| 459 scope.fontDescription().setCommonLigaturesState(commonLigaturesState); | |
| 460 scope.fontDescription().setDiscretionaryLigaturesState(discretionaryLigature
sState); | |
| 461 scope.fontDescription().setHistoricalLigaturesState(historicalLigaturesState
); | |
| 462 scope.fontDescription().setContextualLigaturesState(contextualLigaturesState
); | |
| 463 } | |
| 464 | |
| 465 void FontBuilder::setScript(const String& locale) | 384 void FontBuilder::setScript(const String& locale) |
| 466 { | 385 { |
| 467 FontDescriptionChangeScope scope(this); | 386 FontDescriptionChangeScope scope(this); |
| 468 | 387 |
| 469 scope.fontDescription().setLocale(locale); | 388 scope.fontDescription().setLocale(locale); |
| 470 scope.fontDescription().setScript(localeToScriptCodeForFontSelection(locale)
); | 389 scope.fontDescription().setScript(localeToScriptCodeForFontSelection(locale)
); |
| 471 } | 390 } |
| 472 | 391 |
| 473 void FontBuilder::setStyle(FontStyle italic) | 392 void FontBuilder::setStyle(FontStyle italic) |
| 474 { | 393 { |
| 475 FontDescriptionChangeScope scope(this); | 394 FontDescriptionChangeScope scope(this); |
| 476 | 395 |
| 477 scope.fontDescription().setStyle(italic); | 396 scope.fontDescription().setStyle(italic); |
| 478 } | 397 } |
| 479 | 398 |
| 480 void FontBuilder::setVariant(FontVariant smallCaps) | 399 void FontBuilder::setVariant(FontVariant smallCaps) |
| 481 { | 400 { |
| 482 FontDescriptionChangeScope scope(this); | 401 FontDescriptionChangeScope scope(this); |
| 483 | 402 |
| 484 scope.fontDescription().setVariant(smallCaps); | 403 scope.fontDescription().setVariant(smallCaps); |
| 485 } | 404 } |
| 486 | 405 |
| 406 void FontBuilder::setVariantLigatures(const FontDescription::VariantLigatures& l
igatures) |
| 407 { |
| 408 FontDescriptionChangeScope scope(this); |
| 409 |
| 410 scope.fontDescription().setVariantLigatures(ligatures); |
| 411 } |
| 412 |
| 487 void FontBuilder::setTextRendering(TextRenderingMode textRenderingMode) | 413 void FontBuilder::setTextRendering(TextRenderingMode textRenderingMode) |
| 488 { | 414 { |
| 489 FontDescriptionChangeScope scope(this); | 415 FontDescriptionChangeScope scope(this); |
| 490 | 416 |
| 491 scope.fontDescription().setTextRendering(textRenderingMode); | 417 scope.fontDescription().setTextRendering(textRenderingMode); |
| 492 } | 418 } |
| 493 | 419 |
| 494 void FontBuilder::setKerning(FontDescription::Kerning kerning) | 420 void FontBuilder::setKerning(FontDescription::Kerning kerning) |
| 495 { | 421 { |
| 496 FontDescriptionChangeScope scope(this); | 422 FontDescriptionChangeScope scope(this); |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 670 FontOrientation fontOrientation; | 596 FontOrientation fontOrientation; |
| 671 NonCJKGlyphOrientation glyphOrientation; | 597 NonCJKGlyphOrientation glyphOrientation; |
| 672 getFontAndGlyphOrientation(documentStyle, fontOrientation, glyphOrientation)
; | 598 getFontAndGlyphOrientation(documentStyle, fontOrientation, glyphOrientation)
; |
| 673 fontDescription.setOrientation(fontOrientation); | 599 fontDescription.setOrientation(fontOrientation); |
| 674 fontDescription.setNonCJKGlyphOrientation(glyphOrientation); | 600 fontDescription.setNonCJKGlyphOrientation(glyphOrientation); |
| 675 documentStyle->setFontDescription(fontDescription); | 601 documentStyle->setFontDescription(fontDescription); |
| 676 documentStyle->font().update(fontSelector); | 602 documentStyle->font().update(fontSelector); |
| 677 } | 603 } |
| 678 | 604 |
| 679 } | 605 } |
| OLD | NEW |