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

Unified Diff: Source/core/testing/Internals.cpp

Issue 884763003: Internals methods return 0 instead of false when they fail (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebased Created 5 years, 10 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/testing/Internals.cpp
diff --git a/Source/core/testing/Internals.cpp b/Source/core/testing/Internals.cpp
index a7faee371267405ed17d8ba1048e43c09c16b3e3..34139295527bd3f0fe1ebaec3c3846b1dada02a0 100644
--- a/Source/core/testing/Internals.cpp
+++ b/Source/core/testing/Internals.cpp
@@ -370,7 +370,7 @@ bool Internals::hasSelectorForIdInShadow(Element* host, const AtomicString& idVa
ASSERT(host);
if (!host->shadow()) {
exceptionState.throwDOMException(InvalidAccessError, "The host element does not have a shadow.");
- return 0;
+ return false;
}
return host->shadow()->ensureSelectFeatureSet().hasSelectorForId(idValue);
@@ -381,7 +381,7 @@ bool Internals::hasSelectorForClassInShadow(Element* host, const AtomicString& c
ASSERT(host);
if (!host->shadow()) {
exceptionState.throwDOMException(InvalidAccessError, "The host element does not have a shadow.");
- return 0;
+ return false;
}
return host->shadow()->ensureSelectFeatureSet().hasSelectorForClass(className);
@@ -392,7 +392,7 @@ bool Internals::hasSelectorForAttributeInShadow(Element* host, const AtomicStrin
ASSERT(host);
if (!host->shadow()) {
exceptionState.throwDOMException(InvalidAccessError, "The host element does not have a shadow.");
- return 0;
+ return false;
}
return host->shadow()->ensureSelectFeatureSet().hasSelectorForAttribute(attributeName);
@@ -438,7 +438,7 @@ bool Internals::hasShadowInsertionPoint(const Node* root, ExceptionState& except
ASSERT(root);
if (!root->isShadowRoot()) {
exceptionState.throwDOMException(InvalidAccessError, "The node argument is not a shadow root.");
- return 0;
+ return false;
}
return toShadowRoot(root)->containsShadowElements();
}
@@ -448,7 +448,7 @@ bool Internals::hasContentElement(const Node* root, ExceptionState& exceptionSta
ASSERT(root);
if (!root->isShadowRoot()) {
exceptionState.throwDOMException(InvalidAccessError, "The node argument is not a shadow root.");
- return 0;
+ return false;
}
return toShadowRoot(root)->containsContentElements();
}
@@ -1399,7 +1399,7 @@ bool Internals::hasSpellingMarker(Document* document, int from, int length)
{
ASSERT(document);
if (!document->frame())
- return 0;
+ return false;
return document->frame()->spellChecker().selectionStartHasMarkerFor(DocumentMarker::Spelling, from, length);
}
@@ -1417,7 +1417,7 @@ bool Internals::isOverwriteModeEnabled(Document* document)
{
ASSERT(document);
if (!document->frame())
- return 0;
+ return false;
return document->frame()->editor().isOverwriteModeEnabled();
}
@@ -1473,7 +1473,7 @@ bool Internals::hasGrammarMarker(Document* document, int from, int length)
{
ASSERT(document);
if (!document->frame())
- return 0;
+ return false;
return document->frame()->spellChecker().selectionStartHasMarkerFor(DocumentMarker::Grammar, from, length);
}
@@ -1526,18 +1526,18 @@ bool Internals::scrollsWithRespectTo(Element* element1, Element* element2, Excep
LayoutObject* renderer2 = element2->renderer();
if (!renderer1 || !renderer1->isBox()) {
exceptionState.throwDOMException(InvalidAccessError, renderer1 ? "The first provided element's renderer is not a box." : "The first provided element has no renderer.");
- return 0;
+ return false;
}
if (!renderer2 || !renderer2->isBox()) {
exceptionState.throwDOMException(InvalidAccessError, renderer2 ? "The second provided element's renderer is not a box." : "The second provided element has no renderer.");
- return 0;
+ return false;
}
Layer* layer1 = toRenderBox(renderer1)->layer();
Layer* layer2 = toRenderBox(renderer2)->layer();
if (!layer1 || !layer2) {
exceptionState.throwDOMException(InvalidAccessError, String::format("No render layer can be obtained from the %s provided element.", layer1 ? "second" : "first"));
- return 0;
+ return false;
}
return layer1->scrollsWithRespectTo(layer2);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698