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())); }
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; }
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(); }
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()); } }
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); }
void DatabaseClient::createInspectorAgentFor(Page* page) { ASSERT(!m_inspectorAgent); OwnPtrWillBeRawPtr<InspectorDatabaseAgent> inspectorAgent = InspectorDatabaseAgent::create(); m_inspectorAgent = inspectorAgent.get(); page->inspectorController().registerModuleAgent(inspectorAgent.release()); }
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(); }
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()); } }
void XSLStyleSheet::loadChildSheet(const String& href) { OwnPtrWillBeRawPtr<XSLImportRule> childRule = XSLImportRule::create(this, href); XSLImportRule* c = childRule.get(); m_children.append(childRule.release()); c->loadSheet(); }
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(); }
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)"))); }
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); }
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()); }
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)); }
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); }
PassOwnPtrWillBeRawPtr<InterpolableValue> IntegerOptionalIntegerSVGInterpolation::toInterpolableValue(SVGPropertyBase* value) { RefPtrWillBeRawPtr<SVGIntegerOptionalInteger> integerOptionalInteger = toSVGIntegerOptionalInteger(value); OwnPtrWillBeRawPtr<InterpolableList> result = InterpolableList::create(2); result->set(0, InterpolableNumber::create(integerOptionalInteger->firstInteger()->value())); result->set(1, InterpolableNumber::create(integerOptionalInteger->secondInteger()->value())); return result.release(); }
PassOwnPtrWillBeRawPtr<NodeSet> NodeSet::create(const NodeSet& other) { OwnPtrWillBeRawPtr<NodeSet> nodeSet = NodeSet::create(); nodeSet->m_isSorted = other.m_isSorted; nodeSet->m_subtreesAreDisjoint = other.m_subtreesAreDisjoint; nodeSet->m_nodes.appendVector(other.m_nodes); return nodeSet.release(); }
BisonCSSParser::RuleList* BisonCSSParser::createRuleList() { OwnPtrWillBeRawPtr<RuleList> list = adoptPtrWillBeNoop(new RuleList); RuleList* listPtr = list.get(); m_parsedRuleLists.append(list.release()); return listPtr; }
bool MediaQueryData::addExpression() { OwnPtrWillBeRawPtr<MediaQueryExp> expression = MediaQueryExp::createIfValid(m_mediaFeature, m_valueList); bool isValid = !!expression; m_expressions.append(expression.release()); m_valueList.clear(); return isValid; }
TEST_F(ScriptRunnerTest, QueueSingleScript_Async) { OwnPtrWillBeRawPtr<MockScriptLoader> scriptLoader = MockScriptLoader::create(m_element.get()); m_scriptRunner->queueScriptForExecution(scriptLoader.get(), ScriptRunner::ASYNC_EXECUTION); m_scriptRunner->notifyScriptReady(scriptLoader.get(), ScriptRunner::ASYNC_EXECUTION); EXPECT_CALL(*scriptLoader, execute()); m_platform.runAllTasks(); }
void RejectedPromises::dispose() { if (m_queue.isEmpty()) return; OwnPtrWillBeRawPtr<MessageQueue> queue = createMessageQueue(); queue->swap(m_queue); processQueueNow(queue.release()); }
void RejectedPromises::processQueue() { if (m_queue.isEmpty()) return; OwnPtrWillBeRawPtr<MessageQueue> queue = createMessageQueue(); queue->swap(m_queue); Platform::current()->currentThread()->scheduler()->timerTaskRunner()->postTask(BLINK_FROM_HERE, new Task(bind(&RejectedPromises::processQueueNow, PassRefPtrWillBeRawPtr<RejectedPromises>(this), queue.release()))); }
TEST_F(ScriptRunnerTest, QueueSingleScript_InOrder) { OwnPtrWillBeRawPtr<MockScriptLoader> scriptLoader = MockScriptLoader::create(m_element.get()); m_scriptRunner->queueScriptForExecution(scriptLoader.get(), ScriptRunner::IN_ORDER_EXECUTION); m_scriptRunner->resume(); EXPECT_CALL(*scriptLoader, isReady()).WillOnce(Return(true)); EXPECT_CALL(*scriptLoader, execute()); m_platform.runAllTasks(); }
PassOwnPtrWillBeRawPtr<ColorChooser> ChromeClientImpl::createColorChooser(LocalFrame* frame, ColorChooserClient* chooserClient, const Color&) { OwnPtrWillBeRawPtr<ColorChooserUIController> controller = nullptr; if (RuntimeEnabledFeatures::pagePopupEnabled()) controller = ColorChooserPopupUIController::create(frame, this, chooserClient); else controller = ColorChooserUIController::create(frame, chooserClient); controller->openUI(); return controller.release(); }
PassOwnPtrWillBeRawPtr<WebGLRenderingContext> WebGLRenderingContext::create(HTMLCanvasElement* canvas, WebGLContextAttributes* attrs) { Document& document = canvas->document(); LocalFrame* frame = document.frame(); if (!frame) { canvas->dispatchEvent(WebGLContextEvent::create(EventTypeNames::webglcontextcreationerror, false, true, "Web page was not allowed to create a WebGL context.")); return nullptr; } Settings* settings = frame->settings(); // The FrameLoaderClient might block creation of a new WebGL context despite the page settings; in // particular, if WebGL contexts were lost one or more times via the GL_ARB_robustness extension. if (!frame->loader().client()->allowWebGL(settings && settings->webGLEnabled())) { canvas->dispatchEvent(WebGLContextEvent::create(EventTypeNames::webglcontextcreationerror, false, true, "Web page was not allowed to create a WebGL context.")); return nullptr; } // The only situation that attrs is null is through Document::getCSSCanvasContext(). RefPtrWillBeRawPtr<WebGLContextAttributes> defaultAttrs = nullptr; if (!attrs) { defaultAttrs = WebGLContextAttributes::create(); attrs = defaultAttrs.get(); } blink::WebGraphicsContext3D::Attributes attributes = attrs->attributes(document.topDocument().url().string(), settings, 1); blink::WebGLInfo glInfo; OwnPtr<blink::WebGraphicsContext3D> context = adoptPtr(blink::Platform::current()->createOffscreenGraphicsContext3D(attributes, 0, &glInfo)); if (!context) { String statusMessage("Could not create a WebGL context for VendorInfo = "); statusMessage.append(glInfo.vendorInfo); statusMessage.append(", RendererInfo = "); statusMessage.append(glInfo.rendererInfo); statusMessage.append(", DriverInfo = "); statusMessage.append(glInfo.driverVersion); statusMessage.append("."); canvas->dispatchEvent(WebGLContextEvent::create(EventTypeNames::webglcontextcreationerror, false, true, statusMessage)); return nullptr; } OwnPtr<Extensions3DUtil> extensionsUtil = Extensions3DUtil::create(context.get()); if (!extensionsUtil) return nullptr; if (extensionsUtil->supportsExtension("GL_EXT_debug_marker")) context->pushGroupMarkerEXT("WebGLRenderingContext"); OwnPtrWillBeRawPtr<WebGLRenderingContext> renderingContext = adoptPtrWillBeNoop(new WebGLRenderingContext(canvas, context.release(), attrs)); renderingContext->registerContextExtensions(); renderingContext->suspendIfNeeded(); if (!renderingContext->drawingBuffer()) { canvas->dispatchEvent(WebGLContextEvent::create(EventTypeNames::webglcontextcreationerror, false, true, "Could not create a WebGL context.")); return nullptr; } return renderingContext.release(); }
InspectorController::InspectorController(Page* page, InspectorClient* inspectorClient) : m_instrumentingAgents(InstrumentingAgents::create()) , m_injectedScriptManager(InjectedScriptManager::createForPage()) , m_state(adoptPtrWillBeNoop(new InspectorCompositeState(inspectorClient))) , m_overlay(InspectorOverlay::create(page, inspectorClient)) , m_cssAgent(nullptr) , m_resourceAgent(nullptr) , m_layerTreeAgent(nullptr) , m_inspectorFrontendClient(nullptr) , m_page(page) , m_inspectorClient(inspectorClient) , m_agents(m_instrumentingAgents.get(), m_state.get()) , m_isUnderTest(false) , m_deferredAgentsInitialized(false) { InjectedScriptManager* injectedScriptManager = m_injectedScriptManager.get(); InspectorOverlay* overlay = m_overlay.get(); m_agents.append(InspectorInspectorAgent::create(m_page, injectedScriptManager)); OwnPtrWillBeRawPtr<InspectorPageAgent> pageAgentPtr(InspectorPageAgent::create(m_page, injectedScriptManager, inspectorClient, overlay)); m_pageAgent = pageAgentPtr.get(); m_agents.append(pageAgentPtr.release()); OwnPtrWillBeRawPtr<InspectorDOMAgent> domAgentPtr(InspectorDOMAgent::create(m_pageAgent, injectedScriptManager, overlay)); m_domAgent = domAgentPtr.get(); m_agents.append(domAgentPtr.release()); OwnPtrWillBeRawPtr<InspectorLayerTreeAgent> layerTreeAgentPtr(InspectorLayerTreeAgent::create(m_page)); m_layerTreeAgent = layerTreeAgentPtr.get(); m_agents.append(layerTreeAgentPtr.release()); OwnPtrWillBeRawPtr<InspectorWorkerAgent> workerAgentPtr = InspectorWorkerAgent::create(); OwnPtrWillBeRawPtr<InspectorTracingAgent> tracingAgentPtr = InspectorTracingAgent::create(inspectorClient, workerAgentPtr.get()); m_tracingAgent = tracingAgentPtr.get(); m_agents.append(tracingAgentPtr.release()); m_agents.append(workerAgentPtr.release()); OwnPtrWillBeRawPtr<InspectorTimelineAgent> timelineAgentPtr(InspectorTimelineAgent::create(m_pageAgent, m_layerTreeAgent, overlay, InspectorTimelineAgent::PageInspector, inspectorClient)); m_timelineAgent = timelineAgentPtr.get(); m_agents.append(timelineAgentPtr.release()); PageScriptDebugServer* pageScriptDebugServer = &PageScriptDebugServer::shared(); m_agents.append(PageRuntimeAgent::create(injectedScriptManager, inspectorClient, pageScriptDebugServer, m_page, m_pageAgent)); m_agents.append(PageConsoleAgent::create(injectedScriptManager, m_domAgent, m_timelineAgent, m_page)); ASSERT_ARG(inspectorClient, inspectorClient); m_injectedScriptManager->injectedScriptHost()->init(m_instrumentingAgents.get(), pageScriptDebugServer); }
TEST_F(AnimationInterpolationEffectTest, SingleInterpolation) { RefPtrWillBeRawPtr<InterpolationEffect> interpolationEffect = InterpolationEffect::create(); interpolationEffect->addInterpolation(SampleInterpolation::create(InterpolableNumber::create(0), InterpolableNumber::create(10)), RefPtr<TimingFunction>(), 0, 1, -1, 2); OwnPtrWillBeRawPtr<WillBeHeapVector<RefPtrWillBeMember<Interpolation>>> activeInterpolations = nullptr; interpolationEffect->getActiveInterpolations(-2, duration, activeInterpolations); EXPECT_EQ(0ul, activeInterpolations->size()); interpolationEffect->getActiveInterpolations(-0.5, duration, activeInterpolations); EXPECT_EQ(1ul, activeInterpolations->size()); EXPECT_EQ(-5, getInterpolableNumber(activeInterpolations->at(0))); interpolationEffect->getActiveInterpolations(0.5, duration, activeInterpolations); EXPECT_EQ(1ul, activeInterpolations->size()); EXPECT_FLOAT_EQ(5, getInterpolableNumber(activeInterpolations->at(0))); interpolationEffect->getActiveInterpolations(1.5, duration, activeInterpolations); EXPECT_EQ(1ul, activeInterpolations->size()); EXPECT_FLOAT_EQ(15, getInterpolableNumber(activeInterpolations->at(0))); interpolationEffect->getActiveInterpolations(3, duration, activeInterpolations); EXPECT_EQ(0ul, activeInterpolations->size()); }
WorkerInspectorController::WorkerInspectorController(WorkerGlobalScope* workerGlobalScope) : m_workerGlobalScope(workerGlobalScope) , m_stateClient(adoptPtr(new WorkerStateClient(workerGlobalScope))) , m_state(adoptPtrWillBeNoop(new InspectorCompositeState(m_stateClient.get()))) , m_instrumentingAgents(InstrumentingAgents::create()) , m_injectedScriptManager(InjectedScriptManager::createForWorker()) , m_workerThreadDebugger(adoptPtr(new WorkerThreadDebugger(workerGlobalScope->thread()))) , m_agents(m_instrumentingAgents.get(), m_state.get()) , m_inspectorTaskRunner(adoptPtr(new InspectorTaskRunner(v8::Isolate::GetCurrent()))) , m_beforeInitlizedScope(adoptPtr(new InspectorTaskRunner::IgnoreInterruptsScope(m_inspectorTaskRunner.get()))) , m_paused(false) { OwnPtrWillBeRawPtr<WorkerRuntimeAgent> workerRuntimeAgent = WorkerRuntimeAgent::create(m_injectedScriptManager.get(), m_workerThreadDebugger->debugger(), workerGlobalScope, this); m_workerRuntimeAgent = workerRuntimeAgent.get(); m_agents.append(workerRuntimeAgent.release()); OwnPtrWillBeRawPtr<WorkerDebuggerAgent> workerDebuggerAgent = WorkerDebuggerAgent::create(m_workerThreadDebugger.get(), workerGlobalScope, m_injectedScriptManager.get()); m_workerDebuggerAgent = workerDebuggerAgent.get(); m_agents.append(workerDebuggerAgent.release()); m_asyncCallTracker = adoptPtrWillBeNoop(new AsyncCallTracker(m_workerDebuggerAgent->v8DebuggerAgent(), m_instrumentingAgents.get())); v8::Isolate* isolate = workerGlobalScope->thread()->isolate(); m_agents.append(InspectorProfilerAgent::create(isolate, m_injectedScriptManager.get(), 0)); m_agents.append(InspectorHeapProfilerAgent::create(isolate, m_injectedScriptManager.get())); OwnPtrWillBeRawPtr<WorkerConsoleAgent> workerConsoleAgent = WorkerConsoleAgent::create(m_injectedScriptManager.get(), workerGlobalScope); WorkerConsoleAgent* workerConsoleAgentPtr = workerConsoleAgent.get(); workerConsoleAgentPtr->setDebuggerAgent(m_workerDebuggerAgent->v8DebuggerAgent()); m_agents.append(workerConsoleAgent.release()); m_agents.append(InspectorTimelineAgent::create()); m_injectedScriptManager->injectedScriptHost()->init(workerConsoleAgentPtr, m_workerDebuggerAgent->v8DebuggerAgent(), nullptr, m_workerThreadDebugger->debugger(), adoptPtr(new WorkerInjectedScriptHostClient())); }
bool HTMLPlugInElement::loadPlugin(const KURL& url, const String& mimeType, const Vector<String>& paramNames, const Vector<String>& paramValues, bool useFallback, bool requireLayoutObject) { LocalFrame* frame = document().frame(); if (!frame->loader().allowPlugins(AboutToInstantiatePlugin)) return false; LayoutEmbeddedObject* layoutObject = layoutEmbeddedObject(); // FIXME: This code should not depend on layoutObject! if ((!layoutObject && requireLayoutObject) || useFallback) return false; WTF_LOG(Plugins, "%p Plugin URL: %s", this, m_url.utf8().data()); WTF_LOG(Plugins, " Loaded URL: %s", url.string().utf8().data()); m_loadedUrl = url; OwnPtrWillBeRawPtr<PluginPlaceholder> placeholder = nullptr; RefPtrWillBeRawPtr<Widget> widget = m_persistedPluginWidget; if (!widget) { bool loadManually = document().isPluginDocument() && !document().containsPlugins(); placeholder = frame->loader().client()->createPluginPlaceholder(document(), url, paramNames, paramValues, mimeType, loadManually); if (!placeholder) { FrameLoaderClient::DetachedPluginPolicy policy = requireLayoutObject ? FrameLoaderClient::FailOnDetachedPlugin : FrameLoaderClient::AllowDetachedPlugin; widget = frame->loader().client()->createPlugin(this, url, paramNames, paramValues, mimeType, loadManually, policy); } } if (!placeholder && !widget) { if (layoutObject && !layoutObject->showsUnavailablePluginIndicator()) layoutObject->setPluginUnavailabilityReason(LayoutEmbeddedObject::PluginMissing); setPlaceholder(nullptr); return false; } if (placeholder) { setPlaceholder(placeholder.release()); return true; } if (layoutObject) { setWidget(widget); setPersistedPluginWidget(nullptr); } else { setPersistedPluginWidget(widget.get()); } setPlaceholder(nullptr); document().setContainsPlugins(); scheduleSVGFilterLayerUpdateHack(); // Make sure any input event handlers introduced by the plugin are taken into account. if (Page* page = document().frame()->page()) { if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordinator()) scrollingCoordinator->notifyLayoutUpdated(); } return true; }
InspectorState* InspectorCompositeState::createAgentState(const String& agentName) { ASSERT(m_stateObject->find(agentName) == m_stateObject->end()); ASSERT(m_inspectorStateMap.find(agentName) == m_inspectorStateMap.end()); RefPtr<JSONObject> stateProperties = JSONObject::create(); m_stateObject->setObject(agentName, stateProperties); OwnPtrWillBeRawPtr<InspectorState> statePtr = adoptPtrWillBeNoop(new InspectorState(this, stateProperties)); InspectorState* state = statePtr.get(); m_inspectorStateMap.add(agentName, statePtr.release()); return state; }