| 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 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 348 if (value.isNull()) | 348 if (value.isNull()) |
| 349 return nullptr; | 349 return nullptr; |
| 350 CSSValueID size; | 350 CSSValueID size; |
| 351 if (!HTMLFontElement::cssValueFromFontSizeNumber(value, size)) | 351 if (!HTMLFontElement::cssValueFromFontSizeNumber(value, size)) |
| 352 return nullptr; | 352 return nullptr; |
| 353 return CSSPrimitiveValue::createIdentifier(size); | 353 return CSSPrimitiveValue::createIdentifier(size); |
| 354 } | 354 } |
| 355 | 355 |
| 356 float EditingStyle::NoFontDelta = 0.0f; | 356 float EditingStyle::NoFontDelta = 0.0f; |
| 357 | 357 |
| 358 EditingStyle::EditingStyle() | |
| 359 : m_isMonospaceFont(false) | |
| 360 , m_fontSizeDelta(NoFontDelta) | |
| 361 { | |
| 362 } | |
| 363 | |
| 364 EditingStyle::EditingStyle(ContainerNode* node, PropertiesToInclude propertiesTo
Include) | 358 EditingStyle::EditingStyle(ContainerNode* node, PropertiesToInclude propertiesTo
Include) |
| 365 : m_isMonospaceFont(false) | |
| 366 , m_fontSizeDelta(NoFontDelta) | |
| 367 { | 359 { |
| 368 init(node, propertiesToInclude); | 360 init(node, propertiesToInclude); |
| 369 } | 361 } |
| 370 | 362 |
| 371 EditingStyle::EditingStyle(const Position& position, PropertiesToInclude propert
iesToInclude) | 363 EditingStyle::EditingStyle(const Position& position, PropertiesToInclude propert
iesToInclude) |
| 372 : m_isMonospaceFont(false) | |
| 373 , m_fontSizeDelta(NoFontDelta) | |
| 374 { | 364 { |
| 375 init(position.anchorNode(), propertiesToInclude); | 365 init(position.anchorNode(), propertiesToInclude); |
| 376 } | 366 } |
| 377 | 367 |
| 378 EditingStyle::EditingStyle(const StylePropertySet* style) | 368 EditingStyle::EditingStyle(const StylePropertySet* style) |
| 379 : m_mutableStyle(style ? style->mutableCopy() : nullptr) | 369 : m_mutableStyle(style ? style->mutableCopy() : nullptr) |
| 380 , m_isMonospaceFont(false) | |
| 381 , m_fontSizeDelta(NoFontDelta) | |
| 382 { | 370 { |
| 383 extractFontSizeDelta(); | 371 extractFontSizeDelta(); |
| 384 } | 372 } |
| 385 | 373 |
| 386 EditingStyle::EditingStyle(CSSPropertyID propertyID, const String& value) | 374 EditingStyle::EditingStyle(CSSPropertyID propertyID, const String& value) |
| 387 : m_mutableStyle(nullptr) | 375 : m_mutableStyle(nullptr) |
| 388 , m_isMonospaceFont(false) | |
| 389 , m_fontSizeDelta(NoFontDelta) | |
| 390 { | 376 { |
| 391 setProperty(propertyID, value); | 377 setProperty(propertyID, value); |
| 392 m_isVerticalAlign = propertyID == CSSPropertyVerticalAlign && (value == "sub
" || value == "super"); | 378 m_isVerticalAlign = propertyID == CSSPropertyVerticalAlign && (value == "sub
" || value == "super"); |
| 393 } | 379 } |
| 394 | 380 |
| 395 static Color cssValueToColor(CSSValue* colorValue) | 381 static Color cssValueToColor(CSSValue* colorValue) |
| 396 { | 382 { |
| 397 if (!colorValue || (!colorValue->isColorValue() && !colorValue->isPrimitiveV
alue())) | 383 if (!colorValue || (!colorValue->isColorValue() && !colorValue->isPrimitiveV
alue())) |
| 398 return Color::transparent; | 384 return Color::transparent; |
| 399 | 385 |
| (...skipping 1364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1764 { | 1750 { |
| 1765 for (Node* ancestor = node; ancestor; ancestor = ancestor->parentNode()) { | 1751 for (Node* ancestor = node; ancestor; ancestor = ancestor->parentNode()) { |
| 1766 CSSComputedStyleDeclaration* ancestorStyle = CSSComputedStyleDeclaration
::create(ancestor); | 1752 CSSComputedStyleDeclaration* ancestorStyle = CSSComputedStyleDeclaration
::create(ancestor); |
| 1767 if (!hasTransparentBackgroundColor(ancestorStyle)) | 1753 if (!hasTransparentBackgroundColor(ancestorStyle)) |
| 1768 return ancestorStyle->getPropertyCSSValue(CSSPropertyBackgroundColor
); | 1754 return ancestorStyle->getPropertyCSSValue(CSSPropertyBackgroundColor
); |
| 1769 } | 1755 } |
| 1770 return nullptr; | 1756 return nullptr; |
| 1771 } | 1757 } |
| 1772 | 1758 |
| 1773 } // namespace blink | 1759 } // namespace blink |
| OLD | NEW |