Changeset 87952 in webkit
- Timestamp:
- Jun 2, 2011 2:35:16 PM (13 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r87951 r87952 1 2011-06-02 Ryosuke Niwa <rniwa@webkit.org> 2 3 Reviewed by Enrica Casucci. 4 5 ApplyStyleCommand shouldn't call collapseTextDecorationProperties 6 https://bugs.webkit.org/show_bug.cgi?id=61887 7 8 Removed the call to collapseTextDecorationProperties in ApplyStyleCommand::applyInlineStyle. 9 10 No new tests because this is a code refactoring. 11 12 * editing/ApplyStyleCommand.cpp: 13 (WebCore::ApplyStyleCommand::applyInlineStyle): No loner calls collapseTextDecorationProperties. 14 (WebCore::ApplyStyleCommand::pushDownInlineStyleAroundNode): Updated comment. 15 * editing/EditingStyle.cpp: 16 (WebCore::HTMLElementEquivalent::propertyExistsInStyle): Added to check both text-decoration 17 and -webkit-text-decorations-in-effect. 18 (WebCore::HTMLTextDecorationEquivalent::HTMLTextDecorationEquivalent): Added a comment. 19 (WebCore::HTMLTextDecorationEquivalent::propertyExistsInStyle): Checks both text-decoration 20 and -webkit-text-decorations-in-effect. 21 (WebCore::HTMLTextDecorationEquivalent::valueIsPresentInStyle): Checks if a text decoration 22 is present in -webkit-text-decorations-in-effect or text-decoration preferring the former. 23 (WebCore::EditingStyle::conflictsWithInlineStyleOfElement): Merged loops for when conflictingProperties 24 is false and true. Added a support for -webkit-text-decorations-in-effect. 25 1 26 2011-06-02 Ryosuke Niwa <rniwa@webkit.org> 2 27 -
trunk/Source/WebCore/editing/ApplyStyleCommand.cpp
r86325 r87952 532 532 Node* endDummySpanAncestor = 0; 533 533 534 style->collapseTextDecorationProperties();535 536 534 // update document layout once before removing styles 537 535 // so that we avoid the expense of updating before each and every call … … 1007 1005 } 1008 1006 1009 // Apply text decorationto all nodes containing targetNode and their siblings but NOT to targetNode1007 // Apply style to all nodes containing targetNode and their siblings but NOT to targetNode 1010 1008 // But if we've removed styledElement then go ahead and always apply the style. 1011 1009 if (child != targetNode || styledElement) -
trunk/Source/WebCore/editing/EditingStyle.cpp
r87466 r87952 99 99 virtual bool matches(Element* element) const { return !m_tagName || element->hasTagName(*m_tagName); } 100 100 virtual bool hasAttribute() const { return false; } 101 bool propertyExistsInStyle(CSSStyleDeclaration* style) const { return style->getPropertyCSSValue(m_propertyID); }101 virtual bool propertyExistsInStyle(CSSStyleDeclaration* style) const { return style->getPropertyCSSValue(m_propertyID); } 102 102 virtual bool valueIsPresentInStyle(Element*, CSSStyleDeclaration*) const; 103 103 virtual void addToStyle(Element*, EditingStyle*) const; … … 149 149 return adoptPtr(new HTMLTextDecorationEquivalent(primitiveValue, tagName)); 150 150 } 151 virtual bool propertyExistsInStyle(CSSStyleDeclaration*) const; 151 152 virtual bool valueIsPresentInStyle(Element*, CSSStyleDeclaration*) const; 152 153 … … 157 158 HTMLTextDecorationEquivalent::HTMLTextDecorationEquivalent(int primitiveValue, const QualifiedName& tagName) 158 159 : HTMLElementEquivalent(CSSPropertyTextDecoration, primitiveValue, tagName) 159 { 160 // m_propertyID is used in HTMLElementEquivalent::addToStyle 161 { 162 } 163 164 bool HTMLTextDecorationEquivalent::propertyExistsInStyle(CSSStyleDeclaration* style) const 165 { 166 return style->getPropertyCSSValue(CSSPropertyWebkitTextDecorationsInEffect) || style->getPropertyCSSValue(CSSPropertyTextDecoration); 160 167 } 161 168 162 169 bool HTMLTextDecorationEquivalent::valueIsPresentInStyle(Element* element, CSSStyleDeclaration* style) const 163 170 { 164 RefPtr<CSSValue> styleValue = style->getPropertyCSSValue(m_propertyID); 171 RefPtr<CSSValue> styleValue = style->getPropertyCSSValue(CSSPropertyWebkitTextDecorationsInEffect); 172 if (!styleValue) 173 styleValue = style->getPropertyCSSValue(CSSPropertyTextDecoration); 165 174 return matches(element) && styleValue && styleValue->isValueList() && static_cast<CSSValueList*>(styleValue.get())->hasValue(m_primitiveValue.get()); 166 175 } … … 584 593 return false; 585 594 586 if (!conflictingProperties) {587 CSSMutableStyleDeclaration::const_iterator end = m_mutableStyle->end();588 for (CSSMutableStyleDeclaration::const_iterator it = m_mutableStyle->begin(); it != end; ++it) {589 CSSPropertyID propertyID = static_cast<CSSPropertyID>(it->id());590 591 // We don't override whitespace property of a tab span because that would collapse the tab into a space.592 if (propertyID == CSSPropertyWhiteSpace && isTabSpanNode(element))593 continue;594 595 if (inlineStyle->getPropertyCSSValue(propertyID))596 return true;597 }598 599 return false;600 }601 602 595 CSSMutableStyleDeclaration::const_iterator end = m_mutableStyle->end(); 603 596 for (CSSMutableStyleDeclaration::const_iterator it = m_mutableStyle->begin(); it != end; ++it) { 604 597 CSSPropertyID propertyID = static_cast<CSSPropertyID>(it->id()); 605 if ((propertyID == CSSPropertyWhiteSpace && isTabSpanNode(element)) || !inlineStyle->getPropertyCSSValue(propertyID)) 598 599 // We don't override whitespace property of a tab span because that would collapse the tab into a space. 600 if (propertyID == CSSPropertyWhiteSpace && isTabSpanNode(element)) 606 601 continue; 607 602 603 if (propertyID == CSSPropertyWebkitTextDecorationsInEffect && inlineStyle->getPropertyCSSValue(CSSPropertyTextDecoration)) { 604 if (!conflictingProperties) 605 return true; 606 conflictingProperties->append(CSSPropertyTextDecoration); 607 if (extractedStyle) 608 extractedStyle->setProperty(CSSPropertyTextDecoration, inlineStyle->getPropertyValue(CSSPropertyTextDecoration), inlineStyle->getPropertyPriority(CSSPropertyTextDecoration)); 609 continue; 610 } 611 612 if (!inlineStyle->getPropertyCSSValue(propertyID)) 613 continue; 614 608 615 if (propertyID == CSSPropertyUnicodeBidi && inlineStyle->getPropertyCSSValue(CSSPropertyDirection)) { 616 if (!conflictingProperties) 617 return true; 618 conflictingProperties->append(CSSPropertyDirection); 609 619 if (extractedStyle) 610 620 extractedStyle->setProperty(propertyID, inlineStyle->getPropertyValue(propertyID), inlineStyle->getPropertyPriority(propertyID)); 611 conflictingProperties->append(CSSPropertyDirection);612 621 } 613 622 623 if (!conflictingProperties) 624 return true; 625 614 626 conflictingProperties->append(propertyID); 627 615 628 if (extractedStyle) 616 629 extractedStyle->setProperty(propertyID, inlineStyle->getPropertyValue(propertyID), inlineStyle->getPropertyPriority(propertyID)); 617 630 } 618 631 619 return !conflictingProperties->isEmpty();632 return conflictingProperties && !conflictingProperties->isEmpty(); 620 633 } 621 634
Note: See TracChangeset
for help on using the changeset viewer.