| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007, 2008, 2009 Apple Computer, Inc. | 2 * Copyright (C) 2007, 2008, 2009 Apple Computer, Inc. |
| 3 * Copyright (C) 2010, 2011 Google Inc. All rights reserved. | 3 * Copyright (C) 2010, 2011 Google Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 340 return nullptr; | 340 return nullptr; |
| 341 CSSValueID size; | 341 CSSValueID size; |
| 342 if (!HTMLFontElement::cssValueFromFontSizeNumber(value, size)) | 342 if (!HTMLFontElement::cssValueFromFontSizeNumber(value, size)) |
| 343 return nullptr; | 343 return nullptr; |
| 344 return CSSPrimitiveValue::createIdentifier(size); | 344 return CSSPrimitiveValue::createIdentifier(size); |
| 345 } | 345 } |
| 346 | 346 |
| 347 float EditingStyle::NoFontDelta = 0.0f; | 347 float EditingStyle::NoFontDelta = 0.0f; |
| 348 | 348 |
| 349 EditingStyle::EditingStyle() | 349 EditingStyle::EditingStyle() |
| 350 : m_fixedPitchFontType(NonFixedPitchFont) | 350 : m_fixedPitchFontType(VariablePitchFont) |
| 351 , m_fontSizeDelta(NoFontDelta) | 351 , m_fontSizeDelta(NoFontDelta) |
| 352 { | 352 { |
| 353 } | 353 } |
| 354 | 354 |
| 355 EditingStyle::EditingStyle(ContainerNode* node, PropertiesToInclude propertiesTo
Include) | 355 EditingStyle::EditingStyle(ContainerNode* node, PropertiesToInclude propertiesTo
Include) |
| 356 : m_fixedPitchFontType(NonFixedPitchFont) | 356 : m_fixedPitchFontType(VariablePitchFont) |
| 357 , m_fontSizeDelta(NoFontDelta) | 357 , m_fontSizeDelta(NoFontDelta) |
| 358 { | 358 { |
| 359 init(node, propertiesToInclude); | 359 init(node, propertiesToInclude); |
| 360 } | 360 } |
| 361 | 361 |
| 362 EditingStyle::EditingStyle(const Position& position, PropertiesToInclude propert
iesToInclude) | 362 EditingStyle::EditingStyle(const Position& position, PropertiesToInclude propert
iesToInclude) |
| 363 : m_fixedPitchFontType(NonFixedPitchFont) | 363 : m_fixedPitchFontType(VariablePitchFont) |
| 364 , m_fontSizeDelta(NoFontDelta) | 364 , m_fontSizeDelta(NoFontDelta) |
| 365 { | 365 { |
| 366 init(position.deprecatedNode(), propertiesToInclude); | 366 init(position.deprecatedNode(), propertiesToInclude); |
| 367 } | 367 } |
| 368 | 368 |
| 369 EditingStyle::EditingStyle(const StylePropertySet* style) | 369 EditingStyle::EditingStyle(const StylePropertySet* style) |
| 370 : m_mutableStyle(style ? style->mutableCopy() : nullptr) | 370 : m_mutableStyle(style ? style->mutableCopy() : nullptr) |
| 371 , m_fixedPitchFontType(NonFixedPitchFont) | 371 , m_fixedPitchFontType(VariablePitchFont) |
| 372 , m_fontSizeDelta(NoFontDelta) | 372 , m_fontSizeDelta(NoFontDelta) |
| 373 { | 373 { |
| 374 extractFontSizeDelta(); | 374 extractFontSizeDelta(); |
| 375 } | 375 } |
| 376 | 376 |
| 377 EditingStyle::EditingStyle(CSSPropertyID propertyID, const String& value) | 377 EditingStyle::EditingStyle(CSSPropertyID propertyID, const String& value) |
| 378 : m_mutableStyle(nullptr) | 378 : m_mutableStyle(nullptr) |
| 379 , m_fixedPitchFontType(NonFixedPitchFont) | 379 , m_fixedPitchFontType(VariablePitchFont) |
| 380 , m_fontSizeDelta(NoFontDelta) | 380 , m_fontSizeDelta(NoFontDelta) |
| 381 { | 381 { |
| 382 setProperty(propertyID, value); | 382 setProperty(propertyID, value); |
| 383 } | 383 } |
| 384 | 384 |
| 385 EditingStyle::~EditingStyle() | 385 EditingStyle::~EditingStyle() |
| 386 { | 386 { |
| 387 } | 387 } |
| 388 | 388 |
| 389 static RGBA32 cssValueToRGBA(CSSValue* colorValue) | 389 static RGBA32 cssValueToRGBA(CSSValue* colorValue) |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 573 return; | 573 return; |
| 574 if (!m_mutableStyle) | 574 if (!m_mutableStyle) |
| 575 m_mutableStyle = MutableStylePropertySet::create(); | 575 m_mutableStyle = MutableStylePropertySet::create(); |
| 576 m_mutableStyle->mergeAndOverrideOnConflict(style); | 576 m_mutableStyle->mergeAndOverrideOnConflict(style); |
| 577 extractFontSizeDelta(); | 577 extractFontSizeDelta(); |
| 578 } | 578 } |
| 579 | 579 |
| 580 void EditingStyle::clear() | 580 void EditingStyle::clear() |
| 581 { | 581 { |
| 582 m_mutableStyle.clear(); | 582 m_mutableStyle.clear(); |
| 583 m_fixedPitchFontType = NonFixedPitchFont; | 583 m_fixedPitchFontType = VariablePitchFont; |
| 584 m_fontSizeDelta = NoFontDelta; | 584 m_fontSizeDelta = NoFontDelta; |
| 585 } | 585 } |
| 586 | 586 |
| 587 PassRefPtrWillBeRawPtr<EditingStyle> EditingStyle::copy() const | 587 PassRefPtrWillBeRawPtr<EditingStyle> EditingStyle::copy() const |
| 588 { | 588 { |
| 589 RefPtrWillBeRawPtr<EditingStyle> copy = EditingStyle::create(); | 589 RefPtrWillBeRawPtr<EditingStyle> copy = EditingStyle::create(); |
| 590 if (m_mutableStyle) | 590 if (m_mutableStyle) |
| 591 copy->m_mutableStyle = m_mutableStyle->mutableCopy(); | 591 copy->m_mutableStyle = m_mutableStyle->mutableCopy(); |
| 592 copy->m_fixedPitchFontType = m_fixedPitchFontType; | 592 copy->m_fixedPitchFontType = m_fixedPitchFontType; |
| 593 copy->m_fontSizeDelta = m_fontSizeDelta; | 593 copy->m_fontSizeDelta = m_fontSizeDelta; |
| (...skipping 1085 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1679 { | 1679 { |
| 1680 for (Node* ancestor = node; ancestor; ancestor = ancestor->parentNode()) { | 1680 for (Node* ancestor = node; ancestor; ancestor = ancestor->parentNode()) { |
| 1681 RefPtrWillBeRawPtr<CSSComputedStyleDeclaration> ancestorStyle = CSSCompu
tedStyleDeclaration::create(ancestor); | 1681 RefPtrWillBeRawPtr<CSSComputedStyleDeclaration> ancestorStyle = CSSCompu
tedStyleDeclaration::create(ancestor); |
| 1682 if (!hasTransparentBackgroundColor(ancestorStyle.get())) | 1682 if (!hasTransparentBackgroundColor(ancestorStyle.get())) |
| 1683 return ancestorStyle->getPropertyCSSValue(CSSPropertyBackgroundColor
); | 1683 return ancestorStyle->getPropertyCSSValue(CSSPropertyBackgroundColor
); |
| 1684 } | 1684 } |
| 1685 return nullptr; | 1685 return nullptr; |
| 1686 } | 1686 } |
| 1687 | 1687 |
| 1688 } | 1688 } |
| OLD | NEW |