[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
rniwa at webkit.org
rniwa at webkit.org
Wed Dec 22 11:41:42 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit 7d9165ae7e06d907ec192974b0322934878d003a
Author: rniwa at webkit.org <rniwa at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Wed Aug 4 01:19:14 2010 +0000
2010-08-03 Ryosuke Niwa <rniwa at webkit.org>
Reviewed by Eric Seidel.
extractAndNegateTextDecorationStyle and maxRangeOffset in ApplyStyleCommand.cpp should be deleted
https://bugs.webkit.org/show_bug.cgi?id=43437
Removed extractAndNegateTextDecorationStyle because we never push down text decorations added by CSS rules
as discussed on the bug 27809. Also removed pushDownTextDecorationStyleAtBoundaries because it only existed
to encapsulate the complexity of calling pushDownTextDecorationStyleAroundNode first with forceNegate = false
(calling pushDownTextDecorationStyleAroundNode) and again with forceNegate = true (calling extractAndNegateTextDecorationStyle)
after updating layout but neither the layout update nor the second call to pushDownTextDecorationStyleAroundNode
is needed after the removal of extractAndNegateTextDecorationStyle.
Also replaced maxRangeOffset by lastOffsetForEditing as FIXME (added by r48235) indicated.
No new tests added since this is a clean up.
* editing/ApplyStyleCommand.cpp:
(WebCore::ApplyStyleCommand::pushDownTextDecorationStyleAroundNode): No longer takes forceNegate as an argument.
(WebCore::ApplyStyleCommand::removeInlineStyle): Calls pushDownTextDecorationStyleAroundNode directly.
* editing/ApplyStyleCommand.h:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@64610 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index b55f160..c278138 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,5 +1,28 @@
2010-08-03 Ryosuke Niwa <rniwa at webkit.org>
+ Reviewed by Eric Seidel.
+
+ extractAndNegateTextDecorationStyle and maxRangeOffset in ApplyStyleCommand.cpp should be deleted
+ https://bugs.webkit.org/show_bug.cgi?id=43437
+
+ Removed extractAndNegateTextDecorationStyle because we never push down text decorations added by CSS rules
+ as discussed on the bug 27809. Also removed pushDownTextDecorationStyleAtBoundaries because it only existed
+ to encapsulate the complexity of calling pushDownTextDecorationStyleAroundNode first with forceNegate = false
+ (calling pushDownTextDecorationStyleAroundNode) and again with forceNegate = true (calling extractAndNegateTextDecorationStyle)
+ after updating layout but neither the layout update nor the second call to pushDownTextDecorationStyleAroundNode
+ is needed after the removal of extractAndNegateTextDecorationStyle.
+
+ Also replaced maxRangeOffset by lastOffsetForEditing as FIXME (added by r48235) indicated.
+
+ No new tests added since this is a clean up.
+
+ * editing/ApplyStyleCommand.cpp:
+ (WebCore::ApplyStyleCommand::pushDownTextDecorationStyleAroundNode): No longer takes forceNegate as an argument.
+ (WebCore::ApplyStyleCommand::removeInlineStyle): Calls pushDownTextDecorationStyleAroundNode directly.
+ * editing/ApplyStyleCommand.h:
+
+2010-08-03 Ryosuke Niwa <rniwa at webkit.org>
+
Reviewed by Ojan Vafai.
Extract a function that serializes nodes from the range version of createMarkup
diff --git a/WebCore/editing/ApplyStyleCommand.cpp b/WebCore/editing/ApplyStyleCommand.cpp
index d865468..6fa1f71 100644
--- a/WebCore/editing/ApplyStyleCommand.cpp
+++ b/WebCore/editing/ApplyStyleCommand.cpp
@@ -1385,31 +1385,6 @@ PassRefPtr<CSSMutableStyleDeclaration> ApplyStyleCommand::extractTextDecorationS
return textDecorationStyle.release();
}
-PassRefPtr<CSSMutableStyleDeclaration> ApplyStyleCommand::extractAndNegateTextDecorationStyle(Node* node)
-{
- ASSERT(node);
- ASSERT(node->isElementNode());
-
- // non-html elements not handled yet
- if (!node->isHTMLElement())
- return 0;
-
- RefPtr<CSSComputedStyleDeclaration> nodeStyle = computedStyle(node);
- ASSERT(nodeStyle);
-
- int properties[1] = { CSSPropertyTextDecoration };
- RefPtr<CSSMutableStyleDeclaration> textDecorationStyle = nodeStyle->copyPropertiesInSet(properties, 1);
-
- RefPtr<CSSValue> property = nodeStyle->getPropertyCSSValue(CSSPropertyTextDecoration);
- if (property && !equalIgnoringCase(property->cssText(), "none")) {
- RefPtr<CSSMutableStyleDeclaration> newStyle = textDecorationStyle->copy();
- newStyle->setProperty(CSSPropertyTextDecoration, "none");
- applyTextDecorationStyle(node, newStyle.get());
- }
-
- return textDecorationStyle.release();
-}
-
void ApplyStyleCommand::applyTextDecorationStyle(Node *node, CSSMutableStyleDeclaration *style)
{
ASSERT(node);
@@ -1443,7 +1418,7 @@ void ApplyStyleCommand::applyTextDecorationStyle(Node *node, CSSMutableStyleDecl
surroundNodeRangeWithElement(node, node, createHTMLElement(document(), sTag));
}
-void ApplyStyleCommand::pushDownTextDecorationStyleAroundNode(Node* targetNode, bool forceNegate)
+void ApplyStyleCommand::pushDownTextDecorationStyleAroundNode(Node* targetNode)
{
ASSERT(targetNode);
Node* highestAncestor = highestAncestorWithTextDecoration(targetNode);
@@ -1455,7 +1430,7 @@ void ApplyStyleCommand::pushDownTextDecorationStyleAroundNode(Node* targetNode,
while (current != targetNode) {
ASSERT(current);
ASSERT(current->contains(targetNode));
- RefPtr<CSSMutableStyleDeclaration> decoration = forceNegate ? extractAndNegateTextDecorationStyle(current) : extractTextDecorationStyle(current);
+ RefPtr<CSSMutableStyleDeclaration> decoration = extractTextDecorationStyle(current);
// The inner loop will go through children on each level
Node* child = current->firstChild();
@@ -1476,34 +1451,6 @@ void ApplyStyleCommand::pushDownTextDecorationStyleAroundNode(Node* targetNode,
}
}
-void ApplyStyleCommand::pushDownTextDecorationStyleAtBoundaries(const Position &start, const Position &end)
-{
- // We need to work in two passes. First we push down any inline
- // styles that set text decoration. Then we look for any remaining
- // styles (caused by stylesheets) and explicitly negate text
- // decoration while pushing down.
-
- pushDownTextDecorationStyleAroundNode(start.node(), false);
- updateLayout();
- pushDownTextDecorationStyleAroundNode(start.node(), true);
-
- pushDownTextDecorationStyleAroundNode(end.node(), false);
- updateLayout();
- pushDownTextDecorationStyleAroundNode(end.node(), true);
-}
-
-// FIXME: Why does this exist? Callers should either use lastOffsetForEditing or lastOffsetInNode
-static int maxRangeOffset(Node *n)
-{
- if (n->offsetInCharacters())
- return n->maxCharacterOffset();
-
- if (n->isElementNode())
- return n->childNodeCount();
-
- return 1;
-}
-
void ApplyStyleCommand::removeInlineStyle(PassRefPtr<CSSMutableStyleDeclaration> style, const Position &start, const Position &end)
{
ASSERT(start.isNotNull());
@@ -1515,7 +1462,8 @@ void ApplyStyleCommand::removeInlineStyle(PassRefPtr<CSSMutableStyleDeclaration>
RefPtr<CSSValue> textDecorationSpecialProperty = style->getPropertyCSSValue(CSSPropertyWebkitTextDecorationsInEffect);
if (textDecorationSpecialProperty) {
- pushDownTextDecorationStyleAtBoundaries(start.downstream(), end.upstream());
+ pushDownTextDecorationStyleAroundNode(start.downstream().node());
+ pushDownTextDecorationStyleAroundNode(end.upstream().node());
style = style->copy();
style->setProperty(CSSPropertyTextDecoration, textDecorationSpecialProperty->cssText(), style->getPropertyPriority(CSSPropertyWebkitTextDecorationsInEffect));
}
@@ -1545,8 +1493,8 @@ void ApplyStyleCommand::removeInlineStyle(PassRefPtr<CSSMutableStyleDeclaration>
// Since elem must have been fully selected, and it is at the end
// of the selection, it is clear we can set the new e offset to
// the max range offset of prev.
- ASSERT(e.deprecatedEditingOffset() >= maxRangeOffset(e.node()));
- e = Position(prev, maxRangeOffset(prev));
+ ASSERT(e.deprecatedEditingOffset() >= lastOffsetForEditing(e.node()));
+ e = Position(prev, lastOffsetForEditing(prev));
}
}
}
diff --git a/WebCore/editing/ApplyStyleCommand.h b/WebCore/editing/ApplyStyleCommand.h
index 0aa8110..cc20721 100644
--- a/WebCore/editing/ApplyStyleCommand.h
+++ b/WebCore/editing/ApplyStyleCommand.h
@@ -82,11 +82,9 @@ private:
bool nodeFullySelected(Node*, const Position& start, const Position& end) const;
bool nodeFullyUnselected(Node*, const Position& start, const Position& end) const;
PassRefPtr<CSSMutableStyleDeclaration> extractTextDecorationStyle(Node*);
- PassRefPtr<CSSMutableStyleDeclaration> extractAndNegateTextDecorationStyle(Node*);
void applyTextDecorationStyle(Node*, CSSMutableStyleDeclaration *style);
- void pushDownTextDecorationStyleAroundNode(Node*, bool forceNegate);
- void pushDownTextDecorationStyleAtBoundaries(const Position& start, const Position& end);
-
+ void pushDownTextDecorationStyleAroundNode(Node*);
+
// style-application helpers
void applyBlockStyle(CSSMutableStyleDeclaration*);
void applyRelativeFontStyleChange(CSSMutableStyleDeclaration*);
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list