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 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 } |
210 | 210 |
211 void HTMLElementEquivalent::addToStyle(Element*, EditingStyle* style) const | 211 void HTMLElementEquivalent::addToStyle(Element*, EditingStyle* style) const |
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 virtual bool propertyExistsInStyle(const StylePropertySet*) const override; |
223 virtual bool valueIsPresentInStyle(HTMLElement*, StylePropertySet*) const OV
ERRIDE; | 223 virtual bool valueIsPresentInStyle(HTMLElement*, StylePropertySet*) const ov
erride; |
224 | 224 |
225 virtual void trace(Visitor* visitor) OVERRIDE { HTMLElementEquivalent::trace
(visitor); } | 225 virtual void trace(Visitor* visitor) override { 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 |
234 { | 234 { |
235 } | 235 } |
(...skipping 16 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 virtual bool matches(const Element* element) const override { return HTMLEle
mentEquivalent::matches(element) && element->hasAttribute(m_attrName); } |
263 virtual bool hasAttribute() const OVERRIDE { return true; } | 263 virtual bool hasAttribute() const override { return true; } |
264 virtual bool valueIsPresentInStyle(HTMLElement*, StylePropertySet*) const OV
ERRIDE; | 264 virtual bool valueIsPresentInStyle(HTMLElement*, StylePropertySet*) const ov
erride; |
265 virtual void addToStyle(Element*, EditingStyle*) const OVERRIDE; | 265 virtual 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 virtual void trace(Visitor* visitor) OVERRIDE { HTMLElementEquivalent::trace
(visitor); } | 269 virtual void trace(Visitor* visitor) override { 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 }; |
276 | 276 |
277 HTMLAttributeEquivalent::HTMLAttributeEquivalent(CSSPropertyID id, const HTMLQua
lifiedName& tagName, const QualifiedName& attrName) | 277 HTMLAttributeEquivalent::HTMLAttributeEquivalent(CSSPropertyID id, const HTMLQua
lifiedName& tagName, const QualifiedName& attrName) |
278 : HTMLElementEquivalent(id, tagName) | 278 : HTMLElementEquivalent(id, tagName) |
279 , m_attrName(attrName) | 279 , m_attrName(attrName) |
(...skipping 26 matching lines...) Expand all Loading... |
306 const AtomicString& value = element->getAttribute(m_attrName); | 306 const AtomicString& value = element->getAttribute(m_attrName); |
307 if (value.isNull()) | 307 if (value.isNull()) |
308 return nullptr; | 308 return nullptr; |
309 | 309 |
310 RefPtrWillBeRawPtr<MutableStylePropertySet> dummyStyle = nullptr; | 310 RefPtrWillBeRawPtr<MutableStylePropertySet> dummyStyle = nullptr; |
311 dummyStyle = MutableStylePropertySet::create(); | 311 dummyStyle = MutableStylePropertySet::create(); |
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 virtual PassRefPtrWillBeRawPtr<CSSValue> attributeValueAsCSSValue(Element*)
const override; |
323 | 323 |
324 virtual void trace(Visitor* visitor) OVERRIDE { HTMLAttributeEquivalent::tra
ce(visitor); } | 324 virtual void trace(Visitor* visitor) override { HTMLAttributeEquivalent::tra
ce(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 { |
333 } | 333 } |
334 | 334 |
(...skipping 1343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1678 { | 1678 { |
1679 for (Node* ancestor = node; ancestor; ancestor = ancestor->parentNode()) { | 1679 for (Node* ancestor = node; ancestor; ancestor = ancestor->parentNode()) { |
1680 RefPtrWillBeRawPtr<CSSComputedStyleDeclaration> ancestorStyle = CSSCompu
tedStyleDeclaration::create(ancestor); | 1680 RefPtrWillBeRawPtr<CSSComputedStyleDeclaration> ancestorStyle = CSSCompu
tedStyleDeclaration::create(ancestor); |
1681 if (!hasTransparentBackgroundColor(ancestorStyle.get())) | 1681 if (!hasTransparentBackgroundColor(ancestorStyle.get())) |
1682 return ancestorStyle->getPropertyCSSValue(CSSPropertyBackgroundColor
); | 1682 return ancestorStyle->getPropertyCSSValue(CSSPropertyBackgroundColor
); |
1683 } | 1683 } |
1684 return nullptr; | 1684 return nullptr; |
1685 } | 1685 } |
1686 | 1686 |
1687 } | 1687 } |
OLD | NEW |