Bug 199843

Summary: [SVG2]: Add auto behavior for rx and ry to the SVG <ellipse> and <rect> elements
Product: WebKit Reporter: Said Abou-Hallawa <sabouhallawa>
Component: SVGAssignee: Said Abou-Hallawa <sabouhallawa>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, darin, dbates, dino, esprehn+autocc, ews-watchlist, fmalita, glenn, gyuyoung.kim, joepeck, koivisto, kondapallykalyan, macpherson, menard, pdr, rniwa, schenney, sergio, simon.fraser, webkit-bug-importer, zimmermann
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on: 201663    
Bug Blocks: 191292, 200143    
Attachments:
Description Flags
Patch
none
Patch
none
Patch
none
Patch none

Said Abou-Hallawa
Reported 2019-07-16 16:37:52 PDT
Specs: https://www.w3.org/TR/SVG/geometry.html#RX Test case: <svg xmlns="http://www.w3.org/2000/svg"> <ellipse style="rx: auto;" ry="30" cx="50" cy="50" fill="none" stroke="blue" stroke-width="5"/> </svg>
Attachments
Patch (24.84 KB, patch)
2019-09-18 09:57 PDT, Said Abou-Hallawa
no flags
Patch (25.00 KB, patch)
2019-09-18 11:13 PDT, Said Abou-Hallawa
no flags
Patch (25.07 KB, patch)
2019-09-19 10:48 PDT, Said Abou-Hallawa
no flags
Patch (1.78 KB, patch)
2019-09-20 08:49 PDT, Said Abou-Hallawa
no flags
Said Abou-Hallawa
Comment 3 2019-09-18 09:57:59 PDT
Nikolas Zimmermann
Comment 4 2019-09-18 10:05:48 PDT
Comment on attachment 379046 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=379046&action=review Nice tests, thanks Said. > LayoutTests/ChangeLog:3 > + [SVG2]: Add auto behavior for rx and ry to the SVG <ellipse> and<rect> elements and<rect> -> and <rect> > LayoutTests/ChangeLog:8 > + Skip the tests with dynmaic chnages till webkit.org/b/201918 is fixed. typo: dynamic changes. Maybe add one sentence regarding the new tests?
Said Abou-Hallawa
Comment 5 2019-09-18 11:13:45 PDT
Said Abou-Hallawa
Comment 6 2019-09-18 11:19:11 PDT
Comment on attachment 379046 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=379046&action=review >> LayoutTests/ChangeLog:3 >> + [SVG2]: Add auto behavior for rx and ry to the SVG <ellipse> and<rect> elements > > and<rect> -> and <rect> Fixed. I just realized the space key in my keyboard is malfunctioning. It got stuck many times while typing this comment. >> LayoutTests/ChangeLog:8 >> + Skip the tests with dynmaic chnages till webkit.org/b/201918 is fixed. > > typo: dynamic changes. > Maybe add one sentence regarding the new tests? The typo is fixed and comments were added regarding the new tests.
Nikolas Zimmermann
Comment 7 2019-09-18 11:23:41 PDT
Comment on attachment 379050 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=379050&action=review Sorry, just found another typo :/ For me the code changes look just fine. > Source/WebCore/ChangeLog:8 > + The sepcs is: https://www.w3.org/TR/SVG2/geometry.html#RxProperty. sepcs, spec :-) > Source/WebCore/ChangeLog:11 > + parse LengthOrAuto for these properties. Handle the case if one of them s/these /these /
Simon Fraser (smfr)
Comment 8 2019-09-19 02:54:49 PDT
Comment on attachment 379050 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=379050&action=review > Source/WebCore/rendering/svg/RenderSVGEllipse.cpp:92 > + Length rx = style().svgStyle().rx().isAuto() ? style().svgStyle().ry() : style().svgStyle().rx(); Maybe avoid reading style().svgStyle().rx() twice. Length rx = style().svgStyle().rx(); if (rx.isAuto() rx = style().svgStyle().ry();
Said Abou-Hallawa
Comment 9 2019-09-19 10:48:24 PDT
WebKit Commit Bot
Comment 10 2019-09-19 13:51:33 PDT
The commit-queue encountered the following flaky tests while processing attachment 379147 [details]: imported/w3c/web-platform-tests/websockets/bufferedAmount-unchanged-by-sync-xhr.any.worker.html bug 202003 (author: youennf@gmail.com) The commit-queue is continuing to process your patch.
WebKit Commit Bot
Comment 11 2019-09-19 13:52:36 PDT
Comment on attachment 379147 [details] Patch Clearing flags on attachment: 379147 Committed r250103: <https://trac.webkit.org/changeset/250103>
WebKit Commit Bot
Comment 12 2019-09-19 13:52:39 PDT
All reviewed patches have been landed. Closing bug.
Radar WebKit Bug Importer
Comment 13 2019-09-19 13:53:16 PDT
Darin Adler
Comment 14 2019-09-19 17:55:57 PDT
Comment on attachment 379147 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=379147&action=review > Source/WebCore/rendering/svg/RenderSVGEllipse.cpp:98 > + Length rx = style().svgStyle().rx(); > + if (rx.isAuto()) > + rx = style().svgStyle().ry(); > + > + Length ry = style().svgStyle().ry(); > + if (ry.isAuto()) > + ry = style().svgStyle().rx(); How about this alternative version? Length rx = style().svgStyle().rx(); Length ry = style().svgStyle().ry(); if (rx.isAuto()) rx = ry; else if (ry.isAuto()) ry = rx;
Said Abou-Hallawa
Comment 15 2019-09-19 18:25:42 PDT
Comment on attachment 379147 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=379147&action=review >> Source/WebCore/rendering/svg/RenderSVGEllipse.cpp:98 >> + ry = style().svgStyle().rx(); > > How about this alternative version? > > Length rx = style().svgStyle().rx(); > Length ry = style().svgStyle().ry(); > if (rx.isAuto()) > rx = ry; > else if (ry.isAuto()) > ry = rx; I agree. -- In the worst case scenario, which happens when rx and ry are both 'auto', my solution will calculate rx/ry four times. It will also call the Length::operator==() four times. -- Your solution will calculate rx/ry two times and will call Length::operator==() three times. -- How about this? Length rx = style().svgStyle().rx(); Length ry = style().svgStyle().ry(); m_radii = FloatSize( lengthContext.valueForLength(rx.isAuto() ? ry : rx, SVGLengthMode::Width), lengthContext.valueForLength(ry.isAuto() ? rx : ry, SVGLengthMode::Height)); This will calculate rx/ry two times and will call Length::operator==() two times.
Said Abou-Hallawa
Comment 16 2019-09-20 08:49:43 PDT
Reopening to attach new patch.
Said Abou-Hallawa
Comment 17 2019-09-20 08:49:44 PDT
WebKit Commit Bot
Comment 18 2019-09-20 13:30:40 PDT
Comment on attachment 379243 [details] Patch Clearing flags on attachment: 379243 Committed r250147: <https://trac.webkit.org/changeset/250147>
WebKit Commit Bot
Comment 19 2019-09-20 13:30:42 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.