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/ChangeLog b/Source/WebCore/ChangeLog
index b3b52cb..a6d11a9 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,3 +1,38 @@
+2013-12-21 Antti Koivisto <antti@apple.com>
+
+ 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.
+
2013-12-21 Carlos Garcia Campos <cgarcia@igalia.com>
[SOUP] ResourceHandleSoup should use async client callbacks when client uses async callbacks
diff --git a/Source/WebCore/accessibility/AccessibilityNodeObject.cpp b/Source/WebCore/accessibility/AccessibilityNodeObject.cpp
index e82c3c8..9a0b32e 100644
--- a/Source/WebCore/accessibility/AccessibilityNodeObject.cpp
+++ b/Source/WebCore/accessibility/AccessibilityNodeObject.cpp
@@ -150,7 +150,7 @@
axObjectCache()->postNotification(parent, parent->document(), AXObjectCache::AXLiveRegionChanged);
// If this element is an ARIA text control, notify the AT of changes.
- if (parent->isARIATextControl() && !parent->isNativeTextControl() && !parent->node()->rendererIsEditable())
+ if (parent->isARIATextControl() && !parent->isNativeTextControl() && !parent->node()->hasEditableStyle())
axObjectCache()->postNotification(parent, parent->document(), AXObjectCache::AXValueChanged);
}
}
@@ -737,7 +737,7 @@
return input->isReadOnly();
}
- return !node->rendererIsEditable();
+ return !node->hasEditableStyle();
}
bool AccessibilityNodeObject::isRequired() const
@@ -2048,7 +2048,7 @@
return role;
}
-// If you call node->rendererIsEditable() since that will return true if an ancestor is editable.
+// If you call node->hasEditableStyle() since that will return true if an ancestor is editable.
// This only returns true if this is the element that actually has the contentEditable attribute set.
bool AccessibilityNodeObject::hasContentEditableAttributeSet() const
{
diff --git a/Source/WebCore/accessibility/AccessibilityRenderObject.cpp b/Source/WebCore/accessibility/AccessibilityRenderObject.cpp
index af57678..403be16 100644
--- a/Source/WebCore/accessibility/AccessibilityRenderObject.cpp
+++ b/Source/WebCore/accessibility/AccessibilityRenderObject.cpp
@@ -542,11 +542,11 @@
if (isWebArea()) {
if (HTMLElement* body = m_renderer->document().body()) {
- if (body->rendererIsEditable())
+ if (body->hasEditableStyle())
return false;
}
- return !m_renderer->document().rendererIsEditable();
+ return !m_renderer->document().hasEditableStyle();
}
return AccessibilityNodeObject::isReadOnly();
@@ -1255,7 +1255,7 @@
return false;
// Anything that is content editable should not be ignored.
- // However, one cannot just call node->rendererIsEditable() since that will ask if its parents
+ // However, one cannot just call node->hasEditableStyle() since that will ask if its parents
// are also editable. Only the top level content editable region should be exposed.
if (hasContentEditableAttributeSet())
return false;
@@ -2744,7 +2744,7 @@
if (parent->supportsARIALiveRegion())
cache->postNotification(renderParent, AXObjectCache::AXLiveRegionChanged);
- if (parent->isARIATextControl() && !parent->isNativeTextControl() && !parent->node()->rendererIsEditable())
+ if (parent->isARIATextControl() && !parent->isNativeTextControl() && !parent->node()->hasEditableStyle())
cache->postNotification(renderParent, AXObjectCache::AXValueChanged);
}
}
diff --git a/Source/WebCore/accessibility/AccessibilityTable.cpp b/Source/WebCore/accessibility/AccessibilityTable.cpp
index 4091946..7f432da 100644
--- a/Source/WebCore/accessibility/AccessibilityTable.cpp
+++ b/Source/WebCore/accessibility/AccessibilityTable.cpp
@@ -102,7 +102,7 @@
// When a section of the document is contentEditable, all tables should be
// treated as data tables, otherwise users may not be able to work with rich
// text editors that allow creating and editing tables.
- if (node() && node()->rendererIsEditable())
+ if (node() && node()->hasEditableStyle())
return true;
// This employs a heuristic to determine if this table should appear.
diff --git a/Source/WebCore/dom/Document.cpp b/Source/WebCore/dom/Document.cpp
index cddcee0..f83c90c 100644
--- a/Source/WebCore/dom/Document.cpp
+++ b/Source/WebCore/dom/Document.cpp
@@ -328,7 +328,7 @@
static bool acceptsEditingFocus(Node* node)
{
ASSERT(node);
- ASSERT(node->rendererIsEditable());
+ ASSERT(node->hasEditableStyle());
Node* root = node->rootEditableElement();
Frame* frame = node->document().frame();
diff --git a/Source/WebCore/dom/Element.cpp b/Source/WebCore/dom/Element.cpp
index 2d07af2..b58f164 100644
--- a/Source/WebCore/dom/Element.cpp
+++ b/Source/WebCore/dom/Element.cpp
@@ -2148,7 +2148,7 @@
return usedStyle;
}
- if (!attached()) {
+ if (!inDocument()) {
// FIXME: Try to do better than this. Ensure that styleForElement() works for elements that are not in the
// document tree and figure out when to destroy the computed style for such elements.
return nullptr;
diff --git a/Source/WebCore/dom/Node.cpp b/Source/WebCore/dom/Node.cpp
index b9e536c..d9dbc91 100644
--- a/Source/WebCore/dom/Node.cpp
+++ b/Source/WebCore/dom/Node.cpp
@@ -56,6 +56,7 @@
#include "KeyboardEvent.h"
#include "Logging.h"
#include "MutationEvent.h"
+#include "NodeRenderStyle.h"
#include "PlatformMouseEvent.h"
#include "PlatformWheelEvent.h"
#include "ProcessingInstruction.h"
@@ -543,13 +544,13 @@
bool Node::isContentEditable(UserSelectAllTreatment treatment)
{
document().updateStyleIfNeeded();
- return rendererIsEditable(Editable, treatment);
+ return hasEditableStyle(Editable, treatment);
}
bool Node::isContentRichlyEditable()
{
document().updateStyleIfNeeded();
- return rendererIsEditable(RichlyEditable, UserSelectAllIsAlwaysNonEditable);
+ return hasEditableStyle(RichlyEditable, UserSelectAllIsAlwaysNonEditable);
}
void Node::inspect()
@@ -560,8 +561,10 @@
#endif
}
-bool Node::rendererIsEditable(EditableLevel editableLevel, UserSelectAllTreatment treatment) const
+bool Node::hasEditableStyle(EditableLevel editableLevel, UserSelectAllTreatment treatment) const
{
+ if (!document().hasLivingRenderTree())
+ return false;
if (document().frame() && document().frame()->page() && document().frame()->page()->isEditable() && !containingShadowRoot())
return true;
@@ -573,34 +576,36 @@
// would fire in the middle of Document::setFocusedElement().
for (const Node* node = this; node; node = node->parentNode()) {
- if ((node->isHTMLElement() || node->isDocumentNode()) && node->renderer()) {
+ RenderStyle* style = node->isDocumentNode() ? node->renderStyle() : const_cast<Node*>(node)->computedStyle();
+ if (!style)
+ continue;
+ if (style->display() == NONE)
+ continue;
#if ENABLE(USERSELECT_ALL)
- // Elements with user-select: all style are considered atomic
- // therefore non editable.
- if (treatment == UserSelectAllIsAlwaysNonEditable && node->renderer()->style().userSelect() == SELECT_ALL)
- return false;
-#else
- UNUSED_PARAM(treatment);
-#endif
- switch (node->renderer()->style().userModify()) {
- case READ_ONLY:
- return false;
- case READ_WRITE:
- return true;
- case READ_WRITE_PLAINTEXT_ONLY:
- return editableLevel != RichlyEditable;
- }
- ASSERT_NOT_REACHED();
+ // Elements with user-select: all style are considered atomic
+ // therefore non editable.
+ if (treatment == UserSelectAllIsAlwaysNonEditable && style->userSelect() == SELECT_ALL)
return false;
+#else
+ UNUSED_PARAM(treatment);
+#endif
+ switch (style->userModify()) {
+ case READ_ONLY:
+ return false;
+ case READ_WRITE:
+ return true;
+ case READ_WRITE_PLAINTEXT_ONLY:
+ return editableLevel != RichlyEditable;
}
+ ASSERT_NOT_REACHED();
+ return false;
}
-
return false;
}
bool Node::isEditableToAccessibility(EditableLevel editableLevel) const
{
- if (rendererIsEditable(editableLevel))
+ if (hasEditableStyle(editableLevel))
return true;
// FIXME: Respect editableLevel for ARIA editable elements.
@@ -921,7 +926,7 @@
// is obviously misplaced.
bool Node::canStartSelection() const
{
- if (rendererIsEditable())
+ if (hasEditableStyle())
return true;
if (renderer()) {
@@ -1017,7 +1022,7 @@
bool Node::isRootEditableElement() const
{
- return rendererIsEditable() && isElementNode() && (!parentNode() || !parentNode()->rendererIsEditable()
+ return hasEditableStyle() && isElementNode() && (!parentNode() || !parentNode()->hasEditableStyle()
|| !parentNode()->isElementNode() || hasTagName(bodyTag));
}
@@ -1034,7 +1039,7 @@
Element* Node::rootEditableElement() const
{
Element* result = 0;
- for (Node* n = const_cast<Node*>(this); n && n->rendererIsEditable(); n = n->parentNode()) {
+ for (Node* n = const_cast<Node*>(this); n && n->hasEditableStyle(); n = n->parentNode()) {
if (n->isElementNode())
result = toElement(n);
if (n->hasTagName(bodyTag))
diff --git a/Source/WebCore/dom/Node.h b/Source/WebCore/dom/Node.h
index f6617de..830f84f 100644
--- a/Source/WebCore/dom/Node.h
+++ b/Source/WebCore/dom/Node.h
@@ -341,11 +341,11 @@
void inspect();
- bool rendererIsEditable(EditableType editableType = ContentIsEditable, UserSelectAllTreatment treatment = UserSelectAllIsAlwaysNonEditable) const
+ bool hasEditableStyle(EditableType editableType = ContentIsEditable, UserSelectAllTreatment treatment = UserSelectAllIsAlwaysNonEditable) const
{
switch (editableType) {
case ContentIsEditable:
- return rendererIsEditable(Editable, treatment);
+ return hasEditableStyle(Editable, treatment);
case HasEditableAXRole:
return isEditableToAccessibility(Editable);
}
@@ -353,11 +353,11 @@
return false;
}
- bool rendererIsRichlyEditable(EditableType editableType = ContentIsEditable) const
+ bool hasRichlyEditableStyle(EditableType editableType = ContentIsEditable) const
{
switch (editableType) {
case ContentIsEditable:
- return rendererIsEditable(RichlyEditable, UserSelectAllIsAlwaysNonEditable);
+ return hasEditableStyle(RichlyEditable, UserSelectAllIsAlwaysNonEditable);
case HasEditableAXRole:
return isEditableToAccessibility(RichlyEditable);
}
@@ -654,7 +654,7 @@
bool hasTreeSharedParent() const { return !!parentNode(); }
enum EditableLevel { Editable, RichlyEditable };
- bool rendererIsEditable(EditableLevel, UserSelectAllTreatment = UserSelectAllIsAlwaysNonEditable) const;
+ bool hasEditableStyle(EditableLevel, UserSelectAllTreatment = UserSelectAllIsAlwaysNonEditable) const;
bool isEditableToAccessibility(EditableLevel) const;
virtual void refEventTarget() OVERRIDE;
diff --git a/Source/WebCore/dom/Position.cpp b/Source/WebCore/dom/Position.cpp
index e16a677..287b37b 100644
--- a/Source/WebCore/dom/Position.cpp
+++ b/Source/WebCore/dom/Position.cpp
@@ -67,7 +67,7 @@
{
while ((node = nextLeafNode(node))) {
RenderObject* renderer = node->renderer();
- if (!renderer || !node->rendererIsEditable())
+ if (!renderer || !node->hasEditableStyle())
continue;
if (hasInlineBoxWrapper(*renderer))
return node;
@@ -79,7 +79,7 @@
{
while ((node = previousLeafNode(node))) {
RenderObject* renderer = node->renderer();
- if (!renderer || !node->rendererIsEditable())
+ if (!renderer || !node->hasEditableStyle())
continue;
if (hasInlineBoxWrapper(*renderer))
return node;
@@ -434,15 +434,15 @@
bool Position::atEditingBoundary() const
{
Position nextPosition = downstream(CanCrossEditingBoundary);
- if (atFirstEditingPositionForNode() && nextPosition.isNotNull() && !nextPosition.deprecatedNode()->rendererIsEditable())
+ if (atFirstEditingPositionForNode() && nextPosition.isNotNull() && !nextPosition.deprecatedNode()->hasEditableStyle())
return true;
Position prevPosition = upstream(CanCrossEditingBoundary);
- if (atLastEditingPositionForNode() && prevPosition.isNotNull() && !prevPosition.deprecatedNode()->rendererIsEditable())
+ if (atLastEditingPositionForNode() && prevPosition.isNotNull() && !prevPosition.deprecatedNode()->hasEditableStyle())
return true;
- return nextPosition.isNotNull() && !nextPosition.deprecatedNode()->rendererIsEditable()
- && prevPosition.isNotNull() && !prevPosition.deprecatedNode()->rendererIsEditable();
+ return nextPosition.isNotNull() && !nextPosition.deprecatedNode()->hasEditableStyle()
+ && prevPosition.isNotNull() && !prevPosition.deprecatedNode()->hasEditableStyle();
}
Node* Position::parentEditingBoundary() const
@@ -455,7 +455,7 @@
return 0;
Node* boundary = m_anchorNode.get();
- while (boundary != documentElement && boundary->nonShadowBoundaryParentNode() && m_anchorNode->rendererIsEditable() == boundary->parentNode()->rendererIsEditable())
+ while (boundary != documentElement && boundary->nonShadowBoundaryParentNode() && m_anchorNode->hasEditableStyle() == boundary->parentNode()->hasEditableStyle())
boundary = boundary->nonShadowBoundaryParentNode();
return boundary;
@@ -590,17 +590,17 @@
// FIXME: PositionIterator should respect Before and After positions.
PositionIterator lastVisible = m_anchorType == PositionIsAfterAnchor ? createLegacyEditingPosition(m_anchorNode.get(), caretMaxOffset(m_anchorNode.get())) : *this;
PositionIterator currentPos = lastVisible;
- bool startEditable = startNode->rendererIsEditable();
+ bool startEditable = startNode->hasEditableStyle();
Node* lastNode = startNode;
bool boundaryCrossed = false;
for (; !currentPos.atStart(); currentPos.decrement()) {
Node* currentNode = currentPos.node();
// Don't check for an editability change if we haven't moved to a different node,
- // to avoid the expense of computing rendererIsEditable().
+ // to avoid the expense of computing hasEditableStyle().
if (currentNode != lastNode) {
// Don't change editability.
- bool currentEditable = currentNode->rendererIsEditable();
+ bool currentEditable = currentNode->hasEditableStyle();
if (startEditable != currentEditable) {
if (rule == CannotCrossEditingBoundary)
break;
@@ -717,17 +717,17 @@
// FIXME: PositionIterator should respect Before and After positions.
PositionIterator lastVisible = m_anchorType == PositionIsAfterAnchor ? createLegacyEditingPosition(m_anchorNode.get(), caretMaxOffset(m_anchorNode.get())) : *this;
PositionIterator currentPos = lastVisible;
- bool startEditable = startNode->rendererIsEditable();
+ bool startEditable = startNode->hasEditableStyle();
Node* lastNode = startNode;
bool boundaryCrossed = false;
for (; !currentPos.atEnd(); currentPos.increment()) {
Node* currentNode = currentPos.node();
// Don't check for an editability change if we haven't moved to a different node,
- // to avoid the expense of computing rendererIsEditable().
+ // to avoid the expense of computing hasEditableStyle().
if (currentNode != lastNode) {
// Don't change editability.
- bool currentEditable = currentNode->rendererIsEditable();
+ bool currentEditable = currentNode->hasEditableStyle();
if (startEditable != currentEditable) {
if (rule == CannotCrossEditingBoundary)
break;
@@ -942,10 +942,10 @@
if (block.logicalHeight() || m_anchorNode->hasTagName(bodyTag)) {
if (!Position::hasRenderedNonAnonymousDescendantsWithHeight(block))
return atFirstEditingPositionForNode() && !Position::nodeIsUserSelectNone(deprecatedNode());
- return m_anchorNode->rendererIsEditable() && !Position::nodeIsUserSelectNone(deprecatedNode()) && atEditingBoundary();
+ return m_anchorNode->hasEditableStyle() && !Position::nodeIsUserSelectNone(deprecatedNode()) && atEditingBoundary();
}
} else
- return m_anchorNode->rendererIsEditable() && !Position::nodeIsUserSelectNone(deprecatedNode()) && atEditingBoundary();
+ return m_anchorNode->hasEditableStyle() && !Position::nodeIsUserSelectNone(deprecatedNode()) && atEditingBoundary();
return false;
}
diff --git a/Source/WebCore/dom/PositionIterator.cpp b/Source/WebCore/dom/PositionIterator.cpp
index 5464c08..5e7ff75 100644
--- a/Source/WebCore/dom/PositionIterator.cpp
+++ b/Source/WebCore/dom/PositionIterator.cpp
@@ -165,7 +165,7 @@
if (block.logicalHeight() || m_anchorNode->hasTagName(bodyTag)) {
if (!Position::hasRenderedNonAnonymousDescendantsWithHeight(block))
return atStartOfNode() && !Position::nodeIsUserSelectNone(m_anchorNode);
- return m_anchorNode->rendererIsEditable() && !Position::nodeIsUserSelectNone(m_anchorNode) && Position(*this).atEditingBoundary();
+ return m_anchorNode->hasEditableStyle() && !Position::nodeIsUserSelectNone(m_anchorNode) && Position(*this).atEditingBoundary();
}
}
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
diff --git a/Source/WebCore/editing/ApplyStyleCommand.cpp b/Source/WebCore/editing/ApplyStyleCommand.cpp
index 3f84dc8..a9f152c 100644
--- a/Source/WebCore/editing/ApplyStyleCommand.cpp
+++ b/Source/WebCore/editing/ApplyStyleCommand.cpp
@@ -711,12 +711,12 @@
static bool containsNonEditableRegion(Node* node)
{
- if (!node->rendererIsEditable())
+ if (!node->hasEditableStyle())
return true;
Node* sibling = NodeTraversal::nextSkippingChildren(node);
for (Node* descendent = node->firstChild(); descendent && descendent != sibling; descendent = NodeTraversal::next(descendent)) {
- if (!descendent->rendererIsEditable())
+ if (!descendent->hasEditableStyle())
return true;
}
@@ -757,10 +757,10 @@
for (RefPtr<Node> next; node && node != pastEndNode; node = next) {
next = NodeTraversal::next(node.get());
- if (!node->renderer() || !node->rendererIsEditable())
+ if (!node->renderer() || !node->hasEditableStyle())
continue;
- if (!node->rendererIsRichlyEditable() && node->isHTMLElement()) {
+ if (!node->hasRichlyEditableStyle() && node->isHTMLElement()) {
// This is a plaintext-only region. Only proceed if it's fully selected.
// pastEndNode is the node after the last fully selected node, so if it's inside node then
// node isn't fully selected.
@@ -780,7 +780,7 @@
continue;
if (node->childNodeCount()) {
- if (node->contains(pastEndNode.get()) || containsNonEditableRegion(node.get()) || !node->parentNode()->rendererIsEditable())
+ if (node->contains(pastEndNode.get()) || containsNonEditableRegion(node.get()) || !node->parentNode()->hasEditableStyle())
continue;
if (editingIgnoresContent(node.get())) {
next = NodeTraversal::nextSkippingChildren(node.get());
@@ -1360,13 +1360,13 @@
RefPtr<Node> nextSibling = element->nextSibling();
RefPtr<Node> previousSibling = element->previousSibling();
- if (nextSibling && nextSibling->isElementNode() && nextSibling->rendererIsEditable()
+ if (nextSibling && nextSibling->isElementNode() && nextSibling->hasEditableStyle()
&& areIdenticalElements(element.get(), toElement(nextSibling.get())))
mergeIdenticalElements(element.get(), toElement(nextSibling.get()));
- if (previousSibling && previousSibling->isElementNode() && previousSibling->rendererIsEditable()) {
+ if (previousSibling && previousSibling->isElementNode() && previousSibling->hasEditableStyle()) {
Node* mergedElement = previousSibling->nextSibling();
- if (mergedElement->isElementNode() && mergedElement->rendererIsEditable()
+ if (mergedElement->isElementNode() && mergedElement->hasEditableStyle()
&& areIdenticalElements(toElement(previousSibling.get()), toElement(mergedElement)))
mergeIdenticalElements(toElement(previousSibling.get()), toElement(mergedElement));
}
diff --git a/Source/WebCore/editing/CompositeEditCommand.cpp b/Source/WebCore/editing/CompositeEditCommand.cpp
index 05f2eaa..a630747 100644
--- a/Source/WebCore/editing/CompositeEditCommand.cpp
+++ b/Source/WebCore/editing/CompositeEditCommand.cpp
@@ -1278,7 +1278,7 @@
// FIXME: Can't we do something better when the immediate parent wasn't a list node?
if (!listNode
|| (!listNode->hasTagName(ulTag) && !listNode->hasTagName(olTag))
- || !listNode->rendererIsEditable()
+ || !listNode->hasEditableStyle()
|| listNode == emptyListItem->rootEditableElement())
return false;
diff --git a/Source/WebCore/editing/DeleteButtonController.cpp b/Source/WebCore/editing/DeleteButtonController.cpp
index 09488e7..ef786b9 100644
--- a/Source/WebCore/editing/DeleteButtonController.cpp
+++ b/Source/WebCore/editing/DeleteButtonController.cpp
@@ -61,7 +61,7 @@
static bool isDeletableElement(const Node* node)
{
- if (!node || !node->isHTMLElement() || !node->inDocument() || !node->rendererIsEditable())
+ if (!node || !node->isHTMLElement() || !node->inDocument() || !node->hasEditableStyle())
return false;
// In general we want to only draw the UI around object of a certain area, but we still keep the min width/height to
@@ -152,7 +152,7 @@
// The enclosingNodeOfType function only works on nodes that are editable
// (which is strange, given its name).
- if (!container->rendererIsEditable())
+ if (!container->hasEditableStyle())
return 0;
Node* element = enclosingNodeOfType(firstPositionInNode(container), &isDeletableElement);
diff --git a/Source/WebCore/editing/DeleteFromTextNodeCommand.cpp b/Source/WebCore/editing/DeleteFromTextNodeCommand.cpp
index 27f42a3..a9bcfbc 100644
--- a/Source/WebCore/editing/DeleteFromTextNodeCommand.cpp
+++ b/Source/WebCore/editing/DeleteFromTextNodeCommand.cpp
@@ -67,7 +67,7 @@
{
ASSERT(m_node);
- if (!m_node->rendererIsEditable())
+ if (!m_node->hasEditableStyle())
return;
m_node->insertData(m_offset, m_text, IGNORE_EXCEPTION);
diff --git a/Source/WebCore/editing/DeleteSelectionCommand.cpp b/Source/WebCore/editing/DeleteSelectionCommand.cpp
index 71ee901..b3ac500 100644
--- a/Source/WebCore/editing/DeleteSelectionCommand.cpp
+++ b/Source/WebCore/editing/DeleteSelectionCommand.cpp
@@ -340,7 +340,7 @@
{
ASSERT(node);
Node* next = node;
- while (next && !next->rendererIsEditable())
+ while (next && !next->hasEditableStyle())
next = NodeTraversal::next(next, node);
return next ? firstPositionInOrBeforeNode(next) : Position();
}
@@ -352,7 +352,7 @@
if (m_startRoot != m_endRoot && !(node->isDescendantOf(m_startRoot.get()) && node->isDescendantOf(m_endRoot.get()))) {
// If a node is not in both the start and end editable roots, remove it only if its inside an editable region.
- if (!node->parentNode()->rendererIsEditable()) {
+ if (!node->parentNode()->hasEditableStyle()) {
// Don't remove non-editable atomic nodes.
if (!node->firstChild())
return;
diff --git a/Source/WebCore/editing/EditingStyle.cpp b/Source/WebCore/editing/EditingStyle.cpp
index f2d2af3..adddb12 100644
--- a/Source/WebCore/editing/EditingStyle.cpp
+++ b/Source/WebCore/editing/EditingStyle.cpp
@@ -688,7 +688,7 @@
TriState state = FalseTriState;
bool nodeIsStart = true;
for (Node* node = selection.start().deprecatedNode(); node; node = NodeTraversal::next(node)) {
- if (node->renderer() && node->rendererIsEditable()) {
+ if (node->renderer() && node->hasEditableStyle()) {
ComputedStyleExtractor computedStyle(node);
TriState nodeState = triStateOfStyle(&computedStyle, node->isTextNode() ? EditingStyle::DoNotIgnoreTextOnlyProperties : EditingStyle::IgnoreTextOnlyProperties);
if (nodeIsStart) {
diff --git a/Source/WebCore/editing/Editor.cpp b/Source/WebCore/editing/Editor.cpp
index bfaf496..c713b1b 100644
--- a/Source/WebCore/editing/Editor.cpp
+++ b/Source/WebCore/editing/Editor.cpp
@@ -312,7 +312,7 @@
if (!startContainer || !endContainer)
return false;
- if (!startContainer->rendererIsEditable() || !endContainer->rendererIsEditable())
+ if (!startContainer->hasEditableStyle() || !endContainer->hasEditableStyle())
return false;
if (range->collapsed(IGNORE_EXCEPTION)) {
@@ -2074,7 +2074,7 @@
// If we're not in an editable node, bail.
Node* editableNode = searchRange->startContainer();
- if (!editableNode || !editableNode->rendererIsEditable())
+ if (!editableNode || !editableNode->hasEditableStyle())
return;
if (!isSpellCheckingEnabledFor(editableNode))
@@ -2143,7 +2143,7 @@
// If we're not in an editable node, bail.
Node* editableNode = spellingRange->startContainer();
- if (!editableNode || !editableNode->rendererIsEditable())
+ if (!editableNode || !editableNode->hasEditableStyle())
return;
if (!isSpellCheckingEnabledFor(editableNode))
diff --git a/Source/WebCore/editing/EditorCommand.cpp b/Source/WebCore/editing/EditorCommand.cpp
index dac1359..0150635 100644
--- a/Source/WebCore/editing/EditorCommand.cpp
+++ b/Source/WebCore/editing/EditorCommand.cpp
@@ -255,7 +255,7 @@
if (!renderer || !renderer->isBox())
return 0;
const RenderStyle& style = renderer->style();
- if (!(style.overflowY() == OSCROLL || style.overflowY() == OAUTO || focusedElement->rendererIsEditable()))
+ if (!(style.overflowY() == OSCROLL || style.overflowY() == OAUTO || focusedElement->hasEditableStyle()))
return 0;
int height = std::min<int>(toRenderBox(renderer)->clientHeight(), frame.view()->visibleHeight());
return static_cast<unsigned>(std::max(std::max<int>(height * Scrollbar::minFractionToStepWhenPaging(), height - Scrollbar::maxOverlapBetweenPages()), 1));
diff --git a/Source/WebCore/editing/FormatBlockCommand.cpp b/Source/WebCore/editing/FormatBlockCommand.cpp
index 6931bd2b..e94a4ee 100644
--- a/Source/WebCore/editing/FormatBlockCommand.cpp
+++ b/Source/WebCore/editing/FormatBlockCommand.cpp
@@ -149,14 +149,14 @@
{
Node* lastBlock = startNode;
for (Node* n = startNode; n; n = n->parentNode()) {
- if (!n->rendererIsEditable())
+ if (!n->hasEditableStyle())
return lastBlock;
- if (isTableCell(n) || n->hasTagName(bodyTag) || !n->parentNode() || !n->parentNode()->rendererIsEditable() || isElementForFormatBlock(n))
+ if (isTableCell(n) || n->hasTagName(bodyTag) || !n->parentNode() || !n->parentNode()->hasEditableStyle() || isElementForFormatBlock(n))
return n;
if (isBlock(n))
lastBlock = n;
if (isListElement(n))
- return n->parentNode()->rendererIsEditable() ? n->parentNode() : n;
+ return n->parentNode()->hasEditableStyle() ? n->parentNode() : n;
}
return lastBlock;
}
diff --git a/Source/WebCore/editing/FrameSelection.cpp b/Source/WebCore/editing/FrameSelection.cpp
index 1f0e505..36d6994 100644
--- a/Source/WebCore/editing/FrameSelection.cpp
+++ b/Source/WebCore/editing/FrameSelection.cpp
@@ -1589,7 +1589,7 @@
return;
// This method's purpose is it to make it easier to select iframes (in order to delete them). Don't do anything if the iframe isn't deletable.
- if (!ownerElementParent->rendererIsEditable())
+ if (!ownerElementParent->hasEditableStyle())
return;
// Create compute positions before and after the element.
@@ -2024,7 +2024,7 @@
Document* document = m_frame->document();
bool caretBrowsing = m_frame->settings().caretBrowsingEnabled();
- if (!isNone() || !(document->rendererIsEditable() || caretBrowsing))
+ if (!isNone() || !(document->hasEditableStyle() || caretBrowsing))
return;
Node* node = document->documentElement();
diff --git a/Source/WebCore/editing/FrameSelection.h b/Source/WebCore/editing/FrameSelection.h
index b892dfb..e8805c1 100644
--- a/Source/WebCore/editing/FrameSelection.h
+++ b/Source/WebCore/editing/FrameSelection.h
@@ -133,7 +133,7 @@
Element* rootEditableElement() const { return m_selection.rootEditableElement(); }
Element* rootEditableElementOrDocumentElement() const;
- bool rendererIsEditable() const { return m_selection.rendererIsEditable(); }
+ bool hasEditableStyle() const { return m_selection.hasEditableStyle(); }
bool isContentEditable() const { return m_selection.isContentEditable(); }
bool isContentRichlyEditable() const { return m_selection.isContentRichlyEditable(); }
diff --git a/Source/WebCore/editing/IndentOutdentCommand.cpp b/Source/WebCore/editing/IndentOutdentCommand.cpp
index 70d2722..63958bb 100644
--- a/Source/WebCore/editing/IndentOutdentCommand.cpp
+++ b/Source/WebCore/editing/IndentOutdentCommand.cpp
@@ -125,7 +125,7 @@
VisiblePosition visibleEndOfParagraph = endOfParagraph(visibleStartOfParagraph);
Node* enclosingNode = enclosingNodeOfType(visibleStartOfParagraph.deepEquivalent(), &isListOrIndentBlockquote);
- if (!enclosingNode || !enclosingNode->parentNode()->rendererIsEditable()) // We can't outdent if there is no place to go!
+ if (!enclosingNode || !enclosingNode->parentNode()->hasEditableStyle()) // We can't outdent if there is no place to go!
return;
// Use InsertListCommand to remove the selection from the list
@@ -156,7 +156,7 @@
if (ContainerNode* splitPointParent = splitPoint->parentNode()) {
if (splitPointParent->hasTagName(blockquoteTag)
&& !splitPoint->hasTagName(blockquoteTag)
- && splitPointParent->parentNode()->rendererIsEditable()) // We can't outdent if there is no place to go!
+ && splitPointParent->parentNode()->hasEditableStyle()) // We can't outdent if there is no place to go!
splitElement(toElement(splitPointParent), splitPoint);
}
}
diff --git a/Source/WebCore/editing/InsertIntoTextNodeCommand.cpp b/Source/WebCore/editing/InsertIntoTextNodeCommand.cpp
index d737726..b5d06b2 100644
--- a/Source/WebCore/editing/InsertIntoTextNodeCommand.cpp
+++ b/Source/WebCore/editing/InsertIntoTextNodeCommand.cpp
@@ -53,7 +53,7 @@
if (passwordEchoEnabled)
document().updateLayoutIgnorePendingStylesheets();
- if (!m_node->rendererIsEditable())
+ if (!m_node->hasEditableStyle())
return;
if (passwordEchoEnabled) {
@@ -70,7 +70,7 @@
void InsertIntoTextNodeCommand::doUnapply()
{
- if (!m_node->rendererIsEditable())
+ if (!m_node->hasEditableStyle())
return;
// Need to notify this before actually deleting the text
diff --git a/Source/WebCore/editing/InsertNodeBeforeCommand.cpp b/Source/WebCore/editing/InsertNodeBeforeCommand.cpp
index 86e6822..76c63a5 100644
--- a/Source/WebCore/editing/InsertNodeBeforeCommand.cpp
+++ b/Source/WebCore/editing/InsertNodeBeforeCommand.cpp
@@ -45,7 +45,7 @@
ASSERT(m_refChild);
ASSERT(m_refChild->parentNode());
- ASSERT(m_refChild->parentNode()->rendererIsEditable() || !m_refChild->parentNode()->attached());
+ ASSERT(m_refChild->parentNode()->hasEditableStyle() || !m_refChild->parentNode()->attached());
}
void InsertNodeBeforeCommand::doApply()
diff --git a/Source/WebCore/editing/MergeIdenticalElementsCommand.cpp b/Source/WebCore/editing/MergeIdenticalElementsCommand.cpp
index b168722..1e639eb 100644
--- a/Source/WebCore/editing/MergeIdenticalElementsCommand.cpp
+++ b/Source/WebCore/editing/MergeIdenticalElementsCommand.cpp
@@ -42,7 +42,7 @@
void MergeIdenticalElementsCommand::doApply()
{
- if (m_element1->nextSibling() != m_element2 || !m_element1->rendererIsEditable() || !m_element2->rendererIsEditable())
+ if (m_element1->nextSibling() != m_element2 || !m_element1->hasEditableStyle() || !m_element2->hasEditableStyle())
return;
m_atChild = m_element2->firstChild();
@@ -66,7 +66,7 @@
RefPtr<Node> atChild = m_atChild.release();
ContainerNode* parent = m_element2->parentNode();
- if (!parent || !parent->rendererIsEditable())
+ if (!parent || !parent->hasEditableStyle())
return;
ExceptionCode ec = 0;
diff --git a/Source/WebCore/editing/RemoveNodeCommand.cpp b/Source/WebCore/editing/RemoveNodeCommand.cpp
index 0e1d305..0b330aa 100644
--- a/Source/WebCore/editing/RemoveNodeCommand.cpp
+++ b/Source/WebCore/editing/RemoveNodeCommand.cpp
@@ -59,7 +59,7 @@
{
RefPtr<ContainerNode> parent = m_parent.release();
RefPtr<Node> refChild = m_refChild.release();
- if (!parent || !parent->rendererIsEditable())
+ if (!parent || !parent->hasEditableStyle())
return;
parent->insertBefore(m_node.get(), refChild.get(), IGNORE_EXCEPTION);
diff --git a/Source/WebCore/editing/ReplaceSelectionCommand.cpp b/Source/WebCore/editing/ReplaceSelectionCommand.cpp
index 240b3e5..0cf6d11 100644
--- a/Source/WebCore/editing/ReplaceSelectionCommand.cpp
+++ b/Source/WebCore/editing/ReplaceSelectionCommand.cpp
@@ -160,7 +160,7 @@
if (!editableRoot->getAttributeEventListener(eventNames().webkitBeforeTextInsertedEvent) &&
// FIXME: Remove these checks once textareas and textfields actually register an event handler.
!(shadowAncestorNode && shadowAncestorNode->renderer() && shadowAncestorNode->renderer()->isTextControl()) &&
- editableRoot->rendererIsRichlyEditable()) {
+ editableRoot->hasRichlyEditableStyle()) {
removeInterchangeNodes(m_fragment.get());
return;
}
@@ -181,7 +181,7 @@
// Give the root a chance to change the text.
RefPtr<BeforeTextInsertedEvent> evt = BeforeTextInsertedEvent::create(text);
editableRoot->dispatchEvent(evt, ASSERT_NO_EXCEPTION);
- if (text != evt->text() || !editableRoot->rendererIsRichlyEditable()) {
+ if (text != evt->text() || !editableRoot->hasRichlyEditableStyle()) {
restoreAndRemoveTestRenderingNodesToFragment(holder.get());
RefPtr<Range> range = selection.toNormalizedRange();
@@ -533,7 +533,7 @@
continue;
}
- if (element->parentNode()->rendererIsRichlyEditable())
+ if (element->parentNode()->hasRichlyEditableStyle())
removeNodeAttribute(element, contenteditableAttr);
// WebKit used to not add display: inline and float: none on copy.
diff --git a/Source/WebCore/editing/SplitElementCommand.cpp b/Source/WebCore/editing/SplitElementCommand.cpp
index e9cc53f..6ad8f19 100644
--- a/Source/WebCore/editing/SplitElementCommand.cpp
+++ b/Source/WebCore/editing/SplitElementCommand.cpp
@@ -54,7 +54,7 @@
ExceptionCode ec = 0;
ContainerNode* parent = m_element2->parentNode();
- if (!parent || !parent->rendererIsEditable())
+ if (!parent || !parent->hasEditableStyle())
return;
parent->insertBefore(m_element1.get(), m_element2.get(), ec);
if (ec)
@@ -77,7 +77,7 @@
void SplitElementCommand::doUnapply()
{
- if (!m_element1 || !m_element1->rendererIsEditable() || !m_element2->rendererIsEditable())
+ if (!m_element1 || !m_element1->hasEditableStyle() || !m_element2->hasEditableStyle())
return;
Vector<RefPtr<Node>> children;
diff --git a/Source/WebCore/editing/SplitTextNodeCommand.cpp b/Source/WebCore/editing/SplitTextNodeCommand.cpp
index 2f82cc6..e7108f5 100644
--- a/Source/WebCore/editing/SplitTextNodeCommand.cpp
+++ b/Source/WebCore/editing/SplitTextNodeCommand.cpp
@@ -51,7 +51,7 @@
void SplitTextNodeCommand::doApply()
{
ContainerNode* parent = m_text2->parentNode();
- if (!parent || !parent->rendererIsEditable())
+ if (!parent || !parent->hasEditableStyle())
return;
String prefixText = m_text2->substringData(0, m_offset, IGNORE_EXCEPTION);
@@ -67,7 +67,7 @@
void SplitTextNodeCommand::doUnapply()
{
- if (!m_text1 || !m_text1->rendererIsEditable())
+ if (!m_text1 || !m_text1->hasEditableStyle())
return;
ASSERT(&m_text1->document() == &document());
@@ -86,7 +86,7 @@
return;
ContainerNode* parent = m_text2->parentNode();
- if (!parent || !parent->rendererIsEditable())
+ if (!parent || !parent->hasEditableStyle())
return;
insertText1AndTrimText2();
diff --git a/Source/WebCore/editing/SplitTextNodeContainingElementCommand.cpp b/Source/WebCore/editing/SplitTextNodeContainingElementCommand.cpp
index 53fd7d6..33ab429 100644
--- a/Source/WebCore/editing/SplitTextNodeContainingElementCommand.cpp
+++ b/Source/WebCore/editing/SplitTextNodeContainingElementCommand.cpp
@@ -50,7 +50,7 @@
splitTextNode(m_text.get(), m_offset);
Element* parent = m_text->parentElement();
- if (!parent || !parent->parentElement() || !parent->parentElement()->rendererIsEditable())
+ if (!parent || !parent->parentElement() || !parent->parentElement()->hasEditableStyle())
return;
RenderElement* parentRenderer = parent->renderer();
diff --git a/Source/WebCore/editing/VisiblePosition.cpp b/Source/WebCore/editing/VisiblePosition.cpp
index 90858d9..d8f4a40 100644
--- a/Source/WebCore/editing/VisiblePosition.cpp
+++ b/Source/WebCore/editing/VisiblePosition.cpp
@@ -536,7 +536,7 @@
// The new position must be in the same editable element. Enforce that first.
// Unless the descent is from a non-editable html element to an editable body.
- if (node && node->hasTagName(htmlTag) && !node->rendererIsEditable() && node->document().body() && node->document().body()->rendererIsEditable())
+ if (node && node->hasTagName(htmlTag) && !node->hasEditableStyle() && node->document().body() && node->document().body()->hasEditableStyle())
return next.isNotNull() ? next : prev;
Node* editingRoot = editableRootForPosition(position);
diff --git a/Source/WebCore/editing/VisibleSelection.cpp b/Source/WebCore/editing/VisibleSelection.cpp
index e95da84..2a61d4e 100644
--- a/Source/WebCore/editing/VisibleSelection.cpp
+++ b/Source/WebCore/editing/VisibleSelection.cpp
@@ -626,7 +626,7 @@
return isEditablePosition(start());
}
-bool VisibleSelection::rendererIsEditable() const
+bool VisibleSelection::hasEditableStyle() const
{
return isEditablePosition(start(), ContentIsEditable, DoNotUpdateStyle);
}
diff --git a/Source/WebCore/editing/VisibleSelection.h b/Source/WebCore/editing/VisibleSelection.h
index 9228204..345f82d 100644
--- a/Source/WebCore/editing/VisibleSelection.h
+++ b/Source/WebCore/editing/VisibleSelection.h
@@ -99,7 +99,7 @@
Element* rootEditableElement() const;
bool isContentEditable() const;
- bool rendererIsEditable() const;
+ bool hasEditableStyle() const;
bool isContentRichlyEditable() const;
// Returns a shadow tree node for legacy shadow trees, a child of the
// ShadowRoot node for new shadow trees, or 0 for non-shadow trees.
diff --git a/Source/WebCore/editing/VisibleUnits.cpp b/Source/WebCore/editing/VisibleUnits.cpp
index 16b92ec..a42a9a3 100644
--- a/Source/WebCore/editing/VisibleUnits.cpp
+++ b/Source/WebCore/editing/VisibleUnits.cpp
@@ -48,10 +48,10 @@
static Node* previousLeafWithSameEditability(Node* node, EditableType editableType)
{
- bool editable = node->rendererIsEditable(editableType);
+ bool editable = node->hasEditableStyle(editableType);
node = previousLeafNode(node);
while (node) {
- if (editable == node->rendererIsEditable(editableType))
+ if (editable == node->hasEditableStyle(editableType))
return node;
node = previousLeafNode(node);
}
@@ -63,10 +63,10 @@
if (!node)
return 0;
- bool editable = node->rendererIsEditable(editableType);
+ bool editable = node->hasEditableStyle(editableType);
node = nextLeafNode(node);
while (node) {
- if (editable == node->rendererIsEditable(editableType))
+ if (editable == node->hasEditableStyle(editableType))
return node;
node = nextLeafNode(node);
}
@@ -964,7 +964,7 @@
// Could not find a previous line. This means we must already be on the first line.
// Move to the start of the content in this block, which effectively moves us
// to the start of the line we're on.
- Element* rootElement = node->rendererIsEditable(editableType) ? node->rootEditableElement(editableType) : node->document().documentElement();
+ Element* rootElement = node->hasEditableStyle(editableType) ? node->rootEditableElement(editableType) : node->document().documentElement();
if (!rootElement)
return VisiblePosition();
return VisiblePosition(firstPositionInNode(rootElement), DOWNSTREAM);
@@ -1022,7 +1022,7 @@
// Could not find a next line. This means we must already be on the last line.
// Move to the end of the content in this block, which effectively moves us
// to the end of the line we're on.
- Element* rootElement = node->rendererIsEditable(editableType) ? node->rootEditableElement(editableType) : node->document().documentElement();
+ Element* rootElement = node->hasEditableStyle(editableType) ? node->rootEditableElement(editableType) : node->document().documentElement();
if (!rootElement)
return VisiblePosition();
return VisiblePosition(lastPositionInNode(rootElement), DOWNSTREAM);
@@ -1103,13 +1103,13 @@
Node* n = startNode;
while (n) {
#if ENABLE(USERSELECT_ALL)
- if (boundaryCrossingRule == CannotCrossEditingBoundary && !Position::nodeIsUserSelectAll(n) && n->rendererIsEditable() != startNode->rendererIsEditable())
+ if (boundaryCrossingRule == CannotCrossEditingBoundary && !Position::nodeIsUserSelectAll(n) && n->hasEditableStyle() != startNode->hasEditableStyle())
#else
- if (boundaryCrossingRule == CannotCrossEditingBoundary && n->rendererIsEditable() != startNode->rendererIsEditable())
+ if (boundaryCrossingRule == CannotCrossEditingBoundary && n->hasEditableStyle() != startNode->hasEditableStyle())
#endif
break;
if (boundaryCrossingRule == CanSkipOverEditingBoundary) {
- while (n && n->rendererIsEditable() != startNode->rendererIsEditable())
+ while (n && n->hasEditableStyle() != startNode->hasEditableStyle())
n = NodeTraversal::previousPostOrder(n, startBlock);
if (!n || !n->isDescendantOf(highestRoot))
break;
@@ -1183,13 +1183,13 @@
Node* n = startNode;
while (n) {
#if ENABLE(USERSELECT_ALL)
- if (boundaryCrossingRule == CannotCrossEditingBoundary && !Position::nodeIsUserSelectAll(n) && n->rendererIsEditable() != startNode->rendererIsEditable())
+ if (boundaryCrossingRule == CannotCrossEditingBoundary && !Position::nodeIsUserSelectAll(n) && n->hasEditableStyle() != startNode->hasEditableStyle())
#else
- if (boundaryCrossingRule == CannotCrossEditingBoundary && n->rendererIsEditable() != startNode->rendererIsEditable())
+ if (boundaryCrossingRule == CannotCrossEditingBoundary && n->hasEditableStyle() != startNode->hasEditableStyle())
#endif
break;
if (boundaryCrossingRule == CanSkipOverEditingBoundary) {
- while (n && n->rendererIsEditable() != startNode->rendererIsEditable())
+ while (n && n->hasEditableStyle() != startNode->hasEditableStyle())
n = NodeTraversal::next(n, stayInsideBlock);
if (!n || !n->isDescendantOf(highestRoot))
break;
diff --git a/Source/WebCore/editing/WrapContentsInDummySpanCommand.cpp b/Source/WebCore/editing/WrapContentsInDummySpanCommand.cpp
index 6587d25..f42d077 100644
--- a/Source/WebCore/editing/WrapContentsInDummySpanCommand.cpp
+++ b/Source/WebCore/editing/WrapContentsInDummySpanCommand.cpp
@@ -62,7 +62,7 @@
{
ASSERT(m_element);
- if (!m_dummySpan || !m_element->rendererIsEditable())
+ if (!m_dummySpan || !m_element->hasEditableStyle())
return;
Vector<RefPtr<Node>> children;
@@ -80,7 +80,7 @@
{
ASSERT(m_element);
- if (!m_dummySpan || !m_element->rendererIsEditable())
+ if (!m_dummySpan || !m_element->hasEditableStyle())
return;
executeApply();
diff --git a/Source/WebCore/editing/htmlediting.cpp b/Source/WebCore/editing/htmlediting.cpp
index ad168aa..9e721c6 100644
--- a/Source/WebCore/editing/htmlediting.cpp
+++ b/Source/WebCore/editing/htmlediting.cpp
@@ -116,7 +116,7 @@
node = node->parentNode();
if (!node)
break;
- if (node->rendererIsEditable(editableType))
+ if (node->hasEditableStyle(editableType))
highestEditableRoot = node;
}
@@ -129,7 +129,7 @@
return 0;
while (node) {
- if (node->rendererIsEditable())
+ if (node->hasEditableStyle())
return node->rootEditableElement();
if (node->hasTagName(bodyTag))
break;
@@ -152,7 +152,7 @@
if (node->renderer() && node->renderer()->isTable())
node = node->parentNode();
- return node->rendererIsEditable(editableType);
+ return node->hasEditableStyle(editableType);
}
bool isAtUnsplittableElement(const Position& pos)
@@ -171,7 +171,7 @@
if (node->renderer() && node->renderer()->isTable())
node = node->parentNode();
- return node->rendererIsRichlyEditable(editableType);
+ return node->hasRichlyEditableStyle(editableType);
}
Element* editableRootForPosition(const Position& p, EditableType editableType)
@@ -249,7 +249,7 @@
VisiblePosition firstEditablePositionAfterPositionInRoot(const Position& position, Node* highestRoot)
{
// position falls before highestRoot.
- if (comparePositions(position, firstPositionInNode(highestRoot)) == -1 && highestRoot->rendererIsEditable())
+ if (comparePositions(position, firstPositionInNode(highestRoot)) == -1 && highestRoot->hasEditableStyle())
return firstPositionInNode(highestRoot);
Position p = position;
@@ -548,7 +548,7 @@
Node* root = highestEditableRoot(p);
for (Node* n = p.deprecatedNode(); n; n = n->parentNode()) {
- if (root && !n->rendererIsEditable())
+ if (root && !n->hasEditableStyle())
continue;
if (n->hasTagName(tagName))
return n;
@@ -570,7 +570,7 @@
for (Node* n = p.deprecatedNode(); n; n = n->parentNode()) {
// Don't return a non-editable node if the input position was editable, since
// the callers from editing will no doubt want to perform editing inside the returned node.
- if (root && !n->rendererIsEditable())
+ if (root && !n->hasEditableStyle())
continue;
if (nodeIsOfType(n))
return n;
@@ -586,7 +586,7 @@
Node* highest = 0;
Node* root = rule == CannotCrossEditingBoundary ? highestEditableRoot(p) : 0;
for (Node* n = p.containerNode(); n && n != stayWithin; n = n->parentNode()) {
- if (root && !n->rendererIsEditable())
+ if (root && !n->hasEditableStyle())
continue;
if (nodeIsOfType(n))
highest = n;
@@ -743,7 +743,7 @@
return false;
return firstList->hasTagName(secondList->tagQName()) // make sure the list types match (ol vs. ul)
- && firstList->rendererIsEditable() && secondList->rendererIsEditable() // both lists are editable
+ && firstList->hasEditableStyle() && secondList->hasEditableStyle() // both lists are editable
&& firstList->rootEditableElement() == secondList->rootEditableElement() // don't cross editing boundaries
&& isVisiblyAdjacent(positionInParentAfterNode(firstList), positionInParentBeforeNode(secondList));
// Make sure there is no visible content between this li and the previous list
diff --git a/Source/WebCore/html/HTMLAnchorElement.cpp b/Source/WebCore/html/HTMLAnchorElement.cpp
index 74464ec..6d90798 100644
--- a/Source/WebCore/html/HTMLAnchorElement.cpp
+++ b/Source/WebCore/html/HTMLAnchorElement.cpp
@@ -86,7 +86,7 @@
bool HTMLAnchorElement::supportsFocus() const
{
- if (rendererIsEditable())
+ if (hasEditableStyle())
return HTMLElement::supportsFocus();
// If not a link we should still be able to focus the element if it has tabIndex.
return isLink() || HTMLElement::supportsFocus();
@@ -191,7 +191,7 @@
return;
}
- if (rendererIsEditable()) {
+ if (hasEditableStyle()) {
// This keeps track of the editable block that the selection was in (if it was in one) just before the link was clicked
// for the LiveWhenNotFocused editable link behavior
if (event->type() == eventNames().mousedownEvent && event->isMouseEvent() && static_cast<MouseEvent*>(event)->button() != RightButton && document().frame()) {
@@ -211,7 +211,7 @@
void HTMLAnchorElement::setActive(bool down, bool pause)
{
- if (rendererIsEditable()) {
+ if (hasEditableStyle()) {
EditableLinkBehavior editableLinkBehavior = EditableLinkDefaultBehavior;
if (Settings* settings = document().settings())
editableLinkBehavior = settings->editableLinkBehavior();
@@ -279,7 +279,7 @@
// FIXME: We probably want this same behavior in SVGAElement too
if (!isLink())
return HTMLElement::canStartSelection();
- return rendererIsEditable();
+ return hasEditableStyle();
}
bool HTMLAnchorElement::draggable() const
@@ -561,7 +561,7 @@
bool HTMLAnchorElement::treatLinkAsLiveForEventType(EventType eventType) const
{
- if (!rendererIsEditable())
+ if (!hasEditableStyle())
return true;
Settings* settings = document().settings();
diff --git a/Source/WebCore/html/HTMLBodyElement.cpp b/Source/WebCore/html/HTMLBodyElement.cpp
index 8e3e299..385e889 100644
--- a/Source/WebCore/html/HTMLBodyElement.cpp
+++ b/Source/WebCore/html/HTMLBodyElement.cpp
@@ -185,7 +185,7 @@
bool HTMLBodyElement::supportsFocus() const
{
- return rendererIsEditable() || HTMLElement::supportsFocus();
+ return hasEditableStyle() || HTMLElement::supportsFocus();
}
static int adjustForZoom(int value, Frame& frame)
diff --git a/Source/WebCore/html/HTMLElement.cpp b/Source/WebCore/html/HTMLElement.cpp
index e0d945a..6d2a6db 100644
--- a/Source/WebCore/html/HTMLElement.cpp
+++ b/Source/WebCore/html/HTMLElement.cpp
@@ -662,9 +662,7 @@
bool HTMLElement::supportsFocus() const
{
- if (!document().view()->isInLayout() && !document().view()->isPainting())
- document().updateStyleIfNeeded();
- return Element::supportsFocus() || (rendererIsEditable() && parentNode() && !parentNode()->rendererIsEditable());
+ return Element::supportsFocus() || (hasEditableStyle() && parentNode() && !parentNode()->hasEditableStyle());
}
String HTMLElement::contentEditable() const
diff --git a/Source/WebCore/page/DragController.cpp b/Source/WebCore/page/DragController.cpp
index d032bff..433e4b8 100644
--- a/Source/WebCore/page/DragController.cpp
+++ b/Source/WebCore/page/DragController.cpp
@@ -405,7 +405,7 @@
pluginDocumentAcceptsDrags = pluginView->shouldAllowNavigationFromDrags();
}
- if (doc && (m_didInitiateDrag || (doc->isPluginDocument() && !pluginDocumentAcceptsDrags) || doc->rendererIsEditable()))
+ if (doc && (m_didInitiateDrag || (doc->isPluginDocument() && !pluginDocumentAcceptsDrags) || doc->hasEditableStyle()))
return DragOperationNone;
return dragOperation(dragData);
}
@@ -553,9 +553,9 @@
return true;
if (result.innerNonSharedNode()->isPluginElement()) {
- if (!toHTMLPlugInElement(result.innerNonSharedNode())->canProcessDrag() && !result.innerNonSharedNode()->rendererIsEditable())
+ if (!toHTMLPlugInElement(result.innerNonSharedNode())->canProcessDrag() && !result.innerNonSharedNode()->hasEditableStyle())
return false;
- } else if (!result.innerNonSharedNode()->rendererIsEditable())
+ } else if (!result.innerNonSharedNode()->hasEditableStyle())
return false;
if (m_didInitiateDrag && m_documentUnderMouse == m_dragInitiator && result.isSelected())
diff --git a/Source/WebCore/page/EventHandler.cpp b/Source/WebCore/page/EventHandler.cpp
index fa5b360..a6bab3a 100644
--- a/Source/WebCore/page/EventHandler.cpp
+++ b/Source/WebCore/page/EventHandler.cpp
@@ -937,7 +937,7 @@
VisibleSelection newSelection;
Node* node = event.targetNode();
bool caretBrowsing = m_frame.settings().caretBrowsingEnabled();
- if (node && node->renderer() && (caretBrowsing || node->rendererIsEditable())) {
+ if (node && node->renderer() && (caretBrowsing || node->hasEditableStyle())) {
VisiblePosition pos = node->renderer()->positionForPoint(event.localPoint());
newSelection = VisibleSelection(pos);
}
@@ -1194,7 +1194,7 @@
if (!node)
return false;
- bool editable = node->rendererIsEditable();
+ bool editable = node->hasEditableStyle();
bool editableLinkEnabled = false;
// If the link is editable, then we need to check the settings to see whether or not the link should be followed
@@ -1343,7 +1343,7 @@
switch (style ? style->cursor() : CURSOR_AUTO) {
case CURSOR_AUTO: {
- bool editable = node->rendererIsEditable();
+ bool editable = node->hasEditableStyle();
if (useHandCursor(node, result.isOverLink(), shiftKey))
return handCursor();
diff --git a/Source/WebCore/page/FocusController.cpp b/Source/WebCore/page/FocusController.cpp
index e6eb490..ef89b39 100644
--- a/Source/WebCore/page/FocusController.cpp
+++ b/Source/WebCore/page/FocusController.cpp
@@ -536,7 +536,7 @@
static bool relinquishesEditingFocus(Node *node)
{
ASSERT(node);
- ASSERT(node->rendererIsEditable());
+ ASSERT(node->hasEditableStyle());
Node* root = node->rootEditableElement();
Frame* frame = node->document().frame();
diff --git a/Source/WebCore/rendering/HitTestResult.cpp b/Source/WebCore/rendering/HitTestResult.cpp
index 62925e8..979ac8c 100644
--- a/Source/WebCore/rendering/HitTestResult.cpp
+++ b/Source/WebCore/rendering/HitTestResult.cpp
@@ -578,7 +578,7 @@
if (isHTMLInputElement(m_innerNonSharedNode.get()))
return toHTMLInputElement(m_innerNonSharedNode.get())->isTextField();
- return m_innerNonSharedNode->rendererIsEditable();
+ return m_innerNonSharedNode->hasEditableStyle();
}
bool HitTestResult::addNodeToRectBasedTestResult(Node* node, const HitTestRequest& request, const HitTestLocation& locationInContainer, const LayoutRect& rect)
diff --git a/Source/WebCore/rendering/RenderBlock.cpp b/Source/WebCore/rendering/RenderBlock.cpp
index 3e40256..e2ddf8b 100644
--- a/Source/WebCore/rendering/RenderBlock.cpp
+++ b/Source/WebCore/rendering/RenderBlock.cpp
@@ -2483,7 +2483,7 @@
bool isContentEditable;
if (type == CursorCaret) {
caretPainter = frame().selection().caretRenderer();
- isContentEditable = frame().selection().rendererIsEditable();
+ isContentEditable = frame().selection().hasEditableStyle();
} else {
caretPainter = frame().page()->dragCaretController().caretRenderer();
isContentEditable = frame().page()->dragCaretController().isContentEditable();
@@ -3538,7 +3538,7 @@
ASSERT(!ancestor || ancestor->nonPseudoElement());
ASSERT(child.nonPseudoNode());
return !ancestor || !ancestor->parent() || (ancestor->hasLayer() && ancestor->parent()->isRenderView())
- || ancestor->nonPseudoElement()->rendererIsEditable() == child.nonPseudoNode()->rendererIsEditable();
+ || ancestor->nonPseudoElement()->hasEditableStyle() == child.nonPseudoNode()->hasEditableStyle();
}
// FIXME: This function should go on RenderObject as an instance method. Then
diff --git a/Source/WebCore/rendering/RenderBox.cpp b/Source/WebCore/rendering/RenderBox.cpp
index ea786af..44c29d8 100644
--- a/Source/WebCore/rendering/RenderBox.cpp
+++ b/Source/WebCore/rendering/RenderBox.cpp
@@ -821,7 +821,7 @@
if (scrollsOverflow() && hasScrollableOverflow)
return true;
- return element() && element()->rendererIsEditable();
+ return element() && element()->hasEditableStyle();
}
bool RenderBox::usesCompositedScrolling() const
diff --git a/Source/WebCore/rendering/RenderButton.cpp b/Source/WebCore/rendering/RenderButton.cpp
index 8d3e1c3..8cf73f6 100644
--- a/Source/WebCore/rendering/RenderButton.cpp
+++ b/Source/WebCore/rendering/RenderButton.cpp
@@ -56,7 +56,7 @@
bool RenderButton::canBeSelectionLeaf() const
{
- return formControlElement().rendererIsEditable();
+ return formControlElement().hasEditableStyle();
}
bool RenderButton::hasLineIfEmpty() const
diff --git a/Source/WebCore/rendering/RenderObject.cpp b/Source/WebCore/rendering/RenderObject.cpp
index 6b69665..73a8e33 100644
--- a/Source/WebCore/rendering/RenderObject.cpp
+++ b/Source/WebCore/rendering/RenderObject.cpp
@@ -2354,14 +2354,14 @@
{
// If this is a non-anonymous renderer in an editable area, then it's simple.
if (Node* node = nonPseudoNode()) {
- if (!node->rendererIsEditable()) {
+ if (!node->hasEditableStyle()) {
// If it can be found, we prefer a visually equivalent position that is editable.
Position position = createLegacyEditingPosition(node, offset);
Position candidate = position.downstream(CanCrossEditingBoundary);
- if (candidate.deprecatedNode()->rendererIsEditable())
+ if (candidate.deprecatedNode()->hasEditableStyle())
return VisiblePosition(candidate, affinity);
candidate = position.upstream(CanCrossEditingBoundary);
- if (candidate.deprecatedNode()->rendererIsEditable())
+ if (candidate.deprecatedNode()->hasEditableStyle())
return VisiblePosition(candidate, affinity);
}
// FIXME: Eliminate legacy editing positions
diff --git a/Source/WebCore/rendering/RenderTextFragment.cpp b/Source/WebCore/rendering/RenderTextFragment.cpp
index 1414eaf..fd067c8 100644
--- a/Source/WebCore/rendering/RenderTextFragment.cpp
+++ b/Source/WebCore/rendering/RenderTextFragment.cpp
@@ -60,7 +60,7 @@
bool RenderTextFragment::canBeSelectionLeaf() const
{
- return textNode() && textNode()->rendererIsEditable();
+ return textNode() && textNode()->hasEditableStyle();
}
void RenderTextFragment::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle)
diff --git a/Source/WebCore/rendering/RootInlineBox.cpp b/Source/WebCore/rendering/RootInlineBox.cpp
index c0b2cb9..d6bacbc 100644
--- a/Source/WebCore/rendering/RootInlineBox.cpp
+++ b/Source/WebCore/rendering/RootInlineBox.cpp
@@ -693,7 +693,7 @@
static bool isEditableLeaf(InlineBox* leaf)
{
- return leaf && leaf->renderer().node() && leaf->renderer().node()->rendererIsEditable();
+ return leaf && leaf->renderer().node() && leaf->renderer().node()->hasEditableStyle();
}
InlineBox* RootInlineBox::closestLeafChildForPoint(const IntPoint& pointInContents, bool onlyEditableLeaves)
diff --git a/Source/WebCore/svg/SVGAElement.cpp b/Source/WebCore/svg/SVGAElement.cpp
index 04a4ba7..c0d2e24 100644
--- a/Source/WebCore/svg/SVGAElement.cpp
+++ b/Source/WebCore/svg/SVGAElement.cpp
@@ -189,7 +189,7 @@
bool SVGAElement::supportsFocus() const
{
- if (rendererIsEditable())
+ if (hasEditableStyle())
return SVGGraphicsElement::supportsFocus();
return true;
}