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 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 { | 212 { |
213 style->setProperty(m_propertyID, m_primitiveValue->cssText()); | 213 style->setProperty(m_propertyID, m_primitiveValue->cssText()); |
214 } | 214 } |
215 | 215 |
216 class HTMLTextDecorationEquivalent final : public HTMLElementEquivalent { | 216 class HTMLTextDecorationEquivalent final : public HTMLElementEquivalent { |
217 public: | 217 public: |
218 static PassOwnPtrWillBeRawPtr<HTMLElementEquivalent> create(CSSValueID primi
tiveValue, const HTMLQualifiedName& tagName) | 218 static PassOwnPtrWillBeRawPtr<HTMLElementEquivalent> create(CSSValueID primi
tiveValue, const HTMLQualifiedName& tagName) |
219 { | 219 { |
220 return adoptPtrWillBeNoop(new HTMLTextDecorationEquivalent(primitiveValu
e, tagName)); | 220 return adoptPtrWillBeNoop(new HTMLTextDecorationEquivalent(primitiveValu
e, tagName)); |
221 } | 221 } |
222 virtual bool propertyExistsInStyle(const StylePropertySet*) const override; | 222 bool propertyExistsInStyle(const StylePropertySet*) const override; |
223 virtual bool valueIsPresentInStyle(HTMLElement*, StylePropertySet*) const ov
erride; | 223 bool valueIsPresentInStyle(HTMLElement*, StylePropertySet*) const override; |
224 | 224 |
225 DEFINE_INLINE_VIRTUAL_TRACE() { HTMLElementEquivalent::trace(visitor); } | 225 DEFINE_INLINE_VIRTUAL_TRACE() { HTMLElementEquivalent::trace(visitor); } |
226 | 226 |
227 private: | 227 private: |
228 HTMLTextDecorationEquivalent(CSSValueID primitiveValue, const HTMLQualifiedN
ame& tagName); | 228 HTMLTextDecorationEquivalent(CSSValueID primitiveValue, const HTMLQualifiedN
ame& tagName); |
229 }; | 229 }; |
230 | 230 |
231 HTMLTextDecorationEquivalent::HTMLTextDecorationEquivalent(CSSValueID primitiveV
alue, const HTMLQualifiedName& tagName) | 231 HTMLTextDecorationEquivalent::HTMLTextDecorationEquivalent(CSSValueID primitiveV
alue, const HTMLQualifiedName& tagName) |
232 : HTMLElementEquivalent(textDecorationPropertyForEditing(), primitiveValue,
tagName) | 232 : HTMLElementEquivalent(textDecorationPropertyForEditing(), primitiveValue,
tagName) |
233 // m_propertyID is used in HTMLElementEquivalent::addToStyle | 233 // m_propertyID is used in HTMLElementEquivalent::addToStyle |
(...skipping 18 matching lines...) Expand all Loading... |
252 public: | 252 public: |
253 static PassOwnPtrWillBeRawPtr<HTMLAttributeEquivalent> create(CSSPropertyID
propertyID, const HTMLQualifiedName& tagName, const QualifiedName& attrName) | 253 static PassOwnPtrWillBeRawPtr<HTMLAttributeEquivalent> create(CSSPropertyID
propertyID, const HTMLQualifiedName& tagName, const QualifiedName& attrName) |
254 { | 254 { |
255 return adoptPtrWillBeNoop(new HTMLAttributeEquivalent(propertyID, tagNam
e, attrName)); | 255 return adoptPtrWillBeNoop(new HTMLAttributeEquivalent(propertyID, tagNam
e, attrName)); |
256 } | 256 } |
257 static PassOwnPtrWillBeRawPtr<HTMLAttributeEquivalent> create(CSSPropertyID
propertyID, const QualifiedName& attrName) | 257 static PassOwnPtrWillBeRawPtr<HTMLAttributeEquivalent> create(CSSPropertyID
propertyID, const QualifiedName& attrName) |
258 { | 258 { |
259 return adoptPtrWillBeNoop(new HTMLAttributeEquivalent(propertyID, attrNa
me)); | 259 return adoptPtrWillBeNoop(new HTMLAttributeEquivalent(propertyID, attrNa
me)); |
260 } | 260 } |
261 | 261 |
262 virtual bool matches(const Element* element) const override { return HTMLEle
mentEquivalent::matches(element) && element->hasAttribute(m_attrName); } | 262 bool matches(const Element* element) const override { return HTMLElementEqui
valent::matches(element) && element->hasAttribute(m_attrName); } |
263 virtual bool hasAttribute() const override { return true; } | 263 bool hasAttribute() const override { return true; } |
264 virtual bool valueIsPresentInStyle(HTMLElement*, StylePropertySet*) const ov
erride; | 264 bool valueIsPresentInStyle(HTMLElement*, StylePropertySet*) const override; |
265 virtual void addToStyle(Element*, EditingStyle*) const override; | 265 void addToStyle(Element*, EditingStyle*) const override; |
266 virtual PassRefPtrWillBeRawPtr<CSSValue> attributeValueAsCSSValue(Element*)
const; | 266 virtual PassRefPtrWillBeRawPtr<CSSValue> attributeValueAsCSSValue(Element*)
const; |
267 inline const QualifiedName& attributeName() const { return m_attrName; } | 267 inline const QualifiedName& attributeName() const { return m_attrName; } |
268 | 268 |
269 DEFINE_INLINE_VIRTUAL_TRACE() { HTMLElementEquivalent::trace(visitor); } | 269 DEFINE_INLINE_VIRTUAL_TRACE() { HTMLElementEquivalent::trace(visitor); } |
270 | 270 |
271 protected: | 271 protected: |
272 HTMLAttributeEquivalent(CSSPropertyID, const HTMLQualifiedName& tagName, con
st QualifiedName& attrName); | 272 HTMLAttributeEquivalent(CSSPropertyID, const HTMLQualifiedName& tagName, con
st QualifiedName& attrName); |
273 HTMLAttributeEquivalent(CSSPropertyID, const QualifiedName& attrName); | 273 HTMLAttributeEquivalent(CSSPropertyID, const QualifiedName& attrName); |
274 const QualifiedName& m_attrName; // We can store a reference because HTML at
tribute names are const global. | 274 const QualifiedName& m_attrName; // We can store a reference because HTML at
tribute names are const global. |
275 }; | 275 }; |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 dummyStyle->setProperty(m_propertyID, value); | 312 dummyStyle->setProperty(m_propertyID, value); |
313 return dummyStyle->getPropertyCSSValue(m_propertyID); | 313 return dummyStyle->getPropertyCSSValue(m_propertyID); |
314 } | 314 } |
315 | 315 |
316 class HTMLFontSizeEquivalent final : public HTMLAttributeEquivalent { | 316 class HTMLFontSizeEquivalent final : public HTMLAttributeEquivalent { |
317 public: | 317 public: |
318 static PassOwnPtrWillBeRawPtr<HTMLFontSizeEquivalent> create() | 318 static PassOwnPtrWillBeRawPtr<HTMLFontSizeEquivalent> create() |
319 { | 319 { |
320 return adoptPtrWillBeNoop(new HTMLFontSizeEquivalent()); | 320 return adoptPtrWillBeNoop(new HTMLFontSizeEquivalent()); |
321 } | 321 } |
322 virtual PassRefPtrWillBeRawPtr<CSSValue> attributeValueAsCSSValue(Element*)
const override; | 322 PassRefPtrWillBeRawPtr<CSSValue> attributeValueAsCSSValue(Element*) const ov
erride; |
323 | 323 |
324 DEFINE_INLINE_VIRTUAL_TRACE() { HTMLAttributeEquivalent::trace(visitor); } | 324 DEFINE_INLINE_VIRTUAL_TRACE() { HTMLAttributeEquivalent::trace(visitor); } |
325 | 325 |
326 private: | 326 private: |
327 HTMLFontSizeEquivalent(); | 327 HTMLFontSizeEquivalent(); |
328 }; | 328 }; |
329 | 329 |
330 HTMLFontSizeEquivalent::HTMLFontSizeEquivalent() | 330 HTMLFontSizeEquivalent::HTMLFontSizeEquivalent() |
331 : HTMLAttributeEquivalent(CSSPropertyFontSize, HTMLNames::fontTag, HTMLNames
::sizeAttr) | 331 : HTMLAttributeEquivalent(CSSPropertyFontSize, HTMLNames::fontTag, HTMLNames
::sizeAttr) |
332 { | 332 { |
(...skipping 1375 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 |