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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 static CSSComputedStyleDeclaration* ensureComputedStyle(const Position& position
) | 153 static CSSComputedStyleDeclaration* ensureComputedStyle(const Position& position
) |
154 { | 154 { |
155 Element* elem = associatedElementOf(position); | 155 Element* elem = associatedElementOf(position); |
156 if (!elem) | 156 if (!elem) |
157 return nullptr; | 157 return nullptr; |
158 return CSSComputedStyleDeclaration::create(elem); | 158 return CSSComputedStyleDeclaration::create(elem); |
159 } | 159 } |
160 | 160 |
161 static MutableStylePropertySet* getPropertiesNotIn(StylePropertySet* styleWithRe
dundantProperties, CSSStyleDeclaration* baseStyle); | 161 static MutableStylePropertySet* getPropertiesNotIn(StylePropertySet* styleWithRe
dundantProperties, CSSStyleDeclaration* baseStyle); |
162 enum LegacyFontSizeMode { AlwaysUseLegacyFontSize, UseLegacyFontSizeOnlyIfPixelV
aluesMatch }; | 162 enum LegacyFontSizeMode { AlwaysUseLegacyFontSize, UseLegacyFontSizeOnlyIfPixelV
aluesMatch }; |
163 static int legacyFontSizeFromCSSValue(Document*, CSSPrimitiveValue*, bool, Legac
yFontSizeMode); | 163 static int legacyFontSizeFromCSSValue(Document*, const CSSPrimitiveValue*, bool,
LegacyFontSizeMode); |
164 static bool isTransparentColorValue(CSSValue*); | 164 static bool isTransparentColorValue(const CSSValue*); |
165 static bool hasTransparentBackgroundColor(CSSStyleDeclaration*); | 165 static bool hasTransparentBackgroundColor(CSSStyleDeclaration*); |
166 static bool hasTransparentBackgroundColor(StylePropertySet*); | 166 static bool hasTransparentBackgroundColor(StylePropertySet*); |
167 static CSSValue* backgroundColorValueInEffect(Node*); | 167 static const CSSValue* backgroundColorValueInEffect(Node*); |
168 static bool hasAncestorVerticalAlignStyle(Node&, CSSValueID); | 168 static bool hasAncestorVerticalAlignStyle(Node&, CSSValueID); |
169 | 169 |
170 class HTMLElementEquivalent : public GarbageCollected<HTMLElementEquivalent> { | 170 class HTMLElementEquivalent : public GarbageCollected<HTMLElementEquivalent> { |
171 public: | 171 public: |
172 static HTMLElementEquivalent* create(CSSPropertyID propertyID, CSSValueID pr
imitiveValue, const HTMLQualifiedName& tagName) | 172 static HTMLElementEquivalent* create(CSSPropertyID propertyID, CSSValueID pr
imitiveValue, const HTMLQualifiedName& tagName) |
173 { | 173 { |
174 return new HTMLElementEquivalent(propertyID, primitiveValue, tagName); | 174 return new HTMLElementEquivalent(propertyID, primitiveValue, tagName); |
175 } | 175 } |
176 | 176 |
177 virtual bool matches(const Element* element) const { return !m_tagName || el
ement->hasTagName(*m_tagName); } | 177 virtual bool matches(const Element* element) const { return !m_tagName || el
ement->hasTagName(*m_tagName); } |
(...skipping 28 matching lines...) Expand all Loading... |
206 HTMLElementEquivalent::HTMLElementEquivalent(CSSPropertyID id, CSSValueID primit
iveValue, const HTMLQualifiedName& tagName) | 206 HTMLElementEquivalent::HTMLElementEquivalent(CSSPropertyID id, CSSValueID primit
iveValue, const HTMLQualifiedName& tagName) |
207 : m_propertyID(id) | 207 : m_propertyID(id) |
208 , m_primitiveValue(CSSPrimitiveValue::createIdentifier(primitiveValue)) | 208 , m_primitiveValue(CSSPrimitiveValue::createIdentifier(primitiveValue)) |
209 , m_tagName(&tagName) | 209 , m_tagName(&tagName) |
210 { | 210 { |
211 DCHECK_NE(primitiveValue, CSSValueInvalid); | 211 DCHECK_NE(primitiveValue, CSSValueInvalid); |
212 } | 212 } |
213 | 213 |
214 bool HTMLElementEquivalent::valueIsPresentInStyle(HTMLElement* element, StylePro
pertySet* style) const | 214 bool HTMLElementEquivalent::valueIsPresentInStyle(HTMLElement* element, StylePro
pertySet* style) const |
215 { | 215 { |
216 CSSValue* value = style->getPropertyCSSValue(m_propertyID); | 216 const CSSValue* value = style->getPropertyCSSValue(m_propertyID); |
217 return matches(element) && value && value->isPrimitiveValue() && toCSSPrimit
iveValue(value)->getValueID() == m_primitiveValue->getValueID(); | 217 return matches(element) && value && value->isPrimitiveValue() && toCSSPrimit
iveValue(value)->getValueID() == m_primitiveValue->getValueID(); |
218 } | 218 } |
219 | 219 |
220 void HTMLElementEquivalent::addToStyle(Element*, EditingStyle* style) const | 220 void HTMLElementEquivalent::addToStyle(Element*, EditingStyle* style) const |
221 { | 221 { |
222 style->setProperty(m_propertyID, m_primitiveValue->cssText()); | 222 style->setProperty(m_propertyID, m_primitiveValue->cssText()); |
223 } | 223 } |
224 | 224 |
225 class HTMLTextDecorationEquivalent final : public HTMLElementEquivalent { | 225 class HTMLTextDecorationEquivalent final : public HTMLElementEquivalent { |
226 public: | 226 public: |
(...skipping 17 matching lines...) Expand all Loading... |
244 } | 244 } |
245 | 245 |
246 bool HTMLTextDecorationEquivalent::propertyExistsInStyle(const StylePropertySet*
style) const | 246 bool HTMLTextDecorationEquivalent::propertyExistsInStyle(const StylePropertySet*
style) const |
247 { | 247 { |
248 return style->getPropertyCSSValue(CSSPropertyWebkitTextDecorationsInEffect) | 248 return style->getPropertyCSSValue(CSSPropertyWebkitTextDecorationsInEffect) |
249 || style->getPropertyCSSValue(textDecorationPropertyForEditing()); | 249 || style->getPropertyCSSValue(textDecorationPropertyForEditing()); |
250 } | 250 } |
251 | 251 |
252 bool HTMLTextDecorationEquivalent::valueIsPresentInStyle(HTMLElement* element, S
tylePropertySet* style) const | 252 bool HTMLTextDecorationEquivalent::valueIsPresentInStyle(HTMLElement* element, S
tylePropertySet* style) const |
253 { | 253 { |
254 CSSValue* styleValue = style->getPropertyCSSValue(CSSPropertyWebkitTextDecor
ationsInEffect); | 254 const CSSValue* styleValue = style->getPropertyCSSValue(CSSPropertyWebkitTex
tDecorationsInEffect); |
255 if (!styleValue) | 255 if (!styleValue) |
256 styleValue = style->getPropertyCSSValue(textDecorationPropertyForEditing
()); | 256 styleValue = style->getPropertyCSSValue(textDecorationPropertyForEditing
()); |
257 return matches(element) && styleValue && styleValue->isValueList() && toCSSV
alueList(styleValue)->hasValue(*m_primitiveValue); | 257 return matches(element) && styleValue && styleValue->isValueList() && toCSSV
alueList(styleValue)->hasValue(*m_primitiveValue); |
258 } | 258 } |
259 | 259 |
260 class HTMLAttributeEquivalent : public HTMLElementEquivalent { | 260 class HTMLAttributeEquivalent : public HTMLElementEquivalent { |
261 public: | 261 public: |
262 static HTMLAttributeEquivalent* create(CSSPropertyID propertyID, const HTMLQ
ualifiedName& tagName, const QualifiedName& attrName) | 262 static HTMLAttributeEquivalent* create(CSSPropertyID propertyID, const HTMLQ
ualifiedName& tagName, const QualifiedName& attrName) |
263 { | 263 { |
264 return new HTMLAttributeEquivalent(propertyID, tagName, attrName); | 264 return new HTMLAttributeEquivalent(propertyID, tagName, attrName); |
(...skipping 26 matching lines...) Expand all Loading... |
291 | 291 |
292 HTMLAttributeEquivalent::HTMLAttributeEquivalent(CSSPropertyID id, const Qualifi
edName& attrName) | 292 HTMLAttributeEquivalent::HTMLAttributeEquivalent(CSSPropertyID id, const Qualifi
edName& attrName) |
293 : HTMLElementEquivalent(id) | 293 : HTMLElementEquivalent(id) |
294 , m_attrName(attrName) | 294 , m_attrName(attrName) |
295 { | 295 { |
296 } | 296 } |
297 | 297 |
298 bool HTMLAttributeEquivalent::valueIsPresentInStyle(HTMLElement* element, StyleP
ropertySet* style) const | 298 bool HTMLAttributeEquivalent::valueIsPresentInStyle(HTMLElement* element, StyleP
ropertySet* style) const |
299 { | 299 { |
300 CSSValue* value = attributeValueAsCSSValue(element); | 300 CSSValue* value = attributeValueAsCSSValue(element); |
301 CSSValue* styleValue = style->getPropertyCSSValue(m_propertyID); | 301 const CSSValue* styleValue = style->getPropertyCSSValue(m_propertyID); |
302 | 302 |
303 return compareCSSValuePtr(value, styleValue); | 303 return compareCSSValuePtr(value, styleValue); |
304 } | 304 } |
305 | 305 |
306 void HTMLAttributeEquivalent::addToStyle(Element* element, EditingStyle* style)
const | 306 void HTMLAttributeEquivalent::addToStyle(Element* element, EditingStyle* style)
const |
307 { | 307 { |
308 if (CSSValue* value = attributeValueAsCSSValue(element)) | 308 if (CSSValue* value = attributeValueAsCSSValue(element)) |
309 style->setProperty(m_propertyID, value->cssText()); | 309 style->setProperty(m_propertyID, value->cssText()); |
310 } | 310 } |
311 | 311 |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
371 extractFontSizeDelta(); | 371 extractFontSizeDelta(); |
372 } | 372 } |
373 | 373 |
374 EditingStyle::EditingStyle(CSSPropertyID propertyID, const String& value) | 374 EditingStyle::EditingStyle(CSSPropertyID propertyID, const String& value) |
375 : m_mutableStyle(nullptr) | 375 : m_mutableStyle(nullptr) |
376 { | 376 { |
377 setProperty(propertyID, value); | 377 setProperty(propertyID, value); |
378 m_isVerticalAlign = propertyID == CSSPropertyVerticalAlign && (value == "sub
" || value == "super"); | 378 m_isVerticalAlign = propertyID == CSSPropertyVerticalAlign && (value == "sub
" || value == "super"); |
379 } | 379 } |
380 | 380 |
381 static Color cssValueToColor(CSSValue* colorValue) | 381 static Color cssValueToColor(const CSSValue* colorValue) |
382 { | 382 { |
383 if (!colorValue || (!colorValue->isColorValue() && !colorValue->isPrimitiveV
alue())) | 383 if (!colorValue || (!colorValue->isColorValue() && !colorValue->isPrimitiveV
alue())) |
384 return Color::transparent; | 384 return Color::transparent; |
385 | 385 |
386 if (colorValue->isColorValue()) | 386 if (colorValue->isColorValue()) |
387 return toCSSColorValue(colorValue)->value(); | 387 return toCSSColorValue(colorValue)->value(); |
388 | 388 |
389 Color color = 0; | 389 Color color = 0; |
390 // FIXME: Why ignore the return value? | 390 // FIXME: Why ignore the return value? |
391 CSSParser::parseColor(color, colorValue->cssText()); | 391 CSSParser::parseColor(color, colorValue->cssText()); |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
449 { | 449 { |
450 if (isTabHTMLSpanElementTextNode(node)) | 450 if (isTabHTMLSpanElementTextNode(node)) |
451 node = tabSpanElement(node)->parentNode(); | 451 node = tabSpanElement(node)->parentNode(); |
452 else if (isTabHTMLSpanElement(node)) | 452 else if (isTabHTMLSpanElement(node)) |
453 node = node->parentNode(); | 453 node = node->parentNode(); |
454 | 454 |
455 CSSComputedStyleDeclaration* computedStyleAtPosition = CSSComputedStyleDecla
ration::create(node); | 455 CSSComputedStyleDeclaration* computedStyleAtPosition = CSSComputedStyleDecla
ration::create(node); |
456 m_mutableStyle = propertiesToInclude == AllProperties && computedStyleAtPosi
tion ? computedStyleAtPosition->copyProperties() : editingStyleFromComputedStyle
(computedStyleAtPosition); | 456 m_mutableStyle = propertiesToInclude == AllProperties && computedStyleAtPosi
tion ? computedStyleAtPosition->copyProperties() : editingStyleFromComputedStyle
(computedStyleAtPosition); |
457 | 457 |
458 if (propertiesToInclude == EditingPropertiesInEffect) { | 458 if (propertiesToInclude == EditingPropertiesInEffect) { |
459 if (CSSValue* value = backgroundColorValueInEffect(node)) | 459 if (const CSSValue* value = backgroundColorValueInEffect(node)) |
460 m_mutableStyle->setProperty(CSSPropertyBackgroundColor, value->cssTe
xt()); | 460 m_mutableStyle->setProperty(CSSPropertyBackgroundColor, value->cssTe
xt()); |
461 if (CSSValue* value = computedStyleAtPosition->getPropertyCSSValue(CSSPr
opertyWebkitTextDecorationsInEffect)) | 461 if (const CSSValue* value = computedStyleAtPosition->getPropertyCSSValue
(CSSPropertyWebkitTextDecorationsInEffect)) |
462 m_mutableStyle->setProperty(CSSPropertyTextDecoration, value->cssTex
t()); | 462 m_mutableStyle->setProperty(CSSPropertyTextDecoration, value->cssTex
t()); |
463 } | 463 } |
464 | 464 |
465 if (node && node->ensureComputedStyle()) { | 465 if (node && node->ensureComputedStyle()) { |
466 const ComputedStyle* computedStyle = node->ensureComputedStyle(); | 466 const ComputedStyle* computedStyle = node->ensureComputedStyle(); |
467 removeTextFillAndStrokeColorsIfNeeded(computedStyle); | 467 removeTextFillAndStrokeColorsIfNeeded(computedStyle); |
468 replaceFontSizeByKeywordIfPossible(computedStyle, computedStyleAtPositio
n); | 468 replaceFontSizeByKeywordIfPossible(computedStyle, computedStyleAtPositio
n); |
469 } | 469 } |
470 | 470 |
471 m_isMonospaceFont = computedStyleAtPosition->isMonospaceFont(); | 471 m_isMonospaceFont = computedStyleAtPosition->isMonospaceFont(); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
503 if (!m_mutableStyle) | 503 if (!m_mutableStyle) |
504 return; | 504 return; |
505 | 505 |
506 if (m_mutableStyle->getPropertyCSSValue(CSSPropertyFontSize)) { | 506 if (m_mutableStyle->getPropertyCSSValue(CSSPropertyFontSize)) { |
507 // Explicit font size overrides any delta. | 507 // Explicit font size overrides any delta. |
508 m_mutableStyle->removeProperty(CSSPropertyWebkitFontSizeDelta); | 508 m_mutableStyle->removeProperty(CSSPropertyWebkitFontSizeDelta); |
509 return; | 509 return; |
510 } | 510 } |
511 | 511 |
512 // Get the adjustment amount out of the style. | 512 // Get the adjustment amount out of the style. |
513 CSSValue* value = m_mutableStyle->getPropertyCSSValue(CSSPropertyWebkitFontS
izeDelta); | 513 const CSSValue* value = m_mutableStyle->getPropertyCSSValue(CSSPropertyWebki
tFontSizeDelta); |
514 if (!value || !value->isPrimitiveValue()) | 514 if (!value || !value->isPrimitiveValue()) |
515 return; | 515 return; |
516 | 516 |
517 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); | 517 const CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); |
518 | 518 |
519 // Only PX handled now. If we handle more types in the future, perhaps | 519 // Only PX handled now. If we handle more types in the future, perhaps |
520 // a switch statement here would be more appropriate. | 520 // a switch statement here would be more appropriate. |
521 if (!primitiveValue->isPx()) | 521 if (!primitiveValue->isPx()) |
522 return; | 522 return; |
523 | 523 |
524 m_fontSizeDelta = primitiveValue->getFloatValue(); | 524 m_fontSizeDelta = primitiveValue->getFloatValue(); |
525 m_mutableStyle->removeProperty(CSSPropertyWebkitFontSizeDelta); | 525 m_mutableStyle->removeProperty(CSSPropertyWebkitFontSizeDelta); |
526 } | 526 } |
527 | 527 |
528 bool EditingStyle::isEmpty() const | 528 bool EditingStyle::isEmpty() const |
529 { | 529 { |
530 return (!m_mutableStyle || m_mutableStyle->isEmpty()) && m_fontSizeDelta ==
NoFontDelta; | 530 return (!m_mutableStyle || m_mutableStyle->isEmpty()) && m_fontSizeDelta ==
NoFontDelta; |
531 } | 531 } |
532 | 532 |
533 bool EditingStyle::textDirection(WritingDirection& writingDirection) const | 533 bool EditingStyle::textDirection(WritingDirection& writingDirection) const |
534 { | 534 { |
535 if (!m_mutableStyle) | 535 if (!m_mutableStyle) |
536 return false; | 536 return false; |
537 | 537 |
538 CSSValue* unicodeBidi = m_mutableStyle->getPropertyCSSValue(CSSPropertyUnico
deBidi); | 538 const CSSValue* unicodeBidi = m_mutableStyle->getPropertyCSSValue(CSSPropert
yUnicodeBidi); |
539 if (!unicodeBidi || !unicodeBidi->isPrimitiveValue()) | 539 if (!unicodeBidi || !unicodeBidi->isPrimitiveValue()) |
540 return false; | 540 return false; |
541 | 541 |
542 CSSValueID unicodeBidiValue = toCSSPrimitiveValue(unicodeBidi)->getValueID()
; | 542 CSSValueID unicodeBidiValue = toCSSPrimitiveValue(unicodeBidi)->getValueID()
; |
543 if (isEmbedOrIsolate(unicodeBidiValue)) { | 543 if (isEmbedOrIsolate(unicodeBidiValue)) { |
544 CSSValue* direction = m_mutableStyle->getPropertyCSSValue(CSSPropertyDir
ection); | 544 const CSSValue* direction = m_mutableStyle->getPropertyCSSValue(CSSPrope
rtyDirection); |
545 if (!direction || !direction->isPrimitiveValue()) | 545 if (!direction || !direction->isPrimitiveValue()) |
546 return false; | 546 return false; |
547 | 547 |
548 writingDirection = toCSSPrimitiveValue(direction)->getValueID() == CSSVa
lueLtr ? LeftToRightWritingDirection : RightToLeftWritingDirection; | 548 writingDirection = toCSSPrimitiveValue(direction)->getValueID() == CSSVa
lueLtr ? LeftToRightWritingDirection : RightToLeftWritingDirection; |
549 | 549 |
550 return true; | 550 return true; |
551 } | 551 } |
552 | 552 |
553 if (unicodeBidiValue == CSSValueNormal) { | 553 if (unicodeBidiValue == CSSValueNormal) { |
554 writingDirection = NaturalWritingDirection; | 554 writingDirection = NaturalWritingDirection; |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
675 unsigned propertyCount = nodeStyle->propertyCount(); | 675 unsigned propertyCount = nodeStyle->propertyCount(); |
676 for (unsigned i = 0; i < propertyCount; ++i) | 676 for (unsigned i = 0; i < propertyCount; ++i) |
677 m_mutableStyle->removeProperty(nodeStyle->propertyAt(i).id()); | 677 m_mutableStyle->removeProperty(nodeStyle->propertyAt(i).id()); |
678 } | 678 } |
679 | 679 |
680 void EditingStyle::collapseTextDecorationProperties() | 680 void EditingStyle::collapseTextDecorationProperties() |
681 { | 681 { |
682 if (!m_mutableStyle) | 682 if (!m_mutableStyle) |
683 return; | 683 return; |
684 | 684 |
685 CSSValue* textDecorationsInEffect = m_mutableStyle->getPropertyCSSValue(CSSP
ropertyWebkitTextDecorationsInEffect); | 685 const CSSValue* textDecorationsInEffect = m_mutableStyle->getPropertyCSSValu
e(CSSPropertyWebkitTextDecorationsInEffect); |
686 if (!textDecorationsInEffect) | 686 if (!textDecorationsInEffect) |
687 return; | 687 return; |
688 | 688 |
689 if (textDecorationsInEffect->isValueList()) | 689 if (textDecorationsInEffect->isValueList()) |
690 m_mutableStyle->setProperty(textDecorationPropertyForEditing(), textDeco
rationsInEffect->cssText(), m_mutableStyle->propertyIsImportant(textDecorationPr
opertyForEditing())); | 690 m_mutableStyle->setProperty(textDecorationPropertyForEditing(), textDeco
rationsInEffect->cssText(), m_mutableStyle->propertyIsImportant(textDecorationPr
opertyForEditing())); |
691 else | 691 else |
692 m_mutableStyle->removeProperty(textDecorationPropertyForEditing()); | 692 m_mutableStyle->removeProperty(textDecorationPropertyForEditing()); |
693 m_mutableStyle->removeProperty(CSSPropertyWebkitTextDecorationsInEffect); | 693 m_mutableStyle->removeProperty(CSSPropertyWebkitTextDecorationsInEffect); |
694 } | 694 } |
695 | 695 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
748 TriState state = FalseTriState; | 748 TriState state = FalseTriState; |
749 bool nodeIsStart = true; | 749 bool nodeIsStart = true; |
750 for (Node& node : NodeTraversal::startsAt(*selection.start().anchorNode()))
{ | 750 for (Node& node : NodeTraversal::startsAt(*selection.start().anchorNode()))
{ |
751 if (node.layoutObject() && node.hasEditableStyle()) { | 751 if (node.layoutObject() && node.hasEditableStyle()) { |
752 CSSComputedStyleDeclaration* nodeStyle = CSSComputedStyleDeclaration
::create(&node); | 752 CSSComputedStyleDeclaration* nodeStyle = CSSComputedStyleDeclaration
::create(&node); |
753 if (nodeStyle) { | 753 if (nodeStyle) { |
754 // If the selected element has <sub> or <sup> ancestor element,
apply the corresponding | 754 // If the selected element has <sub> or <sup> ancestor element,
apply the corresponding |
755 // style(vertical-align) to it so that document.queryCommandStat
e() works with the style. | 755 // style(vertical-align) to it so that document.queryCommandStat
e() works with the style. |
756 // See bug http://crbug.com/582225. | 756 // See bug http://crbug.com/582225. |
757 if (m_isVerticalAlign && getIdentifierValue(nodeStyle, CSSProper
tyVerticalAlign) == CSSValueBaseline) { | 757 if (m_isVerticalAlign && getIdentifierValue(nodeStyle, CSSProper
tyVerticalAlign) == CSSValueBaseline) { |
758 CSSPrimitiveValue* verticalAlign = toCSSPrimitiveValue(m_mut
ableStyle->getPropertyCSSValue(CSSPropertyVerticalAlign)); | 758 const CSSPrimitiveValue* verticalAlign = toCSSPrimitiveValue
(m_mutableStyle->getPropertyCSSValue(CSSPropertyVerticalAlign)); |
759 if (hasAncestorVerticalAlignStyle(node, verticalAlign->getVa
lueID())) | 759 if (hasAncestorVerticalAlignStyle(node, verticalAlign->getVa
lueID())) |
760 node.mutableComputedStyle()->setVerticalAlign(verticalAl
ign->convertTo<EVerticalAlign>()); | 760 node.mutableComputedStyle()->setVerticalAlign(verticalAl
ign->convertTo<EVerticalAlign>()); |
761 } | 761 } |
762 | 762 |
763 // Pass EditingStyle::DoNotIgnoreTextOnlyProperties without chec
king if node.isTextNode() | 763 // Pass EditingStyle::DoNotIgnoreTextOnlyProperties without chec
king if node.isTextNode() |
764 // because the node can be an element node. See bug http://crbug
.com/584939. | 764 // because the node can be an element node. See bug http://crbug
.com/584939. |
765 TriState nodeState = triStateOfStyle(nodeStyle, EditingStyle::Do
NotIgnoreTextOnlyProperties); | 765 TriState nodeState = triStateOfStyle(nodeStyle, EditingStyle::Do
NotIgnoreTextOnlyProperties); |
766 if (nodeIsStart) { | 766 if (nodeIsStart) { |
767 state = nodeState; | 767 state = nodeState; |
768 nodeIsStart = false; | 768 nodeIsStart = false; |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
994 { | 994 { |
995 if (!m_mutableStyle) | 995 if (!m_mutableStyle) |
996 return; | 996 return; |
997 | 997 |
998 // ReplaceSelectionCommand::handleStyleSpans() requires that this function o
nly removes the editing style. | 998 // ReplaceSelectionCommand::handleStyleSpans() requires that this function o
nly removes the editing style. |
999 // If this function was modified in the future to delete all redundant prope
rties, then add a boolean value to indicate | 999 // If this function was modified in the future to delete all redundant prope
rties, then add a boolean value to indicate |
1000 // which one of editingStyleAtPosition or computedStyle is called. | 1000 // which one of editingStyleAtPosition or computedStyle is called. |
1001 EditingStyle* editingStyleAtPosition = EditingStyle::create(position, Editin
gPropertiesInEffect); | 1001 EditingStyle* editingStyleAtPosition = EditingStyle::create(position, Editin
gPropertiesInEffect); |
1002 StylePropertySet* styleAtPosition = editingStyleAtPosition->m_mutableStyle.g
et(); | 1002 StylePropertySet* styleAtPosition = editingStyleAtPosition->m_mutableStyle.g
et(); |
1003 | 1003 |
1004 CSSValue* unicodeBidi = nullptr; | 1004 const CSSValue* unicodeBidi = nullptr; |
1005 CSSValue* direction = nullptr; | 1005 const CSSValue* direction = nullptr; |
1006 if (shouldPreserveWritingDirection == PreserveWritingDirection) { | 1006 if (shouldPreserveWritingDirection == PreserveWritingDirection) { |
1007 unicodeBidi = m_mutableStyle->getPropertyCSSValue(CSSPropertyUnicodeBidi
); | 1007 unicodeBidi = m_mutableStyle->getPropertyCSSValue(CSSPropertyUnicodeBidi
); |
1008 direction = m_mutableStyle->getPropertyCSSValue(CSSPropertyDirection); | 1008 direction = m_mutableStyle->getPropertyCSSValue(CSSPropertyDirection); |
1009 } | 1009 } |
1010 | 1010 |
1011 m_mutableStyle->removeEquivalentProperties(styleAtPosition); | 1011 m_mutableStyle->removeEquivalentProperties(styleAtPosition); |
1012 | 1012 |
1013 if (textAlignResolvingStartAndEnd(m_mutableStyle.get()) == textAlignResolvin
gStartAndEnd(styleAtPosition)) | 1013 if (textAlignResolvingStartAndEnd(m_mutableStyle.get()) == textAlignResolvin
gStartAndEnd(styleAtPosition)) |
1014 m_mutableStyle->removeProperty(CSSPropertyTextAlign); | 1014 m_mutableStyle->removeProperty(CSSPropertyTextAlign); |
1015 | 1015 |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1134 break; | 1134 break; |
1135 if (node.isStyledElement() && !isMailHTMLBlockquoteElement(&node)) { | 1135 if (node.isStyledElement() && !isMailHTMLBlockquoteElement(&node)) { |
1136 wrappingStyle->mergeInlineAndImplicitStyleOfElement(toElement(&node)
, EditingStyle::DoNotOverrideValues, | 1136 wrappingStyle->mergeInlineAndImplicitStyleOfElement(toElement(&node)
, EditingStyle::DoNotOverrideValues, |
1137 EditingStyle::EditingPropertiesInEffect); | 1137 EditingStyle::EditingPropertiesInEffect); |
1138 } | 1138 } |
1139 } | 1139 } |
1140 | 1140 |
1141 return wrappingStyle; | 1141 return wrappingStyle; |
1142 } | 1142 } |
1143 | 1143 |
1144 static void mergeTextDecorationValues(CSSValueList* mergedValue, const CSSValueL
ist* valueToMerge) | 1144 static CSSValueList* mergeTextDecorationValues(const CSSValueList* mergedValue,
const CSSValueList* valueToMerge) |
1145 { | 1145 { |
1146 DEFINE_STATIC_LOCAL(CSSPrimitiveValue, underline, (CSSPrimitiveValue::create
Identifier(CSSValueUnderline))); | 1146 DEFINE_STATIC_LOCAL(CSSPrimitiveValue, underline, (CSSPrimitiveValue::create
Identifier(CSSValueUnderline))); |
1147 DEFINE_STATIC_LOCAL(CSSPrimitiveValue, lineThrough, (CSSPrimitiveValue::crea
teIdentifier(CSSValueLineThrough))); | 1147 DEFINE_STATIC_LOCAL(CSSPrimitiveValue, lineThrough, (CSSPrimitiveValue::crea
teIdentifier(CSSValueLineThrough))); |
| 1148 CSSValueList* result = mergedValue->copy(); |
1148 if (valueToMerge->hasValue(underline) && !mergedValue->hasValue(underline)) | 1149 if (valueToMerge->hasValue(underline) && !mergedValue->hasValue(underline)) |
1149 mergedValue->append(&underline); | 1150 result->append(&underline); |
1150 | 1151 |
1151 if (valueToMerge->hasValue(lineThrough) && !mergedValue->hasValue(lineThroug
h)) | 1152 if (valueToMerge->hasValue(lineThrough) && !mergedValue->hasValue(lineThroug
h)) |
1152 mergedValue->append(&lineThrough); | 1153 result->append(&lineThrough); |
| 1154 |
| 1155 return result; |
1153 } | 1156 } |
1154 | 1157 |
1155 void EditingStyle::mergeStyle(const StylePropertySet* style, CSSPropertyOverride
Mode mode) | 1158 void EditingStyle::mergeStyle(const StylePropertySet* style, CSSPropertyOverride
Mode mode) |
1156 { | 1159 { |
1157 if (!style) | 1160 if (!style) |
1158 return; | 1161 return; |
1159 | 1162 |
1160 if (!m_mutableStyle) { | 1163 if (!m_mutableStyle) { |
1161 m_mutableStyle = style->mutableCopy(); | 1164 m_mutableStyle = style->mutableCopy(); |
1162 return; | 1165 return; |
1163 } | 1166 } |
1164 | 1167 |
1165 unsigned propertyCount = style->propertyCount(); | 1168 unsigned propertyCount = style->propertyCount(); |
1166 for (unsigned i = 0; i < propertyCount; ++i) { | 1169 for (unsigned i = 0; i < propertyCount; ++i) { |
1167 StylePropertySet::PropertyReference property = style->propertyAt(i); | 1170 StylePropertySet::PropertyReference property = style->propertyAt(i); |
1168 CSSValue* value = m_mutableStyle->getPropertyCSSValue(property.id()); | 1171 const CSSValue* value = m_mutableStyle->getPropertyCSSValue(property.id(
)); |
1169 | 1172 |
1170 // text decorations never override values | 1173 // text decorations never override values |
1171 if ((property.id() == textDecorationPropertyForEditing() || property.id(
) == CSSPropertyWebkitTextDecorationsInEffect) && property.value()->isValueList(
) && value) { | 1174 if ((property.id() == textDecorationPropertyForEditing() || property.id(
) == CSSPropertyWebkitTextDecorationsInEffect) && property.value()->isValueList(
) && value) { |
1172 if (value->isValueList()) { | 1175 if (value->isValueList()) { |
1173 mergeTextDecorationValues(toCSSValueList(value), toCSSValueList(
property.value())); | 1176 CSSValueList* result = mergeTextDecorationValues(toCSSValueList(
value), toCSSValueList(property.value())); |
| 1177 m_mutableStyle->setProperty(property.id(), result, property.isIm
portant()); |
1174 continue; | 1178 continue; |
1175 } | 1179 } |
1176 value = nullptr; // text-decoration: none is equivalent to not havin
g the property | 1180 value = nullptr; // text-decoration: none is equivalent to not havin
g the property |
1177 } | 1181 } |
1178 | 1182 |
1179 if (mode == OverrideValues || (mode == DoNotOverrideValues && !value)) | 1183 if (mode == OverrideValues || (mode == DoNotOverrideValues && !value)) |
1180 m_mutableStyle->setProperty(property.id(), property.value()->cssText
(), property.isImportant()); | 1184 m_mutableStyle->setProperty(property.id(), property.value()->cssText
(), property.isImportant()); |
1181 } | 1185 } |
1182 } | 1186 } |
1183 | 1187 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1215 CSSComputedStyleDeclaration* computedStyleForElement = CSSComputedStyleDecla
ration::create(element); | 1219 CSSComputedStyleDeclaration* computedStyleForElement = CSSComputedStyleDecla
ration::create(element); |
1216 MutableStylePropertySet* fromComputedStyle = MutableStylePropertySet::create
(HTMLQuirksMode); | 1220 MutableStylePropertySet* fromComputedStyle = MutableStylePropertySet::create
(HTMLQuirksMode); |
1217 { | 1221 { |
1218 unsigned propertyCount = m_mutableStyle->propertyCount(); | 1222 unsigned propertyCount = m_mutableStyle->propertyCount(); |
1219 for (unsigned i = 0; i < propertyCount; ++i) { | 1223 for (unsigned i = 0; i < propertyCount; ++i) { |
1220 StylePropertySet::PropertyReference property = m_mutableStyle->prope
rtyAt(i); | 1224 StylePropertySet::PropertyReference property = m_mutableStyle->prope
rtyAt(i); |
1221 CSSValue* value = property.value(); | 1225 CSSValue* value = property.value(); |
1222 if (!value->isPrimitiveValue()) | 1226 if (!value->isPrimitiveValue()) |
1223 continue; | 1227 continue; |
1224 if (toCSSPrimitiveValue(value)->isPercentage()) { | 1228 if (toCSSPrimitiveValue(value)->isPercentage()) { |
1225 if (CSSValue* computedPropertyValue = computedStyleForElement->g
etPropertyCSSValue(property.id())) | 1229 if (const CSSValue* computedPropertyValue = computedStyleForElem
ent->getPropertyCSSValue(property.id())) |
1226 fromComputedStyle->addRespectingCascade(CSSProperty(property
.id(), computedPropertyValue)); | 1230 fromComputedStyle->addRespectingCascade(CSSProperty(property
.id(), computedPropertyValue)); |
1227 } | 1231 } |
1228 } | 1232 } |
1229 } | 1233 } |
1230 m_mutableStyle->mergeAndOverrideOnConflict(fromComputedStyle); | 1234 m_mutableStyle->mergeAndOverrideOnConflict(fromComputedStyle); |
1231 } | 1235 } |
1232 | 1236 |
1233 static void removePropertiesInStyle(MutableStylePropertySet* styleToRemoveProper
tiesFrom, StylePropertySet* style) | 1237 static void removePropertiesInStyle(MutableStylePropertySet* styleToRemoveProper
tiesFrom, StylePropertySet* style) |
1234 { | 1238 { |
1235 unsigned propertyCount = style->propertyCount(); | 1239 unsigned propertyCount = style->propertyCount(); |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1309 void EditingStyle::forceInline() | 1313 void EditingStyle::forceInline() |
1310 { | 1314 { |
1311 if (!m_mutableStyle) | 1315 if (!m_mutableStyle) |
1312 m_mutableStyle = MutableStylePropertySet::create(HTMLQuirksMode); | 1316 m_mutableStyle = MutableStylePropertySet::create(HTMLQuirksMode); |
1313 const bool propertyIsImportant = true; | 1317 const bool propertyIsImportant = true; |
1314 m_mutableStyle->setProperty(CSSPropertyDisplay, CSSValueInline, propertyIsIm
portant); | 1318 m_mutableStyle->setProperty(CSSPropertyDisplay, CSSValueInline, propertyIsIm
portant); |
1315 } | 1319 } |
1316 | 1320 |
1317 int EditingStyle::legacyFontSize(Document* document) const | 1321 int EditingStyle::legacyFontSize(Document* document) const |
1318 { | 1322 { |
1319 CSSValue* cssValue = m_mutableStyle->getPropertyCSSValue(CSSPropertyFontSize
); | 1323 const CSSValue* cssValue = m_mutableStyle->getPropertyCSSValue(CSSPropertyFo
ntSize); |
1320 if (!cssValue || !cssValue->isPrimitiveValue()) | 1324 if (!cssValue || !cssValue->isPrimitiveValue()) |
1321 return 0; | 1325 return 0; |
1322 return legacyFontSizeFromCSSValue(document, toCSSPrimitiveValue(cssValue), | 1326 return legacyFontSizeFromCSSValue(document, toCSSPrimitiveValue(cssValue), |
1323 m_isMonospaceFont, AlwaysUseLegacyFontSize); | 1327 m_isMonospaceFont, AlwaysUseLegacyFontSize); |
1324 } | 1328 } |
1325 | 1329 |
1326 EditingStyle* EditingStyle::styleAtSelectionStart(const VisibleSelection& select
ion, bool shouldUseBackgroundColorInEffect, MutableStylePropertySet* styleToChec
k) | 1330 EditingStyle* EditingStyle::styleAtSelectionStart(const VisibleSelection& select
ion, bool shouldUseBackgroundColorInEffect, MutableStylePropertySet* styleToChec
k) |
1327 { | 1331 { |
1328 if (selection.isNone()) | 1332 if (selection.isNone()) |
1329 return nullptr; | 1333 return nullptr; |
(...skipping 24 matching lines...) Expand all Loading... |
1354 // Find the ancestor that has CSSValueSub or CSSValueSuper as the value
of CSS vertical-align property. | 1358 // Find the ancestor that has CSSValueSub or CSSValueSuper as the value
of CSS vertical-align property. |
1355 if (getIdentifierValue(elementStyle, CSSPropertyVerticalAlign) == CSSVal
ueBaseline && hasAncestorVerticalAlignStyle(*element, valueID)) | 1359 if (getIdentifierValue(elementStyle, CSSPropertyVerticalAlign) == CSSVal
ueBaseline && hasAncestorVerticalAlignStyle(*element, valueID)) |
1356 style->m_mutableStyle->setProperty(CSSPropertyVerticalAlign, valueID
); | 1360 style->m_mutableStyle->setProperty(CSSPropertyVerticalAlign, valueID
); |
1357 } | 1361 } |
1358 | 1362 |
1359 // If background color is transparent, traverse parent nodes until we hit a
different value or document root | 1363 // If background color is transparent, traverse parent nodes until we hit a
different value or document root |
1360 // Also, if the selection is a range, ignore the background color at the sta
rt of selection, | 1364 // Also, if the selection is a range, ignore the background color at the sta
rt of selection, |
1361 // and find the background color of the common ancestor. | 1365 // and find the background color of the common ancestor. |
1362 if (shouldUseBackgroundColorInEffect && (selection.isRange() || hasTranspare
ntBackgroundColor(style->m_mutableStyle.get()))) { | 1366 if (shouldUseBackgroundColorInEffect && (selection.isRange() || hasTranspare
ntBackgroundColor(style->m_mutableStyle.get()))) { |
1363 const EphemeralRange range(selection.toNormalizedEphemeralRange()); | 1367 const EphemeralRange range(selection.toNormalizedEphemeralRange()); |
1364 if (CSSValue* value = backgroundColorValueInEffect(Range::commonAncestor
Container(range.startPosition().computeContainerNode(), range.endPosition().comp
uteContainerNode()))) | 1368 if (const CSSValue* value = backgroundColorValueInEffect(Range::commonAn
cestorContainer(range.startPosition().computeContainerNode(), range.endPosition(
).computeContainerNode()))) |
1365 style->setProperty(CSSPropertyBackgroundColor, value->cssText()); | 1369 style->setProperty(CSSPropertyBackgroundColor, value->cssText()); |
1366 } | 1370 } |
1367 | 1371 |
1368 return style; | 1372 return style; |
1369 } | 1373 } |
1370 | 1374 |
1371 static bool isUnicodeBidiNestedOrMultipleEmbeddings(CSSValueID valueID) | 1375 static bool isUnicodeBidiNestedOrMultipleEmbeddings(CSSValueID valueID) |
1372 { | 1376 { |
1373 return valueID == CSSValueEmbed || valueID == CSSValueBidiOverride | 1377 return valueID == CSSValueEmbed || valueID == CSSValueBidiOverride |
1374 || valueID == CSSValueWebkitIsolate || valueID == CSSValueWebkitIsolateO
verride || valueID == CSSValueWebkitPlaintext | 1378 || valueID == CSSValueWebkitIsolate || valueID == CSSValueWebkitIsolateO
verride || valueID == CSSValueWebkitPlaintext |
(...skipping 17 matching lines...) Expand all Loading... |
1392 if (selection.isRange()) { | 1396 if (selection.isRange()) { |
1393 end = mostBackwardCaretPosition(selection.end()); | 1397 end = mostBackwardCaretPosition(selection.end()); |
1394 | 1398 |
1395 DCHECK(end.document()); | 1399 DCHECK(end.document()); |
1396 Node* pastLast = Range::create(*end.document(), position.parentAnchoredE
quivalent(), end.parentAnchoredEquivalent())->pastLastNode(); | 1400 Node* pastLast = Range::create(*end.document(), position.parentAnchoredE
quivalent(), end.parentAnchoredEquivalent())->pastLastNode(); |
1397 for (Node* n = node; n && n != pastLast; n = NodeTraversal::next(*n)) { | 1401 for (Node* n = node; n && n != pastLast; n = NodeTraversal::next(*n)) { |
1398 if (!n->isStyledElement()) | 1402 if (!n->isStyledElement()) |
1399 continue; | 1403 continue; |
1400 | 1404 |
1401 CSSComputedStyleDeclaration* style = CSSComputedStyleDeclaration::cr
eate(n); | 1405 CSSComputedStyleDeclaration* style = CSSComputedStyleDeclaration::cr
eate(n); |
1402 CSSValue* unicodeBidi = style->getPropertyCSSValue(CSSPropertyUnicod
eBidi); | 1406 const CSSValue* unicodeBidi = style->getPropertyCSSValue(CSSProperty
UnicodeBidi); |
1403 if (!unicodeBidi || !unicodeBidi->isPrimitiveValue()) | 1407 if (!unicodeBidi || !unicodeBidi->isPrimitiveValue()) |
1404 continue; | 1408 continue; |
1405 | 1409 |
1406 CSSValueID unicodeBidiValue = toCSSPrimitiveValue(unicodeBidi)->getV
alueID(); | 1410 CSSValueID unicodeBidiValue = toCSSPrimitiveValue(unicodeBidi)->getV
alueID(); |
1407 if (isUnicodeBidiNestedOrMultipleEmbeddings(unicodeBidiValue)) | 1411 if (isUnicodeBidiNestedOrMultipleEmbeddings(unicodeBidiValue)) |
1408 return NaturalWritingDirection; | 1412 return NaturalWritingDirection; |
1409 } | 1413 } |
1410 } | 1414 } |
1411 | 1415 |
1412 if (selection.isCaret()) { | 1416 if (selection.isCaret()) { |
(...skipping 12 matching lines...) Expand all Loading... |
1425 WritingDirection foundDirection = NaturalWritingDirection; | 1429 WritingDirection foundDirection = NaturalWritingDirection; |
1426 | 1430 |
1427 for (Node& runner : NodeTraversal::inclusiveAncestorsOf(*node)) { | 1431 for (Node& runner : NodeTraversal::inclusiveAncestorsOf(*node)) { |
1428 if (runner == block) | 1432 if (runner == block) |
1429 break; | 1433 break; |
1430 if (!runner.isStyledElement()) | 1434 if (!runner.isStyledElement()) |
1431 continue; | 1435 continue; |
1432 | 1436 |
1433 Element* element = &toElement(runner); | 1437 Element* element = &toElement(runner); |
1434 CSSComputedStyleDeclaration* style = CSSComputedStyleDeclaration::create
(element); | 1438 CSSComputedStyleDeclaration* style = CSSComputedStyleDeclaration::create
(element); |
1435 CSSValue* unicodeBidi = style->getPropertyCSSValue(CSSPropertyUnicodeBid
i); | 1439 const CSSValue* unicodeBidi = style->getPropertyCSSValue(CSSPropertyUnic
odeBidi); |
1436 if (!unicodeBidi || !unicodeBidi->isPrimitiveValue()) | 1440 if (!unicodeBidi || !unicodeBidi->isPrimitiveValue()) |
1437 continue; | 1441 continue; |
1438 | 1442 |
1439 CSSValueID unicodeBidiValue = toCSSPrimitiveValue(unicodeBidi)->getValue
ID(); | 1443 CSSValueID unicodeBidiValue = toCSSPrimitiveValue(unicodeBidi)->getValue
ID(); |
1440 if (unicodeBidiValue == CSSValueNormal) | 1444 if (unicodeBidiValue == CSSValueNormal) |
1441 continue; | 1445 continue; |
1442 | 1446 |
1443 if (unicodeBidiValue == CSSValueBidiOverride) | 1447 if (unicodeBidiValue == CSSValueBidiOverride) |
1444 return NaturalWritingDirection; | 1448 return NaturalWritingDirection; |
1445 | 1449 |
1446 DCHECK(isEmbedOrIsolate(unicodeBidiValue)) << unicodeBidiValue; | 1450 DCHECK(isEmbedOrIsolate(unicodeBidiValue)) << unicodeBidiValue; |
1447 CSSValue* direction = style->getPropertyCSSValue(CSSPropertyDirection); | 1451 const CSSValue* direction = style->getPropertyCSSValue(CSSPropertyDirect
ion); |
1448 if (!direction || !direction->isPrimitiveValue()) | 1452 if (!direction || !direction->isPrimitiveValue()) |
1449 continue; | 1453 continue; |
1450 | 1454 |
1451 int directionValue = toCSSPrimitiveValue(direction)->getValueID(); | 1455 int directionValue = toCSSPrimitiveValue(direction)->getValueID(); |
1452 if (directionValue != CSSValueLtr && directionValue != CSSValueRtl) | 1456 if (directionValue != CSSValueLtr && directionValue != CSSValueRtl) |
1453 continue; | 1457 continue; |
1454 | 1458 |
1455 if (foundDirection != NaturalWritingDirection) | 1459 if (foundDirection != NaturalWritingDirection) |
1456 return NaturalWritingDirection; | 1460 return NaturalWritingDirection; |
1457 | 1461 |
1458 // In the range case, make sure that the embedding element persists unti
l the end of the range. | 1462 // In the range case, make sure that the embedding element persists unti
l the end of the range. |
1459 if (selection.isRange() && !end.anchorNode()->isDescendantOf(element)) | 1463 if (selection.isRange() && !end.anchorNode()->isDescendantOf(element)) |
1460 return NaturalWritingDirection; | 1464 return NaturalWritingDirection; |
1461 | 1465 |
1462 foundDirection = directionValue == CSSValueLtr ? LeftToRightWritingDirec
tion : RightToLeftWritingDirection; | 1466 foundDirection = directionValue == CSSValueLtr ? LeftToRightWritingDirec
tion : RightToLeftWritingDirection; |
1463 } | 1467 } |
1464 hasNestedOrMultipleEmbeddings = false; | 1468 hasNestedOrMultipleEmbeddings = false; |
1465 return foundDirection; | 1469 return foundDirection; |
1466 } | 1470 } |
1467 | 1471 |
1468 DEFINE_TRACE(EditingStyle) | 1472 DEFINE_TRACE(EditingStyle) |
1469 { | 1473 { |
1470 visitor->trace(m_mutableStyle); | 1474 visitor->trace(m_mutableStyle); |
1471 } | 1475 } |
1472 | 1476 |
1473 static void reconcileTextDecorationProperties(MutableStylePropertySet* style) | 1477 static void reconcileTextDecorationProperties(MutableStylePropertySet* style) |
1474 { | 1478 { |
1475 CSSValue* textDecorationsInEffect = style->getPropertyCSSValue(CSSPropertyWe
bkitTextDecorationsInEffect); | 1479 const CSSValue* textDecorationsInEffect = style->getPropertyCSSValue(CSSProp
ertyWebkitTextDecorationsInEffect); |
1476 CSSValue* textDecoration = style->getPropertyCSSValue(textDecorationProperty
ForEditing()); | 1480 const CSSValue* textDecoration = style->getPropertyCSSValue(textDecorationPr
opertyForEditing()); |
1477 // We shouldn't have both text-decoration and -webkit-text-decorations-in-ef
fect because that wouldn't make sense. | 1481 // We shouldn't have both text-decoration and -webkit-text-decorations-in-ef
fect because that wouldn't make sense. |
1478 DCHECK(!textDecorationsInEffect || !textDecoration); | 1482 DCHECK(!textDecorationsInEffect || !textDecoration); |
1479 if (textDecorationsInEffect) { | 1483 if (textDecorationsInEffect) { |
1480 style->setProperty(textDecorationPropertyForEditing(), textDecorationsIn
Effect->cssText()); | 1484 style->setProperty(textDecorationPropertyForEditing(), textDecorationsIn
Effect->cssText()); |
1481 style->removeProperty(CSSPropertyWebkitTextDecorationsInEffect); | 1485 style->removeProperty(CSSPropertyWebkitTextDecorationsInEffect); |
1482 textDecoration = textDecorationsInEffect; | 1486 textDecoration = textDecorationsInEffect; |
1483 } | 1487 } |
1484 | 1488 |
1485 // If text-decoration is set to "none", remove the property because we don't
want to add redundant "text-decoration: none". | 1489 // If text-decoration is set to "none", remove the property because we don't
want to add redundant "text-decoration: none". |
1486 if (textDecoration && !textDecoration->isValueList()) | 1490 if (textDecoration && !textDecoration->isValueList()) |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1542 } | 1546 } |
1543 | 1547 |
1544 int fontStyle = getIdentifierValue(style, CSSPropertyFontStyle); | 1548 int fontStyle = getIdentifierValue(style, CSSPropertyFontStyle); |
1545 if (fontStyle == CSSValueItalic || fontStyle == CSSValueOblique) { | 1549 if (fontStyle == CSSValueItalic || fontStyle == CSSValueOblique) { |
1546 style->removeProperty(CSSPropertyFontStyle); | 1550 style->removeProperty(CSSPropertyFontStyle); |
1547 m_applyItalic = true; | 1551 m_applyItalic = true; |
1548 } | 1552 } |
1549 | 1553 |
1550 // Assuming reconcileTextDecorationProperties has been called, there should
not be -webkit-text-decorations-in-effect | 1554 // Assuming reconcileTextDecorationProperties has been called, there should
not be -webkit-text-decorations-in-effect |
1551 // Furthermore, text-decoration: none has been trimmed so that text-decorati
on property is always a CSSValueList. | 1555 // Furthermore, text-decoration: none has been trimmed so that text-decorati
on property is always a CSSValueList. |
1552 CSSValue* textDecoration = style->getPropertyCSSValue(textDecorationProperty
ForEditing()); | 1556 const CSSValue* textDecoration = style->getPropertyCSSValue(textDecorationPr
opertyForEditing()); |
1553 if (textDecoration && textDecoration->isValueList()) { | 1557 if (textDecoration && textDecoration->isValueList()) { |
1554 DEFINE_STATIC_LOCAL(CSSPrimitiveValue, underline, (CSSPrimitiveValue::cr
eateIdentifier(CSSValueUnderline))); | 1558 DEFINE_STATIC_LOCAL(CSSPrimitiveValue, underline, (CSSPrimitiveValue::cr
eateIdentifier(CSSValueUnderline))); |
1555 DEFINE_STATIC_LOCAL(CSSPrimitiveValue, lineThrough, (CSSPrimitiveValue::
createIdentifier(CSSValueLineThrough))); | 1559 DEFINE_STATIC_LOCAL(CSSPrimitiveValue, lineThrough, (CSSPrimitiveValue::
createIdentifier(CSSValueLineThrough))); |
1556 CSSValueList* newTextDecoration = toCSSValueList(textDecoration)->copy()
; | 1560 CSSValueList* newTextDecoration = toCSSValueList(textDecoration)->copy()
; |
1557 if (newTextDecoration->removeAll(underline)) | 1561 if (newTextDecoration->removeAll(underline)) |
1558 m_applyUnderline = true; | 1562 m_applyUnderline = true; |
1559 if (newTextDecoration->removeAll(lineThrough)) | 1563 if (newTextDecoration->removeAll(lineThrough)) |
1560 m_applyLineThrough = true; | 1564 m_applyLineThrough = true; |
1561 | 1565 |
1562 // If trimTextDecorations, delete underline and line-through | 1566 // If trimTextDecorations, delete underline and line-through |
(...skipping 15 matching lines...) Expand all Loading... |
1578 if (style->getPropertyCSSValue(CSSPropertyColor)) { | 1582 if (style->getPropertyCSSValue(CSSPropertyColor)) { |
1579 m_applyFontColor = getFontColor(style).serialized(); | 1583 m_applyFontColor = getFontColor(style).serialized(); |
1580 style->removeProperty(CSSPropertyColor); | 1584 style->removeProperty(CSSPropertyColor); |
1581 } | 1585 } |
1582 | 1586 |
1583 m_applyFontFace = style->getPropertyValue(CSSPropertyFontFamily); | 1587 m_applyFontFace = style->getPropertyValue(CSSPropertyFontFamily); |
1584 // Remove double quotes for Outlook 2007 compatibility. See https://bugs.web
kit.org/show_bug.cgi?id=79448 | 1588 // Remove double quotes for Outlook 2007 compatibility. See https://bugs.web
kit.org/show_bug.cgi?id=79448 |
1585 m_applyFontFace.replace('"', ""); | 1589 m_applyFontFace.replace('"', ""); |
1586 style->removeProperty(CSSPropertyFontFamily); | 1590 style->removeProperty(CSSPropertyFontFamily); |
1587 | 1591 |
1588 if (CSSValue* fontSize = style->getPropertyCSSValue(CSSPropertyFontSize)) { | 1592 if (const CSSValue* fontSize = style->getPropertyCSSValue(CSSPropertyFontSiz
e)) { |
1589 if (!fontSize->isPrimitiveValue()) { | 1593 if (!fontSize->isPrimitiveValue()) { |
1590 style->removeProperty(CSSPropertyFontSize); // Can't make sense of t
he number. Put no font size. | 1594 style->removeProperty(CSSPropertyFontSize); // Can't make sense of t
he number. Put no font size. |
1591 } else if (int legacyFontSize = legacyFontSizeFromCSSValue(document, toC
SSPrimitiveValue(fontSize), isMonospaceFont, UseLegacyFontSizeOnlyIfPixelValuesM
atch)) { | 1595 } else if (int legacyFontSize = legacyFontSizeFromCSSValue(document, toC
SSPrimitiveValue(fontSize), isMonospaceFont, UseLegacyFontSizeOnlyIfPixelValuesM
atch)) { |
1592 m_applyFontSize = String::number(legacyFontSize); | 1596 m_applyFontSize = String::number(legacyFontSize); |
1593 style->removeProperty(CSSPropertyFontSize); | 1597 style->removeProperty(CSSPropertyFontSize); |
1594 } | 1598 } |
1595 } | 1599 } |
1596 } | 1600 } |
1597 | 1601 |
1598 static void diffTextDecorations(MutableStylePropertySet* style, CSSPropertyID pr
opertID, CSSValue* refTextDecoration) | 1602 static void diffTextDecorations(MutableStylePropertySet* style, CSSPropertyID pr
opertyID, const CSSValue* refTextDecoration) |
1599 { | 1603 { |
1600 CSSValue* textDecoration = style->getPropertyCSSValue(propertID); | 1604 const CSSValue* textDecoration = style->getPropertyCSSValue(propertyID); |
1601 if (!textDecoration || !textDecoration->isValueList() || !refTextDecoration
|| !refTextDecoration->isValueList()) | 1605 if (!textDecoration || !textDecoration->isValueList() || !refTextDecoration
|| !refTextDecoration->isValueList()) |
1602 return; | 1606 return; |
1603 | 1607 |
1604 CSSValueList* newTextDecoration = toCSSValueList(textDecoration)->copy(); | 1608 CSSValueList* newTextDecoration = toCSSValueList(textDecoration)->copy(); |
1605 CSSValueList* valuesInRefTextDecoration = toCSSValueList(refTextDecoration); | 1609 const CSSValueList* valuesInRefTextDecoration = toCSSValueList(refTextDecora
tion); |
1606 | 1610 |
1607 for (size_t i = 0; i < valuesInRefTextDecoration->length(); i++) | 1611 for (size_t i = 0; i < valuesInRefTextDecoration->length(); i++) |
1608 newTextDecoration->removeAll(*valuesInRefTextDecoration->item(i)); | 1612 newTextDecoration->removeAll(*valuesInRefTextDecoration->item(i)); |
1609 | 1613 |
1610 setTextDecorationProperty(style, newTextDecoration, propertID); | 1614 setTextDecorationProperty(style, newTextDecoration, propertyID); |
1611 } | 1615 } |
1612 | 1616 |
1613 static bool fontWeightIsBold(CSSValue* fontWeight) | 1617 static bool fontWeightIsBold(const CSSValue* fontWeight) |
1614 { | 1618 { |
1615 if (!fontWeight->isPrimitiveValue()) | 1619 if (!fontWeight->isPrimitiveValue()) |
1616 return false; | 1620 return false; |
1617 | 1621 |
1618 // Because b tag can only bold text, there are only two states in plain html
: bold and not bold. | 1622 // Because b tag can only bold text, there are only two states in plain html
: bold and not bold. |
1619 // Collapse all other values to either one of these two states for editing p
urposes. | 1623 // Collapse all other values to either one of these two states for editing p
urposes. |
1620 switch (toCSSPrimitiveValue(fontWeight)->getValueID()) { | 1624 switch (toCSSPrimitiveValue(fontWeight)->getValueID()) { |
1621 case CSSValue100: | 1625 case CSSValue100: |
1622 case CSSValue200: | 1626 case CSSValue200: |
1623 case CSSValue300: | 1627 case CSSValue300: |
1624 case CSSValue400: | 1628 case CSSValue400: |
1625 case CSSValue500: | 1629 case CSSValue500: |
1626 case CSSValueNormal: | 1630 case CSSValueNormal: |
1627 return false; | 1631 return false; |
1628 case CSSValueBold: | 1632 case CSSValueBold: |
1629 case CSSValue600: | 1633 case CSSValue600: |
1630 case CSSValue700: | 1634 case CSSValue700: |
1631 case CSSValue800: | 1635 case CSSValue800: |
1632 case CSSValue900: | 1636 case CSSValue900: |
1633 return true; | 1637 return true; |
1634 default: | 1638 default: |
1635 break; | 1639 break; |
1636 } | 1640 } |
1637 | 1641 |
1638 ASSERT_NOT_REACHED(); // For CSSValueBolder and CSSValueLighter | 1642 ASSERT_NOT_REACHED(); // For CSSValueBolder and CSSValueLighter |
1639 return false; | 1643 return false; |
1640 } | 1644 } |
1641 | 1645 |
1642 static bool fontWeightNeedsResolving(CSSValue* fontWeight) | 1646 static bool fontWeightNeedsResolving(const CSSValue* fontWeight) |
1643 { | 1647 { |
1644 if (!fontWeight->isPrimitiveValue()) | 1648 if (!fontWeight->isPrimitiveValue()) |
1645 return true; | 1649 return true; |
1646 | 1650 |
1647 CSSValueID value = toCSSPrimitiveValue(fontWeight)->getValueID(); | 1651 const CSSValueID value = toCSSPrimitiveValue(fontWeight)->getValueID(); |
1648 return value == CSSValueLighter || value == CSSValueBolder; | 1652 return value == CSSValueLighter || value == CSSValueBolder; |
1649 } | 1653 } |
1650 | 1654 |
1651 MutableStylePropertySet* getPropertiesNotIn(StylePropertySet* styleWithRedundant
Properties, CSSStyleDeclaration* baseStyle) | 1655 MutableStylePropertySet* getPropertiesNotIn(StylePropertySet* styleWithRedundant
Properties, CSSStyleDeclaration* baseStyle) |
1652 { | 1656 { |
1653 DCHECK(styleWithRedundantProperties); | 1657 DCHECK(styleWithRedundantProperties); |
1654 DCHECK(baseStyle); | 1658 DCHECK(baseStyle); |
1655 MutableStylePropertySet* result = styleWithRedundantProperties->mutableCopy(
); | 1659 MutableStylePropertySet* result = styleWithRedundantProperties->mutableCopy(
); |
1656 | 1660 |
1657 result->removeEquivalentProperties(baseStyle); | 1661 result->removeEquivalentProperties(baseStyle); |
1658 | 1662 |
1659 CSSValue* baseTextDecorationsInEffect = baseStyle->getPropertyCSSValueIntern
al(CSSPropertyWebkitTextDecorationsInEffect); | 1663 const CSSValue* baseTextDecorationsInEffect = baseStyle->getPropertyCSSValue
Internal(CSSPropertyWebkitTextDecorationsInEffect); |
1660 diffTextDecorations(result, textDecorationPropertyForEditing(), baseTextDeco
rationsInEffect); | 1664 diffTextDecorations(result, textDecorationPropertyForEditing(), baseTextDeco
rationsInEffect); |
1661 diffTextDecorations(result, CSSPropertyWebkitTextDecorationsInEffect, baseTe
xtDecorationsInEffect); | 1665 diffTextDecorations(result, CSSPropertyWebkitTextDecorationsInEffect, baseTe
xtDecorationsInEffect); |
1662 | 1666 |
1663 if (CSSValue* baseFontWeight = baseStyle->getPropertyCSSValueInternal(CSSPro
pertyFontWeight)) { | 1667 if (const CSSValue* baseFontWeight = baseStyle->getPropertyCSSValueInternal(
CSSPropertyFontWeight)) { |
1664 if (CSSValue* fontWeight = result->getPropertyCSSValue(CSSPropertyFontWe
ight)) { | 1668 if (CSSValue* fontWeight = result->getPropertyCSSValue(CSSPropertyFontWe
ight)) { |
1665 if (!fontWeightNeedsResolving(fontWeight) && !fontWeightNeedsResolvi
ng(baseFontWeight) | 1669 if (!fontWeightNeedsResolving(fontWeight) && !fontWeightNeedsResolvi
ng(baseFontWeight) |
1666 && (fontWeightIsBold(fontWeight) == fontWeightIsBold(baseFontWei
ght))) | 1670 && (fontWeightIsBold(fontWeight) == fontWeightIsBold(baseFontWei
ght))) |
1667 result->removeProperty(CSSPropertyFontWeight); | 1671 result->removeProperty(CSSPropertyFontWeight); |
1668 } | 1672 } |
1669 } | 1673 } |
1670 | 1674 |
1671 if (baseStyle->getPropertyCSSValueInternal(CSSPropertyColor) && getFontColor
(result) == getFontColor(baseStyle)) | 1675 if (baseStyle->getPropertyCSSValueInternal(CSSPropertyColor) && getFontColor
(result) == getFontColor(baseStyle)) |
1672 result->removeProperty(CSSPropertyColor); | 1676 result->removeProperty(CSSPropertyColor); |
1673 | 1677 |
1674 if (baseStyle->getPropertyCSSValueInternal(CSSPropertyTextAlign) | 1678 if (baseStyle->getPropertyCSSValueInternal(CSSPropertyTextAlign) |
1675 && textAlignResolvingStartAndEnd(result) == textAlignResolvingStartAndEn
d(baseStyle)) | 1679 && textAlignResolvingStartAndEnd(result) == textAlignResolvingStartAndEn
d(baseStyle)) |
1676 result->removeProperty(CSSPropertyTextAlign); | 1680 result->removeProperty(CSSPropertyTextAlign); |
1677 | 1681 |
1678 if (baseStyle->getPropertyCSSValueInternal(CSSPropertyBackgroundColor) && ge
tBackgroundColor(result) == getBackgroundColor(baseStyle)) | 1682 if (baseStyle->getPropertyCSSValueInternal(CSSPropertyBackgroundColor) && ge
tBackgroundColor(result) == getBackgroundColor(baseStyle)) |
1679 result->removeProperty(CSSPropertyBackgroundColor); | 1683 result->removeProperty(CSSPropertyBackgroundColor); |
1680 | 1684 |
1681 return result; | 1685 return result; |
1682 } | 1686 } |
1683 | 1687 |
1684 CSSValueID getIdentifierValue(StylePropertySet* style, CSSPropertyID propertyID) | 1688 CSSValueID getIdentifierValue(StylePropertySet* style, CSSPropertyID propertyID) |
1685 { | 1689 { |
1686 if (!style) | 1690 if (!style) |
1687 return CSSValueInvalid; | 1691 return CSSValueInvalid; |
1688 CSSValue* value = style->getPropertyCSSValue(propertyID); | 1692 const CSSValue* value = style->getPropertyCSSValue(propertyID); |
1689 if (!value || !value->isPrimitiveValue()) | 1693 if (!value || !value->isPrimitiveValue()) |
1690 return CSSValueInvalid; | 1694 return CSSValueInvalid; |
1691 return toCSSPrimitiveValue(value)->getValueID(); | 1695 return toCSSPrimitiveValue(value)->getValueID(); |
1692 } | 1696 } |
1693 | 1697 |
1694 CSSValueID getIdentifierValue(CSSStyleDeclaration* style, CSSPropertyID property
ID) | 1698 CSSValueID getIdentifierValue(CSSStyleDeclaration* style, CSSPropertyID property
ID) |
1695 { | 1699 { |
1696 if (!style) | 1700 if (!style) |
1697 return CSSValueInvalid; | 1701 return CSSValueInvalid; |
1698 CSSValue* value = style->getPropertyCSSValueInternal(propertyID); | 1702 const CSSValue* value = style->getPropertyCSSValueInternal(propertyID); |
1699 if (!value || !value->isPrimitiveValue()) | 1703 if (!value || !value->isPrimitiveValue()) |
1700 return CSSValueInvalid; | 1704 return CSSValueInvalid; |
1701 return toCSSPrimitiveValue(value)->getValueID(); | 1705 return toCSSPrimitiveValue(value)->getValueID(); |
1702 } | 1706 } |
1703 | 1707 |
1704 int legacyFontSizeFromCSSValue(Document* document, CSSPrimitiveValue* value, boo
l isMonospaceFont, LegacyFontSizeMode mode) | 1708 int legacyFontSizeFromCSSValue(Document* document, const CSSPrimitiveValue* valu
e, bool isMonospaceFont, LegacyFontSizeMode mode) |
1705 { | 1709 { |
1706 CSSPrimitiveValue::LengthUnitType lengthType; | 1710 CSSPrimitiveValue::LengthUnitType lengthType; |
1707 if (CSSPrimitiveValue::unitTypeToLengthUnitType(value->typeWithCalcResolved(
), lengthType) | 1711 if (CSSPrimitiveValue::unitTypeToLengthUnitType(value->typeWithCalcResolved(
), lengthType) |
1708 && lengthType == CSSPrimitiveValue::UnitTypePixels) { | 1712 && lengthType == CSSPrimitiveValue::UnitTypePixels) { |
1709 double conversion = CSSPrimitiveValue::conversionToCanonicalUnitsScaleFa
ctor(value->typeWithCalcResolved()); | 1713 double conversion = CSSPrimitiveValue::conversionToCanonicalUnitsScaleFa
ctor(value->typeWithCalcResolved()); |
1710 int pixelFontSize = clampTo<int>(value->getDoubleValue() * conversion); | 1714 int pixelFontSize = clampTo<int>(value->getDoubleValue() * conversion); |
1711 int legacyFontSize = FontSize::legacyFontSize(document, pixelFontSize, i
sMonospaceFont); | 1715 int legacyFontSize = FontSize::legacyFontSize(document, pixelFontSize, i
sMonospaceFont); |
1712 // Use legacy font size only if pixel value matches exactly to that of l
egacy font size. | 1716 // Use legacy font size only if pixel value matches exactly to that of l
egacy font size. |
1713 if (mode == AlwaysUseLegacyFontSize || FontSize::fontSizeForKeyword(docu
ment, legacyFontSize, isMonospaceFont) == pixelFontSize) | 1717 if (mode == AlwaysUseLegacyFontSize || FontSize::fontSizeForKeyword(docu
ment, legacyFontSize, isMonospaceFont) == pixelFontSize) |
1714 return legacyFontSize; | 1718 return legacyFontSize; |
1715 | 1719 |
1716 return 0; | 1720 return 0; |
1717 } | 1721 } |
1718 | 1722 |
1719 if (CSSValueXSmall <= value->getValueID() && value->getValueID() <= CSSValue
WebkitXxxLarge) | 1723 if (CSSValueXSmall <= value->getValueID() && value->getValueID() <= CSSValue
WebkitXxxLarge) |
1720 return value->getValueID() - CSSValueXSmall + 1; | 1724 return value->getValueID() - CSSValueXSmall + 1; |
1721 | 1725 |
1722 return 0; | 1726 return 0; |
1723 } | 1727 } |
1724 | 1728 |
1725 bool isTransparentColorValue(CSSValue* cssValue) | 1729 bool isTransparentColorValue(const CSSValue* cssValue) |
1726 { | 1730 { |
1727 if (!cssValue) | 1731 if (!cssValue) |
1728 return true; | 1732 return true; |
1729 if (cssValue->isColorValue()) | 1733 if (cssValue->isColorValue()) |
1730 return !toCSSColorValue(cssValue)->value().alpha(); | 1734 return !toCSSColorValue(cssValue)->value().alpha(); |
1731 if (!cssValue->isPrimitiveValue()) | 1735 if (!cssValue->isPrimitiveValue()) |
1732 return false; | 1736 return false; |
1733 CSSPrimitiveValue* value = toCSSPrimitiveValue(cssValue); | 1737 const CSSPrimitiveValue* value = toCSSPrimitiveValue(cssValue); |
1734 return value->getValueID() == CSSValueTransparent; | 1738 return value->getValueID() == CSSValueTransparent; |
1735 } | 1739 } |
1736 | 1740 |
1737 bool hasTransparentBackgroundColor(CSSStyleDeclaration* style) | 1741 bool hasTransparentBackgroundColor(CSSStyleDeclaration* style) |
1738 { | 1742 { |
1739 CSSValue* cssValue = style->getPropertyCSSValueInternal(CSSPropertyBackgroun
dColor); | 1743 const CSSValue* cssValue = style->getPropertyCSSValueInternal(CSSPropertyBac
kgroundColor); |
1740 return isTransparentColorValue(cssValue); | 1744 return isTransparentColorValue(cssValue); |
1741 } | 1745 } |
1742 | 1746 |
1743 bool hasTransparentBackgroundColor(StylePropertySet* style) | 1747 bool hasTransparentBackgroundColor(StylePropertySet* style) |
1744 { | 1748 { |
1745 CSSValue* cssValue = style->getPropertyCSSValue(CSSPropertyBackgroundColor); | 1749 const CSSValue* cssValue = style->getPropertyCSSValue(CSSPropertyBackgroundC
olor); |
1746 return isTransparentColorValue(cssValue); | 1750 return isTransparentColorValue(cssValue); |
1747 } | 1751 } |
1748 | 1752 |
1749 CSSValue* backgroundColorValueInEffect(Node* node) | 1753 const CSSValue* backgroundColorValueInEffect(Node* node) |
1750 { | 1754 { |
1751 for (Node* ancestor = node; ancestor; ancestor = ancestor->parentNode()) { | 1755 for (Node* ancestor = node; ancestor; ancestor = ancestor->parentNode()) { |
1752 CSSComputedStyleDeclaration* ancestorStyle = CSSComputedStyleDeclaration
::create(ancestor); | 1756 CSSComputedStyleDeclaration* ancestorStyle = CSSComputedStyleDeclaration
::create(ancestor); |
1753 if (!hasTransparentBackgroundColor(ancestorStyle)) | 1757 if (!hasTransparentBackgroundColor(ancestorStyle)) |
1754 return ancestorStyle->getPropertyCSSValue(CSSPropertyBackgroundColor
); | 1758 return ancestorStyle->getPropertyCSSValue(CSSPropertyBackgroundColor
); |
1755 } | 1759 } |
1756 return nullptr; | 1760 return nullptr; |
1757 } | 1761 } |
1758 | 1762 |
1759 } // namespace blink | 1763 } // namespace blink |
OLD | NEW |