Uploaded image for project: 'MyFaces Trinidad'
  1. MyFaces Trinidad
  2. TRINIDAD-1561

compressed style class map can yield corrupted css file

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 1.2.13-core
    • Skinning
    • None

    Description

      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
      instead of
      .x10 .AFFoo

      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: Color value is invalid

      7. You should see a compressed style instead of a blank '.'
      .xd0 .AFFoo

      color: Color value is invalid

      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
      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()

      Attachments

        Activity

          People

            jeanne.waldman@oracle.com Jeanne Waldman
            jeanne.waldman@oracle.com Jeanne Waldman
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: