[ 
https://issues.apache.org/jira/browse/TRINIDAD-1561?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Jeanne Waldman resolved TRINIDAD-1561.
--------------------------------------

       Resolution: Fixed
    Fix Version/s: 1.2.13-core 

Fixed in trunk. Will be fixed in 1.2.13 release (just missed getting into 
1.2.12)

> compressed style class map can yield corrupted css file
> -------------------------------------------------------
>
>                 Key: TRINIDAD-1561
>                 URL: https://issues.apache.org/jira/browse/TRINIDAD-1561
>             Project: MyFaces Trinidad
>          Issue Type: Bug
>          Components: Skinning
>            Reporter: Jeanne Waldman
>            Assignee: Jeanne Waldman
>             Fix For: 1.2.13-core 
>
>
> Overview:
> The compressed styleclass map stored in FileSystemStyleCache gets created 
> once based on the current StyleContext.
> If the StyleContext changes, it's possible that the css will get corrupted.
> You'll see something like
> . .AFFoo {color: black}
> instead of
> .x10 .AFFoo {color: black}
> This can lead to really strange skinning errors, and it has been hard to 
> track down in the past, but now I know what is going on.
> Steps to Reproduce:
> 1. Set skin-family in trinidad-config.xml to purple
> 2. In demo's purpleSkin.css add
> @agent ie
> {
>   af|panelLabelAndMessage .Foo {
>     -tr-rule-ref: selector(".AFPanelFormLayoutHorizontalPadding:alias");
>     -tr-rule-ref: selector(".AFStartTextAlign:alias");
>     vertical-align: top;
>     padding-top: 3px;
>     padding-bottom: 0px;
>     -tr-rule-ref: selector(".AFDefaultFontFamily:alias");
>     color: purple;
>     background-color: red;
>   }
>   
>   af|panelLabelAndMessage af|inputText::content {
>     background-color: yellow;
>   }
> }
> af|panelLabelAndMessage {}
> 3. Run in gecko
> 4. Then run in IE
> 5. In IE, view the generated css file
> 6. At the end you will see something like: 
> . .AFFoo{color: purple; background-color: red; etc.}
> 7. You should see a compressed style instead of a blank '.'
> .xd0 .AFFoo {color: purple; background-color: red; etc}
> Details:
> All this happens in FileSystemStyleCache:
> 1. We get the styleSheetDocument - ALL selectors in the skinning file
> 2. We get the shortenedStyleMap using the styleSheetDocument pared down for
> the specific StyleContext (gecko, for example)
> 3. There is an optimization to use "" as the shortened key if the style
> selector has no properties
> e.g., af|bar{} as opposed to af|bar{color:black}
> 4. Now when we switch to another context (internet explorer from gecko, or a 
> different locale), we are using the original shortenedStyleMap
> which had "" for af|barsince for gecko there was no styling
> 5. BUT for the new context, af|bar has styling.
> 6. We do not render af|bar on the dom element (bug)
> 7. We render '.' in the css, so you see something like . .AFFoo
> {blah blah blah} (bug)
> Fix:
> The fix is to simply create the compressed styleclass map using all styles, 
> not just the styles that match the StyleContext. Then even if we switch the 
> context, the styleclass will be in the map.
> This is a one line fix.
> In _getShortStyleClassMap change
> document.getStyleSheets(context); to
> document.getStyleSheets()

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to