| 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 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 { | 203 { |
| 204 style->setProperty(m_propertyID, m_primitiveValue->cssText()); | 204 style->setProperty(m_propertyID, m_primitiveValue->cssText()); |
| 205 } | 205 } |
| 206 | 206 |
| 207 class HTMLTextDecorationEquivalent : public HTMLElementEquivalent { | 207 class HTMLTextDecorationEquivalent : public HTMLElementEquivalent { |
| 208 public: | 208 public: |
| 209 static PassOwnPtr<HTMLElementEquivalent> create(CSSValueID primitiveValue, c
onst QualifiedName& tagName) | 209 static PassOwnPtr<HTMLElementEquivalent> create(CSSValueID primitiveValue, c
onst QualifiedName& tagName) |
| 210 { | 210 { |
| 211 return adoptPtr(new HTMLTextDecorationEquivalent(primitiveValue, tagName
)); | 211 return adoptPtr(new HTMLTextDecorationEquivalent(primitiveValue, tagName
)); |
| 212 } | 212 } |
| 213 virtual bool propertyExistsInStyle(const StylePropertySet*) const; | 213 virtual bool propertyExistsInStyle(const StylePropertySet*) const OVERRIDE; |
| 214 virtual bool valueIsPresentInStyle(Element*, StylePropertySet*) const; | 214 virtual bool valueIsPresentInStyle(Element*, StylePropertySet*) const OVERRI
DE; |
| 215 | 215 |
| 216 private: | 216 private: |
| 217 HTMLTextDecorationEquivalent(CSSValueID primitiveValue, const QualifiedName&
tagName); | 217 HTMLTextDecorationEquivalent(CSSValueID primitiveValue, const QualifiedName&
tagName); |
| 218 }; | 218 }; |
| 219 | 219 |
| 220 HTMLTextDecorationEquivalent::HTMLTextDecorationEquivalent(CSSValueID primitiveV
alue, const QualifiedName& tagName) | 220 HTMLTextDecorationEquivalent::HTMLTextDecorationEquivalent(CSSValueID primitiveV
alue, const QualifiedName& tagName) |
| 221 : HTMLElementEquivalent(textDecorationPropertyForEditing(), primitiveValue,
tagName) | 221 : HTMLElementEquivalent(textDecorationPropertyForEditing(), primitiveValue,
tagName) |
| 222 // m_propertyID is used in HTMLElementEquivalent::addToStyle | 222 // m_propertyID is used in HTMLElementEquivalent::addToStyle |
| 223 { | 223 { |
| 224 } | 224 } |
| (...skipping 16 matching lines...) Expand all Loading... |
| 241 public: | 241 public: |
| 242 static PassOwnPtr<HTMLAttributeEquivalent> create(CSSPropertyID propertyID,
const QualifiedName& tagName, const QualifiedName& attrName) | 242 static PassOwnPtr<HTMLAttributeEquivalent> create(CSSPropertyID propertyID,
const QualifiedName& tagName, const QualifiedName& attrName) |
| 243 { | 243 { |
| 244 return adoptPtr(new HTMLAttributeEquivalent(propertyID, tagName, attrNam
e)); | 244 return adoptPtr(new HTMLAttributeEquivalent(propertyID, tagName, attrNam
e)); |
| 245 } | 245 } |
| 246 static PassOwnPtr<HTMLAttributeEquivalent> create(CSSPropertyID propertyID,
const QualifiedName& attrName) | 246 static PassOwnPtr<HTMLAttributeEquivalent> create(CSSPropertyID propertyID,
const QualifiedName& attrName) |
| 247 { | 247 { |
| 248 return adoptPtr(new HTMLAttributeEquivalent(propertyID, attrName)); | 248 return adoptPtr(new HTMLAttributeEquivalent(propertyID, attrName)); |
| 249 } | 249 } |
| 250 | 250 |
| 251 bool matches(const Element* elem) const { return HTMLElementEquivalent::matc
hes(elem) && elem->hasAttribute(m_attrName); } | 251 virtual bool matches(const Element* elem) const OVERRIDE { return HTMLElemen
tEquivalent::matches(elem) && elem->hasAttribute(m_attrName); } |
| 252 virtual bool hasAttribute() const { return true; } | 252 virtual bool hasAttribute() const OVERRIDE { return true; } |
| 253 virtual bool valueIsPresentInStyle(Element*, StylePropertySet*) const; | 253 virtual bool valueIsPresentInStyle(Element*, StylePropertySet*) const OVERRI
DE; |
| 254 virtual void addToStyle(Element*, EditingStyle*) const; | 254 virtual void addToStyle(Element*, EditingStyle*) const OVERRIDE; |
| 255 virtual PassRefPtr<CSSValue> attributeValueAsCSSValue(Element*) const; | 255 virtual PassRefPtr<CSSValue> attributeValueAsCSSValue(Element*) const; |
| 256 inline const QualifiedName& attributeName() const { return m_attrName; } | 256 inline const QualifiedName& attributeName() const { return m_attrName; } |
| 257 | 257 |
| 258 protected: | 258 protected: |
| 259 HTMLAttributeEquivalent(CSSPropertyID, const QualifiedName& tagName, const Q
ualifiedName& attrName); | 259 HTMLAttributeEquivalent(CSSPropertyID, const QualifiedName& tagName, const Q
ualifiedName& attrName); |
| 260 HTMLAttributeEquivalent(CSSPropertyID, const QualifiedName& attrName); | 260 HTMLAttributeEquivalent(CSSPropertyID, const QualifiedName& attrName); |
| 261 const QualifiedName& m_attrName; // We can store a reference because HTML at
tribute names are const global. | 261 const QualifiedName& m_attrName; // We can store a reference because HTML at
tribute names are const global. |
| 262 }; | 262 }; |
| 263 | 263 |
| 264 HTMLAttributeEquivalent::HTMLAttributeEquivalent(CSSPropertyID id, const Qualifi
edName& tagName, const QualifiedName& attrName) | 264 HTMLAttributeEquivalent::HTMLAttributeEquivalent(CSSPropertyID id, const Qualifi
edName& tagName, const QualifiedName& attrName) |
| (...skipping 27 matching lines...) Expand all Loading... |
| 292 ASSERT(element); | 292 ASSERT(element); |
| 293 if (!element->hasAttribute(m_attrName)) | 293 if (!element->hasAttribute(m_attrName)) |
| 294 return 0; | 294 return 0; |
| 295 | 295 |
| 296 RefPtr<MutableStylePropertySet> dummyStyle; | 296 RefPtr<MutableStylePropertySet> dummyStyle; |
| 297 dummyStyle = MutableStylePropertySet::create(); | 297 dummyStyle = MutableStylePropertySet::create(); |
| 298 dummyStyle->setProperty(m_propertyID, element->getAttribute(m_attrName)); | 298 dummyStyle->setProperty(m_propertyID, element->getAttribute(m_attrName)); |
| 299 return dummyStyle->getPropertyCSSValue(m_propertyID); | 299 return dummyStyle->getPropertyCSSValue(m_propertyID); |
| 300 } | 300 } |
| 301 | 301 |
| 302 class HTMLFontSizeEquivalent : public HTMLAttributeEquivalent { | 302 class HTMLFontSizeEquivalent FINAL : public HTMLAttributeEquivalent { |
| 303 public: | 303 public: |
| 304 static PassOwnPtr<HTMLFontSizeEquivalent> create() | 304 static PassOwnPtr<HTMLFontSizeEquivalent> create() |
| 305 { | 305 { |
| 306 return adoptPtr(new HTMLFontSizeEquivalent()); | 306 return adoptPtr(new HTMLFontSizeEquivalent()); |
| 307 } | 307 } |
| 308 virtual PassRefPtr<CSSValue> attributeValueAsCSSValue(Element*) const; | 308 virtual PassRefPtr<CSSValue> attributeValueAsCSSValue(Element*) const OVERRI
DE; |
| 309 | 309 |
| 310 private: | 310 private: |
| 311 HTMLFontSizeEquivalent(); | 311 HTMLFontSizeEquivalent(); |
| 312 }; | 312 }; |
| 313 | 313 |
| 314 HTMLFontSizeEquivalent::HTMLFontSizeEquivalent() | 314 HTMLFontSizeEquivalent::HTMLFontSizeEquivalent() |
| 315 : HTMLAttributeEquivalent(CSSPropertyFontSize, HTMLNames::fontTag, HTMLNames
::sizeAttr) | 315 : HTMLAttributeEquivalent(CSSPropertyFontSize, HTMLNames::fontTag, HTMLNames
::sizeAttr) |
| 316 { | 316 { |
| 317 } | 317 } |
| 318 | 318 |
| (...skipping 1330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1649 { | 1649 { |
| 1650 for (Node* ancestor = node; ancestor; ancestor = ancestor->parentNode()) { | 1650 for (Node* ancestor = node; ancestor; ancestor = ancestor->parentNode()) { |
| 1651 RefPtr<CSSComputedStyleDeclaration> ancestorStyle = CSSComputedStyleDecl
aration::create(ancestor); | 1651 RefPtr<CSSComputedStyleDeclaration> ancestorStyle = CSSComputedStyleDecl
aration::create(ancestor); |
| 1652 if (!hasTransparentBackgroundColor(ancestorStyle.get())) | 1652 if (!hasTransparentBackgroundColor(ancestorStyle.get())) |
| 1653 return ancestorStyle->getPropertyCSSValue(CSSPropertyBackgroundColor
); | 1653 return ancestorStyle->getPropertyCSSValue(CSSPropertyBackgroundColor
); |
| 1654 } | 1654 } |
| 1655 return 0; | 1655 return 0; |
| 1656 } | 1656 } |
| 1657 | 1657 |
| 1658 } | 1658 } |
| OLD | NEW |