Bug 90017 - [Meta] [Shadow] contenteditable attribute for distributed nodes.
Summary: [Meta] [Shadow] contenteditable attribute for distributed nodes.
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: HTML Editing (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on: 90197 90434 90661
Blocks: 82697
  Show dependency treegraph
 
Reported: 2012-06-26 14:57 PDT by Hayato Ito
Modified: 2012-10-16 09:23 PDT (History)
12 users (show)

See Also:


Attachments
WIP (5.41 KB, patch)
2012-08-30 00:53 PDT, Takashi Sakamoto
no flags Details | Formatted Diff | Diff
Patch (5.45 KB, patch)
2012-08-30 19:54 PDT, Takashi Sakamoto
no flags Details | Formatted Diff | Diff
Patch (5.44 KB, patch)
2012-10-14 23:50 PDT, Takashi Sakamoto
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Hayato Ito 2012-06-26 14:57:05 PDT
This meta bug tracks all issues related to 'contenteditable' attribute for distributed nodes in Shadow DOM, including but not limited to:

- Should a contenteditable attribute of shadow host propagate to distributed nodes?
  - See: https://www.w3.org/Bugs/Public/show_bug.cgi?id=17608
- How to implement an inheritance of 'contenteditable' for distributed ndoes.
  - We might need to modify how to inherit a '-user-modify' CSS property.
  - We need to figure out how style is resolved for distributed nodes. We might need to tweak Style::inheritFrom()

Let me add details later.
Comment 1 Hayato Ito 2012-07-02 00:19:04 PDT
I guess style resolving does not work for distributed nodes. Maybe a cache is wrongly used for distributed nodes in resolving style. We might need to file another bug to fix style issues for distributed nodes.
Comment 2 Takashi Sakamoto 2012-08-30 00:53:02 PDT
Created attachment 161419 [details]
WIP
Comment 3 Takashi Sakamoto 2012-08-30 19:54:25 PDT
Created attachment 161609 [details]
Patch
Comment 4 Dimitri Glazkov (Google) 2012-09-07 11:10:45 PDT
Comment on attachment 161609 [details]
Patch

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

> Source/WebCore/css/StyleResolver.cpp:1783
> +    if (m_distributedToInsertionPoint) {

This seems like an odd place for this code. Should this not be in StyleResolver::applyProperty?
Comment 5 Ryosuke Niwa 2012-09-13 15:34:10 PDT
Comment on attachment 161609 [details]
Patch

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

> Source/WebCore/css/StyleResolver.cpp:1786
> +        m_style->setUserModify(element->parentElement()->renderStyle()->userModify());

This looks fishy to me. So distributed nodes don't inherit any style but -webkit-user-modify?
Comment 6 Takashi Sakamoto 2012-09-25 02:13:42 PDT
Comment on attachment 161609 [details]
Patch

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

Thank you for reviewing.

>> Source/WebCore/css/StyleResolver.cpp:1783
>> +    if (m_distributedToInsertionPoint) {
> 
> This seems like an odd place for this code. Should this not be in StyleResolver::applyProperty?

In StyleResolver::applyProperty, I found that "case CSSPropertyWebkitUserModify:" is "ASSERT_NOT_REACHED();"
So did you mean StyleBuilder.cpp? i.e. adding a new class, e.g. ApplyPropertyUserModify and implementing an original applyInheritValue?

>> Source/WebCore/css/StyleResolver.cpp:1786
>> +        m_style->setUserModify(element->parentElement()->renderStyle()->userModify());
> 
> This looks fishy to me. So distributed nodes don't inherit any style but -webkit-user-modify?

Distributed nodes inherit styles except -webkit-user-modify from their rendering and style parents, because m_style->inheritFrom(m_parentStyle) has been already executed.
The code is for overriding -webkit-user-modify values by using shadow hosts' values.
Comment 7 Dimitri Glazkov (Google) 2012-09-25 09:02:50 PDT
Comment on attachment 161609 [details]
Patch

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

>>> Source/WebCore/css/StyleResolver.cpp:1783
>>> +    if (m_distributedToInsertionPoint) {
>> 
>> This seems like an odd place for this code. Should this not be in StyleResolver::applyProperty?
> 
> In StyleResolver::applyProperty, I found that "case CSSPropertyWebkitUserModify:" is "ASSERT_NOT_REACHED();"
> So did you mean StyleBuilder.cpp? i.e. adding a new class, e.g. ApplyPropertyUserModify and implementing an original applyInheritValue?

Yep, that seems like the more logical approach.
Comment 8 Takashi Sakamoto 2012-09-27 02:21:14 PDT
Comment on attachment 161609 [details]
Patch

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

>>>> Source/WebCore/css/StyleResolver.cpp:1783
>>>> +    if (m_distributedToInsertionPoint) {
>>> 
>>> This seems like an odd place for this code. Should this not be in StyleResolver::applyProperty?
>> 
>> In StyleResolver::applyProperty, I found that "case CSSPropertyWebkitUserModify:" is "ASSERT_NOT_REACHED();"
>> So did you mean StyleBuilder.cpp? i.e. adding a new class, e.g. ApplyPropertyUserModify and implementing an original applyInheritValue?
> 
> Yep, that seems like the more logical approach.

I think, applyProperty will be invoked when an element has some matched properties, i.e. suppose that A is a distributed node and there exists "<style>A { -webkit-user-modify: inherit }</style>" or something. I think, this is another issue to be discussed.
The issue I would like to fix in this bug is, for example,

    <host> --------- (SR)
         |           |
         +---- <A>    +---<div>
                           |
                           +---<content> (or <shadow>)

(<host content-editable>
    <#shadow-root><div><content /></div></#shadow-root>
    <A></A>
 </host>) 

A has no matched styles related to -webkit-user-modify.
The host is "content-editable". <div> is not "content-editable".
A's style is inherited from <div>'s style, because A's parentNodeForStyle is <div>.

A should be content-editable or not?

So this patch makes A content-editable.
Comment 9 Dimitri Glazkov (Google) 2012-09-27 11:04:58 PDT
Comment on attachment 161609 [details]
Patch

I understand now.
Comment 10 Takashi Sakamoto 2012-10-14 23:50:45 PDT
Created attachment 168633 [details]
Patch
Comment 11 WebKit Review Bot 2012-10-16 09:23:48 PDT
Comment on attachment 168633 [details]
Patch

Clearing flags on attachment: 168633

Committed r131464: <http://trac.webkit.org/changeset/131464>
Comment 12 WebKit Review Bot 2012-10-16 09:23:53 PDT
All reviewed patches have been landed.  Closing bug.