Title: [87952] trunk/Source/WebCore
- Revision
- 87952
- Author
- rn...@webkit.org
- Date
- 2011-06-02 14:35:16 -0700 (Thu, 02 Jun 2011)
Log Message
2011-06-02 Ryosuke Niwa <rn...@webkit.org>
Reviewed by Enrica Casucci.
ApplyStyleCommand shouldn't call collapseTextDecorationProperties
https://bugs.webkit.org/show_bug.cgi?id=61887
Removed the call to collapseTextDecorationProperties in ApplyStyleCommand::applyInlineStyle.
No new tests because this is a code refactoring.
* editing/ApplyStyleCommand.cpp:
(WebCore::ApplyStyleCommand::applyInlineStyle): No loner calls collapseTextDecorationProperties.
(WebCore::ApplyStyleCommand::pushDownInlineStyleAroundNode): Updated comment.
* editing/EditingStyle.cpp:
(WebCore::HTMLElementEquivalent::propertyExistsInStyle): Added to check both text-decoration
and -webkit-text-decorations-in-effect.
(WebCore::HTMLTextDecorationEquivalent::HTMLTextDecorationEquivalent): Added a comment.
(WebCore::HTMLTextDecorationEquivalent::propertyExistsInStyle): Checks both text-decoration
and -webkit-text-decorations-in-effect.
(WebCore::HTMLTextDecorationEquivalent::valueIsPresentInStyle): Checks if a text decoration
is present in -webkit-text-decorations-in-effect or text-decoration preferring the former.
(WebCore::EditingStyle::conflictsWithInlineStyleOfElement): Merged loops for when conflictingProperties
is false and true. Added a support for -webkit-text-decorations-in-effect.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (87951 => 87952)
--- trunk/Source/WebCore/ChangeLog 2011-06-02 21:29:46 UTC (rev 87951)
+++ trunk/Source/WebCore/ChangeLog 2011-06-02 21:35:16 UTC (rev 87952)
@@ -1,5 +1,30 @@
2011-06-02 Ryosuke Niwa <rn...@webkit.org>
+ Reviewed by Enrica Casucci.
+
+ ApplyStyleCommand shouldn't call collapseTextDecorationProperties
+ https://bugs.webkit.org/show_bug.cgi?id=61887
+
+ Removed the call to collapseTextDecorationProperties in ApplyStyleCommand::applyInlineStyle.
+
+ No new tests because this is a code refactoring.
+
+ * editing/ApplyStyleCommand.cpp:
+ (WebCore::ApplyStyleCommand::applyInlineStyle): No loner calls collapseTextDecorationProperties.
+ (WebCore::ApplyStyleCommand::pushDownInlineStyleAroundNode): Updated comment.
+ * editing/EditingStyle.cpp:
+ (WebCore::HTMLElementEquivalent::propertyExistsInStyle): Added to check both text-decoration
+ and -webkit-text-decorations-in-effect.
+ (WebCore::HTMLTextDecorationEquivalent::HTMLTextDecorationEquivalent): Added a comment.
+ (WebCore::HTMLTextDecorationEquivalent::propertyExistsInStyle): Checks both text-decoration
+ and -webkit-text-decorations-in-effect.
+ (WebCore::HTMLTextDecorationEquivalent::valueIsPresentInStyle): Checks if a text decoration
+ is present in -webkit-text-decorations-in-effect or text-decoration preferring the former.
+ (WebCore::EditingStyle::conflictsWithInlineStyleOfElement): Merged loops for when conflictingProperties
+ is false and true. Added a support for -webkit-text-decorations-in-effect.
+
+2011-06-02 Ryosuke Niwa <rn...@webkit.org>
+
Reviewed by Eric Seidel.
Make more functions static local in EventHandlers.cpp
Modified: trunk/Source/WebCore/editing/ApplyStyleCommand.cpp (87951 => 87952)
--- trunk/Source/WebCore/editing/ApplyStyleCommand.cpp 2011-06-02 21:29:46 UTC (rev 87951)
+++ trunk/Source/WebCore/editing/ApplyStyleCommand.cpp 2011-06-02 21:35:16 UTC (rev 87952)
@@ -531,8 +531,6 @@
Node* startDummySpanAncestor = 0;
Node* endDummySpanAncestor = 0;
- style->collapseTextDecorationProperties();
-
// update document layout once before removing styles
// so that we avoid the expense of updating before each and every call
// to check a computed style
@@ -1006,7 +1004,7 @@
}
}
- // Apply text decoration to all nodes containing targetNode and their siblings but NOT to targetNode
+ // Apply style to all nodes containing targetNode and their siblings but NOT to targetNode
// But if we've removed styledElement then go ahead and always apply the style.
if (child != targetNode || styledElement)
applyInlineStyleToPushDown(child, styleToPushDown.get());
Modified: trunk/Source/WebCore/editing/EditingStyle.cpp (87951 => 87952)
--- trunk/Source/WebCore/editing/EditingStyle.cpp 2011-06-02 21:29:46 UTC (rev 87951)
+++ trunk/Source/WebCore/editing/EditingStyle.cpp 2011-06-02 21:35:16 UTC (rev 87952)
@@ -98,7 +98,7 @@
virtual ~HTMLElementEquivalent() { }
virtual bool matches(Element* element) const { return !m_tagName || element->hasTagName(*m_tagName); }
virtual bool hasAttribute() const { return false; }
- bool propertyExistsInStyle(CSSStyleDeclaration* style) const { return style->getPropertyCSSValue(m_propertyID); }
+ virtual bool propertyExistsInStyle(CSSStyleDeclaration* style) const { return style->getPropertyCSSValue(m_propertyID); }
virtual bool valueIsPresentInStyle(Element*, CSSStyleDeclaration*) const;
virtual void addToStyle(Element*, EditingStyle*) const;
@@ -148,6 +148,7 @@
{
return adoptPtr(new HTMLTextDecorationEquivalent(primitiveValue, tagName));
}
+ virtual bool propertyExistsInStyle(CSSStyleDeclaration*) const;
virtual bool valueIsPresentInStyle(Element*, CSSStyleDeclaration*) const;
private:
@@ -156,12 +157,20 @@
HTMLTextDecorationEquivalent::HTMLTextDecorationEquivalent(int primitiveValue, const QualifiedName& tagName)
: HTMLElementEquivalent(CSSPropertyTextDecoration, primitiveValue, tagName)
+ // m_propertyID is used in HTMLElementEquivalent::addToStyle
{
}
+bool HTMLTextDecorationEquivalent::propertyExistsInStyle(CSSStyleDeclaration* style) const
+{
+ return style->getPropertyCSSValue(CSSPropertyWebkitTextDecorationsInEffect) || style->getPropertyCSSValue(CSSPropertyTextDecoration);
+}
+
bool HTMLTextDecorationEquivalent::valueIsPresentInStyle(Element* element, CSSStyleDeclaration* style) const
{
- RefPtr<CSSValue> styleValue = style->getPropertyCSSValue(m_propertyID);
+ RefPtr<CSSValue> styleValue = style->getPropertyCSSValue(CSSPropertyWebkitTextDecorationsInEffect);
+ if (!styleValue)
+ styleValue = style->getPropertyCSSValue(CSSPropertyTextDecoration);
return matches(element) && styleValue && styleValue->isValueList() && static_cast<CSSValueList*>(styleValue.get())->hasValue(m_primitiveValue.get());
}
@@ -583,40 +592,44 @@
if (!m_mutableStyle || !inlineStyle)
return false;
- if (!conflictingProperties) {
- CSSMutableStyleDeclaration::const_iterator end = m_mutableStyle->end();
- for (CSSMutableStyleDeclaration::const_iterator it = m_mutableStyle->begin(); it != end; ++it) {
- CSSPropertyID propertyID = static_cast<CSSPropertyID>(it->id());
+ CSSMutableStyleDeclaration::const_iterator end = m_mutableStyle->end();
+ for (CSSMutableStyleDeclaration::const_iterator it = m_mutableStyle->begin(); it != end; ++it) {
+ CSSPropertyID propertyID = static_cast<CSSPropertyID>(it->id());
- // We don't override whitespace property of a tab span because that would collapse the tab into a space.
- if (propertyID == CSSPropertyWhiteSpace && isTabSpanNode(element))
- continue;
+ // We don't override whitespace property of a tab span because that would collapse the tab into a space.
+ if (propertyID == CSSPropertyWhiteSpace && isTabSpanNode(element))
+ continue;
- if (inlineStyle->getPropertyCSSValue(propertyID))
+ if (propertyID == CSSPropertyWebkitTextDecorationsInEffect && inlineStyle->getPropertyCSSValue(CSSPropertyTextDecoration)) {
+ if (!conflictingProperties)
return true;
+ conflictingProperties->append(CSSPropertyTextDecoration);
+ if (extractedStyle)
+ extractedStyle->setProperty(CSSPropertyTextDecoration, inlineStyle->getPropertyValue(CSSPropertyTextDecoration), inlineStyle->getPropertyPriority(CSSPropertyTextDecoration));
+ continue;
}
- return false;
- }
-
- CSSMutableStyleDeclaration::const_iterator end = m_mutableStyle->end();
- for (CSSMutableStyleDeclaration::const_iterator it = m_mutableStyle->begin(); it != end; ++it) {
- CSSPropertyID propertyID = static_cast<CSSPropertyID>(it->id());
- if ((propertyID == CSSPropertyWhiteSpace && isTabSpanNode(element)) || !inlineStyle->getPropertyCSSValue(propertyID))
+ if (!inlineStyle->getPropertyCSSValue(propertyID))
continue;
if (propertyID == CSSPropertyUnicodeBidi && inlineStyle->getPropertyCSSValue(CSSPropertyDirection)) {
+ if (!conflictingProperties)
+ return true;
+ conflictingProperties->append(CSSPropertyDirection);
if (extractedStyle)
extractedStyle->setProperty(propertyID, inlineStyle->getPropertyValue(propertyID), inlineStyle->getPropertyPriority(propertyID));
- conflictingProperties->append(CSSPropertyDirection);
}
+ if (!conflictingProperties)
+ return true;
+
conflictingProperties->append(propertyID);
+
if (extractedStyle)
extractedStyle->setProperty(propertyID, inlineStyle->getPropertyValue(propertyID), inlineStyle->getPropertyPriority(propertyID));
}
- return !conflictingProperties->isEmpty();
+ return conflictingProperties && !conflictingProperties->isEmpty();
}
bool EditingStyle::conflictsWithImplicitStyleOfElement(HTMLElement* element, EditingStyle* extractedStyle, ShouldExtractMatchingStyle shouldExtractMatchingStyle) const
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes