| 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 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 } | 189 } |
| 190 | 190 |
| 191 HTMLElementEquivalent::HTMLElementEquivalent(CSSPropertyID id, const HTMLQualifi
edName& tagName) | 191 HTMLElementEquivalent::HTMLElementEquivalent(CSSPropertyID id, const HTMLQualifi
edName& tagName) |
| 192 : m_propertyID(id) | 192 : m_propertyID(id) |
| 193 , m_tagName(&tagName) | 193 , m_tagName(&tagName) |
| 194 { | 194 { |
| 195 } | 195 } |
| 196 | 196 |
| 197 HTMLElementEquivalent::HTMLElementEquivalent(CSSPropertyID id, CSSValueID primit
iveValue, const HTMLQualifiedName& tagName) | 197 HTMLElementEquivalent::HTMLElementEquivalent(CSSPropertyID id, CSSValueID primit
iveValue, const HTMLQualifiedName& tagName) |
| 198 : m_propertyID(id) | 198 : m_propertyID(id) |
| 199 , m_primitiveValue(CSSPrimitiveValue::createIdentifier(primitiveValue)) | 199 , m_primitiveValue(CSSPrimitiveValue::create(primitiveValue)) |
| 200 , m_tagName(&tagName) | 200 , m_tagName(&tagName) |
| 201 { | 201 { |
| 202 ASSERT(primitiveValue != CSSValueInvalid); | 202 ASSERT(primitiveValue != CSSValueInvalid); |
| 203 } | 203 } |
| 204 | 204 |
| 205 bool HTMLElementEquivalent::valueIsPresentInStyle(HTMLElement* element, StylePro
pertySet* style) const | 205 bool HTMLElementEquivalent::valueIsPresentInStyle(HTMLElement* element, StylePro
pertySet* style) const |
| 206 { | 206 { |
| 207 RefPtrWillBeRawPtr<CSSValue> value = style->getPropertyCSSValue(m_propertyID
); | 207 RefPtrWillBeRawPtr<CSSValue> value = style->getPropertyCSSValue(m_propertyID
); |
| 208 return matches(element) && value && value->isPrimitiveValue() && toCSSPrimit
iveValue(value.get())->getValueID() == m_primitiveValue->getValueID(); | 208 return matches(element) && value && value->isPrimitiveValue() && toCSSPrimit
iveValue(value.get())->getValueID() == m_primitiveValue->getValueID(); |
| 209 } | 209 } |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 334 | 334 |
| 335 PassRefPtrWillBeRawPtr<CSSValue> HTMLFontSizeEquivalent::attributeValueAsCSSValu
e(Element* element) const | 335 PassRefPtrWillBeRawPtr<CSSValue> HTMLFontSizeEquivalent::attributeValueAsCSSValu
e(Element* element) const |
| 336 { | 336 { |
| 337 ASSERT(element); | 337 ASSERT(element); |
| 338 const AtomicString& value = element->getAttribute(m_attrName); | 338 const AtomicString& value = element->getAttribute(m_attrName); |
| 339 if (value.isNull()) | 339 if (value.isNull()) |
| 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::create(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_isMonospaceFont(false) | 350 : m_isMonospaceFont(false) |
| 351 , m_fontSizeDelta(NoFontDelta) | 351 , m_fontSizeDelta(NoFontDelta) |
| 352 { | 352 { |
| 353 } | 353 } |
| 354 | 354 |
| (...skipping 762 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1117 wrappingStyle->mergeInlineAndImplicitStyleOfElement(toElement(node),
EditingStyle::DoNotOverrideValues, | 1117 wrappingStyle->mergeInlineAndImplicitStyleOfElement(toElement(node),
EditingStyle::DoNotOverrideValues, |
| 1118 EditingStyle::EditingPropertiesInEffect); | 1118 EditingStyle::EditingPropertiesInEffect); |
| 1119 } | 1119 } |
| 1120 } | 1120 } |
| 1121 | 1121 |
| 1122 return wrappingStyle.release(); | 1122 return wrappingStyle.release(); |
| 1123 } | 1123 } |
| 1124 | 1124 |
| 1125 static void mergeTextDecorationValues(CSSValueList* mergedValue, const CSSValueL
ist* valueToMerge) | 1125 static void mergeTextDecorationValues(CSSValueList* mergedValue, const CSSValueL
ist* valueToMerge) |
| 1126 { | 1126 { |
| 1127 DEFINE_STATIC_REF_WILL_BE_PERSISTENT(CSSPrimitiveValue, underline, (CSSPrimi
tiveValue::createIdentifier(CSSValueUnderline))); | 1127 DEFINE_STATIC_REF_WILL_BE_PERSISTENT(CSSPrimitiveValue, underline, (CSSPrimi
tiveValue::create(CSSValueUnderline))); |
| 1128 DEFINE_STATIC_REF_WILL_BE_PERSISTENT(CSSPrimitiveValue, lineThrough, (CSSPri
mitiveValue::createIdentifier(CSSValueLineThrough))); | 1128 DEFINE_STATIC_REF_WILL_BE_PERSISTENT(CSSPrimitiveValue, lineThrough, (CSSPri
mitiveValue::create(CSSValueLineThrough))); |
| 1129 if (valueToMerge->hasValue(underline) && !mergedValue->hasValue(underline)) | 1129 if (valueToMerge->hasValue(underline) && !mergedValue->hasValue(underline)) |
| 1130 mergedValue->append(underline); | 1130 mergedValue->append(underline); |
| 1131 | 1131 |
| 1132 if (valueToMerge->hasValue(lineThrough) && !mergedValue->hasValue(lineThroug
h)) | 1132 if (valueToMerge->hasValue(lineThrough) && !mergedValue->hasValue(lineThroug
h)) |
| 1133 mergedValue->append(lineThrough); | 1133 mergedValue->append(lineThrough); |
| 1134 } | 1134 } |
| 1135 | 1135 |
| 1136 void EditingStyle::mergeStyle(const StylePropertySet* style, CSSPropertyOverride
Mode mode) | 1136 void EditingStyle::mergeStyle(const StylePropertySet* style, CSSPropertyOverride
Mode mode) |
| 1137 { | 1137 { |
| 1138 if (!style) | 1138 if (!style) |
| (...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1503 int fontStyle = getIdentifierValue(style, CSSPropertyFontStyle); | 1503 int fontStyle = getIdentifierValue(style, CSSPropertyFontStyle); |
| 1504 if (fontStyle == CSSValueItalic || fontStyle == CSSValueOblique) { | 1504 if (fontStyle == CSSValueItalic || fontStyle == CSSValueOblique) { |
| 1505 style->removeProperty(CSSPropertyFontStyle); | 1505 style->removeProperty(CSSPropertyFontStyle); |
| 1506 m_applyItalic = true; | 1506 m_applyItalic = true; |
| 1507 } | 1507 } |
| 1508 | 1508 |
| 1509 // Assuming reconcileTextDecorationProperties has been called, there should
not be -webkit-text-decorations-in-effect | 1509 // Assuming reconcileTextDecorationProperties has been called, there should
not be -webkit-text-decorations-in-effect |
| 1510 // Furthermore, text-decoration: none has been trimmed so that text-decorati
on property is always a CSSValueList. | 1510 // Furthermore, text-decoration: none has been trimmed so that text-decorati
on property is always a CSSValueList. |
| 1511 RefPtrWillBeRawPtr<CSSValue> textDecoration = style->getPropertyCSSValue(tex
tDecorationPropertyForEditing()); | 1511 RefPtrWillBeRawPtr<CSSValue> textDecoration = style->getPropertyCSSValue(tex
tDecorationPropertyForEditing()); |
| 1512 if (textDecoration && textDecoration->isValueList()) { | 1512 if (textDecoration && textDecoration->isValueList()) { |
| 1513 DEFINE_STATIC_REF_WILL_BE_PERSISTENT(CSSPrimitiveValue, underline, (CSSP
rimitiveValue::createIdentifier(CSSValueUnderline))); | 1513 DEFINE_STATIC_REF_WILL_BE_PERSISTENT(CSSPrimitiveValue, underline, (CSSP
rimitiveValue::create(CSSValueUnderline))); |
| 1514 DEFINE_STATIC_REF_WILL_BE_PERSISTENT(CSSPrimitiveValue, lineThrough, (CS
SPrimitiveValue::createIdentifier(CSSValueLineThrough))); | 1514 DEFINE_STATIC_REF_WILL_BE_PERSISTENT(CSSPrimitiveValue, lineThrough, (CS
SPrimitiveValue::create(CSSValueLineThrough))); |
| 1515 RefPtrWillBeRawPtr<CSSValueList> newTextDecoration = toCSSValueList(text
Decoration.get())->copy(); | 1515 RefPtrWillBeRawPtr<CSSValueList> newTextDecoration = toCSSValueList(text
Decoration.get())->copy(); |
| 1516 if (newTextDecoration->removeAll(underline)) | 1516 if (newTextDecoration->removeAll(underline)) |
| 1517 m_applyUnderline = true; | 1517 m_applyUnderline = true; |
| 1518 if (newTextDecoration->removeAll(lineThrough)) | 1518 if (newTextDecoration->removeAll(lineThrough)) |
| 1519 m_applyLineThrough = true; | 1519 m_applyLineThrough = true; |
| 1520 | 1520 |
| 1521 // If trimTextDecorations, delete underline and line-through | 1521 // If trimTextDecorations, delete underline and line-through |
| 1522 setTextDecorationProperty(style, newTextDecoration.get(), textDecoration
PropertyForEditing()); | 1522 setTextDecorationProperty(style, newTextDecoration.get(), textDecoration
PropertyForEditing()); |
| 1523 } | 1523 } |
| 1524 | 1524 |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1708 { | 1708 { |
| 1709 for (Node* ancestor = node; ancestor; ancestor = ancestor->parentNode()) { | 1709 for (Node* ancestor = node; ancestor; ancestor = ancestor->parentNode()) { |
| 1710 RefPtrWillBeRawPtr<CSSComputedStyleDeclaration> ancestorStyle = CSSCompu
tedStyleDeclaration::create(ancestor); | 1710 RefPtrWillBeRawPtr<CSSComputedStyleDeclaration> ancestorStyle = CSSCompu
tedStyleDeclaration::create(ancestor); |
| 1711 if (!hasTransparentBackgroundColor(ancestorStyle.get())) | 1711 if (!hasTransparentBackgroundColor(ancestorStyle.get())) |
| 1712 return ancestorStyle->getPropertyCSSValue(CSSPropertyBackgroundColor
); | 1712 return ancestorStyle->getPropertyCSSValue(CSSPropertyBackgroundColor
); |
| 1713 } | 1713 } |
| 1714 return nullptr; | 1714 return nullptr; |
| 1715 } | 1715 } |
| 1716 | 1716 |
| 1717 } | 1717 } |
| OLD | NEW |