当前位置: 首页>>代码示例>>C++>>正文


C++ TrackExceptionState::hadException方法代码示例

本文整理汇总了C++中TrackExceptionState::hadException方法的典型用法代码示例。如果您正苦于以下问题:C++ TrackExceptionState::hadException方法的具体用法?C++ TrackExceptionState::hadException怎么用?C++ TrackExceptionState::hadException使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TrackExceptionState的用法示例。


在下文中一共展示了TrackExceptionState::hadException方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: start

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();
}
开发者ID:halton,项目名称:blink-crosswalk,代码行数:26,代码来源:VisibleSelection.cpp

示例2: start

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();
}
开发者ID:darktears,项目名称:blink-crosswalk,代码行数:25,代码来源:VisibleSelection.cpp

示例3: 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();
}
开发者ID:jeremyroman,项目名称:blink,代码行数:33,代码来源:DOMSelection.cpp

示例4:

v8::Local<v8::Value> WebDocument::registerEmbedderCustomElement(const WebString& name, v8::Local<v8::Value> options, WebExceptionCode& ec)
{
    v8::Isolate* isolate = v8::Isolate::GetCurrent();
    Document* document = unwrap<Document>();
    TrackExceptionState exceptionState;
    ElementRegistrationOptions registrationOptions;
    V8ElementRegistrationOptions::toImpl(isolate, options, registrationOptions, exceptionState);
    if (exceptionState.hadException())
        return v8::Local<v8::Value>();
    ScriptValue constructor = document->registerElement(ScriptState::current(isolate), name, registrationOptions, exceptionState, CustomElement::EmbedderNames);
    ec = exceptionState.code();
    if (exceptionState.hadException())
        return v8::Local<v8::Value>();
    return constructor.v8Value();
}
开发者ID:shaoboyan,项目名称:chromium-crosswalk,代码行数:15,代码来源:WebDocument.cpp

示例5: query

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;
}
开发者ID:Pluto-tv,项目名称:blink-crosswalk,代码行数:26,代码来源:Permissions.cpp

示例6: 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());
}
开发者ID:joone,项目名称:chromium-crosswalk,代码行数:30,代码来源:InspectorOverlay.cpp

示例7: doUnapply

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);
}
开发者ID:chunywang,项目名称:blink-crosswalk,代码行数:25,代码来源:MergeIdenticalElementsCommand.cpp

示例8: runShadowDOMTest

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();
}
开发者ID:mirror,项目名称:chromium,代码行数:27,代码来源:TouchActionTest.cpp

示例9: request

ScriptPromise Permissions::request(ScriptState* scriptState, const Vector<Dictionary>& rawPermissions)
{
    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;
    OwnPtr<WebVector<WebPermissionType>> permissions = adoptPtr(new WebVector<WebPermissionType>(rawPermissions.size()));

    for (size_t i = 0; i < rawPermissions.size(); ++i) {
        const Dictionary& rawPermission = rawPermissions[i];
        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())));

        permissions->operator[](i) = getPermissionType(scriptState, rawPermission, permission, exceptionState);
    }

    ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState);
    ScriptPromise promise = resolver->promise();

    // We need to do this is a separate loop because we can't create the Resolver and Promise untile we are clear of all parsing/type errors.
    for (size_t i = 0; i < rawPermissions.size(); ++i) {
        if (handleNotSupportedPermission(scriptState, rawPermissions[i], resolver, (*permissions)[i], exceptionState))
            return promise;
    }

    client->requestPermissions(*permissions, KURL(KURL(), scriptState->executionContext()->securityOrigin()->toString()), new PermissionsCallback(resolver, permissions.release()));
    return promise;
}
开发者ID:Pluto-tv,项目名称:blink-crosswalk,代码行数:31,代码来源:Permissions.cpp

示例10: createEvent

WebDOMEvent WebDocument::createEvent(const WebString& eventType)
{
    TrackExceptionState exceptionState;
    WebDOMEvent event(unwrap<Document>()->createEvent(eventType, exceptionState));
    if (exceptionState.hadException())
        return WebDOMEvent();
    return event;
}
开发者ID:pozdnyakov,项目名称:blink-crosswalk-1,代码行数:8,代码来源:WebDocument.cpp

示例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;
}
开发者ID:aobzhirov,项目名称:ChromiumGStreamerBackend,代码行数:8,代码来源:WebSerializedScriptValue.cpp

示例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);
}
开发者ID:Igalia,项目名称:blink,代码行数:8,代码来源:SplitTextNodeCommand.cpp

示例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();
}
开发者ID:venkatarajasekhar,项目名称:Qt,代码行数:9,代码来源:WebElement.cpp

示例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();
}
开发者ID:joone,项目名称:blink-crosswalk,代码行数:9,代码来源:VisiblePosition.cpp

示例15: setBaseValueAsString

void SVGStaticStringList::setBaseValueAsString(const String& value, SVGParsingError& parseError)
{
    TrackExceptionState es;

    m_value->setValueAsString(value, es);

    if (es.hadException())
        parseError = ParsingAttributeFailedError;
}
开发者ID:venkatarajasekhar,项目名称:Qt,代码行数:9,代码来源:SVGStaticStringList.cpp


注:本文中的TrackExceptionState::hadException方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。