Figure out if node is focusable without requiring renderer
https://bugs.webkit.org/show_bug.cgi?id=126118
Reviewed by Andreas Kling.
* dom/Element.cpp:
(WebCore::Element::computedStyle):
Use inDocument() test instead of the attached() test. We can compute style for anything that
is in document.
* dom/Node.cpp:
(WebCore::Node::isContentEditable):
(WebCore::Node::isContentRichlyEditable):
(WebCore::Node::hasEditableStyle):
Use computedStyle instead of getting the style from renderer. Computed style gets constructed
on demand if renderer does not exist. If it does then the existing style is used.
(WebCore::Node::isEditableToAccessibility):
(WebCore::Node::canStartSelection):
(WebCore::Node::isRootEditableElement):
(WebCore::Node::rootEditableElement):
* dom/Node.h:
(WebCore::Node::hasEditableStyle):
(WebCore::Node::hasRichlyEditableStyle):
Renamed from rendererIsEditable since these no longer require renderer.
(WebCore::HTMLElement::supportsFocus):
Stop calling updateStyleIfNeeded() and forcing render tree construction.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@160966 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/editing/AppendNodeCommand.cpp b/Source/WebCore/editing/AppendNodeCommand.cpp
index af3ce1f..15a5233 100644
--- a/Source/WebCore/editing/AppendNodeCommand.cpp
+++ b/Source/WebCore/editing/AppendNodeCommand.cpp
@@ -42,7 +42,7 @@
ASSERT(m_node);
ASSERT(!m_node->parentNode());
- ASSERT(m_parent->rendererIsEditable() || !m_parent->attached());
+ ASSERT(m_parent->hasEditableStyle() || !m_parent->attached());
}
static void sendAXTextChangedIgnoringLineBreaks(Node* node, AXObjectCache::AXTextChange textChange)
@@ -58,7 +58,7 @@
void AppendNodeCommand::doApply()
{
- if (!m_parent->rendererIsEditable() && m_parent->attached())
+ if (!m_parent->hasEditableStyle() && m_parent->attached())
return;
m_parent->appendChild(m_node.get(), IGNORE_EXCEPTION);
@@ -69,7 +69,7 @@
void AppendNodeCommand::doUnapply()
{
- if (!m_parent->rendererIsEditable())
+ if (!m_parent->hasEditableStyle())
return;
// Need to notify this before actually deleting the text