Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(671)

Unified Diff: Source/core/editing/htmlediting.cpp

Issue 417113011: Cast highestEnclosingNodeOfType() return value to tighter type (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/editing/htmlediting.h ('k') | Source/core/editing/markup.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/editing/htmlediting.cpp
diff --git a/Source/core/editing/htmlediting.cpp b/Source/core/editing/htmlediting.cpp
index 8b5e040f7fb0d12d1e820f6ee2dadde554a62a8c..496aeecdaf3127f8fafa783f224e94d9b0b2de2f 100644
--- a/Source/core/editing/htmlediting.cpp
+++ b/Source/core/editing/htmlediting.cpp
@@ -964,7 +964,7 @@ unsigned numEnclosingMailBlockquotes(const Position& p)
{
unsigned num = 0;
for (Node* n = p.deprecatedNode(); n; n = n->parentNode())
- if (isMailBlockquote(n))
+ if (isMailHTMLBlockquoteElement(n))
num++;
return num;
@@ -1000,12 +1000,13 @@ void updatePositionForNodeRemoval(Position& position, Node& node)
}
}
-bool isMailBlockquote(const Node *node)
+bool isMailHTMLBlockquoteElement(const Node* node)
{
- if (!node || !node->hasTagName(blockquoteTag))
+ if (!node || !node->isHTMLElement())
return false;
- return toElement(node)->getAttribute("type") == "cite";
+ const HTMLElement& element = toHTMLElement(*node);
+ return element.hasTagName(blockquoteTag) && element.getAttribute("type") == "cite";
}
int caretMinOffset(const Node* n)
@@ -1164,17 +1165,21 @@ bool areIdenticalElements(const Node* first, const Node* second)
bool isNonTableCellHTMLBlockElement(const Node* node)
{
- return node->hasTagName(listingTag)
- || node->hasTagName(olTag)
- || node->hasTagName(preTag)
- || node->hasTagName(tableTag)
- || node->hasTagName(ulTag)
- || node->hasTagName(xmpTag)
- || node->hasTagName(h1Tag)
- || node->hasTagName(h2Tag)
- || node->hasTagName(h3Tag)
- || node->hasTagName(h4Tag)
- || node->hasTagName(h5Tag);
+ if (!node->isHTMLElement())
+ return false;
+
+ const HTMLElement& element = toHTMLElement(*node);
+ return element.hasTagName(listingTag)
+ || element.hasTagName(olTag)
+ || element.hasTagName(preTag)
+ || element.hasTagName(tableTag)
+ || element.hasTagName(ulTag)
+ || element.hasTagName(xmpTag)
+ || element.hasTagName(h1Tag)
+ || element.hasTagName(h2Tag)
+ || element.hasTagName(h3Tag)
+ || element.hasTagName(h4Tag)
+ || element.hasTagName(h5Tag);
}
Position adjustedSelectionStartForStyleComputation(const VisibleSelection& selection)
« no previous file with comments | « Source/core/editing/htmlediting.h ('k') | Source/core/editing/markup.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698