Title: [106358] trunk/Source/WebCore
Revision
106358
Author
[email protected]
Date
2012-01-31 06:58:37 -0800 (Tue, 31 Jan 2012)

Log 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.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (106357 => 106358)


--- trunk/Source/WebCore/ChangeLog	2012-01-31 14:28:13 UTC (rev 106357)
+++ trunk/Source/WebCore/ChangeLog	2012-01-31 14:58:37 UTC (rev 106358)
@@ -1,3 +1,27 @@
+2012-01-31  Antti Koivisto  <[email protected]>
+
+        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.
+
 2012-01-31  Kenneth Rohde Christiansen  <[email protected]>
 
         Tap highlighting: Support better outlines for multiline inlines

Modified: trunk/Source/WebCore/css/CSSFontFaceRule.cpp (106357 => 106358)


--- trunk/Source/WebCore/css/CSSFontFaceRule.cpp	2012-01-31 14:28:13 UTC (rev 106357)
+++ trunk/Source/WebCore/css/CSSFontFaceRule.cpp	2012-01-31 14:58:37 UTC (rev 106358)
@@ -33,8 +33,7 @@
 
 CSSFontFaceRule::~CSSFontFaceRule()
 {
-    // FIXME: SVGFontFaceElement's style declaration should probably be parented to the rule too.
-    if (m_style && !m_style->isElementStyleDeclaration())
+    if (m_style)
         m_style->clearParentRule();
 }
 

Modified: trunk/Source/WebCore/css/CSSMutableStyleDeclaration.h (106357 => 106358)


--- trunk/Source/WebCore/css/CSSMutableStyleDeclaration.h	2012-01-31 14:28:13 UTC (rev 106357)
+++ trunk/Source/WebCore/css/CSSMutableStyleDeclaration.h	2012-01-31 14:58:37 UTC (rev 106358)
@@ -57,10 +57,6 @@
     { 
         return adoptRef(new CSSMutableStyleDeclaration(element, true));
     }
-    static PassRefPtr<CSSMutableStyleDeclaration> createForSVGFontFaceElement(StyledElement* element) 
-    { 
-        return adoptRef(new CSSMutableStyleDeclaration(element, false));
-    }
 
     unsigned propertyCount() const { return m_properties.size(); }
     bool isEmpty() const { return m_properties.isEmpty(); }

Modified: trunk/Source/WebCore/svg/SVGFontFaceElement.cpp (106357 => 106358)


--- trunk/Source/WebCore/svg/SVGFontFaceElement.cpp	2012-01-31 14:28:13 UTC (rev 106357)
+++ trunk/Source/WebCore/svg/SVGFontFaceElement.cpp	2012-01-31 14:58:37 UTC (rev 106358)
@@ -49,11 +49,11 @@
 inline SVGFontFaceElement::SVGFontFaceElement(const QualifiedName& tagName, Document* document)
     : SVGElement(tagName, document)
     , m_fontFaceRule(CSSFontFaceRule::create())
-    , m_styleDeclaration(CSSMutableStyleDeclaration::createForSVGFontFaceElement(this))
 {
     ASSERT(hasTagName(font_faceTag));
-    m_styleDeclaration->setStrictParsing(true);
-    m_fontFaceRule->setDeclaration(m_styleDeclaration.get());
+    RefPtr<CSSMutableStyleDeclaration> styleDeclaration = CSSMutableStyleDeclaration::create(m_fontFaceRule.get());
+    styleDeclaration->setStrictParsing(true);
+    m_fontFaceRule->setDeclaration(styleDeclaration.release());
 }
 
 PassRefPtr<SVGFontFaceElement> SVGFontFaceElement::create(const QualifiedName& tagName, Document* document)
@@ -113,7 +113,7 @@
 {    
     int propId = cssPropertyIdForSVGAttributeName(attr->name());
     if (propId > 0) {
-        m_styleDeclaration->setProperty(propId, attr->value(), false);
+        m_fontFaceRule->style()->setProperty(propId, attr->value(), false);
         rebuildFontFace();
         return;
     }
@@ -258,7 +258,7 @@
 
 String SVGFontFaceElement::fontFamily() const
 {
-    return m_styleDeclaration->getPropertyValue(CSSPropertyFontFamily);
+    return m_fontFaceRule->style()->getPropertyValue(CSSPropertyFontFamily);
 }
 
 SVGFontElement* SVGFontFaceElement::associatedFontElement() const
@@ -299,11 +299,11 @@
     // Parse in-memory CSS rules
     CSSProperty srcProperty(CSSPropertySrc, list);
     const CSSProperty* srcPropertyRef = &srcProperty;
-    m_styleDeclaration->addParsedProperties(&srcPropertyRef, 1);
+    m_fontFaceRule->style()->addParsedProperties(&srcPropertyRef, 1);
 
     if (describesParentFont) {    
         // Traverse parsed CSS values and associate CSSFontFaceSrcValue elements with ourselves.
-        RefPtr<CSSValue> src = ""
+        RefPtr<CSSValue> src = ""
         CSSValueList* srcList = static_cast<CSSValueList*>(src.get());
 
         unsigned srcLength = srcList ? srcList->length() : 0;

Modified: trunk/Source/WebCore/svg/SVGFontFaceElement.h (106357 => 106358)


--- trunk/Source/WebCore/svg/SVGFontFaceElement.h	2012-01-31 14:28:13 UTC (rev 106357)
+++ trunk/Source/WebCore/svg/SVGFontFaceElement.h	2012-01-31 14:58:37 UTC (rev 106358)
@@ -61,8 +61,6 @@
     virtual void removedFromDocument();
 
     RefPtr<CSSFontFaceRule> m_fontFaceRule;
-    RefPtr<CSSMutableStyleDeclaration> m_styleDeclaration;
-
     RefPtr<SVGFontElement> m_fontElement;
 };
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to