// Log.debug ("Resolving style for " +
// layoutContext.getTagName() + ":" +
// layoutContext.getPseudoElement());
final LayoutElement parent = element.getParentLayoutElement();
final LayoutStyle initialStyle = getInitialStyle();
final LayoutStyle style = element.getLayoutStyle();
// Stage 0: Initialize with the built-in defaults
// The copy will return false if it couldn't do the copy automatically
if (style.copyFrom(initialStyle) == false)
{
// manually copy all styles from the initial style-set..
for (int i = 0; i < keys.length; i++)
{
final StyleKey key = keys[i];
style.setValue(key, initialStyle.getValue(key));
}
}
// Stage 1a: Add the parent styles (but only the one marked as inheritable).
// If our element has a parent, get the parent's style information
// so we can "inherit" the styles that support that kind of thing
if (parent != null)
{
final LayoutStyle parentStyle;
parentStyle = parent.getLayoutStyle();
final StyleKey[] inheritedKeys = getInheritedKeys();
for (int i = 0; i < inheritedKeys.length; i++)
{
final StyleKey key = inheritedKeys[i];
style.setValue(key, parentStyle.getValue(key));
}
}
// At this point, the parentStyle contains the "foundation" from which
// the current element's style information will come....
// Stage 1b: Find all matching stylesheet styles for the given element.
performSelectionStep(element, style);
// Stage 1c: Add the contents of the style attribute, if there is one ..
// the libLayout style is always added: This is a computed style and the hook
// for a element neutral user defined tweaking ..
final Object libLayoutStyleValue = element.getAttribute(Namespaces.LIBLAYOUT_NAMESPACE, "style");
// You cannot override element specific styles with that. So an HTML-style
// attribute has more value than a LibLayout-style attribute.
addStyleFromAttribute(element, libLayoutStyleValue);
if (strictStyleMode)
{
performStrictStyleAttr(element);
}
else
{
performCompleteStyleAttr(element);
}
// Stage 2: Compute the 'specified' set of values.
// Find all explicitly inherited styles and add them from the parent.
final CSSInheritValue inheritInstance = CSSInheritValue.getInstance();
if (parent == null)
{
for (int i = 0; i < keys.length; i++)
{
final StyleKey key = keys[i];
final Object value = style.getValue(key);
if (inheritInstance.equals(value))
{
style.setValue(key, initialStyle.getValue(key));
}
}
}
else
{
final LayoutStyle parentStyle = parent.getLayoutStyle();
for (int i = 0; i < keys.length; i++)
{
final StyleKey key = keys[i];
final Object value = style.getValue(key);
if (inheritInstance.equals(value))