Title: [119776] trunk/Source/WebCore
Revision
119776
Author
[email protected]
Date
2012-06-07 17:36:22 -0700 (Thu, 07 Jun 2012)

Log Message

Dropping m_startingLineNumber property from StyledElement.
https://bugs.webkit.org/show_bug.cgi?id=86848

Patch by Mike West <[email protected]> on 2012-06-07
Reviewed by Adam Barth.

We can have the same effect by moving the line-number calculation
directly into StyledElement::styleAttributeChanged. This means that
subsequent changes to the style attribute (via script) won't generate
error messages with line numbers, but that's an acceptable tradeoff.

Behavior is covered by existing CSP tests.

* dom/StyledElement.cpp:
(WebCore::StyledElement::StyledElement):
(WebCore::StyledElement::styleAttributeChanged):
* dom/StyledElement.h:
(WebCore::StyledElement::destroyInlineStyle):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (119775 => 119776)


--- trunk/Source/WebCore/ChangeLog	2012-06-08 00:29:27 UTC (rev 119775)
+++ trunk/Source/WebCore/ChangeLog	2012-06-08 00:36:22 UTC (rev 119776)
@@ -1,3 +1,23 @@
+2012-06-07  Mike West  <[email protected]>
+
+        Dropping m_startingLineNumber property from StyledElement.
+        https://bugs.webkit.org/show_bug.cgi?id=86848
+
+        Reviewed by Adam Barth.
+
+        We can have the same effect by moving the line-number calculation
+        directly into StyledElement::styleAttributeChanged. This means that
+        subsequent changes to the style attribute (via script) won't generate
+        error messages with line numbers, but that's an acceptable tradeoff.
+
+        Behavior is covered by existing CSP tests.
+
+        * dom/StyledElement.cpp:
+        (WebCore::StyledElement::StyledElement):
+        (WebCore::StyledElement::styleAttributeChanged):
+        * dom/StyledElement.h:
+        (WebCore::StyledElement::destroyInlineStyle):
+
 2012-06-07  Peter Beverloo  <[email protected]>
 
         Initialize m_document in AXObjectCache's constructor for !HAVE(ACCESSIBILITY) builds

Modified: trunk/Source/WebCore/dom/StyledElement.cpp (119775 => 119776)


--- trunk/Source/WebCore/dom/StyledElement.cpp	2012-06-08 00:29:27 UTC (rev 119775)
+++ trunk/Source/WebCore/dom/StyledElement.cpp	2012-06-08 00:36:22 UTC (rev 119776)
@@ -130,10 +130,7 @@
 
 StyledElement::StyledElement(const QualifiedName& name, Document* document, ConstructionType type)
     : Element(name, document, type)
-    , m_startLineNumber(WTF::OrdinalNumber::beforeFirst())
 {
-    if (document && document->scriptableDocumentParser() && !document->isInDocumentWrite())
-        m_startLineNumber = document->scriptableDocumentParser()->lineNumber();
 }
 
 StyledElement::~StyledElement()
@@ -181,9 +178,12 @@
 void StyledElement::styleAttributeChanged(const AtomicString& newStyleString, ShouldReparseStyleAttribute shouldReparse)
 {
     if (shouldReparse) {
+        WTF::OrdinalNumber startLineNumber = WTF::OrdinalNumber::beforeFirst();
+        if (document() && document()->scriptableDocumentParser() && !document()->isInDocumentWrite())
+            startLineNumber = document()->scriptableDocumentParser()->lineNumber();
         if (newStyleString.isNull())
             destroyInlineStyle();
-        else if (document()->contentSecurityPolicy()->allowInlineStyle(document()->url(), m_startLineNumber))
+        else if (document()->contentSecurityPolicy()->allowInlineStyle(document()->url(), startLineNumber))
             ensureAttributeData()->updateInlineStyleAvoidingMutation(this, newStyleString);
         setIsStyleAttributeValid();
     }

Modified: trunk/Source/WebCore/dom/StyledElement.h (119775 => 119776)


--- trunk/Source/WebCore/dom/StyledElement.h	2012-06-08 00:29:27 UTC (rev 119775)
+++ trunk/Source/WebCore/dom/StyledElement.h	2012-06-08 00:36:22 UTC (rev 119776)
@@ -27,7 +27,6 @@
 
 #include "Element.h"
 #include "StylePropertySet.h"
-#include <wtf/text/TextPosition.h>
 
 namespace WebCore {
 
@@ -93,8 +92,6 @@
         if (attributeData())
             attributeData()->destroyInlineStyle(this);
     }
-
-    WTF::OrdinalNumber m_startLineNumber;
 };
 
 inline const SpaceSplitString& StyledElement::classNames() const
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to