Bug 125108 - [CSS Shapes] Implement interpolation between keywords in basic shapes
Summary: [CSS Shapes] Implement interpolation between keywords in basic shapes
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Rob Buis
URL:
Keywords:
Depends on: 126072
Blocks: 124173
  Show dependency treegraph
 
Reported: 2013-12-02 14:56 PST by Bem Jones-Bey
Modified: 2014-03-04 14:46 PST (History)
10 users (show)

See Also:


Attachments
Patch (6.92 KB, patch)
2013-12-06 12:06 PST, Rob Buis
no flags Details | Formatted Diff | Diff
Patch (6.68 KB, patch)
2013-12-09 13:32 PST, Rob Buis
no flags Details | Formatted Diff | Diff
Patch (15.12 KB, patch)
2013-12-16 11:33 PST, Rob Buis
no flags Details | Formatted Diff | Diff
Patch (31.17 KB, patch)
2013-12-17 14:10 PST, Rob Buis
no flags Details | Formatted Diff | Diff
Patch (31.16 KB, patch)
2013-12-17 14:51 PST, Rob Buis
simon.fraser: review+
simon.fraser: commit-queue-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Bem Jones-Bey 2013-12-02 14:56:41 PST
It isn't specified by in the spec, but it should be possible to come up with a reasonable interpolation behavior anyways.
Comment 1 Rob Buis 2013-12-06 12:06:50 PST
Created attachment 218610 [details]
Patch
Comment 2 Dirk Schulze 2013-12-06 12:13:09 PST
Comment on attachment 218610 [details]
Patch

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

> Source/WebCore/rendering/style/BasicShapes.cpp:137
> +    return (radius().canBlend(otherCircle->radius())

the extra braces seem unnecessary.

> Source/WebCore/rendering/style/BasicShapes.h:71
> +        // FIXME: Support animations between different shapes in the future.
> +        return type() == other->type();

I wonder how you want to realize that with the current refactoring... It seems like interpolation between different kind of shapes gets less likely.
Comment 3 Rob Buis 2013-12-06 12:37:25 PST
(In reply to comment #2)
> (From update of attachment 218610 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=218610&action=review
> 
> > Source/WebCore/rendering/style/BasicShapes.cpp:137
> > +    return (radius().canBlend(otherCircle->radius())
> 
> the extra braces seem unnecessary.

Thanks.

> > Source/WebCore/rendering/style/BasicShapes.h:71
> > +        // FIXME: Support animations between different shapes in the future.
> > +        return type() == other->type();
> 
> I wonder how you want to realize that with the current refactoring... It seems like interpolation between different kind of shapes gets less likely.

I am not sure what you mean? Right now this fallback makes sense since we have depricated circle and ellipse. Once those are removed then this one could maybe become pure virtual. Ultimately each basic shape would have to decide if it can blend with "other".
Comment 4 Dirk Schulze 2013-12-06 12:47:38 PST
Comment on attachment 218610 [details]
Patch

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

> Source/WebCore/rendering/style/BasicShapes.cpp:215
> +    return (radiusX().canBlend(otherEllipse->radiusX())

Ditto. braces.

>>> Source/WebCore/rendering/style/BasicShapes.h:71
>>> +        return type() == other->type();
>> 
>> I wonder how you want to realize that with the current refactoring... It seems like interpolation between different kind of shapes gets less likely.
> 
> I am not sure what you mean? Right now this fallback makes sense since we have depricated circle and ellipse. Once those are removed then this one could maybe become pure virtual. Ultimately each basic shape would have to decide if it can blend with "other".

Exactly. I don't think that this makes it necessarily easier. It may blow up the source code because it is harder to share code.
Comment 5 Rob Buis 2013-12-06 13:08:54 PST
(In reply to comment #4)
> (From update of attachment 218610 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=218610&action=review
> 
> > Source/WebCore/rendering/style/BasicShapes.cpp:215
> > +    return (radiusX().canBlend(otherEllipse->radiusX())
> 
> Ditto. braces.
> 
> >>> Source/WebCore/rendering/style/BasicShapes.h:71
> >>> +        return type() == other->type();
> >> 
> >> I wonder how you want to realize that with the current refactoring... It seems like interpolation between different kind of shapes gets less likely.
> > 
> > I am not sure what you mean? Right now this fallback makes sense since we have depricated circle and ellipse. Once those are removed then this one could maybe become pure virtual. Ultimately each basic shape would have to decide if it can blend with "other".
> 
> Exactly. I don't think that this makes it necessarily easier. It may blow up the source code because it is harder to share code.

Never mind, it seems the patch is not needed, interpolation between different types of shapes is not in the spec anymore. I just got triggered by the existing comment:

FIXME: Support animations between different shapes in the future.
Comment 6 Dirk Schulze 2013-12-06 23:06:24 PST
(In reply to comment #5)
> (In reply to comment #4)
> > (From update of attachment 218610 [details] [details])
> > View in context: https://bugs.webkit.org/attachment.cgi?id=218610&action=review
> > 
> > > Source/WebCore/rendering/style/BasicShapes.cpp:215
> > > +    return (radiusX().canBlend(otherEllipse->radiusX())
> > 
> > Ditto. braces.
> > 
> > >>> Source/WebCore/rendering/style/BasicShapes.h:71
> > >>> +        return type() == other->type();
> > >> 
> > >> I wonder how you want to realize that with the current refactoring... It seems like interpolation between different kind of shapes gets less likely.
> > > 
> > > I am not sure what you mean? Right now this fallback makes sense since we have depricated circle and ellipse. Once those are removed then this one could maybe become pure virtual. Ultimately each basic shape would have to decide if it can blend with "other".
> > 
> > Exactly. I don't think that this makes it necessarily easier. It may blow up the source code because it is harder to share code.
> 
> Never mind, it seems the patch is not needed, interpolation between different types of shapes is not in the spec anymore. I just got triggered by the existing comment:
> 
> FIXME: Support animations between different shapes in the future.

Ah right... In this case... could you remove the FIXME please and take a look if there is more cleanup possible?
Comment 7 Rob Buis 2013-12-09 13:32:33 PST
Created attachment 218795 [details]
Patch
Comment 8 Dirk Schulze 2013-12-09 22:32:24 PST
Comment on attachment 218795 [details]
Patch

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

> Source/WebCore/ChangeLog:3
> +        [CSS Shapes] Implement interpolation between keywords in basic shapes

The patch looks fine for me and (on fixing a snippet) I would r+ it. However, could you open a new bug report for it? This one is not the right bug report for this fix.

I noticed that even the previous patch to not match the idea of this bug report. This bug report is about interpolation between things like circle(farthest-side) to circle(200px). So keyword to another keyword/value.

> LayoutTests/animations/resources/animation-test-helpers.js:227
>          matches = s.match("polygon\\(nonzero, (.*)\\s+(.*)\\s*,\\s*(.*)\\s+(.*)\\s*,\\s*(.*)\\s+(.*)\\s*,\\s*(.*)\\s+(.*)\\)");
> +        if (!matches)
> +            matches = s.match("polygon\\(evenodd, (.*)\\s+(.*)\\s*,\\s*(.*)\\s+(.*)\\s*,\\s*(.*)\\s+(.*)\\s*,\\s*(.*)\\s+(.*)\\)");

you should be able to use [...|...] instead of using an if, no?
Comment 9 Rob Buis 2013-12-10 07:13:28 PST
(In reply to comment #8)
> (From update of attachment 218795 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=218795&action=review
> 
> > Source/WebCore/ChangeLog:3
> > +        [CSS Shapes] Implement interpolation between keywords in basic shapes
> 
> The patch looks fine for me and (on fixing a snippet) I would r+ it. However, could you open a new bug report for it? This one is not the right bug report for this fix.
> 
> I noticed that even the previous patch to not match the idea of this bug report. This bug report is about interpolation between things like circle(farthest-side) to circle(200px). So keyword to another keyword/value.

Agreed, I created https://bugs.webkit.org/show_bug.cgi?id=125508 for this patch instead.

> > LayoutTests/animations/resources/animation-test-helpers.js:227
> >          matches = s.match("polygon\\(nonzero, (.*)\\s+(.*)\\s*,\\s*(.*)\\s+(.*)\\s*,\\s*(.*)\\s+(.*)\\s*,\\s*(.*)\\s+(.*)\\)");
> > +        if (!matches)
> > +            matches = s.match("polygon\\(evenodd, (.*)\\s+(.*)\\s*,\\s*(.*)\\s+(.*)\\s*,\\s*(.*)\\s+(.*)\\s*,\\s*(.*)\\s+(.*)\\)");
> 
> you should be able to use [...|...] instead of using an if, no?

Yes, initially I tried that but ran into problems. I took another look and the framework assumed all floats, that was the problem. In my new patch for 125508 I changed a framework a bit so it knows how to deal with shape polygon.
Comment 10 Rob Buis 2013-12-16 06:56:39 PST
Comment on attachment 218795 [details]
Patch

Oops, should have obsoleted once I made the new bug for this.
Comment 11 Rob Buis 2013-12-16 11:33:35 PST
Created attachment 219336 [details]
Patch
Comment 12 Bem Jones-Bey 2013-12-16 11:39:20 PST
Comment on attachment 219336 [details]
Patch

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

> Source/WebCore/ChangeLog:9
> +        Length values of 0% and 100%.

What about center coordinates specified like "top 50% bottom 10px"? It doesn't seem like you handle those in this patch, as those keywords can't be resolved until layout time.
Comment 13 Rob Buis 2013-12-17 13:27:45 PST
(In reply to comment #12)
> (From update of attachment 219336 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=219336&action=review
> 
> > Source/WebCore/ChangeLog:9
> > +        Length values of 0% and 100%.
> 
> What about center coordinates specified like "top 50% bottom 10px"? It doesn't seem like you handle those in this patch, as those keywords can't be resolved until layout time.

I failed to see that part of the spec before :) Will upload shortly a new patch that should be able to handle that.
Comment 14 Rob Buis 2013-12-17 14:10:07 PST
Created attachment 219451 [details]
Patch
Comment 15 WebKit Commit Bot 2013-12-17 14:12:07 PST
Attachment 219451 [details] did not pass style-queue:

Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'LayoutTests/ChangeLog', u'LayoutTests/fast/shapes/parsing/parsing-shape-inside-expected.txt', u'LayoutTests/fast/shapes/parsing/parsing-shape-outside-expected.txt', u'LayoutTests/fast/shapes/parsing/parsing-test-utils.js', u'LayoutTests/fast/shapes/shape-outside-floats/shape-outside-animation-expected.txt', u'LayoutTests/fast/shapes/shape-outside-floats/shape-outside-animation.html', u'Source/WebCore/ChangeLog', u'Source/WebCore/page/animation/CSSPropertyAnimation.cpp', u'Source/WebCore/rendering/style/BasicShapes.cpp', u'Source/WebCore/rendering/style/BasicShapes.h', '--commit-queue']" exit_code: 1
ERROR: Source/WebCore/rendering/style/BasicShapes.cpp:88:  Weird number of spaces at line-start.  Are you using a 4-space indent?  [whitespace/indent] [3]
Total errors found: 1 in 10 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 16 Rob Buis 2013-12-17 14:51:24 PST
Created attachment 219455 [details]
Patch
Comment 17 Bem Jones-Bey 2013-12-17 15:19:06 PST
Comment on attachment 219455 [details]
Patch

lgtm. :-)
Comment 18 Simon Fraser (smfr) 2013-12-17 17:10:55 PST
Comment on attachment 219455 [details]
Patch

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

> Source/WebCore/rendering/style/BasicShapes.cpp:76
> +FloatSize BasicShape::referenceBoxSize(RenderBox* renderer) const

RenderBox should be a reference if it cannot be null.
Comment 19 Rob Buis 2013-12-18 12:45:10 PST
Landed in r160770.
Comment 20 Rob Buis 2013-12-20 08:04:03 PST
Reopening this bug. There is a cleaning up patch I need to do and I think some of the shapes other than circle/ellipse need keyword interpolation too.
Comment 21 Dirk Schulze 2013-12-20 08:11:09 PST
(In reply to comment #20)
> Reopening this bug. There is a cleaning up patch I need to do and I think some of the shapes other than circle/ellipse need keyword interpolation too.

You may use this as master bug and upload the followups on a different bug report.
Comment 22 Bear Travis 2014-03-04 14:46:24 PST
Fixed with bug 127010 and further changes to the spec.