<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[163509] trunk/Source</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/163509">163509</a></dd>
<dt>Author</dt> <dd>simon.fraser@apple.com</dd>
<dt>Date</dt> <dd>2014-02-05 20:31:46 -0800 (Wed, 05 Feb 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Support encoding and decoding of Regions
https://bugs.webkit.org/show_bug.cgi?id=128284

Source/WebCore:

Reviewed by Anders Carlsson.

Region changes to make it encodable:

Make Region::Span public and give it a default constructor.
Allow getting and setting of Shape internals, and a way to update
the Region bounds after changing the shape. Also add a way to test
for valid spans and segments.

* platform/graphics/Region.cpp:
(WebCore::Region::Shape::isValid):
(WebCore::Region::updateBoundsFromShape):
* platform/graphics/Region.h:
(WebCore::Region::isValid):
(WebCore::Region::Span::Span):
(WebCore::Region::shapeSegments):
(WebCore::Region::shapeSpans):
(WebCore::Region::setShapeSegments):
(WebCore::Region::setShapeSpans):
(WebCore::Region::Shape::segments):
(WebCore::Region::Shape::spans):
(WebCore::Region::Shape::setSegments):
(WebCore::Region::Shape::setSpans):

Source/WebKit2:

Reviewed by Anders Carlsson.

Support encoding and decoding of Region, and its internal
struct Region::Span.

ArgumentCoders had to be taught about how to encode
Vectors with inline capacity.

* Platform/IPC/ArgumentCoders.h:
* Shared/WebCoreArgumentCoders.cpp:
(IPC::ArgumentCoder&lt;Region::Span&gt;::encode):
(IPC::ArgumentCoder&lt;Region::Span&gt;::decode):
(IPC::ArgumentCoder&lt;Region&gt;::encode):
(IPC::ArgumentCoder&lt;Region&gt;::decode):
* Shared/WebCoreArgumentCoders.h:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsRegioncpp">trunk/Source/WebCore/platform/graphics/Region.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsRegionh">trunk/Source/WebCore/platform/graphics/Region.h</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2PlatformIPCArgumentCodersh">trunk/Source/WebKit2/Platform/IPC/ArgumentCoders.h</a></li>
<li><a href="#trunkSourceWebKit2SharedWebCoreArgumentCoderscpp">trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp</a></li>
<li><a href="#trunkSourceWebKit2SharedWebCoreArgumentCodersh">trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (163508 => 163509)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-02-06 04:10:47 UTC (rev 163508)
+++ trunk/Source/WebCore/ChangeLog        2014-02-06 04:31:46 UTC (rev 163509)
</span><span class="lines">@@ -1,3 +1,32 @@
</span><ins>+2014-02-05  Simon Fraser  &lt;simon.fraser@apple.com&gt;
+
+        Support encoding and decoding of Regions
+        https://bugs.webkit.org/show_bug.cgi?id=128284
+
+        Reviewed by Anders Carlsson.
+
+        Region changes to make it encodable:
+        
+        Make Region::Span public and give it a default constructor.
+        Allow getting and setting of Shape internals, and a way to update
+        the Region bounds after changing the shape. Also add a way to test
+        for valid spans and segments.
+
+        * platform/graphics/Region.cpp:
+        (WebCore::Region::Shape::isValid):
+        (WebCore::Region::updateBoundsFromShape):
+        * platform/graphics/Region.h:
+        (WebCore::Region::isValid):
+        (WebCore::Region::Span::Span):
+        (WebCore::Region::shapeSegments):
+        (WebCore::Region::shapeSpans):
+        (WebCore::Region::setShapeSegments):
+        (WebCore::Region::setShapeSpans):
+        (WebCore::Region::Shape::segments):
+        (WebCore::Region::Shape::spans):
+        (WebCore::Region::Shape::setSegments):
+        (WebCore::Region::Shape::setSpans):
+
</ins><span class="cx"> 2014-02-05  Andreas Kling  &lt;akling@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Rebaseline the bindings tests after Oliver's hackery.
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsRegioncpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/Region.cpp (163508 => 163509)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/Region.cpp        2014-02-06 04:10:47 UTC (rev 163508)
+++ trunk/Source/WebCore/platform/graphics/Region.cpp        2014-02-06 04:31:46 UTC (rev 163509)
</span><span class="lines">@@ -319,10 +319,10 @@
</span><span class="cx"> #ifndef NDEBUG
</span><span class="cx"> void Region::Shape::dump() const
</span><span class="cx"> {
</span><del>-    for (Shape::SpanIterator span = spans_begin(), end = spans_end(); span != end; ++span) {
</del><ins>+    for (auto span = spans_begin(), end = spans_end(); span != end; ++span) {
</ins><span class="cx">         printf(&quot;%6d: (&quot;, span-&gt;y);
</span><span class="cx"> 
</span><del>-        for (Shape::SegmentIterator segment = segments_begin(span), end = segments_end(span); segment != end; ++segment)
</del><ins>+        for (auto segment = segments_begin(span), end = segments_end(span); segment != end; ++segment)
</ins><span class="cx">             printf(&quot;%d &quot;, *segment);
</span><span class="cx">         printf(&quot;)\n&quot;);
</span><span class="cx">     }
</span><span class="lines">@@ -331,6 +331,27 @@
</span><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+bool Region::Shape::isValid() const
+{
+    for (auto span = spans_begin(), end = spans_end(); span != end &amp;&amp; span + 1 != end; ++span) {
+        int y = span-&gt;y;
+        int height = (span + 1)-&gt;y - y;
+        
+        if (height &lt; 0)
+            return false;
+
+        for (auto segment = segments_begin(span), end = segments_end(span); segment != end &amp;&amp; segment + 1 != end; segment += 2) {
+            int x = *segment;
+            int width = *(segment + 1) - x;
+            
+            if (width &lt; 0)
+                return false;
+        }
+    }
+
+    return true;
+}
+
</ins><span class="cx"> IntRect Region::Shape::bounds() const
</span><span class="cx"> {
</span><span class="cx">     if (isEmpty())
</span><span class="lines">@@ -550,6 +571,11 @@
</span><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+void Region::updateBoundsFromShape()
+{
+    m_bounds = m_shape.bounds();
+}
+
</ins><span class="cx"> void Region::intersect(const Region&amp; region)
</span><span class="cx"> {
</span><span class="cx">     if (m_bounds.isEmpty())
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsRegionh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/Region.h (163508 => 163509)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/Region.h        2014-02-06 04:10:47 UTC (rev 163508)
+++ trunk/Source/WebCore/platform/graphics/Region.h        2014-02-06 04:31:46 UTC (rev 163509)
</span><span class="lines">@@ -64,10 +64,20 @@
</span><span class="cx">     void dump() const;
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-private:
</del><ins>+    bool isValid() const { return m_shape.isValid(); }
+
+    // This is internal to Region, but exposed just for encoding.
+    // FIXME: figure out a better way to encode WebCore classes.
</ins><span class="cx">     struct Span {
</span><ins>+        Span()
+            : y(0)
+            , segmentIndex(0)
+        {
+        }
+
</ins><span class="cx">         Span(int y, size_t segmentIndex)
</span><del>-            : y(y), segmentIndex(segmentIndex)
</del><ins>+            : y(y)
+            , segmentIndex(segmentIndex)
</ins><span class="cx">         {
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="lines">@@ -75,6 +85,16 @@
</span><span class="cx">         size_t segmentIndex;
</span><span class="cx">     };
</span><span class="cx"> 
</span><ins>+    // For encoding/decoding only.
+    const Vector&lt;int, 32&gt;&amp; shapeSegments() const { return m_shape.segments(); }
+    const Vector&lt;Span, 16&gt;&amp; shapeSpans() const { return m_shape.spans(); }
+
+    void setShapeSegments(const Vector&lt;int&gt;&amp; segments) { m_shape.setSegments(segments); }
+    void setShapeSpans(const Vector&lt;Span&gt;&amp; spans) { m_shape.setSpans(spans); }
+    void updateBoundsFromShape();
+
+private:
+
</ins><span class="cx">     class Shape {
</span><span class="cx">     public:
</span><span class="cx">         Shape();
</span><span class="lines">@@ -105,7 +125,16 @@
</span><span class="cx"> 
</span><span class="cx">         template&lt;typename CompareOperation&gt;
</span><span class="cx">         static bool compareShapes(const Shape&amp; shape1, const Shape&amp; shape2);
</span><ins>+        
+        bool isValid() const;
</ins><span class="cx"> 
</span><ins>+        // For encoding/decoding only.
+        const Vector&lt;int, 32&gt;&amp; segments() const { return m_segments; }
+        const Vector&lt;Span, 16&gt;&amp; spans() const { return m_spans; }
+
+        void setSegments(const Vector&lt;int&gt;&amp; segments) { m_segments = segments; }
+        void setSpans(const Vector&lt;Span&gt;&amp; spans) { m_spans = spans; }
+
</ins><span class="cx"> #ifndef NDEBUG
</span><span class="cx">         void dump() const;
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (163508 => 163509)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2014-02-06 04:10:47 UTC (rev 163508)
+++ trunk/Source/WebKit2/ChangeLog        2014-02-06 04:31:46 UTC (rev 163509)
</span><span class="lines">@@ -1,3 +1,24 @@
</span><ins>+2014-02-05  Simon Fraser  &lt;simon.fraser@apple.com&gt;
+
+        Support encoding and decoding of Regions
+        https://bugs.webkit.org/show_bug.cgi?id=128284
+
+        Reviewed by Anders Carlsson.
+        
+        Support encoding and decoding of Region, and its internal
+        struct Region::Span.
+        
+        ArgumentCoders had to be taught about how to encode
+        Vectors with inline capacity.
+
+        * Platform/IPC/ArgumentCoders.h:
+        * Shared/WebCoreArgumentCoders.cpp:
+        (IPC::ArgumentCoder&lt;Region::Span&gt;::encode):
+        (IPC::ArgumentCoder&lt;Region::Span&gt;::decode):
+        (IPC::ArgumentCoder&lt;Region&gt;::encode):
+        (IPC::ArgumentCoder&lt;Region&gt;::decode):
+        * Shared/WebCoreArgumentCoders.h:
+
</ins><span class="cx"> 2014-02-05  Anders Carlsson  &lt;andersca@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Add -[WKNavigationAction request]
</span></span></pre></div>
<a id="trunkSourceWebKit2PlatformIPCArgumentCodersh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Platform/IPC/ArgumentCoders.h (163508 => 163509)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Platform/IPC/ArgumentCoders.h        2014-02-06 04:10:47 UTC (rev 163508)
+++ trunk/Source/WebKit2/Platform/IPC/ArgumentCoders.h        2014-02-06 04:31:46 UTC (rev 163509)
</span><span class="lines">@@ -92,23 +92,23 @@
</span><span class="cx">     }
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-template&lt;bool fixedSizeElements, typename T&gt; struct VectorArgumentCoder;
</del><ins>+template&lt;bool fixedSizeElements, typename T, size_t inlineCapacity&gt; struct VectorArgumentCoder;
</ins><span class="cx"> 
</span><del>-template&lt;typename T&gt; struct VectorArgumentCoder&lt;false, T&gt; {
-    static void encode(ArgumentEncoder&amp; encoder, const Vector&lt;T&gt;&amp; vector)
</del><ins>+template&lt;typename T, size_t inlineCapacity&gt; struct VectorArgumentCoder&lt;false, T, inlineCapacity&gt; {
+    static void encode(ArgumentEncoder&amp; encoder, const Vector&lt;T, inlineCapacity&gt;&amp; vector)
</ins><span class="cx">     {
</span><span class="cx">         encoder &lt;&lt; static_cast&lt;uint64_t&gt;(vector.size());
</span><span class="cx">         for (size_t i = 0; i &lt; vector.size(); ++i)
</span><span class="cx">             encoder &lt;&lt; vector[i];
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    static bool decode(ArgumentDecoder&amp; decoder, Vector&lt;T&gt;&amp; vector)
</del><ins>+    static bool decode(ArgumentDecoder&amp; decoder, Vector&lt;T, inlineCapacity&gt;&amp; vector)
</ins><span class="cx">     {
</span><span class="cx">         uint64_t size;
</span><span class="cx">         if (!decoder.decode(size))
</span><span class="cx">             return false;
</span><span class="cx"> 
</span><del>-        Vector&lt;T&gt; tmp;
</del><ins>+        Vector&lt;T, inlineCapacity&gt; tmp;
</ins><span class="cx">         for (size_t i = 0; i &lt; size; ++i) {
</span><span class="cx">             T element;
</span><span class="cx">             if (!decoder.decode(element))
</span><span class="lines">@@ -123,14 +123,14 @@
</span><span class="cx">     }
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-template&lt;typename T&gt; struct VectorArgumentCoder&lt;true, T&gt; {
-    static void encode(ArgumentEncoder&amp; encoder, const Vector&lt;T&gt;&amp; vector)
</del><ins>+template&lt;typename T, size_t inlineCapacity&gt; struct VectorArgumentCoder&lt;true, T, inlineCapacity&gt; {
+    static void encode(ArgumentEncoder&amp; encoder, const Vector&lt;T, inlineCapacity&gt;&amp; vector)
</ins><span class="cx">     {
</span><span class="cx">         encoder &lt;&lt; static_cast&lt;uint64_t&gt;(vector.size());
</span><span class="cx">         encoder.encodeFixedLengthData(reinterpret_cast&lt;const uint8_t*&gt;(vector.data()), vector.size() * sizeof(T), alignof(T));
</span><span class="cx">     }
</span><span class="cx">     
</span><del>-    static bool decode(ArgumentDecoder&amp; decoder, Vector&lt;T&gt;&amp; vector)
</del><ins>+    static bool decode(ArgumentDecoder&amp; decoder, Vector&lt;T, inlineCapacity&gt;&amp; vector)
</ins><span class="cx">     {
</span><span class="cx">         uint64_t size;
</span><span class="cx">         if (!decoder.decode(size))
</span><span class="lines">@@ -144,7 +144,7 @@
</span><span class="cx">             return false;
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        Vector&lt;T&gt; temp;
</del><ins>+        Vector&lt;T, inlineCapacity&gt; temp;
</ins><span class="cx">         temp.resize(size);
</span><span class="cx"> 
</span><span class="cx">         decoder.decodeFixedLengthData(reinterpret_cast&lt;uint8_t*&gt;(temp.data()), size * sizeof(T), alignof(T));
</span><span class="lines">@@ -154,7 +154,7 @@
</span><span class="cx">     }
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-template&lt;typename T&gt; struct ArgumentCoder&lt;Vector&lt;T&gt;&gt; : VectorArgumentCoder&lt;std::is_arithmetic&lt;T&gt;::value, T&gt; { };
</del><ins>+template&lt;typename T, size_t inlineCapacity&gt; struct ArgumentCoder&lt;Vector&lt;T, inlineCapacity&gt;&gt; : VectorArgumentCoder&lt;std::is_arithmetic&lt;T&gt;::value, T, inlineCapacity&gt; { };
</ins><span class="cx"> 
</span><span class="cx"> template&lt;typename KeyArg, typename MappedArg, typename HashArg, typename KeyTraitsArg, typename MappedTraitsArg&gt; struct ArgumentCoder&lt;HashMap&lt;KeyArg, MappedArg, HashArg, KeyTraitsArg, MappedTraitsArg&gt;&gt; {
</span><span class="cx">     typedef HashMap&lt;KeyArg, MappedArg, HashArg, KeyTraitsArg, MappedTraitsArg&gt; HashMapType;
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedWebCoreArgumentCoderscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp (163508 => 163509)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp        2014-02-06 04:10:47 UTC (rev 163508)
+++ trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp        2014-02-06 04:31:46 UTC (rev 163509)
</span><span class="lines">@@ -51,6 +51,7 @@
</span><span class="cx"> #include &lt;WebCore/Length.h&gt;
</span><span class="cx"> #include &lt;WebCore/PluginData.h&gt;
</span><span class="cx"> #include &lt;WebCore/ProtectionSpace.h&gt;
</span><ins>+#include &lt;WebCore/Region.h&gt;
</ins><span class="cx"> #include &lt;WebCore/ResourceError.h&gt;
</span><span class="cx"> #include &lt;WebCore/ResourceRequest.h&gt;
</span><span class="cx"> #include &lt;WebCore/ResourceResponse.h&gt;
</span><span class="lines">@@ -198,7 +199,56 @@
</span><span class="cx">     return SimpleArgumentCoder&lt;IntSize&gt;::decode(decoder, intSize);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+template&lt;&gt; struct ArgumentCoder&lt;WebCore::Region::Span&gt; {
+    static void encode(ArgumentEncoder&amp;, const WebCore::Region::Span&amp;);
+    static bool decode(ArgumentDecoder&amp;, WebCore::Region::Span&amp;);
+};
</ins><span class="cx"> 
</span><ins>+void ArgumentCoder&lt;Region::Span&gt;::encode(ArgumentEncoder&amp; encoder, const Region::Span&amp; span)
+{
+    encoder &lt;&lt; span.y;
+    encoder &lt;&lt; (uint64_t)span.segmentIndex;
+}
+
+bool ArgumentCoder&lt;Region::Span&gt;::decode(ArgumentDecoder&amp; decoder, Region::Span&amp; span)
+{
+    if (!decoder.decode(span.y))
+        return false;
+    
+    uint64_t segmentIndex;
+    if (!decoder.decode(segmentIndex))
+        return false;
+    
+    span.segmentIndex = segmentIndex;
+    return true;
+}
+
+void ArgumentCoder&lt;Region&gt;::encode(ArgumentEncoder&amp; encoder, const Region&amp; region)
+{
+    encoder.encode(region.shapeSegments());
+    encoder.encode(region.shapeSpans());
+}
+
+bool ArgumentCoder&lt;Region&gt;::decode(ArgumentDecoder&amp; decoder, Region&amp; region)
+{
+    Vector&lt;int&gt; segments;
+    if (!decoder.decode(segments))
+        return false;
+
+    Vector&lt;Region::Span&gt; spans;
+    if (!decoder.decode(spans))
+        return false;
+    
+    region.setShapeSegments(segments);
+    region.setShapeSpans(spans);
+    region.updateBoundsFromShape();
+    
+    if (!region.isValid())
+        return false;
+
+    return true;
+}
+
</ins><span class="cx"> void ArgumentCoder&lt;Length&gt;::encode(ArgumentEncoder&amp; encoder, const Length&amp; length)
</span><span class="cx"> {
</span><span class="cx">     SimpleArgumentCoder&lt;Length&gt;::encode(encoder, length);
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedWebCoreArgumentCodersh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.h (163508 => 163509)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.h        2014-02-06 04:10:47 UTC (rev 163508)
+++ trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.h        2014-02-06 04:31:46 UTC (rev 163509)
</span><span class="lines">@@ -51,6 +51,7 @@
</span><span class="cx"> class URL;
</span><span class="cx"> class Notification;
</span><span class="cx"> class ProtectionSpace;
</span><ins>+class Region;
</ins><span class="cx"> class ResourceError;
</span><span class="cx"> class ResourceRequest;
</span><span class="cx"> class ResourceResponse;
</span><span class="lines">@@ -162,6 +163,11 @@
</span><span class="cx">     static bool decode(ArgumentDecoder&amp;, WebCore::IntSize&amp;);
</span><span class="cx"> };
</span><span class="cx"> 
</span><ins>+template&lt;&gt; struct ArgumentCoder&lt;WebCore::Region&gt; {
+    static void encode(ArgumentEncoder&amp;, const WebCore::Region&amp;);
+    static bool decode(ArgumentDecoder&amp;, WebCore::Region&amp;);
+};
+
</ins><span class="cx"> template&lt;&gt; struct ArgumentCoder&lt;WebCore::Length&gt; {
</span><span class="cx">     static void encode(ArgumentEncoder&amp;, const WebCore::Length&amp;);
</span><span class="cx">     static bool decode(ArgumentDecoder&amp;, WebCore::Length&amp;);
</span></span></pre>
</div>
</div>

</body>
</html>