コード例 #1
0
static String truncatedStringForLookupMenuItem(const String& original)
{
    if (original.isEmpty())
        return original;

    // Truncate the string if it's too long. This is in consistency with AppKit.
    unsigned maxNumberOfGraphemeClustersInLookupMenuItem = 24;
    static NeverDestroyed<String> ellipsis(&horizontalEllipsis, 1);

    String trimmed = original.stripWhiteSpace();
    unsigned numberOfCharacters = numCharactersInGraphemeClusters(trimmed, maxNumberOfGraphemeClustersInLookupMenuItem);
    return numberOfCharacters == trimmed.length() ? trimmed : trimmed.left(numberOfCharacters) + ellipsis.get();
}
コード例 #2
0
EncodedJSValue jsTestNondeterministicNondeterministicGetterExceptionAttr(ExecState* exec, JSObject* slotBase, EncodedJSValue thisValue, PropertyName)
{
    UNUSED_PARAM(exec);
    UNUSED_PARAM(slotBase);
    UNUSED_PARAM(thisValue);
    JSTestNondeterministic* castedThis = jsDynamicCast<JSTestNondeterministic*>(JSValue::decode(thisValue));
    if (UNLIKELY(!castedThis)) {
        if (jsDynamicCast<JSTestNondeterministicPrototype*>(slotBase))
            return reportDeprecatedGetterError(*exec, "TestNondeterministic", "nondeterministicGetterExceptionAttr");
        return throwGetterTypeError(*exec, "TestNondeterministic", "nondeterministicGetterExceptionAttr");
    }
    ExceptionCode ec = 0;
#if ENABLE(WEB_REPLAY)
    JSGlobalObject* globalObject = exec->lexicalGlobalObject();
    InputCursor& cursor = globalObject->inputCursor();
    static NeverDestroyed<const AtomicString> bindingName("TestNondeterministic.nondeterministicGetterExceptionAttr", AtomicString::ConstructFromLiteral);
    if (cursor.isCapturing()) {
        String memoizedResult = castedThis->impl().nondeterministicGetterExceptionAttr(ec);
        cursor.appendInput<MemoizedDOMResult<String>>(bindingName.get().string(), memoizedResult, ec);
        JSValue result = jsStringWithCache(exec, memoizedResult);
        setDOMException(exec, ec);
        return JSValue::encode(result);
    }

    if (cursor.isReplaying()) {
        String memoizedResult;
        MemoizedDOMResultBase* input = cursor.fetchInput<MemoizedDOMResultBase>();
        if (input && input->convertTo<String>(memoizedResult)) {
            JSValue result = jsStringWithCache(exec, memoizedResult);
            setDOMException(exec, input->exceptionCode());
            return JSValue::encode(result);
        }
    }
#endif
    TestNondeterministic& impl = castedThis->impl();
    JSValue result = jsStringWithCache(exec, impl.nondeterministicGetterExceptionAttr(ec));
    setDOMException(exec, ec);
    return JSValue::encode(result);
}
コード例 #3
0
ファイル: XSSAuditor.cpp プロジェクト: eocanha/webkit
bool XSSAuditor::eraseDangerousAttributesIfInjected(const FilterTokenRequest& request)
{
    static NeverDestroyed<String> safeJavaScriptURL(ASCIILiteral("javascript:void(0)"));

    bool didBlockScript = false;
    for (size_t i = 0; i < request.token.attributes().size(); ++i) {
        const HTMLToken::Attribute& attribute = request.token.attributes().at(i);
        bool isInlineEventHandler = isNameOfInlineEventHandler(attribute.name);
        // FIXME: It would be better if we didn't create a new String for every attribute in the document.
        String strippedValue = stripLeadingAndTrailingHTMLSpaces(String(attribute.value));
        bool valueContainsJavaScriptURL = (!isInlineEventHandler && protocolIsJavaScript(strippedValue)) || (isSemicolonSeparatedAttribute(attribute) && semicolonSeparatedValueContainsJavaScriptURL(strippedValue));
        if (!isInlineEventHandler && !valueContainsJavaScriptURL)
            continue;
        if (!isContainedInRequest(canonicalize(snippetFromAttribute(request, attribute), TruncationStyle::ScriptLikeAttribute)))
            continue;
        request.token.eraseValueOfAttribute(i);
        if (valueContainsJavaScriptURL)
            request.token.appendToAttributeValue(i, safeJavaScriptURL.get());
        didBlockScript = true;
    }
    return didBlockScript;
}
コード例 #4
0
static Vector<CDMFactory*>& installedCDMFactories()
{
    static NeverDestroyed<Vector<CDMFactory*>> cdms;
    static bool queriedCDMs = false;
    if (!queriedCDMs) {
        queriedCDMs = true;

        cdms.get().append(new CDMFactory([](CDM* cdm) { return std::make_unique<CDMPrivateClearKey>(cdm); },
            CDMPrivateClearKey::supportsKeySystem, CDMPrivateClearKey::supportsKeySystemAndMimeType));

        // FIXME: initialize specific UA CDMs. http://webkit.org/b/109318, http://webkit.org/b/109320
        cdms.get().append(new CDMFactory([](CDM* cdm) { return std::make_unique<CDMPrivateMediaPlayer>(cdm); },
            CDMPrivateMediaPlayer::supportsKeySystem, CDMPrivateMediaPlayer::supportsKeySystemAndMimeType));

#if PLATFORM(MAC) && ENABLE(MEDIA_SOURCE)
        cdms.get().append(new CDMFactory([](CDM* cdm) { return std::make_unique<CDMPrivateMediaSourceAVFObjC>(cdm); },
            CDMPrivateMediaSourceAVFObjC::supportsKeySystem, CDMPrivateMediaSourceAVFObjC::supportsKeySystemAndMimeType));
#endif
    }

    return cdms;
}
コード例 #5
0
ファイル: SVGPatternElement.cpp プロジェクト: eocanha/webkit
bool SVGPatternElement::isSupportedAttribute(const QualifiedName& attrName)
{
    static NeverDestroyed<HashSet<QualifiedName>> supportedAttributes;
    if (supportedAttributes.get().isEmpty()) {
        SVGURIReference::addSupportedAttributes(supportedAttributes);
        SVGTests::addSupportedAttributes(supportedAttributes);
        SVGLangSpace::addSupportedAttributes(supportedAttributes);
        SVGExternalResourcesRequired::addSupportedAttributes(supportedAttributes);
        SVGFitToViewBox::addSupportedAttributes(supportedAttributes);
        supportedAttributes.get().add(SVGNames::patternUnitsAttr);
        supportedAttributes.get().add(SVGNames::patternContentUnitsAttr);
        supportedAttributes.get().add(SVGNames::patternTransformAttr);
        supportedAttributes.get().add(SVGNames::xAttr);
        supportedAttributes.get().add(SVGNames::yAttr);
        supportedAttributes.get().add(SVGNames::widthAttr);
        supportedAttributes.get().add(SVGNames::heightAttr);
    }
    return supportedAttributes.get().contains<SVGAttributeHashTranslator>(attrName);
}
コード例 #6
0
bool SVGFEDisplacementMapElement::isSupportedAttribute(const QualifiedName& attrName)
{
    static NeverDestroyed<HashSet<QualifiedName>> supportedAttributes;
    if (supportedAttributes.get().isEmpty()) {
        supportedAttributes.get().add(SVGNames::inAttr);
        supportedAttributes.get().add(SVGNames::in2Attr);
        supportedAttributes.get().add(SVGNames::xChannelSelectorAttr);
        supportedAttributes.get().add(SVGNames::yChannelSelectorAttr);
        supportedAttributes.get().add(SVGNames::scaleAttr);
    }
    return supportedAttributes.get().contains<SVGAttributeHashTranslator>(attrName);
}
コード例 #7
0
// FIXME: This should be removed, all callers are almost certainly wrong.
static bool isRecognizedTagName(const QualifiedName& tagName)
{
    static NeverDestroyed<HashSet<AtomicStringImpl*>> tagList;
    if (tagList.get().isEmpty()) {
        auto* tags = HTMLNames::getHTMLTags();
        for (size_t i = 0; i < HTMLNames::HTMLTagsCount; i++) {
            if (*tags[i] == bgsoundTag
                || *tags[i] == commandTag
                || *tags[i] == detailsTag
                || *tags[i] == figcaptionTag
                || *tags[i] == figureTag
                || *tags[i] == summaryTag
                || *tags[i] == trackTag) {
                // Even though we have atoms for these tags, we don't want to
                // treat them as "recognized tags" for the purpose of parsing
                // because that changes how we parse documents.
                continue;
            }
            tagList.get().add(tags[i]->localName().impl());
        }
    }
    return tagList.get().contains(tagName.localName().impl());
}
コード例 #8
0
UScriptCode localeToScriptCodeForFontSelection(const String& locale)
{
    static NeverDestroyed<LocaleScriptMap> localeScriptMap;
    if (localeScriptMap.get().isEmpty()) {
        for (size_t i = 0; i < sizeof(localeScriptList) / sizeof(LocaleScript); ++i)
            localeScriptMap.get().set(ASCIILiteral(localeScriptList[i].locale), localeScriptList[i].script);
    }

    String canonicalLocale = locale.lower().replace('-', '_');
    while (!canonicalLocale.isEmpty()) {
        LocaleScriptMap::iterator it = localeScriptMap.get().find(canonicalLocale);
        if (it != localeScriptMap.get().end())
            return it->value;
        size_t pos = canonicalLocale.reverseFind('_');
        if (pos == notFound)
            break;
        UScriptCode code = scriptNameToCode(canonicalLocale.substring(pos + 1));
        if (code != USCRIPT_INVALID_CODE && code != USCRIPT_UNKNOWN)
            return code;
        canonicalLocale = canonicalLocale.substring(0, pos);
    }
    return USCRIPT_COMMON;
}
コード例 #9
0
void simulateClick(Element& element, Event* underlyingEvent, SimulatedClickMouseEventOptions mouseEventOptions, SimulatedClickVisualOptions visualOptions, SimulatedClickCreationOptions creationOptions)
{
    if (element.isDisabledFormControl())
        return;

    static NeverDestroyed<HashSet<Element*>> elementsDispatchingSimulatedClicks;
    if (!elementsDispatchingSimulatedClicks.get().add(&element).isNewEntry)
        return;

    if (mouseEventOptions == SendMouseOverUpDownEvents)
        simulateMouseEvent(eventNames().mouseoverEvent, element, underlyingEvent, creationOptions);

    if (mouseEventOptions != SendNoEvents)
        simulateMouseEvent(eventNames().mousedownEvent, element, underlyingEvent, creationOptions);
    element.setActive(true, visualOptions == ShowPressedLook);
    if (mouseEventOptions != SendNoEvents)
        simulateMouseEvent(eventNames().mouseupEvent, element, underlyingEvent, creationOptions);
    element.setActive(false);

    simulateMouseEvent(eventNames().clickEvent, element, underlyingEvent, creationOptions);

    elementsDispatchingSimulatedClicks.get().remove(&element);
}
コード例 #10
0
bool SVGMarkerElement::isSupportedAttribute(const QualifiedName& attrName)
{
    static NeverDestroyed<HashSet<QualifiedName>> supportedAttributes;
    if (supportedAttributes.get().isEmpty()) {
        SVGLangSpace::addSupportedAttributes(supportedAttributes);
        SVGExternalResourcesRequired::addSupportedAttributes(supportedAttributes);
        SVGFitToViewBox::addSupportedAttributes(supportedAttributes);
        supportedAttributes.get().add(SVGNames::markerUnitsAttr);
        supportedAttributes.get().add(SVGNames::refXAttr);
        supportedAttributes.get().add(SVGNames::refYAttr);
        supportedAttributes.get().add(SVGNames::markerWidthAttr);
        supportedAttributes.get().add(SVGNames::markerHeightAttr);
        supportedAttributes.get().add(SVGNames::orientAttr);
    }
    return supportedAttributes.get().contains<SVGAttributeHashTranslator>(attrName);
}
コード例 #11
0
bool SVGRadialGradientElement::isSupportedAttribute(const QualifiedName& attrName)
{
    static NeverDestroyed<HashSet<QualifiedName>> supportedAttributes;
    if (supportedAttributes.get().isEmpty()) {
        supportedAttributes.get().add(SVGNames::cxAttr);
        supportedAttributes.get().add(SVGNames::cyAttr);
        supportedAttributes.get().add(SVGNames::fxAttr);
        supportedAttributes.get().add(SVGNames::fyAttr);
        supportedAttributes.get().add(SVGNames::rAttr);
        supportedAttributes.get().add(SVGNames::frAttr);
    }
    return supportedAttributes.get().contains<SVGAttributeHashTranslator>(attrName);
}
コード例 #12
0
bool SVGFEGaussianBlurElement::isSupportedAttribute(const QualifiedName& attrName)
{
    static NeverDestroyed<HashSet<QualifiedName>> supportedAttributes;
    if (supportedAttributes.get().isEmpty()) {
        supportedAttributes.get().add(SVGNames::inAttr);
        supportedAttributes.get().add(SVGNames::stdDeviationAttr);
        supportedAttributes.get().add(SVGNames::edgeModeAttr);
    }
    return supportedAttributes.get().contains<SVGAttributeHashTranslator>(attrName);
}
コード例 #13
0
bool SVGFEColorMatrixElement::isSupportedAttribute(const QualifiedName& attrName)
{
    static NeverDestroyed<HashSet<QualifiedName>> supportedAttributes;
    if (supportedAttributes.get().isEmpty()) {
        supportedAttributes.get().add(SVGNames::typeAttr);
        supportedAttributes.get().add(SVGNames::valuesAttr);
        supportedAttributes.get().add(SVGNames::inAttr);
    }
    return supportedAttributes.get().contains<SVGAttributeHashTranslator>(attrName);
}
コード例 #14
0
bool SVGFEMorphologyElement::isSupportedAttribute(const QualifiedName& attrName)
{
    static NeverDestroyed<HashSet<QualifiedName>> supportedAttributes;
    if (supportedAttributes.get().isEmpty()) {
        supportedAttributes.get().add(SVGNames::inAttr);
        supportedAttributes.get().add(SVGNames::operatorAttr);
        supportedAttributes.get().add(SVGNames::radiusAttr);
    }
    return supportedAttributes.get().contains<SVGAttributeHashTranslator>(attrName);
}
コード例 #15
0
ファイル: SVGTextPathElement.cpp プロジェクト: quanmo/webkit
bool SVGTextPathElement::isSupportedAttribute(const QualifiedName& attrName)
{
    static NeverDestroyed<HashSet<QualifiedName>> supportedAttributes;
    if (supportedAttributes.get().isEmpty()) {
        SVGURIReference::addSupportedAttributes(supportedAttributes);
        supportedAttributes.get().add(SVGNames::startOffsetAttr);
        supportedAttributes.get().add(SVGNames::methodAttr);
        supportedAttributes.get().add(SVGNames::spacingAttr);
    }
    return supportedAttributes.get().contains<SVGAttributeHashTranslator>(attrName);
}
コード例 #16
0
ファイル: SVGImageElement.cpp プロジェクト: cheekiatng/webkit
bool SVGImageElement::isSupportedAttribute(const QualifiedName& attrName)
{
    static NeverDestroyed<HashSet<QualifiedName>> supportedAttributes;
    if (supportedAttributes.get().isEmpty()) {
        SVGLangSpace::addSupportedAttributes(supportedAttributes);
        SVGExternalResourcesRequired::addSupportedAttributes(supportedAttributes);
        SVGURIReference::addSupportedAttributes(supportedAttributes);
        supportedAttributes.get().add(SVGNames::xAttr);
        supportedAttributes.get().add(SVGNames::yAttr);
        supportedAttributes.get().add(SVGNames::widthAttr);
        supportedAttributes.get().add(SVGNames::heightAttr);
        supportedAttributes.get().add(SVGNames::preserveAspectRatioAttr);
    }
    return supportedAttributes.get().contains<SVGAttributeHashTranslator>(attrName);
}
コード例 #17
0
ファイル: SVGResources.cpp プロジェクト: eocanha/webkit
static HashSet<AtomicString>& chainableResourceTags()
{
    static NeverDestroyed<HashSet<AtomicString>> s_tagList;
    if (s_tagList.get().isEmpty()) {
        s_tagList.get().add(SVGNames::linearGradientTag.localName());
        s_tagList.get().add(SVGNames::filterTag.localName());
        s_tagList.get().add(SVGNames::patternTag.localName());
        s_tagList.get().add(SVGNames::radialGradientTag.localName());
    }

    return s_tagList;
}
コード例 #18
0
ファイル: SVGGradientElement.cpp プロジェクト: eocanha/webkit
bool SVGGradientElement::isSupportedAttribute(const QualifiedName& attrName)
{
    static NeverDestroyed<HashSet<QualifiedName>> supportedAttributes;
    if (supportedAttributes.get().isEmpty()) {
        SVGURIReference::addSupportedAttributes(supportedAttributes);
        SVGExternalResourcesRequired::addSupportedAttributes(supportedAttributes);
        supportedAttributes.get().add(SVGNames::gradientUnitsAttr);
        supportedAttributes.get().add(SVGNames::gradientTransformAttr);
        supportedAttributes.get().add(SVGNames::spreadMethodAttr);
    }
    return supportedAttributes.get().contains<SVGAttributeHashTranslator>(attrName);
}
コード例 #19
0
bool SVGFilterPrimitiveStandardAttributes::isSupportedAttribute(const QualifiedName& attrName)
{
    static NeverDestroyed<HashSet<QualifiedName>> supportedAttributes;
    if (supportedAttributes.get().isEmpty()) {
        supportedAttributes.get().add(SVGNames::xAttr);
        supportedAttributes.get().add(SVGNames::yAttr);
        supportedAttributes.get().add(SVGNames::widthAttr);
        supportedAttributes.get().add(SVGNames::heightAttr);
        supportedAttributes.get().add(SVGNames::resultAttr);
    }
    return supportedAttributes.get().contains<SVGAttributeHashTranslator>(attrName);
}
コード例 #20
0
bool SVGTextPositioningElement::isSupportedAttribute(const QualifiedName& attrName)
{
    static NeverDestroyed<HashSet<QualifiedName>> supportedAttributes;
    if (supportedAttributes.get().isEmpty()) {
        supportedAttributes.get().add(SVGNames::xAttr);
        supportedAttributes.get().add(SVGNames::yAttr);
        supportedAttributes.get().add(SVGNames::dxAttr);
        supportedAttributes.get().add(SVGNames::dyAttr);
        supportedAttributes.get().add(SVGNames::rotateAttr);
    }
    return supportedAttributes.get().contains<SVGAttributeHashTranslator>(attrName);
}
コード例 #21
0
static URLSchemesMap& secureSchemes()
{
    static NeverDestroyed<URLSchemesMap> secureSchemes;

    if (secureSchemes.get().isEmpty()) {
        secureSchemes.get().add("https");
        secureSchemes.get().add("about");
        secureSchemes.get().add("data");
        secureSchemes.get().add("wss");
#if USE(QUICK_LOOK)
        secureSchemes.get().add(QLPreviewProtocol());
#endif
#if PLATFORM(GTK) || PLATFORM(WPE)
        secureSchemes.get().add("resource");
#endif
    }

    return secureSchemes;
}
コード例 #22
0
ファイル: ImageBuffer.cpp プロジェクト: edcwconan/webkit
void ImageBuffer::transformColorSpace(ColorSpace srcColorSpace, ColorSpace dstColorSpace)
{
    static NeverDestroyed<Vector<int>> deviceRgbLUT;
    static NeverDestroyed<Vector<int>> linearRgbLUT;

    if (srcColorSpace == dstColorSpace)
        return;

    // only sRGB <-> linearRGB are supported at the moment
    if ((srcColorSpace != ColorSpaceLinearRGB && srcColorSpace != ColorSpaceDeviceRGB)
        || (dstColorSpace != ColorSpaceLinearRGB && dstColorSpace != ColorSpaceDeviceRGB))
        return;

    if (dstColorSpace == ColorSpaceLinearRGB) {
        if (linearRgbLUT.get().isEmpty()) {
            for (unsigned i = 0; i < 256; i++) {
                float color = i  / 255.0f;
                color = (color <= 0.04045f ? color / 12.92f : pow((color + 0.055f) / 1.055f, 2.4f));
                color = std::max(0.0f, color);
                color = std::min(1.0f, color);
                linearRgbLUT.get().append(static_cast<int>(round(color * 255)));
            }
        }
        platformTransformColorSpace(linearRgbLUT.get());
    } else if (dstColorSpace == ColorSpaceDeviceRGB) {
        if (deviceRgbLUT.get().isEmpty()) {
            for (unsigned i = 0; i < 256; i++) {
                float color = i / 255.0f;
                color = (powf(color, 1.0f / 2.4f) * 1.055f) - 0.055f;
                color = std::max(0.0f, color);
                color = std::min(1.0f, color);
                deviceRgbLUT.get().append(static_cast<int>(round(color * 255)));
            }
        }
        platformTransformColorSpace(deviceRgbLUT.get());
    }
}
コード例 #23
0
void MediaResource::responseReceived(CachedResource* resource, const ResourceResponse& response)
{
    ASSERT_UNUSED(resource, resource == m_resource);

    if (!m_loader->document())
        return;

    RefPtr<MediaResource> protect(this);
    if (!m_loader->crossOriginMode().isNull() && !resource->passesSameOriginPolicyCheck(*m_loader->document()->securityOrigin())) {
        static NeverDestroyed<const String> consoleMessage("Cross-origin media resource load denied by Cross-Origin Resource Sharing policy.");
        m_loader->document()->addConsoleMessage(MessageSource::Security, MessageLevel::Error, consoleMessage.get());
        m_didPassAccessControlCheck = false;
        if (m_client)
            m_client->accessControlCheckFailed(*this, ResourceError(errorDomainWebKitInternal, 0, response.url(), consoleMessage.get()));
        stop();
        return;
    }

    m_didPassAccessControlCheck = !m_loader->crossOriginMode().isNull();
    if (m_client)
        m_client->responseReceived(*this, response);
}
コード例 #24
0
ファイル: SVGElement.cpp プロジェクト: cheekiatng/webkit
bool SVGElement::childShouldCreateRenderer(const Node& child) const
{
    static NeverDestroyed<HashSet<QualifiedName>> invalidTextContent;

    if (invalidTextContent.get().isEmpty()) {
        invalidTextContent.get().add(SVGNames::textPathTag);
#if ENABLE(SVG_FONTS)
        invalidTextContent.get().add(SVGNames::altGlyphTag);
#endif
        invalidTextContent.get().add(SVGNames::trefTag);
        invalidTextContent.get().add(SVGNames::tspanTag);
    }
    if (child.isSVGElement()) {
        const SVGElement& svgChild = downcast<SVGElement>(child);
        if (invalidTextContent.get().contains(svgChild.tagQName()))
            return false;

        return svgChild.isValid();
    }
    return false;
}
コード例 #25
0
ファイル: SVGAngle.cpp プロジェクト: Comcast/WebKitForWayland
String SVGAngle::valueAsString() const
{
    switch (m_unitType) {
    case SVG_ANGLETYPE_DEG: {
        static NeverDestroyed<String> degString(ASCIILiteral("deg"));
        return String::number(m_valueInSpecifiedUnits) + degString.get();
    }
    case SVG_ANGLETYPE_RAD: {
        static NeverDestroyed<String> radString(ASCIILiteral("rad"));
        return String::number(m_valueInSpecifiedUnits) + radString.get();
    }
    case SVG_ANGLETYPE_GRAD: {
        static NeverDestroyed<String> gradString(ASCIILiteral("grad"));
        return String::number(m_valueInSpecifiedUnits) + gradString.get();
    }
    case SVG_ANGLETYPE_UNSPECIFIED:
    case SVG_ANGLETYPE_UNKNOWN:
        return String::number(m_valueInSpecifiedUnits);
    }

    ASSERT_NOT_REACHED();
    return String();
}
コード例 #26
0
ファイル: SVGUseElement.cpp プロジェクト: cheekiatng/webkit
static inline bool isDisallowedElement(const SVGElement& element)
{
    static NeverDestroyed<HashSet<AtomicString>> set = createAllowedElementSet();
    return !set.get().contains(element.localName());
}
コード例 #27
0
ファイル: AXObjectCacheAtk.cpp プロジェクト: feel2d/webkit
static void notifyChildrenSelectionChange(AccessibilityObject* object)
{
    // This static variables are needed to keep track of the old
    // focused object and its associated list object, as per previous
    // calls to this function, in order to properly decide whether to
    // emit some signals or not.
    static NeverDestroyed<RefPtr<AccessibilityObject>> oldListObject;
    static NeverDestroyed<RefPtr<AccessibilityObject>> oldFocusedObject;

    // Only list boxes and menu lists supported so far.
    if (!object || !(object->isListBox() || object->isMenuList()))
        return;

    // Only support HTML select elements so far (ARIA selectors not supported).
    Node* node = object->node();
    if (!is<HTMLSelectElement>(node))
        return;

    // Emit signal from the listbox's point of view first.
    g_signal_emit_by_name(object->wrapper(), "selection-changed");

    // Find the item where the selection change was triggered from.
    HTMLSelectElement& select = downcast<HTMLSelectElement>(*node);
    int changedItemIndex = select.activeSelectionStartListIndex();

    AccessibilityObject* listObject = getListObject(object);
    if (!listObject) {
        oldListObject.get() = 0;
        return;
    }

    const AccessibilityObject::AccessibilityChildrenVector& items = listObject->children();
    if (changedItemIndex < 0 || changedItemIndex >= static_cast<int>(items.size()))
        return;
    AccessibilityObject* item = items.at(changedItemIndex).get();

    // Ensure the current list object is the same than the old one so
    // further comparisons make sense. Otherwise, just reset
    // oldFocusedObject so it won't be taken into account.
    if (oldListObject.get() != listObject)
        oldFocusedObject.get() = 0;

    AtkObject* axItem = item ? item->wrapper() : 0;
    AtkObject* axOldFocusedObject = oldFocusedObject.get() ? oldFocusedObject.get()->wrapper() : 0;

    // Old focused object just lost focus, so emit the events.
    if (axOldFocusedObject && axItem != axOldFocusedObject) {
        g_signal_emit_by_name(axOldFocusedObject, "focus-event", false);
        atk_object_notify_state_change(axOldFocusedObject, ATK_STATE_FOCUSED, false);
    }

    // Emit needed events for the currently (un)selected item.
    if (axItem) {
        bool isSelected = item->isSelected();
        atk_object_notify_state_change(axItem, ATK_STATE_SELECTED, isSelected);
        // When the selection changes in a collapsed widget such as a combo box
        // whose child menu is not showing, that collapsed widget retains focus.
        if (!object->isCollapsed()) {
            g_signal_emit_by_name(axItem, "focus-event", isSelected);
            atk_object_notify_state_change(axItem, ATK_STATE_FOCUSED, isSelected);
        }
    }

    // Update pointers to the previously involved objects.
    oldListObject.get() = listObject;
    oldFocusedObject.get() = item;
}
コード例 #28
0
void WebPlatformStrategies::initialize()
{
    static NeverDestroyed<WebPlatformStrategies> platformStrategies;
    setPlatformStrategies(&platformStrategies.get());
}
コード例 #29
0
ファイル: Font.cpp プロジェクト: alexgcastro/webkit
static SystemFallbackCache& systemFallbackCache()
{
    static NeverDestroyed<SystemFallbackCache> map;
    return map.get();
}
コード例 #30
0
ファイル: SVGResources.cpp プロジェクト: eocanha/webkit
static HashSet<AtomicString>& clipperFilterMaskerTags()
{
    static NeverDestroyed<HashSet<AtomicString>> s_tagList;
    if (s_tagList.get().isEmpty()) {
        // "container elements": http://www.w3.org/TR/SVG11/intro.html#TermContainerElement
        // "graphics elements" : http://www.w3.org/TR/SVG11/intro.html#TermGraphicsElement
        s_tagList.get().add(SVGNames::aTag.localName());
        s_tagList.get().add(SVGNames::circleTag.localName());
        s_tagList.get().add(SVGNames::ellipseTag.localName());
        s_tagList.get().add(SVGNames::glyphTag.localName());
        s_tagList.get().add(SVGNames::gTag.localName());
        s_tagList.get().add(SVGNames::imageTag.localName());
        s_tagList.get().add(SVGNames::lineTag.localName());
        s_tagList.get().add(SVGNames::markerTag.localName());
        s_tagList.get().add(SVGNames::maskTag.localName());
        s_tagList.get().add(SVGNames::missing_glyphTag.localName());
        s_tagList.get().add(SVGNames::pathTag.localName());
        s_tagList.get().add(SVGNames::polygonTag.localName());
        s_tagList.get().add(SVGNames::polylineTag.localName());
        s_tagList.get().add(SVGNames::rectTag.localName());
        s_tagList.get().add(SVGNames::svgTag.localName());
        s_tagList.get().add(SVGNames::textTag.localName());
        s_tagList.get().add(SVGNames::useTag.localName());

        // Not listed in the definitions is the clipPath element, the SVG spec says though:
        // The "clipPath" element or any of its children can specify property "clip-path".
        // So we have to add clipPathTag here, otherwhise clip-path on clipPath will fail.
        // (Already mailed SVG WG, waiting for a solution)
        s_tagList.get().add(SVGNames::clipPathTag.localName());

        // Not listed in the definitions are the text content elements, though filter/clipper/masker on tspan/text/.. is allowed.
        // (Already mailed SVG WG, waiting for a solution)
        s_tagList.get().add(SVGNames::altGlyphTag.localName());
        s_tagList.get().add(SVGNames::textPathTag.localName());
        s_tagList.get().add(SVGNames::trefTag.localName());
        s_tagList.get().add(SVGNames::tspanTag.localName());

        // Not listed in the definitions is the foreignObject element, but clip-path
        // is a supported attribute.
        s_tagList.get().add(SVGNames::foreignObjectTag.localName());

        // Elements that we ignore, as it doesn't make any sense.
        // defs, pattern, switch (FIXME: Mail SVG WG about these)
        // symbol (is converted to a svg element, when referenced by use, we can safely ignore it.)
    }

    return s_tagList;
}