
SVG changes color when rotated in Safari 10 - einaregilsson
http://stackoverflow.com/questions/39637347/svg-changes-color-when-rotated-in-safari-10
======
unwind
I love the comment from the OP, saying he's "figured out how it happens", and
it turns out the R and B color components are swapped for some rotational
angles.

That's clearly explained, then. :)

I don't suppose Safari has a public bug tracker? This sounds like such an
awesome "WTF" it'd be fun to read the developers' take. :)

~~~
einaregilsson
OP here. "How it happens" is not "why it happens". The svg renderer is
switching the values of R and B, that's why it turns blue instead of some
other color. Why the renderer does that, I have no idea :)

~~~
nathan-wall
So #ff0000 becomes #0000ff. What about #f00000? Does it become #00000f or
#0000f0? Does #00f000 stay the same or become a darker green?

Sorry, I would check myself, but am on Linux and don't have access to Safari
10.

------
einaregilsson
A user on my site ran into this while playing Go Fish. He was pretty surprised
to see this:
[https://dl.dropboxusercontent.com/u/6430877/screenshot.png](https://dl.dropboxusercontent.com/u/6430877/screenshot.png)

------
Tloewald
The interesting takeaway from this, in my opinion, is that modern browsers
offer three fairly independent rendering paths (perhaps more): vanilla, 2d CSS
transform, and 3D CSS transform. A project I worked on had a truly bizarre
chrome-only intermittent rendering bug that we could not figure out for
months. I eventually "fixed" it by adding a null (translate by zero or
whatever) CSS 3D transform at the root of each affected element (sending
everything down a different rendering path) and the problem went away.

~~~
nathancahill
Yes, using 3D CSS transform is a common performance optimization. 3D enables
hardware acceleration.

------
draw_down
I saw something like this in Safari 9. Super annoying. The workaround I
discovered was that it stopped happening if the opacity wasn't 1. So I set it
to 0.99.

------
distantsounds
I don't see this behaviour in Safari 10 either but I am but one of many users.

------
jstsch
Also when scaling, not just when rotating. Take a look at this one in H5mag
(top-right hamburger turns blue occasionally when resizing the window):
[http://jouwlater.h5mag.com/denken_en_doen/cover](http://jouwlater.h5mag.com/denken_en_doen/cover)

------
0x0
Is this the same bug?
[https://bugs.webkit.org/show_bug.cgi?id=150142](https://bugs.webkit.org/show_bug.cgi?id=150142)

------
robotmlg
I'm using the latest Safari Tech Preview, and the example works fine for me.
Maybe this is already fixed.

~~~
einaregilsson
Probably. I'm using 10.0 (11602.1.50.0.10), which is what I got when I
upgraded through the App Store this morning.

------
__BrianDGLS__
It doesn't change color for me in safari 10. Is this a joke?

~~~
coldtea
No, a joke is like "Why did the chicken cross the road? To get to the other
side".

This makes so little sense as a joke, and there are tons of reasons why it
would work for some and not others and still be a bug...

~~~
sdegutis
I never understood that joke. Is it supposed to be an anti-joke? That's the
only way it makes any sense as a joke. And if so, why is it one of the first
jokes we hear as children?

~~~
coldtea
> _I never understood that joke. Is it supposed to be an anti-joke? That 's
> the only way it makes any sense as a joke._

It's just a joke based on going against the listener's common expectations --
like almost all jokes.

They expect a specific intent for crossing the road -- and having something to
do with the fact that the being doing the crossing is a chicken, but instead
they get the obvious and most immediate and base reason for anybody crossing a
road.

~~~
sdegutis
Right, that's what makes it an anti-joke. Anti jokes can be funny. Just, it's
weird that it's one of the first jokes we're introduced to growing up, because
it's not a typical or even basic kind of joke.

~~~
logfromblammo
It's the introductory example of an anti-joke in the culture's humor-teaching
curriculum.

A lot of the jokes that we tell kids are actually teaching them the basics of
what is considered funny in our culture. Much of it demonstrates how to
establish a pattern or preconception, then break or subvert it for the desired
comedic effect.

For instance, you can't tell "banana-banana-orange" or "interrupting cow" as
your first knock-knock joke, because you first have to establish the pattern
of a "proper" knock-knock joke.

After the chicken crosses the road, you tell some shaggy dog stories, then you
hit them with the never-ending setup, where the joke is in how long you can
get them to listen to your pointless rambling while waiting for a punchline
that never comes.

------
pmiller2
Doesn't work for me on iOS 9 mobile Safari.

