Commit f02be1e8 authored by antti@apple.com's avatar 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.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@160966 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent b37ca71d
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
......@@ -150,7 +150,7 @@ void AccessibilityNodeObject::childrenChanged()
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 @@ bool AccessibilityNodeObject::isReadOnly() const
return input->isReadOnly();
}
return !node->rendererIsEditable();
return !node->hasEditableStyle();
}
bool AccessibilityNodeObject::isRequired() const
......@@ -2048,7 +2048,7 @@ AccessibilityRole AccessibilityNodeObject::remapAriaRoleDueToParent(Accessibilit
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
{
......
......@@ -542,11 +542,11 @@ bool AccessibilityRenderObject::isReadOnly() const
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 @@ bool AccessibilityRenderObject::computeAccessibilityIsIgnored() const
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 @@ void AccessibilityRenderObject::textChanged()
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);
}
}
......
......@@ -102,7 +102,7 @@ bool AccessibilityTable::isDataTable() const
// 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.
......
......@@ -328,7 +328,7 @@ static Widget* widgetForElement(Element* focusedElement)
static bool acceptsEditingFocus(Node* node)
{
ASSERT(node);
ASSERT(node->rendererIsEditable());
ASSERT(node->hasEditableStyle());
Node* root = node->rootEditableElement();
Frame* frame = node->document().frame();
......
......@@ -2148,7 +2148,7 @@ RenderStyle* Element::computedStyle(PseudoId pseudoElementSpecifier)
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;
......
......@@ -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 @@ const AtomicString& Node::namespaceURI() const
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 @@ void Node::inspect()
#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 @@ bool Node::rendererIsEditable(EditableLevel editableLevel, UserSelectAllTreatmen
// 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;
// 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);
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();
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 @@ int Node::maxCharacterOffset() const
// is obviously misplaced.
bool Node::canStartSelection() const
{
if (rendererIsEditable())
if (hasEditableStyle())
return true;
if (renderer()) {
......@@ -1017,7 +1022,7 @@ void Node::removedFrom(ContainerNode& insertionPoint)
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(EditableType editableType) const
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))
......
......@@ -341,11 +341,11 @@ public:
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 @@ public:
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 @@ private:
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;
......
......@@ -67,7 +67,7 @@ static Node* nextRenderedEditable(Node* node)
{
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 @@ static Node* previousRenderedEditable(Node* node)
{
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::atLastEditingPositionForNode() const
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 @@ Node* Position::parentEditingBoundary() const
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 @@ Position Position::upstream(EditingBoundaryCrossingRule rule) const
// 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 @@ Position Position::downstream(EditingBoundaryCrossingRule rule) const
// 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 @@ bool Position::isCandidate() const
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;
}
......
......@@ -165,7 +165,7 @@ bool PositionIterator::isCandidate() const
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();
}
}
......
......@@ -42,7 +42,7 @@ AppendNodeCommand::AppendNodeCommand(PassRefPtr<ContainerNode> parent, PassRefPt
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 @@ static void sendAXTextChangedIgnoringLineBreaks(Node* node, AXObjectCache::AXTex
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::doApply()
void AppendNodeCommand::doUnapply()
{
if (!m_parent->rendererIsEditable())
if (!m_parent->hasEditableStyle())
return;
// Need to notify this before actually deleting the text
......
......@@ -711,12 +711,12 @@ void ApplyStyleCommand::fixRangeAndApplyInlineStyle(EditingStyle* style, const P
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 @@ void ApplyStyleCommand::applyInlineStyleToNodeRange(EditingStyle* style, PassRef
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 @@ void ApplyStyleCommand::applyInlineStyleToNodeRange(EditingStyle* style, PassRef
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 @@ void ApplyStyleCommand::surroundNodeRangeWithElement(PassRefPtr<Node> passedStar
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));
}
......
......@@ -1278,7 +1278,7 @@ bool CompositeEditCommand::breakOutOfEmptyListItem()
// 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;
......
......@@ -61,7 +61,7 @@ DeleteButtonController::DeleteButtonController(Frame& frame)
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 @@ static HTMLElement* enclosingDeletableElement(const VisibleSelection& selection)
// 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);
......
......@@ -67,7 +67,7 @@ void DeleteFromTextNodeCommand::doUnapply()
{
ASSERT(m_node);
if (!m_node->rendererIsEditable())
if (!m_node->hasEditableStyle())
return;
m_node->insertData(m_offset, m_text, IGNORE_EXCEPTION);
......
......@@ -340,7 +340,7 @@ static Position firstEditablePositionInNode(Node* node)
{
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 @@ void DeleteSelectionCommand::removeNode(PassRefPtr<Node> node, ShouldAssumeConte
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;
......
......@@ -688,7 +688,7 @@ TriState EditingStyle::triStateOfStyle(const VisibleSelection& selection) const
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) {
......
......@@ -312,7 +312,7 @@ bool Editor::canDeleteRange(Range* range) const
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 @@ void Editor::markMisspellingsOrBadGrammar(const VisibleSelection& selection, boo
// 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 @@ void Editor::markAllMisspellingsAndBadGrammarInRanges(TextCheckingTypeMask textC
// 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))
......
......@@ -255,7 +255,7 @@ static unsigned verticalScrollDistance(Frame& frame)
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));
......
......@@ -149,14 +149,14 @@ Node* enclosingBlockToSplitTreeTo(Node* startNode)
{
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;
}
......
......@@ -1589,7 +1589,7 @@ void FrameSelection::selectFrameElementInParentIfFullySelected()
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 @@ void FrameSelection::setSelectionFromNone()
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();
......
......@@ -133,7 +133,7 @@ public:
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(); }
......
......@@ -125,7 +125,7 @@ void IndentOutdentCommand::outdentParagraph()
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 @@ void IndentOutdentCommand::outdentParagraph()
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);
}
}
......
......@@ -53,7 +53,7 @@ void InsertIntoTextNodeCommand::doApply()