1. convert all CSS classes to inner styles
2. convert all inner styles to CSS classes
3. optimize CSS classes
4. transform CSS to stylesheet extension XWiki Object
5. send this object to server
6. use/demand the stylesheet extension object in current page
Step 1 is necessary because it's much easier to convert styles in CSS classes (step2) and to optimize CSS classes (step 3) when there are no (previously generated) CSS classes to interfere with.
Steps 5 and 6 imply that current editing page is published, and code for these steps will be outside LocalToWebStyleFilter.
Step 4 will probably be outside the filter, too.