Bug 27476 - execCommand('underline' / 'strikeThrough') doesn't work properly with multiple styles in text-decoration
Summary: execCommand('underline' / 'strikeThrough') doesn't work properly with multipl...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: HTML Editing (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC All
: P2 Normal
Assignee: Ryosuke Niwa
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-07-20 18:43 PDT by Ryosuke Niwa
Modified: 2009-07-23 00:13 PDT (History)
3 users (show)

See Also:


Attachments
fixes the bug (20.42 KB, patch)
2009-07-22 11:45 PDT, Ryosuke Niwa
eric: review-
Details | Formatted Diff | Diff
2nd submission, no longer adds hasValue to CSSValueList (21.87 KB, patch)
2009-07-22 15:56 PDT, Ryosuke Niwa
eric: review-
Details | Formatted Diff | Diff
3rd submission, test for computed style is converted to a js test (24.04 KB, patch)
2009-07-22 18:12 PDT, Ryosuke Niwa
eric: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ryosuke Niwa 2009-07-20 18:43:52 PDT
execCommand('underline' / 'strikeThrough') results in text-decoration: underline / line-through, deleting all other text decorations even when more than one styles are specified.
Comment 1 Ryosuke Niwa 2009-07-22 11:45:49 PDT
Created attachment 33278 [details]
fixes the bug
Comment 2 Eric Seidel (no email) 2009-07-22 13:33:14 PDT
Comment on attachment 33278 [details]
fixes the bug

/CSSComputedStyleDeclaration.cpp change needs testing.
window.getComputedStyle(foo).getPropertyCSSValue('text-decoration')


   RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
 1055             RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
needs test too.
foo.style.textDecoration

 73 void CSSValueList::remove(CSSValue* val)
should be called removeFirst or removeAll or should at least be documented as to its behavior.

 78         if (m_values.at(index)->cssText() == val->cssText())

is really really sad.

consider adding a bool return to remove and then you don't need hasValue

 93 static bool applyCommandToFrame(Frame* frame, EditorCommandSource source, EditAction action, CSSMutableStyleDeclaration* style)
is a great change and could even be made in a separate patch.  it's OK to do in this one though.

YOu can just delete:
110116 static bool executeApplyStyle(Frame* frame, EditorCommandSource source, EditAction action, int propertyID, const char* propertyValue)

Spacing:
 130     Node* nodeToRemove=0;

This looks great!  We just need more tests!
Comment 3 Ryosuke Niwa 2009-07-22 15:56:51 PDT
Created attachment 33304 [details]
2nd submission, no longer adds hasValue to CSSValueList
Comment 4 Eric Seidel (no email) 2009-07-22 16:26:18 PDT
Comment on attachment 33304 [details]
2nd submission, no longer adds hasValue to CSSValueList

getComputedStyle/getComputedStyle-text-decoration.html shoudl be a js test (like how editing/execCommand/resources/toggle-text-decorations.js is).  Ping me if you need help converting it.

missing newline at EOF:
29 var successfullyParsed = true;
030 \ No newline at end of file

Would like to see the converted test. Otherwise this looks fine.
Comment 5 Ryosuke Niwa 2009-07-22 18:12:53 PDT
Created attachment 33308 [details]
3rd submission, test for computed style is converted to a js test
Comment 6 Eric Seidel (no email) 2009-07-22 18:29:34 PDT
Comment on attachment 33308 [details]
3rd submission, test for computed style is converted to a js test

Looks fine.
Comment 7 Ryosuke Niwa 2009-07-22 19:40:28 PDT
Landed in http://trac.webkit.org/changeset/46251