| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2005, 2006, 2008, 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2005, 2006, 2008, 2009 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 410 element = span.release(); | 410 element = span.release(); |
| 411 } else { | 411 } else { |
| 412 // Only handle HTML elements and text nodes. | 412 // Only handle HTML elements and text nodes. |
| 413 continue; | 413 continue; |
| 414 } | 414 } |
| 415 lastStyledNode = node; | 415 lastStyledNode = node; |
| 416 | 416 |
| 417 RefPtrWillBeRawPtr<MutableStylePropertySet> inlineStyle = copyStyleOrCre
ateEmpty(element->inlineStyle()); | 417 RefPtrWillBeRawPtr<MutableStylePropertySet> inlineStyle = copyStyleOrCre
ateEmpty(element->inlineStyle()); |
| 418 float currentFontSize = computedFontSize(node); | 418 float currentFontSize = computedFontSize(node); |
| 419 float desiredFontSize = max(MinimumFontSize, startingFontSizes.get(node)
+ style->fontSizeDelta()); | 419 float desiredFontSize = max(MinimumFontSize, startingFontSizes.get(node)
+ style->fontSizeDelta()); |
| 420 RefPtrWillBeRawPtr<CSSValue> value = inlineStyle->getPropertyCSSValue(CS
SPropertyFontSize); | 420 RefPtr<CSSValue> value = inlineStyle->getPropertyCSSValue(CSSPropertyFon
tSize); |
| 421 if (value) { | 421 if (value) { |
| 422 element->removeInlineStyleProperty(CSSPropertyFontSize); | 422 element->removeInlineStyleProperty(CSSPropertyFontSize); |
| 423 currentFontSize = computedFontSize(node); | 423 currentFontSize = computedFontSize(node); |
| 424 } | 424 } |
| 425 if (currentFontSize != desiredFontSize) { | 425 if (currentFontSize != desiredFontSize) { |
| 426 inlineStyle->setProperty(CSSPropertyFontSize, cssValuePool().createV
alue(desiredFontSize, CSSPrimitiveValue::UnitType::Pixels), false); | 426 inlineStyle->setProperty(CSSPropertyFontSize, cssValuePool().createV
alue(desiredFontSize, CSSPrimitiveValue::UnitType::Pixels), false); |
| 427 setNodeAttribute(element.get(), styleAttr, AtomicString(inlineStyle-
>asText())); | 427 setNodeAttribute(element.get(), styleAttr, AtomicString(inlineStyle-
>asText())); |
| 428 } | 428 } |
| 429 if (inlineStyle->isEmpty()) { | 429 if (inlineStyle->isEmpty()) { |
| 430 removeElementAttribute(element.get(), styleAttr); | 430 removeElementAttribute(element.get(), styleAttr); |
| (...skipping 1109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1540 | 1540 |
| 1541 float ApplyStyleCommand::computedFontSize(Node* node) | 1541 float ApplyStyleCommand::computedFontSize(Node* node) |
| 1542 { | 1542 { |
| 1543 if (!node) | 1543 if (!node) |
| 1544 return 0; | 1544 return 0; |
| 1545 | 1545 |
| 1546 RefPtrWillBeRawPtr<CSSComputedStyleDeclaration> style = CSSComputedStyleDecl
aration::create(node); | 1546 RefPtrWillBeRawPtr<CSSComputedStyleDeclaration> style = CSSComputedStyleDecl
aration::create(node); |
| 1547 if (!style) | 1547 if (!style) |
| 1548 return 0; | 1548 return 0; |
| 1549 | 1549 |
| 1550 RefPtrWillBeRawPtr<CSSPrimitiveValue> value = static_pointer_cast<CSSPrimiti
veValue>(style->getPropertyCSSValue(CSSPropertyFontSize)); | 1550 RefPtr<CSSPrimitiveValue> value = static_pointer_cast<CSSPrimitiveValue>(sty
le->getPropertyCSSValue(CSSPropertyFontSize)); |
| 1551 if (!value) | 1551 if (!value) |
| 1552 return 0; | 1552 return 0; |
| 1553 | 1553 |
| 1554 ASSERT(value->typeWithCalcResolved() == CSSPrimitiveValue::UnitType::Pixels)
; | 1554 ASSERT(value->typeWithCalcResolved() == CSSPrimitiveValue::UnitType::Pixels)
; |
| 1555 return value->getFloatValue(); | 1555 return value->getFloatValue(); |
| 1556 } | 1556 } |
| 1557 | 1557 |
| 1558 void ApplyStyleCommand::joinChildTextNodes(ContainerNode* node, const Position&
start, const Position& end) | 1558 void ApplyStyleCommand::joinChildTextNodes(ContainerNode* node, const Position&
start, const Position& end) |
| 1559 { | 1559 { |
| 1560 if (!node) | 1560 if (!node) |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1594 DEFINE_TRACE(ApplyStyleCommand) | 1594 DEFINE_TRACE(ApplyStyleCommand) |
| 1595 { | 1595 { |
| 1596 visitor->trace(m_style); | 1596 visitor->trace(m_style); |
| 1597 visitor->trace(m_start); | 1597 visitor->trace(m_start); |
| 1598 visitor->trace(m_end); | 1598 visitor->trace(m_end); |
| 1599 visitor->trace(m_styledInlineElement); | 1599 visitor->trace(m_styledInlineElement); |
| 1600 CompositeEditCommand::trace(visitor); | 1600 CompositeEditCommand::trace(visitor); |
| 1601 } | 1601 } |
| 1602 | 1602 |
| 1603 } | 1603 } |
| OLD | NEW |