Title: [125384] trunk/Source/WebCore
Revision
125384
Author
[email protected]
Date
2012-08-12 17:14:23 -0700 (Sun, 12 Aug 2012)

Log Message

Remove unnecessary null checks from pseudoStyleForElement and adjustRenderStyle
https://bugs.webkit.org/show_bug.cgi?id=93730

Reviewed by Tony Chang.

All the callers of both methods make sure to pass in a non-null parentStyle.

No change in behavior.

* css/StyleResolver.cpp:
* css/StyleResolver.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (125383 => 125384)


--- trunk/Source/WebCore/ChangeLog	2012-08-12 23:13:26 UTC (rev 125383)
+++ trunk/Source/WebCore/ChangeLog	2012-08-13 00:14:23 UTC (rev 125384)
@@ -1,3 +1,17 @@
+2012-08-12  Ojan Vafai  <[email protected]>
+
+        Remove unnecessary null checks from pseudoStyleForElement and adjustRenderStyle
+        https://bugs.webkit.org/show_bug.cgi?id=93730
+
+        Reviewed by Tony Chang.
+
+        All the callers of both methods make sure to pass in a non-null parentStyle.
+
+        No change in behavior.
+
+        * css/StyleResolver.cpp:
+        * css/StyleResolver.h:
+
 2012-08-12  Pravin D  <[email protected]>
 
         table cell.cellIndex should return -1 if there is no parent table

Modified: trunk/Source/WebCore/css/StyleResolver.cpp (125383 => 125384)


--- trunk/Source/WebCore/css/StyleResolver.cpp	2012-08-12 23:13:26 UTC (rev 125383)
+++ trunk/Source/WebCore/css/StyleResolver.cpp	2012-08-13 00:14:23 UTC (rev 125384)
@@ -1908,6 +1908,7 @@
 
 PassRefPtr<RenderStyle> StyleResolver::pseudoStyleForElement(PseudoId pseudo, Element* e, RenderStyle* parentStyle)
 {
+    ASSERT(m_parentStyle);
     if (!e)
         return 0;
 
@@ -1915,10 +1916,8 @@
 
     initForStyleResolve(e, parentStyle, pseudo);
     m_style = RenderStyle::create();
+    m_style->inheritFrom(m_parentStyle);
 
-    if (m_parentStyle)
-        m_style->inheritFrom(m_parentStyle);
-
     // Since we don't use pseudo-elements in any of our quirk/print user agent rules, don't waste time walking
     // those rules.
 
@@ -2070,6 +2069,8 @@
 
 void StyleResolver::adjustRenderStyle(RenderStyle* style, RenderStyle* parentStyle, Element *e)
 {
+    ASSERT(parentStyle);
+
     // Cache our original display.
     style->setOriginalDisplay(style->display());
 
@@ -2129,7 +2130,7 @@
 
         // FIXME: Don't support this mutation for pseudo styles like first-letter or first-line, since it's not completely
         // clear how that should work.
-        if (style->display() == INLINE && style->styleType() == NOPSEUDO && parentStyle && style->writingMode() != parentStyle->writingMode())
+        if (style->display() == INLINE && style->styleType() == NOPSEUDO && style->writingMode() != parentStyle->writingMode())
             style->setDisplay(INLINE_BLOCK);
 
         // After performing the display mutation, check table rows. We do not honor position:relative on

Modified: trunk/Source/WebCore/css/StyleResolver.h (125383 => 125384)


--- trunk/Source/WebCore/css/StyleResolver.h	2012-08-12 23:13:26 UTC (rev 125383)
+++ trunk/Source/WebCore/css/StyleResolver.h	2012-08-13 00:14:23 UTC (rev 125384)
@@ -141,7 +141,7 @@
 
     void keyframeStylesForAnimation(Element*, const RenderStyle*, KeyframeList&);
 
-    PassRefPtr<RenderStyle> pseudoStyleForElement(PseudoId, Element*, RenderStyle* parentStyle = 0);
+    PassRefPtr<RenderStyle> pseudoStyleForElement(PseudoId, Element*, RenderStyle* parentStyle);
 
     PassRefPtr<RenderStyle> styleForPage(int pageIndex);
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to