Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(299)

Unified Diff: Source/WebCore/editing/ApplyStyleCommand.cpp

Issue 7973008: Revert 93001 - Apple-style-span class seems unnecessary (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/874/
Patch Set: Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/WebCore/editing/ApplyStyleCommand.h ('k') | Source/WebCore/editing/EditingStyle.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/WebCore/editing/ApplyStyleCommand.cpp
===================================================================
--- Source/WebCore/editing/ApplyStyleCommand.cpp (revision 95747)
+++ Source/WebCore/editing/ApplyStyleCommand.cpp (working copy)
@@ -61,7 +61,7 @@
return styleSpanClassString;
}
-bool isLegacyAppleStyleSpan(const Node *node)
+bool isStyleSpan(const Node *node)
{
if (!node || !node->isHTMLElement())
return false;
@@ -96,8 +96,13 @@
return hasNoAttributeOrOnlyStyleAttribute(toHTMLElement(element), AllowNonEmptyStyleAttribute);
}
-static inline bool isSpanWithoutAttributesOrUnstyledStyleSpan(const Node* node)
+static inline bool isUnstyledStyleSpan(const Node* node)
{
+ return isStyleSpan(node) && hasNoAttributeOrOnlyStyleAttribute(toHTMLElement(node), StyleAttributeShouldBeEmpty);
+}
+
+static inline bool isSpanWithoutAttributesOrUnstyleStyleSpan(const Node* node)
+{
if (!node || !node->isHTMLElement() || !node->hasTagName(spanTag))
return false;
return hasNoAttributeOrOnlyStyleAttribute(toHTMLElement(node), StyleAttributeShouldBeEmpty);
@@ -118,12 +123,14 @@
static PassRefPtr<Element> createFontElement(Document* document)
{
RefPtr<Element> fontNode = createHTMLElement(document, fontTag);
+ fontNode->setAttribute(classAttr, styleSpanClassString());
return fontNode.release();
}
PassRefPtr<HTMLElement> createStyleSpanElement(Document* document)
{
RefPtr<HTMLElement> styleElement = createHTMLElement(document, spanTag);
+ styleElement->setAttribute(classAttr, styleSpanClassString());
return styleElement.release();
}
@@ -399,7 +406,8 @@
}
if (inlineStyleDecl->isEmpty()) {
removeNodeAttribute(element.get(), styleAttr);
- if (isSpanWithoutAttributesOrUnstyledStyleSpan(element.get()))
+ // FIXME: should this be isSpanWithoutAttributesOrUnstyleStyleSpan? Need a test.
+ if (isUnstyledStyleSpan(element.get()))
unstyledSpans.append(element.release());
}
}
@@ -411,7 +419,7 @@
static Node* dummySpanAncestorForNode(const Node* node)
{
- while (node && (!node->isElementNode() || !isStyleSpanOrSpanWithOnlyStyleAttribute(toElement(node))))
+ while (node && !isStyleSpan(node))
node = node->parentNode();
return node ? node->parentNode() : 0;
@@ -429,7 +437,7 @@
Node* next;
for (Node* node = dummySpanAncestor->firstChild(); node; node = next) {
next = node->nextSibling();
- if (isSpanWithoutAttributesOrUnstyledStyleSpan(node))
+ if (isUnstyledStyleSpan(node))
removeNodePreservingChildren(node);
node = next;
}
@@ -516,7 +524,8 @@
inlineStyle->setProperty(CSSPropertyUnicodeBidi, CSSValueNormal);
inlineStyle->removeProperty(CSSPropertyDirection);
setNodeAttribute(element, styleAttr, inlineStyle->cssText());
- if (isSpanWithoutAttributesOrUnstyledStyleSpan(element))
+ // FIXME: should this be isSpanWithoutAttributesOrUnstyleStyleSpan? Need a test.
+ if (isUnstyledStyleSpan(element))
removeNodePreservingChildren(element);
}
}
@@ -873,7 +882,7 @@
for (size_t i = 0; i < attributes.size(); i++)
removeNodeAttribute(element, attributes[i]);
- if (isEmptyFontTag(element) || isSpanWithoutAttributesOrUnstyledStyleSpan(element))
+ if (isEmptyFontTag(element) || isSpanWithoutAttributesOrUnstyleStyleSpan(element))
removeNodePreservingChildren(element);
return true;
@@ -901,7 +910,7 @@
if (inlineStyle->isEmpty())
removeNodeAttribute(element, styleAttr);
- if (isSpanWithoutAttributesOrUnstyledStyleSpan(element))
+ if (isSpanWithoutAttributesOrUnstyleStyleSpan(element))
removeNodePreservingChildren(element);
return true;
« no previous file with comments | « Source/WebCore/editing/ApplyStyleCommand.h ('k') | Source/WebCore/editing/EditingStyle.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698