Title: [105772] trunk
Revision
105772
Author
[email protected]
Date
2012-01-24 12:24:11 -0800 (Tue, 24 Jan 2012)

Log Message

REGRESSION (r73385): Marquee with behavior="alternate" is not working
https://bugs.webkit.org/show_bug.cgi?id=64230

Patch by Parag Radke <[email protected]> on 2012-01-24
Reviewed by Simon Fraser.

Source/WebCore:

This patch gives correct content width for marquee, which computes
correct start position to scroll marquee.

Test: fast/html/marquee-alternate.html

* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::computePreferredLogicalWidths):
We need(style()->marqueeBehavior() != MALTERNATE) check as we always need the marquee's
actual content width to compute the initial/end position in case of 'MALTERNATE'.
So we need to calculate the logical width in Alternate case even if fixed width is specified
as content has to animate between renderBox().right().x() - contentWidth() and
renderBox().left().x() + contentWidth().

* rendering/RenderMarquee.cpp:
(WebCore::RenderMarquee::computePosition):
Using PreferredLogicalWidth in place of LayoutOverflow for calculating correct content width.

LayoutTests:

Added a test case to check marquee alternate behavior with fixed width.

* fast/html/marquee-alternate-expected.txt: Added.
* fast/html/marquee-alternate.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (105771 => 105772)


--- trunk/LayoutTests/ChangeLog	2012-01-24 20:22:00 UTC (rev 105771)
+++ trunk/LayoutTests/ChangeLog	2012-01-24 20:24:11 UTC (rev 105772)
@@ -1,3 +1,15 @@
+2012-01-24  Parag Radke  <[email protected]>
+
+        REGRESSION (r73385): Marquee with behavior="alternate" is not working
+        https://bugs.webkit.org/show_bug.cgi?id=64230
+
+        Reviewed by Simon Fraser.
+
+        Added a test case to check marquee alternate behavior with fixed width.
+
+        * fast/html/marquee-alternate-expected.txt: Added.
+        * fast/html/marquee-alternate.html: Added.
+
 2012-01-24  Abhishek Arya  <[email protected]>
 
         Crash when rendering -webkit-column-span.

Added: trunk/LayoutTests/fast/html/marquee-alternate-expected.txt (0 => 105772)


--- trunk/LayoutTests/fast/html/marquee-alternate-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/html/marquee-alternate-expected.txt	2012-01-24 20:24:11 UTC (rev 105772)
@@ -0,0 +1,8 @@
+
+PASS on initial position
+PASS on after half cycle completion
+PASS on after full cycle completion
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/fast/html/marquee-alternate.html (0 => 105772)


--- trunk/LayoutTests/fast/html/marquee-alternate.html	                        (rev 0)
+++ trunk/LayoutTests/fast/html/marquee-alternate.html	2012-01-24 20:24:11 UTC (rev 105772)
@@ -0,0 +1,64 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<script src=""
+<script type="text/_javascript_">
+window.jsTestIsAsync = true;
+var initialPosition = 1;
+var halfAnimationPeriod = 63;
+var fullAnimationPeriod = 123;
+function scrollOffsetInitial()
+{
+  var section1 = document.getElementById('marquee');
+  if (section1.scrollLeft == -initialPosition) {
+      debug("PASS on initial position");
+  } else {
+      debug("FAIL");
+      debug("ScrollLeft = " + section1.scrollLeft);
+      debug("ScrollWidth = " + section1.scrollWidth);
+      finishJSTest();
+  }
+}
+
+function scrollOffsetCompleteCycle()
+{
+  var section1 = document.getElementById('marquee');
+  if (section1.scrollLeft == -initialPosition) {
+      debug("PASS on after full cycle completion");
+  } else {
+      debug("FAIL");
+      debug("ScrollLeft = " + section1.scrollLeft);
+      debug("ScrollWidth = " + section1.scrollWidth);
+  }
+  finishJSTest();
+}
+
+function scrollOffsetMidCycle()
+{
+  var section1 = document.getElementById('marquee');
+  if (section1.scrollLeft == 0 ) {
+      debug("PASS on after half cycle completion");
+  } else {
+      debug("FAIL");
+      debug("ScrollLeft = " + section1.scrollLeft);
+      debug("ScrollWidth = " + section1.scrollWidth);
+      finishJSTest();
+  }
+}
+
+function dump() {
+  var t=setTimeout("scrollOffsetInitial()",0);
+  var t=setTimeout("scrollOffsetMidCycle()",halfAnimationPeriod);
+  var t=setTimeout("scrollOffsetCompleteCycle()",fullAnimationPeriod);
+}
+successfullyParsed = true;
+</script>
+</head>
+<body _onload_ = dump() >
+<marquee id="marquee" width=30 behavior="alternate" scrollamount=1 scrolldelay=1><img src="" width="29" height="29" alt="lime"></marquee>
+<pre id="console"></pre>
+<script src=""
+</body>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (105771 => 105772)


--- trunk/Source/WebCore/ChangeLog	2012-01-24 20:22:00 UTC (rev 105771)
+++ trunk/Source/WebCore/ChangeLog	2012-01-24 20:24:11 UTC (rev 105772)
@@ -1,3 +1,27 @@
+2012-01-24  Parag Radke  <[email protected]>
+
+        REGRESSION (r73385): Marquee with behavior="alternate" is not working
+        https://bugs.webkit.org/show_bug.cgi?id=64230
+
+        Reviewed by Simon Fraser.
+
+        This patch gives correct content width for marquee, which computes
+        correct start position to scroll marquee.
+
+        Test: fast/html/marquee-alternate.html
+
+        * rendering/RenderBlock.cpp:
+        (WebCore::RenderBlock::computePreferredLogicalWidths):
+        We need(style()->marqueeBehavior() != MALTERNATE) check as we always need the marquee's 
+        actual content width to compute the initial/end position in case of 'MALTERNATE'.
+        So we need to calculate the logical width in Alternate case even if fixed width is specified
+        as content has to animate between renderBox().right().x() - contentWidth() and 
+        renderBox().left().x() + contentWidth().
+        
+        * rendering/RenderMarquee.cpp:
+        (WebCore::RenderMarquee::computePosition):
+        Using PreferredLogicalWidth in place of LayoutOverflow for calculating correct content width.
+
 2012-01-24  Andreas Kling  <[email protected]>
 
         RenderInline: Skip caching the computed line height.

Modified: trunk/Source/WebCore/rendering/RenderBlock.cpp (105771 => 105772)


--- trunk/Source/WebCore/rendering/RenderBlock.cpp	2012-01-24 20:22:00 UTC (rev 105771)
+++ trunk/Source/WebCore/rendering/RenderBlock.cpp	2012-01-24 20:24:11 UTC (rev 105772)
@@ -4950,7 +4950,7 @@
     updateFirstLetter();
 
     RenderStyle* styleToUse = style();
-    if (!isTableCell() && styleToUse->logicalWidth().isFixed() && styleToUse->logicalWidth().value() > 0)
+    if (!isTableCell() && styleToUse->logicalWidth().isFixed() && styleToUse->logicalWidth().value() > 0 && style()->marqueeBehavior() != MALTERNATE)
         m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = computeContentBoxLogicalWidth(styleToUse->logicalWidth().value());
     else {
         m_minPreferredLogicalWidth = 0;

Modified: trunk/Source/WebCore/rendering/RenderMarquee.cpp (105771 => 105772)


--- trunk/Source/WebCore/rendering/RenderMarquee.cpp	2012-01-24 20:22:00 UTC (rev 105771)
+++ trunk/Source/WebCore/rendering/RenderMarquee.cpp	2012-01-24 20:24:11 UTC (rev 105772)
@@ -116,7 +116,7 @@
     if (isHorizontal()) {
         bool ltr = s->isLeftToRightDirection();
         int clientWidth = box->clientWidth();
-        int contentWidth = ltr ? box->maxXLayoutOverflow() : box->minXLayoutOverflow();
+        int contentWidth = ltr ? box->maxPreferredLogicalWidth() : box->minPreferredLogicalWidth();
         if (ltr)
             contentWidth += (box->paddingRight() - box->borderLeft());
         else {
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to