Title: [98021] trunk
Revision
98021
Author
hy...@apple.com
Date
2011-10-20 14:12:00 -0700 (Thu, 20 Oct 2011)

Log Message

https://bugs.webkit.org/show_bug.cgi?id=70539
        
Make the 'clip' property work in variable width regions.

Reviewed by Dan Bernstein.

Source/WebCore: 

Added new test in fast/regions.

* rendering/RenderBox.cpp:
(WebCore::RenderBox::clipRect):
* rendering/RenderBox.h:
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::calculateClipRects):
(WebCore::RenderLayer::calculateRects):
(WebCore::RenderLayer::repaintBlockSelectionGaps):
* rendering/RenderLayerBacking.cpp:
(WebCore::clipBox):

LayoutTests: 

* fast/regions/positioned-objects-clipped-spanning-regions.html: Added.
* platform/mac/fast/regions/positioned-objects-clipped-spanning-regions-expected.png: Added.
* platform/mac/fast/regions/positioned-objects-clipped-spanning-regions-expected.txt: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (98020 => 98021)


--- trunk/LayoutTests/ChangeLog	2011-10-20 20:57:47 UTC (rev 98020)
+++ trunk/LayoutTests/ChangeLog	2011-10-20 21:12:00 UTC (rev 98021)
@@ -1,3 +1,15 @@
+2011-10-20  David Hyatt  <hy...@apple.com>
+
+        https://bugs.webkit.org/show_bug.cgi?id=70539
+        
+        Make the 'clip' property work in variable width regions.
+
+        Reviewed by Dan Bernstein.
+
+        * fast/regions/positioned-objects-clipped-spanning-regions.html: Added.
+        * platform/mac/fast/regions/positioned-objects-clipped-spanning-regions-expected.png: Added.
+        * platform/mac/fast/regions/positioned-objects-clipped-spanning-regions-expected.txt: Added.
+
 2011-10-20  Csaba Osztrogonác  <o...@webkit.org>
 
         [Qt] FontCache::createFontPlatformData() is broken, a default font is returned

Added: trunk/LayoutTests/fast/regions/positioned-objects-clipped-spanning-regions.html (0 => 98021)


--- trunk/LayoutTests/fast/regions/positioned-objects-clipped-spanning-regions.html	                        (rev 0)
+++ trunk/LayoutTests/fast/regions/positioned-objects-clipped-spanning-regions.html	2011-10-20 21:12:00 UTC (rev 98021)
@@ -0,0 +1,63 @@
+<!doctype html>
+
+<html style="direction:rtl">
+<head>
+ <style>
+    #content {
+        -webkit-flow-into: flow1;
+        text-align: justify;
+        padding: 5px;
+    }
+    
+    #first-box {
+        margin:10%
+    }
+    
+    #second-box {
+        position:absolute;
+        right:0;
+        top:0;
+        height:450px;
+        width:50%;
+        background-color:green;
+        border-left:10px solid red;
+        clip:rect(0 300px 450px 10px)
+    }
+    
+    #region1, #region2, #region3 {
+        border: 1px solid black;
+        -webkit-flow-from: flow1;
+    }
+
+    #region1 {
+        width: 200px;
+        height: 150px;
+    }
+    
+    #region2 {
+        width: 300px;
+        height: 180px;
+    }
+    
+    #region3 {
+        width: 120px;
+        height: 120px;
+    }
+</style>
+</head>
+<body>
+<p style="direction:ltr">The green positioned object should span all the regions. It should fill the right half of every region. Its red borders should be clipped.</p>
+
+<div id="content">
+    <div id="first-box">
+        <div id="second-box">
+            
+        </div>
+    </div>
+</div>
+
+<div id="container">
+    <div id="region1"></div>
+    <div id="region2"></div>
+    <div id="region3"></div>
+</div>

Added: trunk/LayoutTests/platform/mac/fast/regions/positioned-objects-clipped-spanning-regions-expected.png


(Binary files differ)
Property changes on: trunk/LayoutTests/platform/mac/fast/regions/positioned-objects-clipped-spanning-regions-expected.png ___________________________________________________________________

Added: svn:mime-type

Added: trunk/LayoutTests/platform/mac/fast/regions/positioned-objects-clipped-spanning-regions-expected.txt (0 => 98021)


--- trunk/LayoutTests/platform/mac/fast/regions/positioned-objects-clipped-spanning-regions-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/mac/fast/regions/positioned-objects-clipped-spanning-regions-expected.txt	2011-10-20 21:12:00 UTC (rev 98021)
@@ -0,0 +1,25 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x532
+  RenderBlock {HTML} at (0,0) size 800x532
+    RenderBody {BODY} at (8,16) size 784x508
+      RenderBlock {P} at (0,0) size 784x36
+        RenderText {#text} at (0,0) size 777x36
+          text run at (0,0) width 777: "The green positioned object should span all the regions. It should fill the right half of every region. Its red borders should be"
+          text run at (0,18) width 50: "clipped."
+      RenderBlock {DIV} at (0,52) size 784x456
+        RenderRegion {DIV} at (582,0) size 202x152 [border: (1px solid #000000)]
+        RenderRegion {DIV} at (482,152) size 302x182 [border: (1px solid #000000)]
+        RenderRegion {DIV} at (662,334) size 122x122 [border: (1px solid #000000)]
+Flow Threads
+  Thread with flow-name 'flow1'
+    layer at (0,0) size 300x450
+      RenderFlowThread at (0,0) size 300x450
+        RenderBlock {DIV} at (0,0) size 300x39
+          RenderBlock {DIV} at (34,34) size 232x0
+    layer at (140,0) size 160x450 backgroundClip at (150,0) size 150x450 clip at (150,0) size 290x450 outlineClip at (150,0) size 290x450
+      RenderBlock (positioned) {DIV} at (140,0) size 160x450 [bgcolor=#008000] [border: (10px solid #FF0000)]
+  Regions for flow 'flow1'
+    RenderRegion {DIV} #region1
+    RenderRegion {DIV} #region2
+    RenderRegion {DIV} #region3

Modified: trunk/Source/WebCore/ChangeLog (98020 => 98021)


--- trunk/Source/WebCore/ChangeLog	2011-10-20 20:57:47 UTC (rev 98020)
+++ trunk/Source/WebCore/ChangeLog	2011-10-20 21:12:00 UTC (rev 98021)
@@ -1,3 +1,23 @@
+2011-10-20  David Hyatt  <hy...@apple.com>
+
+        https://bugs.webkit.org/show_bug.cgi?id=70539
+        
+        Make the 'clip' property work in variable width regions.
+
+        Reviewed by Dan Bernstein.
+
+        Added new test in fast/regions.
+
+        * rendering/RenderBox.cpp:
+        (WebCore::RenderBox::clipRect):
+        * rendering/RenderBox.h:
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::calculateClipRects):
+        (WebCore::RenderLayer::calculateRects):
+        (WebCore::RenderLayer::repaintBlockSelectionGaps):
+        * rendering/RenderLayerBacking.cpp:
+        (WebCore::clipBox):
+
 2011-10-20  Simon Fraser  <simon.fra...@apple.com>
 
         Fix build breakage on some platforms after r98008.

Modified: trunk/Source/WebCore/rendering/RenderBox.cpp (98020 => 98021)


--- trunk/Source/WebCore/rendering/RenderBox.cpp	2011-10-20 20:57:47 UTC (rev 98020)
+++ trunk/Source/WebCore/rendering/RenderBox.cpp	2011-10-20 21:12:00 UTC (rev 98021)
@@ -1247,20 +1247,25 @@
     return clipRect;
 }
 
-LayoutRect RenderBox::clipRect(const LayoutPoint& location)
+LayoutRect RenderBox::clipRect(const LayoutPoint& location, RenderRegion* region)
 {
-    LayoutRect clipRect(location, size());
+    LayoutRect borderBoxRect = borderBoxRectInRegion(region);
+    LayoutRect clipRect = LayoutRect(borderBoxRect.location() + location, borderBoxRect.size());
+
     if (!style()->clipLeft().isAuto()) {
-        LayoutUnit c = style()->clipLeft().calcValue(width());
+        LayoutUnit c = style()->clipLeft().calcValue(borderBoxRect.width());
         clipRect.move(c, 0);
         clipRect.contract(c, 0);
     }
 
+    // We don't use the region-specific border box's width and height since clip offsets are (stupidly) specified
+    // from the left and top edges. Therefore it's better to avoid constraining to smaller widths and heights.
+
     if (!style()->clipRight().isAuto())
         clipRect.contract(width() - style()->clipRight().calcValue(width()), 0);
 
     if (!style()->clipTop().isAuto()) {
-        LayoutUnit c = style()->clipTop().calcValue(height());
+        LayoutUnit c = style()->clipTop().calcValue(borderBoxRect.height());
         clipRect.move(0, c);
         clipRect.contract(0, c);
     }

Modified: trunk/Source/WebCore/rendering/RenderBox.h (98020 => 98021)


--- trunk/Source/WebCore/rendering/RenderBox.h	2011-10-20 20:57:47 UTC (rev 98020)
+++ trunk/Source/WebCore/rendering/RenderBox.h	2011-10-20 21:12:00 UTC (rev 98021)
@@ -362,7 +362,7 @@
     virtual LayoutRect localCaretRect(InlineBox*, int caretOffset, LayoutUnit* extraWidthToEndOfLine = 0);
 
     virtual LayoutRect overflowClipRect(const LayoutPoint& location, RenderRegion*, OverlayScrollbarSizeRelevancy = IgnoreOverlayScrollbarSize);
-    LayoutRect clipRect(const LayoutPoint& location);
+    LayoutRect clipRect(const LayoutPoint& location, RenderRegion*);
     virtual bool hasControlClip() const { return false; }
     virtual LayoutRect controlClipRect(const LayoutPoint&) const { return LayoutRect(); }
     bool pushContentsClip(PaintInfo&, const LayoutPoint& accumulatedOffset);

Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (98020 => 98021)


--- trunk/Source/WebCore/rendering/RenderLayer.cpp	2011-10-20 20:57:47 UTC (rev 98020)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp	2011-10-20 21:12:00 UTC (rev 98021)
@@ -3529,7 +3529,7 @@
                 clipRects.setPosClipRect(intersection(newOverflowClip, clipRects.posClipRect()));
         }
         if (renderer()->hasClip()) {
-            LayoutRect newPosClip = toRenderBox(renderer())->clipRect(offset);
+            LayoutRect newPosClip = toRenderBox(renderer())->clipRect(offset, region);
             clipRects.setPosClipRect(intersection(newPosClip, clipRects.posClipRect()));
             clipRects.setOverflowClipRect(intersection(newPosClip, clipRects.overflowClipRect()));
             clipRects.setFixedClipRect(intersection(newPosClip, clipRects.fixedClipRect()));
@@ -3594,7 +3594,7 @@
 
         if (renderer()->hasClip()) {
             // Clip applies to *us* as well, so go ahead and update the damageRect.
-            LayoutRect newPosClip = toRenderBox(renderer())->clipRect(offset);
+            LayoutRect newPosClip = toRenderBox(renderer())->clipRect(offset, region);
             backgroundRect.intersect(newPosClip);
             foregroundRect.intersect(newPosClip);
             outlineRect.intersect(newPosClip);
@@ -3668,7 +3668,7 @@
     if (renderer()->hasOverflowClip())
         rect.intersect(toRenderBox(renderer())->overflowClipRect(LayoutPoint(), 0)); // FIXME: Regions not accounted for.
     if (renderer()->hasClip())
-        rect.intersect(toRenderBox(renderer())->clipRect(LayoutPoint()));
+        rect.intersect(toRenderBox(renderer())->clipRect(LayoutPoint(), 0)); // FIXME: Regions not accounted for.
     if (!rect.isEmpty())
         renderer()->repaintRectangle(rect);
 }

Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.cpp (98020 => 98021)


--- trunk/Source/WebCore/rendering/RenderLayerBacking.cpp	2011-10-20 20:57:47 UTC (rev 98020)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.cpp	2011-10-20 21:12:00 UTC (rev 98021)
@@ -340,7 +340,7 @@
         result = renderer->overflowClipRect(LayoutPoint(), 0); // FIXME: Incorrect for CSS regions.
 
     if (renderer->hasClip())
-        result.intersect(renderer->clipRect(LayoutPoint()));
+        result.intersect(renderer->clipRect(LayoutPoint(), 0)); // FIXME: Incorrect for CSS regions.
 
     return result;
 }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to