本文整理汇总了C++中OwnPtrWillBeRawPtr类的典型用法代码示例。如果您正苦于以下问题:C++ OwnPtrWillBeRawPtr类的具体用法?C++ OwnPtrWillBeRawPtr怎么用?C++ OwnPtrWillBeRawPtr使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了OwnPtrWillBeRawPtr类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: treeScope
void ScopedStyleResolver::addTreeBoundaryCrossingRules(const RuleSet& authorRules, CSSStyleSheet* parentStyleSheet, unsigned sheetIndex)
{
bool isDocumentScope = treeScope().rootNode().isDocumentNode();
if (authorRules.deepCombinatorOrShadowPseudoRules().isEmpty()
&& (isDocumentScope || (authorRules.contentPseudoElementRules().isEmpty() && authorRules.slottedPseudoElementRules().isEmpty())))
return;
if (!authorRules.deepCombinatorOrShadowPseudoRules().isEmpty())
m_hasDeepOrShadowSelector = true;
OwnPtrWillBeRawPtr<RuleSet> ruleSetForScope = RuleSet::create();
addRules(ruleSetForScope.get(), authorRules.deepCombinatorOrShadowPseudoRules());
if (!isDocumentScope) {
addRules(ruleSetForScope.get(), authorRules.contentPseudoElementRules());
addRules(ruleSetForScope.get(), authorRules.slottedPseudoElementRules());
}
if (!m_treeBoundaryCrossingRuleSet) {
m_treeBoundaryCrossingRuleSet = adoptPtrWillBeNoop(new CSSStyleSheetRuleSubSet());
treeScope().document().styleResolver()->addTreeBoundaryCrossingScope(treeScope().rootNode());
}
m_treeBoundaryCrossingRuleSet->append(RuleSubSet::create(parentStyleSheet, sheetIndex, ruleSetForScope.release()));
}
示例2: create
bool MediaQuerySet::add(const String& queryString)
{
// To "parse a media query" for a given string means to follow "the parse
// a media query list" steps and return "null" if more than one media query
// is returned, or else the returned media query.
RefPtrWillBeRawPtr<MediaQuerySet> result = create(queryString);
// Only continue if exactly one media query is found, as described above.
if (result->m_queries.size() != 1)
return true;
OwnPtrWillBeRawPtr<MediaQuery> newQuery = result->m_queries[0].release();
ASSERT(newQuery);
// If comparing with any of the media queries in the collection of media
// queries returns true terminate these steps.
for (size_t i = 0; i < m_queries.size(); ++i) {
MediaQuery* query = m_queries[i].get();
if (*query == *newQuery)
return true;
}
m_queries.append(newQuery.release());
return true;
}
示例3: TEST_F
TEST_F(ScrollableAreaTest, ScrollbarTrackAndThumbRepaint)
{
ScrollbarThemeWithMockInvalidation theme;
OwnPtrWillBeRawPtr<MockScrollableArea> scrollableArea = MockScrollableArea::create(IntPoint(0, 100));
RefPtrWillBeRawPtr<Scrollbar> scrollbar = Scrollbar::createForTesting(scrollableArea.get(), HorizontalScrollbar, RegularScrollbar, &theme);
EXPECT_CALL(theme, shouldRepaintAllPartsOnInvalidation()).WillRepeatedly(Return(true));
EXPECT_TRUE(scrollbar->trackNeedsRepaint());
EXPECT_TRUE(scrollbar->thumbNeedsRepaint());
scrollbar->setNeedsPaintInvalidation(NoPart);
EXPECT_TRUE(scrollbar->trackNeedsRepaint());
EXPECT_TRUE(scrollbar->thumbNeedsRepaint());
scrollbar->clearTrackNeedsRepaint();
scrollbar->clearThumbNeedsRepaint();
EXPECT_FALSE(scrollbar->trackNeedsRepaint());
EXPECT_FALSE(scrollbar->thumbNeedsRepaint());
scrollbar->setNeedsPaintInvalidation(ThumbPart);
EXPECT_TRUE(scrollbar->trackNeedsRepaint());
EXPECT_TRUE(scrollbar->thumbNeedsRepaint());
// When not all parts are repainted on invalidation,
// setNeedsPaintInvalidation sets repaint bits only on the requested parts.
EXPECT_CALL(theme, shouldRepaintAllPartsOnInvalidation()).WillRepeatedly(Return(false));
scrollbar->clearTrackNeedsRepaint();
scrollbar->clearThumbNeedsRepaint();
EXPECT_FALSE(scrollbar->trackNeedsRepaint());
EXPECT_FALSE(scrollbar->thumbNeedsRepaint());
scrollbar->setNeedsPaintInvalidation(ThumbPart);
EXPECT_FALSE(scrollbar->trackNeedsRepaint());
EXPECT_TRUE(scrollbar->thumbNeedsRepaint());
// Forced GC in order to finalize objects depending on the mock object.
Heap::collectAllGarbage();
}
示例4: createCSSFontFace
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());
}
}
示例5: TEST
TEST(ScrollAnimatorTest, Disabled)
{
OwnPtrWillBeRawPtr<MockScrollableArea> scrollableArea = MockScrollableArea::create(false);
OwnPtr<ScrollAnimator> scrollAnimator = adoptPtr(new ScrollAnimator(scrollableArea.get(), getMockedTime));
EXPECT_CALL(*scrollableArea, minimumScrollPosition()).Times(AtLeast(1)).WillRepeatedly(Return(IntPoint()));
EXPECT_CALL(*scrollableArea, maximumScrollPosition()).Times(AtLeast(1)).WillRepeatedly(Return(IntPoint(1000, 1000)));
EXPECT_CALL(*scrollableArea, setScrollOffset(_, _)).Times(8);
EXPECT_CALL(*scrollableArea, registerForAnimation()).Times(0);
scrollAnimator->userScroll(HorizontalScrollbar, ScrollByLine, 100, 1);
EXPECT_EQ(100, scrollAnimator->currentPosition().x());
EXPECT_EQ(0, scrollAnimator->currentPosition().y());
reset(*scrollAnimator);
scrollAnimator->userScroll(HorizontalScrollbar, ScrollByPage, 100, 1);
EXPECT_EQ(100, scrollAnimator->currentPosition().x());
EXPECT_EQ(0, scrollAnimator->currentPosition().y());
reset(*scrollAnimator);
scrollAnimator->userScroll(HorizontalScrollbar, ScrollByDocument, 100, 1);
EXPECT_EQ(100, scrollAnimator->currentPosition().x());
EXPECT_EQ(0, scrollAnimator->currentPosition().y());
reset(*scrollAnimator);
scrollAnimator->userScroll(HorizontalScrollbar, ScrollByPixel, 100, 1);
EXPECT_EQ(100, scrollAnimator->currentPosition().x());
EXPECT_EQ(0, scrollAnimator->currentPosition().y());
reset(*scrollAnimator);
}
示例6: ASSERT
void DatabaseClient::createInspectorAgentFor(Page* page)
{
ASSERT(!m_inspectorAgent);
OwnPtrWillBeRawPtr<InspectorDatabaseAgent> inspectorAgent = InspectorDatabaseAgent::create();
m_inspectorAgent = inspectorAgent.get();
page->inspectorController().registerModuleAgent(inspectorAgent.release());
}
示例7: toWebGLContextAttributes
PassOwnPtrWillBeRawPtr<CanvasRenderingContext> WebGL2RenderingContext::Factory::create(HTMLCanvasElement* canvas, const CanvasContextCreationAttributes& attrs, Document&)
{
if (!RuntimeEnabledFeatures::unsafeES3APIsEnabled()) {
canvas->dispatchEvent(WebGLContextEvent::create(EventTypeNames::webglcontextcreationerror, false, true, "Creation of WebGL2 contexts disabled."));
return nullptr;
}
WebGLContextAttributes attributes = toWebGLContextAttributes(attrs);
OwnPtr<WebGraphicsContext3D> context(createWebGraphicsContext3D(canvas, attributes, 2));
if (!context)
return nullptr;
OwnPtr<Extensions3DUtil> extensionsUtil = Extensions3DUtil::create(context.get());
if (!extensionsUtil)
return nullptr;
if (extensionsUtil->supportsExtension("GL_EXT_debug_marker")) {
String contextLabel(String::format("WebGL2RenderingContext-%p", context.get()));
context->pushGroupMarkerEXT(contextLabel.ascii().data());
}
OwnPtrWillBeRawPtr<WebGL2RenderingContext> renderingContext = adoptPtrWillBeNoop(new WebGL2RenderingContext(canvas, context.release(), attributes));
if (!renderingContext->drawingBuffer()) {
canvas->dispatchEvent(WebGLContextEvent::create(EventTypeNames::webglcontextcreationerror, false, true, "Could not create a WebGL2 context."));
return nullptr;
}
renderingContext->initializeNewContext();
renderingContext->registerContextExtensions();
return renderingContext.release();
}
示例8: createCSSFontFace
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());
}
}
示例9: loadChildSheet
void XSLStyleSheet::loadChildSheet(const String& href)
{
OwnPtrWillBeRawPtr<XSLImportRule> childRule = XSLImportRule::create(this, href);
XSLImportRule* c = childRule.get();
m_children.append(childRule.release());
c->loadSheet();
}
示例10: onLoaderFinished
void FetchManager::onLoaderFinished(Loader* loader)
{
// We don't use remove here, because it may cause recursive deletion.
OwnPtrWillBeRawPtr<Loader> p = m_loaders.take(loader);
ASSERT(p);
p->dispose();
}
示例11: TEST_F
TEST_F(AnimationLengthStyleInterpolationTest, MultipleUnits)
{
CSSLengthArray actual, expectation;
initLengthArray(expectation);
OwnPtrWillBeRawPtr<InterpolableList> list = createInterpolableLength(0, 10, 0, 10, 0, 10, 0, 10, 0, 10);
toCSSPrimitiveValue(interpolableValueToLength(list.get(), ValueRangeAll).get())->accumulateLengthArray(expectation);
EXPECT_TRUE(lengthArraysEqual(expectation, setLengthArray(actual, "calc(10% + 10ex + 10ch + 10vh + 10vmax)")));
}
示例12: setInterval
int setInterval(ScriptState* scriptState, EventTarget& eventTarget, const ScriptValue& handler, int timeout, const Vector<ScriptValue>& arguments)
{
ExecutionContext* executionContext = eventTarget.executionContext();
if (!isAllowed(scriptState, executionContext, false))
return 0;
OwnPtrWillBeRawPtr<ScheduledAction> action = ScheduledAction::create(scriptState, handler, arguments);
return DOMTimer::install(executionContext, action.release(), timeout, false);
}
示例13: performTask
virtual void performTask(ExecutionContext* scriptContext)
{
ASSERT_WITH_SECURITY_IMPLICATION(scriptContext->isWorkerGlobalScope());
DedicatedWorkerGlobalScope* context = static_cast<DedicatedWorkerGlobalScope*>(scriptContext);
OwnPtrWillBeRawPtr<MessagePortArray> ports = MessagePort::entanglePorts(*scriptContext, m_channels.release());
context->dispatchEvent(MessageEvent::create(ports.release(), m_message));
context->thread()->workerObjectProxy().confirmMessageFromWorkerObject(context->hasPendingActivity());
}
示例14: postMessageToWorkerObject
void WorkerMessagingProxy::postMessageToWorkerObject(PassRefPtr<SerializedScriptValue> message, PassOwnPtr<MessagePortChannelArray> channels)
{
if (!m_workerObject || m_askedToTerminate)
return;
OwnPtrWillBeRawPtr<MessagePortArray> ports = MessagePort::entanglePorts(*m_executionContext.get(), channels);
m_workerObject->dispatchEvent(MessageEvent::create(ports.release(), message));
}
示例15: pluginLoadObserver
void FrameLoaderClientImpl::dispatchDidFailProvisionalLoad(
const ResourceError& error, HistoryCommitType commitType)
{
OwnPtrWillBeRawPtr<WebPluginLoadObserver> observer = pluginLoadObserver(m_webFrame->frame()->loader().provisionalDocumentLoader());
m_webFrame->didFail(error, true, commitType);
if (observer)
observer->didFailLoading(error);
}