RESOLVED FIXED 120623
[CSS Background] Position property should be ignored when using repeat: space
https://bugs.webkit.org/show_bug.cgi?id=120623
Summary [CSS Background] Position property should be ignored when using repeat: space
Andrei Parvu
Reported 2013-09-03 02:07:26 PDT
As the spec [1] says, background/mask-position property should be ignored when using repeat: space, if there are at least two copies of the image on a direction. If there is not enough space for two copies, only one should be drawn, and background/mask-position should determine its position. [1] - http://www.w3.org/TR/css3-background/#the-background-repeat
Attachments
Patch (7.53 KB, patch)
2013-09-03 02:19 PDT, Andrei Parvu
no flags
Patch (7.63 KB, patch)
2013-09-03 07:04 PDT, Andrei Parvu
no flags
Patch (8.01 KB, patch)
2013-09-03 23:31 PDT, Andrei Parvu
no flags
Andrei Parvu
Comment 1 2013-09-03 02:19:52 PDT
Dirk Schulze
Comment 2 2013-09-03 05:26:39 PDT
Comment on attachment 210338 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=210338&action=review > Source/WebCore/ChangeLog:7 > + The background/mask-position should be ignored when using repeat: space, if there are > + at least two copies of the image in one direction. The last part of the sentence is confusing. I needed to read the spec again to understand what you mean. Maybe just quite the spec :) > Source/WebCore/rendering/RenderBoxModelObject.cpp:1358 > + backgroundRepeatX = NoRepeatFill; Doesn't that affect computed style? The spec is just speaking about visual differences.
Andrei Parvu
Comment 3 2013-09-03 06:52:30 PDT
> > > Source/WebCore/rendering/RenderBoxModelObject.cpp:1358 > > + backgroundRepeatX = NoRepeatFill; > > Doesn't that affect computed style? The spec is just speaking about visual differences. backgroundRepeatX is a local variable, it doesn't affect he computed style.
Andrei Parvu
Comment 4 2013-09-03 07:04:41 PDT
Andrei Parvu
Comment 5 2013-09-03 07:05:18 PDT
(In reply to comment #4) > Created an attachment (id=210370) [details] > Patch Modified the description in the change log.
Dirk Schulze
Comment 6 2013-09-03 08:27:38 PDT
Comment on attachment 210370 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=210370&action=review > Source/WebCore/rendering/RenderBoxModelObject.cpp:1353 > + if (space) { You are not checking for positive as suggested in the ChangeLog, but for zero. Negtative values would still enter the code path. > Source/WebCore/rendering/RenderBoxModelObject.cpp:1358 > + geometry.setSpaceSize(FloatSize(space, 0)); > + geometry.setPhaseX(actualWidth ? actualWidth - roundToInt(computedXPosition + left) % actualWidth : 0); > + } else > + backgroundRepeatX = NoRepeatFill; To be honest, I do not understand the code path good enough. I would have assumed that you check how many tiles fit into the paint area. If it is less than two... disable spacing and use background-position instead. Maybe the code path does it, but I don't see it. Can you elaborate more please?
Andrei Parvu
Comment 7 2013-09-03 23:31:14 PDT
Andrei Parvu
Comment 8 2013-09-03 23:36:40 PDT
(In reply to comment #6) > (From update of attachment 210370 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=210370&action=review > > > Source/WebCore/rendering/RenderBoxModelObject.cpp:1353 > > + if (space) { > > You are not checking for positive as suggested in the ChangeLog, but for zero. Negtative values would still enter the code path. > > > Source/WebCore/rendering/RenderBoxModelObject.cpp:1358 > > + geometry.setSpaceSize(FloatSize(space, 0)); > > + geometry.setPhaseX(actualWidth ? actualWidth - roundToInt(computedXPosition + left) % actualWidth : 0); > > + } else > > + backgroundRepeatX = NoRepeatFill; > > To be honest, I do not understand the code path good enough. I would have assumed that you check how many tiles fit into the paint area. If it is less than two... disable spacing and use background-position instead. Maybe the code path does it, but I don't see it. Can you elaborate more please? getSpace() now returns -1 if the number of tiles is less than two; in this case the repeat of the image is set as NoRepeatFill. If space is greater or equal to zero, then the value of background/mask-position is ignored when computing 'computedX/YPosition'.
Dirk Schulze
Comment 9 2013-09-17 14:39:29 PDT
Comment on attachment 210432 [details] Patch r=me
Andrei Parvu
Comment 10 2013-09-17 23:54:47 PDT
(In reply to comment #9) > (From update of attachment 210432 [details]) > r=me Thanks for the review. Could you also commit the patch?
WebKit Commit Bot
Comment 11 2013-09-19 07:40:32 PDT
Comment on attachment 210432 [details] Patch Clearing flags on attachment: 210432 Committed r156097: <http://trac.webkit.org/changeset/156097>
WebKit Commit Bot
Comment 12 2013-09-19 07:40:35 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.