Opened 14 years ago
Closed 12 years ago
#16461 closed task (blessed) (fixed)
CSS3 gradient replacements for images and rework existing
Reported by: | cyberskull | Owned by: | ocean90 |
---|---|---|---|
Milestone: | 3.5 | Priority: | normal |
Severity: | normal | Version: | 3.1 |
Component: | Performance | Keywords: | has-patch |
Focuses: | Cc: |
Description
I've created a patch that replaces the images used in colors-classic.dev.css with the correct CSS3 gradients understood by WebKit, Gecko et al.
It sets up the gradients with a fallback to the image if the gradient is not understood, thus it will still look pretty with IE or other browsers that don't understand gradients.
Other work done is a small amount of code cleanup, just a bit of housekeeping.
Tested in Firefox 3.6.13, Safari 5.0.3, WebKit Nightly, Opera 10.63 on Mac OS X 10.5 PPC. It all worked ok for me.
Attachments (7)
Change History (55)
#3
@
14 years ago
- Keywords ui-feedback added
- Milestone changed from Awaiting Review to Future Release
#4
follow-up:
↓ 5
@
14 years ago
We'd also want to do this in colors-fresh. Ideally the files should be pretty closely synced.
#5
in reply to:
↑ 4
@
14 years ago
Replying to nacin:
We'd also want to do this in colors-fresh. Ideally the files should be pretty closely synced.
That is easy enough to do. I've made the CSS-equivalent gradients for almost all the gradient images in wp-admin/images
. From there it's just a matter of copy and paste.
If I do that, do I submit them in a separate ticket?
#6
follow-up:
↓ 7
@
14 years ago
- Summary changed from CSS gradient replacements for images in colors-classic to CSS gradient replacements for images in colors stylesheets
Here is fine. We're indeed looking to replace gradient images with CSS gradients.
#7
in reply to:
↑ 6
@
14 years ago
Replying to nacin:
Here is fine. We're indeed looking to replace gradient images with CSS gradients.
OK. I have attached a file with what is hopefully all the gradient images used in wp-admin/images
replaced with CSS. Please inform me if I missed anything. ;)
#10
@
13 years ago
- Component changed from Administration to Performance
Surprisingly, patch still applies cleanly.
@cyberskull: please make patches relative to the wp root directory, not relative to wp-admin/css/ etc.
#12
follow-up:
↓ 13
@
13 years ago
We should remove them. I have read an article that some browsers will load the image too, which will be no positive perfomance, but I can't find the article anymore.
#13
in reply to:
↑ 12
@
13 years ago
Replying to ocean90:
We should remove them. I have read an article that some browsers will load the image too, which will be no positive perfomance, but I can't find the article anymore.
That behavior is being phased out, at least in WebKit. So no need to worry.
#14
@
13 years ago
- Cc jane added
- Keywords needs-refresh ui-feedback added; has-patch removed
- Summary changed from CSS gradient replacements for images in colors stylesheets to CSS3 gradient replacements for images and rework existing
I want to use this ticket to rework all existing CSS3 gradients to support more browsers (see #17222) and to have one standard code for all gradients.
So their are two questions:
- Do we want the filter code for the IE < 9?
- Should the image still be there as fallback or is a color, like we did for the admin bar, enough?
#15
follow-up:
↓ 17
@
13 years ago
- Keywords dev-feedback added
My suggestion based on http://ie.microsoft.com/testdrive/Graphics/CSSGradientBackgroundMaker/
background-color: #xxx; /* Fallback */ background-image: -ms-linear-gradient(...); /* IE10 */ background-image: -moz-linear-gradient(...); /* Firefox */ background-image: -o-linear-gradient(...); /* Opera */ background-image: -webkit-gradient(...); /* old Webkit */ background-image: -webkit-linear-gradient(...); /* new Webkit */
#17
in reply to:
↑ 15
@
13 years ago
Replying to ocean90:
+1 from me too. Perhaps we can also add the standard CSS3 property at the end. Was thinking: didn't CSS3 offer a way to define a style property once and then use a reference to it? Not sure if that's supported in any browser yet (or maybe it was dropped).
#19
follow-up:
↓ 21
@
13 years ago
+1 and I'd be happy to see the fallback be a color rather than an image. Getting rid of images also fits with the "make 3.2 faster" mantra.
Personally I'd like to see the proposed standard in there too (background-image: linear-gradient(...);
), but I honestly have a hard time justifying it since as far as I know no browser currently supports it.
#21
in reply to:
↑ 19
@
13 years ago
Replying to aaroncampbell:
Personally I'd like to see the proposed standard in there too (
background-image: linear-gradient(...);
), but I honestly have a hard time justifying it since as far as I know no browser currently supports it.
True, but that makes it more futureproof. When we introduced border-radius
none of the browsers supported the proposed standard, now some of the latest browsers support it (and won't work without it like Opera 11).
#22
@
13 years ago
The patch I submited doesn't have the -o
or -ms
versions (as Opera only announced the feature a week or two after I submitted it). As for the -ms
, I can toss it in. The prefixless version is included in the patch.
I always include the standard version when I do CSS coding, as then I don't have to re-edit the CSS when it is adopted by someone. The only times I change the standard version is to match what I am doing in the others or if the standard was revised.
I'll update the patch this week to include the prefixes for all the major layout engines then.
I have a question, is there a consensus on whether to keep the images or not?
#23
@
13 years ago
- Keywords ui-feedback dev-feedback removed
There is already no image in the head, footer, login head and admin bar, so get rid from the other images too.
#16726 has a patch for the admin bar with the new code for gradients.
#24
@
13 years ago
16461.complete.patch and 16461_login.patch include now my proposed standard (complemented with the proposed W3C Markup).
Removing the images is harmful for plugins which uses core images.
#25
@
13 years ago
The images that would be removed should not be used by plugins directly. They should just use the 'button' class etc.
#27
@
13 years ago
I'm definitely for removing the images. If we don't use them we might as well shrink the package site. Like scribu said, people should be using the css classes not the images directly.
#28
@
13 years ago
- Milestone changed from 3.2 to Future Release
Past freeze. UI style update hit some of this along way. Will punt instead of close so can review anything else that can be improved here in 3.3.
#30
@
13 years ago
editor menu: #17720 (has patch)
btw. it it possible to make arrows with css, so we could replace this:
http://core.trac.wordpress.org/browser/trunk/wp-admin/images/menu-arrow-frame.png?rev=17871
example of imageless arrow:
http://helpdesk.wpseo.de/
#33
follow-up:
↓ 34
@
13 years ago
Related: #19233
Quote by duck:
Per http://dev.w3.org/csswg/css3-images/#linear-gradient-syntax should the "proposed W3C Markup" rule use "to top"?
#34
in reply to:
↑ 33
@
13 years ago
Replying to ocean90:
Related: #19233
Quote by duck:
Per http://dev.w3.org/csswg/css3-images/#linear-gradient-syntax should the "proposed W3C Markup" rule use "to top"?
I am personally against using that syntax. More syntax means it will be more prone to breaking.
#37
@
12 years ago
- Keywords 3.5-early commit added
- Milestone changed from 3.4 to Future Release
Let's do this 3.5-early. Looks good.
#38
@
12 years ago
- Milestone changed from Future Release to 3.5
It's time for this one. Is 16461.complete.patch everything, and ready to go?
We should be mindful to keep any images for which plugins may have a legitimate use.
#39
@
12 years ago
- Keywords needs-refresh added
Patch needs a pretty serious refresh. Would also like to see prefixed properties use the "koop-shiny" method of spacing from now on.
#40
@
12 years ago
#43
follow-up:
↓ 44
@
12 years ago
After a chat with helenyhou and sabreuse our prefred syntax is:
.grad-to-top { background: #fff; background-image: -webkit-gradient(linear, left top, left bottom, from(#fff), to(#000)); background-image: -webkit-linear-gradient(top, #fff, #000); background-image: -moz-linear-gradient(top, #fff, #000); background-image: -o-linear-gradient(top, #fff, #000); background-image: linear-gradient(to bottom, #fff, #000); } .grad-to-bottom { background: #fff; background-image: -webkit-gradient(linear, left bottom, left top, from(#fff), to(#000)); background-image: -webkit-linear-gradient(bottom, #fff, #000); background-image: -moz-linear-gradient(bottom, #fff, #000); background-image: -o-linear-gradient(bottom, #fff, #000); background-image: linear-gradient(to top, #fff, #000); } .grad-to-bottom-with-color-stops { background: #fff; background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0, #fff), color-stop(1, #000)); background-image: -webkit-linear-gradient(bottom, #fff 0%, #000 100%); background-image: -moz-linear-gradient(bottom, #fff 0%, #000 100%); background-image: -o-linear-gradient(bottom, #fff 0%, #000 100%); background-image: linear-gradient(to top, #fff 0%, #000 100%); }
References:
- developer.apple.com/library/safari/#documentation/…
- https://developer.mozilla.org/en/CSS/-moz-linear-gradient
- http://blogs.msdn.com/b/ie/archive/2012/06/25/unprefixed-css3-gradients-in-ie10.aspx
- https://developer.mozilla.org/en/CSS/-moz-linear-gradient#Browser_compatibility
- http://make.wordpress.org/core/handbook/coding-standards/css/#property-ordering
- http://www.css3files.com/gradient/
- http://dev.opera.com/articles/view/opera-mobile-emulator-experimental-webkit-prefix-support/#onlywebkit
#44
in reply to:
↑ 43
@
12 years ago
Replying to ocean90:
Small correction: seems that both the -moz- and -o- rules don't work...
Edit: disregard that :) Was just a typo in the above example.
#45
@
12 years ago
Small correction: seems that both the -moz- and -o- rules don't work...
Glad to see it was just a typo. However, for reference, I thought I'd post this link, short story: Opera is aliasing -webkit- to -o- prefixes in the next release, they've got a suggested casscade for the properties listed in the help document related to it, and strangely enough, they're suggesting using the same order as suggested above: http://dev.opera.com/articles/view/opera-mobile-emulator-experimental-webkit-prefix-support/#onlywebkit
#46
@
12 years ago
@azaozz: Oh, sry. thanks for fixing it.
@dd32: Thanks for the info and the link.
I think I get the patch ready by the end of the day.
#47
@
12 years ago
- Keywords needs-refresh removed
Gradients with 16461.patch.
Changed files:
- wp-includes/css/editor.dev.css
- wp-includes/css/admin-bar.dev.css
- wp-includes/css/wp-pointer.dev.css
- wp-admin/css/colors-classic.dev.css
- wp-admin/css/colors-fresh.dev.css
- wp-admin/css/install.dev.css
- wp-admin/css/wp-admin.dev.css
Obsolete images:
- wp-admin/images/blue-grad.png
- wp-admin/images/button-grad-active.png
- wp-admin/images/button-grad.png
- wp-admin/images/gray-grad.png
- wp-admin/images/white-grad-active.png
- wp-admin/images/white-grad.png
diff file of the changes to colors-classic.dev.css