Commit graph

25 commits

Author SHA1 Message Date
Bartosz Dziewoński
4c01f8b2bc Make "/*@noflip*/ /*@embed*/" annotation work without CSSJanus hacks
This reverts most of commit 2d842f1425,
leaving only the test added in it, and reimplements the same
functionality better.

Instead of stripping /*@noflip*/ annotations in CSSJanus, which is
incompatible with other implementations that preserve it, extend
CSSMin to allow other CSS comments to be present before the
rule-global @embed annotation. (This required making the regex logic
in it even worse than it was, but it's actually slightly less terrible
than I expected it would be. Good thing we have tests!)

Bug: 69698
Change-Id: I58603ef64f7d7cdc6461b34721a4d6b15f15ad79
2014-09-23 22:47:54 +00:00
Timo Tijhof
bb5709241e CSSJanus: Add Apache license header
Follows-up f9e8d61 which removed the Python library and its copy
of the Apache license file.

Change-Id: Ic3ed4a2fb935e713916cb8eb6ba1673839f40532
2014-09-20 17:21:53 -07:00
Bartosz Dziewoński
2d842f1425 Make "/*@noflip*/ /*@embed*/" annotation work
To do it, just remove /*@noflip*/ annotations in CSSJanus after
we're done processing. They are not needed anymore and some obscure
interactions with CSSMin logic for preserving comments caused
`/*@noflip*/ /*@embed*/ background-image: url(…)` not to work
correctly (it would not be embedded).

This also requires us to always do CSSJanus processing, even when we
don't need flipping, to consistently handle the annotations.
I'm not entirely sure if this is worth it, but I still greatly prefer
doing it to documenting this stupid limitation. :)

Bug: 69698
Change-Id: I311b12b08b2dff9d45efb584db08cf4a11318f59
2014-08-18 17:40:51 +02:00
Shahyar
923ad97b3a Correct shadow flipping in CSSJanus
Was incorrectly assuming values between -1 and 1 were 0
Fixes an issue with mw-ui-input class in RTL mode which
makes use of box shadow.

Change-Id: I13e52467721bc2534e0a7c5245e3380ac43736ef
2014-07-30 23:14:32 +00:00
Siebrand Mazeland
9ef0e8bb84 Pass phpcs-strict on includes/libs/CSSJanus.php
Change-Id: I184a419a225d5503c5b72909bd69624eba690b0e
2014-04-24 21:46:54 +02:00
Roan Kattouw
e5096f2500 CSSJanus: Account for attribute selectors in brace lookahead
Recognize selectors of the forms [attr=val], [attr*=val], [attr~=val]
and [attr^=val], optionally with single-quoted values.

Because these selectors previously weren't recognized, trying to
apply /* @noflip */ to one of them would be recognized as a
single-property noflip rather than a rule-wide noflip, and so only
the first property in the rule would be noflipped.

The (simplified) input that triggered this bug was:

/* @noflip */ figure[typeof*='mw:Image'].mw-halign-left { clear: left; float: left; }

which became { clear: left; float: right; } when run through CSSJanus.

See also I4cddce80397d8 which is a workaround for this issue

Bug: 50910
Change-Id: If424a1df26bb7a5a18cee4b0318b029392528fc0
2014-02-08 00:43:52 +00:00
jenkins-bot
edba2e008c Merge "CSSJanus: Support text-shadow and box-shadow flipping" 2013-09-27 20:35:16 +00:00
Ebrahim Byagowi
bda65740a8 Tweak CSSJanus to support noflip for selectors with parentheses
Also suggested for CSSJanus itself at http://code.google.com/p/cssjanus/issues/detail?id=22

Change-Id: I4e3b21522e9c5a72cd456ed3d6a0be9225e4b70d
2013-07-19 11:53:27 -07:00
MatmaRex
511273dca1 CSSJanus: Support text-shadow and box-shadow flipping
We just need to negate the horizontal offset value in both of them.

This only supports *a single shadow* per element; multiple shadows
are not supported (only the first will be flipped).

Second attempt. First, reverted one: I14822955.

Bug: 45677
Change-Id: I97ee7431e1a5acb35d594076a88a0f9acf290402
2013-07-17 20:30:24 +02:00
MatmaRex
ad6d2e43d5 CSSJanus: Handle values of border-radius correctly
The values are not "top right bottom left" here, but
"top-left top-right bottom-right bottom-left".

Bug: 49074
Change-Id: I22bc777b59e667aeb36727fdc8e41e8681979128
2013-07-17 12:47:10 +02:00
MatmaRex
b5984db716 CSSJanus: Fix handling of CSS3 color syntaxes
The 'color' rule, and by extension 'four_notation_color' too,
only understood #rrggbb and named colors. Extend it to match
rgb[a](...) and hsl[a](...) syntaxes as well.

This makes usage of rgb(a)/hsl(a) syntax in declarations like
'border-color: a b c d;' be interpreted and flipped correctly.

Change-Id: I218a9aa55a86b3d955b92375c1a209fdde312138
2013-07-04 05:30:26 +02:00
MatmaRex
3eaad66d63 CSSJanus: don't mangle 5+ consecutive numeric values
Don't mangle 5+ consecutive numeric values in the
'four_notation_quantity' and 'four_notation_color' rules. This
prevents box-shadow rules from being utterly broken in RTL (but still
doesn't flip them properly).

Bug: 45677
Change-Id: I16cb9e171a79c6f299b40fa02908b0c045e3c474
2013-06-06 17:29:51 +02:00
Tyler Anthony Romeo
4dcc7961df Fixed @param tags to conform with Doxygen format.
Doxygen expects parameter types to come before the
parameter name in @param tags. Used a quick regex
to switch everything around where possible. This
only fixes cases where a primitve variable (or a
primitive followed by other types) is the variable
type. Other cases will need to be fixed manually.

Change-Id: Ic59fd20856eb0489d70f3469a56ebce0efb3db13
2013-03-11 13:15:01 -04:00
Krinkle
d86c886ac6 Revert "(bug 45677) CSSJanus: support text-shadow and box-shadow flipping"
See I5d24c7d8456e2. This is a wontfix per Trevor and myself.

This reverts commit e457d804eb

Change-Id: I886a078cbeedd5a742e9c6dfedc9bd718bab089c
2013-03-07 06:19:26 +00:00
MatmaRex
e457d804eb (bug 45677) CSSJanus: support text-shadow and box-shadow flipping
We just need to negate the horizontal offset value in both of them.

This only supports *a single shadow* per element; multiple shadows
are not supported (only the first will be flipped).

Also, to make it possible:
* don't mangle 5+ consecutive numeric values in the
  'four_notation_quantity' rule
* support rgb(a) and hsl(a) colors in the 'color' rule

Change-Id: I148229558e1b9a0516e413ffe86007235c3c3ef8
2013-03-05 20:42:52 +01:00
Tim Landscheidt
ce034ac430 Do not flip partial keys in CSSJanus.
Change-Id: I1ee9d16069c4627aa81024eeb642714ef796cec5
2013-01-23 07:57:07 +00:00
Catrope
e4fbf314fe Work around preg_replace_callback() issue in CSSJanus
As reported in bug 38294, CSSJanus returns an empty string for some
input. This seems to be caused by preg_replace_callback() returning
null which, according to the PHP docs, happens "in case of error". Of
course there's no way to figure out what the error was :S

Work around this by checking for a null return value

Change-Id: I5db952bc32f73b94ac13e449d9aa1f8693602dbd
2012-08-28 12:35:27 -07:00
Alexandre Emsenhuber
63176b99b7 Added missing GPLv2 headers in some places.
Also made file/class documentation more consistent.

Change-Id: I1deb70318d01a257b51948ba806d80cd1a239f4f
2012-05-04 08:47:07 +02:00
Sam Reed
7b25f8231f Fixing some of the "@return true" or "@return false", need to be "@return bool" and then the metadata can say true if foo, false if bar
Other documentation improvements
2012-02-09 19:30:01 +00:00
Roan Kattouw
2d3862484c Fix bug in CSSJanus where background-position and background-position-x weren't flipped if negative values were given. Trevor found this by running the original CSSJanus test suite against his NodeJS port; I should port the test suite to PHPUnit some time 2012-02-02 16:31:42 +00:00
Sam Reed
4622da783c More documentation! 2011-10-26 04:15:09 +00:00
Roan Kattouw
11e642cab5 Clarify dual-licensing (GPL&Apache) of CSSJanus. Has no significant contributions (i.e. changes other than very minor whitespace and Doxygen changes) by anyone other than me. 2011-07-31 01:32:19 +00:00
Alexandre Emsenhuber
6aed2bff14 Fixed some doxygen warnings 2010-09-21 20:11:40 +00:00
Roan Kattouw
ba57fb3810 (bug 25042) CSSJanus does not flip direction: rules outside of body { } selectors 2010-09-10 13:08:54 +00:00
Trevor Parscal
c5aa835502 Moved stand-alone libraries to includes/libs. 2010-09-09 19:57:11 +00:00
Renamed from includes/CSSJanus.php (Browse further)