| 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 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 { | 247 { |
| 248 return style->getPropertyCSSValue(CSSPropertyWebkitTextDecorationsInEffect) | 248 return style->getPropertyCSSValue(CSSPropertyWebkitTextDecorationsInEffect) |
| 249 || style->getPropertyCSSValue(textDecorationPropertyForEditing()); | 249 || style->getPropertyCSSValue(textDecorationPropertyForEditing()); |
| 250 } | 250 } |
| 251 | 251 |
| 252 bool HTMLTextDecorationEquivalent::valueIsPresentInStyle(HTMLElement* element, S
tylePropertySet* style) const | 252 bool HTMLTextDecorationEquivalent::valueIsPresentInStyle(HTMLElement* element, S
tylePropertySet* style) const |
| 253 { | 253 { |
| 254 CSSValue* styleValue = style->getPropertyCSSValue(CSSPropertyWebkitTextDecor
ationsInEffect); | 254 CSSValue* styleValue = style->getPropertyCSSValue(CSSPropertyWebkitTextDecor
ationsInEffect); |
| 255 if (!styleValue) | 255 if (!styleValue) |
| 256 styleValue = style->getPropertyCSSValue(textDecorationPropertyForEditing
()); | 256 styleValue = style->getPropertyCSSValue(textDecorationPropertyForEditing
()); |
| 257 return matches(element) && styleValue && styleValue->isValueList() && toCSSV
alueList(styleValue)->hasValue(m_primitiveValue.get()); | 257 return matches(element) && styleValue && styleValue->isValueList() && toCSSV
alueList(styleValue)->hasValue(*m_primitiveValue); |
| 258 } | 258 } |
| 259 | 259 |
| 260 class HTMLAttributeEquivalent : public HTMLElementEquivalent { | 260 class HTMLAttributeEquivalent : public HTMLElementEquivalent { |
| 261 public: | 261 public: |
| 262 static HTMLAttributeEquivalent* create(CSSPropertyID propertyID, const HTMLQ
ualifiedName& tagName, const QualifiedName& attrName) | 262 static HTMLAttributeEquivalent* create(CSSPropertyID propertyID, const HTMLQ
ualifiedName& tagName, const QualifiedName& attrName) |
| 263 { | 263 { |
| 264 return new HTMLAttributeEquivalent(propertyID, tagName, attrName); | 264 return new HTMLAttributeEquivalent(propertyID, tagName, attrName); |
| 265 } | 265 } |
| 266 static HTMLAttributeEquivalent* create(CSSPropertyID propertyID, const Quali
fiedName& attrName) | 266 static HTMLAttributeEquivalent* create(CSSPropertyID propertyID, const Quali
fiedName& attrName) |
| 267 { | 267 { |
| (...skipping 884 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1152 } | 1152 } |
| 1153 } | 1153 } |
| 1154 | 1154 |
| 1155 return wrappingStyle; | 1155 return wrappingStyle; |
| 1156 } | 1156 } |
| 1157 | 1157 |
| 1158 static void mergeTextDecorationValues(CSSValueList* mergedValue, const CSSValueL
ist* valueToMerge) | 1158 static void mergeTextDecorationValues(CSSValueList* mergedValue, const CSSValueL
ist* valueToMerge) |
| 1159 { | 1159 { |
| 1160 DEFINE_STATIC_LOCAL(CSSPrimitiveValue, underline, (CSSPrimitiveValue::create
Identifier(CSSValueUnderline))); | 1160 DEFINE_STATIC_LOCAL(CSSPrimitiveValue, underline, (CSSPrimitiveValue::create
Identifier(CSSValueUnderline))); |
| 1161 DEFINE_STATIC_LOCAL(CSSPrimitiveValue, lineThrough, (CSSPrimitiveValue::crea
teIdentifier(CSSValueLineThrough))); | 1161 DEFINE_STATIC_LOCAL(CSSPrimitiveValue, lineThrough, (CSSPrimitiveValue::crea
teIdentifier(CSSValueLineThrough))); |
| 1162 if (valueToMerge->hasValue(&underline) && !mergedValue->hasValue(&underline)
) | 1162 if (valueToMerge->hasValue(underline) && !mergedValue->hasValue(underline)) |
| 1163 mergedValue->append(&underline); | 1163 mergedValue->append(&underline); |
| 1164 | 1164 |
| 1165 if (valueToMerge->hasValue(&lineThrough) && !mergedValue->hasValue(&lineThro
ugh)) | 1165 if (valueToMerge->hasValue(lineThrough) && !mergedValue->hasValue(lineThroug
h)) |
| 1166 mergedValue->append(&lineThrough); | 1166 mergedValue->append(&lineThrough); |
| 1167 } | 1167 } |
| 1168 | 1168 |
| 1169 void EditingStyle::mergeStyle(const StylePropertySet* style, CSSPropertyOverride
Mode mode) | 1169 void EditingStyle::mergeStyle(const StylePropertySet* style, CSSPropertyOverride
Mode mode) |
| 1170 { | 1170 { |
| 1171 if (!style) | 1171 if (!style) |
| 1172 return; | 1172 return; |
| 1173 | 1173 |
| 1174 if (!m_mutableStyle) { | 1174 if (!m_mutableStyle) { |
| 1175 m_mutableStyle = style->mutableCopy(); | 1175 m_mutableStyle = style->mutableCopy(); |
| (...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1561 m_applyItalic = true; | 1561 m_applyItalic = true; |
| 1562 } | 1562 } |
| 1563 | 1563 |
| 1564 // Assuming reconcileTextDecorationProperties has been called, there should
not be -webkit-text-decorations-in-effect | 1564 // Assuming reconcileTextDecorationProperties has been called, there should
not be -webkit-text-decorations-in-effect |
| 1565 // Furthermore, text-decoration: none has been trimmed so that text-decorati
on property is always a CSSValueList. | 1565 // Furthermore, text-decoration: none has been trimmed so that text-decorati
on property is always a CSSValueList. |
| 1566 CSSValue* textDecoration = style->getPropertyCSSValue(textDecorationProperty
ForEditing()); | 1566 CSSValue* textDecoration = style->getPropertyCSSValue(textDecorationProperty
ForEditing()); |
| 1567 if (textDecoration && textDecoration->isValueList()) { | 1567 if (textDecoration && textDecoration->isValueList()) { |
| 1568 DEFINE_STATIC_LOCAL(CSSPrimitiveValue, underline, (CSSPrimitiveValue::cr
eateIdentifier(CSSValueUnderline))); | 1568 DEFINE_STATIC_LOCAL(CSSPrimitiveValue, underline, (CSSPrimitiveValue::cr
eateIdentifier(CSSValueUnderline))); |
| 1569 DEFINE_STATIC_LOCAL(CSSPrimitiveValue, lineThrough, (CSSPrimitiveValue::
createIdentifier(CSSValueLineThrough))); | 1569 DEFINE_STATIC_LOCAL(CSSPrimitiveValue, lineThrough, (CSSPrimitiveValue::
createIdentifier(CSSValueLineThrough))); |
| 1570 CSSValueList* newTextDecoration = toCSSValueList(textDecoration)->copy()
; | 1570 CSSValueList* newTextDecoration = toCSSValueList(textDecoration)->copy()
; |
| 1571 if (newTextDecoration->removeAll(&underline)) | 1571 if (newTextDecoration->removeAll(underline)) |
| 1572 m_applyUnderline = true; | 1572 m_applyUnderline = true; |
| 1573 if (newTextDecoration->removeAll(&lineThrough)) | 1573 if (newTextDecoration->removeAll(lineThrough)) |
| 1574 m_applyLineThrough = true; | 1574 m_applyLineThrough = true; |
| 1575 | 1575 |
| 1576 // If trimTextDecorations, delete underline and line-through | 1576 // If trimTextDecorations, delete underline and line-through |
| 1577 setTextDecorationProperty(style, newTextDecoration, textDecorationProper
tyForEditing()); | 1577 setTextDecorationProperty(style, newTextDecoration, textDecorationProper
tyForEditing()); |
| 1578 } | 1578 } |
| 1579 | 1579 |
| 1580 int verticalAlign = getIdentifierValue(style, CSSPropertyVerticalAlign); | 1580 int verticalAlign = getIdentifierValue(style, CSSPropertyVerticalAlign); |
| 1581 switch (verticalAlign) { | 1581 switch (verticalAlign) { |
| 1582 case CSSValueSub: | 1582 case CSSValueSub: |
| 1583 style->removeProperty(CSSPropertyVerticalAlign); | 1583 style->removeProperty(CSSPropertyVerticalAlign); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 1612 static void diffTextDecorations(MutableStylePropertySet* style, CSSPropertyID pr
opertID, CSSValue* refTextDecoration) | 1612 static void diffTextDecorations(MutableStylePropertySet* style, CSSPropertyID pr
opertID, CSSValue* refTextDecoration) |
| 1613 { | 1613 { |
| 1614 CSSValue* textDecoration = style->getPropertyCSSValue(propertID); | 1614 CSSValue* textDecoration = style->getPropertyCSSValue(propertID); |
| 1615 if (!textDecoration || !textDecoration->isValueList() || !refTextDecoration
|| !refTextDecoration->isValueList()) | 1615 if (!textDecoration || !textDecoration->isValueList() || !refTextDecoration
|| !refTextDecoration->isValueList()) |
| 1616 return; | 1616 return; |
| 1617 | 1617 |
| 1618 CSSValueList* newTextDecoration = toCSSValueList(textDecoration)->copy(); | 1618 CSSValueList* newTextDecoration = toCSSValueList(textDecoration)->copy(); |
| 1619 CSSValueList* valuesInRefTextDecoration = toCSSValueList(refTextDecoration); | 1619 CSSValueList* valuesInRefTextDecoration = toCSSValueList(refTextDecoration); |
| 1620 | 1620 |
| 1621 for (size_t i = 0; i < valuesInRefTextDecoration->length(); i++) | 1621 for (size_t i = 0; i < valuesInRefTextDecoration->length(); i++) |
| 1622 newTextDecoration->removeAll(valuesInRefTextDecoration->item(i)); | 1622 newTextDecoration->removeAll(*valuesInRefTextDecoration->item(i)); |
| 1623 | 1623 |
| 1624 setTextDecorationProperty(style, newTextDecoration, propertID); | 1624 setTextDecorationProperty(style, newTextDecoration, propertID); |
| 1625 } | 1625 } |
| 1626 | 1626 |
| 1627 static bool fontWeightIsBold(CSSValue* fontWeight) | 1627 static bool fontWeightIsBold(CSSValue* fontWeight) |
| 1628 { | 1628 { |
| 1629 if (!fontWeight->isPrimitiveValue()) | 1629 if (!fontWeight->isPrimitiveValue()) |
| 1630 return false; | 1630 return false; |
| 1631 | 1631 |
| 1632 // Because b tag can only bold text, there are only two states in plain html
: bold and not bold. | 1632 // Because b tag can only bold text, there are only two states in plain html
: bold and not bold. |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1764 { | 1764 { |
| 1765 for (Node* ancestor = node; ancestor; ancestor = ancestor->parentNode()) { | 1765 for (Node* ancestor = node; ancestor; ancestor = ancestor->parentNode()) { |
| 1766 CSSComputedStyleDeclaration* ancestorStyle = CSSComputedStyleDeclaration
::create(ancestor); | 1766 CSSComputedStyleDeclaration* ancestorStyle = CSSComputedStyleDeclaration
::create(ancestor); |
| 1767 if (!hasTransparentBackgroundColor(ancestorStyle)) | 1767 if (!hasTransparentBackgroundColor(ancestorStyle)) |
| 1768 return ancestorStyle->getPropertyCSSValue(CSSPropertyBackgroundColor
); | 1768 return ancestorStyle->getPropertyCSSValue(CSSPropertyBackgroundColor
); |
| 1769 } | 1769 } |
| 1770 return nullptr; | 1770 return nullptr; |
| 1771 } | 1771 } |
| 1772 | 1772 |
| 1773 } // namespace blink | 1773 } // namespace blink |
| OLD | NEW |