| 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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 properties.remove(index); | 120 properties.remove(index); |
| 121 continue; | 121 continue; |
| 122 } | 122 } |
| 123 ++index; | 123 ++index; |
| 124 } | 124 } |
| 125 } | 125 } |
| 126 return properties; | 126 return properties; |
| 127 } | 127 } |
| 128 | 128 |
| 129 template <class StyleDeclarationType> | 129 template <class StyleDeclarationType> |
| 130 static PassRefPtrWillBeRawPtr<MutableStylePropertySet> copyEditingProperties(Sty
leDeclarationType* style, EditingPropertiesType type = OnlyInheritableEditingPro
perties) | 130 static RawPtr<MutableStylePropertySet> copyEditingProperties(StyleDeclarationTyp
e* style, EditingPropertiesType type = OnlyInheritableEditingProperties) |
| 131 { | 131 { |
| 132 if (type == AllEditingProperties) | 132 if (type == AllEditingProperties) |
| 133 return style->copyPropertiesInSet(allEditingProperties()); | 133 return style->copyPropertiesInSet(allEditingProperties()); |
| 134 return style->copyPropertiesInSet(inheritableEditingProperties()); | 134 return style->copyPropertiesInSet(inheritableEditingProperties()); |
| 135 } | 135 } |
| 136 | 136 |
| 137 static inline bool isEditingProperty(int id) | 137 static inline bool isEditingProperty(int id) |
| 138 { | 138 { |
| 139 return allEditingProperties().contains(static_cast<CSSPropertyID>(id)); | 139 return allEditingProperties().contains(static_cast<CSSPropertyID>(id)); |
| 140 } | 140 } |
| 141 | 141 |
| 142 static PassRefPtrWillBeRawPtr<MutableStylePropertySet> editingStyleFromComputedS
tyle(PassRefPtrWillBeRawPtr<CSSComputedStyleDeclaration> style, EditingPropertie
sType type = OnlyInheritableEditingProperties) | 142 static RawPtr<MutableStylePropertySet> editingStyleFromComputedStyle(RawPtr<CSSC
omputedStyleDeclaration> style, EditingPropertiesType type = OnlyInheritableEdit
ingProperties) |
| 143 { | 143 { |
| 144 if (!style) | 144 if (!style) |
| 145 return MutableStylePropertySet::create(HTMLQuirksMode); | 145 return MutableStylePropertySet::create(HTMLQuirksMode); |
| 146 return copyEditingProperties(style.get(), type); | 146 return copyEditingProperties(style.get(), type); |
| 147 } | 147 } |
| 148 | 148 |
| 149 static PassRefPtrWillBeRawPtr<CSSComputedStyleDeclaration> ensureComputedStyle(c
onst Position& position) | 149 static RawPtr<CSSComputedStyleDeclaration> ensureComputedStyle(const Position& p
osition) |
| 150 { | 150 { |
| 151 Element* elem = associatedElementOf(position); | 151 Element* elem = associatedElementOf(position); |
| 152 if (!elem) | 152 if (!elem) |
| 153 return nullptr; | 153 return nullptr; |
| 154 return CSSComputedStyleDeclaration::create(elem); | 154 return CSSComputedStyleDeclaration::create(elem); |
| 155 } | 155 } |
| 156 | 156 |
| 157 static PassRefPtrWillBeRawPtr<MutableStylePropertySet> getPropertiesNotIn(StyleP
ropertySet* styleWithRedundantProperties, CSSStyleDeclaration* baseStyle); | 157 static RawPtr<MutableStylePropertySet> getPropertiesNotIn(StylePropertySet* styl
eWithRedundantProperties, CSSStyleDeclaration* baseStyle); |
| 158 enum LegacyFontSizeMode { AlwaysUseLegacyFontSize, UseLegacyFontSizeOnlyIfPixelV
aluesMatch }; | 158 enum LegacyFontSizeMode { AlwaysUseLegacyFontSize, UseLegacyFontSizeOnlyIfPixelV
aluesMatch }; |
| 159 static int legacyFontSizeFromCSSValue(Document*, CSSPrimitiveValue*, bool, Legac
yFontSizeMode); | 159 static int legacyFontSizeFromCSSValue(Document*, CSSPrimitiveValue*, bool, Legac
yFontSizeMode); |
| 160 static bool isTransparentColorValue(CSSValue*); | 160 static bool isTransparentColorValue(CSSValue*); |
| 161 static bool hasTransparentBackgroundColor(CSSStyleDeclaration*); | 161 static bool hasTransparentBackgroundColor(CSSStyleDeclaration*); |
| 162 static bool hasTransparentBackgroundColor(StylePropertySet*); | 162 static bool hasTransparentBackgroundColor(StylePropertySet*); |
| 163 static PassRefPtrWillBeRawPtr<CSSValue> backgroundColorValueInEffect(Node*); | 163 static RawPtr<CSSValue> backgroundColorValueInEffect(Node*); |
| 164 | 164 |
| 165 class HTMLElementEquivalent : public NoBaseWillBeGarbageCollected<HTMLElementEqu
ivalent> { | 165 class HTMLElementEquivalent : public GarbageCollected<HTMLElementEquivalent> { |
| 166 USING_FAST_MALLOC_WILL_BE_REMOVED(HTMLElementEquivalent); | |
| 167 DECLARE_EMPTY_VIRTUAL_DESTRUCTOR_WILL_BE_REMOVED(HTMLElementEquivalent); | |
| 168 public: | 166 public: |
| 169 static PassOwnPtrWillBeRawPtr<HTMLElementEquivalent> create(CSSPropertyID pr
opertyID, CSSValueID primitiveValue, const HTMLQualifiedName& tagName) | 167 static RawPtr<HTMLElementEquivalent> create(CSSPropertyID propertyID, CSSVal
ueID primitiveValue, const HTMLQualifiedName& tagName) |
| 170 { | 168 { |
| 171 return adoptPtrWillBeNoop(new HTMLElementEquivalent(propertyID, primitiv
eValue, tagName)); | 169 return new HTMLElementEquivalent(propertyID, primitiveValue, tagName); |
| 172 } | 170 } |
| 173 | 171 |
| 174 virtual bool matches(const Element* element) const { return !m_tagName || el
ement->hasTagName(*m_tagName); } | 172 virtual bool matches(const Element* element) const { return !m_tagName || el
ement->hasTagName(*m_tagName); } |
| 175 virtual bool hasAttribute() const { return false; } | 173 virtual bool hasAttribute() const { return false; } |
| 176 virtual bool propertyExistsInStyle(const StylePropertySet* style) const { re
turn style->getPropertyCSSValue(m_propertyID); } | 174 virtual bool propertyExistsInStyle(const StylePropertySet* style) const { re
turn style->getPropertyCSSValue(m_propertyID); } |
| 177 virtual bool valueIsPresentInStyle(HTMLElement*, StylePropertySet*) const; | 175 virtual bool valueIsPresentInStyle(HTMLElement*, StylePropertySet*) const; |
| 178 virtual void addToStyle(Element*, EditingStyle*) const; | 176 virtual void addToStyle(Element*, EditingStyle*) const; |
| 179 | 177 |
| 180 DEFINE_INLINE_VIRTUAL_TRACE() { visitor->trace(m_primitiveValue); } | 178 DEFINE_INLINE_VIRTUAL_TRACE() { visitor->trace(m_primitiveValue); } |
| 181 | 179 |
| 182 protected: | 180 protected: |
| 183 HTMLElementEquivalent(CSSPropertyID); | 181 HTMLElementEquivalent(CSSPropertyID); |
| 184 HTMLElementEquivalent(CSSPropertyID, const HTMLQualifiedName& tagName); | 182 HTMLElementEquivalent(CSSPropertyID, const HTMLQualifiedName& tagName); |
| 185 HTMLElementEquivalent(CSSPropertyID, CSSValueID primitiveValue, const HTMLQu
alifiedName& tagName); | 183 HTMLElementEquivalent(CSSPropertyID, CSSValueID primitiveValue, const HTMLQu
alifiedName& tagName); |
| 186 const CSSPropertyID m_propertyID; | 184 const CSSPropertyID m_propertyID; |
| 187 const RefPtrWillBeMember<CSSPrimitiveValue> m_primitiveValue; | 185 const Member<CSSPrimitiveValue> m_primitiveValue; |
| 188 const HTMLQualifiedName* m_tagName; // We can store a pointer because HTML t
ag names are const global. | 186 const HTMLQualifiedName* m_tagName; // We can store a pointer because HTML t
ag names are const global. |
| 189 }; | 187 }; |
| 190 | 188 |
| 191 DEFINE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(HTMLElementEquivalent); | |
| 192 | |
| 193 HTMLElementEquivalent::HTMLElementEquivalent(CSSPropertyID id) | 189 HTMLElementEquivalent::HTMLElementEquivalent(CSSPropertyID id) |
| 194 : m_propertyID(id) | 190 : m_propertyID(id) |
| 195 , m_tagName(0) | 191 , m_tagName(0) |
| 196 { | 192 { |
| 197 } | 193 } |
| 198 | 194 |
| 199 HTMLElementEquivalent::HTMLElementEquivalent(CSSPropertyID id, const HTMLQualifi
edName& tagName) | 195 HTMLElementEquivalent::HTMLElementEquivalent(CSSPropertyID id, const HTMLQualifi
edName& tagName) |
| 200 : m_propertyID(id) | 196 : m_propertyID(id) |
| 201 , m_tagName(&tagName) | 197 , m_tagName(&tagName) |
| 202 { | 198 { |
| 203 } | 199 } |
| 204 | 200 |
| 205 HTMLElementEquivalent::HTMLElementEquivalent(CSSPropertyID id, CSSValueID primit
iveValue, const HTMLQualifiedName& tagName) | 201 HTMLElementEquivalent::HTMLElementEquivalent(CSSPropertyID id, CSSValueID primit
iveValue, const HTMLQualifiedName& tagName) |
| 206 : m_propertyID(id) | 202 : m_propertyID(id) |
| 207 , m_primitiveValue(CSSPrimitiveValue::createIdentifier(primitiveValue)) | 203 , m_primitiveValue(CSSPrimitiveValue::createIdentifier(primitiveValue)) |
| 208 , m_tagName(&tagName) | 204 , m_tagName(&tagName) |
| 209 { | 205 { |
| 210 ASSERT(primitiveValue != CSSValueInvalid); | 206 ASSERT(primitiveValue != CSSValueInvalid); |
| 211 } | 207 } |
| 212 | 208 |
| 213 bool HTMLElementEquivalent::valueIsPresentInStyle(HTMLElement* element, StylePro
pertySet* style) const | 209 bool HTMLElementEquivalent::valueIsPresentInStyle(HTMLElement* element, StylePro
pertySet* style) const |
| 214 { | 210 { |
| 215 RefPtrWillBeRawPtr<CSSValue> value = style->getPropertyCSSValue(m_propertyID
); | 211 RawPtr<CSSValue> value = style->getPropertyCSSValue(m_propertyID); |
| 216 return matches(element) && value && value->isPrimitiveValue() && toCSSPrimit
iveValue(value.get())->getValueID() == m_primitiveValue->getValueID(); | 212 return matches(element) && value && value->isPrimitiveValue() && toCSSPrimit
iveValue(value.get())->getValueID() == m_primitiveValue->getValueID(); |
| 217 } | 213 } |
| 218 | 214 |
| 219 void HTMLElementEquivalent::addToStyle(Element*, EditingStyle* style) const | 215 void HTMLElementEquivalent::addToStyle(Element*, EditingStyle* style) const |
| 220 { | 216 { |
| 221 style->setProperty(m_propertyID, m_primitiveValue->cssText()); | 217 style->setProperty(m_propertyID, m_primitiveValue->cssText()); |
| 222 } | 218 } |
| 223 | 219 |
| 224 class HTMLTextDecorationEquivalent final : public HTMLElementEquivalent { | 220 class HTMLTextDecorationEquivalent final : public HTMLElementEquivalent { |
| 225 public: | 221 public: |
| 226 static PassOwnPtrWillBeRawPtr<HTMLElementEquivalent> create(CSSValueID primi
tiveValue, const HTMLQualifiedName& tagName) | 222 static RawPtr<HTMLElementEquivalent> create(CSSValueID primitiveValue, const
HTMLQualifiedName& tagName) |
| 227 { | 223 { |
| 228 return adoptPtrWillBeNoop(new HTMLTextDecorationEquivalent(primitiveValu
e, tagName)); | 224 return new HTMLTextDecorationEquivalent(primitiveValue, tagName); |
| 229 } | 225 } |
| 230 bool propertyExistsInStyle(const StylePropertySet*) const override; | 226 bool propertyExistsInStyle(const StylePropertySet*) const override; |
| 231 bool valueIsPresentInStyle(HTMLElement*, StylePropertySet*) const override; | 227 bool valueIsPresentInStyle(HTMLElement*, StylePropertySet*) const override; |
| 232 | 228 |
| 233 DEFINE_INLINE_VIRTUAL_TRACE() { HTMLElementEquivalent::trace(visitor); } | 229 DEFINE_INLINE_VIRTUAL_TRACE() { HTMLElementEquivalent::trace(visitor); } |
| 234 | 230 |
| 235 private: | 231 private: |
| 236 HTMLTextDecorationEquivalent(CSSValueID primitiveValue, const HTMLQualifiedN
ame& tagName); | 232 HTMLTextDecorationEquivalent(CSSValueID primitiveValue, const HTMLQualifiedN
ame& tagName); |
| 237 }; | 233 }; |
| 238 | 234 |
| 239 HTMLTextDecorationEquivalent::HTMLTextDecorationEquivalent(CSSValueID primitiveV
alue, const HTMLQualifiedName& tagName) | 235 HTMLTextDecorationEquivalent::HTMLTextDecorationEquivalent(CSSValueID primitiveV
alue, const HTMLQualifiedName& tagName) |
| 240 : HTMLElementEquivalent(textDecorationPropertyForEditing(), primitiveValue,
tagName) | 236 : HTMLElementEquivalent(textDecorationPropertyForEditing(), primitiveValue,
tagName) |
| 241 // m_propertyID is used in HTMLElementEquivalent::addToStyle | 237 // m_propertyID is used in HTMLElementEquivalent::addToStyle |
| 242 { | 238 { |
| 243 } | 239 } |
| 244 | 240 |
| 245 bool HTMLTextDecorationEquivalent::propertyExistsInStyle(const StylePropertySet*
style) const | 241 bool HTMLTextDecorationEquivalent::propertyExistsInStyle(const StylePropertySet*
style) const |
| 246 { | 242 { |
| 247 return style->getPropertyCSSValue(CSSPropertyWebkitTextDecorationsInEffect) | 243 return style->getPropertyCSSValue(CSSPropertyWebkitTextDecorationsInEffect) |
| 248 || style->getPropertyCSSValue(textDecorationPropertyForEditing()); | 244 || style->getPropertyCSSValue(textDecorationPropertyForEditing()); |
| 249 } | 245 } |
| 250 | 246 |
| 251 bool HTMLTextDecorationEquivalent::valueIsPresentInStyle(HTMLElement* element, S
tylePropertySet* style) const | 247 bool HTMLTextDecorationEquivalent::valueIsPresentInStyle(HTMLElement* element, S
tylePropertySet* style) const |
| 252 { | 248 { |
| 253 RefPtrWillBeRawPtr<CSSValue> styleValue = style->getPropertyCSSValue(CSSProp
ertyWebkitTextDecorationsInEffect); | 249 RawPtr<CSSValue> styleValue = style->getPropertyCSSValue(CSSPropertyWebkitTe
xtDecorationsInEffect); |
| 254 if (!styleValue) | 250 if (!styleValue) |
| 255 styleValue = style->getPropertyCSSValue(textDecorationPropertyForEditing
()); | 251 styleValue = style->getPropertyCSSValue(textDecorationPropertyForEditing
()); |
| 256 return matches(element) && styleValue && styleValue->isValueList() && toCSSV
alueList(styleValue.get())->hasValue(m_primitiveValue.get()); | 252 return matches(element) && styleValue && styleValue->isValueList() && toCSSV
alueList(styleValue.get())->hasValue(m_primitiveValue.get()); |
| 257 } | 253 } |
| 258 | 254 |
| 259 class HTMLAttributeEquivalent : public HTMLElementEquivalent { | 255 class HTMLAttributeEquivalent : public HTMLElementEquivalent { |
| 260 public: | 256 public: |
| 261 static PassOwnPtrWillBeRawPtr<HTMLAttributeEquivalent> create(CSSPropertyID
propertyID, const HTMLQualifiedName& tagName, const QualifiedName& attrName) | 257 static RawPtr<HTMLAttributeEquivalent> create(CSSPropertyID propertyID, cons
t HTMLQualifiedName& tagName, const QualifiedName& attrName) |
| 262 { | 258 { |
| 263 return adoptPtrWillBeNoop(new HTMLAttributeEquivalent(propertyID, tagNam
e, attrName)); | 259 return new HTMLAttributeEquivalent(propertyID, tagName, attrName); |
| 264 } | 260 } |
| 265 static PassOwnPtrWillBeRawPtr<HTMLAttributeEquivalent> create(CSSPropertyID
propertyID, const QualifiedName& attrName) | 261 static RawPtr<HTMLAttributeEquivalent> create(CSSPropertyID propertyID, cons
t QualifiedName& attrName) |
| 266 { | 262 { |
| 267 return adoptPtrWillBeNoop(new HTMLAttributeEquivalent(propertyID, attrNa
me)); | 263 return new HTMLAttributeEquivalent(propertyID, attrName); |
| 268 } | 264 } |
| 269 | 265 |
| 270 bool matches(const Element* element) const override { return HTMLElementEqui
valent::matches(element) && element->hasAttribute(m_attrName); } | 266 bool matches(const Element* element) const override { return HTMLElementEqui
valent::matches(element) && element->hasAttribute(m_attrName); } |
| 271 bool hasAttribute() const override { return true; } | 267 bool hasAttribute() const override { return true; } |
| 272 bool valueIsPresentInStyle(HTMLElement*, StylePropertySet*) const override; | 268 bool valueIsPresentInStyle(HTMLElement*, StylePropertySet*) const override; |
| 273 void addToStyle(Element*, EditingStyle*) const override; | 269 void addToStyle(Element*, EditingStyle*) const override; |
| 274 virtual PassRefPtrWillBeRawPtr<CSSValue> attributeValueAsCSSValue(Element*)
const; | 270 virtual RawPtr<CSSValue> attributeValueAsCSSValue(Element*) const; |
| 275 inline const QualifiedName& attributeName() const { return m_attrName; } | 271 inline const QualifiedName& attributeName() const { return m_attrName; } |
| 276 | 272 |
| 277 DEFINE_INLINE_VIRTUAL_TRACE() { HTMLElementEquivalent::trace(visitor); } | 273 DEFINE_INLINE_VIRTUAL_TRACE() { HTMLElementEquivalent::trace(visitor); } |
| 278 | 274 |
| 279 protected: | 275 protected: |
| 280 HTMLAttributeEquivalent(CSSPropertyID, const HTMLQualifiedName& tagName, con
st QualifiedName& attrName); | 276 HTMLAttributeEquivalent(CSSPropertyID, const HTMLQualifiedName& tagName, con
st QualifiedName& attrName); |
| 281 HTMLAttributeEquivalent(CSSPropertyID, const QualifiedName& attrName); | 277 HTMLAttributeEquivalent(CSSPropertyID, const QualifiedName& attrName); |
| 282 const QualifiedName& m_attrName; // We can store a reference because HTML at
tribute names are const global. | 278 const QualifiedName& m_attrName; // We can store a reference because HTML at
tribute names are const global. |
| 283 }; | 279 }; |
| 284 | 280 |
| 285 HTMLAttributeEquivalent::HTMLAttributeEquivalent(CSSPropertyID id, const HTMLQua
lifiedName& tagName, const QualifiedName& attrName) | 281 HTMLAttributeEquivalent::HTMLAttributeEquivalent(CSSPropertyID id, const HTMLQua
lifiedName& tagName, const QualifiedName& attrName) |
| 286 : HTMLElementEquivalent(id, tagName) | 282 : HTMLElementEquivalent(id, tagName) |
| 287 , m_attrName(attrName) | 283 , m_attrName(attrName) |
| 288 { | 284 { |
| 289 } | 285 } |
| 290 | 286 |
| 291 HTMLAttributeEquivalent::HTMLAttributeEquivalent(CSSPropertyID id, const Qualifi
edName& attrName) | 287 HTMLAttributeEquivalent::HTMLAttributeEquivalent(CSSPropertyID id, const Qualifi
edName& attrName) |
| 292 : HTMLElementEquivalent(id) | 288 : HTMLElementEquivalent(id) |
| 293 , m_attrName(attrName) | 289 , m_attrName(attrName) |
| 294 { | 290 { |
| 295 } | 291 } |
| 296 | 292 |
| 297 bool HTMLAttributeEquivalent::valueIsPresentInStyle(HTMLElement* element, StyleP
ropertySet* style) const | 293 bool HTMLAttributeEquivalent::valueIsPresentInStyle(HTMLElement* element, StyleP
ropertySet* style) const |
| 298 { | 294 { |
| 299 RefPtrWillBeRawPtr<CSSValue> value = attributeValueAsCSSValue(element); | 295 RawPtr<CSSValue> value = attributeValueAsCSSValue(element); |
| 300 RefPtrWillBeRawPtr<CSSValue> styleValue = style->getPropertyCSSValue(m_prope
rtyID); | 296 RawPtr<CSSValue> styleValue = style->getPropertyCSSValue(m_propertyID); |
| 301 | 297 |
| 302 return compareCSSValuePtr(value, styleValue); | 298 return compareCSSValuePtr(value, styleValue); |
| 303 } | 299 } |
| 304 | 300 |
| 305 void HTMLAttributeEquivalent::addToStyle(Element* element, EditingStyle* style)
const | 301 void HTMLAttributeEquivalent::addToStyle(Element* element, EditingStyle* style)
const |
| 306 { | 302 { |
| 307 if (RefPtrWillBeRawPtr<CSSValue> value = attributeValueAsCSSValue(element)) | 303 if (RawPtr<CSSValue> value = attributeValueAsCSSValue(element)) |
| 308 style->setProperty(m_propertyID, value->cssText()); | 304 style->setProperty(m_propertyID, value->cssText()); |
| 309 } | 305 } |
| 310 | 306 |
| 311 PassRefPtrWillBeRawPtr<CSSValue> HTMLAttributeEquivalent::attributeValueAsCSSVal
ue(Element* element) const | 307 RawPtr<CSSValue> HTMLAttributeEquivalent::attributeValueAsCSSValue(Element* elem
ent) const |
| 312 { | 308 { |
| 313 ASSERT(element); | 309 ASSERT(element); |
| 314 const AtomicString& value = element->getAttribute(m_attrName); | 310 const AtomicString& value = element->getAttribute(m_attrName); |
| 315 if (value.isNull()) | 311 if (value.isNull()) |
| 316 return nullptr; | 312 return nullptr; |
| 317 | 313 |
| 318 RefPtrWillBeRawPtr<MutableStylePropertySet> dummyStyle = nullptr; | 314 RawPtr<MutableStylePropertySet> dummyStyle = nullptr; |
| 319 dummyStyle = MutableStylePropertySet::create(HTMLQuirksMode); | 315 dummyStyle = MutableStylePropertySet::create(HTMLQuirksMode); |
| 320 dummyStyle->setProperty(m_propertyID, value); | 316 dummyStyle->setProperty(m_propertyID, value); |
| 321 return dummyStyle->getPropertyCSSValue(m_propertyID); | 317 return dummyStyle->getPropertyCSSValue(m_propertyID); |
| 322 } | 318 } |
| 323 | 319 |
| 324 class HTMLFontSizeEquivalent final : public HTMLAttributeEquivalent { | 320 class HTMLFontSizeEquivalent final : public HTMLAttributeEquivalent { |
| 325 public: | 321 public: |
| 326 static PassOwnPtrWillBeRawPtr<HTMLFontSizeEquivalent> create() | 322 static RawPtr<HTMLFontSizeEquivalent> create() |
| 327 { | 323 { |
| 328 return adoptPtrWillBeNoop(new HTMLFontSizeEquivalent()); | 324 return new HTMLFontSizeEquivalent(); |
| 329 } | 325 } |
| 330 PassRefPtrWillBeRawPtr<CSSValue> attributeValueAsCSSValue(Element*) const ov
erride; | 326 RawPtr<CSSValue> attributeValueAsCSSValue(Element*) const override; |
| 331 | 327 |
| 332 DEFINE_INLINE_VIRTUAL_TRACE() { HTMLAttributeEquivalent::trace(visitor); } | 328 DEFINE_INLINE_VIRTUAL_TRACE() { HTMLAttributeEquivalent::trace(visitor); } |
| 333 | 329 |
| 334 private: | 330 private: |
| 335 HTMLFontSizeEquivalent(); | 331 HTMLFontSizeEquivalent(); |
| 336 }; | 332 }; |
| 337 | 333 |
| 338 HTMLFontSizeEquivalent::HTMLFontSizeEquivalent() | 334 HTMLFontSizeEquivalent::HTMLFontSizeEquivalent() |
| 339 : HTMLAttributeEquivalent(CSSPropertyFontSize, HTMLNames::fontTag, HTMLNames
::sizeAttr) | 335 : HTMLAttributeEquivalent(CSSPropertyFontSize, HTMLNames::fontTag, HTMLNames
::sizeAttr) |
| 340 { | 336 { |
| 341 } | 337 } |
| 342 | 338 |
| 343 PassRefPtrWillBeRawPtr<CSSValue> HTMLFontSizeEquivalent::attributeValueAsCSSValu
e(Element* element) const | 339 RawPtr<CSSValue> HTMLFontSizeEquivalent::attributeValueAsCSSValue(Element* eleme
nt) const |
| 344 { | 340 { |
| 345 ASSERT(element); | 341 ASSERT(element); |
| 346 const AtomicString& value = element->getAttribute(m_attrName); | 342 const AtomicString& value = element->getAttribute(m_attrName); |
| 347 if (value.isNull()) | 343 if (value.isNull()) |
| 348 return nullptr; | 344 return nullptr; |
| 349 CSSValueID size; | 345 CSSValueID size; |
| 350 if (!HTMLFontElement::cssValueFromFontSizeNumber(value, size)) | 346 if (!HTMLFontElement::cssValueFromFontSizeNumber(value, size)) |
| 351 return nullptr; | 347 return nullptr; |
| 352 return CSSPrimitiveValue::createIdentifier(size); | 348 return CSSPrimitiveValue::createIdentifier(size); |
| 353 } | 349 } |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 461 return textAlignResolvingStartAndEnd(getIdentifierValue(style, CSSPropertyTe
xtAlign), getIdentifierValue(style, CSSPropertyDirection)); | 457 return textAlignResolvingStartAndEnd(getIdentifierValue(style, CSSPropertyTe
xtAlign), getIdentifierValue(style, CSSPropertyDirection)); |
| 462 } | 458 } |
| 463 | 459 |
| 464 void EditingStyle::init(Node* node, PropertiesToInclude propertiesToInclude) | 460 void EditingStyle::init(Node* node, PropertiesToInclude propertiesToInclude) |
| 465 { | 461 { |
| 466 if (isTabHTMLSpanElementTextNode(node)) | 462 if (isTabHTMLSpanElementTextNode(node)) |
| 467 node = tabSpanElement(node)->parentNode(); | 463 node = tabSpanElement(node)->parentNode(); |
| 468 else if (isTabHTMLSpanElement(node)) | 464 else if (isTabHTMLSpanElement(node)) |
| 469 node = node->parentNode(); | 465 node = node->parentNode(); |
| 470 | 466 |
| 471 RefPtrWillBeRawPtr<CSSComputedStyleDeclaration> computedStyleAtPosition = CS
SComputedStyleDeclaration::create(node); | 467 RawPtr<CSSComputedStyleDeclaration> computedStyleAtPosition = CSSComputedSty
leDeclaration::create(node); |
| 472 m_mutableStyle = propertiesToInclude == AllProperties && computedStyleAtPosi
tion ? computedStyleAtPosition->copyProperties() : editingStyleFromComputedStyle
(computedStyleAtPosition); | 468 m_mutableStyle = propertiesToInclude == AllProperties && computedStyleAtPosi
tion ? computedStyleAtPosition->copyProperties() : editingStyleFromComputedStyle
(computedStyleAtPosition); |
| 473 | 469 |
| 474 if (propertiesToInclude == EditingPropertiesInEffect) { | 470 if (propertiesToInclude == EditingPropertiesInEffect) { |
| 475 if (RefPtrWillBeRawPtr<CSSValue> value = backgroundColorValueInEffect(no
de)) | 471 if (RawPtr<CSSValue> value = backgroundColorValueInEffect(node)) |
| 476 m_mutableStyle->setProperty(CSSPropertyBackgroundColor, value->cssTe
xt()); | 472 m_mutableStyle->setProperty(CSSPropertyBackgroundColor, value->cssTe
xt()); |
| 477 if (RefPtrWillBeRawPtr<CSSValue> value = computedStyleAtPosition->getPro
pertyCSSValue(CSSPropertyWebkitTextDecorationsInEffect)) | 473 if (RawPtr<CSSValue> value = computedStyleAtPosition->getPropertyCSSValu
e(CSSPropertyWebkitTextDecorationsInEffect)) |
| 478 m_mutableStyle->setProperty(CSSPropertyTextDecoration, value->cssTex
t()); | 474 m_mutableStyle->setProperty(CSSPropertyTextDecoration, value->cssTex
t()); |
| 479 } | 475 } |
| 480 | 476 |
| 481 if (node && node->ensureComputedStyle()) { | 477 if (node && node->ensureComputedStyle()) { |
| 482 const ComputedStyle* computedStyle = node->ensureComputedStyle(); | 478 const ComputedStyle* computedStyle = node->ensureComputedStyle(); |
| 483 removeTextFillAndStrokeColorsIfNeeded(computedStyle); | 479 removeTextFillAndStrokeColorsIfNeeded(computedStyle); |
| 484 replaceFontSizeByKeywordIfPossible(computedStyle, computedStyleAtPositio
n.get()); | 480 replaceFontSizeByKeywordIfPossible(computedStyle, computedStyleAtPositio
n.get()); |
| 485 } | 481 } |
| 486 | 482 |
| 487 m_isMonospaceFont = computedStyleAtPosition->isMonospaceFont(); | 483 m_isMonospaceFont = computedStyleAtPosition->isMonospaceFont(); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 519 if (!m_mutableStyle) | 515 if (!m_mutableStyle) |
| 520 return; | 516 return; |
| 521 | 517 |
| 522 if (m_mutableStyle->getPropertyCSSValue(CSSPropertyFontSize)) { | 518 if (m_mutableStyle->getPropertyCSSValue(CSSPropertyFontSize)) { |
| 523 // Explicit font size overrides any delta. | 519 // Explicit font size overrides any delta. |
| 524 m_mutableStyle->removeProperty(CSSPropertyWebkitFontSizeDelta); | 520 m_mutableStyle->removeProperty(CSSPropertyWebkitFontSizeDelta); |
| 525 return; | 521 return; |
| 526 } | 522 } |
| 527 | 523 |
| 528 // Get the adjustment amount out of the style. | 524 // Get the adjustment amount out of the style. |
| 529 RefPtrWillBeRawPtr<CSSValue> value = m_mutableStyle->getPropertyCSSValue(CSS
PropertyWebkitFontSizeDelta); | 525 RawPtr<CSSValue> value = m_mutableStyle->getPropertyCSSValue(CSSPropertyWebk
itFontSizeDelta); |
| 530 if (!value || !value->isPrimitiveValue()) | 526 if (!value || !value->isPrimitiveValue()) |
| 531 return; | 527 return; |
| 532 | 528 |
| 533 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value.get()); | 529 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value.get()); |
| 534 | 530 |
| 535 // Only PX handled now. If we handle more types in the future, perhaps | 531 // Only PX handled now. If we handle more types in the future, perhaps |
| 536 // a switch statement here would be more appropriate. | 532 // a switch statement here would be more appropriate. |
| 537 if (!primitiveValue->isPx()) | 533 if (!primitiveValue->isPx()) |
| 538 return; | 534 return; |
| 539 | 535 |
| 540 m_fontSizeDelta = primitiveValue->getFloatValue(); | 536 m_fontSizeDelta = primitiveValue->getFloatValue(); |
| 541 m_mutableStyle->removeProperty(CSSPropertyWebkitFontSizeDelta); | 537 m_mutableStyle->removeProperty(CSSPropertyWebkitFontSizeDelta); |
| 542 } | 538 } |
| 543 | 539 |
| 544 bool EditingStyle::isEmpty() const | 540 bool EditingStyle::isEmpty() const |
| 545 { | 541 { |
| 546 return (!m_mutableStyle || m_mutableStyle->isEmpty()) && m_fontSizeDelta ==
NoFontDelta; | 542 return (!m_mutableStyle || m_mutableStyle->isEmpty()) && m_fontSizeDelta ==
NoFontDelta; |
| 547 } | 543 } |
| 548 | 544 |
| 549 bool EditingStyle::textDirection(WritingDirection& writingDirection) const | 545 bool EditingStyle::textDirection(WritingDirection& writingDirection) const |
| 550 { | 546 { |
| 551 if (!m_mutableStyle) | 547 if (!m_mutableStyle) |
| 552 return false; | 548 return false; |
| 553 | 549 |
| 554 RefPtrWillBeRawPtr<CSSValue> unicodeBidi = m_mutableStyle->getPropertyCSSVal
ue(CSSPropertyUnicodeBidi); | 550 RawPtr<CSSValue> unicodeBidi = m_mutableStyle->getPropertyCSSValue(CSSProper
tyUnicodeBidi); |
| 555 if (!unicodeBidi || !unicodeBidi->isPrimitiveValue()) | 551 if (!unicodeBidi || !unicodeBidi->isPrimitiveValue()) |
| 556 return false; | 552 return false; |
| 557 | 553 |
| 558 CSSValueID unicodeBidiValue = toCSSPrimitiveValue(unicodeBidi.get())->getVal
ueID(); | 554 CSSValueID unicodeBidiValue = toCSSPrimitiveValue(unicodeBidi.get())->getVal
ueID(); |
| 559 if (isEmbedOrIsolate(unicodeBidiValue)) { | 555 if (isEmbedOrIsolate(unicodeBidiValue)) { |
| 560 RefPtrWillBeRawPtr<CSSValue> direction = m_mutableStyle->getPropertyCSSV
alue(CSSPropertyDirection); | 556 RawPtr<CSSValue> direction = m_mutableStyle->getPropertyCSSValue(CSSProp
ertyDirection); |
| 561 if (!direction || !direction->isPrimitiveValue()) | 557 if (!direction || !direction->isPrimitiveValue()) |
| 562 return false; | 558 return false; |
| 563 | 559 |
| 564 writingDirection = toCSSPrimitiveValue(direction.get())->getValueID() ==
CSSValueLtr ? LeftToRightWritingDirection : RightToLeftWritingDirection; | 560 writingDirection = toCSSPrimitiveValue(direction.get())->getValueID() ==
CSSValueLtr ? LeftToRightWritingDirection : RightToLeftWritingDirection; |
| 565 | 561 |
| 566 return true; | 562 return true; |
| 567 } | 563 } |
| 568 | 564 |
| 569 if (unicodeBidiValue == CSSValueNormal) { | 565 if (unicodeBidiValue == CSSValueNormal) { |
| 570 writingDirection = NaturalWritingDirection; | 566 writingDirection = NaturalWritingDirection; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 584 extractFontSizeDelta(); | 580 extractFontSizeDelta(); |
| 585 } | 581 } |
| 586 | 582 |
| 587 void EditingStyle::clear() | 583 void EditingStyle::clear() |
| 588 { | 584 { |
| 589 m_mutableStyle.clear(); | 585 m_mutableStyle.clear(); |
| 590 m_isMonospaceFont = false; | 586 m_isMonospaceFont = false; |
| 591 m_fontSizeDelta = NoFontDelta; | 587 m_fontSizeDelta = NoFontDelta; |
| 592 } | 588 } |
| 593 | 589 |
| 594 PassRefPtrWillBeRawPtr<EditingStyle> EditingStyle::copy() const | 590 RawPtr<EditingStyle> EditingStyle::copy() const |
| 595 { | 591 { |
| 596 RefPtrWillBeRawPtr<EditingStyle> copy = EditingStyle::create(); | 592 RawPtr<EditingStyle> copy = EditingStyle::create(); |
| 597 if (m_mutableStyle) | 593 if (m_mutableStyle) |
| 598 copy->m_mutableStyle = m_mutableStyle->mutableCopy(); | 594 copy->m_mutableStyle = m_mutableStyle->mutableCopy(); |
| 599 copy->m_isMonospaceFont = m_isMonospaceFont; | 595 copy->m_isMonospaceFont = m_isMonospaceFont; |
| 600 copy->m_fontSizeDelta = m_fontSizeDelta; | 596 copy->m_fontSizeDelta = m_fontSizeDelta; |
| 601 return copy; | 597 return copy; |
| 602 } | 598 } |
| 603 | 599 |
| 604 // This is the list of CSS properties that apply specially to block-level elemen
ts. | 600 // This is the list of CSS properties that apply specially to block-level elemen
ts. |
| 605 static const CSSPropertyID staticBlockProperties[] = { | 601 static const CSSPropertyID staticBlockProperties[] = { |
| 606 CSSPropertyBreakAfter, | 602 CSSPropertyBreakAfter, |
| (...skipping 21 matching lines...) Expand all Loading... |
| 628 }; | 624 }; |
| 629 | 625 |
| 630 static const Vector<CSSPropertyID>& blockPropertiesVector() | 626 static const Vector<CSSPropertyID>& blockPropertiesVector() |
| 631 { | 627 { |
| 632 DEFINE_STATIC_LOCAL(Vector<CSSPropertyID>, properties, ()); | 628 DEFINE_STATIC_LOCAL(Vector<CSSPropertyID>, properties, ()); |
| 633 if (properties.isEmpty()) | 629 if (properties.isEmpty()) |
| 634 CSSPropertyMetadata::filterEnabledCSSPropertiesIntoVector(staticBlockPro
perties, WTF_ARRAY_LENGTH(staticBlockProperties), properties); | 630 CSSPropertyMetadata::filterEnabledCSSPropertiesIntoVector(staticBlockPro
perties, WTF_ARRAY_LENGTH(staticBlockProperties), properties); |
| 635 return properties; | 631 return properties; |
| 636 } | 632 } |
| 637 | 633 |
| 638 PassRefPtrWillBeRawPtr<EditingStyle> EditingStyle::extractAndRemoveBlockProperti
es() | 634 RawPtr<EditingStyle> EditingStyle::extractAndRemoveBlockProperties() |
| 639 { | 635 { |
| 640 RefPtrWillBeRawPtr<EditingStyle> blockProperties = EditingStyle::create(); | 636 RawPtr<EditingStyle> blockProperties = EditingStyle::create(); |
| 641 if (!m_mutableStyle) | 637 if (!m_mutableStyle) |
| 642 return blockProperties; | 638 return blockProperties; |
| 643 | 639 |
| 644 blockProperties->m_mutableStyle = m_mutableStyle->copyPropertiesInSet(blockP
ropertiesVector()); | 640 blockProperties->m_mutableStyle = m_mutableStyle->copyPropertiesInSet(blockP
ropertiesVector()); |
| 645 removeBlockProperties(); | 641 removeBlockProperties(); |
| 646 | 642 |
| 647 return blockProperties; | 643 return blockProperties; |
| 648 } | 644 } |
| 649 | 645 |
| 650 PassRefPtrWillBeRawPtr<EditingStyle> EditingStyle::extractAndRemoveTextDirection
() | 646 RawPtr<EditingStyle> EditingStyle::extractAndRemoveTextDirection() |
| 651 { | 647 { |
| 652 RefPtrWillBeRawPtr<EditingStyle> textDirection = EditingStyle::create(); | 648 RawPtr<EditingStyle> textDirection = EditingStyle::create(); |
| 653 textDirection->m_mutableStyle = MutableStylePropertySet::create(HTMLQuirksMo
de); | 649 textDirection->m_mutableStyle = MutableStylePropertySet::create(HTMLQuirksMo
de); |
| 654 textDirection->m_mutableStyle->setProperty(CSSPropertyUnicodeBidi, CSSValueI
solate, m_mutableStyle->propertyIsImportant(CSSPropertyUnicodeBidi)); | 650 textDirection->m_mutableStyle->setProperty(CSSPropertyUnicodeBidi, CSSValueI
solate, m_mutableStyle->propertyIsImportant(CSSPropertyUnicodeBidi)); |
| 655 textDirection->m_mutableStyle->setProperty(CSSPropertyDirection, m_mutableSt
yle->getPropertyValue(CSSPropertyDirection), | 651 textDirection->m_mutableStyle->setProperty(CSSPropertyDirection, m_mutableSt
yle->getPropertyValue(CSSPropertyDirection), |
| 656 m_mutableStyle->propertyIsImportant(CSSPropertyDirection)); | 652 m_mutableStyle->propertyIsImportant(CSSPropertyDirection)); |
| 657 | 653 |
| 658 m_mutableStyle->removeProperty(CSSPropertyUnicodeBidi); | 654 m_mutableStyle->removeProperty(CSSPropertyUnicodeBidi); |
| 659 m_mutableStyle->removeProperty(CSSPropertyDirection); | 655 m_mutableStyle->removeProperty(CSSPropertyDirection); |
| 660 | 656 |
| 661 return textDirection; | 657 return textDirection; |
| 662 } | 658 } |
| 663 | 659 |
| 664 void EditingStyle::removeBlockProperties() | 660 void EditingStyle::removeBlockProperties() |
| 665 { | 661 { |
| 666 if (!m_mutableStyle) | 662 if (!m_mutableStyle) |
| 667 return; | 663 return; |
| 668 | 664 |
| 669 m_mutableStyle->removePropertiesInSet(blockPropertiesVector().data(), blockP
ropertiesVector().size()); | 665 m_mutableStyle->removePropertiesInSet(blockPropertiesVector().data(), blockP
ropertiesVector().size()); |
| 670 } | 666 } |
| 671 | 667 |
| 672 void EditingStyle::removeStyleAddedByElement(Element* element) | 668 void EditingStyle::removeStyleAddedByElement(Element* element) |
| 673 { | 669 { |
| 674 if (!element || !element->parentNode()) | 670 if (!element || !element->parentNode()) |
| 675 return; | 671 return; |
| 676 RefPtrWillBeRawPtr<MutableStylePropertySet> parentStyle = editingStyleFromCo
mputedStyle(CSSComputedStyleDeclaration::create(element->parentNode()), AllEditi
ngProperties); | 672 RawPtr<MutableStylePropertySet> parentStyle = editingStyleFromComputedStyle(
CSSComputedStyleDeclaration::create(element->parentNode()), AllEditingProperties
); |
| 677 RefPtrWillBeRawPtr<MutableStylePropertySet> nodeStyle = editingStyleFromComp
utedStyle(CSSComputedStyleDeclaration::create(element), AllEditingProperties); | 673 RawPtr<MutableStylePropertySet> nodeStyle = editingStyleFromComputedStyle(CS
SComputedStyleDeclaration::create(element), AllEditingProperties); |
| 678 nodeStyle->removeEquivalentProperties(parentStyle.get()); | 674 nodeStyle->removeEquivalentProperties(parentStyle.get()); |
| 679 m_mutableStyle->removeEquivalentProperties(nodeStyle.get()); | 675 m_mutableStyle->removeEquivalentProperties(nodeStyle.get()); |
| 680 } | 676 } |
| 681 | 677 |
| 682 void EditingStyle::removeStyleConflictingWithStyleOfElement(Element* element) | 678 void EditingStyle::removeStyleConflictingWithStyleOfElement(Element* element) |
| 683 { | 679 { |
| 684 if (!element || !element->parentNode() || !m_mutableStyle) | 680 if (!element || !element->parentNode() || !m_mutableStyle) |
| 685 return; | 681 return; |
| 686 | 682 |
| 687 RefPtrWillBeRawPtr<MutableStylePropertySet> parentStyle = editingStyleFromCo
mputedStyle(CSSComputedStyleDeclaration::create(element->parentNode()), AllEditi
ngProperties); | 683 RawPtr<MutableStylePropertySet> parentStyle = editingStyleFromComputedStyle(
CSSComputedStyleDeclaration::create(element->parentNode()), AllEditingProperties
); |
| 688 RefPtrWillBeRawPtr<MutableStylePropertySet> nodeStyle = editingStyleFromComp
utedStyle(CSSComputedStyleDeclaration::create(element), AllEditingProperties); | 684 RawPtr<MutableStylePropertySet> nodeStyle = editingStyleFromComputedStyle(CS
SComputedStyleDeclaration::create(element), AllEditingProperties); |
| 689 nodeStyle->removeEquivalentProperties(parentStyle.get()); | 685 nodeStyle->removeEquivalentProperties(parentStyle.get()); |
| 690 | 686 |
| 691 unsigned propertyCount = nodeStyle->propertyCount(); | 687 unsigned propertyCount = nodeStyle->propertyCount(); |
| 692 for (unsigned i = 0; i < propertyCount; ++i) | 688 for (unsigned i = 0; i < propertyCount; ++i) |
| 693 m_mutableStyle->removeProperty(nodeStyle->propertyAt(i).id()); | 689 m_mutableStyle->removeProperty(nodeStyle->propertyAt(i).id()); |
| 694 } | 690 } |
| 695 | 691 |
| 696 void EditingStyle::collapseTextDecorationProperties() | 692 void EditingStyle::collapseTextDecorationProperties() |
| 697 { | 693 { |
| 698 if (!m_mutableStyle) | 694 if (!m_mutableStyle) |
| 699 return; | 695 return; |
| 700 | 696 |
| 701 RefPtrWillBeRawPtr<CSSValue> textDecorationsInEffect = m_mutableStyle->getPr
opertyCSSValue(CSSPropertyWebkitTextDecorationsInEffect); | 697 RawPtr<CSSValue> textDecorationsInEffect = m_mutableStyle->getPropertyCSSVal
ue(CSSPropertyWebkitTextDecorationsInEffect); |
| 702 if (!textDecorationsInEffect) | 698 if (!textDecorationsInEffect) |
| 703 return; | 699 return; |
| 704 | 700 |
| 705 if (textDecorationsInEffect->isValueList()) | 701 if (textDecorationsInEffect->isValueList()) |
| 706 m_mutableStyle->setProperty(textDecorationPropertyForEditing(), textDeco
rationsInEffect->cssText(), m_mutableStyle->propertyIsImportant(textDecorationPr
opertyForEditing())); | 702 m_mutableStyle->setProperty(textDecorationPropertyForEditing(), textDeco
rationsInEffect->cssText(), m_mutableStyle->propertyIsImportant(textDecorationPr
opertyForEditing())); |
| 707 else | 703 else |
| 708 m_mutableStyle->removeProperty(textDecorationPropertyForEditing()); | 704 m_mutableStyle->removeProperty(textDecorationPropertyForEditing()); |
| 709 m_mutableStyle->removeProperty(CSSPropertyWebkitTextDecorationsInEffect); | 705 m_mutableStyle->removeProperty(CSSPropertyWebkitTextDecorationsInEffect); |
| 710 } | 706 } |
| 711 | 707 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 723 | 719 |
| 724 TriState EditingStyle::triStateOfStyle(EditingStyle* style) const | 720 TriState EditingStyle::triStateOfStyle(EditingStyle* style) const |
| 725 { | 721 { |
| 726 if (!style || !style->m_mutableStyle) | 722 if (!style || !style->m_mutableStyle) |
| 727 return FalseTriState; | 723 return FalseTriState; |
| 728 return triStateOfStyle(style->m_mutableStyle->ensureCSSStyleDeclaration(), D
oNotIgnoreTextOnlyProperties); | 724 return triStateOfStyle(style->m_mutableStyle->ensureCSSStyleDeclaration(), D
oNotIgnoreTextOnlyProperties); |
| 729 } | 725 } |
| 730 | 726 |
| 731 TriState EditingStyle::triStateOfStyle(CSSStyleDeclaration* styleToCompare, Shou
ldIgnoreTextOnlyProperties shouldIgnoreTextOnlyProperties) const | 727 TriState EditingStyle::triStateOfStyle(CSSStyleDeclaration* styleToCompare, Shou
ldIgnoreTextOnlyProperties shouldIgnoreTextOnlyProperties) const |
| 732 { | 728 { |
| 733 RefPtrWillBeRawPtr<MutableStylePropertySet> difference = getPropertiesNotIn(
m_mutableStyle.get(), styleToCompare); | 729 RawPtr<MutableStylePropertySet> difference = getPropertiesNotIn(m_mutableSty
le.get(), styleToCompare); |
| 734 | 730 |
| 735 if (shouldIgnoreTextOnlyProperties == IgnoreTextOnlyProperties) | 731 if (shouldIgnoreTextOnlyProperties == IgnoreTextOnlyProperties) |
| 736 difference->removePropertiesInSet(textOnlyProperties, WTF_ARRAY_LENGTH(t
extOnlyProperties)); | 732 difference->removePropertiesInSet(textOnlyProperties, WTF_ARRAY_LENGTH(t
extOnlyProperties)); |
| 737 | 733 |
| 738 if (difference->isEmpty()) | 734 if (difference->isEmpty()) |
| 739 return TrueTriState; | 735 return TrueTriState; |
| 740 if (difference->propertyCount() == m_mutableStyle->propertyCount()) | 736 if (difference->propertyCount() == m_mutableStyle->propertyCount()) |
| 741 return FalseTriState; | 737 return FalseTriState; |
| 742 | 738 |
| 743 return MixedTriState; | 739 return MixedTriState; |
| 744 } | 740 } |
| 745 | 741 |
| 746 TriState EditingStyle::triStateOfStyle(const VisibleSelection& selection) const | 742 TriState EditingStyle::triStateOfStyle(const VisibleSelection& selection) const |
| 747 { | 743 { |
| 748 if (!selection.isCaretOrRange()) | 744 if (!selection.isCaretOrRange()) |
| 749 return FalseTriState; | 745 return FalseTriState; |
| 750 | 746 |
| 751 if (selection.isCaret()) | 747 if (selection.isCaret()) |
| 752 return triStateOfStyle(EditingStyle::styleAtSelectionStart(selection).ge
t()); | 748 return triStateOfStyle(EditingStyle::styleAtSelectionStart(selection).ge
t()); |
| 753 | 749 |
| 754 TriState state = FalseTriState; | 750 TriState state = FalseTriState; |
| 755 bool nodeIsStart = true; | 751 bool nodeIsStart = true; |
| 756 for (Node& node : NodeTraversal::startsAt(selection.start().anchorNode())) { | 752 for (Node& node : NodeTraversal::startsAt(selection.start().anchorNode())) { |
| 757 if (node.layoutObject() && node.hasEditableStyle()) { | 753 if (node.layoutObject() && node.hasEditableStyle()) { |
| 758 RefPtrWillBeRawPtr<CSSComputedStyleDeclaration> nodeStyle = CSSCompu
tedStyleDeclaration::create(&node); | 754 RawPtr<CSSComputedStyleDeclaration> nodeStyle = CSSComputedStyleDecl
aration::create(&node); |
| 759 if (nodeStyle) { | 755 if (nodeStyle) { |
| 760 TriState nodeState = triStateOfStyle(nodeStyle.get(), node.isTex
tNode() ? EditingStyle::DoNotIgnoreTextOnlyProperties : EditingStyle::IgnoreText
OnlyProperties); | 756 TriState nodeState = triStateOfStyle(nodeStyle.get(), node.isTex
tNode() ? EditingStyle::DoNotIgnoreTextOnlyProperties : EditingStyle::IgnoreText
OnlyProperties); |
| 761 if (nodeIsStart) { | 757 if (nodeIsStart) { |
| 762 state = nodeState; | 758 state = nodeState; |
| 763 nodeIsStart = false; | 759 nodeIsStart = false; |
| 764 } else if (state != nodeState && node.isTextNode()) { | 760 } else if (state != nodeState && node.isTextNode()) { |
| 765 state = MixedTriState; | 761 state = MixedTriState; |
| 766 break; | 762 break; |
| 767 } | 763 } |
| 768 } | 764 } |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 820 | 816 |
| 821 conflictingProperties->append(propertyID); | 817 conflictingProperties->append(propertyID); |
| 822 | 818 |
| 823 if (extractedStyle) | 819 if (extractedStyle) |
| 824 extractedStyle->setProperty(propertyID, inlineStyle->getPropertyValu
e(propertyID), inlineStyle->propertyIsImportant(propertyID)); | 820 extractedStyle->setProperty(propertyID, inlineStyle->getPropertyValu
e(propertyID), inlineStyle->propertyIsImportant(propertyID)); |
| 825 } | 821 } |
| 826 | 822 |
| 827 return conflictingProperties && !conflictingProperties->isEmpty(); | 823 return conflictingProperties && !conflictingProperties->isEmpty(); |
| 828 } | 824 } |
| 829 | 825 |
| 830 static const WillBeHeapVector<OwnPtrWillBeMember<HTMLElementEquivalent>>& htmlEl
ementEquivalents() | 826 static const HeapVector<Member<HTMLElementEquivalent>>& htmlElementEquivalents() |
| 831 { | 827 { |
| 832 DEFINE_STATIC_LOCAL(WillBePersistentHeapVector<OwnPtrWillBeMember<HTMLElemen
tEquivalent>>, HTMLElementEquivalents, ()); | 828 DEFINE_STATIC_LOCAL(PersistentHeapVector<Member<HTMLElementEquivalent>>, HTM
LElementEquivalents, ()); |
| 833 if (!HTMLElementEquivalents.size()) { | 829 if (!HTMLElementEquivalents.size()) { |
| 834 HTMLElementEquivalents.append(HTMLElementEquivalent::create(CSSPropertyF
ontWeight, CSSValueBold, HTMLNames::bTag)); | 830 HTMLElementEquivalents.append(HTMLElementEquivalent::create(CSSPropertyF
ontWeight, CSSValueBold, HTMLNames::bTag)); |
| 835 HTMLElementEquivalents.append(HTMLElementEquivalent::create(CSSPropertyF
ontWeight, CSSValueBold, HTMLNames::strongTag)); | 831 HTMLElementEquivalents.append(HTMLElementEquivalent::create(CSSPropertyF
ontWeight, CSSValueBold, HTMLNames::strongTag)); |
| 836 HTMLElementEquivalents.append(HTMLElementEquivalent::create(CSSPropertyV
erticalAlign, CSSValueSub, HTMLNames::subTag)); | 832 HTMLElementEquivalents.append(HTMLElementEquivalent::create(CSSPropertyV
erticalAlign, CSSValueSub, HTMLNames::subTag)); |
| 837 HTMLElementEquivalents.append(HTMLElementEquivalent::create(CSSPropertyV
erticalAlign, CSSValueSuper, HTMLNames::supTag)); | 833 HTMLElementEquivalents.append(HTMLElementEquivalent::create(CSSPropertyV
erticalAlign, CSSValueSuper, HTMLNames::supTag)); |
| 838 HTMLElementEquivalents.append(HTMLElementEquivalent::create(CSSPropertyF
ontStyle, CSSValueItalic, HTMLNames::iTag)); | 834 HTMLElementEquivalents.append(HTMLElementEquivalent::create(CSSPropertyF
ontStyle, CSSValueItalic, HTMLNames::iTag)); |
| 839 HTMLElementEquivalents.append(HTMLElementEquivalent::create(CSSPropertyF
ontStyle, CSSValueItalic, HTMLNames::emTag)); | 835 HTMLElementEquivalents.append(HTMLElementEquivalent::create(CSSPropertyF
ontStyle, CSSValueItalic, HTMLNames::emTag)); |
| 840 | 836 |
| 841 HTMLElementEquivalents.append(HTMLTextDecorationEquivalent::create(CSSVa
lueUnderline, HTMLNames::uTag)); | 837 HTMLElementEquivalents.append(HTMLTextDecorationEquivalent::create(CSSVa
lueUnderline, HTMLNames::uTag)); |
| 842 HTMLElementEquivalents.append(HTMLTextDecorationEquivalent::create(CSSVa
lueLineThrough, HTMLNames::sTag)); | 838 HTMLElementEquivalents.append(HTMLTextDecorationEquivalent::create(CSSVa
lueLineThrough, HTMLNames::sTag)); |
| 843 HTMLElementEquivalents.append(HTMLTextDecorationEquivalent::create(CSSVa
lueLineThrough, HTMLNames::strikeTag)); | 839 HTMLElementEquivalents.append(HTMLTextDecorationEquivalent::create(CSSVa
lueLineThrough, HTMLNames::strikeTag)); |
| 844 } | 840 } |
| 845 | 841 |
| 846 return HTMLElementEquivalents; | 842 return HTMLElementEquivalents; |
| 847 } | 843 } |
| 848 | 844 |
| 849 | 845 |
| 850 bool EditingStyle::conflictsWithImplicitStyleOfElement(HTMLElement* element, Edi
tingStyle* extractedStyle, ShouldExtractMatchingStyle shouldExtractMatchingStyle
) const | 846 bool EditingStyle::conflictsWithImplicitStyleOfElement(HTMLElement* element, Edi
tingStyle* extractedStyle, ShouldExtractMatchingStyle shouldExtractMatchingStyle
) const |
| 851 { | 847 { |
| 852 if (!m_mutableStyle) | 848 if (!m_mutableStyle) |
| 853 return false; | 849 return false; |
| 854 | 850 |
| 855 const WillBeHeapVector<OwnPtrWillBeMember<HTMLElementEquivalent>>& HTMLEleme
ntEquivalents = htmlElementEquivalents(); | 851 const HeapVector<Member<HTMLElementEquivalent>>& HTMLElementEquivalents = ht
mlElementEquivalents(); |
| 856 for (size_t i = 0; i < HTMLElementEquivalents.size(); ++i) { | 852 for (size_t i = 0; i < HTMLElementEquivalents.size(); ++i) { |
| 857 const HTMLElementEquivalent* equivalent = HTMLElementEquivalents[i].get(
); | 853 const HTMLElementEquivalent* equivalent = HTMLElementEquivalents[i].get(
); |
| 858 if (equivalent->matches(element) && equivalent->propertyExistsInStyle(m_
mutableStyle.get()) | 854 if (equivalent->matches(element) && equivalent->propertyExistsInStyle(m_
mutableStyle.get()) |
| 859 && (shouldExtractMatchingStyle == ExtractMatchingStyle || !equivalen
t->valueIsPresentInStyle(element, m_mutableStyle.get()))) { | 855 && (shouldExtractMatchingStyle == ExtractMatchingStyle || !equivalen
t->valueIsPresentInStyle(element, m_mutableStyle.get()))) { |
| 860 if (extractedStyle) | 856 if (extractedStyle) |
| 861 equivalent->addToStyle(element, extractedStyle); | 857 equivalent->addToStyle(element, extractedStyle); |
| 862 return true; | 858 return true; |
| 863 } | 859 } |
| 864 } | 860 } |
| 865 return false; | 861 return false; |
| 866 } | 862 } |
| 867 | 863 |
| 868 static const WillBeHeapVector<OwnPtrWillBeMember<HTMLAttributeEquivalent>>& html
AttributeEquivalents() | 864 static const HeapVector<Member<HTMLAttributeEquivalent>>& htmlAttributeEquivalen
ts() |
| 869 { | 865 { |
| 870 DEFINE_STATIC_LOCAL(WillBePersistentHeapVector<OwnPtrWillBeMember<HTMLAttrib
uteEquivalent>>, HTMLAttributeEquivalents, ()); | 866 DEFINE_STATIC_LOCAL(PersistentHeapVector<Member<HTMLAttributeEquivalent>>, H
TMLAttributeEquivalents, ()); |
| 871 if (!HTMLAttributeEquivalents.size()) { | 867 if (!HTMLAttributeEquivalents.size()) { |
| 872 // elementIsStyledSpanOrHTMLEquivalent depends on the fact each HTMLAttr
iuteEquivalent matches exactly one attribute | 868 // elementIsStyledSpanOrHTMLEquivalent depends on the fact each HTMLAttr
iuteEquivalent matches exactly one attribute |
| 873 // of exactly one element except dirAttr. | 869 // of exactly one element except dirAttr. |
| 874 HTMLAttributeEquivalents.append(HTMLAttributeEquivalent::create(CSSPrope
rtyColor, HTMLNames::fontTag, HTMLNames::colorAttr)); | 870 HTMLAttributeEquivalents.append(HTMLAttributeEquivalent::create(CSSPrope
rtyColor, HTMLNames::fontTag, HTMLNames::colorAttr)); |
| 875 HTMLAttributeEquivalents.append(HTMLAttributeEquivalent::create(CSSPrope
rtyFontFamily, HTMLNames::fontTag, HTMLNames::faceAttr)); | 871 HTMLAttributeEquivalents.append(HTMLAttributeEquivalent::create(CSSPrope
rtyFontFamily, HTMLNames::fontTag, HTMLNames::faceAttr)); |
| 876 HTMLAttributeEquivalents.append(HTMLFontSizeEquivalent::create()); | 872 HTMLAttributeEquivalents.append(HTMLFontSizeEquivalent::create()); |
| 877 | 873 |
| 878 HTMLAttributeEquivalents.append(HTMLAttributeEquivalent::create(CSSPrope
rtyDirection, HTMLNames::dirAttr)); | 874 HTMLAttributeEquivalents.append(HTMLAttributeEquivalent::create(CSSPrope
rtyDirection, HTMLNames::dirAttr)); |
| 879 HTMLAttributeEquivalents.append(HTMLAttributeEquivalent::create(CSSPrope
rtyUnicodeBidi, HTMLNames::dirAttr)); | 875 HTMLAttributeEquivalents.append(HTMLAttributeEquivalent::create(CSSPrope
rtyUnicodeBidi, HTMLNames::dirAttr)); |
| 880 } | 876 } |
| 881 | 877 |
| 882 return HTMLAttributeEquivalents; | 878 return HTMLAttributeEquivalents; |
| 883 } | 879 } |
| 884 | 880 |
| 885 bool EditingStyle::conflictsWithImplicitStyleOfAttributes(HTMLElement* element)
const | 881 bool EditingStyle::conflictsWithImplicitStyleOfAttributes(HTMLElement* element)
const |
| 886 { | 882 { |
| 887 ASSERT(element); | 883 ASSERT(element); |
| 888 if (!m_mutableStyle) | 884 if (!m_mutableStyle) |
| 889 return false; | 885 return false; |
| 890 | 886 |
| 891 const WillBeHeapVector<OwnPtrWillBeMember<HTMLAttributeEquivalent>>& HTMLAtt
ributeEquivalents = htmlAttributeEquivalents(); | 887 const HeapVector<Member<HTMLAttributeEquivalent>>& HTMLAttributeEquivalents
= htmlAttributeEquivalents(); |
| 892 for (const auto& equivalent : HTMLAttributeEquivalents) { | 888 for (const auto& equivalent : HTMLAttributeEquivalents) { |
| 893 if (equivalent->matches(element) && equivalent->propertyExistsInStyle(m_
mutableStyle.get()) | 889 if (equivalent->matches(element) && equivalent->propertyExistsInStyle(m_
mutableStyle.get()) |
| 894 && !equivalent->valueIsPresentInStyle(element, m_mutableStyle.get())
) | 890 && !equivalent->valueIsPresentInStyle(element, m_mutableStyle.get())
) |
| 895 return true; | 891 return true; |
| 896 } | 892 } |
| 897 | 893 |
| 898 return false; | 894 return false; |
| 899 } | 895 } |
| 900 | 896 |
| 901 bool EditingStyle::extractConflictingImplicitStyleOfAttributes(HTMLElement* elem
ent, ShouldPreserveWritingDirection shouldPreserveWritingDirection, | 897 bool EditingStyle::extractConflictingImplicitStyleOfAttributes(HTMLElement* elem
ent, ShouldPreserveWritingDirection shouldPreserveWritingDirection, |
| 902 EditingStyle* extractedStyle, Vector<QualifiedName>& conflictingAttributes,
ShouldExtractMatchingStyle shouldExtractMatchingStyle) const | 898 EditingStyle* extractedStyle, Vector<QualifiedName>& conflictingAttributes,
ShouldExtractMatchingStyle shouldExtractMatchingStyle) const |
| 903 { | 899 { |
| 904 ASSERT(element); | 900 ASSERT(element); |
| 905 // HTMLAttributeEquivalent::addToStyle doesn't support unicode-bidi and dire
ction properties | 901 // HTMLAttributeEquivalent::addToStyle doesn't support unicode-bidi and dire
ction properties |
| 906 ASSERT(!extractedStyle || shouldPreserveWritingDirection == PreserveWritingD
irection); | 902 ASSERT(!extractedStyle || shouldPreserveWritingDirection == PreserveWritingD
irection); |
| 907 if (!m_mutableStyle) | 903 if (!m_mutableStyle) |
| 908 return false; | 904 return false; |
| 909 | 905 |
| 910 const WillBeHeapVector<OwnPtrWillBeMember<HTMLAttributeEquivalent>>& HTMLAtt
ributeEquivalents = htmlAttributeEquivalents(); | 906 const HeapVector<Member<HTMLAttributeEquivalent>>& HTMLAttributeEquivalents
= htmlAttributeEquivalents(); |
| 911 bool removed = false; | 907 bool removed = false; |
| 912 for (const auto& attribute : HTMLAttributeEquivalents) { | 908 for (const auto& attribute : HTMLAttributeEquivalents) { |
| 913 const HTMLAttributeEquivalent* equivalent = attribute.get(); | 909 const HTMLAttributeEquivalent* equivalent = attribute.get(); |
| 914 | 910 |
| 915 // unicode-bidi and direction are pushed down separately so don't push d
own with other styles. | 911 // unicode-bidi and direction are pushed down separately so don't push d
own with other styles. |
| 916 if (shouldPreserveWritingDirection == PreserveWritingDirection && equiva
lent->attributeName() == HTMLNames::dirAttr) | 912 if (shouldPreserveWritingDirection == PreserveWritingDirection && equiva
lent->attributeName() == HTMLNames::dirAttr) |
| 917 continue; | 913 continue; |
| 918 | 914 |
| 919 if (!equivalent->matches(element) || !equivalent->propertyExistsInStyle(
m_mutableStyle.get()) | 915 if (!equivalent->matches(element) || !equivalent->propertyExistsInStyle(
m_mutableStyle.get()) |
| 920 || (shouldExtractMatchingStyle == DoNotExtractMatchingStyle && equiv
alent->valueIsPresentInStyle(element, m_mutableStyle.get()))) | 916 || (shouldExtractMatchingStyle == DoNotExtractMatchingStyle && equiv
alent->valueIsPresentInStyle(element, m_mutableStyle.get()))) |
| (...skipping 13 matching lines...) Expand all Loading... |
| 934 return !m_mutableStyle || getPropertiesNotIn(m_mutableStyle.get(), CSSComput
edStyleDeclaration::create(node).get())->isEmpty(); | 930 return !m_mutableStyle || getPropertiesNotIn(m_mutableStyle.get(), CSSComput
edStyleDeclaration::create(node).get())->isEmpty(); |
| 935 } | 931 } |
| 936 | 932 |
| 937 bool EditingStyle::elementIsStyledSpanOrHTMLEquivalent(const HTMLElement* elemen
t) | 933 bool EditingStyle::elementIsStyledSpanOrHTMLEquivalent(const HTMLElement* elemen
t) |
| 938 { | 934 { |
| 939 ASSERT(element); | 935 ASSERT(element); |
| 940 bool elementIsSpanOrElementEquivalent = false; | 936 bool elementIsSpanOrElementEquivalent = false; |
| 941 if (isHTMLSpanElement(*element)) { | 937 if (isHTMLSpanElement(*element)) { |
| 942 elementIsSpanOrElementEquivalent = true; | 938 elementIsSpanOrElementEquivalent = true; |
| 943 } else { | 939 } else { |
| 944 const WillBeHeapVector<OwnPtrWillBeMember<HTMLElementEquivalent>>& HTMLE
lementEquivalents = htmlElementEquivalents(); | 940 const HeapVector<Member<HTMLElementEquivalent>>& HTMLElementEquivalents
= htmlElementEquivalents(); |
| 945 size_t i; | 941 size_t i; |
| 946 for (i = 0; i < HTMLElementEquivalents.size(); ++i) { | 942 for (i = 0; i < HTMLElementEquivalents.size(); ++i) { |
| 947 if (HTMLElementEquivalents[i]->matches(element)) { | 943 if (HTMLElementEquivalents[i]->matches(element)) { |
| 948 elementIsSpanOrElementEquivalent = true; | 944 elementIsSpanOrElementEquivalent = true; |
| 949 break; | 945 break; |
| 950 } | 946 } |
| 951 } | 947 } |
| 952 } | 948 } |
| 953 | 949 |
| 954 AttributeCollection attributes = element->attributes(); | 950 AttributeCollection attributes = element->attributes(); |
| 955 if (attributes.isEmpty()) | 951 if (attributes.isEmpty()) |
| 956 return elementIsSpanOrElementEquivalent; // span, b, etc... without any
attributes | 952 return elementIsSpanOrElementEquivalent; // span, b, etc... without any
attributes |
| 957 | 953 |
| 958 unsigned matchedAttributes = 0; | 954 unsigned matchedAttributes = 0; |
| 959 const WillBeHeapVector<OwnPtrWillBeMember<HTMLAttributeEquivalent>>& HTMLAtt
ributeEquivalents = htmlAttributeEquivalents(); | 955 const HeapVector<Member<HTMLAttributeEquivalent>>& HTMLAttributeEquivalents
= htmlAttributeEquivalents(); |
| 960 for (const auto& equivalent : HTMLAttributeEquivalents) { | 956 for (const auto& equivalent : HTMLAttributeEquivalents) { |
| 961 if (equivalent->matches(element) && equivalent->attributeName() != HTMLN
ames::dirAttr) | 957 if (equivalent->matches(element) && equivalent->attributeName() != HTMLN
ames::dirAttr) |
| 962 matchedAttributes++; | 958 matchedAttributes++; |
| 963 } | 959 } |
| 964 | 960 |
| 965 if (!elementIsSpanOrElementEquivalent && !matchedAttributes) | 961 if (!elementIsSpanOrElementEquivalent && !matchedAttributes) |
| 966 return false; // element is not a span, a html element equivalent, or fo
nt element. | 962 return false; // element is not a span, a html element equivalent, or fo
nt element. |
| 967 | 963 |
| 968 if (element->getAttribute(HTMLNames::classAttr) == AppleStyleSpanClass) | 964 if (element->getAttribute(HTMLNames::classAttr) == AppleStyleSpanClass) |
| 969 matchedAttributes++; | 965 matchedAttributes++; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 985 } | 981 } |
| 986 | 982 |
| 987 void EditingStyle::prepareToApplyAt(const Position& position, ShouldPreserveWrit
ingDirection shouldPreserveWritingDirection) | 983 void EditingStyle::prepareToApplyAt(const Position& position, ShouldPreserveWrit
ingDirection shouldPreserveWritingDirection) |
| 988 { | 984 { |
| 989 if (!m_mutableStyle) | 985 if (!m_mutableStyle) |
| 990 return; | 986 return; |
| 991 | 987 |
| 992 // ReplaceSelectionCommand::handleStyleSpans() requires that this function o
nly removes the editing style. | 988 // ReplaceSelectionCommand::handleStyleSpans() requires that this function o
nly removes the editing style. |
| 993 // If this function was modified in the future to delete all redundant prope
rties, then add a boolean value to indicate | 989 // If this function was modified in the future to delete all redundant prope
rties, then add a boolean value to indicate |
| 994 // which one of editingStyleAtPosition or computedStyle is called. | 990 // which one of editingStyleAtPosition or computedStyle is called. |
| 995 RefPtrWillBeRawPtr<EditingStyle> editingStyleAtPosition = EditingStyle::crea
te(position, EditingPropertiesInEffect); | 991 RawPtr<EditingStyle> editingStyleAtPosition = EditingStyle::create(position,
EditingPropertiesInEffect); |
| 996 StylePropertySet* styleAtPosition = editingStyleAtPosition->m_mutableStyle.g
et(); | 992 StylePropertySet* styleAtPosition = editingStyleAtPosition->m_mutableStyle.g
et(); |
| 997 | 993 |
| 998 RefPtrWillBeRawPtr<CSSValue> unicodeBidi = nullptr; | 994 RawPtr<CSSValue> unicodeBidi = nullptr; |
| 999 RefPtrWillBeRawPtr<CSSValue> direction = nullptr; | 995 RawPtr<CSSValue> direction = nullptr; |
| 1000 if (shouldPreserveWritingDirection == PreserveWritingDirection) { | 996 if (shouldPreserveWritingDirection == PreserveWritingDirection) { |
| 1001 unicodeBidi = m_mutableStyle->getPropertyCSSValue(CSSPropertyUnicodeBidi
); | 997 unicodeBidi = m_mutableStyle->getPropertyCSSValue(CSSPropertyUnicodeBidi
); |
| 1002 direction = m_mutableStyle->getPropertyCSSValue(CSSPropertyDirection); | 998 direction = m_mutableStyle->getPropertyCSSValue(CSSPropertyDirection); |
| 1003 } | 999 } |
| 1004 | 1000 |
| 1005 m_mutableStyle->removeEquivalentProperties(styleAtPosition); | 1001 m_mutableStyle->removeEquivalentProperties(styleAtPosition); |
| 1006 | 1002 |
| 1007 if (textAlignResolvingStartAndEnd(m_mutableStyle.get()) == textAlignResolvin
gStartAndEnd(styleAtPosition)) | 1003 if (textAlignResolvingStartAndEnd(m_mutableStyle.get()) == textAlignResolvin
gStartAndEnd(styleAtPosition)) |
| 1008 m_mutableStyle->removeProperty(CSSPropertyTextAlign); | 1004 m_mutableStyle->removeProperty(CSSPropertyTextAlign); |
| 1009 | 1005 |
| 1010 if (getFontColor(m_mutableStyle.get()) == getFontColor(styleAtPosition)) | 1006 if (getFontColor(m_mutableStyle.get()) == getFontColor(styleAtPosition)) |
| 1011 m_mutableStyle->removeProperty(CSSPropertyColor); | 1007 m_mutableStyle->removeProperty(CSSPropertyColor); |
| 1012 | 1008 |
| 1013 if (hasTransparentBackgroundColor(m_mutableStyle.get()) | 1009 if (hasTransparentBackgroundColor(m_mutableStyle.get()) |
| 1014 || cssValueToColor(m_mutableStyle->getPropertyCSSValue(CSSPropertyBackgr
oundColor).get()) == backgroundColorInEffect(position.computeContainerNode())) | 1010 || cssValueToColor(m_mutableStyle->getPropertyCSSValue(CSSPropertyBackgr
oundColor).get()) == backgroundColorInEffect(position.computeContainerNode())) |
| 1015 m_mutableStyle->removeProperty(CSSPropertyBackgroundColor); | 1011 m_mutableStyle->removeProperty(CSSPropertyBackgroundColor); |
| 1016 | 1012 |
| 1017 if (unicodeBidi && unicodeBidi->isPrimitiveValue()) { | 1013 if (unicodeBidi && unicodeBidi->isPrimitiveValue()) { |
| 1018 m_mutableStyle->setProperty(CSSPropertyUnicodeBidi, toCSSPrimitiveValue(
unicodeBidi.get())->getValueID()); | 1014 m_mutableStyle->setProperty(CSSPropertyUnicodeBidi, toCSSPrimitiveValue(
unicodeBidi.get())->getValueID()); |
| 1019 if (direction && direction->isPrimitiveValue()) | 1015 if (direction && direction->isPrimitiveValue()) |
| 1020 m_mutableStyle->setProperty(CSSPropertyDirection, toCSSPrimitiveValu
e(direction.get())->getValueID()); | 1016 m_mutableStyle->setProperty(CSSPropertyDirection, toCSSPrimitiveValu
e(direction.get())->getValueID()); |
| 1021 } | 1017 } |
| 1022 } | 1018 } |
| 1023 | 1019 |
| 1024 void EditingStyle::mergeTypingStyle(Document* document) | 1020 void EditingStyle::mergeTypingStyle(Document* document) |
| 1025 { | 1021 { |
| 1026 ASSERT(document); | 1022 ASSERT(document); |
| 1027 | 1023 |
| 1028 RefPtrWillBeRawPtr<EditingStyle> typingStyle = document->frame()->selection(
).typingStyle(); | 1024 RawPtr<EditingStyle> typingStyle = document->frame()->selection().typingStyl
e(); |
| 1029 if (!typingStyle || typingStyle == this) | 1025 if (!typingStyle || typingStyle == this) |
| 1030 return; | 1026 return; |
| 1031 | 1027 |
| 1032 mergeStyle(typingStyle->style(), OverrideValues); | 1028 mergeStyle(typingStyle->style(), OverrideValues); |
| 1033 } | 1029 } |
| 1034 | 1030 |
| 1035 void EditingStyle::mergeInlineStyleOfElement(HTMLElement* element, CSSPropertyOv
errideMode mode, PropertiesToInclude propertiesToInclude) | 1031 void EditingStyle::mergeInlineStyleOfElement(HTMLElement* element, CSSPropertyOv
errideMode mode, PropertiesToInclude propertiesToInclude) |
| 1036 { | 1032 { |
| 1037 ASSERT(element); | 1033 ASSERT(element); |
| 1038 if (!element->inlineStyle()) | 1034 if (!element->inlineStyle()) |
| (...skipping 12 matching lines...) Expand all Loading... |
| 1051 } | 1047 } |
| 1052 } | 1048 } |
| 1053 | 1049 |
| 1054 static inline bool elementMatchesAndPropertyIsNotInInlineStyleDecl(const HTMLEle
mentEquivalent* equivalent, const Element* element, | 1050 static inline bool elementMatchesAndPropertyIsNotInInlineStyleDecl(const HTMLEle
mentEquivalent* equivalent, const Element* element, |
| 1055 EditingStyle::CSSPropertyOverrideMode mode, StylePropertySet* style) | 1051 EditingStyle::CSSPropertyOverrideMode mode, StylePropertySet* style) |
| 1056 { | 1052 { |
| 1057 return equivalent->matches(element) && (!element->inlineStyle() || !equivale
nt->propertyExistsInStyle(element->inlineStyle())) | 1053 return equivalent->matches(element) && (!element->inlineStyle() || !equivale
nt->propertyExistsInStyle(element->inlineStyle())) |
| 1058 && (mode == EditingStyle::OverrideValues || !equivalent->propertyExistsI
nStyle(style)); | 1054 && (mode == EditingStyle::OverrideValues || !equivalent->propertyExistsI
nStyle(style)); |
| 1059 } | 1055 } |
| 1060 | 1056 |
| 1061 static PassRefPtrWillBeRawPtr<MutableStylePropertySet> extractEditingProperties(
const StylePropertySet* style, EditingStyle::PropertiesToInclude propertiesToInc
lude) | 1057 static RawPtr<MutableStylePropertySet> extractEditingProperties(const StylePrope
rtySet* style, EditingStyle::PropertiesToInclude propertiesToInclude) |
| 1062 { | 1058 { |
| 1063 if (!style) | 1059 if (!style) |
| 1064 return nullptr; | 1060 return nullptr; |
| 1065 | 1061 |
| 1066 switch (propertiesToInclude) { | 1062 switch (propertiesToInclude) { |
| 1067 case EditingStyle::AllProperties: | 1063 case EditingStyle::AllProperties: |
| 1068 case EditingStyle::EditingPropertiesInEffect: | 1064 case EditingStyle::EditingPropertiesInEffect: |
| 1069 return copyEditingProperties(style, AllEditingProperties); | 1065 return copyEditingProperties(style, AllEditingProperties); |
| 1070 case EditingStyle::OnlyEditingInheritableProperties: | 1066 case EditingStyle::OnlyEditingInheritableProperties: |
| 1071 return copyEditingProperties(style, OnlyInheritableEditingProperties); | 1067 return copyEditingProperties(style, OnlyInheritableEditingProperties); |
| 1072 } | 1068 } |
| 1073 | 1069 |
| 1074 ASSERT_NOT_REACHED(); | 1070 ASSERT_NOT_REACHED(); |
| 1075 return nullptr; | 1071 return nullptr; |
| 1076 } | 1072 } |
| 1077 | 1073 |
| 1078 void EditingStyle::mergeInlineAndImplicitStyleOfElement(Element* element, CSSPro
pertyOverrideMode mode, PropertiesToInclude propertiesToInclude) | 1074 void EditingStyle::mergeInlineAndImplicitStyleOfElement(Element* element, CSSPro
pertyOverrideMode mode, PropertiesToInclude propertiesToInclude) |
| 1079 { | 1075 { |
| 1080 RefPtrWillBeRawPtr<EditingStyle> styleFromRules = EditingStyle::create(); | 1076 RawPtr<EditingStyle> styleFromRules = EditingStyle::create(); |
| 1081 styleFromRules->mergeStyleFromRulesForSerialization(element); | 1077 styleFromRules->mergeStyleFromRulesForSerialization(element); |
| 1082 | 1078 |
| 1083 if (element->inlineStyle()) | 1079 if (element->inlineStyle()) |
| 1084 styleFromRules->m_mutableStyle->mergeAndOverrideOnConflict(element->inli
neStyle()); | 1080 styleFromRules->m_mutableStyle->mergeAndOverrideOnConflict(element->inli
neStyle()); |
| 1085 | 1081 |
| 1086 styleFromRules->m_mutableStyle = extractEditingProperties(styleFromRules->m_
mutableStyle.get(), propertiesToInclude); | 1082 styleFromRules->m_mutableStyle = extractEditingProperties(styleFromRules->m_
mutableStyle.get(), propertiesToInclude); |
| 1087 mergeStyle(styleFromRules->m_mutableStyle.get(), mode); | 1083 mergeStyle(styleFromRules->m_mutableStyle.get(), mode); |
| 1088 | 1084 |
| 1089 const WillBeHeapVector<OwnPtrWillBeMember<HTMLElementEquivalent>>& elementEq
uivalents = htmlElementEquivalents(); | 1085 const HeapVector<Member<HTMLElementEquivalent>>& elementEquivalents = htmlEl
ementEquivalents(); |
| 1090 for (const auto& equivalent : elementEquivalents) { | 1086 for (const auto& equivalent : elementEquivalents) { |
| 1091 if (elementMatchesAndPropertyIsNotInInlineStyleDecl(equivalent.get(), el
ement, mode, m_mutableStyle.get())) | 1087 if (elementMatchesAndPropertyIsNotInInlineStyleDecl(equivalent.get(), el
ement, mode, m_mutableStyle.get())) |
| 1092 equivalent->addToStyle(element, this); | 1088 equivalent->addToStyle(element, this); |
| 1093 } | 1089 } |
| 1094 | 1090 |
| 1095 const WillBeHeapVector<OwnPtrWillBeMember<HTMLAttributeEquivalent>>& attribu
teEquivalents = htmlAttributeEquivalents(); | 1091 const HeapVector<Member<HTMLAttributeEquivalent>>& attributeEquivalents = ht
mlAttributeEquivalents(); |
| 1096 for (const auto& attribute : attributeEquivalents) { | 1092 for (const auto& attribute : attributeEquivalents) { |
| 1097 if (attribute->attributeName() == HTMLNames::dirAttr) | 1093 if (attribute->attributeName() == HTMLNames::dirAttr) |
| 1098 continue; // We don't want to include directionality | 1094 continue; // We don't want to include directionality |
| 1099 if (elementMatchesAndPropertyIsNotInInlineStyleDecl(attribute.get(), ele
ment, mode, m_mutableStyle.get())) | 1095 if (elementMatchesAndPropertyIsNotInInlineStyleDecl(attribute.get(), ele
ment, mode, m_mutableStyle.get())) |
| 1100 attribute->addToStyle(element, this); | 1096 attribute->addToStyle(element, this); |
| 1101 } | 1097 } |
| 1102 } | 1098 } |
| 1103 | 1099 |
| 1104 PassRefPtrWillBeRawPtr<EditingStyle> EditingStyle::wrappingStyleForAnnotatedSeri
alization(ContainerNode* context) | 1100 RawPtr<EditingStyle> EditingStyle::wrappingStyleForAnnotatedSerialization(Contai
nerNode* context) |
| 1105 { | 1101 { |
| 1106 RefPtrWillBeRawPtr<EditingStyle> wrappingStyle = EditingStyle::create(contex
t, EditingStyle::EditingPropertiesInEffect); | 1102 RawPtr<EditingStyle> wrappingStyle = EditingStyle::create(context, EditingSt
yle::EditingPropertiesInEffect); |
| 1107 | 1103 |
| 1108 // Styles that Mail blockquotes contribute should only be placed on the Mail | 1104 // Styles that Mail blockquotes contribute should only be placed on the Mail |
| 1109 // blockquote, to help us differentiate those styles from ones that the user | 1105 // blockquote, to help us differentiate those styles from ones that the user |
| 1110 // has applied. This helps us get the color of content pasted into | 1106 // has applied. This helps us get the color of content pasted into |
| 1111 // blockquotes right. | 1107 // blockquotes right. |
| 1112 wrappingStyle->removeStyleAddedByElement(toHTMLElement(enclosingNodeOfType(f
irstPositionInOrBeforeNode(context), isMailHTMLBlockquoteElement, CanCrossEditin
gBoundary))); | 1108 wrappingStyle->removeStyleAddedByElement(toHTMLElement(enclosingNodeOfType(f
irstPositionInOrBeforeNode(context), isMailHTMLBlockquoteElement, CanCrossEditin
gBoundary))); |
| 1113 | 1109 |
| 1114 // Call collapseTextDecorationProperties first or otherwise it'll copy the v
alue over from in-effect to text-decorations. | 1110 // Call collapseTextDecorationProperties first or otherwise it'll copy the v
alue over from in-effect to text-decorations. |
| 1115 wrappingStyle->collapseTextDecorationProperties(); | 1111 wrappingStyle->collapseTextDecorationProperties(); |
| 1116 | 1112 |
| 1117 return wrappingStyle.release(); | 1113 return wrappingStyle.release(); |
| 1118 } | 1114 } |
| 1119 | 1115 |
| 1120 PassRefPtrWillBeRawPtr<EditingStyle> EditingStyle::wrappingStyleForSerialization
(ContainerNode* context) | 1116 RawPtr<EditingStyle> EditingStyle::wrappingStyleForSerialization(ContainerNode*
context) |
| 1121 { | 1117 { |
| 1122 RefPtrWillBeRawPtr<EditingStyle> wrappingStyle = EditingStyle::create(); | 1118 RawPtr<EditingStyle> wrappingStyle = EditingStyle::create(); |
| 1123 | 1119 |
| 1124 // When not annotating for interchange, we only preserve inline style declar
ations. | 1120 // When not annotating for interchange, we only preserve inline style declar
ations. |
| 1125 for (ContainerNode* node = context; node && !node->isDocumentNode(); node =
node->parentNode()) { | 1121 for (ContainerNode* node = context; node && !node->isDocumentNode(); node =
node->parentNode()) { |
| 1126 if (node->isStyledElement() && !isMailHTMLBlockquoteElement(node)) { | 1122 if (node->isStyledElement() && !isMailHTMLBlockquoteElement(node)) { |
| 1127 wrappingStyle->mergeInlineAndImplicitStyleOfElement(toElement(node),
EditingStyle::DoNotOverrideValues, | 1123 wrappingStyle->mergeInlineAndImplicitStyleOfElement(toElement(node),
EditingStyle::DoNotOverrideValues, |
| 1128 EditingStyle::EditingPropertiesInEffect); | 1124 EditingStyle::EditingPropertiesInEffect); |
| 1129 } | 1125 } |
| 1130 } | 1126 } |
| 1131 | 1127 |
| 1132 return wrappingStyle.release(); | 1128 return wrappingStyle.release(); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 1149 return; | 1145 return; |
| 1150 | 1146 |
| 1151 if (!m_mutableStyle) { | 1147 if (!m_mutableStyle) { |
| 1152 m_mutableStyle = style->mutableCopy(); | 1148 m_mutableStyle = style->mutableCopy(); |
| 1153 return; | 1149 return; |
| 1154 } | 1150 } |
| 1155 | 1151 |
| 1156 unsigned propertyCount = style->propertyCount(); | 1152 unsigned propertyCount = style->propertyCount(); |
| 1157 for (unsigned i = 0; i < propertyCount; ++i) { | 1153 for (unsigned i = 0; i < propertyCount; ++i) { |
| 1158 StylePropertySet::PropertyReference property = style->propertyAt(i); | 1154 StylePropertySet::PropertyReference property = style->propertyAt(i); |
| 1159 RefPtrWillBeRawPtr<CSSValue> value = m_mutableStyle->getPropertyCSSValue
(property.id()); | 1155 RawPtr<CSSValue> value = m_mutableStyle->getPropertyCSSValue(property.id
()); |
| 1160 | 1156 |
| 1161 // text decorations never override values | 1157 // text decorations never override values |
| 1162 if ((property.id() == textDecorationPropertyForEditing() || property.id(
) == CSSPropertyWebkitTextDecorationsInEffect) && property.value()->isValueList(
) && value) { | 1158 if ((property.id() == textDecorationPropertyForEditing() || property.id(
) == CSSPropertyWebkitTextDecorationsInEffect) && property.value()->isValueList(
) && value) { |
| 1163 if (value->isValueList()) { | 1159 if (value->isValueList()) { |
| 1164 mergeTextDecorationValues(toCSSValueList(value.get()), toCSSValu
eList(property.value())); | 1160 mergeTextDecorationValues(toCSSValueList(value.get()), toCSSValu
eList(property.value())); |
| 1165 continue; | 1161 continue; |
| 1166 } | 1162 } |
| 1167 value = nullptr; // text-decoration: none is equivalent to not havin
g the property | 1163 value = nullptr; // text-decoration: none is equivalent to not havin
g the property |
| 1168 } | 1164 } |
| 1169 | 1165 |
| 1170 if (mode == OverrideValues || (mode == DoNotOverrideValues && !value)) | 1166 if (mode == OverrideValues || (mode == DoNotOverrideValues && !value)) |
| 1171 m_mutableStyle->setProperty(property.id(), property.value()->cssText
(), property.isImportant()); | 1167 m_mutableStyle->setProperty(property.id(), property.value()->cssText
(), property.isImportant()); |
| 1172 } | 1168 } |
| 1173 } | 1169 } |
| 1174 | 1170 |
| 1175 static PassRefPtrWillBeRawPtr<MutableStylePropertySet> styleFromMatchedRulesForE
lement(Element* element, unsigned rulesToInclude) | 1171 static RawPtr<MutableStylePropertySet> styleFromMatchedRulesForElement(Element*
element, unsigned rulesToInclude) |
| 1176 { | 1172 { |
| 1177 RefPtrWillBeRawPtr<MutableStylePropertySet> style = MutableStylePropertySet:
:create(HTMLQuirksMode); | 1173 RawPtr<MutableStylePropertySet> style = MutableStylePropertySet::create(HTML
QuirksMode); |
| 1178 RefPtrWillBeRawPtr<StyleRuleList> matchedRules = element->document().ensureS
tyleResolver().styleRulesForElement(element, rulesToInclude); | 1174 RawPtr<StyleRuleList> matchedRules = element->document().ensureStyleResolver
().styleRulesForElement(element, rulesToInclude); |
| 1179 if (matchedRules) { | 1175 if (matchedRules) { |
| 1180 for (unsigned i = 0; i < matchedRules->size(); ++i) | 1176 for (unsigned i = 0; i < matchedRules->size(); ++i) |
| 1181 style->mergeAndOverrideOnConflict(&matchedRules->at(i)->properties()
); | 1177 style->mergeAndOverrideOnConflict(&matchedRules->at(i)->properties()
); |
| 1182 } | 1178 } |
| 1183 return style.release(); | 1179 return style.release(); |
| 1184 } | 1180 } |
| 1185 | 1181 |
| 1186 void EditingStyle::mergeStyleFromRules(Element* element) | 1182 void EditingStyle::mergeStyleFromRules(Element* element) |
| 1187 { | 1183 { |
| 1188 RefPtrWillBeRawPtr<MutableStylePropertySet> styleFromMatchedRules = styleFro
mMatchedRulesForElement(element, | 1184 RawPtr<MutableStylePropertySet> styleFromMatchedRules = styleFromMatchedRule
sForElement(element, |
| 1189 StyleResolver::AuthorCSSRules | StyleResolver::CrossOriginCSSRules); | 1185 StyleResolver::AuthorCSSRules | StyleResolver::CrossOriginCSSRules); |
| 1190 // Styles from the inline style declaration, held in the variable "style", t
ake precedence | 1186 // Styles from the inline style declaration, held in the variable "style", t
ake precedence |
| 1191 // over those from matched rules. | 1187 // over those from matched rules. |
| 1192 if (m_mutableStyle) | 1188 if (m_mutableStyle) |
| 1193 styleFromMatchedRules->mergeAndOverrideOnConflict(m_mutableStyle.get()); | 1189 styleFromMatchedRules->mergeAndOverrideOnConflict(m_mutableStyle.get()); |
| 1194 | 1190 |
| 1195 clear(); | 1191 clear(); |
| 1196 m_mutableStyle = styleFromMatchedRules; | 1192 m_mutableStyle = styleFromMatchedRules; |
| 1197 } | 1193 } |
| 1198 | 1194 |
| 1199 void EditingStyle::mergeStyleFromRulesForSerialization(Element* element) | 1195 void EditingStyle::mergeStyleFromRulesForSerialization(Element* element) |
| 1200 { | 1196 { |
| 1201 mergeStyleFromRules(element); | 1197 mergeStyleFromRules(element); |
| 1202 | 1198 |
| 1203 // The property value, if it's a percentage, may not reflect the actual comp
uted value. | 1199 // The property value, if it's a percentage, may not reflect the actual comp
uted value. |
| 1204 // For example: style="height: 1%; overflow: visible;" in quirksmode | 1200 // For example: style="height: 1%; overflow: visible;" in quirksmode |
| 1205 // FIXME: There are others like this, see <rdar://problem/5195123> Slashdot
copy/paste fidelity problem | 1201 // FIXME: There are others like this, see <rdar://problem/5195123> Slashdot
copy/paste fidelity problem |
| 1206 RefPtrWillBeRawPtr<CSSComputedStyleDeclaration> computedStyleForElement = CS
SComputedStyleDeclaration::create(element); | 1202 RawPtr<CSSComputedStyleDeclaration> computedStyleForElement = CSSComputedSty
leDeclaration::create(element); |
| 1207 RefPtrWillBeRawPtr<MutableStylePropertySet> fromComputedStyle = MutableStyle
PropertySet::create(HTMLQuirksMode); | 1203 RawPtr<MutableStylePropertySet> fromComputedStyle = MutableStylePropertySet:
:create(HTMLQuirksMode); |
| 1208 { | 1204 { |
| 1209 unsigned propertyCount = m_mutableStyle->propertyCount(); | 1205 unsigned propertyCount = m_mutableStyle->propertyCount(); |
| 1210 for (unsigned i = 0; i < propertyCount; ++i) { | 1206 for (unsigned i = 0; i < propertyCount; ++i) { |
| 1211 StylePropertySet::PropertyReference property = m_mutableStyle->prope
rtyAt(i); | 1207 StylePropertySet::PropertyReference property = m_mutableStyle->prope
rtyAt(i); |
| 1212 CSSValue* value = property.value(); | 1208 CSSValue* value = property.value(); |
| 1213 if (!value->isPrimitiveValue()) | 1209 if (!value->isPrimitiveValue()) |
| 1214 continue; | 1210 continue; |
| 1215 if (toCSSPrimitiveValue(value)->isPercentage()) { | 1211 if (toCSSPrimitiveValue(value)->isPercentage()) { |
| 1216 if (RefPtrWillBeRawPtr<CSSValue> computedPropertyValue = compute
dStyleForElement->getPropertyCSSValue(property.id())) | 1212 if (RawPtr<CSSValue> computedPropertyValue = computedStyleForEle
ment->getPropertyCSSValue(property.id())) |
| 1217 fromComputedStyle->addRespectingCascade(CSSProperty(property
.id(), computedPropertyValue)); | 1213 fromComputedStyle->addRespectingCascade(CSSProperty(property
.id(), computedPropertyValue)); |
| 1218 } | 1214 } |
| 1219 } | 1215 } |
| 1220 } | 1216 } |
| 1221 m_mutableStyle->mergeAndOverrideOnConflict(fromComputedStyle.get()); | 1217 m_mutableStyle->mergeAndOverrideOnConflict(fromComputedStyle.get()); |
| 1222 } | 1218 } |
| 1223 | 1219 |
| 1224 static void removePropertiesInStyle(MutableStylePropertySet* styleToRemoveProper
tiesFrom, StylePropertySet* style) | 1220 static void removePropertiesInStyle(MutableStylePropertySet* styleToRemoveProper
tiesFrom, StylePropertySet* style) |
| 1225 { | 1221 { |
| 1226 unsigned propertyCount = style->propertyCount(); | 1222 unsigned propertyCount = style->propertyCount(); |
| 1227 Vector<CSSPropertyID> propertiesToRemove(propertyCount); | 1223 Vector<CSSPropertyID> propertiesToRemove(propertyCount); |
| 1228 for (unsigned i = 0; i < propertyCount; ++i) | 1224 for (unsigned i = 0; i < propertyCount; ++i) |
| 1229 propertiesToRemove[i] = style->propertyAt(i).id(); | 1225 propertiesToRemove[i] = style->propertyAt(i).id(); |
| 1230 | 1226 |
| 1231 styleToRemovePropertiesFrom->removePropertiesInSet(propertiesToRemove.data()
, propertiesToRemove.size()); | 1227 styleToRemovePropertiesFrom->removePropertiesInSet(propertiesToRemove.data()
, propertiesToRemove.size()); |
| 1232 } | 1228 } |
| 1233 | 1229 |
| 1234 void EditingStyle::removeStyleFromRulesAndContext(Element* element, ContainerNod
e* context) | 1230 void EditingStyle::removeStyleFromRulesAndContext(Element* element, ContainerNod
e* context) |
| 1235 { | 1231 { |
| 1236 ASSERT(element); | 1232 ASSERT(element); |
| 1237 if (!m_mutableStyle) | 1233 if (!m_mutableStyle) |
| 1238 return; | 1234 return; |
| 1239 | 1235 |
| 1240 // 1. Remove style from matched rules because style remain without repeating
it in inline style declaration | 1236 // 1. Remove style from matched rules because style remain without repeating
it in inline style declaration |
| 1241 RefPtrWillBeRawPtr<MutableStylePropertySet> styleFromMatchedRules = styleFro
mMatchedRulesForElement(element, StyleResolver::AllButEmptyCSSRules); | 1237 RawPtr<MutableStylePropertySet> styleFromMatchedRules = styleFromMatchedRule
sForElement(element, StyleResolver::AllButEmptyCSSRules); |
| 1242 if (styleFromMatchedRules && !styleFromMatchedRules->isEmpty()) | 1238 if (styleFromMatchedRules && !styleFromMatchedRules->isEmpty()) |
| 1243 m_mutableStyle = getPropertiesNotIn(m_mutableStyle.get(), styleFromMatch
edRules->ensureCSSStyleDeclaration()); | 1239 m_mutableStyle = getPropertiesNotIn(m_mutableStyle.get(), styleFromMatch
edRules->ensureCSSStyleDeclaration()); |
| 1244 | 1240 |
| 1245 // 2. Remove style present in context and not overriden by matched rules. | 1241 // 2. Remove style present in context and not overriden by matched rules. |
| 1246 RefPtrWillBeRawPtr<EditingStyle> computedStyle = EditingStyle::create(contex
t, EditingPropertiesInEffect); | 1242 RawPtr<EditingStyle> computedStyle = EditingStyle::create(context, EditingPr
opertiesInEffect); |
| 1247 if (computedStyle->m_mutableStyle) { | 1243 if (computedStyle->m_mutableStyle) { |
| 1248 if (!computedStyle->m_mutableStyle->getPropertyCSSValue(CSSPropertyBackg
roundColor)) | 1244 if (!computedStyle->m_mutableStyle->getPropertyCSSValue(CSSPropertyBackg
roundColor)) |
| 1249 computedStyle->m_mutableStyle->setProperty(CSSPropertyBackgroundColo
r, CSSValueTransparent); | 1245 computedStyle->m_mutableStyle->setProperty(CSSPropertyBackgroundColo
r, CSSValueTransparent); |
| 1250 | 1246 |
| 1251 removePropertiesInStyle(computedStyle->m_mutableStyle.get(), styleFromMa
tchedRules.get()); | 1247 removePropertiesInStyle(computedStyle->m_mutableStyle.get(), styleFromMa
tchedRules.get()); |
| 1252 m_mutableStyle = getPropertiesNotIn(m_mutableStyle.get(), computedStyle-
>m_mutableStyle->ensureCSSStyleDeclaration()); | 1248 m_mutableStyle = getPropertiesNotIn(m_mutableStyle.get(), computedStyle-
>m_mutableStyle->ensureCSSStyleDeclaration()); |
| 1253 } | 1249 } |
| 1254 | 1250 |
| 1255 // 3. If this element is a span and has display: inline or float: none, remo
ve them unless they are overriden by rules. | 1251 // 3. If this element is a span and has display: inline or float: none, remo
ve them unless they are overriden by rules. |
| 1256 // These rules are added by serialization code to wrap text nodes. | 1252 // These rules are added by serialization code to wrap text nodes. |
| 1257 if (isStyleSpanOrSpanWithOnlyStyleAttribute(element)) { | 1253 if (isStyleSpanOrSpanWithOnlyStyleAttribute(element)) { |
| 1258 if (!styleFromMatchedRules->getPropertyCSSValue(CSSPropertyDisplay) && g
etIdentifierValue(m_mutableStyle.get(), CSSPropertyDisplay) == CSSValueInline) | 1254 if (!styleFromMatchedRules->getPropertyCSSValue(CSSPropertyDisplay) && g
etIdentifierValue(m_mutableStyle.get(), CSSPropertyDisplay) == CSSValueInline) |
| 1259 m_mutableStyle->removeProperty(CSSPropertyDisplay); | 1255 m_mutableStyle->removeProperty(CSSPropertyDisplay); |
| 1260 if (!styleFromMatchedRules->getPropertyCSSValue(CSSPropertyFloat) && get
IdentifierValue(m_mutableStyle.get(), CSSPropertyFloat) == CSSValueNone) | 1256 if (!styleFromMatchedRules->getPropertyCSSValue(CSSPropertyFloat) && get
IdentifierValue(m_mutableStyle.get(), CSSPropertyFloat) == CSSValueNone) |
| 1261 m_mutableStyle->removeProperty(CSSPropertyFloat); | 1257 m_mutableStyle->removeProperty(CSSPropertyFloat); |
| 1262 } | 1258 } |
| 1263 } | 1259 } |
| 1264 | 1260 |
| 1265 void EditingStyle::removePropertiesInElementDefaultStyle(Element* element) | 1261 void EditingStyle::removePropertiesInElementDefaultStyle(Element* element) |
| 1266 { | 1262 { |
| 1267 if (!m_mutableStyle || m_mutableStyle->isEmpty()) | 1263 if (!m_mutableStyle || m_mutableStyle->isEmpty()) |
| 1268 return; | 1264 return; |
| 1269 | 1265 |
| 1270 RefPtrWillBeRawPtr<StylePropertySet> defaultStyle = styleFromMatchedRulesFor
Element(element, StyleResolver::UAAndUserCSSRules); | 1266 RawPtr<StylePropertySet> defaultStyle = styleFromMatchedRulesForElement(elem
ent, StyleResolver::UAAndUserCSSRules); |
| 1271 | 1267 |
| 1272 removePropertiesInStyle(m_mutableStyle.get(), defaultStyle.get()); | 1268 removePropertiesInStyle(m_mutableStyle.get(), defaultStyle.get()); |
| 1273 } | 1269 } |
| 1274 | 1270 |
| 1275 void EditingStyle::addAbsolutePositioningFromElement(const Element& element) | 1271 void EditingStyle::addAbsolutePositioningFromElement(const Element& element) |
| 1276 { | 1272 { |
| 1277 LayoutRect rect = element.boundingBox(); | 1273 LayoutRect rect = element.boundingBox(); |
| 1278 LayoutObject* layoutObject = element.layoutObject(); | 1274 LayoutObject* layoutObject = element.layoutObject(); |
| 1279 | 1275 |
| 1280 LayoutUnit x = rect.x(); | 1276 LayoutUnit x = rect.x(); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 1300 void EditingStyle::forceInline() | 1296 void EditingStyle::forceInline() |
| 1301 { | 1297 { |
| 1302 if (!m_mutableStyle) | 1298 if (!m_mutableStyle) |
| 1303 m_mutableStyle = MutableStylePropertySet::create(HTMLQuirksMode); | 1299 m_mutableStyle = MutableStylePropertySet::create(HTMLQuirksMode); |
| 1304 const bool propertyIsImportant = true; | 1300 const bool propertyIsImportant = true; |
| 1305 m_mutableStyle->setProperty(CSSPropertyDisplay, CSSValueInline, propertyIsIm
portant); | 1301 m_mutableStyle->setProperty(CSSPropertyDisplay, CSSValueInline, propertyIsIm
portant); |
| 1306 } | 1302 } |
| 1307 | 1303 |
| 1308 int EditingStyle::legacyFontSize(Document* document) const | 1304 int EditingStyle::legacyFontSize(Document* document) const |
| 1309 { | 1305 { |
| 1310 RefPtrWillBeRawPtr<CSSValue> cssValue = m_mutableStyle->getPropertyCSSValue(
CSSPropertyFontSize); | 1306 RawPtr<CSSValue> cssValue = m_mutableStyle->getPropertyCSSValue(CSSPropertyF
ontSize); |
| 1311 if (!cssValue || !cssValue->isPrimitiveValue()) | 1307 if (!cssValue || !cssValue->isPrimitiveValue()) |
| 1312 return 0; | 1308 return 0; |
| 1313 return legacyFontSizeFromCSSValue(document, toCSSPrimitiveValue(cssValue.get
()), | 1309 return legacyFontSizeFromCSSValue(document, toCSSPrimitiveValue(cssValue.get
()), |
| 1314 m_isMonospaceFont, AlwaysUseLegacyFontSize); | 1310 m_isMonospaceFont, AlwaysUseLegacyFontSize); |
| 1315 } | 1311 } |
| 1316 | 1312 |
| 1317 PassRefPtrWillBeRawPtr<EditingStyle> EditingStyle::styleAtSelectionStart(const V
isibleSelection& selection, bool shouldUseBackgroundColorInEffect) | 1313 RawPtr<EditingStyle> EditingStyle::styleAtSelectionStart(const VisibleSelection&
selection, bool shouldUseBackgroundColorInEffect) |
| 1318 { | 1314 { |
| 1319 if (selection.isNone()) | 1315 if (selection.isNone()) |
| 1320 return nullptr; | 1316 return nullptr; |
| 1321 | 1317 |
| 1322 Position position = adjustedSelectionStartForStyleComputation(selection); | 1318 Position position = adjustedSelectionStartForStyleComputation(selection); |
| 1323 | 1319 |
| 1324 // If the pos is at the end of a text node, then this node is not fully sele
cted. | 1320 // If the pos is at the end of a text node, then this node is not fully sele
cted. |
| 1325 // Move it to the next deep equivalent position to avoid removing the style
from this node. | 1321 // Move it to the next deep equivalent position to avoid removing the style
from this node. |
| 1326 // e.g. if pos was at Position("hello", 5) in <b>hello<div>world</div></b>,
we want Position("world", 0) instead. | 1322 // e.g. if pos was at Position("hello", 5) in <b>hello<div>world</div></b>,
we want Position("world", 0) instead. |
| 1327 // We only do this for range because caret at Position("hello", 5) in <b>hel
lo</b>world should give you font-weight: bold. | 1323 // We only do this for range because caret at Position("hello", 5) in <b>hel
lo</b>world should give you font-weight: bold. |
| 1328 Node* positionNode = position.computeContainerNode(); | 1324 Node* positionNode = position.computeContainerNode(); |
| 1329 if (selection.isRange() && positionNode && positionNode->isTextNode() && pos
ition.computeOffsetInContainerNode() == positionNode->maxCharacterOffset()) | 1325 if (selection.isRange() && positionNode && positionNode->isTextNode() && pos
ition.computeOffsetInContainerNode() == positionNode->maxCharacterOffset()) |
| 1330 position = nextVisuallyDistinctCandidate(position); | 1326 position = nextVisuallyDistinctCandidate(position); |
| 1331 | 1327 |
| 1332 Element* element = associatedElementOf(position); | 1328 Element* element = associatedElementOf(position); |
| 1333 if (!element) | 1329 if (!element) |
| 1334 return nullptr; | 1330 return nullptr; |
| 1335 | 1331 |
| 1336 RefPtrWillBeRawPtr<EditingStyle> style = EditingStyle::create(element, Editi
ngStyle::AllProperties); | 1332 RawPtr<EditingStyle> style = EditingStyle::create(element, EditingStyle::All
Properties); |
| 1337 style->mergeTypingStyle(&element->document()); | 1333 style->mergeTypingStyle(&element->document()); |
| 1338 | 1334 |
| 1339 // If background color is transparent, traverse parent nodes until we hit a
different value or document root | 1335 // If background color is transparent, traverse parent nodes until we hit a
different value or document root |
| 1340 // Also, if the selection is a range, ignore the background color at the sta
rt of selection, | 1336 // Also, if the selection is a range, ignore the background color at the sta
rt of selection, |
| 1341 // and find the background color of the common ancestor. | 1337 // and find the background color of the common ancestor. |
| 1342 if (shouldUseBackgroundColorInEffect && (selection.isRange() || hasTranspare
ntBackgroundColor(style->m_mutableStyle.get()))) { | 1338 if (shouldUseBackgroundColorInEffect && (selection.isRange() || hasTranspare
ntBackgroundColor(style->m_mutableStyle.get()))) { |
| 1343 const EphemeralRange range(selection.toNormalizedEphemeralRange()); | 1339 const EphemeralRange range(selection.toNormalizedEphemeralRange()); |
| 1344 if (PassRefPtrWillBeRawPtr<CSSValue> value = backgroundColorValueInEffec
t(Range::commonAncestorContainer(range.startPosition().computeContainerNode(), r
ange.endPosition().computeContainerNode()))) | 1340 if (RawPtr<CSSValue> value = backgroundColorValueInEffect(Range::commonA
ncestorContainer(range.startPosition().computeContainerNode(), range.endPosition
().computeContainerNode()))) |
| 1345 style->setProperty(CSSPropertyBackgroundColor, value->cssText()); | 1341 style->setProperty(CSSPropertyBackgroundColor, value->cssText()); |
| 1346 } | 1342 } |
| 1347 | 1343 |
| 1348 return style; | 1344 return style; |
| 1349 } | 1345 } |
| 1350 | 1346 |
| 1351 static bool isUnicodeBidiNestedOrMultipleEmbeddings(CSSValueID valueID) | 1347 static bool isUnicodeBidiNestedOrMultipleEmbeddings(CSSValueID valueID) |
| 1352 { | 1348 { |
| 1353 return valueID == CSSValueEmbed || valueID == CSSValueBidiOverride | 1349 return valueID == CSSValueEmbed || valueID == CSSValueBidiOverride |
| 1354 || valueID == CSSValueWebkitIsolate || valueID == CSSValueWebkitIsolateO
verride || valueID == CSSValueWebkitPlaintext | 1350 || valueID == CSSValueWebkitIsolate || valueID == CSSValueWebkitIsolateO
verride || valueID == CSSValueWebkitPlaintext |
| (...skipping 16 matching lines...) Expand all Loading... |
| 1371 Position end; | 1367 Position end; |
| 1372 if (selection.isRange()) { | 1368 if (selection.isRange()) { |
| 1373 end = mostBackwardCaretPosition(selection.end()); | 1369 end = mostBackwardCaretPosition(selection.end()); |
| 1374 | 1370 |
| 1375 ASSERT(end.document()); | 1371 ASSERT(end.document()); |
| 1376 Node* pastLast = Range::create(*end.document(), position.parentAnchoredE
quivalent(), end.parentAnchoredEquivalent())->pastLastNode(); | 1372 Node* pastLast = Range::create(*end.document(), position.parentAnchoredE
quivalent(), end.parentAnchoredEquivalent())->pastLastNode(); |
| 1377 for (Node* n = node; n && n != pastLast; n = NodeTraversal::next(*n)) { | 1373 for (Node* n = node; n && n != pastLast; n = NodeTraversal::next(*n)) { |
| 1378 if (!n->isStyledElement()) | 1374 if (!n->isStyledElement()) |
| 1379 continue; | 1375 continue; |
| 1380 | 1376 |
| 1381 RefPtrWillBeRawPtr<CSSComputedStyleDeclaration> style = CSSComputedS
tyleDeclaration::create(n); | 1377 RawPtr<CSSComputedStyleDeclaration> style = CSSComputedStyleDeclarat
ion::create(n); |
| 1382 RefPtrWillBeRawPtr<CSSValue> unicodeBidi = style->getPropertyCSSValu
e(CSSPropertyUnicodeBidi); | 1378 RawPtr<CSSValue> unicodeBidi = style->getPropertyCSSValue(CSSPropert
yUnicodeBidi); |
| 1383 if (!unicodeBidi || !unicodeBidi->isPrimitiveValue()) | 1379 if (!unicodeBidi || !unicodeBidi->isPrimitiveValue()) |
| 1384 continue; | 1380 continue; |
| 1385 | 1381 |
| 1386 CSSValueID unicodeBidiValue = toCSSPrimitiveValue(unicodeBidi.get())
->getValueID(); | 1382 CSSValueID unicodeBidiValue = toCSSPrimitiveValue(unicodeBidi.get())
->getValueID(); |
| 1387 if (isUnicodeBidiNestedOrMultipleEmbeddings(unicodeBidiValue)) | 1383 if (isUnicodeBidiNestedOrMultipleEmbeddings(unicodeBidiValue)) |
| 1388 return NaturalWritingDirection; | 1384 return NaturalWritingDirection; |
| 1389 } | 1385 } |
| 1390 } | 1386 } |
| 1391 | 1387 |
| 1392 if (selection.isCaret()) { | 1388 if (selection.isCaret()) { |
| 1393 WritingDirection direction; | 1389 WritingDirection direction; |
| 1394 if (typingStyle && typingStyle->textDirection(direction)) { | 1390 if (typingStyle && typingStyle->textDirection(direction)) { |
| 1395 hasNestedOrMultipleEmbeddings = false; | 1391 hasNestedOrMultipleEmbeddings = false; |
| 1396 return direction; | 1392 return direction; |
| 1397 } | 1393 } |
| 1398 node = selection.visibleStart().deepEquivalent().anchorNode(); | 1394 node = selection.visibleStart().deepEquivalent().anchorNode(); |
| 1399 } | 1395 } |
| 1400 | 1396 |
| 1401 // The selection is either a caret with no typing attributes or a range in w
hich no embedding is added, so just use the start position | 1397 // The selection is either a caret with no typing attributes or a range in w
hich no embedding is added, so just use the start position |
| 1402 // to decide. | 1398 // to decide. |
| 1403 Node* block = enclosingBlock(node); | 1399 Node* block = enclosingBlock(node); |
| 1404 WritingDirection foundDirection = NaturalWritingDirection; | 1400 WritingDirection foundDirection = NaturalWritingDirection; |
| 1405 | 1401 |
| 1406 for (; node != block; node = node->parentNode()) { | 1402 for (; node != block; node = node->parentNode()) { |
| 1407 if (!node->isStyledElement()) | 1403 if (!node->isStyledElement()) |
| 1408 continue; | 1404 continue; |
| 1409 | 1405 |
| 1410 Element* element = toElement(node); | 1406 Element* element = toElement(node); |
| 1411 RefPtrWillBeRawPtr<CSSComputedStyleDeclaration> style = CSSComputedStyle
Declaration::create(element); | 1407 RawPtr<CSSComputedStyleDeclaration> style = CSSComputedStyleDeclaration:
:create(element); |
| 1412 RefPtrWillBeRawPtr<CSSValue> unicodeBidi = style->getPropertyCSSValue(CS
SPropertyUnicodeBidi); | 1408 RawPtr<CSSValue> unicodeBidi = style->getPropertyCSSValue(CSSPropertyUni
codeBidi); |
| 1413 if (!unicodeBidi || !unicodeBidi->isPrimitiveValue()) | 1409 if (!unicodeBidi || !unicodeBidi->isPrimitiveValue()) |
| 1414 continue; | 1410 continue; |
| 1415 | 1411 |
| 1416 CSSValueID unicodeBidiValue = toCSSPrimitiveValue(unicodeBidi.get())->ge
tValueID(); | 1412 CSSValueID unicodeBidiValue = toCSSPrimitiveValue(unicodeBidi.get())->ge
tValueID(); |
| 1417 if (unicodeBidiValue == CSSValueNormal) | 1413 if (unicodeBidiValue == CSSValueNormal) |
| 1418 continue; | 1414 continue; |
| 1419 | 1415 |
| 1420 if (unicodeBidiValue == CSSValueBidiOverride) | 1416 if (unicodeBidiValue == CSSValueBidiOverride) |
| 1421 return NaturalWritingDirection; | 1417 return NaturalWritingDirection; |
| 1422 | 1418 |
| 1423 ASSERT(isEmbedOrIsolate(unicodeBidiValue)); | 1419 ASSERT(isEmbedOrIsolate(unicodeBidiValue)); |
| 1424 RefPtrWillBeRawPtr<CSSValue> direction = style->getPropertyCSSValue(CSSP
ropertyDirection); | 1420 RawPtr<CSSValue> direction = style->getPropertyCSSValue(CSSPropertyDirec
tion); |
| 1425 if (!direction || !direction->isPrimitiveValue()) | 1421 if (!direction || !direction->isPrimitiveValue()) |
| 1426 continue; | 1422 continue; |
| 1427 | 1423 |
| 1428 int directionValue = toCSSPrimitiveValue(direction.get())->getValueID(); | 1424 int directionValue = toCSSPrimitiveValue(direction.get())->getValueID(); |
| 1429 if (directionValue != CSSValueLtr && directionValue != CSSValueRtl) | 1425 if (directionValue != CSSValueLtr && directionValue != CSSValueRtl) |
| 1430 continue; | 1426 continue; |
| 1431 | 1427 |
| 1432 if (foundDirection != NaturalWritingDirection) | 1428 if (foundDirection != NaturalWritingDirection) |
| 1433 return NaturalWritingDirection; | 1429 return NaturalWritingDirection; |
| 1434 | 1430 |
| 1435 // In the range case, make sure that the embedding element persists unti
l the end of the range. | 1431 // In the range case, make sure that the embedding element persists unti
l the end of the range. |
| 1436 if (selection.isRange() && !end.anchorNode()->isDescendantOf(element)) | 1432 if (selection.isRange() && !end.anchorNode()->isDescendantOf(element)) |
| 1437 return NaturalWritingDirection; | 1433 return NaturalWritingDirection; |
| 1438 | 1434 |
| 1439 foundDirection = directionValue == CSSValueLtr ? LeftToRightWritingDirec
tion : RightToLeftWritingDirection; | 1435 foundDirection = directionValue == CSSValueLtr ? LeftToRightWritingDirec
tion : RightToLeftWritingDirection; |
| 1440 } | 1436 } |
| 1441 hasNestedOrMultipleEmbeddings = false; | 1437 hasNestedOrMultipleEmbeddings = false; |
| 1442 return foundDirection; | 1438 return foundDirection; |
| 1443 } | 1439 } |
| 1444 | 1440 |
| 1445 DEFINE_TRACE(EditingStyle) | 1441 DEFINE_TRACE(EditingStyle) |
| 1446 { | 1442 { |
| 1447 visitor->trace(m_mutableStyle); | 1443 visitor->trace(m_mutableStyle); |
| 1448 } | 1444 } |
| 1449 | 1445 |
| 1450 static void reconcileTextDecorationProperties(MutableStylePropertySet* style) | 1446 static void reconcileTextDecorationProperties(MutableStylePropertySet* style) |
| 1451 { | 1447 { |
| 1452 RefPtrWillBeRawPtr<CSSValue> textDecorationsInEffect = style->getPropertyCSS
Value(CSSPropertyWebkitTextDecorationsInEffect); | 1448 RawPtr<CSSValue> textDecorationsInEffect = style->getPropertyCSSValue(CSSPro
pertyWebkitTextDecorationsInEffect); |
| 1453 RefPtrWillBeRawPtr<CSSValue> textDecoration = style->getPropertyCSSValue(tex
tDecorationPropertyForEditing()); | 1449 RawPtr<CSSValue> textDecoration = style->getPropertyCSSValue(textDecorationP
ropertyForEditing()); |
| 1454 // We shouldn't have both text-decoration and -webkit-text-decorations-in-ef
fect because that wouldn't make sense. | 1450 // We shouldn't have both text-decoration and -webkit-text-decorations-in-ef
fect because that wouldn't make sense. |
| 1455 ASSERT(!textDecorationsInEffect || !textDecoration); | 1451 ASSERT(!textDecorationsInEffect || !textDecoration); |
| 1456 if (textDecorationsInEffect) { | 1452 if (textDecorationsInEffect) { |
| 1457 style->setProperty(textDecorationPropertyForEditing(), textDecorationsIn
Effect->cssText()); | 1453 style->setProperty(textDecorationPropertyForEditing(), textDecorationsIn
Effect->cssText()); |
| 1458 style->removeProperty(CSSPropertyWebkitTextDecorationsInEffect); | 1454 style->removeProperty(CSSPropertyWebkitTextDecorationsInEffect); |
| 1459 textDecoration = textDecorationsInEffect; | 1455 textDecoration = textDecorationsInEffect; |
| 1460 } | 1456 } |
| 1461 | 1457 |
| 1462 // If text-decoration is set to "none", remove the property because we don't
want to add redundant "text-decoration: none". | 1458 // If text-decoration is set to "none", remove the property because we don't
want to add redundant "text-decoration: none". |
| 1463 if (textDecoration && !textDecoration->isValueList()) | 1459 if (textDecoration && !textDecoration->isValueList()) |
| 1464 style->removeProperty(textDecorationPropertyForEditing()); | 1460 style->removeProperty(textDecorationPropertyForEditing()); |
| 1465 } | 1461 } |
| 1466 | 1462 |
| 1467 StyleChange::StyleChange(EditingStyle* style, const Position& position) | 1463 StyleChange::StyleChange(EditingStyle* style, const Position& position) |
| 1468 : m_applyBold(false) | 1464 : m_applyBold(false) |
| 1469 , m_applyItalic(false) | 1465 , m_applyItalic(false) |
| 1470 , m_applyUnderline(false) | 1466 , m_applyUnderline(false) |
| 1471 , m_applyLineThrough(false) | 1467 , m_applyLineThrough(false) |
| 1472 , m_applySubscript(false) | 1468 , m_applySubscript(false) |
| 1473 , m_applySuperscript(false) | 1469 , m_applySuperscript(false) |
| 1474 { | 1470 { |
| 1475 Document* document = position.document(); | 1471 Document* document = position.document(); |
| 1476 if (!style || !style->style() || !document || !document->frame() || !associa
tedElementOf(position)) | 1472 if (!style || !style->style() || !document || !document->frame() || !associa
tedElementOf(position)) |
| 1477 return; | 1473 return; |
| 1478 | 1474 |
| 1479 RefPtrWillBeRawPtr<CSSComputedStyleDeclaration> computedStyle = ensureComput
edStyle(position); | 1475 RawPtr<CSSComputedStyleDeclaration> computedStyle = ensureComputedStyle(posi
tion); |
| 1480 // FIXME: take care of background-color in effect | 1476 // FIXME: take care of background-color in effect |
| 1481 RefPtrWillBeRawPtr<MutableStylePropertySet> mutableStyle = getPropertiesNotI
n(style->style(), computedStyle.get()); | 1477 RawPtr<MutableStylePropertySet> mutableStyle = getPropertiesNotIn(style->sty
le(), computedStyle.get()); |
| 1482 ASSERT(mutableStyle); | 1478 ASSERT(mutableStyle); |
| 1483 | 1479 |
| 1484 reconcileTextDecorationProperties(mutableStyle.get()); | 1480 reconcileTextDecorationProperties(mutableStyle.get()); |
| 1485 if (!document->frame()->editor().shouldStyleWithCSS()) | 1481 if (!document->frame()->editor().shouldStyleWithCSS()) |
| 1486 extractTextStyles(document, mutableStyle.get(), computedStyle->isMonospa
ceFont()); | 1482 extractTextStyles(document, mutableStyle.get(), computedStyle->isMonospa
ceFont()); |
| 1487 | 1483 |
| 1488 // Changing the whitespace style in a tab span would collapse the tab into a
space. | 1484 // Changing the whitespace style in a tab span would collapse the tab into a
space. |
| 1489 if (isTabHTMLSpanElementTextNode(position.anchorNode()) || isTabHTMLSpanElem
ent((position.anchorNode()))) | 1485 if (isTabHTMLSpanElementTextNode(position.anchorNode()) || isTabHTMLSpanElem
ent((position.anchorNode()))) |
| 1490 mutableStyle->removeProperty(CSSPropertyWhiteSpace); | 1486 mutableStyle->removeProperty(CSSPropertyWhiteSpace); |
| 1491 | 1487 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 1519 } | 1515 } |
| 1520 | 1516 |
| 1521 int fontStyle = getIdentifierValue(style, CSSPropertyFontStyle); | 1517 int fontStyle = getIdentifierValue(style, CSSPropertyFontStyle); |
| 1522 if (fontStyle == CSSValueItalic || fontStyle == CSSValueOblique) { | 1518 if (fontStyle == CSSValueItalic || fontStyle == CSSValueOblique) { |
| 1523 style->removeProperty(CSSPropertyFontStyle); | 1519 style->removeProperty(CSSPropertyFontStyle); |
| 1524 m_applyItalic = true; | 1520 m_applyItalic = true; |
| 1525 } | 1521 } |
| 1526 | 1522 |
| 1527 // Assuming reconcileTextDecorationProperties has been called, there should
not be -webkit-text-decorations-in-effect | 1523 // Assuming reconcileTextDecorationProperties has been called, there should
not be -webkit-text-decorations-in-effect |
| 1528 // Furthermore, text-decoration: none has been trimmed so that text-decorati
on property is always a CSSValueList. | 1524 // Furthermore, text-decoration: none has been trimmed so that text-decorati
on property is always a CSSValueList. |
| 1529 RefPtrWillBeRawPtr<CSSValue> textDecoration = style->getPropertyCSSValue(tex
tDecorationPropertyForEditing()); | 1525 RawPtr<CSSValue> textDecoration = style->getPropertyCSSValue(textDecorationP
ropertyForEditing()); |
| 1530 if (textDecoration && textDecoration->isValueList()) { | 1526 if (textDecoration && textDecoration->isValueList()) { |
| 1531 DEFINE_STATIC_REF_WILL_BE_PERSISTENT(CSSPrimitiveValue, underline, (CSSP
rimitiveValue::createIdentifier(CSSValueUnderline))); | 1527 DEFINE_STATIC_REF_WILL_BE_PERSISTENT(CSSPrimitiveValue, underline, (CSSP
rimitiveValue::createIdentifier(CSSValueUnderline))); |
| 1532 DEFINE_STATIC_REF_WILL_BE_PERSISTENT(CSSPrimitiveValue, lineThrough, (CS
SPrimitiveValue::createIdentifier(CSSValueLineThrough))); | 1528 DEFINE_STATIC_REF_WILL_BE_PERSISTENT(CSSPrimitiveValue, lineThrough, (CS
SPrimitiveValue::createIdentifier(CSSValueLineThrough))); |
| 1533 RefPtrWillBeRawPtr<CSSValueList> newTextDecoration = toCSSValueList(text
Decoration.get())->copy(); | 1529 RawPtr<CSSValueList> newTextDecoration = toCSSValueList(textDecoration.g
et())->copy(); |
| 1534 if (newTextDecoration->removeAll(underline)) | 1530 if (newTextDecoration->removeAll(underline)) |
| 1535 m_applyUnderline = true; | 1531 m_applyUnderline = true; |
| 1536 if (newTextDecoration->removeAll(lineThrough)) | 1532 if (newTextDecoration->removeAll(lineThrough)) |
| 1537 m_applyLineThrough = true; | 1533 m_applyLineThrough = true; |
| 1538 | 1534 |
| 1539 // If trimTextDecorations, delete underline and line-through | 1535 // If trimTextDecorations, delete underline and line-through |
| 1540 setTextDecorationProperty(style, newTextDecoration.get(), textDecoration
PropertyForEditing()); | 1536 setTextDecorationProperty(style, newTextDecoration.get(), textDecoration
PropertyForEditing()); |
| 1541 } | 1537 } |
| 1542 | 1538 |
| 1543 int verticalAlign = getIdentifierValue(style, CSSPropertyVerticalAlign); | 1539 int verticalAlign = getIdentifierValue(style, CSSPropertyVerticalAlign); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 1555 if (style->getPropertyCSSValue(CSSPropertyColor)) { | 1551 if (style->getPropertyCSSValue(CSSPropertyColor)) { |
| 1556 m_applyFontColor = getFontColor(style).serialized(); | 1552 m_applyFontColor = getFontColor(style).serialized(); |
| 1557 style->removeProperty(CSSPropertyColor); | 1553 style->removeProperty(CSSPropertyColor); |
| 1558 } | 1554 } |
| 1559 | 1555 |
| 1560 m_applyFontFace = style->getPropertyValue(CSSPropertyFontFamily); | 1556 m_applyFontFace = style->getPropertyValue(CSSPropertyFontFamily); |
| 1561 // Remove double quotes for Outlook 2007 compatibility. See https://bugs.web
kit.org/show_bug.cgi?id=79448 | 1557 // Remove double quotes for Outlook 2007 compatibility. See https://bugs.web
kit.org/show_bug.cgi?id=79448 |
| 1562 m_applyFontFace.replaceWithLiteral('"', ""); | 1558 m_applyFontFace.replaceWithLiteral('"', ""); |
| 1563 style->removeProperty(CSSPropertyFontFamily); | 1559 style->removeProperty(CSSPropertyFontFamily); |
| 1564 | 1560 |
| 1565 if (RefPtrWillBeRawPtr<CSSValue> fontSize = style->getPropertyCSSValue(CSSPr
opertyFontSize)) { | 1561 if (RawPtr<CSSValue> fontSize = style->getPropertyCSSValue(CSSPropertyFontSi
ze)) { |
| 1566 if (!fontSize->isPrimitiveValue()) { | 1562 if (!fontSize->isPrimitiveValue()) { |
| 1567 style->removeProperty(CSSPropertyFontSize); // Can't make sense of t
he number. Put no font size. | 1563 style->removeProperty(CSSPropertyFontSize); // Can't make sense of t
he number. Put no font size. |
| 1568 } else if (int legacyFontSize = legacyFontSizeFromCSSValue(document, toC
SSPrimitiveValue(fontSize.get()), isMonospaceFont, UseLegacyFontSizeOnlyIfPixelV
aluesMatch)) { | 1564 } else if (int legacyFontSize = legacyFontSizeFromCSSValue(document, toC
SSPrimitiveValue(fontSize.get()), isMonospaceFont, UseLegacyFontSizeOnlyIfPixelV
aluesMatch)) { |
| 1569 m_applyFontSize = String::number(legacyFontSize); | 1565 m_applyFontSize = String::number(legacyFontSize); |
| 1570 style->removeProperty(CSSPropertyFontSize); | 1566 style->removeProperty(CSSPropertyFontSize); |
| 1571 } | 1567 } |
| 1572 } | 1568 } |
| 1573 } | 1569 } |
| 1574 | 1570 |
| 1575 static void diffTextDecorations(MutableStylePropertySet* style, CSSPropertyID pr
opertID, CSSValue* refTextDecoration) | 1571 static void diffTextDecorations(MutableStylePropertySet* style, CSSPropertyID pr
opertID, CSSValue* refTextDecoration) |
| 1576 { | 1572 { |
| 1577 RefPtrWillBeRawPtr<CSSValue> textDecoration = style->getPropertyCSSValue(pro
pertID); | 1573 RawPtr<CSSValue> textDecoration = style->getPropertyCSSValue(propertID); |
| 1578 if (!textDecoration || !textDecoration->isValueList() || !refTextDecoration
|| !refTextDecoration->isValueList()) | 1574 if (!textDecoration || !textDecoration->isValueList() || !refTextDecoration
|| !refTextDecoration->isValueList()) |
| 1579 return; | 1575 return; |
| 1580 | 1576 |
| 1581 RefPtrWillBeRawPtr<CSSValueList> newTextDecoration = toCSSValueList(textDeco
ration.get())->copy(); | 1577 RawPtr<CSSValueList> newTextDecoration = toCSSValueList(textDecoration.get()
)->copy(); |
| 1582 CSSValueList* valuesInRefTextDecoration = toCSSValueList(refTextDecoration); | 1578 CSSValueList* valuesInRefTextDecoration = toCSSValueList(refTextDecoration); |
| 1583 | 1579 |
| 1584 for (size_t i = 0; i < valuesInRefTextDecoration->length(); i++) | 1580 for (size_t i = 0; i < valuesInRefTextDecoration->length(); i++) |
| 1585 newTextDecoration->removeAll(valuesInRefTextDecoration->item(i)); | 1581 newTextDecoration->removeAll(valuesInRefTextDecoration->item(i)); |
| 1586 | 1582 |
| 1587 setTextDecorationProperty(style, newTextDecoration.get(), propertID); | 1583 setTextDecorationProperty(style, newTextDecoration.get(), propertID); |
| 1588 } | 1584 } |
| 1589 | 1585 |
| 1590 static bool fontWeightIsBold(CSSValue* fontWeight) | 1586 static bool fontWeightIsBold(CSSValue* fontWeight) |
| 1591 { | 1587 { |
| (...skipping 26 matching lines...) Expand all Loading... |
| 1618 | 1614 |
| 1619 static bool fontWeightNeedsResolving(CSSValue* fontWeight) | 1615 static bool fontWeightNeedsResolving(CSSValue* fontWeight) |
| 1620 { | 1616 { |
| 1621 if (!fontWeight->isPrimitiveValue()) | 1617 if (!fontWeight->isPrimitiveValue()) |
| 1622 return true; | 1618 return true; |
| 1623 | 1619 |
| 1624 CSSValueID value = toCSSPrimitiveValue(fontWeight)->getValueID(); | 1620 CSSValueID value = toCSSPrimitiveValue(fontWeight)->getValueID(); |
| 1625 return value == CSSValueLighter || value == CSSValueBolder; | 1621 return value == CSSValueLighter || value == CSSValueBolder; |
| 1626 } | 1622 } |
| 1627 | 1623 |
| 1628 PassRefPtrWillBeRawPtr<MutableStylePropertySet> getPropertiesNotIn(StyleProperty
Set* styleWithRedundantProperties, CSSStyleDeclaration* baseStyle) | 1624 RawPtr<MutableStylePropertySet> getPropertiesNotIn(StylePropertySet* styleWithRe
dundantProperties, CSSStyleDeclaration* baseStyle) |
| 1629 { | 1625 { |
| 1630 ASSERT(styleWithRedundantProperties); | 1626 ASSERT(styleWithRedundantProperties); |
| 1631 ASSERT(baseStyle); | 1627 ASSERT(baseStyle); |
| 1632 RefPtrWillBeRawPtr<MutableStylePropertySet> result = styleWithRedundantPrope
rties->mutableCopy(); | 1628 RawPtr<MutableStylePropertySet> result = styleWithRedundantProperties->mutab
leCopy(); |
| 1633 | 1629 |
| 1634 result->removeEquivalentProperties(baseStyle); | 1630 result->removeEquivalentProperties(baseStyle); |
| 1635 | 1631 |
| 1636 RefPtrWillBeRawPtr<CSSValue> baseTextDecorationsInEffect = baseStyle->getPro
pertyCSSValueInternal(CSSPropertyWebkitTextDecorationsInEffect); | 1632 RawPtr<CSSValue> baseTextDecorationsInEffect = baseStyle->getPropertyCSSValu
eInternal(CSSPropertyWebkitTextDecorationsInEffect); |
| 1637 diffTextDecorations(result.get(), textDecorationPropertyForEditing(), baseTe
xtDecorationsInEffect.get()); | 1633 diffTextDecorations(result.get(), textDecorationPropertyForEditing(), baseTe
xtDecorationsInEffect.get()); |
| 1638 diffTextDecorations(result.get(), CSSPropertyWebkitTextDecorationsInEffect,
baseTextDecorationsInEffect.get()); | 1634 diffTextDecorations(result.get(), CSSPropertyWebkitTextDecorationsInEffect,
baseTextDecorationsInEffect.get()); |
| 1639 | 1635 |
| 1640 if (RefPtrWillBeRawPtr<CSSValue> baseFontWeight = baseStyle->getPropertyCSSV
alueInternal(CSSPropertyFontWeight)) { | 1636 if (RawPtr<CSSValue> baseFontWeight = baseStyle->getPropertyCSSValueInternal
(CSSPropertyFontWeight)) { |
| 1641 if (RefPtrWillBeRawPtr<CSSValue> fontWeight = result->getPropertyCSSValu
e(CSSPropertyFontWeight)) { | 1637 if (RawPtr<CSSValue> fontWeight = result->getPropertyCSSValue(CSSPropert
yFontWeight)) { |
| 1642 if (!fontWeightNeedsResolving(fontWeight.get()) && !fontWeightNeedsR
esolving(baseFontWeight.get()) | 1638 if (!fontWeightNeedsResolving(fontWeight.get()) && !fontWeightNeedsR
esolving(baseFontWeight.get()) |
| 1643 && (fontWeightIsBold(fontWeight.get()) == fontWeightIsBold(baseF
ontWeight.get()))) | 1639 && (fontWeightIsBold(fontWeight.get()) == fontWeightIsBold(baseF
ontWeight.get()))) |
| 1644 result->removeProperty(CSSPropertyFontWeight); | 1640 result->removeProperty(CSSPropertyFontWeight); |
| 1645 } | 1641 } |
| 1646 } | 1642 } |
| 1647 | 1643 |
| 1648 if (baseStyle->getPropertyCSSValueInternal(CSSPropertyColor) && getFontColor
(result.get()) == getFontColor(baseStyle)) | 1644 if (baseStyle->getPropertyCSSValueInternal(CSSPropertyColor) && getFontColor
(result.get()) == getFontColor(baseStyle)) |
| 1649 result->removeProperty(CSSPropertyColor); | 1645 result->removeProperty(CSSPropertyColor); |
| 1650 | 1646 |
| 1651 if (baseStyle->getPropertyCSSValueInternal(CSSPropertyTextAlign) | 1647 if (baseStyle->getPropertyCSSValueInternal(CSSPropertyTextAlign) |
| 1652 && textAlignResolvingStartAndEnd(result.get()) == textAlignResolvingStar
tAndEnd(baseStyle)) | 1648 && textAlignResolvingStartAndEnd(result.get()) == textAlignResolvingStar
tAndEnd(baseStyle)) |
| 1653 result->removeProperty(CSSPropertyTextAlign); | 1649 result->removeProperty(CSSPropertyTextAlign); |
| 1654 | 1650 |
| 1655 if (baseStyle->getPropertyCSSValueInternal(CSSPropertyBackgroundColor) && ge
tBackgroundColor(result.get()) == getBackgroundColor(baseStyle)) | 1651 if (baseStyle->getPropertyCSSValueInternal(CSSPropertyBackgroundColor) && ge
tBackgroundColor(result.get()) == getBackgroundColor(baseStyle)) |
| 1656 result->removeProperty(CSSPropertyBackgroundColor); | 1652 result->removeProperty(CSSPropertyBackgroundColor); |
| 1657 | 1653 |
| 1658 return result.release(); | 1654 return result.release(); |
| 1659 } | 1655 } |
| 1660 | 1656 |
| 1661 CSSValueID getIdentifierValue(StylePropertySet* style, CSSPropertyID propertyID) | 1657 CSSValueID getIdentifierValue(StylePropertySet* style, CSSPropertyID propertyID) |
| 1662 { | 1658 { |
| 1663 if (!style) | 1659 if (!style) |
| 1664 return CSSValueInvalid; | 1660 return CSSValueInvalid; |
| 1665 RefPtrWillBeRawPtr<CSSValue> value = style->getPropertyCSSValue(propertyID); | 1661 RawPtr<CSSValue> value = style->getPropertyCSSValue(propertyID); |
| 1666 if (!value || !value->isPrimitiveValue()) | 1662 if (!value || !value->isPrimitiveValue()) |
| 1667 return CSSValueInvalid; | 1663 return CSSValueInvalid; |
| 1668 return toCSSPrimitiveValue(value.get())->getValueID(); | 1664 return toCSSPrimitiveValue(value.get())->getValueID(); |
| 1669 } | 1665 } |
| 1670 | 1666 |
| 1671 CSSValueID getIdentifierValue(CSSStyleDeclaration* style, CSSPropertyID property
ID) | 1667 CSSValueID getIdentifierValue(CSSStyleDeclaration* style, CSSPropertyID property
ID) |
| 1672 { | 1668 { |
| 1673 if (!style) | 1669 if (!style) |
| 1674 return CSSValueInvalid; | 1670 return CSSValueInvalid; |
| 1675 RefPtrWillBeRawPtr<CSSValue> value = style->getPropertyCSSValueInternal(prop
ertyID); | 1671 RawPtr<CSSValue> value = style->getPropertyCSSValueInternal(propertyID); |
| 1676 if (!value || !value->isPrimitiveValue()) | 1672 if (!value || !value->isPrimitiveValue()) |
| 1677 return CSSValueInvalid; | 1673 return CSSValueInvalid; |
| 1678 return toCSSPrimitiveValue(value.get())->getValueID(); | 1674 return toCSSPrimitiveValue(value.get())->getValueID(); |
| 1679 } | 1675 } |
| 1680 | 1676 |
| 1681 int legacyFontSizeFromCSSValue(Document* document, CSSPrimitiveValue* value, boo
l isMonospaceFont, LegacyFontSizeMode mode) | 1677 int legacyFontSizeFromCSSValue(Document* document, CSSPrimitiveValue* value, boo
l isMonospaceFont, LegacyFontSizeMode mode) |
| 1682 { | 1678 { |
| 1683 CSSPrimitiveValue::LengthUnitType lengthType; | 1679 CSSPrimitiveValue::LengthUnitType lengthType; |
| 1684 if (CSSPrimitiveValue::unitTypeToLengthUnitType(value->typeWithCalcResolved(
), lengthType) | 1680 if (CSSPrimitiveValue::unitTypeToLengthUnitType(value->typeWithCalcResolved(
), lengthType) |
| 1685 && lengthType == CSSPrimitiveValue::UnitTypePixels) { | 1681 && lengthType == CSSPrimitiveValue::UnitTypePixels) { |
| (...skipping 20 matching lines...) Expand all Loading... |
| 1706 if (cssValue->isColorValue()) | 1702 if (cssValue->isColorValue()) |
| 1707 return !toCSSColorValue(cssValue)->value().alpha(); | 1703 return !toCSSColorValue(cssValue)->value().alpha(); |
| 1708 if (!cssValue->isPrimitiveValue()) | 1704 if (!cssValue->isPrimitiveValue()) |
| 1709 return false; | 1705 return false; |
| 1710 CSSPrimitiveValue* value = toCSSPrimitiveValue(cssValue); | 1706 CSSPrimitiveValue* value = toCSSPrimitiveValue(cssValue); |
| 1711 return value->getValueID() == CSSValueTransparent; | 1707 return value->getValueID() == CSSValueTransparent; |
| 1712 } | 1708 } |
| 1713 | 1709 |
| 1714 bool hasTransparentBackgroundColor(CSSStyleDeclaration* style) | 1710 bool hasTransparentBackgroundColor(CSSStyleDeclaration* style) |
| 1715 { | 1711 { |
| 1716 RefPtrWillBeRawPtr<CSSValue> cssValue = style->getPropertyCSSValueInternal(C
SSPropertyBackgroundColor); | 1712 RawPtr<CSSValue> cssValue = style->getPropertyCSSValueInternal(CSSPropertyBa
ckgroundColor); |
| 1717 return isTransparentColorValue(cssValue.get()); | 1713 return isTransparentColorValue(cssValue.get()); |
| 1718 } | 1714 } |
| 1719 | 1715 |
| 1720 bool hasTransparentBackgroundColor(StylePropertySet* style) | 1716 bool hasTransparentBackgroundColor(StylePropertySet* style) |
| 1721 { | 1717 { |
| 1722 RefPtrWillBeRawPtr<CSSValue> cssValue = style->getPropertyCSSValue(CSSProper
tyBackgroundColor); | 1718 RawPtr<CSSValue> cssValue = style->getPropertyCSSValue(CSSPropertyBackground
Color); |
| 1723 return isTransparentColorValue(cssValue.get()); | 1719 return isTransparentColorValue(cssValue.get()); |
| 1724 } | 1720 } |
| 1725 | 1721 |
| 1726 PassRefPtrWillBeRawPtr<CSSValue> backgroundColorValueInEffect(Node* node) | 1722 RawPtr<CSSValue> backgroundColorValueInEffect(Node* node) |
| 1727 { | 1723 { |
| 1728 for (Node* ancestor = node; ancestor; ancestor = ancestor->parentNode()) { | 1724 for (Node* ancestor = node; ancestor; ancestor = ancestor->parentNode()) { |
| 1729 RefPtrWillBeRawPtr<CSSComputedStyleDeclaration> ancestorStyle = CSSCompu
tedStyleDeclaration::create(ancestor); | 1725 RawPtr<CSSComputedStyleDeclaration> ancestorStyle = CSSComputedStyleDecl
aration::create(ancestor); |
| 1730 if (!hasTransparentBackgroundColor(ancestorStyle.get())) | 1726 if (!hasTransparentBackgroundColor(ancestorStyle.get())) |
| 1731 return ancestorStyle->getPropertyCSSValue(CSSPropertyBackgroundColor
); | 1727 return ancestorStyle->getPropertyCSSValue(CSSPropertyBackgroundColor
); |
| 1732 } | 1728 } |
| 1733 return nullptr; | 1729 return nullptr; |
| 1734 } | 1730 } |
| 1735 | 1731 |
| 1736 } // namespace blink | 1732 } // namespace blink |
| OLD | NEW |