| Index: sky/engine/core/dom/Element.cpp
|
| diff --git a/sky/engine/core/dom/Element.cpp b/sky/engine/core/dom/Element.cpp
|
| index 86f1b1e4214ab52aba5f13047c4aa92945853b6b..b1b22884aca70a24e0e279d823cb55ae0704e2be 100644
|
| --- a/sky/engine/core/dom/Element.cpp
|
| +++ b/sky/engine/core/dom/Element.cpp
|
| @@ -44,6 +44,7 @@
|
| #include "sky/engine/core/dom/Attr.h"
|
| #include "sky/engine/core/dom/ClientRect.h"
|
| #include "sky/engine/core/dom/ClientRectList.h"
|
| +#include "sky/engine/core/dom/Document.h"
|
| #include "sky/engine/core/dom/ElementDataCache.h"
|
| #include "sky/engine/core/dom/ElementRareData.h"
|
| #include "sky/engine/core/dom/ElementTraversal.h"
|
| @@ -164,7 +165,9 @@ void Element::setTabIndex(int value)
|
|
|
| short Element::tabIndex() const
|
| {
|
| - return hasRareData() ? elementRareData()->tabIndex() : 0;
|
| + if (supportsFocus())
|
| + return hasRareData() ? elementRareData()->tabIndex() : 0;
|
| + return -1;
|
| }
|
|
|
| bool Element::rendererIsFocusable() const
|
| @@ -273,6 +276,86 @@ void Element::synchronizeAllAttributes() const
|
| synchronizeAttribute(HTMLNames::styleAttr.localName());
|
| }
|
|
|
| +String Element::title() const
|
| +{
|
| + return getAttribute(HTMLNames::titleAttr);
|
| +}
|
| +
|
| +String Element::contentEditable() const
|
| +{
|
| + const AtomicString& value = getAttribute(HTMLNames::contenteditableAttr);
|
| +
|
| + if (value.isNull())
|
| + return "inherit";
|
| + if (value.isEmpty() || equalIgnoringCase(value, "true"))
|
| + return "true";
|
| + if (equalIgnoringCase(value, "false"))
|
| + return "false";
|
| + if (equalIgnoringCase(value, "plaintext-only"))
|
| + return "plaintext-only";
|
| +
|
| + return "inherit";
|
| +}
|
| +
|
| +void Element::setContentEditable(const String& enabled, ExceptionState& exceptionState)
|
| +{
|
| + if (equalIgnoringCase(enabled, "true"))
|
| + setAttribute(HTMLNames::contenteditableAttr, "true");
|
| + else if (equalIgnoringCase(enabled, "false"))
|
| + setAttribute(HTMLNames::contenteditableAttr, "false");
|
| + else if (equalIgnoringCase(enabled, "plaintext-only"))
|
| + setAttribute(HTMLNames::contenteditableAttr, "plaintext-only");
|
| + else if (equalIgnoringCase(enabled, "inherit"))
|
| + removeAttribute(HTMLNames::contenteditableAttr);
|
| + else
|
| + exceptionState.throwDOMException(SyntaxError, "The value provided ('" + enabled + "') is not one of 'true', 'false', 'plaintext-only', or 'inherit'.");
|
| +}
|
| +
|
| +bool Element::spellcheck() const
|
| +{
|
| + return isSpellCheckingEnabled();
|
| +}
|
| +
|
| +void Element::setSpellcheck(bool enable)
|
| +{
|
| + setAttribute(HTMLNames::spellcheckAttr, enable ? "true" : "false");
|
| +}
|
| +
|
| +
|
| +void Element::click()
|
| +{
|
| + dispatchSimulatedClick(0, SendNoEvents);
|
| +}
|
| +
|
| +// Returns the conforming 'dir' value associated with the state the attribute is in (in its canonical case), if any,
|
| +// or the empty string if the attribute is in a state that has no associated keyword value or if the attribute is
|
| +// not in a defined state (e.g. the attribute is missing and there is no missing value default).
|
| +// http://www.whatwg.org/specs/web-apps/current-work/multipage/common-dom-interfaces.html#limited-to-only-known-values
|
| +static inline const AtomicString& toValidDirValue(const AtomicString& value)
|
| +{
|
| + DEFINE_STATIC_LOCAL(const AtomicString, ltrValue, ("ltr", AtomicString::ConstructFromLiteral));
|
| + DEFINE_STATIC_LOCAL(const AtomicString, rtlValue, ("rtl", AtomicString::ConstructFromLiteral));
|
| + DEFINE_STATIC_LOCAL(const AtomicString, autoValue, ("auto", AtomicString::ConstructFromLiteral));
|
| +
|
| + if (equalIgnoringCase(value, ltrValue))
|
| + return ltrValue;
|
| + if (equalIgnoringCase(value, rtlValue))
|
| + return rtlValue;
|
| + if (equalIgnoringCase(value, autoValue))
|
| + return autoValue;
|
| + return nullAtom;
|
| +}
|
| +
|
| +const AtomicString& Element::dir()
|
| +{
|
| + return toValidDirValue(getAttribute(HTMLNames::dirAttr));
|
| +}
|
| +
|
| +void Element::setDir(const AtomicString& value)
|
| +{
|
| + setAttribute(HTMLNames::dirAttr, value);
|
| +}
|
| +
|
| int Element::offsetLeft()
|
| {
|
| document().updateLayoutIgnorePendingStylesheets();
|
|
|