本文整理汇总了C++中PassRefPtrWillBeRawPtr类的典型用法代码示例。如果您正苦于以下问题:C++ PassRefPtrWillBeRawPtr类的具体用法?C++ PassRefPtrWillBeRawPtr怎么用?C++ PassRefPtrWillBeRawPtr使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PassRefPtrWillBeRawPtr类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: toMouseEvent
PassRefPtrWillBeRawPtr<MouseEvent> MouseEvent::create(const AtomicString& eventType, PassRefPtrWillBeRawPtr<AbstractView> view, PassRefPtrWillBeRawPtr<Event> underlyingEvent, SimulatedClickCreationScope creationScope)
{
PlatformEvent::Modifiers modifiers = PlatformEvent::NoModifiers;
if (UIEventWithKeyState* keyStateEvent = findEventWithKeyState(underlyingEvent.get())) {
modifiers = keyStateEvent->modifiers();
}
PlatformMouseEvent::SyntheticEventType syntheticType = PlatformMouseEvent::Positionless;
int screenX = 0;
int screenY = 0;
if (underlyingEvent && underlyingEvent->isMouseEvent()) {
syntheticType = PlatformMouseEvent::RealOrIndistinguishable;
MouseEvent* mouseEvent = toMouseEvent(underlyingEvent.get());
screenX = mouseEvent->screenLocation().x();
screenY = mouseEvent->screenLocation().y();
}
double timestamp = underlyingEvent ? underlyingEvent->platformTimeStamp() : monotonicallyIncreasingTime();
RefPtrWillBeRawPtr<MouseEvent> createdEvent = MouseEvent::create(eventType, true, true, view,
0, screenX, screenY, 0, 0, 0, 0, modifiers, 0, 0, nullptr,
timestamp, syntheticType);
createdEvent->setTrusted(creationScope == SimulatedClickCreationScope::FromUserAgent);
createdEvent->setUnderlyingEvent(underlyingEvent);
if (syntheticType == PlatformMouseEvent::RealOrIndistinguishable) {
MouseEvent* mouseEvent = toMouseEvent(createdEvent->underlyingEvent());
createdEvent->initCoordinates(mouseEvent->clientLocation());
}
return createdEvent.release();
}
示例2: dispatchEvent
DispatchEventResult EventDispatcher::dispatchEvent(Node& node, PassRefPtrWillBeRawPtr<EventDispatchMediator> mediator)
{
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("blink.debug"), "EventDispatcher::dispatchEvent");
ASSERT(!EventDispatchForbiddenScope::isEventDispatchForbidden());
EventDispatcher dispatcher(node, &mediator->event());
return mediator->dispatchEvent(dispatcher);
}
示例3: add
bool TextTrackCueList::add(PassRefPtrWillBeRawPtr<TextTrackCue> cue)
{
ASSERT(cue->startTime() >= 0);
ASSERT(cue->endTime() >= 0);
return add(cue, 0, m_list.size());
}
示例4: workerGlobalScopeDidConnect
static void workerGlobalScopeDidConnect(ExecutionContext* context, PassRefPtrWillBeRawPtr<ThreadableWebSocketChannelClientWrapper> workerClientWrapper, const String& subprotocol, const String& extensions)
{
ASSERT_UNUSED(context, context->isWorkerGlobalScope());
workerClientWrapper->setSubprotocol(subprotocol);
workerClientWrapper->setExtensions(extensions);
workerClientWrapper->didConnect();
}
示例5: expandToParagraphBoundary
static PassRefPtrWillBeRawPtr<Range> expandToParagraphBoundary(PassRefPtrWillBeRawPtr<Range> range)
{
RefPtrWillBeRawPtr<Range> paragraphRange = range->cloneRange();
setStart(paragraphRange.get(), startOfParagraph(VisiblePosition(range->startPosition())));
setEnd(paragraphRange.get(), endOfParagraph(VisiblePosition(range->endPosition())));
return paragraphRange;
}
示例6: createInjectedScriptHostV8Wrapper
static v8::Local<v8::Object> createInjectedScriptHostV8Wrapper(PassRefPtrWillBeRawPtr<InjectedScriptHost> host, InjectedScriptManager* injectedScriptManager, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
{
ASSERT(host);
v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext, &V8InjectedScriptHost::wrapperTypeInfo, host->toScriptWrappableBase(), isolate);
if (UNLIKELY(wrapper.IsEmpty()))
return wrapper;
// Create a weak reference to the v8 wrapper of InspectorBackend to deref
// InspectorBackend when the wrapper is garbage collected.
InjectedScriptManager::CallbackData* callbackData = injectedScriptManager->createCallbackData(injectedScriptManager);
#if ENABLE(OILPAN)
callbackData->hostPtr = WrapperPersistent<InjectedScriptHost>::create(host.get());
#else
callbackData->host = host.get();
#endif
callbackData->handle.set(isolate, wrapper);
callbackData->handle.setWeak(callbackData, &InjectedScriptManager::setWeakCallback);
#if ENABLE(OILPAN)
V8DOMWrapper::setNativeInfoWithPersistentHandle(wrapper, &V8InjectedScriptHost::wrapperTypeInfo, host->toScriptWrappableBase(), callbackData->hostPtr);
#else
V8DOMWrapper::setNativeInfo(wrapper, &V8InjectedScriptHost::wrapperTypeInfo, host->toScriptWrappableBase());
#endif
ASSERT(V8DOMWrapper::isDOMWrapper(wrapper));
return wrapper;
}
示例7: cueIsBefore
static bool cueIsBefore(const TextTrackCue* cue, PassRefPtrWillBeRawPtr<TextTrackCue> otherCue)
{
if (cue->startTime() < otherCue->startTime())
return true;
return cue->startTime() == otherCue->startTime() && cue->endTime() > otherCue->endTime();
}
示例8: CSSCalcBinaryOperation
CSSCalcBinaryOperation(PassRefPtrWillBeRawPtr<CSSCalcExpressionNode> leftSide, PassRefPtrWillBeRawPtr<CSSCalcExpressionNode> rightSide, CalcOperator op, CalculationCategory category)
: CSSCalcExpressionNode(category, isIntegerResult(leftSide.get(), rightSide.get(), op))
, m_leftSide(leftSide)
, m_rightSide(rightSide)
, m_operator(op)
{
}
示例9: initCSSFontFace
void FontFace::initCSSFontFace(Document* document, PassRefPtrWillBeRawPtr<CSSValue> src)
{
m_cssFontFace = createCSSFontFace(this, m_unicodeRange.get());
if (m_error)
return;
// Each item in the src property's list is a single CSSFontFaceSource. Put them all into a CSSFontFace.
ASSERT(src);
ASSERT(src->isValueList());
CSSValueList* srcList = toCSSValueList(src.get());
int srcLength = srcList->length();
for (int i = 0; i < srcLength; i++) {
// An item in the list either specifies a string (local font name) or a URL (remote font to download).
CSSFontFaceSrcValue* item = toCSSFontFaceSrcValue(srcList->item(i));
OwnPtrWillBeRawPtr<CSSFontFaceSource> source = nullptr;
if (!item->isLocal()) {
const Settings* settings = document ? document->settings() : nullptr;
bool allowDownloading = settings && settings->downloadableBinaryFontsEnabled();
if (allowDownloading && item->isSupportedFormat() && document) {
FontResource* fetched = item->fetch(document);
if (fetched) {
FontLoader* fontLoader = document->styleEngine().fontSelector()->fontLoader();
source = adoptPtrWillBeNoop(new RemoteFontFaceSource(fetched, fontLoader));
}
}
} else {
source = adoptPtrWillBeNoop(new LocalFontFaceSource(item->resource()));
}
if (source)
m_cssFontFace->addSource(source.release());
}
}
示例10: buildSerializablePositionOffset
static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> buildSerializablePositionOffset(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> offset, CSSValueID defaultSide)
{
CSSValueID side = defaultSide;
RefPtrWillBeRawPtr<CSSPrimitiveValue> amount = nullptr;
if (!offset) {
side = CSSValueCenter;
} else if (offset->isValueID()) {
side = offset->getValueID();
} else if (Pair* pair = offset->getPairValue()) {
side = pair->first()->getValueID();
amount = pair->second();
} else {
amount = offset;
}
if (side == CSSValueCenter) {
side = defaultSide;
amount = cssValuePool().createValue(50, CSSPrimitiveValue::CSS_PERCENTAGE);
} else if ((side == CSSValueRight || side == CSSValueBottom)
&& amount->isPercentage()) {
side = defaultSide;
amount = cssValuePool().createValue(100 - amount->getFloatValue(), CSSPrimitiveValue::CSS_PERCENTAGE);
} else if (amount->isLength() && !amount->getFloatValue()) {
if (side == CSSValueRight || side == CSSValueBottom)
amount = cssValuePool().createValue(100, CSSPrimitiveValue::CSS_PERCENTAGE);
else
amount = cssValuePool().createValue(0, CSSPrimitiveValue::CSS_PERCENTAGE);
side = defaultSide;
}
return cssValuePool().createValue(Pair::create(cssValuePool().createValue(side), amount.release(), Pair::KeepIdenticalValues));
}
示例11: pushHTMLBodyElement
void HTMLElementStack::pushHTMLBodyElement(PassRefPtrWillBeRawPtr<HTMLStackItem> item)
{
ASSERT(item->hasTagName(HTMLNames::bodyTag));
ASSERT(!m_bodyElement);
m_bodyElement = item->element();
pushCommon(item);
}
示例12: enqueueRequest
void SpellCheckRequester::enqueueRequest(PassRefPtrWillBeRawPtr<SpellCheckRequest> request)
{
ASSERT(request);
bool continuation = false;
if (!m_requestQueue.isEmpty()) {
RefPtrWillBeRawPtr<SpellCheckRequest> lastRequest = m_requestQueue.last();
// It's a continuation if the number of the last request got incremented in the new one and
// both apply to the same editable.
continuation = request->rootEditableElement() == lastRequest->rootEditableElement()
&& request->requestNumber() == lastRequest->requestNumber() + 1;
}
// Spellcheck requests for chunks of text in the same element should not overwrite each other.
if (!continuation) {
for (auto& requestQueue : m_requestQueue) {
if (request->rootEditableElement() != requestQueue->rootEditableElement())
continue;
requestQueue = request;
return;
}
}
m_requestQueue.append(request);
}
示例13: insertAbove
void HTMLElementStack::insertAbove(PassRefPtrWillBeRawPtr<HTMLStackItem> item, ElementRecord* recordBelow)
{
ASSERT(item);
ASSERT(recordBelow);
ASSERT(m_top);
ASSERT(!item->hasTagName(htmlTag));
ASSERT(!item->hasTagName(headTag));
ASSERT(!item->hasTagName(bodyTag));
ASSERT(m_rootNode);
if (recordBelow == m_top) {
push(item);
return;
}
for (ElementRecord* recordAbove = m_top.get(); recordAbove; recordAbove = recordAbove->next()) {
if (recordAbove->next() != recordBelow)
continue;
m_stackDepth++;
recordAbove->setNext(adoptPtrWillBeNoop(new ElementRecord(item, recordAbove->releaseNext())));
recordAbove->next()->element()->beginParsingChildren();
return;
}
ASSERT_NOT_REACHED();
}
示例14: createUpgradeCandidateWrapper
v8::Handle<v8::Object> CustomElementWrapper<ElementType, WrapperType>::wrap(PassRefPtrWillBeRawPtr<ElementType> element, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate, v8::Handle<v8::Object> (*createSpecificWrapper)(ElementType* element, v8::Handle<v8::Object> creationContext, v8::Isolate*))
{
ASSERT(DOMDataStore::getWrapper<V8Element>(element.get(), isolate).IsEmpty());
// FIXME: creationContext.IsEmpty() should never happen. Remove
// this when callers (like InspectorController::inspect) are fixed
// to never pass an empty creation context.
v8::Handle<v8::Context> context = creationContext.IsEmpty() ? isolate->GetCurrentContext() : creationContext->CreationContext();
if (!element->isUpgradedCustomElement() || DOMWrapperWorld::world(context).isIsolatedWorld())
return createUpgradeCandidateWrapper(element.get(), creationContext, isolate, createSpecificWrapper);
V8PerContextData* perContextData = V8PerContextData::from(context);
if (!perContextData)
return v8::Handle<v8::Object>();
CustomElementBinding* binding = perContextData->customElementBinding(element->customElementDefinition());
v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext, binding->wrapperType(), element.get(), isolate);
if (wrapper.IsEmpty())
return v8::Handle<v8::Object>();
wrapper->SetPrototype(binding->prototype());
V8DOMWrapper::associateObjectWithWrapper<WrapperType>(element, binding->wrapperType(), wrapper, isolate, WrapperConfiguration::Dependent);
return wrapper;
}
示例15: initCSSFontFace
void FontFace::initCSSFontFace(Document* document, PassRefPtrWillBeRawPtr<CSSValue> src)
{
m_cssFontFace = createCSSFontFace(this, m_unicodeRange.get());
if (m_error)
return;
// Each item in the src property's list is a single CSSFontFaceSource. Put them all into a CSSFontFace.
ASSERT(src);
ASSERT(src->isValueList());
CSSValueList* srcList = toCSSValueList(src.get());
int srcLength = srcList->length();
bool foundSVGFont = false;
for (int i = 0; i < srcLength; i++) {
// An item in the list either specifies a string (local font name) or a URL (remote font to download).
CSSFontFaceSrcValue* item = toCSSFontFaceSrcValue(srcList->item(i));
OwnPtrWillBeRawPtr<CSSFontFaceSource> source = nullptr;
#if ENABLE(SVG_FONTS)
foundSVGFont = item->isSVGFontFaceSrc() || item->svgFontFaceElement();
#endif
if (!item->isLocal()) {
Settings* settings = document ? document->frame() ? document->frame()->settings() : 0 : 0;
bool allowDownloading = foundSVGFont || (settings && settings->downloadableBinaryFontsEnabled());
if (allowDownloading && item->isSupportedFormat() && document) {
FontResource* fetched = item->fetch(document);
if (fetched) {
FontLoader* fontLoader = document->styleEngine()->fontSelector()->fontLoader();
#if ENABLE(SVG_FONTS)
if (foundSVGFont) {
source = adoptPtrWillBeNoop(new SVGRemoteFontFaceSource(item->resource(), fetched, fontLoader));
} else
#endif
{
source = adoptPtrWillBeNoop(new RemoteFontFaceSource(fetched, fontLoader));
}
}
}
} else {
#if ENABLE(SVG_FONTS)
if (item->svgFontFaceElement()) {
RefPtrWillBeRawPtr<SVGFontFaceElement> fontfaceElement = item->svgFontFaceElement();
// SVGFontFaceSource assumes that it is the case where <font-face> element resides in the same document.
// We put a RELEASE_ASSERT here as it will cause UAF if the assumption is false.
RELEASE_ASSERT(fontfaceElement->inDocument());
RELEASE_ASSERT(fontfaceElement->document() == document);
source = adoptPtrWillBeNoop(new SVGFontFaceSource(fontfaceElement.get()));
} else
#endif
{
source = adoptPtrWillBeNoop(new LocalFontFaceSource(item->resource()));
}
}
if (source)
m_cssFontFace->addSource(source.release());
}
}