Title: [133561] trunk/Source/WebCore
Revision
133561
Author
[email protected]
Date
2012-11-05 22:25:40 -0800 (Mon, 05 Nov 2012)

Log Message

Use switch/case statements instead of if/elseif in CSSSelector.cpp
https://bugs.webkit.org/show_bug.cgi?id=100470

Reviewed by Ryosuke Niwa.

Minor clean up. We can get compiler warnings if we use switch/case statements here.

No changes to functionality, so no new tests.

* css/CSSSelector.cpp:
(WebCore::CSSSelector::selectorText):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (133560 => 133561)


--- trunk/Source/WebCore/ChangeLog	2012-11-06 06:24:01 UTC (rev 133560)
+++ trunk/Source/WebCore/ChangeLog	2012-11-06 06:25:40 UTC (rev 133561)
@@ -1,3 +1,17 @@
+2012-11-05  Hayato Ito  <[email protected]>
+
+        Use switch/case statements instead of if/elseif in CSSSelector.cpp
+        https://bugs.webkit.org/show_bug.cgi?id=100470
+
+        Reviewed by Ryosuke Niwa.
+
+        Minor clean up. We can get compiler warnings if we use switch/case statements here.
+
+        No changes to functionality, so no new tests.
+
+        * css/CSSSelector.cpp:
+        (WebCore::CSSSelector::selectorText):
+
 2012-11-05  Kenichi Ishibashi  <[email protected]>
 
         [Chromium] Unicode combining diacritical aren't always combined on Linux

Modified: trunk/Source/WebCore/css/CSSSelector.cpp (133560 => 133561)


--- trunk/Source/WebCore/css/CSSSelector.cpp	2012-11-06 06:24:01 UTC (rev 133560)
+++ trunk/Source/WebCore/css/CSSSelector.cpp	2012-11-06 06:25:40 UTC (rev 133561)
@@ -627,17 +627,19 @@
 
     if (CSSSelector* tagHistory = cs->tagHistory()) {
         String tagHistoryText = tagHistory->selectorText();
-        if (cs->relation() == CSSSelector::DirectAdjacent)
+        switch (cs->relation()) {
+        case CSSSelector::Descendant:
+            return tagHistoryText + " " + str.toString();
+        case CSSSelector::Child:
+            return tagHistoryText + " > " + str.toString();
+        case CSSSelector::DirectAdjacent:
             return tagHistoryText + " + " + str.toString();
-        else if (cs->relation() == CSSSelector::IndirectAdjacent)
+        case CSSSelector::IndirectAdjacent:
             return tagHistoryText + " ~ " + str.toString();
-        else if (cs->relation() == CSSSelector::Child)
-            return tagHistoryText + " > " + str.toString();
-        else if (cs->relation() == CSSSelector::ShadowDescendant)
+        case CSSSelector::SubSelector:
+            ASSERT_NOT_REACHED();
+        case CSSSelector::ShadowDescendant:
             return tagHistoryText + str.toString();
-        else {
-            // Descendant
-            return tagHistoryText + " " + str.toString();
         }
     }
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to