Ejemplo n.º 1
0
static StylePropertySet* createBorderStyle(CSSValueID value) {
  MutableStylePropertySet* style =
      MutableStylePropertySet::create(HTMLQuirksMode);
  style->setProperty(CSSPropertyBorderTopStyle, value);
  style->setProperty(CSSPropertyBorderBottomStyle, value);
  style->setProperty(CSSPropertyBorderLeftStyle, value);
  style->setProperty(CSSPropertyBorderRightStyle, value);
  return style;
}
Ejemplo n.º 2
0
static inline void applyCSSPropertyToTarget(SVGElement* targetElement, CSSPropertyID id, const String& value)
{
    ASSERT_WITH_SECURITY_IMPLICATION(!targetElement->m_deletionHasBegun);

    MutableStylePropertySet* propertySet = targetElement->ensureAnimatedSMILStyleProperties();
    if (!propertySet->setProperty(id, value, false, 0))
        return;

    targetElement->setNeedsStyleRecalc(LocalStyleChange);
}
Ejemplo n.º 3
0
static inline void applyCSSPropertyToTarget(SVGElement* targetElement, CSSPropertyID id, const String& value)
{
#if !ENABLE(OILPAN)
    ASSERT_WITH_SECURITY_IMPLICATION(!targetElement->m_deletionHasBegun);
#endif

    MutableStylePropertySet* propertySet = targetElement->ensureAnimatedSMILStyleProperties();
    if (!propertySet->setProperty(id, value, false, 0))
        return;

    targetElement->setNeedsStyleRecalc(LocalStyleChange, StyleChangeReasonForTracing::create(StyleChangeReason::Animation));
}
Ejemplo n.º 4
0
void HTMLFontElement::collectStyleForPresentationAttribute(const QualifiedName& name, const AtomicString& value, MutableStylePropertySet& style)
{
    if (name == sizeAttr) {
        CSSValueID size = CSSValueInvalid;
        if (cssValueFromFontSizeNumber(value, size))
            addPropertyToPresentationAttributeStyle(style, CSSPropertyFontSize, size);
    } else if (name == colorAttr)
        addHTMLColorToStyle(style, CSSPropertyColor, value);
    else if (name == faceAttr) {
        if (RefPtr<CSSValueList> fontFaceValue = cssValuePool().createFontFaceValue(value))
            style.setProperty(CSSProperty(CSSPropertyFontFamily, fontFaceValue.release()));
    } else
        HTMLElement::collectStyleForPresentationAttribute(name, value, style);
}
Ejemplo n.º 5
0
static StylePropertySet* createGroupBorderStyle(int rows) {
  MutableStylePropertySet* style =
      MutableStylePropertySet::create(HTMLQuirksMode);
  if (rows) {
    style->setProperty(CSSPropertyBorderTopWidth, CSSValueThin);
    style->setProperty(CSSPropertyBorderBottomWidth, CSSValueThin);
    style->setProperty(CSSPropertyBorderTopStyle, CSSValueSolid);
    style->setProperty(CSSPropertyBorderBottomStyle, CSSValueSolid);
  } else {
    style->setProperty(CSSPropertyBorderLeftWidth, CSSValueThin);
    style->setProperty(CSSPropertyBorderRightWidth, CSSValueThin);
    style->setProperty(CSSPropertyBorderLeftStyle, CSSValueSolid);
    style->setProperty(CSSPropertyBorderRightStyle, CSSValueSolid);
  }
  return style;
}
Ejemplo n.º 6
0
StylePropertySet* HTMLTableElement::createSharedCellStyle() {
  MutableStylePropertySet* style =
      MutableStylePropertySet::create(HTMLQuirksMode);

  switch (getCellBorders()) {
    case SolidBordersColsOnly:
      style->setProperty(CSSPropertyBorderLeftWidth, CSSValueThin);
      style->setProperty(CSSPropertyBorderRightWidth, CSSValueThin);
      style->setProperty(CSSPropertyBorderLeftStyle, CSSValueSolid);
      style->setProperty(CSSPropertyBorderRightStyle, CSSValueSolid);
      style->setProperty(CSSPropertyBorderColor, *CSSInheritedValue::create());
      break;
    case SolidBordersRowsOnly:
      style->setProperty(CSSPropertyBorderTopWidth, CSSValueThin);
      style->setProperty(CSSPropertyBorderBottomWidth, CSSValueThin);
      style->setProperty(CSSPropertyBorderTopStyle, CSSValueSolid);
      style->setProperty(CSSPropertyBorderBottomStyle, CSSValueSolid);
      style->setProperty(CSSPropertyBorderColor, *CSSInheritedValue::create());
      break;
    case SolidBorders:
      style->setProperty(
          CSSPropertyBorderWidth,
          *CSSPrimitiveValue::create(1, CSSPrimitiveValue::UnitType::Pixels));
      style->setProperty(CSSPropertyBorderStyle,
                         *CSSIdentifierValue::create(CSSValueSolid));
      style->setProperty(CSSPropertyBorderColor, *CSSInheritedValue::create());
      break;
    case InsetBorders:
      style->setProperty(
          CSSPropertyBorderWidth,
          *CSSPrimitiveValue::create(1, CSSPrimitiveValue::UnitType::Pixels));
      style->setProperty(CSSPropertyBorderStyle,
                         *CSSIdentifierValue::create(CSSValueInset));
      style->setProperty(CSSPropertyBorderColor, *CSSInheritedValue::create());
      break;
    case NoBorders:
      // If 'rules=none' then allow any borders set at cell level to take
      // effect.
      break;
  }

  if (m_padding)
    style->setProperty(CSSPropertyPadding,
                       *CSSPrimitiveValue::create(
                           m_padding, CSSPrimitiveValue::UnitType::Pixels));

  return style;
}