v8::Handle<v8::Object> V8TestInterfaceDocument::createWrapper(PassRefPtrWillBeRawPtr<TestInterfaceDocument> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) { ASSERT(impl); ASSERT(!DOMDataStore::containsWrapper<V8TestInterfaceDocument>(impl.get(), isolate)); if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) { const WrapperTypeInfo* actualInfo = ScriptWrappable::fromObject(impl.get())->typeInfo(); // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapperTypeInfo. These will both have // the same object de-ref functions, though, so use that as the basis of the check. RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction == wrapperTypeInfo.derefObjectFunction); } if (LocalFrame* frame = impl->frame()) { if (frame->script().initializeMainWorld()) { // initializeMainWorld may have created a wrapper for the object, retry from the start. v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapper<V8TestInterfaceDocument>(impl.get(), isolate); if (!wrapper.IsEmpty()) return wrapper; } } v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext, &wrapperTypeInfo, toInternalPointer(impl.get()), isolate); if (UNLIKELY(wrapper.IsEmpty())) return wrapper; installPerContextEnabledProperties(wrapper, impl.get(), isolate); V8DOMWrapper::associateObjectWithWrapper<V8TestInterfaceDocument>(impl, &wrapperTypeInfo, wrapper, isolate, WrapperConfiguration::Dependent); return wrapper; }
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(); }
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; }
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; }
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) { }
TextCheckingParagraph::TextCheckingParagraph(PassRefPtrWillBeRawPtr<Range> checkingRange, PassRefPtrWillBeRawPtr<Range> paragraphRange) : m_checkingRange(checkingRange.get()) , m_paragraphRange(paragraphRange.get()) , m_checkingStart(-1) , m_checkingEnd(-1) , m_checkingLength(-1) { }
static PassRefPtrWillBeRawPtr<CSSCalcExpressionNode> createSimplified(PassRefPtrWillBeRawPtr<CSSCalcExpressionNode> leftSide, PassRefPtrWillBeRawPtr<CSSCalcExpressionNode> rightSide, CalcOperator op) { CalculationCategory leftCategory = leftSide->category(); CalculationCategory rightCategory = rightSide->category(); ASSERT(leftCategory != CalcOther && rightCategory != CalcOther); bool isInteger = isIntegerResult(leftSide.get(), rightSide.get(), op); // Simplify numbers. if (leftCategory == CalcNumber && rightCategory == CalcNumber) { return CSSCalcPrimitiveValue::create(evaluateOperator(leftSide->doubleValue(), rightSide->doubleValue(), op), CSSPrimitiveValue::UnitType::Number, isInteger); } // Simplify addition and subtraction between same types. if (op == CalcAdd || op == CalcSubtract) { if (leftCategory == rightSide->category()) { CSSPrimitiveValue::UnitType leftType = leftSide->typeWithCalcResolved(); if (hasDoubleValue(leftType)) { CSSPrimitiveValue::UnitType rightType = rightSide->typeWithCalcResolved(); if (leftType == rightType) return CSSCalcPrimitiveValue::create(evaluateOperator(leftSide->doubleValue(), rightSide->doubleValue(), op), leftType, isInteger); CSSPrimitiveValue::UnitCategory leftUnitCategory = CSSPrimitiveValue::unitCategory(leftType); if (leftUnitCategory != CSSPrimitiveValue::UOther && leftUnitCategory == CSSPrimitiveValue::unitCategory(rightType)) { CSSPrimitiveValue::UnitType canonicalType = CSSPrimitiveValue::canonicalUnitTypeForCategory(leftUnitCategory); if (canonicalType != CSSPrimitiveValue::UnitType::Unknown) { double leftValue = leftSide->doubleValue() * CSSPrimitiveValue::conversionToCanonicalUnitsScaleFactor(leftType); double rightValue = rightSide->doubleValue() * CSSPrimitiveValue::conversionToCanonicalUnitsScaleFactor(rightType); return CSSCalcPrimitiveValue::create(evaluateOperator(leftValue, rightValue, op), canonicalType, isInteger); } } } } } else { // Simplify multiplying or dividing by a number for simplifiable types. ASSERT(op == CalcMultiply || op == CalcDivide); CSSCalcExpressionNode* numberSide = getNumberSide(leftSide.get(), rightSide.get()); if (!numberSide) return create(leftSide, rightSide, op); if (numberSide == leftSide && op == CalcDivide) return nullptr; CSSCalcExpressionNode* otherSide = leftSide == numberSide ? rightSide.get() : leftSide.get(); double number = numberSide->doubleValue(); if (std::isnan(number) || std::isinf(number)) return nullptr; if (op == CalcDivide && !number) return nullptr; CSSPrimitiveValue::UnitType otherType = otherSide->typeWithCalcResolved(); if (hasDoubleValue(otherType)) return CSSCalcPrimitiveValue::create(evaluateOperator(otherSide->doubleValue(), number, op), otherType, isInteger); } return create(leftSide, rightSide, op); }
PassRefPtrWillBeRawPtr<AnimationEffect> makeAnimationEffect(CSSPropertyID id, PassRefPtrWillBeRawPtr<AnimatableValue> value) { AnimatableValueKeyframeVector keyframes(2); keyframes[0] = AnimatableValueKeyframe::create(); keyframes[0]->setOffset(0.0); keyframes[0]->setPropertyValue(id, value.get()); keyframes[1] = AnimatableValueKeyframe::create(); keyframes[1]->setOffset(1.0); keyframes[1]->setPropertyValue(id, value.get()); return AnimatableValueKeyframeEffectModel::create(keyframes); }
void IDBCursor::continueFunction(PassRefPtrWillBeRawPtr<IDBKey> key, PassRefPtrWillBeRawPtr<IDBKey> primaryKey, ExceptionState& exceptionState) { ASSERT(!primaryKey || (key && primaryKey)); if (m_transaction->isFinished() || m_transaction->isFinishing()) { exceptionState.throwDOMException(TransactionInactiveError, IDBDatabase::transactionFinishedErrorMessage); return; } if (!m_transaction->isActive()) { exceptionState.throwDOMException(TransactionInactiveError, IDBDatabase::transactionInactiveErrorMessage); return; } if (!m_gotValue) { exceptionState.throwDOMException(InvalidStateError, IDBDatabase::noValueErrorMessage); return; } if (isDeleted()) { exceptionState.throwDOMException(InvalidStateError, IDBDatabase::sourceDeletedErrorMessage); return; } if (key) { ASSERT(m_key); if (m_direction == WebIDBCursor::Next || m_direction == WebIDBCursor::NextNoDuplicate) { const bool ok = m_key->isLessThan(key.get()) || (primaryKey && m_key->isEqual(key.get()) && m_primaryKey->isLessThan(primaryKey.get())); if (!ok) { exceptionState.throwDOMException(DataError, "The parameter is less than or equal to this cursor's position."); return; } } else { const bool ok = key->isLessThan(m_key.get()) || (primaryKey && key->isEqual(m_key.get()) && primaryKey->isLessThan(m_primaryKey.get())); if (!ok) { exceptionState.throwDOMException(DataError, "The parameter is greater than or equal to this cursor's position."); return; } } } // FIXME: We're not using the context from when continue was called, which means the callback // will be on the original context openCursor was called on. Is this right? m_request->setPendingCursor(this); m_gotValue = false; m_backend->continueFunction(key, primaryKey, WebIDBCallbacksImpl::create(m_request).leakPtr()); }
void DateTimeEditElement::addField(PassRefPtrWillBeRawPtr<DateTimeFieldElement> field) { if (m_fields.size() == m_fields.capacity()) return; m_fields.append(field.get()); fieldsWrapperElement()->appendChild(field); }
void RTCStatsRequestImpl::requestSucceeded(PassRefPtrWillBeRawPtr<RTCStatsResponseBase> response) { if (!m_successCallback) return; m_successCallback->handleEvent(static_cast<RTCStatsResponse*>(response.get())); clear(); }
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()); } }
void SVGElement::setWebAnimatedAttribute(const QualifiedName& attribute, PassRefPtrWillBeRawPtr<SVGPropertyBase> value) { updateInstancesAnimatedAttribute(this, attribute, [&value](SVGAnimatedPropertyBase& animatedProperty) { animatedProperty.setAnimatedValue(value.get()); }); ensureSVGRareData()->webAnimatedAttributes().add(&attribute); }
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()); } }
bool IDBDatabase::dispatchEventInternal(PassRefPtrWillBeRawPtr<Event> event) { IDB_TRACE("IDBDatabase::dispatchEvent"); if (m_contextStopped || !executionContext()) return false; ASSERT(event->type() == EventTypeNames::versionchange || event->type() == EventTypeNames::close); for (size_t i = 0; i < m_enqueuedEvents.size(); ++i) { if (m_enqueuedEvents[i].get() == event.get()) m_enqueuedEvents.remove(i); } bool result = EventTarget::dispatchEventInternal(event.get()); if (event->type() == EventTypeNames::versionchange && !m_closePending && m_backend) m_backend->versionChangeIgnored(); return result; }
bool BeaconLoader::sendBeacon(LocalFrame* frame, int allowance, const KURL& beaconURL, PassRefPtrWillBeRawPtr<Blob>& data, int& payloadLength) { ASSERT(data); unsigned long long entitySize = data->size(); if (allowance > 0 && static_cast<unsigned long long>(allowance) < entitySize) return false; ResourceRequest request(beaconURL); prepareRequest(frame, request); RefPtr<FormData> entityBody = FormData::create(); if (data->hasBackingFile()) entityBody->appendFile(toFile(data.get())->path()); else entityBody->appendBlob(data->uuid(), data->blobDataHandle()); request.setHTTPBody(entityBody.release()); AtomicString contentType; const String& blobType = data->type(); if (!blobType.isEmpty() && isValidContentType(blobType)) request.setHTTPContentType(AtomicString(contentType)); issueRequest(frame, request); payloadLength = entitySize; return true; }
bool TextTrackCueList::add(PassRefPtrWillBeRawPtr<TextTrackCue> cue) { ASSERT(cue->startTime() >= 0); ASSERT(cue->endTime() >= 0); // Maintain text track cue order: // https://html.spec.whatwg.org/#text-track-cue-order size_t index = findInsertionIndex(cue.get()); // FIXME: The cue should not exist in the list in the first place. if (!m_list.isEmpty() && (index > 0) && (m_list[index - 1].get() == cue.get())) return false; m_list.insert(index, cue); invalidateCueIndex(index); return true; }
void ContentDistribution::append(PassRefPtrWillBeRawPtr<Node> node) { ASSERT(node); ASSERT(!isActiveInsertionPoint(*node)); size_t size = m_nodes.size(); m_indices.set(node.get(), size); m_nodes.append(node); }
void Event::setUnderlyingEvent(PassRefPtrWillBeRawPtr<Event> ue) { // Prohibit creation of a cycle -- just do nothing in that case. for (Event* e = ue.get(); e; e = e->underlyingEvent()) if (e == this) return; m_underlyingEvent = ue; }
bool EventTarget::dispatchEventInternal(PassRefPtrWillBeRawPtr<Event> event) { event->setTarget(this); event->setCurrentTarget(this); event->setEventPhase(Event::AT_TARGET); bool defaultWasNotPrevented = fireEventListeners(event.get()); event->setEventPhase(0); return defaultWasNotPrevented; }
void IDBDatabase::enqueueEvent(PassRefPtrWillBeRawPtr<Event> event) { ASSERT(!m_contextStopped); ASSERT(executionContext()); EventQueue* eventQueue = executionContext()->eventQueue(); event->setTarget(this); eventQueue->enqueueEvent(event.get()); m_enqueuedEvents.append(event); }
bool ServiceWorkerGlobalScope::dispatchEventInternal(PassRefPtrWillBeRawPtr<Event> event) { m_eventNestingLevel++; bool result = WorkerGlobalScope::dispatchEventInternal(event.get()); if (event->interfaceName() == EventNames::ErrorEvent && m_eventNestingLevel == 2) m_hadErrorInTopLevelEventHandler = true; m_eventNestingLevel--; return result; }
void VTTRegion::appendVTTCueBox(PassRefPtrWillBeRawPtr<VTTCueBox> displayBox) { ASSERT(m_cueContainer); if (m_cueContainer->contains(displayBox.get())) return; m_cueContainer->appendChild(displayBox); displayLastVTTCueBox(); }
void CueTimeline::addCueInternal(PassRefPtrWillBeRawPtr<TextTrackCue> cue) { // Negative duration cues need be treated in the interval tree as // zero-length cues. double endTime = std::max(cue->startTime(), cue->endTime()); CueInterval interval = m_cueTree.createInterval(cue->startTime(), endTime, cue.get()); if (!m_cueTree.contains(interval)) m_cueTree.add(interval); }
bool HTMLOptionsCollection::anonymousIndexedSetter(unsigned index, PassRefPtrWillBeRawPtr<HTMLOptionElement> value, ExceptionState& exceptionState) { HTMLSelectElement& base = toHTMLSelectElement(ownerNode()); if (!value) { // undefined or null base.remove(index); return true; } base.setOption(index, value.get(), exceptionState); return true; }
void CustomElementScheduler::resolveOrScheduleResolution(PassRefPtrWillBeRawPtr<CustomElementRegistrationContext> context, PassRefPtrWillBeRawPtr<Element> element, const CustomElementDescriptor& descriptor) { if (CustomElementCallbackDispatcher::inCallbackDeliveryScope()) { context->resolve(element.get(), descriptor); return; } HTMLImportLoader* loader = element->document().importLoader(); OwnPtrWillBeRawPtr<CustomElementMicrotaskResolutionStep> step = CustomElementMicrotaskResolutionStep::create(context, element, descriptor); CustomElementMicrotaskDispatcher::instance().enqueue(loader, step.release()); }
void CustomElementScheduler::resolveOrScheduleResolution(PassRefPtrWillBeRawPtr<CustomElementRegistrationContext> context, PassRefPtrWillBeRawPtr<Element> element, const CustomElementDescriptor& descriptor) { if (CustomElementProcessingStack::inCallbackDeliveryScope()) { context->resolve(element.get(), descriptor); return; } Document& document = element->document(); OwnPtrWillBeRawPtr<CustomElementMicrotaskResolutionStep> step = CustomElementMicrotaskResolutionStep::create(context, element, descriptor); enqueueMicrotaskStep(document, step.release()); }
// Implements the steps for 'An end tag whose tag name is "script"' // http://whatwg.org/html#scriptEndTag // Script handling lives outside the tree builder to keep each class simple. void HTMLScriptRunner::execute(PassRefPtrWillBeRawPtr<Element> scriptElement, const TextPosition& scriptStartPosition) { ASSERT(scriptElement); TRACE_EVENT1("blink", "HTMLScriptRunner::execute", "data", getTraceArgsForScriptElement(scriptElement.get(), scriptStartPosition)); // FIXME: If scripting is disabled, always just return. bool hadPreloadScanner = m_host->hasPreloadScanner(); // Try to execute the script given to us. runScript(scriptElement.get(), scriptStartPosition); if (hasParserBlockingScript()) { if (isExecutingScript()) return; // Unwind to the outermost HTMLScriptRunner::execute before continuing parsing. // If preload scanner got created, it is missing the source after the current insertion point. Append it and scan. if (!hadPreloadScanner && m_host->hasPreloadScanner()) m_host->appendCurrentInputStreamToPreloadScannerAndScan(); executeParsingBlockingScripts(); } }
bool IDBOpenDBRequest::dispatchEvent(PassRefPtrWillBeRawPtr<Event> event) { // If the connection closed between onUpgradeNeeded and the delivery of the "success" event, // an "error" event should be fired instead. if (event->type() == EventTypeNames::success && resultAsAny()->type() == IDBAny::IDBDatabaseType && resultAsAny()->idbDatabase()->isClosePending()) { dequeueEvent(event.get()); setResult(nullptr); onError(DOMError::create(AbortError, "The connection was closed.")); return false; } return IDBRequest::dispatchEvent(event); }
void FontBuilder::createFont(PassRefPtrWillBeRawPtr<FontSelector> fontSelector, ComputedStyle& style) { if (!m_flags) return; FontDescription description = style.fontDescription(); if (isSet(PropertySetFlag::Family)) { description.setGenericFamily(m_fontDescription.genericFamily()); description.setFamily(m_fontDescription.family()); } if (isSet(PropertySetFlag::Size)) { description.setKeywordSize(m_fontDescription.keywordSize()); description.setSpecifiedSize(m_fontDescription.specifiedSize()); description.setIsAbsoluteSize(m_fontDescription.isAbsoluteSize()); } if (isSet(PropertySetFlag::SizeAdjust)) description.setSizeAdjust(m_fontDescription.sizeAdjust()); if (isSet(PropertySetFlag::Weight)) description.setWeight(m_fontDescription.weight()); if (isSet(PropertySetFlag::Stretch)) description.setStretch(m_fontDescription.stretch()); if (isSet(PropertySetFlag::FeatureSettings)) description.setFeatureSettings(m_fontDescription.featureSettings()); if (isSet(PropertySetFlag::Script)) { description.setLocale(m_fontDescription.locale()); description.setScript(m_fontDescription.script()); } if (isSet(PropertySetFlag::Style)) description.setStyle(m_fontDescription.style()); if (isSet(PropertySetFlag::Variant)) description.setVariant(m_fontDescription.variant()); if (isSet(PropertySetFlag::VariantLigatures)) description.setVariantLigatures(m_fontDescription.variantLigatures()); if (isSet(PropertySetFlag::TextRendering)) description.setTextRendering(m_fontDescription.textRendering()); if (isSet(PropertySetFlag::Kerning)) description.setKerning(m_fontDescription.kerning()); if (isSet(PropertySetFlag::FontSmoothing)) description.setFontSmoothing(m_fontDescription.fontSmoothing()); if (isSet(PropertySetFlag::TextOrientation) || isSet(PropertySetFlag::WritingMode)) updateOrientation(description, style); updateSpecifiedSize(description, style); updateComputedSize(description, style); updateAdjustedSize(description, style, fontSelector.get()); style.setFontDescription(description); style.font().update(fontSelector); m_flags = 0; }