htmlunit-2.7

 Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.gargoylesoftware.htmlunit.javascript.host.css;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.w3c.css.sac.AttributeCondition;
import org.w3c.css.sac.CombinatorCondition;
import org.w3c.css.sac.Condition;
import org.w3c.css.sac.ConditionalSelector;
import org.w3c.css.sac.DescendantSelector;
import org.w3c.css.sac.ElementSelector;
import org.w3c.css.sac.Selector;
import org.w3c.css.sac.SiblingSelector;

class SelectorSpecificity
  implements Comparable<SelectorSpecificity>
{
  private static final Log LOG = LogFactory.getLog(SelectorSpecificity.class);
  public static final SelectorSpecificity FROM_STYLE_ATTRIBUTE = new SelectorSpecificity(1, 0, 0, 0);
  private int fieldA_;
  private int fieldB_;
  private int fieldC_;
  private int fieldD_;
  
  SelectorSpecificity(Selector selector)
  {
    readSelectorSpecificity(selector);
  }
  
  private SelectorSpecificity(int a, int b, int c, int d)
  {
    fieldA_ = a;
    fieldB_ = b;
    fieldC_ = c;
    fieldD_ = d;
  }
  
  void readSelectorSpecificity(Selector selector)
  {
    switch (selector.getSelectorType())
    {
    case 1: 
      return;
    case 10: 
      DescendantSelector ds = (DescendantSelector)selector;
      readSelectorSpecificity(ds.getAncestorSelector());
      readSelectorSpecificity(ds.getSimpleSelector());
      return;
    case 0: 
      ConditionalSelector conditional = (ConditionalSelector)selector;
      Condition condition = conditional.getCondition();
      readSelectorSpecificity(conditional.getSimpleSelector());
      readSelectorSpecificity(condition);
      return;
    case 4: 
      ElementSelector es = (ElementSelector)selector;
      String name = es.getLocalName();
      if (name != null) {
        fieldD_ += 1;
      }
      return;
    case 12: 
      SiblingSelector ss = (SiblingSelector)selector;
      readSelectorSpecificity(ss.getSelector());
      readSelectorSpecificity(ss.getSiblingSelector());
      return;
    }
    LOG.warn("Unhandled CSS selector type for specificity computation: '" + selector.getSelectorType() + "'.");
  }
  
  private void readSelectorSpecificity(Condition condition)
  {
    switch (condition.getConditionType())
    {
    case 5: 
      fieldB_ += 1;
      return;
    case 9: 
      fieldC_ += 1;
      return;
    case 0: 
      CombinatorCondition cc1 = (CombinatorCondition)condition;
      readSelectorSpecificity(cc1.getFirstCondition());
      readSelectorSpecificity(cc1.getSecondCondition());
      return;
    case 4: 
      AttributeCondition ac1 = (AttributeCondition)condition;
      if ("id".equalsIgnoreCase(ac1.getLocalName())) {
        fieldB_ += 1;
      } else {
        fieldC_ += 1;
      }
      return;
    case 10: 
      fieldD_ += 1;
      return;
    }
    LOG.warn("Unhandled CSS condition type for specifity computation: '" + condition.getConditionType() + "'.");
  }
  
  public String toString()
  {
    return fieldA_ + "," + fieldB_ + "," + fieldC_ + "," + fieldD_;
  }
  
  public int compareTo(SelectorSpecificity other)
  {
    if (fieldA_ != fieldA_) {
      return fieldA_ - fieldA_;
    }
    if (fieldB_ != fieldB_) {
      return fieldB_ - fieldB_;
    }
    if (fieldC_ != fieldC_) {
      return fieldC_ - fieldC_;
    }
    if (fieldD_ != fieldD_) {
      return fieldD_ - fieldD_;
    }
    return 0;
  }
}

/* Location:
 * Qualified Name:     com.gargoylesoftware.htmlunit.javascript.host.css.SelectorSpecificity
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.gargoylesoftware.htmlunit.javascript.host.css;

import com.gargoylesoftware.htmlunit.javascript.SimpleScriptable;
import com.gargoylesoftware.htmlunit.javascript.host.html.HTMLElement;

public class CSSValue
  extends SimpleScriptable
{
  private static final long serialVersionUID = 5433037821970827600L;
  public static final short CSS_INHERIT = 0;
  public static final short CSS_PRIMITIVE_VALUE = 1;
  public static final short CSS_VALUE_LIST = 2;
  public static final short CSS_CUSTOM = 3;
  private org.w3c.dom.css.CSSValue wrappedCssValue_;
  
  public CSSValue() {}
  
  CSSValue(HTMLElement element, org.w3c.dom.css.CSSValue cssValue)
  {
    setParentScope(element.getParentScope());
    setPrototype(getPrototype(getClass()));
    setDomNode(element.getDomNodeOrNull(), false);
    wrappedCssValue_ = cssValue;
  }
  
  public String jsxGet_cssText()
  {
    return wrappedCssValue_.getCssText();
  }
}

/* Location:
 * Qualified Name:     com.gargoylesoftware.htmlunit.javascript.host.css.CSSValue
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.gargoylesoftware.htmlunit.javascript.host.css;

import com.gargoylesoftware.htmlunit.BrowserVersion;
import com.gargoylesoftware.htmlunit.javascript.SimpleScriptable;
import com.gargoylesoftware.htmlunit.javascript.host.Stylesheet;
import java.util.ArrayList;
import java.util.List;
import net.sourceforge.htmlunit.corejs.javascript.Scriptable;
import org.w3c.dom.css.CSSStyleSheet;

public class CSSRuleList
  extends SimpleScriptable
{
  private static final long serialVersionUID = 6068213884501456020L;
  private final Stylesheet stylesheet_;
  private final org.w3c.dom.css.CSSRuleList rules_;
  
  @Deprecated
  public CSSRuleList()
  {
    stylesheet_ = null;
    rules_ = null;
  }
  
  public CSSRuleList(Stylesheet stylesheet)
  {
    stylesheet_ = stylesheet;
    rules_ = stylesheet.getWrappedSheet().getCssRules();
    setParentScope(stylesheet.getParentScope());
    setPrototype(getPrototype(getClass()));
  }
  
  public int jsxGet_length()
  {
    if (rules_ != null) {
      return rules_.getLength();
    }
    return 0;
  }
  
  public Object jsxFunction_item(int index)
  {
    return null;
  }
  
  public Object[] getIds()
  {
    List<String> idList = new ArrayList();
    
    int length = jsxGet_length();
    if (!getBrowserVersion().isIE())
    {
      for (int i = 0; i < length; i++) {
        idList.add(Integer.toString(i));
      }
      idList.add("length");
      idList.add("item");
    }
    else
    {
      idList.add("length");
      for (int i = 0; i < length; i++) {
        idList.add(Integer.toString(i));
      }
    }
    return idList.toArray();
  }
  
  public boolean has(String name, Scriptable start)
  {
    if ((name.equals("length")) || (name.equals("item"))) {
      return true;
    }
    try
    {
      int index = Integer.parseInt(name);
      int length = jsxGet_length();
      if ((index >= 0) && (index < length)) {
        return true;
      }
    }
    catch (Exception e) {}
    return false;
  }
  
  public Object get(int index, Scriptable start)
  {
    return CSSRule.create(stylesheet_, rules_.item(index));
  }
}

/* Location:
 * Qualified Name:     com.gargoylesoftware.htmlunit.javascript.host.css.CSSRuleList
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.gargoylesoftware.htmlunit.javascript.host.css;

import com.gargoylesoftware.htmlunit.javascript.SimpleScriptable;
import com.gargoylesoftware.htmlunit.javascript.host.Stylesheet;

public class CSSRule
  extends SimpleScriptable
{
  public static final short UNKNOWN_RULE = 0;
  public static final short STYLE_RULE = 1;
  public static final short CHARSET_RULE = 2;
  public static final short IMPORT_RULE = 3;
  public static final short MEDIA_RULE = 4;
  public static final short FONT_FACE_RULE = 5;
  public static final short PAGE_RULE = 6;
  private static final long serialVersionUID = -8392071769970424557L;
  private final Stylesheet stylesheet_;
  private final org.w3c.dom.css.CSSRule rule_;
  
  @Deprecated
  public CSSRule()
  {
    stylesheet_ = null;
    rule_ = null;
  }
  
  public static CSSRule create(Stylesheet stylesheet, org.w3c.dom.css.CSSRule rule)
  {
    switch (rule.getType())
    {
    case 1: 
      return new CSSStyleRule(stylesheet, rule);
    case 3: 
      return new CSSImportRule(stylesheet, rule);
    }
    throw new UnsupportedOperationException("CSSRule " + rule.getClass().getName() + " is not yet supported.");
  }
  
  protected CSSRule(Stylesheet stylesheet, org.w3c.dom.css.CSSRule rule)
  {
    stylesheet_ = stylesheet;
    rule_ = rule;
    setParentScope(stylesheet);
    setPrototype(getPrototype(getClass()));
  }
  
  public short jsxGet_type()
  {
    return rule_.getType();
  }
  
  public String jsxGet_cssText()
  {
    return rule_.getCssText();
  }
  
  public void jsxSet_cssText(String cssText)
  {
    rule_.setCssText(cssText);
  }
  
  public Stylesheet jsxGet_parentStyleSheet()
  {
    return stylesheet_;
  }
  
  public CSSRule jsxGet_parentRule()
  {
    org.w3c.dom.css.CSSRule parentRule = rule_.getParentRule();
    if (parentRule != null) {
      return create(stylesheet_, parentRule);
    }
    return null;
  }
  
  protected org.w3c.dom.css.CSSRule getRule()
  {
    return rule_;
  }
}

/* Location:
 * Qualified Name:     com.gargoylesoftware.htmlunit.javascript.host.css.CSSRule
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.gargoylesoftware.htmlunit.javascript.host.css;

import com.gargoylesoftware.htmlunit.javascript.host.Stylesheet;
import com.gargoylesoftware.htmlunit.javascript.host.html.HTMLElement;
import org.w3c.dom.css.CSSStyleSheet;

public class CSSImportRule
  extends CSSRule
{
  private static final long serialVersionUID = -3352769444872087531L;
  private com.gargoylesoftware.htmlunit.javascript.host.MediaList media_;
  private Stylesheet importedStylesheet_;
  
  @Deprecated
  public CSSImportRule() {}
  
  protected CSSImportRule(Stylesheet stylesheet, org.w3c.dom.css.CSSRule rule)
  {
    super(stylesheet, rule);
  }
  
  public String jsxGet_href()
  {
    return getImportRule().getHref();
  }
  
  public com.gargoylesoftware.htmlunit.javascript.host.MediaList jsxGet_media()
  {
    if (media_ == null)
    {
      Stylesheet parent = jsxGet_parentStyleSheet();
      org.w3c.dom.stylesheets.MediaList ml = getImportRule().getMedia();
      media_ = new com.gargoylesoftware.htmlunit.javascript.host.MediaList(parent, ml);
    }
    return media_;
  }
  
  public Stylesheet jsxGet_styleSheet()
  {
    if (importedStylesheet_ == null)
    {
      Stylesheet owningSheet = jsxGet_parentStyleSheet();
      HTMLElement ownerNode = owningSheet.jsxGet_ownerNode();
      CSSStyleSheet importedStylesheet = getImportRule().getStyleSheet();
      importedStylesheet_ = new Stylesheet(ownerNode, importedStylesheet, owningSheet.getUri());
    }
    return importedStylesheet_;
  }
  
  private org.w3c.dom.css.CSSImportRule getImportRule()
  {
    return (org.w3c.dom.css.CSSImportRule)getRule();
  }
}

/* Location:
 * Qualified Name:     com.gargoylesoftware.htmlunit.javascript.host.css.CSSImportRule
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.gargoylesoftware.htmlunit.javascript.host.css;

import com.gargoylesoftware.htmlunit.javascript.host.html.HTMLElement;

public class CSSPrimitiveValue
  extends CSSValue
{
  private static final long serialVersionUID = -1742690770021576031L;
  public static final short CSS_UNKNOWN = 0;
  public static final short CSS_NUMBER = 1;
  public static final short CSS_PERCENTAGE = 2;
  public static final short CSS_EMS = 3;
  public static final short CSS_EXS = 4;
  public static final short CSS_PX = 5;
  public static final short CSS_CM = 6;
  public static final short CSS_MM = 7;
  public static final short CSS_IN = 8;
  public static final short CSS_PT = 9;
  public static final short CSS_PC = 10;
  public static final short CSS_DEG = 11;
  public static final short CSS_RAD = 12;
  public static final short CSS_GRAD = 13;
  public static final short CSS_MS = 14;
  public static final short CSS_S = 15;
  public static final short CSS_HZ = 16;
  public static final short CSS_KHZ = 17;
  public static final short CSS_DIMENSION = 18;
  public static final short CSS_STRING = 19;
  public static final short CSS_URI = 20;
  public static final short CSS_IDENT = 21;
  public static final short CSS_ATTR = 22;
  public static final short CSS_COUNTER = 23;
  public static final short CSS_RECT = 24;
  public static final short CSS_RGBCOLOR = 25;
  private org.w3c.dom.css.CSSPrimitiveValue wrappedCssPrimitiveValue_;
  
  public CSSPrimitiveValue() {}
  
  CSSPrimitiveValue(HTMLElement element, org.w3c.dom.css.CSSPrimitiveValue cssValue)
  {
    super(element, cssValue);
    setParentScope(element.getParentScope());
    setPrototype(getPrototype(getClass()));
    setDomNode(element.getDomNodeOrNull(), false);
    wrappedCssPrimitiveValue_ = cssValue;
  }
  
  public double jsxFunction_getFloatValue(int unitType)
  {
    return wrappedCssPrimitiveValue_.getFloatValue((short)unitType);
  }
}

/* Location:
 * Qualified Name:     com.gargoylesoftware.htmlunit.javascript.host.css.CSSPrimitiveValue
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.gargoylesoftware.htmlunit.javascript.host.css;

import com.gargoylesoftware.htmlunit.BrowserVersion;
import com.gargoylesoftware.htmlunit.javascript.host.Stylesheet;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class CSSStyleRule
  extends CSSRule
{
  private static final long serialVersionUID = 207943879569003822L;
  
  @Deprecated
  public CSSStyleRule() {}
  
  protected CSSStyleRule(Stylesheet stylesheet, org.w3c.dom.css.CSSRule rule)
  {
    super(stylesheet, rule);
  }
  
  public String jsxGet_selectorText()
  {
    String selectorText = ((org.w3c.dom.css.CSSStyleRule)getRule()).getSelectorText();
    Pattern p = Pattern.compile("[\\.#]?[a-zA-Z]+");
    Matcher m = p.matcher(selectorText);
    StringBuffer sb = new StringBuffer();
    while (m.find())
    {
      String fixedName = m.group();
      if ((!fixedName.startsWith(".")) && (!fixedName.startsWith("#"))) {
        if (getBrowserVersion().isIE()) {
          fixedName = fixedName.toUpperCase();
        } else {
          fixedName = fixedName.toLowerCase();
        }
      }
      m.appendReplacement(sb, fixedName);
    }
    m.appendTail(sb);
    
    selectorText = sb.toString().replaceAll("\\*([\\.#])", "$1");
    return selectorText;
  }
  
  public void jsxSet_selectorText(String selectorText)
  {
    ((org.w3c.dom.css.CSSStyleRule)getRule()).setSelectorText(selectorText);
  }
  
  public CSSStyleDeclaration jsxGet_style()
  {
    return new CSSStyleDeclaration(getParentScope(), ((org.w3c.dom.css.CSSStyleRule)getRule()).getStyle());
  }
}

/* Location:
 * Qualified Name:     com.gargoylesoftware.htmlunit.javascript.host.css.CSSStyleRule
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.gargoylesoftware.htmlunit.javascript.host.css;

import org.apache.commons.lang.StringUtils;

class ComputedCSSStyleDeclaration$1
  extends CSSStyleDeclaration.CssValue
{
  ComputedCSSStyleDeclaration$1(ComputedCSSStyleDeclaration paramComputedCSSStyleDeclaration, int x0)
  {
    super(x0);
  }
  
  public String get(ComputedCSSStyleDeclaration style)
  {
    return StringUtils.defaultIfEmpty(style.getStyleAttribute("height", true), "363px");
  }
}

/* Location:
 * Qualified Name:     com.gargoylesoftware.htmlunit.javascript.host.css.ComputedCSSStyleDeclaration.1
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.gargoylesoftware.htmlunit.javascript.host.css;

import org.apache.commons.lang.StringUtils;

class ComputedCSSStyleDeclaration$2
  extends CSSStyleDeclaration.CssValue
{
  ComputedCSSStyleDeclaration$2(ComputedCSSStyleDeclaration paramComputedCSSStyleDeclaration, int x0, String paramString)
  {
    super(x0);
  }
  
  public String get(ComputedCSSStyleDeclaration style)
  {
    return StringUtils.defaultIfEmpty(style.getStyleAttribute("width", true), val$defaultWidth);
  }
}

/* Location:
 * Qualified Name:     com.gargoylesoftware.htmlunit.javascript.host.css.ComputedCSSStyleDeclaration.2
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.gargoylesoftware.htmlunit.javascript.host.css;

class ComputedCSSStyleDeclaration$3
  extends CSSStyleDeclaration.CssValue
{
  ComputedCSSStyleDeclaration$3(ComputedCSSStyleDeclaration paramComputedCSSStyleDeclaration, int x0)
  {
    super(x0);
  }
  
  public String get(ComputedCSSStyleDeclaration style)
  {
    return style.jsxGet_width();
  }
}

/* Location:
 * Qualified Name:     com.gargoylesoftware.htmlunit.javascript.host.css.ComputedCSSStyleDeclaration.3
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.gargoylesoftware.htmlunit.javascript.host.css;

class ComputedCSSStyleDeclaration$4
  extends CSSStyleDeclaration.CssValue
{
  ComputedCSSStyleDeclaration$4(ComputedCSSStyleDeclaration paramComputedCSSStyleDeclaration, int x0)
  {
    super(x0);
  }
  
  public String get(ComputedCSSStyleDeclaration style)
  {
    return style.getStyleAttribute("width", true);
  }
}

/* Location:
 * Qualified Name:     com.gargoylesoftware.htmlunit.javascript.host.css.ComputedCSSStyleDeclaration.4
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.gargoylesoftware.htmlunit.javascript.host.css;

class ComputedCSSStyleDeclaration$5
  extends CSSStyleDeclaration.CssValue
{
  ComputedCSSStyleDeclaration$5(ComputedCSSStyleDeclaration paramComputedCSSStyleDeclaration, int x0)
  {
    super(x0);
  }
  
  public String get(ComputedCSSStyleDeclaration style)
  {
    return style.getStyleAttribute("height", true);
  }
}

/* Location:
 * Qualified Name:     com.gargoylesoftware.htmlunit.javascript.host.css.ComputedCSSStyleDeclaration.5
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.gargoylesoftware.htmlunit.javascript.host.css;

import com.gargoylesoftware.htmlunit.BrowserVersion;
import com.gargoylesoftware.htmlunit.BrowserVersionFeatures;
import com.gargoylesoftware.htmlunit.html.DomNode;
import com.gargoylesoftware.htmlunit.html.HtmlElement;
import com.gargoylesoftware.htmlunit.html.HtmlHead;
import com.gargoylesoftware.htmlunit.javascript.host.Text;
import com.gargoylesoftware.htmlunit.javascript.host.Window;
import com.gargoylesoftware.htmlunit.javascript.host.html.HTMLBodyElement;
import com.gargoylesoftware.htmlunit.javascript.host.html.HTMLElement;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.SortedMap;
import java.util.TreeMap;
import net.sourceforge.htmlunit.corejs.javascript.Context;
import org.apache.commons.lang.StringUtils;
import org.w3c.css.sac.Selector;

public class ComputedCSSStyleDeclaration
  extends CSSStyleDeclaration
{
  private static final long serialVersionUID = -1883166331827717255L;
  private static final int PIXELS_PER_CHAR = 10;
  private SortedMap<String, CSSStyleDeclaration.StyleElement> localModifications_ = new TreeMap();
  private Map<String, String> defaultDisplays_;
  private Integer width_;
  private Integer height_;
  private Integer paddingHorizontal_;
  private Integer paddingVertical_;
  private Integer borderHorizontal_;
  private Integer borderVertical_;
  
  public ComputedCSSStyleDeclaration() {}
  
  public ComputedCSSStyleDeclaration(CSSStyleDeclaration style)
  {
    super(style.getElement());
    getElement().setDefaults(this);
  }
  
  protected String getStyleAttribute(String name, boolean camelCase)
  {
    String s = super.getStyleAttribute(name, camelCase);
    if ((s.length() == 0) && (isInheritable(name, camelCase)))
    {
      HTMLElement parent = getElement().getParentHTMLElement();
      if (parent != null) {
        s = getWindow().jsxFunction_getComputedStyle(parent, null).getStyleAttribute(name, camelCase);
      }
    }
    return s;
  }
  
  private boolean isInheritable(String name, boolean camelCase)
  {
    if (!camelCase) {
      name = camelize(name);
    }
    return ("azimuth".equals(name)) || ("borderCollapse".equals(name)) || ("borderSpacing".equals(name)) || ("captionSide".equals(name)) || ("color".equals(name)) || ("cursor".equals(name)) || ("direction".equals(name)) || ("elevation".equals(name)) || ("emptyCells".equals(name)) || ("fontFamily".equals(name)) || ("fontSize".equals(name)) || ("fontStyle".equals(name)) || ("fontVariant".equals(name)) || ("fontWeight".equals(name)) || ("font".equals(name)) || ("letterSpacing".equals(name)) || ("lineHeight".equals(name)) || ("listStyleImage".equals(name)) || ("listStylePosition".equals(name)) || ("listStyleType".equals(name)) || ("listStyle".equals(name)) || ("orphans".equals(name)) || ("pitchRange".equals(name)) || ("pitch".equals(name)) || ("quotes".equals(name)) || ("richness".equals(name)) || ("speakHeader".equals(name)) || ("speakNumeral".equals(name)) || ("speakPunctuation".equals(name)) || ("speak".equals(name)) || ("speechRate".equals(name)) || ("stress".equals(name)) || ("textAlign".equals(name)) || ("textIndent".equals(name)) || ("textTransform".equals(name)) || ("visibility".equals(name)) || ("voiceFamily".equals(name)) || ("volume".equals(name)) || ("whiteSpace".equals(name)) || ("widows".equals(name)) || ("wordSpacing".equals(name));
  }
  
  protected void setStyleAttribute(String name, String newValue) {}
  
  public void applyStyleFromSelector(org.w3c.dom.css.CSSStyleDeclaration declaration, Selector selector)
  {
    SelectorSpecificity specificity = new SelectorSpecificity(selector);
    for (int k = 0; k < declaration.getLength(); k++)
    {
      String name = declaration.item(k);
      String value = declaration.getPropertyValue(name);
      String priority = declaration.getPropertyPriority(name);
      applyLocalStyleAttribute(name, value, priority, specificity);
    }
  }
  
  private void applyLocalStyleAttribute(String name, String newValue, String priority, SelectorSpecificity specificity)
  {
    if (!"important".equals(priority))
    {
      CSSStyleDeclaration.StyleElement existingElement = (CSSStyleDeclaration.StyleElement)localModifications_.get(name);
      if (existingElement != null)
      {
        if ("important".equals(existingElement.getPriority())) {
          return;
        }
        if (specificity.compareTo(existingElement.getSpecificity()) < 0) {
          return;
        }
      }
    }
    CSSStyleDeclaration.StyleElement element = new CSSStyleDeclaration.StyleElement(name, newValue, priority, specificity, getCurrentElementIndex());
    localModifications_.put(name, element);
  }
  
  public void setDefaultLocalStyleAttribute(String name, String newValue)
  {
    CSSStyleDeclaration.StyleElement element = new CSSStyleDeclaration.StyleElement(name, newValue);
    localModifications_.put(name, element);
  }
  
  protected Map<String, CSSStyleDeclaration.StyleElement> getStyleMap(boolean camelCase)
  {
    Map<String, CSSStyleDeclaration.StyleElement> styleMap = super.getStyleMap(camelCase);
    if (localModifications_ != null) {
      for (CSSStyleDeclaration.StyleElement e : localModifications_.values())
      {
        String key = e.getName();
        if (camelCase) {
          key = camelize(key);
        }
        CSSStyleDeclaration.StyleElement existent = (CSSStyleDeclaration.StyleElement)styleMap.get(key);
        CSSStyleDeclaration.StyleElement element = new CSSStyleDeclaration.StyleElement(key, e.getValue(), e.getIndex());
        if (existent == null) {
          styleMap.put(key, element);
        }
      }
    }
    return styleMap;
  }
  
  public String jsxGet_backgroundAttachment()
  {
    return StringUtils.defaultIfEmpty(super.jsxGet_backgroundAttachment(), "scroll");
  }
  
  public String jsxGet_backgroundColor()
  {
    String value = super.jsxGet_backgroundColor();
    if (StringUtils.isEmpty(value)) {
      value = "transparent";
    } else if (getBrowserVersion().isFirefox()) {
      value = toRGBColor(value);
    }
    return value;
  }
  
  public String jsxGet_backgroundImage()
  {
    return StringUtils.defaultIfEmpty(super.jsxGet_backgroundImage(), "none");
  }
  
  public String jsxGet_backgroundRepeat()
  {
    return StringUtils.defaultIfEmpty(super.jsxGet_backgroundRepeat(), "repeat");
  }
  
  public String jsxGet_borderBottomColor()
  {
    return StringUtils.defaultIfEmpty(super.jsxGet_borderBottomColor(), "rgb(0, 0, 0)");
  }
  
  public String jsxGet_borderBottomStyle()
  {
    return StringUtils.defaultIfEmpty(super.jsxGet_borderBottomStyle(), "none");
  }
  
  public String jsxGet_borderBottomWidth()
  {
    return pixelString(StringUtils.defaultIfEmpty(super.jsxGet_borderBottomWidth(), "0px"));
  }
  
  public String jsxGet_borderCollapse()
  {
    return StringUtils.defaultIfEmpty(super.jsxGet_borderCollapse(), "separate");
  }
  
  public String jsxGet_borderLeftColor()
  {
    return StringUtils.defaultIfEmpty(super.jsxGet_borderLeftColor(), "rgb(0, 0, 0)");
  }
  
  public String jsxGet_borderLeftStyle()
  {
    return StringUtils.defaultIfEmpty(super.jsxGet_borderLeftStyle(), "none");
  }
  
  public String jsxGet_borderLeftWidth()
  {
    return pixelString(StringUtils.defaultIfEmpty(super.jsxGet_borderLeftWidth(), "0px"));
  }
  
  public String jsxGet_borderRightColor()
  {
    return StringUtils.defaultIfEmpty(super.jsxGet_borderRightColor(), "rgb(0, 0, 0)");
  }
  
  public String jsxGet_borderRightStyle()
  {
    return StringUtils.defaultIfEmpty(super.jsxGet_borderRightStyle(), "none");
  }
  
  public String jsxGet_borderRightWidth()
  {
    return pixelString(StringUtils.defaultIfEmpty(super.jsxGet_borderRightWidth(), "0px"));
  }
  
  public String jsxGet_borderSpacing()
  {
    return StringUtils.defaultIfEmpty(super.jsxGet_borderSpacing(), "0px 0px");
  }
  
  public String jsxGet_borderTopColor()
  {
    return StringUtils.defaultIfEmpty(super.jsxGet_borderTopColor(), "rgb(0, 0, 0)");
  }
  
  public String jsxGet_borderTopStyle()
  {
    return StringUtils.defaultIfEmpty(super.jsxGet_borderTopStyle(), "none");
  }
  
  public String jsxGet_borderTopWidth()
  {
    return pixelString(StringUtils.defaultIfEmpty(super.jsxGet_borderTopWidth(), "0px"));
  }
  
  public String jsxGet_bottom()
  {
    return StringUtils.defaultIfEmpty(super.jsxGet_bottom(), "auto");
  }
  
  public String jsxGet_captionSide()
  {
    return StringUtils.defaultIfEmpty(super.jsxGet_captionSide(), "top");
  }
  
  public String jsxGet_clear()
  {
    return StringUtils.defaultIfEmpty(super.jsxGet_clear(), "none");
  }
  
  public String jsxGet_clip()
  {
    return StringUtils.defaultIfEmpty(super.jsxGet_clip(), "auto");
  }
  
  public String jsxGet_color()
  {
    return StringUtils.defaultIfEmpty(super.jsxGet_color(), "rgb(0, 0, 0)");
  }
  
  public String jsxGet_counterIncrement()
  {
    return StringUtils.defaultIfEmpty(super.jsxGet_counterIncrement(), "none");
  }
  
  public String jsxGet_counterReset()
  {
    return StringUtils.defaultIfEmpty(super.jsxGet_counterReset(), "none");
  }
  
  public String jsxGet_cssFloat()
  {
    return StringUtils.defaultIfEmpty(super.jsxGet_cssFloat(), "none");
  }
  
  public String jsxGet_cursor()
  {
    return StringUtils.defaultIfEmpty(super.jsxGet_cursor(), "auto");
  }
  
  public String jsxGet_direction()
  {
    return StringUtils.defaultIfEmpty(super.jsxGet_direction(), "ltr");
  }
  
  public String jsxGet_display()
  {
    return StringUtils.defaultIfEmpty(super.jsxGet_display(), getDefaultStyleDisplay());
  }
  
  private String getDefaultStyleDisplay()
  {
    if (defaultDisplays_ == null)
    {
      Map<String, String> map = new HashMap();
      map.put("A", "inline");
      map.put("CODE", "inline");
      map.put("SPAN", "inline");
      if (!getBrowserVersion().isIE())
      {
        map.put("LI", "list-item");
        map.put("TABLE", "table");
        map.put("TBODY", "table-row-group");
        map.put("TD", "table-cell");
        map.put("TH", "table-cell");
        map.put("THEAD", "table-header-group");
        map.put("TR", "table-row");
      }
      defaultDisplays_ = Collections.unmodifiableMap(map);
    }
    String defaultValue = (String)defaultDisplays_.get(getElement().jsxGet_tagName());
    if (defaultValue == null) {
      return "block";
    }
    return defaultValue;
  }
  
  public String jsxGet_emptyCells()
  {
    return StringUtils.defaultIfEmpty(super.jsxGet_emptyCells(), "-moz-show-background");
  }
  
  public String jsxGet_fontFamily()
  {
    return StringUtils.defaultIfEmpty(super.jsxGet_fontFamily(), "serif");
  }
  
  public String jsxGet_fontSize()
  {
    String value = super.jsxGet_fontSize();
    if (value.length() == 0)
    {
      HTMLElement parent = getElement().getParentHTMLElement();
      if (parent != null) {
        value = parent.jsxGet_currentStyle().jsxGet_fontSize();
      }
    }
    if (value.length() == 0) {
      value = "16px";
    }
    return value;
  }
  
  public String jsxGet_fontSizeAdjust()
  {
    return StringUtils.defaultIfEmpty(super.jsxGet_fontSizeAdjust(), "none");
  }
  
  public String jsxGet_fontStyle()
  {
    return StringUtils.defaultIfEmpty(super.jsxGet_fontStyle(), "normal");
  }
  
  public String jsxGet_fontVariant()
  {
    return StringUtils.defaultIfEmpty(super.jsxGet_fontVariant(), "normal");
  }
  
  public String jsxGet_fontWeight()
  {
    return StringUtils.defaultIfEmpty(super.jsxGet_fontWeight(), "400");
  }
  
  public String jsxGet_height()
  {
    pixelString(getElement(), new CSSStyleDeclaration.CssValue(605)
    {
      public String get(ComputedCSSStyleDeclaration style)
      {
        return StringUtils.defaultIfEmpty(style.getStyleAttribute("height", true), "363px");
      }
    });
  }
  
  public String jsxGet_left()
  {
    return StringUtils.defaultIfEmpty(super.jsxGet_left(), "auto");
  }
  
  public String jsxGet_letterSpacing()
  {
    return StringUtils.defaultIfEmpty(super.jsxGet_letterSpacing(), "normal");
  }
  
  public String jsxGet_lineHeight()
  {
    return StringUtils.defaultIfEmpty(super.jsxGet_lineHeight(), "normal");
  }
  
  public String jsxGet_listStyleImage()
  {
    return StringUtils.defaultIfEmpty(super.jsxGet_listStyleImage(), "none");
  }
  
  public String jsxGet_listStylePosition()
  {
    return StringUtils.defaultIfEmpty(super.jsxGet_listStylePosition(), "outside");
  }
  
  public String jsxGet_listStyleType()
  {
    return StringUtils.defaultIfEmpty(super.jsxGet_listStyleType(), "disc");
  }
  
  public String jsxGet_marginBottom()
  {
    return pixelString(StringUtils.defaultIfEmpty(super.jsxGet_marginBottom(), "0px"));
  }
  
  public String jsxGet_marginLeft()
  {
    return pixelString(StringUtils.defaultIfEmpty(super.jsxGet_marginLeft(), "0px"));
  }
  
  public String jsxGet_marginRight()
  {
    return pixelString(StringUtils.defaultIfEmpty(super.jsxGet_marginRight(), "0px"));
  }
  
  public String jsxGet_marginTop()
  {
    return pixelString(StringUtils.defaultIfEmpty(super.jsxGet_marginTop(), "0px"));
  }
  
  public String jsxGet_markerOffset()
  {
    return StringUtils.defaultIfEmpty(super.jsxGet_markerOffset(), "none");
  }
  
  public String jsxGet_maxHeight()
  {
    return StringUtils.defaultIfEmpty(super.jsxGet_maxHeight(), "none");
  }
  
  public String jsxGet_maxWidth()
  {
    return StringUtils.defaultIfEmpty(super.jsxGet_maxWidth(), "none");
  }
  
  public String jsxGet_minHeight()
  {
    return StringUtils.defaultIfEmpty(super.jsxGet_minHeight(), "0px");
  }
  
  public String jsxGet_minWidth()
  {
    return StringUtils.defaultIfEmpty(super.jsxGet_minWidth(), "0px");
  }
  
  public String jsxGet_MozAppearance()
  {
    return StringUtils.defaultIfEmpty(super.jsxGet_MozAppearance(), "none");
  }
  
  public String jsxGet_MozBackgroundClip()
  {
    return StringUtils.defaultIfEmpty(super.jsxGet_MozBackgroundClip(), "border");
  }
  
  public String jsxGet_MozBackgroundInlinePolicy()
  {
    return StringUtils.defaultIfEmpty(super.jsxGet_MozBackgroundInlinePolicy(), "continuous");
  }
  
  public String jsxGet_MozBackgroundOrigin()
  {
    return StringUtils.defaultIfEmpty(super.jsxGet_MozBackgroundOrigin(), "padding");
  }
  
  public String jsxGet_MozBinding()
  {
    return StringUtils.defaultIfEmpty(super.jsxGet_MozBinding(), "none");
  }
  
  public String jsxGet_MozBorderBottomColors()
  {
    return StringUtils.defaultIfEmpty(super.jsxGet_MozBorderBottomColors(), "none");
  }
  
  public String jsxGet_MozBorderLeftColors()
  {
    return StringUtils.defaultIfEmpty(super.jsxGet_MozBorderLeftColors(), "none");
  }
  
  public String jsxGet_MozBorderRadiusBottomleft()
  {
    return StringUtils.defaultIfEmpty(super.jsxGet_MozBorderRadiusBottomleft(), "0px");
  }
  
  public String jsxGet_MozBorderRadiusBottomright()
  {
    return StringUtils.defaultIfEmpty(super.jsxGet_MozBorderRadiusBottomright(), "0px");
  }
  
  public String jsxGet_MozBorderRadiusTopleft()
  {
    return StringUtils.defaultIfEmpty(super.jsxGet_MozBorderRadiusTopleft(), "0px");
  }
  
  public String jsxGet_MozBorderRadiusTopright()
  {
    return StringUtils.defaultIfEmpty(super.jsxGet_MozBorderRadiusTopright(), "0px");
  }
  
  public String jsxGet_MozBorderRightColors()
  {
    return StringUtils.defaultIfEmpty(super.jsxGet_MozBorderRightColors(), "none");
  }
  
  public String jsxGet_MozBorderTopColors()
  {
    return StringUtils.defaultIfEmpty(super.jsxGet_MozBorderTopColors(), "none");
  }
  
  public String jsxGet_MozBoxAlign()
  {
    return StringUtils.defaultIfEmpty(super.jsxGet_MozBoxAlign(), "stretch");
  }
  
  public String jsxGet_MozBoxDirection()
  {
    return StringUtils.defaultIfEmpty(super.jsxGet_MozBoxDirection(), "normal");
  }
  
  public String jsxGet_MozBoxFlex()
  {
    return StringUtils.defaultIfEmpty(super.jsxGet_MozBoxFlex(), "0");
  }
  
  public String jsxGet_MozBoxOrdinalGroup()
  {
    return StringUtils.defaultIfEmpty(super.jsxGet_MozBoxOrdinalGroup(), "1");
  }
  
  public String jsxGet_MozBoxOrient()
  {
    return StringUtils.defaultIfEmpty(super.jsxGet_MozBoxOrient(), "horizontal");
  }
  
  public String jsxGet_MozBoxPack()
  {
    return StringUtils.defaultIfEmpty(super.jsxGet_MozBoxPack(), "start");
  }
  
  public String jsxGet_MozBoxSizing()
  {
    return StringUtils.defaultIfEmpty(super.jsxGet_MozBoxSizing(), "content-box");
  }
  
  public String jsxGet_MozColumnCount()
  {
    return StringUtils.defaultIfEmpty(super.jsxGet_MozColumnCount(), "auto");
  }
  
  public String jsxGet_MozColumnGap()
  {
    return StringUtils.defaultIfEmpty(super.jsxGet_MozColumnGap(), "0px");
  }
  
  public String jsxGet_MozColumnWidth()
  {
    return StringUtils.defaultIfEmpty(super.jsxGet_MozColumnWidth(), "auto");
  }
  
  public String jsxGet_MozFloatEdge()
  {
    return StringUtils.defaultIfEmpty(super.jsxGet_MozFloatEdge(), "content-box");
  }
  
  public String jsxGet_MozImageRegion()
  {
    return StringUtils.defaultIfEmpty(super.jsxGet_MozImageRegion(), "auto");
  }
  
  public String jsxGet_MozOpacity()
  {
    return StringUtils.defaultIfEmpty(super.jsxGet_MozOpacity(), "1");
  }
  
  public String jsxGet_MozOutlineColor()
  {
    return StringUtils.defaultIfEmpty(super.jsxGet_MozOutlineColor(), "rgb(0, 0, 0)");
  }
  
  public String jsxGet_MozOutlineOffset()
  {
    return StringUtils.defaultIfEmpty(super.jsxGet_MozOutlineOffset(), "0px");
  }
  
  public String jsxGet_MozOutlineRadiusBottomleft()
  {
    return StringUtils.defaultIfEmpty(super.jsxGet_MozOutlineRadiusBottomleft(), "0px");
  }
  
  public String jsxGet_MozOutlineRadiusBottomright()
  {
    return StringUtils.defaultIfEmpty(super.jsxGet_MozOutlineRadiusBottomright(), "0px");
  }
  
  public String jsxGet_MozOutlineRadiusTopleft()
  {
    return StringUtils.defaultIfEmpty(super.jsxGet_MozOutlineRadiusTopleft(), "0px");
  }
  
  public String jsxGet_MozOutlineRadiusTopright()
  {
    return StringUtils.defaultIfEmpty(super.jsxGet_MozOutlineRadiusTopright(), "0px");
  }
  
  public String jsxGet_MozOutlineStyle()
  {
    return StringUtils.defaultIfEmpty(super.jsxGet_MozOutlineStyle(), "none");
  }
  
  public String jsxGet_MozOutlineWidth()
  {
    return StringUtils.defaultIfEmpty(super.jsxGet_MozOutlineWidth(), "0px");
  }
  
  public String jsxGet_MozUserFocus()
  {
    return StringUtils.defaultIfEmpty(super.jsxGet_MozUserFocus(), "none");
  }
  
  public String jsxGet_MozUserInput()
  {
    return StringUtils.defaultIfEmpty(super.jsxGet_MozUserInput(), "auto");
  }
  
  public String jsxGet_MozUserModify()
  {
    return StringUtils.defaultIfEmpty(super.jsxGet_MozUserModify(), "read-only");
  }
  
  public String jsxGet_MozUserSelect()
  {
    return StringUtils.defaultIfEmpty(super.jsxGet_MozUserSelect(), "auto");
  }
  
  public String jsxGet_opacity()
  {
    return StringUtils.defaultIfEmpty(super.jsxGet_opacity(), "1");
  }
  
  public String jsxGet_outlineColor()
  {
    return StringUtils.defaultIfEmpty(super.jsxGet_outlineColor(), "rgb(0, 0, 0)");
  }
  
  public String jsxGet_outlineOffset()
  {
    return StringUtils.defaultIfEmpty(super.jsxGet_outlineOffset(), "0px");
  }
  
  public String jsxGet_outlineStyle()
  {
    return StringUtils.defaultIfEmpty(super.jsxGet_outlineStyle(), "none");
  }
  
  public String jsxGet_outlineWidth()
  {
    return StringUtils.defaultIfEmpty(super.jsxGet_outlineWidth(), "0px");
  }
  
  public String jsxGet_overflow()
  {
    return StringUtils.defaultIfEmpty(super.jsxGet_overflow(), "visible");
  }
  
  public String jsxGet_overflowX()
  {
    return StringUtils.defaultIfEmpty(super.jsxGet_overflowX(), "visible");
  }
  
  public String jsxGet_overflowY()
  {
    return StringUtils.defaultIfEmpty(super.jsxGet_overflowY(), "visible");
  }
  
  public String jsxGet_paddingBottom()
  {
    return pixelString(StringUtils.defaultIfEmpty(super.jsxGet_paddingBottom(), "0px"));
  }
  
  public String jsxGet_paddingLeft()
  {
    return pixelString(StringUtils.defaultIfEmpty(super.jsxGet_paddingLeft(), "0px"));
  }
  
  public String jsxGet_paddingRight()
  {
    return pixelString(StringUtils.defaultIfEmpty(super.jsxGet_paddingRight(), "0px"));
  }
  
  public String jsxGet_paddingTop()
  {
    return pixelString(StringUtils.defaultIfEmpty(super.jsxGet_paddingTop(), "0px"));
  }
  
  public String jsxGet_position()
  {
    return StringUtils.defaultIfEmpty(super.jsxGet_position(), "static");
  }
  
  public String jsxGet_right()
  {
    return StringUtils.defaultIfEmpty(super.jsxGet_right(), "auto");
  }
  
  public String jsxGet_tableLayout()
  {
    return StringUtils.defaultIfEmpty(super.jsxGet_tableLayout(), "auto");
  }
  
  public String jsxGet_textAlign()
  {
    return StringUtils.defaultIfEmpty(super.jsxGet_textAlign(), "start");
  }
  
  public String jsxGet_textDecoration()
  {
    return StringUtils.defaultIfEmpty(super.jsxGet_textDecoration(), "none");
  }
  
  public String jsxGet_textIndent()
  {
    return StringUtils.defaultIfEmpty(super.jsxGet_textIndent(), "0px");
  }
  
  public String jsxGet_textTransform()
  {
    return StringUtils.defaultIfEmpty(super.jsxGet_textTransform(), "none");
  }
  
  public String jsxGet_top()
  {
    return StringUtils.defaultIfEmpty(super.jsxGet_top(), "auto");
  }
  
  public String jsxGet_unicodeBidi()
  {
    return StringUtils.defaultIfEmpty(super.jsxGet_unicodeBidi(), "normal");
  }
  
  public String jsxGet_verticalAlign()
  {
    return StringUtils.defaultIfEmpty(super.jsxGet_verticalAlign(), "baseline");
  }
  
  public String jsxGet_visibility()
  {
    return StringUtils.defaultIfEmpty(super.jsxGet_visibility(), "visible");
  }
  
  public String jsxGet_whiteSpace()
  {
    return StringUtils.defaultIfEmpty(super.jsxGet_whiteSpace(), "normal");
  }
  
  public String jsxGet_width()
  {
    if (jsxGet_display().equals("none")) {
      return "auto";
    }
    String defaultWidth;
    final String defaultWidth;
    if (getBrowserVersion().isIE()) {
      defaultWidth = "auto";
    } else {
      defaultWidth = "1256px";
    }
    pixelString(getElement(), new CSSStyleDeclaration.CssValue(1256)
    {
      public String get(ComputedCSSStyleDeclaration style)
      {
        return Str
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43

Further reading...

For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.

New!JAR listings


Copyright 2006-2019. Infinite Loop Ltd