Title: [160127] trunk
Revision
160127
Author
[email protected]
Date
2013-12-04 14:24:55 -0800 (Wed, 04 Dec 2013)

Log Message

Web Inspector: [CSS Shapes] Support raster shape visualizations
https://bugs.webkit.org/show_bug.cgi?id=124080

Reviewed by Joseph Pecoraro.

Source/WebCore:

Create an inspector visualization for a shape created from an image.
The visualization takes each line of the image, combining where possible.

Test added to inspector-protocol/model/highlight-shape-outside.html

* rendering/shapes/RasterShape.cpp:
(WebCore::RasterShapeIntervals::buildBoundsPath): Create a path representing the
RasterShapeIntervals.
* rendering/shapes/RasterShape.h:

LayoutTests:

Add a test for data sent to the inspector for a raster shape.

* inspector-protocol/model/highlight-shape-outside-expected.txt:
* inspector-protocol/model/highlight-shape-outside.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (160126 => 160127)


--- trunk/LayoutTests/ChangeLog	2013-12-04 22:18:43 UTC (rev 160126)
+++ trunk/LayoutTests/ChangeLog	2013-12-04 22:24:55 UTC (rev 160127)
@@ -1,3 +1,15 @@
+2013-12-04  Bear Travis  <[email protected]>
+
+        Web Inspector: [CSS Shapes] Support raster shape visualizations
+        https://bugs.webkit.org/show_bug.cgi?id=124080
+
+        Reviewed by Joseph Pecoraro.
+
+        Add a test for data sent to the inspector for a raster shape.
+
+        * inspector-protocol/model/highlight-shape-outside-expected.txt:
+        * inspector-protocol/model/highlight-shape-outside.html:
+
 2013-12-04  Myles C. Maxfield  <[email protected]>
 
         Allow ImageBuffer to use an IOSurface that is larger than necessary

Modified: trunk/LayoutTests/inspector-protocol/model/highlight-shape-outside-expected.txt (160126 => 160127)


--- trunk/LayoutTests/inspector-protocol/model/highlight-shape-outside-expected.txt	2013-12-04 22:18:43 UTC (rev 160126)
+++ trunk/LayoutTests/inspector-protocol/model/highlight-shape-outside-expected.txt	2013-12-04 22:24:55 UTC (rev 160127)
@@ -7,4 +7,7 @@
 PASS: Actual [M 175 75 L 175 125 L 75 125 L 75 75 L 175 75 Z] Expected [M 175 75 L 175 125 L 75 125 L 75 75 L 175 75 Z]
 PASS: Actual [M 150 50 L 150 100 L 50 100 L 50 50 L 150 50 Z] Expected [M 150 50 L 150 100 L 50 100 L 50 50 L 150 50 Z]
 PASS: Actual [M 25 25 L 125 25 L 125 125 L 25 125 L 25 25 Z] Expected [M 25 25 L 125 25 L 125 125 L 25 125 L 25 25 Z]
+PASS: Actual [M 50 50 L 100 50 L 100 100 L 50 100 Z] Expected [M 50 50 L 100 50 L 100 100 L 50 100 Z]
+PASS: Actual [M 35 35 L 115 35 L 115 65 L 35 65 Z M 35 85 L 115 85 L 115 115 L 35 115 Z] Expected [M 35 35 L 115 35 L 115 65 L 35 65 Z M 35 85 L 115 85 L 115 115 L 35 115 Z]
+PASS: Actual [M 50 50 L 100 50 L 100 100 L 50 100 Z] Expected [M 50 50 L 100 50 L 100 100 L 50 100 Z]
 

Modified: trunk/LayoutTests/inspector-protocol/model/highlight-shape-outside.html (160126 => 160127)


--- trunk/LayoutTests/inspector-protocol/model/highlight-shape-outside.html	2013-12-04 22:18:43 UTC (rev 160126)
+++ trunk/LayoutTests/inspector-protocol/model/highlight-shape-outside.html	2013-12-04 22:24:55 UTC (rev 160127)
@@ -39,6 +39,16 @@
 .content-box {
     -webkit-shape-outside: content-box;
 }
+.raster-svg {
+    -webkit-shape-outside: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' preserveAspectRatio='none' width='100px' height='100px'><rect x='25' y='25' width='50' height='50' fill='blue' /></svg>");
+}
+.raster-svg-complex {
+    -webkit-shape-outside: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' preserveAspectRatio='none' width='100px' height='100px'><rect x='10' y='10' width='30' height='30' fill='blue' /><rect x='60' y='10' width='30' height='30' fill='blue' /><rect x='10' y='60' width='30' height='30' fill='blue' /><rect x='60' y='60' width='30' height='30' fill='blue' /></svg>");
+}
+.raster-png {
+    /* png version of raster-svg */
+   -webkit-shape-outside: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAMAAABHPGVmAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAAZQTFRFAAD/////e9yZLAAAAAJ0Uk5T/wDltzBKAAAASUlEQVR42uzYsQ0AMAgEsWf/pTMDBURIvgXcX2qhQCAQCAQCgUA+I2kHgUAgEAgEAoFAIBAIBAKBQOYRoxMCgUAgEAjkHPIEGAA2ih1NVnaDGgAAAABJRU5ErkJggg==");
+}
 </style>
 <script type="text/_javascript_" src=""
 <script type="text/_javascript_" src=""
@@ -80,6 +90,18 @@
     {
         'selector' : '.content-box.padded',
         'path' : ['M', 25, 25, 'L', 125, 25, 'L', 125, 125, 'L', 25, 125, 'L', 25, 25, 'Z']
+    },
+    {
+        'selector' : '.raster-svg.padded',
+        'path' : ['M', 50, 50, 'L', 100, 50, 'L', 100, 100, 'L', 50, 100, 'Z']
+    },
+    {
+        'selector' : '.raster-svg-complex.padded',
+        'path' : ['M', 35, 35, 'L', 115, 35, 'L', 115, 65, 'L', 35, 65, 'Z', 'M', 35, 85, 'L', 115, 85, 'L', 115, 115, 'L', 35, 115, 'Z']
+    },
+    {
+        'selector' : '.raster-png.padded',
+        'path' : ['M', 50, 50, 'L', 100, 50, 'L', 100, 100, 'L', 50, 100, 'Z']
     }
     ];
 
@@ -113,5 +135,8 @@
     <div class='shape padded rectangle vertical-rl'></div>
     <div class='shape padded rectangle vertical-rl border-box'></div>
     <div class='shape padded content-box'></div>
+    <div class='shape padded raster-svg'></div>
+    <div class='shape padded raster-svg-complex'></div>
+    <div class='shape padded raster-png'></div>
 </body>
 </html>

Modified: trunk/Source/WebCore/ChangeLog (160126 => 160127)


--- trunk/Source/WebCore/ChangeLog	2013-12-04 22:18:43 UTC (rev 160126)
+++ trunk/Source/WebCore/ChangeLog	2013-12-04 22:24:55 UTC (rev 160127)
@@ -1,3 +1,20 @@
+2013-12-04  Bear Travis  <[email protected]>
+
+        Web Inspector: [CSS Shapes] Support raster shape visualizations
+        https://bugs.webkit.org/show_bug.cgi?id=124080
+
+        Reviewed by Joseph Pecoraro.
+
+        Create an inspector visualization for a shape created from an image.
+        The visualization takes each line of the image, combining where possible.
+
+        Test added to inspector-protocol/model/highlight-shape-outside.html
+
+        * rendering/shapes/RasterShape.cpp:
+        (WebCore::RasterShapeIntervals::buildBoundsPath): Create a path representing the
+        RasterShapeIntervals.
+        * rendering/shapes/RasterShape.h:
+
 2013-12-04  Zoltan Horvath  <[email protected]>
 
         [CSS Shapes] Remove explicit numbering from BasicShape::Type and CSSBasicShape::Type enums

Modified: trunk/Source/WebCore/rendering/shapes/RasterShape.cpp (160126 => 160127)


--- trunk/Source/WebCore/rendering/shapes/RasterShape.cpp	2013-12-04 22:18:43 UTC (rev 160126)
+++ trunk/Source/WebCore/rendering/shapes/RasterShape.cpp	2013-12-04 22:24:55 UTC (rev 160127)
@@ -252,6 +252,23 @@
     return result.release();
 }
 
+void RasterShapeIntervals::buildBoundsPath(Path& path) const
+{
+    for (int y = bounds().y(); y < bounds().maxY(); y++) {
+        if (intervalsAt(y).isEmpty())
+            continue;
+
+        IntShapeInterval extent = limitIntervalAt(y);
+        int endY = y + 1;
+        for (; endY < bounds().maxY(); endY++) {
+            if (intervalsAt(endY).isEmpty() || limitIntervalAt(endY) != extent)
+                break;
+        }
+        path.addRect(FloatRect(extent.x1(), y, extent.width(), endY - y));
+        y = endY - 1;
+    }
+}
+
 const RasterShapeIntervals& RasterShape::marginIntervals() const
 {
     ASSERT(shapeMargin() >= 0);

Modified: trunk/Source/WebCore/rendering/shapes/RasterShape.h (160126 => 160127)


--- trunk/Source/WebCore/rendering/shapes/RasterShape.h	2013-12-04 22:18:43 UTC (rev 160126)
+++ trunk/Source/WebCore/rendering/shapes/RasterShape.h	2013-12-04 22:24:55 UTC (rev 160127)
@@ -55,6 +55,8 @@
     bool firstIncludedIntervalY(int minY, const IntSize& minSize, LayoutUnit& result) const;
     PassOwnPtr<RasterShapeIntervals> computeShapeMarginIntervals(unsigned shapeMargin) const;
 
+    void buildBoundsPath(Path&) const;
+
 private:
     int size() const { return m_intervalLists.size(); }
 
@@ -101,8 +103,7 @@
     virtual void getIncludedIntervals(LayoutUnit logicalTop, LayoutUnit logicalHeight, SegmentList&) const OVERRIDE;
     virtual bool firstIncludedIntervalLogicalTop(LayoutUnit minLogicalIntervalTop, const LayoutSize& minLogicalIntervalSize, LayoutUnit&) const OVERRIDE;
 
-    // FIXME: Bug 124080 - RasterShapes are not yet supported and only display their shape bounds
-    virtual void buildPath(Path& path) const OVERRIDE { UNUSED_PARAM(path); }
+    virtual void buildPath(Path& path) const OVERRIDE { m_intervals->buildBoundsPath(path); }
 
 private:
     const RasterShapeIntervals& marginIntervals() const;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to