| 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 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 { | 158 { |
| 159 return adoptPtr(new HTMLElementEquivalent(propertyID, primitiveValue, ta
gName)); | 159 return adoptPtr(new HTMLElementEquivalent(propertyID, primitiveValue, ta
gName)); |
| 160 } | 160 } |
| 161 | 161 |
| 162 virtual bool matches(const Element* element) const { return !m_tagName || el
ement->hasTagName(*m_tagName); } | 162 virtual bool matches(const Element* element) const { return !m_tagName || el
ement->hasTagName(*m_tagName); } |
| 163 virtual bool hasAttribute() const { return false; } | 163 virtual bool hasAttribute() const { return false; } |
| 164 virtual bool propertyExistsInStyle(const StylePropertySet* style) const { re
turn style->getPropertyCSSValue(m_propertyID); } | 164 virtual bool propertyExistsInStyle(const StylePropertySet* style) const { re
turn style->getPropertyCSSValue(m_propertyID); } |
| 165 virtual bool valueIsPresentInStyle(HTMLElement*, StylePropertySet*) const; | 165 virtual bool valueIsPresentInStyle(HTMLElement*, StylePropertySet*) const; |
| 166 virtual void addToStyle(Element*, EditingStyle*) const; | 166 virtual void addToStyle(Element*, EditingStyle*) const; |
| 167 | 167 |
| 168 virtual void trace(Visitor* visitor) { visitor->trace(m_primitiveValue); } | |
| 169 | |
| 170 protected: | 168 protected: |
| 171 HTMLElementEquivalent(CSSPropertyID); | 169 HTMLElementEquivalent(CSSPropertyID); |
| 172 HTMLElementEquivalent(CSSPropertyID, const HTMLQualifiedName& tagName); | 170 HTMLElementEquivalent(CSSPropertyID, const HTMLQualifiedName& tagName); |
| 173 HTMLElementEquivalent(CSSPropertyID, CSSValueID primitiveValue, const HTMLQu
alifiedName& tagName); | 171 HTMLElementEquivalent(CSSPropertyID, CSSValueID primitiveValue, const HTMLQu
alifiedName& tagName); |
| 174 const CSSPropertyID m_propertyID; | 172 const CSSPropertyID m_propertyID; |
| 175 const RefPtr<CSSPrimitiveValue> m_primitiveValue; | 173 const RefPtr<CSSPrimitiveValue> m_primitiveValue; |
| 176 const HTMLQualifiedName* m_tagName; // We can store a pointer because HTML t
ag names are const global. | 174 const HTMLQualifiedName* m_tagName; // We can store a pointer because HTML t
ag names are const global. |
| 177 }; | 175 }; |
| 178 | 176 |
| 179 DEFINE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(HTMLElementEquivalent); | 177 DEFINE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(HTMLElementEquivalent); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 | 209 |
| 212 class HTMLTextDecorationEquivalent final : public HTMLElementEquivalent { | 210 class HTMLTextDecorationEquivalent final : public HTMLElementEquivalent { |
| 213 public: | 211 public: |
| 214 static PassOwnPtr<HTMLElementEquivalent> create(CSSValueID primitiveValue, c
onst HTMLQualifiedName& tagName) | 212 static PassOwnPtr<HTMLElementEquivalent> create(CSSValueID primitiveValue, c
onst HTMLQualifiedName& tagName) |
| 215 { | 213 { |
| 216 return adoptPtr(new HTMLTextDecorationEquivalent(primitiveValue, tagName
)); | 214 return adoptPtr(new HTMLTextDecorationEquivalent(primitiveValue, tagName
)); |
| 217 } | 215 } |
| 218 virtual bool propertyExistsInStyle(const StylePropertySet*) const override; | 216 virtual bool propertyExistsInStyle(const StylePropertySet*) const override; |
| 219 virtual bool valueIsPresentInStyle(HTMLElement*, StylePropertySet*) const ov
erride; | 217 virtual bool valueIsPresentInStyle(HTMLElement*, StylePropertySet*) const ov
erride; |
| 220 | 218 |
| 221 virtual void trace(Visitor* visitor) override { HTMLElementEquivalent::trace
(visitor); } | |
| 222 | |
| 223 private: | 219 private: |
| 224 HTMLTextDecorationEquivalent(CSSValueID primitiveValue, const HTMLQualifiedN
ame& tagName); | 220 HTMLTextDecorationEquivalent(CSSValueID primitiveValue, const HTMLQualifiedN
ame& tagName); |
| 225 }; | 221 }; |
| 226 | 222 |
| 227 HTMLTextDecorationEquivalent::HTMLTextDecorationEquivalent(CSSValueID primitiveV
alue, const HTMLQualifiedName& tagName) | 223 HTMLTextDecorationEquivalent::HTMLTextDecorationEquivalent(CSSValueID primitiveV
alue, const HTMLQualifiedName& tagName) |
| 228 : HTMLElementEquivalent(textDecorationPropertyForEditing(), primitiveValue,
tagName) | 224 : HTMLElementEquivalent(textDecorationPropertyForEditing(), primitiveValue,
tagName) |
| 229 // m_propertyID is used in HTMLElementEquivalent::addToStyle | 225 // m_propertyID is used in HTMLElementEquivalent::addToStyle |
| 230 { | 226 { |
| 231 } | 227 } |
| 232 | 228 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 255 return adoptPtr(new HTMLAttributeEquivalent(propertyID, attrName)); | 251 return adoptPtr(new HTMLAttributeEquivalent(propertyID, attrName)); |
| 256 } | 252 } |
| 257 | 253 |
| 258 virtual bool matches(const Element* element) const override { return HTMLEle
mentEquivalent::matches(element) && element->hasAttribute(m_attrName); } | 254 virtual bool matches(const Element* element) const override { return HTMLEle
mentEquivalent::matches(element) && element->hasAttribute(m_attrName); } |
| 259 virtual bool hasAttribute() const override { return true; } | 255 virtual bool hasAttribute() const override { return true; } |
| 260 virtual bool valueIsPresentInStyle(HTMLElement*, StylePropertySet*) const ov
erride; | 256 virtual bool valueIsPresentInStyle(HTMLElement*, StylePropertySet*) const ov
erride; |
| 261 virtual void addToStyle(Element*, EditingStyle*) const override; | 257 virtual void addToStyle(Element*, EditingStyle*) const override; |
| 262 virtual PassRefPtr<CSSValue> attributeValueAsCSSValue(Element*) const; | 258 virtual PassRefPtr<CSSValue> attributeValueAsCSSValue(Element*) const; |
| 263 inline const QualifiedName& attributeName() const { return m_attrName; } | 259 inline const QualifiedName& attributeName() const { return m_attrName; } |
| 264 | 260 |
| 265 virtual void trace(Visitor* visitor) override { HTMLElementEquivalent::trace
(visitor); } | |
| 266 | |
| 267 protected: | 261 protected: |
| 268 HTMLAttributeEquivalent(CSSPropertyID, const HTMLQualifiedName& tagName, con
st QualifiedName& attrName); | 262 HTMLAttributeEquivalent(CSSPropertyID, const HTMLQualifiedName& tagName, con
st QualifiedName& attrName); |
| 269 HTMLAttributeEquivalent(CSSPropertyID, const QualifiedName& attrName); | 263 HTMLAttributeEquivalent(CSSPropertyID, const QualifiedName& attrName); |
| 270 const QualifiedName& m_attrName; // We can store a reference because HTML at
tribute names are const global. | 264 const QualifiedName& m_attrName; // We can store a reference because HTML at
tribute names are const global. |
| 271 }; | 265 }; |
| 272 | 266 |
| 273 HTMLAttributeEquivalent::HTMLAttributeEquivalent(CSSPropertyID id, const HTMLQua
lifiedName& tagName, const QualifiedName& attrName) | 267 HTMLAttributeEquivalent::HTMLAttributeEquivalent(CSSPropertyID id, const HTMLQua
lifiedName& tagName, const QualifiedName& attrName) |
| 274 : HTMLElementEquivalent(id, tagName) | 268 : HTMLElementEquivalent(id, tagName) |
| 275 , m_attrName(attrName) | 269 , m_attrName(attrName) |
| 276 { | 270 { |
| (...skipping 982 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1259 // In the range case, make sure that the embedding element persists unti
l the end of the range. | 1253 // In the range case, make sure that the embedding element persists unti
l the end of the range. |
| 1260 if (selection.isRange() && !end.deprecatedNode()->isDescendantOf(element
)) | 1254 if (selection.isRange() && !end.deprecatedNode()->isDescendantOf(element
)) |
| 1261 return NaturalWritingDirection; | 1255 return NaturalWritingDirection; |
| 1262 | 1256 |
| 1263 foundDirection = directionValue == CSSValueLtr ? LeftToRightWritingDirec
tion : RightToLeftWritingDirection; | 1257 foundDirection = directionValue == CSSValueLtr ? LeftToRightWritingDirec
tion : RightToLeftWritingDirection; |
| 1264 } | 1258 } |
| 1265 hasNestedOrMultipleEmbeddings = false; | 1259 hasNestedOrMultipleEmbeddings = false; |
| 1266 return foundDirection; | 1260 return foundDirection; |
| 1267 } | 1261 } |
| 1268 | 1262 |
| 1269 void EditingStyle::trace(Visitor* visitor) | |
| 1270 { | |
| 1271 visitor->trace(m_mutableStyle); | |
| 1272 } | |
| 1273 | |
| 1274 static void reconcileTextDecorationProperties(MutableStylePropertySet* style) | 1263 static void reconcileTextDecorationProperties(MutableStylePropertySet* style) |
| 1275 { | 1264 { |
| 1276 RefPtr<CSSValue> textDecorationsInEffect = style->getPropertyCSSValue(CSSPro
pertyWebkitTextDecorationsInEffect); | 1265 RefPtr<CSSValue> textDecorationsInEffect = style->getPropertyCSSValue(CSSPro
pertyWebkitTextDecorationsInEffect); |
| 1277 RefPtr<CSSValue> textDecoration = style->getPropertyCSSValue(textDecorationP
ropertyForEditing()); | 1266 RefPtr<CSSValue> textDecoration = style->getPropertyCSSValue(textDecorationP
ropertyForEditing()); |
| 1278 // We shouldn't have both text-decoration and -webkit-text-decorations-in-ef
fect because that wouldn't make sense. | 1267 // We shouldn't have both text-decoration and -webkit-text-decorations-in-ef
fect because that wouldn't make sense. |
| 1279 ASSERT(!textDecorationsInEffect || !textDecoration); | 1268 ASSERT(!textDecorationsInEffect || !textDecoration); |
| 1280 if (textDecorationsInEffect) { | 1269 if (textDecorationsInEffect) { |
| 1281 style->setProperty(textDecorationPropertyForEditing(), textDecorationsIn
Effect->cssText()); | 1270 style->setProperty(textDecorationPropertyForEditing(), textDecorationsIn
Effect->cssText()); |
| 1282 style->removeProperty(CSSPropertyWebkitTextDecorationsInEffect); | 1271 style->removeProperty(CSSPropertyWebkitTextDecorationsInEffect); |
| 1283 textDecoration = textDecorationsInEffect; | 1272 textDecoration = textDecorationsInEffect; |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1547 { | 1536 { |
| 1548 for (Node* ancestor = node; ancestor; ancestor = ancestor->parentNode()) { | 1537 for (Node* ancestor = node; ancestor; ancestor = ancestor->parentNode()) { |
| 1549 RefPtr<CSSComputedStyleDeclaration> ancestorStyle = CSSComputedStyleDecl
aration::create(ancestor); | 1538 RefPtr<CSSComputedStyleDeclaration> ancestorStyle = CSSComputedStyleDecl
aration::create(ancestor); |
| 1550 if (!hasTransparentBackgroundColor(ancestorStyle.get())) | 1539 if (!hasTransparentBackgroundColor(ancestorStyle.get())) |
| 1551 return ancestorStyle->getPropertyCSSValue(CSSPropertyBackgroundColor
); | 1540 return ancestorStyle->getPropertyCSSValue(CSSPropertyBackgroundColor
); |
| 1552 } | 1541 } |
| 1553 return nullptr; | 1542 return nullptr; |
| 1554 } | 1543 } |
| 1555 | 1544 |
| 1556 } | 1545 } |
| OLD | NEW |