Title: [131776] trunk/Source/WebCore
Revision
131776
Author
[email protected]
Date
2012-10-18 11:03:14 -0700 (Thu, 18 Oct 2012)

Log Message

Add 8-bit path to RenderBlock::handleTrailingSpaces()
https://bugs.webkit.org/show_bug.cgi?id=99731

Reviewed by Dan Bernstein.

Factored out and added findFirstTrailingSpace() templated helper function that is called with the
approriate character pointer type.

No tests needed, change covered by existing tests.

* rendering/RenderBlockLineLayout.cpp:
(WebCore::findFirstTrailingSpace):
(WebCore::RenderBlock::handleTrailingSpaces):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (131775 => 131776)


--- trunk/Source/WebCore/ChangeLog	2012-10-18 17:54:02 UTC (rev 131775)
+++ trunk/Source/WebCore/ChangeLog	2012-10-18 18:03:14 UTC (rev 131776)
@@ -1,3 +1,19 @@
+2012-10-18  Michael Saboff  <[email protected]>
+
+        Add 8-bit path to RenderBlock::handleTrailingSpaces()
+        https://bugs.webkit.org/show_bug.cgi?id=99731
+
+        Reviewed by Dan Bernstein.
+
+        Factored out and added findFirstTrailingSpace() templated helper function that is called with the 
+        approriate character pointer type.
+
+        No tests needed, change covered by existing tests.
+
+        * rendering/RenderBlockLineLayout.cpp:
+        (WebCore::findFirstTrailingSpace):
+        (WebCore::RenderBlock::handleTrailingSpaces):
+
 2012-10-18  Hans Muller  <[email protected]>
 
         [CSS Exclusions] Add ExclusionShape::shapeBoundingBox() method

Modified: trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp (131775 => 131776)


--- trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp	2012-10-18 17:54:02 UTC (rev 131775)
+++ trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp	2012-10-18 18:03:14 UTC (rev 131776)
@@ -1021,6 +1021,20 @@
     child->layer()->setStaticBlockPosition(blockHeight);
 }
 
+template <typename CharacterType>
+static inline int findFirstTrailingSpace(RenderText* lastText, const CharacterType* characters, int start, int stop)
+{
+    int firstSpace = stop;
+    while (firstSpace > start) {
+        UChar current = characters[firstSpace - 1];
+        if (!isCollapsibleSpace(current, lastText))
+            break;
+        firstSpace--;
+    }
+
+    return firstSpace;
+}
+
 inline BidiRun* RenderBlock::handleTrailingSpaces(BidiRunList<BidiRun>& bidiRuns, BidiContext* currentContext)
 {
     if (!bidiRuns.runCount()
@@ -1034,14 +1048,12 @@
         return 0;
 
     RenderText* lastText = toRenderText(lastObject);
-    const UChar* characters = lastText->characters();
-    int firstSpace = trailingSpaceRun->stop();
-    while (firstSpace > trailingSpaceRun->start()) {
-        UChar current = characters[firstSpace - 1];
-        if (!isCollapsibleSpace(current, lastText))
-            break;
-        firstSpace--;
-    }
+    int firstSpace;
+    if (lastText->is8Bit())
+        firstSpace = findFirstTrailingSpace(lastText, lastText->characters8(), trailingSpaceRun->start(), trailingSpaceRun->stop());
+    else
+        firstSpace = findFirstTrailingSpace(lastText, lastText->characters16(), trailingSpaceRun->start(), trailingSpaceRun->stop());
+
     if (firstSpace == trailingSpaceRun->stop())
         return 0;
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to