Bug 141465 - Div having contentEditable and display:grid cannot be edited if it is empty.
Summary: Div having contentEditable and display:grid cannot be edited if it is empty.
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: ChangSeok Oh
URL:
Keywords:
Depends on: 141647
Blocks:
  Show dependency treegraph
 
Reported: 2015-02-11 00:15 PST by ChangSeok Oh
Modified: 2021-07-03 02:17 PDT (History)
12 users (show)

See Also:


Attachments
Patch (6.41 KB, patch)
2015-02-12 12:50 PST, ChangSeok Oh
rniwa: review+
svillar: commit-queue-
Details | Formatted Diff | Diff
Patch (6.43 KB, patch)
2015-02-13 07:44 PST, ChangSeok Oh
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description ChangSeok Oh 2015-02-11 00:15:52 PST
This will fix a similar issue with Bug 141218, the only difference from 141218 is that a div has display:grid.
Comment 1 ChangSeok Oh 2015-02-11 00:23:21 PST
Manuel Rego Casasnovas said :
>> Source/WebCore/dom/Position.cpp:939
>> +    if (is<RenderBlockFlow>(*renderer) || is<RenderFlexibleBox>(*renderer)) {

>I think this is going to be failing for grid too. Maybe you could use here !renderer->isRenderBlockFlow() to cover both cases.

>Also adding a test case for grid would be nice. :-)

>Mmmm, I've just realized that this won't make any sense. I'm wondering if we should just add is<RenderGrid> or if this "if" is actually needed for something else.

>Anyway, this is failing in grid too.
Comment 2 Manuel Rego Casasnovas 2015-02-11 01:20:04 PST
Just to give you more information. There're some of these bugs that are both in flex and grid, mostly because of they're not RenderBlockFlow.

In some cases, we need some special methods to check that they're not RenderBlockFlow but they're not buttons either (as RenderButton, like RenderFullScreen) inherit from RenderFlexibleBox.

For example take a look to this method:
http://trac.webkit.org/browser/trunk/Source/WebCore/rendering/RenderBlock.cpp#L2927
Comment 3 ChangSeok Oh 2015-02-12 11:56:19 PST
(In reply to comment #2)
> Just to give you more information. There're some of these bugs that are both
> in flex and grid, mostly because of they're not RenderBlockFlow.
> 
> In some cases, we need some special methods to check that they're not
> RenderBlockFlow but they're not buttons either (as RenderButton, like
> RenderFullScreen) inherit from RenderFlexibleBox.
> 
> For example take a look to this method:
> http://trac.webkit.org/browser/trunk/Source/WebCore/rendering/RenderBlock.
> cpp#L2927

Thanks for the comment. But I'm not sure if I understand your intention correctly. Why do we need to check that? As my understanding any element can be editable with the contenteditable attribute. https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Content_Editable
Actually I checked RenderFullScreen is allowed to edit in firefox.
Could you provide me a sample which should not be allowed to edit even though it has a contenteditable attribute?
I think just adding is<RenderGrid>(*renderer) is enough there? (Of course more touches are required to make grid work properly for this case.)
Comment 4 ChangSeok Oh 2015-02-12 12:50:33 PST
Created attachment 246469 [details]
Patch
Comment 5 Manuel Rego Casasnovas 2015-02-13 00:56:54 PST
(In reply to comment #3)
> (In reply to comment #2)
> > Just to give you more information. There're some of these bugs that are both
> > in flex and grid, mostly because of they're not RenderBlockFlow.
> > 
> > In some cases, we need some special methods to check that they're not
> > RenderBlockFlow but they're not buttons either (as RenderButton, like
> > RenderFullScreen) inherit from RenderFlexibleBox.
> > 
> > For example take a look to this method:
> > http://trac.webkit.org/browser/trunk/Source/WebCore/rendering/RenderBlock.
> > cpp#L2927
> 
> Thanks for the comment. But I'm not sure if I understand your intention
> correctly. Why do we need to check that? As my understanding any element can
> be editable with the contenteditable attribute.
> https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Content_Editable
> Actually I checked RenderFullScreen is allowed to edit in firefox.
> Could you provide me a sample which should not be allowed to edit even
> though it has a contenteditable attribute?
> I think just adding is<RenderGrid>(*renderer) is enough there? (Of course
> more touches are required to make grid work properly for this case.)

Sorry for the misleading comment. I was not thinking about editable or not, just about how we usually detect in other parts of the code that a renderer is a flex or a grid. We usually use that kind of methods, as flex and grid don't inherit from RenderBlockFlow. However, sometimes we need that buttons, full-screen and other that inherit from RenderFlexibleBox behave like a RenderBlockFlow and we've this kind of special method.
Anyway you can forget about my comment, sorry for the noise.
Comment 6 Sergio Villar Senin 2015-02-13 00:58:33 PST
Comment on attachment 246469 [details]
Patch

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

> Source/WebCore/ChangeLog:8
> +        This bug is qutie similar with webkit.org/b/141218. RenderGrid should be also treated as a candidate

qutie -> quite

similar with -> similar to

> Source/WebCore/ChangeLog:11
> +        a minimum height of a single line if it is editable as well as RenderFlexibleBox does.

Where is this specified?

> LayoutTests/fast/events/key-events-in-editable-gridbox.html:7
> +        display: grid;

No need for the unprefixed version.
Comment 7 Sergio Villar Senin 2015-02-13 01:23:46 PST
Comment on attachment 246469 [details]
Patch

Setting cq- while we wait for clarifications.
Comment 8 ChangSeok Oh 2015-02-13 07:29:32 PST
Comment on attachment 246469 [details]
Patch

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

Thanks for the review guys! Let me update the patch soon. =)

>> Source/WebCore/ChangeLog:8
>> +        This bug is qutie similar with webkit.org/b/141218. RenderGrid should be also treated as a candidate
> 
> qutie -> quite
> 
> similar with -> similar to

Oops thanks.

>> Source/WebCore/ChangeLog:11
>> +        a minimum height of a single line if it is editable as well as RenderFlexibleBox does.
> 
> Where is this specified?

http://trac.webkit.org/browser/trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp#L707

>> LayoutTests/fast/events/key-events-in-editable-gridbox.html:7
>> +        display: grid;
> 
> No need for the unprefixed version.

O.K Removed. BTW doesn't webkit have a plan to remove the --webkit- prefix in the future?
Comment 9 ChangSeok Oh 2015-02-13 07:44:52 PST
Created attachment 246525 [details]
Patch
Comment 10 WebKit Commit Bot 2015-02-13 09:15:57 PST
Comment on attachment 246525 [details]
Patch

Clearing flags on attachment: 246525

Committed r180050: <http://trac.webkit.org/changeset/180050>
Comment 11 Csaba Osztrogonác 2015-02-16 08:09:56 PST
(In reply to comment #10)
> Comment on attachment 246525 [details]
> Patch
> 
> Clearing flags on attachment: 246525
> 
> Committed r180050: <http://trac.webkit.org/changeset/180050>

It broke the !ENABLE(CSS_GRID_LAYOUT) build - new bug report: bug141647
Comment 12 Sergio Villar Senin 2015-10-01 08:20:08 PDT
Closing this as it landed some time ago.