void SVGSMILElement::parseAttribute(const QualifiedName& name, const AtomicString& oldValue, const AtomicString& value)
{
    if (name == SVGNames::beginAttr) {
        if (!m_conditions.isEmpty()) {
            clearConditions();
            parseBeginOrEnd(fastGetAttribute(SVGNames::endAttr), End);
        }
        parseBeginOrEnd(value.getString(), Begin);
        if (inDocument())
            connectSyncBaseConditions();
    } else if (name == SVGNames::endAttr) {
        if (!m_conditions.isEmpty()) {
            clearConditions();
            parseBeginOrEnd(fastGetAttribute(SVGNames::beginAttr), Begin);
        }
        parseBeginOrEnd(value.getString(), End);
        if (inDocument())
            connectSyncBaseConditions();
    } else if (name == SVGNames::onbeginAttr) {
        setAttributeEventListener(EventTypeNames::beginEvent, createAttributeEventListener(this, name, value, eventParameterName()));
    } else if (name == SVGNames::onendAttr) {
        setAttributeEventListener(EventTypeNames::endEvent, createAttributeEventListener(this, name, value, eventParameterName()));
    } else if (name == SVGNames::onrepeatAttr) {
        setAttributeEventListener(EventTypeNames::repeatEvent, createAttributeEventListener(this, name, value, eventParameterName()));
    } else {
        SVGElement::parseAttribute(name, oldValue, value);
    }
}
Beispiel #2
0
static bool typefacesHasWeightSuffix(const AtomicString& family,
                                     AtomicString& adjustedName,
                                     FontWeight& variantWeight) {
  struct FamilyWeightSuffix {
    const wchar_t* suffix;
    size_t length;
    FontWeight weight;
  };
  // Mapping from suffix to weight from the DirectWrite documentation.
  // http://msdn.microsoft.com/en-us/library/windows/desktop/dd368082.aspx
  const static FamilyWeightSuffix variantForSuffix[] = {
      {L" thin", 5, FontWeight100},        {L" extralight", 11, FontWeight200},
      {L" ultralight", 11, FontWeight200}, {L" light", 6, FontWeight300},
      {L" regular", 8, FontWeight400},     {L" medium", 7, FontWeight500},
      {L" demibold", 9, FontWeight600},    {L" semibold", 9, FontWeight600},
      {L" extrabold", 10, FontWeight800},  {L" ultrabold", 10, FontWeight800},
      {L" black", 6, FontWeight900},       {L" heavy", 6, FontWeight900}};
  size_t numVariants = WTF_ARRAY_LENGTH(variantForSuffix);
  for (size_t i = 0; i < numVariants; i++) {
    const FamilyWeightSuffix& entry = variantForSuffix[i];
    if (family.endsWith(entry.suffix, TextCaseUnicodeInsensitive)) {
      String familyName = family.getString();
      familyName.truncate(family.length() - entry.length);
      adjustedName = AtomicString(familyName);
      variantWeight = entry.weight;
      return true;
    }
  }

  return false;
}
Beispiel #3
0
static bool typefacesHasStretchSuffix(const AtomicString& family,
                                      AtomicString& adjustedName,
                                      FontStretch& variantStretch) {
  struct FamilyStretchSuffix {
    const wchar_t* suffix;
    size_t length;
    FontStretch stretch;
  };
  // Mapping from suffix to stretch value from the DirectWrite documentation.
  // http://msdn.microsoft.com/en-us/library/windows/desktop/dd368078.aspx
  // Also includes Narrow as a synonym for Condensed to to support Arial
  // Narrow and other fonts following the same naming scheme.
  const static FamilyStretchSuffix variantForSuffix[] = {
      {L" ultracondensed", 15, FontStretchUltraCondensed},
      {L" extracondensed", 15, FontStretchExtraCondensed},
      {L" condensed", 10, FontStretchCondensed},
      {L" narrow", 7, FontStretchCondensed},
      {L" semicondensed", 14, FontStretchSemiCondensed},
      {L" semiexpanded", 13, FontStretchSemiExpanded},
      {L" expanded", 9, FontStretchExpanded},
      {L" extraexpanded", 14, FontStretchExtraExpanded},
      {L" ultraexpanded", 14, FontStretchUltraExpanded}};
  size_t numVariants = WTF_ARRAY_LENGTH(variantForSuffix);
  for (size_t i = 0; i < numVariants; i++) {
    const FamilyStretchSuffix& entry = variantForSuffix[i];
    if (family.endsWith(entry.suffix, TextCaseUnicodeInsensitive)) {
      String familyName = family.getString();
      familyName.truncate(family.length() - entry.length);
      adjustedName = AtomicString(familyName);
      variantStretch = entry.stretch;
      return true;
    }
  }

  return false;
}
Beispiel #4
0
AtomicString DOMTokenList::removeToken(const AtomicString& input,
                                       const AtomicString& token) {
  Vector<String> tokens;
  tokens.append(token.getString());
  return removeTokens(input, tokens);
}
Beispiel #5
0
void DOMTokenList::remove(const AtomicString& token,
                          ExceptionState& exceptionState) {
  Vector<String> tokens;
  tokens.append(token.getString());
  remove(tokens, exceptionState);
}