Title: [118538] trunk
Revision
118538
Author
[email protected]
Date
2012-05-25 10:26:54 -0700 (Fri, 25 May 2012)

Log Message

Web Inspector: Hangup when continuously changing a css width value in Inspector
https://bugs.webkit.org/show_bug.cgi?id=85802

Reviewed by Vsevolod Vlasov.

Source/WebCore:

An error in the property whitespace prefix detection algorithm would append the previous line trailing whitespace,
thereby enormously increasing the actual prefix during multiple incremental property changes.

* inspector/InspectorStyleSheet.cpp:
(WebCore::InspectorStyle::newLineAndWhitespaceDelimiters):

LayoutTests:

* inspector/styles/styles-formatting-expected.txt:
* inspector/styles/styles-formatting.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (118537 => 118538)


--- trunk/LayoutTests/ChangeLog	2012-05-25 17:24:55 UTC (rev 118537)
+++ trunk/LayoutTests/ChangeLog	2012-05-25 17:26:54 UTC (rev 118538)
@@ -1,3 +1,13 @@
+2012-05-25  Alexander Pavlov  <[email protected]>
+
+        Web Inspector: Hangup when continuously changing a css width value in Inspector
+        https://bugs.webkit.org/show_bug.cgi?id=85802
+
+        Reviewed by Vsevolod Vlasov.
+
+        * inspector/styles/styles-formatting-expected.txt:
+        * inspector/styles/styles-formatting.html:
+
 2012-05-25  Joshua Bell  <[email protected]>
 
         [Chromium] Widen CRASH expectation for visibility-simple-canvas2d-layer.html to include Mac10.6.

Modified: trunk/LayoutTests/inspector/styles/styles-formatting-expected.txt (118537 => 118538)


--- trunk/LayoutTests/inspector/styles/styles-formatting-expected.txt	2012-05-25 17:24:55 UTC (rev 118537)
+++ trunk/LayoutTests/inspector/styles/styles-formatting-expected.txt	2012-05-25 17:26:54 UTC (rev 118538)
@@ -7,7 +7,7 @@
 
 Running: testFormattedInsertStart
 raw cssText:
-{
+{ 
     firstProperty: firstValue;
     property1: value1;
     property2: value2;
@@ -16,7 +16,7 @@
 
 Running: testFormattedRemoveStart
 raw cssText:
-{
+{ 
     property1: value1;
     property2: value2;
     property3: value3;
@@ -24,7 +24,7 @@
 
 Running: testFormattedInsertMiddle
 raw cssText:
-{
+{ 
     property1: value1;
     middleProperty: middleValue;
     property2: value2;
@@ -33,7 +33,7 @@
 
 Running: testFormattedRemoveMiddle
 raw cssText:
-{
+{ 
     property1: value1;
     property2: value2;
     property3: value3;
@@ -41,7 +41,7 @@
 
 Running: testFormattedInsertEnd
 raw cssText:
-{
+{ 
     property1: value1;
     property2: value2;
     property3: value3;
@@ -50,7 +50,7 @@
 
 Running: testFormattedRemoveEnd
 raw cssText:
-{
+{ 
     property1: value1;
     property2: value2;
     property3: value3;
@@ -58,38 +58,38 @@
 
 Running: testFormattedDisableStart
 raw cssText:
-{
+{ 
     property2: value2;
     property3: value3;
 }
 
 Running: testFormattedDisableEnd
 raw cssText:
-{
+{ 
     property2: value2;
 }
 
 Running: testFormattedDisableMiddle
 raw cssText:
-{
+{ 
 }
 
 Running: testFormattedInsert1
 raw cssText:
-{
+{ 
     propA: valA;
 }
 
 Running: testFormattedInsert2
 raw cssText:
-{
+{ 
     propA: valA;
     propB: valB;
 }
 
 Running: testFormattedInsert3
 raw cssText:
-{
+{ 
     propA: valA;
     propB: valB;
     propC: valC;
@@ -97,7 +97,7 @@
 
 Running: testFormattedEnableStart
 raw cssText:
-{
+{ 
     propA: valA;
     property1: value1;
     propB: valB;
@@ -106,7 +106,7 @@
 
 Running: testFormattedEnableEnd
 raw cssText:
-{
+{ 
     propA: valA;
     property1: value1;
     propB: valB;
@@ -116,7 +116,7 @@
 
 Running: testFormattedEnableMiddle
 raw cssText:
-{
+{ 
     propA: valA;
     property1: value1;
     propB: valB;

Modified: trunk/LayoutTests/inspector/styles/styles-formatting.html (118537 => 118538)


--- trunk/LayoutTests/inspector/styles/styles-formatting.html	2012-05-25 17:24:55 UTC (rev 118537)
+++ trunk/LayoutTests/inspector/styles/styles-formatting.html	2012-05-25 17:26:54 UTC (rev 118538)
@@ -227,7 +227,7 @@
 
 <style>
 
-#formatted {
+#formatted { 
     property1: value1;
     property2: value2;
     property3: value3;

Modified: trunk/Source/WebCore/ChangeLog (118537 => 118538)


--- trunk/Source/WebCore/ChangeLog	2012-05-25 17:24:55 UTC (rev 118537)
+++ trunk/Source/WebCore/ChangeLog	2012-05-25 17:26:54 UTC (rev 118538)
@@ -1,5 +1,18 @@
 2012-05-25  Alexander Pavlov  <[email protected]>
 
+        Web Inspector: Hangup when continuously changing a css width value in Inspector
+        https://bugs.webkit.org/show_bug.cgi?id=85802
+
+        Reviewed by Vsevolod Vlasov.
+
+        An error in the property whitespace prefix detection algorithm would append the previous line trailing whitespace,
+        thereby enormously increasing the actual prefix during multiple incremental property changes.
+
+        * inspector/InspectorStyleSheet.cpp:
+        (WebCore::InspectorStyle::newLineAndWhitespaceDelimiters):
+
+2012-05-25  Alexander Pavlov  <[email protected]>
+
         Web Inspector: Clean up Inspector.json after r118367
         https://bugs.webkit.org/show_bug.cgi?id=87499
 

Modified: trunk/Source/WebCore/inspector/InspectorStyleSheet.cpp (118537 => 118538)


--- trunk/Source/WebCore/inspector/InspectorStyleSheet.cpp	2012-05-25 17:24:55 UTC (rev 118537)
+++ trunk/Source/WebCore/inspector/InspectorStyleSheet.cpp	2012-05-25 17:26:54 UTC (rev 118538)
@@ -57,6 +57,7 @@
 #include <wtf/OwnPtr.h>
 #include <wtf/PassOwnPtr.h>
 #include <wtf/Vector.h>
+#include <wtf/text/StringBuilder.h>
 
 using WebCore::TypeBuilder::Array;
 
@@ -638,10 +639,9 @@
 
     m_formatAcquired = true;
 
-    String formatLineFeed = "";
-    String formatPropertyPrefix = "";
-    String prefix;
     String candidatePrefix = defaultPrefix;
+    StringBuilder formatLineFeed;
+    StringBuilder prefix;
     int scanStart = 0;
     int propertyIndex = 0;
     bool isFullPrefixScanned = false;
@@ -658,11 +658,12 @@
             if (isLineFeed) {
                 if (!lineFeedTerminated)
                     formatLineFeed.append(ch);
+                prefix.clear();
             } else if (isHTMLSpace(ch))
                 prefix.append(ch);
             else {
-                candidatePrefix = prefix;
-                prefix = "";
+                candidatePrefix = prefix.toString();
+                prefix.clear();
                 scanStart = currentProperty.range.end;
                 ++propertyIndex;
                 processNextProperty = true;
@@ -677,8 +678,8 @@
         }
     }
 
-    m_format.first = formatLineFeed;
-    m_format.second = isFullPrefixScanned ? prefix : candidatePrefix;
+    m_format.first = formatLineFeed.toString();
+    m_format.second = isFullPrefixScanned ? prefix.toString() : candidatePrefix;
     return m_format;
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to