Bug 142003 - HTMLElement::collectStyleForPresentationAttribute duplicates a lot of code for contentEditableAttr
Summary: HTMLElement::collectStyleForPresentationAttribute duplicates a lot of code fo...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Ryosuke Niwa
URL:
Keywords:
Depends on:
Blocks: 129034
  Show dependency treegraph
 
Reported: 2015-02-24 21:08 PST by Ryosuke Niwa
Modified: 2015-02-25 10:42 PST (History)
7 users (show)

See Also:


Attachments
Cleanup (3.99 KB, patch)
2015-02-24 21:10 PST, Ryosuke Niwa
no flags Details | Formatted Diff | Diff
Updated per Ben's comment (5.39 KB, patch)
2015-02-25 02:28 PST, Ryosuke Niwa
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ryosuke Niwa 2015-02-24 21:08:30 PST
Don't duplicate code!
Comment 1 Ryosuke Niwa 2015-02-24 21:10:42 PST
Created attachment 247309 [details]
Cleanup
Comment 2 Benjamin Poulain 2015-02-25 00:37:29 PST
Comment on attachment 247309 [details]
Cleanup

View in context: https://bugs.webkit.org/attachment.cgi?id=247309&action=review

Honestly I would prefer this with new tests. I would be surprised if we have good coverage for the changes in WordWrap, NbspMode and LineBreak. I bet the tests only check for the behavior of UserModify.

> Source/WebCore/html/HTMLElement.cpp:170
> +static CSSValueID contentEditableValueToUserModifyValue(const AtomicString& value)

I think it would be better to base that off "ContentEditableType" with a switch().

Otherwise the tests are duplicated.
Comment 3 Ryosuke Niwa 2015-02-25 00:50:14 PST
Comment on attachment 247309 [details]
Cleanup

Thanks for the review!
Comment 4 Ryosuke Niwa 2015-02-25 00:50:53 PST
Comment on attachment 247309 [details]
Cleanup

Oh oops, missed the comments.
Comment 5 Ryosuke Niwa 2015-02-25 00:53:53 PST
Comment on attachment 247309 [details]
Cleanup

View in context: https://bugs.webkit.org/attachment.cgi?id=247309&action=review

>> Source/WebCore/html/HTMLElement.cpp:170
>> +static CSSValueID contentEditableValueToUserModifyValue(const AtomicString& value)
> 
> I think it would be better to base that off "ContentEditableType" with a switch().
> 
> Otherwise the tests are duplicated.

You mean adding a new enum type? Or you're talking about EUserModify, which has three values?
Comment 6 Benjamin Poulain 2015-02-25 00:56:19 PST
(In reply to comment #5)
> Comment on attachment 247309 [details]
> Cleanup
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=247309&action=review
> 
> >> Source/WebCore/html/HTMLElement.cpp:170
> >> +static CSSValueID contentEditableValueToUserModifyValue(const AtomicString& value)
> > 
> > I think it would be better to base that off "ContentEditableType" with a switch().
> > 
> > Otherwise the tests are duplicated.
> 
> You mean adding a new enum type? Or you're talking about EUserModify, which
> has three values?

I have added "enum class ContentEditableType" in HTMLElement to solve some styling problems.

I think that *may* have everything you need.
Comment 7 Ryosuke Niwa 2015-02-25 01:59:19 PST
(In reply to comment #6)
> (In reply to comment #5)
> > Comment on attachment 247309 [details]
> > Cleanup
> > 
> > View in context:
> > https://bugs.webkit.org/attachment.cgi?id=247309&action=review
> > 
> > >> Source/WebCore/html/HTMLElement.cpp:170
> > >> +static CSSValueID contentEditableValueToUserModifyValue(const AtomicString& value)
> > > 
> > > I think it would be better to base that off "ContentEditableType" with a switch().
> > > 
> > > Otherwise the tests are duplicated.
> > 
> > You mean adding a new enum type? Or you're talking about EUserModify, which
> > has three values?
> 
> I have added "enum class ContentEditableType" in HTMLElement to solve some
> styling problems.
> 
> I think that *may* have everything you need.

Yes, indeed. Uploading a new patch...
Comment 8 Ryosuke Niwa 2015-02-25 02:28:14 PST
Created attachment 247326 [details]
Updated per Ben's comment
Comment 9 WebKit Commit Bot 2015-02-25 10:42:22 PST
Comment on attachment 247326 [details]
Updated per Ben's comment

Clearing flags on attachment: 247326

Committed r180631: <http://trac.webkit.org/changeset/180631>
Comment 10 WebKit Commit Bot 2015-02-25 10:42:26 PST
All reviewed patches have been landed.  Closing bug.