[Webkit-unassigned] [Bug 108852] Web Inspector: Get array of used CSS colors on a page

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Feb 4 13:23:06 PST 2013


https://bugs.webkit.org/show_bug.cgi?id=108852





--- Comment #1 from Alexander Pavlov (apavlov) <apavlov at chromium.org>  2013-02-04 13:25:10 PST ---
Brian,

This is how I would tackle this problem:
1) Get all stylesheet headers for the page (see bug 105828, which is intended to add tracking of all stylesheets in the frontend, in which case this step will no longer be necessary) using CSSAgent.getAllStyleSheets()
2) Get all stylesheets' rules using CSSAgent.getStyleSheet() (or, alternatively, WebInspector.CSSStyleSheet.createForId())
3) Traverse rules' styles, check if each property can contain a color value (using WebInspector.CSSMetadata.isColorAwareProperty()). If yes, try to parse out a color and process appropriately.
4) Create a swatch using the collected data.

I suggest that you wait until bug 105828 is fixed before putting together the final version of your patch. That bug will introduce two events, StyleSheetAdded and StyleSheetRemoved (in addition to the existing StyleSheetChanged), so you will be able to keep the up-to-date stats on all the colors used.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


More information about the webkit-unassigned mailing list