本文整理汇总了C++中TrackExceptionState类的典型用法代码示例。如果您正苦于以下问题:C++ TrackExceptionState类的具体用法?C++ TrackExceptionState怎么用?C++ TrackExceptionState使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TrackExceptionState类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: makeSearchRange
static PassRefPtrWillBeRawPtr<Range> makeSearchRange(const Position& pos)
{
Node* node = pos.deprecatedNode();
if (!node)
return nullptr;
Document& document = node->document();
if (!document.documentElement())
return nullptr;
Element* boundary = enclosingBlockFlowElement(*node);
if (!boundary)
return nullptr;
RefPtrWillBeRawPtr<Range> searchRange(Range::create(document));
TrackExceptionState exceptionState;
Position start(pos.parentAnchoredEquivalent());
searchRange->selectNodeContents(boundary, exceptionState);
searchRange->setStart(start.containerNode(), start.offsetInContainerNode(), exceptionState);
ASSERT(!exceptionState.hadException());
if (exceptionState.hadException())
return nullptr;
return searchRange.release();
}
示例2: getClient
ScriptPromise Permissions::query(ScriptState* scriptState, const Dictionary& rawPermission)
{
WebPermissionClient* client = getClient(scriptState->executionContext());
if (!client)
return ScriptPromise::rejectWithDOMException(scriptState, DOMException::create(InvalidStateError, "In its current state, the global scope can't query permissions."));
TrackExceptionState exceptionState;
PermissionDescriptor permission = NativeValueTraits<PermissionDescriptor>::nativeValue(scriptState->isolate(), rawPermission.v8Value(), exceptionState);
if (exceptionState.hadException())
return ScriptPromise::reject(scriptState, v8::Exception::TypeError(v8String(scriptState->isolate(), exceptionState.message())));
ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState);
ScriptPromise promise = resolver->promise();
WebPermissionType type = getPermissionType(scriptState, rawPermission, permission, exceptionState);
if (handleNotSupportedPermission(scriptState, rawPermission, resolver, type, exceptionState))
return promise;
// If the current origin is a file scheme, it will unlikely return a
// meaningful value because most APIs are broken on file scheme and no
// permission prompt will be shown even if the returned permission will most
// likely be "prompt".
client->queryPermission(type, KURL(KURL(), scriptState->executionContext()->securityOrigin()->toString()), new PermissionCallback(resolver, type));
return promise;
}
示例3: makeSearchRange
static PassRefPtr<Range> makeSearchRange(const Position& pos)
{
Node* n = pos.deprecatedNode();
if (!n)
return 0;
Document& d = n->document();
Node* de = d.documentElement();
if (!de)
return 0;
Node* boundary = n->enclosingBlockFlowElement();
if (!boundary)
return 0;
RefPtr<Range> searchRange(Range::create(d));
TrackExceptionState es;
Position start(pos.parentAnchoredEquivalent());
searchRange->selectNodeContents(boundary, es);
searchRange->setStart(start.containerNode(), start.offsetInContainerNode(), es);
ASSERT(!es.hadException());
if (es.hadException())
return 0;
return searchRange.release();
}
示例4: frameContentAsPlainText
static void frameContentAsPlainText(size_t maxChars, LocalFrame* frame, StringBuilder& output)
{
Document* document = frame->document();
if (!document)
return;
if (!frame->view())
return;
// Select the document body.
RefPtr<Range> range(document->createRange());
TrackExceptionState exceptionState;
range->selectNodeContents(document, exceptionState);
if (!exceptionState.had_exception()) {
// The text iterator will walk nodes giving us text. This is similar to
// the plainText() function in core/editing/TextIterator.h, but we implement the maximum
// size and also copy the results directly into a wstring, avoiding the
// string conversion.
for (TextIterator it(range.get()); !it.atEnd(); it.advance()) {
it.appendTextToStringBuilder(output, 0, maxChars - output.length());
if (output.length() >= maxChars)
return; // Filled up the buffer.
}
}
}
示例5: drawNodeHighlight
void InspectorOverlay::drawNodeHighlight()
{
if (!m_highlightNode)
return;
String selectors = m_nodeHighlightConfig.selectorList;
RefPtrWillBeRawPtr<StaticElementList> elements = nullptr;
TrackExceptionState exceptionState;
ContainerNode* queryBase = m_highlightNode->containingShadowRoot();
if (!queryBase)
queryBase = m_highlightNode->ownerDocument();
if (selectors.length())
elements = queryBase->querySelectorAll(AtomicString(selectors), exceptionState);
if (elements && !exceptionState.hadException()) {
for (unsigned i = 0; i < elements->length(); ++i) {
Element* element = elements->item(i);
InspectorHighlight highlight(element, m_nodeHighlightConfig, false);
RefPtr<JSONObject> highlightJSON = highlight.asJSONObject();
evaluateInOverlay("drawHighlight", highlightJSON.release());
}
}
bool appendElementInfo = m_highlightNode->isElementNode() && !m_omitTooltip && m_nodeHighlightConfig.showInfo && m_highlightNode->layoutObject() && m_highlightNode->document().frame();
InspectorHighlight highlight(m_highlightNode.get(), m_nodeHighlightConfig, appendElementInfo);
if (m_eventTargetNode)
highlight.appendEventTargetQuads(m_eventTargetNode.get(), m_nodeHighlightConfig);
RefPtr<JSONObject> highlightJSON = highlight.asJSONObject();
evaluateInOverlay("drawHighlight", highlightJSON.release());
}
示例6: ASSERT
void MergeIdenticalElementsCommand::doUnapply()
{
ASSERT(m_element1);
ASSERT(m_element2);
RefPtr<Node> atChild = m_atChild.release();
ContainerNode* parent = m_element2->parentNode();
if (!parent || !parent->rendererIsEditable())
return;
TrackExceptionState es;
parent->insertBefore(m_element1.get(), m_element2.get(), es);
if (es.hadException())
return;
Vector<RefPtr<Node> > children;
for (Node* child = m_element2->firstChild(); child && child != atChild; child = child->nextSibling())
children.append(child);
size_t size = children.size();
for (size_t i = 0; i < size; ++i)
m_element1->appendChild(children[i].release(), es);
}
示例7: querySelector
WebElement WebNode::querySelector(const WebString& tag, WebExceptionCode& ec) const
{
TrackExceptionState es;
WebElement element(m_private->querySelector(tag, es));
ec = es.code();
return element;
}
开发者ID:IllusionRom-deprecated,项目名称:android_platform_external_chromium_org_third_party_WebKit,代码行数:7,代码来源:WebNode.cpp
示例8: setupTest
void TouchActionTest::runShadowDOMTest(std::string file) {
TouchActionTrackingWebViewClient client;
WebView* webView = setupTest(file, client);
TrackExceptionState es;
// Oilpan: see runTouchActionTest() comment why these are persistent
// references.
Persistent<Document> document =
static_cast<Document*>(webView->mainFrame()->document());
Persistent<StaticElementList> hostNodes =
document->querySelectorAll("[shadow-host]", es);
ASSERT_FALSE(es.hadException());
ASSERT_GE(hostNodes->length(), 1u);
for (unsigned index = 0; index < hostNodes->length(); index++) {
ShadowRoot* shadowRoot = hostNodes->item(index)->openShadowRoot();
runTestOnTree(shadowRoot, webView, client);
}
// Projections show up in the main document.
runTestOnTree(document.get(), webView, client);
// Explicitly reset to break dependency on locally scoped client.
m_webViewHelper.reset();
}
示例9: containsNode
bool DOMSelection::containsNode(const Node* n, bool allowPartial) const
{
if (!m_frame)
return false;
FrameSelection& selection = m_frame->selection();
if (!n || m_frame->document() != n->document() || selection.isNone())
return false;
unsigned nodeIndex = n->nodeIndex();
RefPtrWillBeRawPtr<Range> selectedRange = selection.selection().toNormalizedRange();
ContainerNode* parentNode = n->parentNode();
if (!parentNode)
return false;
TrackExceptionState exceptionState;
bool nodeFullySelected = Range::compareBoundaryPoints(parentNode, nodeIndex, selectedRange->startContainer(), selectedRange->startOffset(), exceptionState) >= 0 && !exceptionState.hadException()
&& Range::compareBoundaryPoints(parentNode, nodeIndex + 1, selectedRange->endContainer(), selectedRange->endOffset(), exceptionState) <= 0 && !exceptionState.hadException();
if (exceptionState.hadException())
return false;
if (nodeFullySelected)
return true;
bool nodeFullyUnselected = (Range::compareBoundaryPoints(parentNode, nodeIndex, selectedRange->endContainer(), selectedRange->endOffset(), exceptionState) > 0 && !exceptionState.hadException())
|| (Range::compareBoundaryPoints(parentNode, nodeIndex + 1, selectedRange->startContainer(), selectedRange->startOffset(), exceptionState) < 0 && !exceptionState.hadException());
ASSERT(!exceptionState.hadException());
if (nodeFullyUnselected)
return false;
return allowPartial || n->isTextNode();
}
示例10: createEvent
WebDOMEvent WebDocument::createEvent(const WebString& eventType)
{
TrackExceptionState exceptionState;
WebDOMEvent event(unwrap<Document>()->createEvent(eventType, exceptionState));
if (exceptionState.hadException())
return WebDOMEvent();
return event;
}
示例11: serialize
WebSerializedScriptValue WebSerializedScriptValue::serialize(v8::Local<v8::Value> value)
{
TrackExceptionState exceptionState;
WebSerializedScriptValue serializedValue = SerializedScriptValueFactory::instance().create(v8::Isolate::GetCurrent(), value, nullptr, nullptr, nullptr, exceptionState);
if (exceptionState.hadException())
return createInvalid();
return serializedValue;
}
示例12:
void SplitTextNodeCommand::insertText1AndTrimText2()
{
TrackExceptionState exceptionState;
m_text2->parentNode()->insertBefore(m_text1.get(), m_text2.get(), exceptionState);
if (exceptionState.hadException())
return;
m_text2->deleteData(0, m_offset, exceptionState, CharacterData::DeprecatedRecalcStyleImmediatlelyForEditing);
}
示例13: setAttribute
bool WebElement::setAttribute(const WebString& attrName, const WebString& attrValue)
{
// TODO: Custom element callbacks need to be called on WebKit API methods that
// mutate the DOM in any way.
CustomElementCallbackDispatcher::CallbackDeliveryScope deliverCustomElementCallbacks;
TrackExceptionState exceptionState;
unwrap<Element>()->setAttribute(attrName, attrValue, exceptionState);
return !exceptionState.hadException();
}
示例14: setEnd
bool setEnd(Range *r, const VisiblePosition &visiblePosition)
{
if (!r)
return false;
Position p = visiblePosition.deepEquivalent().parentAnchoredEquivalent();
TrackExceptionState exceptionState;
r->setEnd(p.containerNode(), p.offsetInContainerNode(), exceptionState);
return !exceptionState.hadException();
}
示例15: setBaseValueAsString
void SVGStaticStringList::setBaseValueAsString(const String& value, SVGParsingError& parseError)
{
TrackExceptionState es;
m_value->setValueAsString(value, es);
if (es.hadException())
parseError = ParsingAttributeFailedError;
}