Commit 04a3c837 authored by rob.buis@samsung.com's avatar rob.buis@samsung.com

Clean up isSpecialElement

Hide isSpecialElement since it is only used in
htmlediting.cpp. And since the two callers pass
a non-null node, turn the null check into an ASSERT.

Review URL: https://codereview.chromium.org/694893003

git-svn-id: svn://svn.chromium.org/blink/trunk@184850 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 7c079f7c
...@@ -425,18 +425,15 @@ const String& nonBreakingSpaceString() ...@@ -425,18 +425,15 @@ const String& nonBreakingSpaceString()
} }
// FIXME: need to dump this // FIXME: need to dump this
bool isSpecialHTMLElement(const Node* n) static bool isSpecialHTMLElement(const Node& n)
{ {
if (!n) if (!n.isHTMLElement())
return false;
if (!n->isHTMLElement())
return false; return false;
if (n->isLink()) if (n.isLink())
return true; return true;
RenderObject* renderer = n->renderer(); RenderObject* renderer = n.renderer();
if (!renderer) if (!renderer)
return false; return false;
...@@ -453,7 +450,7 @@ static HTMLElement* firstInSpecialElement(const Position& pos) ...@@ -453,7 +450,7 @@ static HTMLElement* firstInSpecialElement(const Position& pos)
{ {
Element* rootEditableElement = pos.containerNode()->rootEditableElement(); Element* rootEditableElement = pos.containerNode()->rootEditableElement();
for (Node* n = pos.deprecatedNode(); n && n->rootEditableElement() == rootEditableElement; n = n->parentNode()) { for (Node* n = pos.deprecatedNode(); n && n->rootEditableElement() == rootEditableElement; n = n->parentNode()) {
if (isSpecialHTMLElement(n)) { if (isSpecialHTMLElement(*n)) {
HTMLElement* specialElement = toHTMLElement(n); HTMLElement* specialElement = toHTMLElement(n);
VisiblePosition vPos = VisiblePosition(pos, DOWNSTREAM); VisiblePosition vPos = VisiblePosition(pos, DOWNSTREAM);
VisiblePosition firstInElement = VisiblePosition(firstPositionInOrBeforeNode(specialElement), DOWNSTREAM); VisiblePosition firstInElement = VisiblePosition(firstPositionInOrBeforeNode(specialElement), DOWNSTREAM);
...@@ -470,7 +467,7 @@ static HTMLElement* lastInSpecialElement(const Position& pos) ...@@ -470,7 +467,7 @@ static HTMLElement* lastInSpecialElement(const Position& pos)
{ {
Element* rootEditableElement = pos.containerNode()->rootEditableElement(); Element* rootEditableElement = pos.containerNode()->rootEditableElement();
for (Node* n = pos.deprecatedNode(); n && n->rootEditableElement() == rootEditableElement; n = n->parentNode()) { for (Node* n = pos.deprecatedNode(); n && n->rootEditableElement() == rootEditableElement; n = n->parentNode()) {
if (isSpecialHTMLElement(n)) { if (isSpecialHTMLElement(*n)) {
HTMLElement* specialElement = toHTMLElement(n); HTMLElement* specialElement = toHTMLElement(n);
VisiblePosition vPos = VisiblePosition(pos, DOWNSTREAM); VisiblePosition vPos = VisiblePosition(pos, DOWNSTREAM);
VisiblePosition lastInElement = VisiblePosition(lastPositionInOrAfterNode(specialElement), DOWNSTREAM); VisiblePosition lastInElement = VisiblePosition(lastPositionInOrAfterNode(specialElement), DOWNSTREAM);
......
...@@ -105,7 +105,6 @@ inline bool canHaveChildrenForEditing(const Node* node) ...@@ -105,7 +105,6 @@ inline bool canHaveChildrenForEditing(const Node* node)
bool isAtomicNode(const Node*); bool isAtomicNode(const Node*);
bool isBlock(const Node*); bool isBlock(const Node*);
bool isInline(const Node*); bool isInline(const Node*);
bool isSpecialHTMLElement(const Node*);
bool isTabHTMLSpanElement(const Node*); bool isTabHTMLSpanElement(const Node*);
bool isTabHTMLSpanElementTextNode(const Node*); bool isTabHTMLSpanElementTextNode(const Node*);
bool isMailHTMLBlockquoteElement(const Node*); bool isMailHTMLBlockquoteElement(const Node*);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment