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 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 HTMLFontSizeEquivalent::HTMLFontSizeEquivalent() | 299 HTMLFontSizeEquivalent::HTMLFontSizeEquivalent() |
300 : HTMLAttributeEquivalent(CSSPropertyFontSize, HTMLNames::fontTag, HTMLNames
::sizeAttr) | 300 : HTMLAttributeEquivalent(CSSPropertyFontSize, HTMLNames::fontTag, HTMLNames
::sizeAttr) |
301 { | 301 { |
302 } | 302 } |
303 | 303 |
304 PassRefPtr<CSSValue> HTMLFontSizeEquivalent::attributeValueAsCSSValue(Element* e
lement) const | 304 PassRefPtr<CSSValue> HTMLFontSizeEquivalent::attributeValueAsCSSValue(Element* e
lement) const |
305 { | 305 { |
306 ASSERT(element); | 306 ASSERT(element); |
307 if (!element->hasAttribute(m_attrName)) | 307 if (!element->hasAttribute(m_attrName)) |
308 return 0; | 308 return 0; |
309 int size; | 309 CSSValueID size; |
310 if (!HTMLFontElement::cssValueFromFontSizeNumber(element->getAttribute(m_att
rName), size)) | 310 if (!HTMLFontElement::cssValueFromFontSizeNumber(element->getAttribute(m_att
rName), size)) |
311 return 0; | 311 return 0; |
312 return CSSPrimitiveValue::createIdentifier(size); | 312 return CSSPrimitiveValue::createIdentifier(size); |
313 } | 313 } |
314 | 314 |
315 float EditingStyle::NoFontDelta = 0.0f; | 315 float EditingStyle::NoFontDelta = 0.0f; |
316 | 316 |
317 EditingStyle::EditingStyle() | 317 EditingStyle::EditingStyle() |
318 : m_shouldUseFixedDefaultFontSize(false) | 318 : m_shouldUseFixedDefaultFontSize(false) |
319 , m_fontSizeDelta(NoFontDelta) | 319 , m_fontSizeDelta(NoFontDelta) |
(...skipping 626 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
946 m_mutableStyle->removeProperty(CSSPropertyTextAlign); | 946 m_mutableStyle->removeProperty(CSSPropertyTextAlign); |
947 | 947 |
948 if (getRGBAFontColor(m_mutableStyle.get()) == getRGBAFontColor(styleAtPositi
on)) | 948 if (getRGBAFontColor(m_mutableStyle.get()) == getRGBAFontColor(styleAtPositi
on)) |
949 m_mutableStyle->removeProperty(CSSPropertyColor); | 949 m_mutableStyle->removeProperty(CSSPropertyColor); |
950 | 950 |
951 if (hasTransparentBackgroundColor(m_mutableStyle.get()) | 951 if (hasTransparentBackgroundColor(m_mutableStyle.get()) |
952 || cssValueToRGBA(m_mutableStyle->getPropertyCSSValue(CSSPropertyBackgro
undColor).get()) == rgbaBackgroundColorInEffect(position.containerNode())) | 952 || cssValueToRGBA(m_mutableStyle->getPropertyCSSValue(CSSPropertyBackgro
undColor).get()) == rgbaBackgroundColorInEffect(position.containerNode())) |
953 m_mutableStyle->removeProperty(CSSPropertyBackgroundColor); | 953 m_mutableStyle->removeProperty(CSSPropertyBackgroundColor); |
954 | 954 |
955 if (unicodeBidi && unicodeBidi->isPrimitiveValue()) { | 955 if (unicodeBidi && unicodeBidi->isPrimitiveValue()) { |
956 m_mutableStyle->setProperty(CSSPropertyUnicodeBidi, static_cast<CSSPrimi
tiveValue*>(unicodeBidi.get())->getIdent()); | 956 m_mutableStyle->setProperty(CSSPropertyUnicodeBidi, static_cast<CSSValue
ID>(toCSSPrimitiveValue(unicodeBidi.get())->getIdent())); |
957 if (direction && direction->isPrimitiveValue()) | 957 if (direction && direction->isPrimitiveValue()) |
958 m_mutableStyle->setProperty(CSSPropertyDirection, static_cast<CSSPri
mitiveValue*>(direction.get())->getIdent()); | 958 m_mutableStyle->setProperty(CSSPropertyDirection, static_cast<CSSVal
ueID>(toCSSPrimitiveValue(direction.get())->getIdent())); |
959 } | 959 } |
960 } | 960 } |
961 | 961 |
962 void EditingStyle::mergeTypingStyle(Document* document) | 962 void EditingStyle::mergeTypingStyle(Document* document) |
963 { | 963 { |
964 ASSERT(document); | 964 ASSERT(document); |
965 | 965 |
966 RefPtr<EditingStyle> typingStyle = document->frame()->selection()->typingSty
le(); | 966 RefPtr<EditingStyle> typingStyle = document->frame()->selection()->typingSty
le(); |
967 if (!typingStyle || typingStyle == this) | 967 if (!typingStyle || typingStyle == this) |
968 return; | 968 return; |
(...skipping 646 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1615 { | 1615 { |
1616 for (Node* ancestor = node; ancestor; ancestor = ancestor->parentNode()) { | 1616 for (Node* ancestor = node; ancestor; ancestor = ancestor->parentNode()) { |
1617 RefPtr<CSSComputedStyleDeclaration> ancestorStyle = CSSComputedStyleDecl
aration::create(ancestor); | 1617 RefPtr<CSSComputedStyleDeclaration> ancestorStyle = CSSComputedStyleDecl
aration::create(ancestor); |
1618 if (!hasTransparentBackgroundColor(ancestorStyle.get())) | 1618 if (!hasTransparentBackgroundColor(ancestorStyle.get())) |
1619 return ancestorStyle->getPropertyCSSValue(CSSPropertyBackgroundColor
); | 1619 return ancestorStyle->getPropertyCSSValue(CSSPropertyBackgroundColor
); |
1620 } | 1620 } |
1621 return 0; | 1621 return 0; |
1622 } | 1622 } |
1623 | 1623 |
1624 } | 1624 } |
OLD | NEW |