org.xwiki.gwt.dom.client.internal.mozilla
Class MozillaDOMUtils

java.lang.Object
  extended by org.xwiki.gwt.dom.client.DOMUtils
      extended by org.xwiki.gwt.dom.client.internal.mozilla.MozillaDOMUtils

public class MozillaDOMUtils
extends DOMUtils

Contains methods from DOMUtils that require a different implementation in Mozilla.

Version:
$Id: MozillaDOMUtils.java 21741 2009-07-01 08:47:08Z mflorea $

Field Summary
 
Fields inherited from class org.xwiki.gwt.dom.client.DOMUtils
CDATA_NODE, COMMENT_NODE, DOCUMENT_FRAGMENT_NODE, HTML_BLOCK_LEVEL_INLINE_CONTAINERS, HTML_EMPTY_TAGS, HTML_FLOW_CONTAINERS, HTML_SPECIAL_BLOCK_LEVEL_ELEMENTS, UNSUPPORTED_NODE_TYPE
 
Constructor Summary
MozillaDOMUtils()
           
 
Method Summary
 void ensureBlockIsEditable(Element block)
          Ensures the given block-level element can be edited in design mode.
 java.lang.String getComputedStyleProperty(Element el, java.lang.String propertyName)
          Returns the value of the specified CSS property for the given element as it is computed by the browser before it displays that element.
 com.google.gwt.dom.client.Node splitHTMLNode(com.google.gwt.dom.client.Node parent, com.google.gwt.dom.client.Node descendant, int offset)
          Given a subtree specified by its root parent and one of the inner nodes, this method splits the subtree by the path from the given descendant (inner node) to the root parent.
 
Methods inherited from class org.xwiki.gwt.dom.client.DOMUtils
cloneNode, cloneNode, cloneNode, cloneNodeContents, comparePoints, deleteNodeContents, deleteNodeContents, deleteNodeContents, deleteSiblings, detach, extractNode, extractNode, extractNode, extractNodeContents, getAncestors, getAttribute, getAttributeNames, getChild, getFarthestInlineAncestor, getFirstAncestor, getFirstDescendant, getFirstLeaf, getFirstLeaf, getInnerText, getInstance, getLastLeaf, getLastLeaf, getLength, getNearestBlockContainer, getNearestCommonAncestor, getNearestFlowContainer, getNextLeaf, getNextLeaf, getNextNode, getNodeIndex, getNormalizedChildCount, getNormalizedNodeIndex, getPreviousLeaf, getPreviousLeaf, getPreviousNode, getTextRange, hasAttribute, hasAttributes, importNode, insertAfter, insertAt, isBlock, isBlockLevelInlineContainer, isFlowContainer, isInline, isSerializable, isSpecialBlock, scrollIntoView, setAttribute, setInnerHTML, splitNode, splitNode
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MozillaDOMUtils

public MozillaDOMUtils()
Method Detail

getComputedStyleProperty

public java.lang.String getComputedStyleProperty(Element el,
                                                 java.lang.String propertyName)
Returns the value of the specified CSS property for the given element as it is computed by the browser before it displays that element. The CSS property doesn't have to be applied explicitly or directly on the given element. It can be inherited or assumed by default on that element.
NOTE: You have to pass the JavaScript name of the property and not its CSS name. The JavaScript name has camel case style (fontWeight) and it is used like this object.style.propertyJSName = value. The CSS name has dash style (font-weight) and it is used like this propertyCSSName: value;.

Specified by:
getComputedStyleProperty in class DOMUtils
Parameters:
el - the element for which we retrieve the property value.
propertyName - the script name of the CSS property whose value is returned.
Returns:
the computed value of the specified CSS property for the given element.
See Also:
DOMUtils.getComputedStyleProperty(Element, String)

splitHTMLNode

public com.google.gwt.dom.client.Node splitHTMLNode(com.google.gwt.dom.client.Node parent,
                                                    com.google.gwt.dom.client.Node descendant,
                                                    int offset)
Given a subtree specified by its root parent and one of the inner nodes, this method splits the subtree by the path from the given descendant (inner node) to the root parent. Additionally to what DOMUtils.splitNode(Node, Node, int)) does this method ensures that both subtrees are editable in design mode. This method is required because some browsers like Firefox prevent the user from placing the caret inside empty block elements such as paragraphs or headers. This empty block elements can be obtained by splitting at the beginning or at the end of such a block element.

Overrides:
splitHTMLNode in class DOMUtils
Parameters:
parent - the parent node of the subtree's root
descendant - an inner node within the specified subtree
offset - the offset within the given descendant. It can be either a character index or a child index depending on the descendant node type.
Returns:
the node resulted from splitting the descendant
See Also:
DOMUtils.splitHTMLNode(Node, Node, int)

ensureBlockIsEditable

public void ensureBlockIsEditable(Element block)
Ensures the given block-level element can be edited in design mode. This method is required because in some browsers you can't place the caret inside elements that don't have any visible content and thus you cannot edit them.

Overrides:
ensureBlockIsEditable in class DOMUtils
Parameters:
block - a block-level DOM element
See Also:
DOMUtils.ensureBlockIsEditable(Element)


Copyright © 2004-2009 XWiki. All Rights Reserved.