Title: [134096] trunk
- Revision
- 134096
- Author
- rn...@webkit.org
- Date
- 2012-11-09 12:10:31 -0800 (Fri, 09 Nov 2012)
Log Message
RemoveFormat command doesn't remove background color
https://bugs.webkit.org/show_bug.cgi?id=101682
Reviewed by Tony Chang.
Source/WebCore:
Fixed the bug by removing all non-transparent background-color properties.
Test: editing/execCommand/remove-format-background-color.html
* editing/RemoveFormatCommand.cpp:
(WebCore::RemoveFormatCommand::doApply):
LayoutTests:
Added a regression test.
* editing/execCommand/remove-format-background-color-expected.txt: Added.
* editing/execCommand/remove-format-background-color.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (134095 => 134096)
--- trunk/LayoutTests/ChangeLog 2012-11-09 19:55:06 UTC (rev 134095)
+++ trunk/LayoutTests/ChangeLog 2012-11-09 20:10:31 UTC (rev 134096)
@@ -1,3 +1,15 @@
+2012-11-08 Ryosuke Niwa <rn...@webkit.org>
+
+ RemoveFormat command doesn't remove background color
+ https://bugs.webkit.org/show_bug.cgi?id=101682
+
+ Reviewed by Tony Chang.
+
+ Added a regression test.
+
+ * editing/execCommand/remove-format-background-color-expected.txt: Added.
+ * editing/execCommand/remove-format-background-color.html: Added.
+
2012-11-09 Zan Dobersek <zandober...@gmail.com>
Unreviewed GTK gardening.
Added: trunk/LayoutTests/editing/execCommand/remove-format-background-color-expected.txt (0 => 134096)
--- trunk/LayoutTests/editing/execCommand/remove-format-background-color-expected.txt (rev 0)
+++ trunk/LayoutTests/editing/execCommand/remove-format-background-color-expected.txt 2012-11-09 20:10:31 UTC (rev 134096)
@@ -0,0 +1,4 @@
+This tests removing format on text that has background color. There should be no span or inline style below:
+| "<#selection-anchor>hello "
+| "world"
+| " WebKit.<#selection-focus>"
Added: trunk/LayoutTests/editing/execCommand/remove-format-background-color.html (0 => 134096)
--- trunk/LayoutTests/editing/execCommand/remove-format-background-color.html (rev 0)
+++ trunk/LayoutTests/editing/execCommand/remove-format-background-color.html 2012-11-09 20:10:31 UTC (rev 134096)
@@ -0,0 +1,22 @@
+<!DOCTYPE html>
+<html>
+<body>
+<p id="description">This tests removing format on text that has background color. There should be no span or inline style below:</p>
+<div id="editor" contenteditable>hello <span style="color: black; background-color: #ff0000;">world</span> WebKit.</div>
+<script type="text/_javascript_" src=""
+<script type="text/_javascript_">
+
+if (window.testRunner)
+ testRunner.dumpAsText();
+
+var editor = document.getElementById('editor');
+editor.focus();
+document.execCommand('SelectAll', false, null);
+document.execCommand('RemoveFormat', false, null);
+
+Markup.description(document.getElementById('description').textContent);
+Markup.dump(editor);
+
+</script>
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (134095 => 134096)
--- trunk/Source/WebCore/ChangeLog 2012-11-09 19:55:06 UTC (rev 134095)
+++ trunk/Source/WebCore/ChangeLog 2012-11-09 20:10:31 UTC (rev 134096)
@@ -1,3 +1,17 @@
+2012-11-08 Ryosuke Niwa <rn...@webkit.org>
+
+ RemoveFormat command doesn't remove background color
+ https://bugs.webkit.org/show_bug.cgi?id=101682
+
+ Reviewed by Tony Chang.
+
+ Fixed the bug by removing all non-transparent background-color properties.
+
+ Test: editing/execCommand/remove-format-background-color.html
+
+ * editing/RemoveFormatCommand.cpp:
+ (WebCore::RemoveFormatCommand::doApply):
+
2012-11-09 Alec Flett <alecfl...@chromium.org>
IndexedDB: switch frontend to use int64_t-based references
Modified: trunk/Source/WebCore/editing/RemoveFormatCommand.cpp (134095 => 134096)
--- trunk/Source/WebCore/editing/RemoveFormatCommand.cpp 2012-11-09 19:55:06 UTC (rev 134095)
+++ trunk/Source/WebCore/editing/RemoveFormatCommand.cpp 2012-11-09 20:10:31 UTC (rev 134096)
@@ -28,6 +28,7 @@
#include "RemoveFormatCommand.h"
#include "ApplyStyleCommand.h"
+#include "CSSValueKeywords.h"
#include "EditingStyle.h"
#include "Element.h"
#include "Frame.h"
@@ -87,6 +88,10 @@
Node* root = frame->selection()->rootEditableElement();
RefPtr<EditingStyle> defaultStyle = EditingStyle::create(root);
+ // We want to remove everything but transparent background.
+ // FIXME: We shouldn't access style().
+ defaultStyle->style()->setProperty(CSSPropertyBackgroundColor, CSSValueTransparent);
+
applyCommandToComposite(ApplyStyleCommand::create(document(), defaultStyle.get(), isElementForRemoveFormatCommand, editingAction()));
}
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes