Changeset 106358 in webkit


Ignore:
Timestamp:
Jan 31, 2012 6:58:37 AM (12 years ago)
Author:
Antti Koivisto
Message:

Parent SVGFontFaceElements style declaration to the rule
https://bugs.webkit.org/show_bug.cgi?id=77421

Reviewed by Adam Roben.

For some reason the declaration is parented to the element which adds a bunch of unnecessary special case code.
The invalidation on mutation is done explicitly by SVGFontFaceElement so that is not affected. The declaration
is not exposed so the change is not observable with a test.

  • css/CSSFontFaceRule.cpp:

(WebCore::CSSFontFaceRule::~CSSFontFaceRule):

  • css/CSSMutableStyleDeclaration.h:

(WebCore::CSSMutableStyleDeclaration::createInline):

  • svg/SVGFontFaceElement.cpp:

(WebCore::SVGFontFaceElement::SVGFontFaceElement):
(WebCore::SVGFontFaceElement::parseMappedAttribute):
(WebCore::SVGFontFaceElement::fontFamily):
(WebCore::SVGFontFaceElement::rebuildFontFace):

  • svg/SVGFontFaceElement.h:


Remove the unnecessary m_styleDeclaration field, access through m_fontFaceRule instead.

Location:
trunk/Source/WebCore
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r106357 r106358  
     12012-01-31  Antti Koivisto  <antti@apple.com>
     2
     3        Parent SVGFontFaceElements style declaration to the rule
     4        https://bugs.webkit.org/show_bug.cgi?id=77421
     5
     6        Reviewed by Adam Roben.
     7
     8        For some reason the declaration is parented to the element which adds a bunch of unnecessary special case code.
     9        The invalidation on mutation is done explicitly by SVGFontFaceElement so that is not affected. The declaration
     10        is not exposed so the change is not observable with a test.
     11
     12        * css/CSSFontFaceRule.cpp:
     13        (WebCore::CSSFontFaceRule::~CSSFontFaceRule):
     14        * css/CSSMutableStyleDeclaration.h:
     15        (WebCore::CSSMutableStyleDeclaration::createInline):
     16        * svg/SVGFontFaceElement.cpp:
     17        (WebCore::SVGFontFaceElement::SVGFontFaceElement):
     18        (WebCore::SVGFontFaceElement::parseMappedAttribute):
     19        (WebCore::SVGFontFaceElement::fontFamily):
     20        (WebCore::SVGFontFaceElement::rebuildFontFace):
     21        * svg/SVGFontFaceElement.h:
     22       
     23            Remove the unnecessary m_styleDeclaration field, access through m_fontFaceRule instead.
     24
    1252012-01-31  Kenneth Rohde Christiansen  <kenneth@webkit.org>
    226
  • trunk/Source/WebCore/css/CSSFontFaceRule.cpp

    r106247 r106358  
    3434CSSFontFaceRule::~CSSFontFaceRule()
    3535{
    36     // FIXME: SVGFontFaceElement's style declaration should probably be parented to the rule too.
    37     if (m_style && !m_style->isElementStyleDeclaration())
     36    if (m_style)
    3837        m_style->clearParentRule();
    3938}
  • trunk/Source/WebCore/css/CSSMutableStyleDeclaration.h

    r106258 r106358  
    5757    {
    5858        return adoptRef(new CSSMutableStyleDeclaration(element, true));
    59     }
    60     static PassRefPtr<CSSMutableStyleDeclaration> createForSVGFontFaceElement(StyledElement* element)
    61     {
    62         return adoptRef(new CSSMutableStyleDeclaration(element, false));
    6359    }
    6460
  • trunk/Source/WebCore/svg/SVGFontFaceElement.cpp

    r105642 r106358  
    5050    : SVGElement(tagName, document)
    5151    , m_fontFaceRule(CSSFontFaceRule::create())
    52     , m_styleDeclaration(CSSMutableStyleDeclaration::createForSVGFontFaceElement(this))
    5352{
    5453    ASSERT(hasTagName(font_faceTag));
    55     m_styleDeclaration->setStrictParsing(true);
    56     m_fontFaceRule->setDeclaration(m_styleDeclaration.get());
     54    RefPtr<CSSMutableStyleDeclaration> styleDeclaration = CSSMutableStyleDeclaration::create(m_fontFaceRule.get());
     55    styleDeclaration->setStrictParsing(true);
     56    m_fontFaceRule->setDeclaration(styleDeclaration.release());
    5757}
    5858
     
    114114    int propId = cssPropertyIdForSVGAttributeName(attr->name());
    115115    if (propId > 0) {
    116         m_styleDeclaration->setProperty(propId, attr->value(), false);
     116        m_fontFaceRule->style()->setProperty(propId, attr->value(), false);
    117117        rebuildFontFace();
    118118        return;
     
    259259String SVGFontFaceElement::fontFamily() const
    260260{
    261     return m_styleDeclaration->getPropertyValue(CSSPropertyFontFamily);
     261    return m_fontFaceRule->style()->getPropertyValue(CSSPropertyFontFamily);
    262262}
    263263
     
    300300    CSSProperty srcProperty(CSSPropertySrc, list);
    301301    const CSSProperty* srcPropertyRef = &srcProperty;
    302     m_styleDeclaration->addParsedProperties(&srcPropertyRef, 1);
     302    m_fontFaceRule->style()->addParsedProperties(&srcPropertyRef, 1);
    303303
    304304    if (describesParentFont) {   
    305305        // Traverse parsed CSS values and associate CSSFontFaceSrcValue elements with ourselves.
    306         RefPtr<CSSValue> src = m_styleDeclaration->getPropertyCSSValue(CSSPropertySrc);
     306        RefPtr<CSSValue> src = m_fontFaceRule->style()->getPropertyCSSValue(CSSPropertySrc);
    307307        CSSValueList* srcList = static_cast<CSSValueList*>(src.get());
    308308
  • trunk/Source/WebCore/svg/SVGFontFaceElement.h

    r76990 r106358  
    6262
    6363    RefPtr<CSSFontFaceRule> m_fontFaceRule;
    64     RefPtr<CSSMutableStyleDeclaration> m_styleDeclaration;
    65 
    6664    RefPtr<SVGFontElement> m_fontElement;
    6765};
Note: See TracChangeset for help on using the changeset viewer.