<!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>[182702] releases/WebKitGTK/webkit-2.8/Source/WebCore</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/182702">182702</a></dd>
<dt>Author</dt> <dd>carlosgc@webkit.org</dd>
<dt>Date</dt> <dd>2015-04-13 03:34:45 -0700 (Mon, 13 Apr 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>Merge <a href="http://trac.webkit.org/projects/webkit/changeset/182235">r182235</a> - Lots of time spent querying table cell borders, when there are none.
https://bugs.webkit.org/show_bug.cgi?id=143277

Reviewed by Simon Fraser.

This patch speeds up collapsed border queries by using existing collapsed border
cache to calculate repaint rects and by introducing a fast path for zero width collapsed borders.

It reduces the number of calls to recompute collapsed borders from 36 000 to 1 600, while loading a page with a table of 400 rows (1 cell per row).
When scrolling the same page all the way down to the bottom, the number of calls to recompute collapsed borders falls from 290 000 to 0.

Covered by existing tests.

* rendering/RenderTable.cpp:
(WebCore::RenderTable::styleDidChange): This moves invalidation time from RenderTable::layout() to styleDidChange().
(WebCore::RenderTable::invalidateCollapsedBorders):
(WebCore::RenderTable::recalcCollapsedBorders):
* rendering/RenderTable.h:
(WebCore::RenderTable::collapsedBordersAreValid):
(WebCore::RenderTable::invalidateCollapsedBorders): Deleted.
* rendering/RenderTableCell.cpp:
(WebCore::RenderTableCell::RenderTableCell):
(WebCore::RenderTableCell::willBeRemovedFromTree): Invalidate caches so that when repaint rect is calculated, we don't end up using stale values.
(WebCore::RenderTableCell::styleDidChange): Same as willBeRemovedFromTree.
(WebCore::RenderTableCell::collapsedStartBorder): Check if collapsed border is zero -also query cache.
(WebCore::RenderTableCell::collapsedEndBorder):
(WebCore::RenderTableCell::collapsedBeforeBorder):
(WebCore::RenderTableCell::collapsedAfterBorder):
(WebCore::RenderTableCell::cachedCollapsedLeftBorder):
(WebCore::RenderTableCell::cachedCollapsedRightBorder):
(WebCore::RenderTableCell::cachedCollapsedTopBorder):
(WebCore::RenderTableCell::cachedCollapsedBottomBorder):
(WebCore::RenderTableCell::paintCollapsedBorders):
(WebCore::RenderTableCell::cellAtLeft): Deleted.
(WebCore::RenderTableCell::cellAtRight): Deleted.
(WebCore::RenderTableCell::cellAtTop): Deleted.
(WebCore::RenderTableCell::cellAtBottom): Deleted.
* rendering/RenderTableCell.h:
(WebCore::RenderTableCell::invalidateHasEmptyCollapsedBorders):
* rendering/RenderTableCol.cpp:
(WebCore::RenderTableCol::styleDidChange):
* rendering/RenderTableRow.cpp:
(WebCore::RenderTableRow::styleDidChange):
(WebCore::RenderTableRow::addChild):
* rendering/RenderTableSection.cpp:
(WebCore::RenderTableSection::styleDidChange):
(WebCore::RenderTableSection::clearCachedCollapsedBorders): This is just an extra safety to invalidate collapsed border cache. This is always
called together with RenderTable::invalidateCollapsedBorders() -and that should prevent the RenderCells to use the cache.
(WebCore::RenderTableSection::removeCachedCollapsedBorders):
(WebCore::RenderTableSection::setCachedCollapsedBorder):
(WebCore::RenderTableSection::cachedCollapsedBorder):
* rendering/RenderTableSection.h:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#releasesWebKitGTKwebkit28SourceWebCoreChangeLog">releases/WebKitGTK/webkit-2.8/Source/WebCore/ChangeLog</a></li>
<li><a href="#releasesWebKitGTKwebkit28SourceWebCorerenderingRenderTablecpp">releases/WebKitGTK/webkit-2.8/Source/WebCore/rendering/RenderTable.cpp</a></li>
<li><a href="#releasesWebKitGTKwebkit28SourceWebCorerenderingRenderTableh">releases/WebKitGTK/webkit-2.8/Source/WebCore/rendering/RenderTable.h</a></li>
<li><a href="#releasesWebKitGTKwebkit28SourceWebCorerenderingRenderTableCellcpp">releases/WebKitGTK/webkit-2.8/Source/WebCore/rendering/RenderTableCell.cpp</a></li>
<li><a href="#releasesWebKitGTKwebkit28SourceWebCorerenderingRenderTableCellh">releases/WebKitGTK/webkit-2.8/Source/WebCore/rendering/RenderTableCell.h</a></li>
<li><a href="#releasesWebKitGTKwebkit28SourceWebCorerenderingRenderTableColcpp">releases/WebKitGTK/webkit-2.8/Source/WebCore/rendering/RenderTableCol.cpp</a></li>
<li><a href="#releasesWebKitGTKwebkit28SourceWebCorerenderingRenderTableRowcpp">releases/WebKitGTK/webkit-2.8/Source/WebCore/rendering/RenderTableRow.cpp</a></li>
<li><a href="#releasesWebKitGTKwebkit28SourceWebCorerenderingRenderTableSectioncpp">releases/WebKitGTK/webkit-2.8/Source/WebCore/rendering/RenderTableSection.cpp</a></li>
<li><a href="#releasesWebKitGTKwebkit28SourceWebCorerenderingRenderTableSectionh">releases/WebKitGTK/webkit-2.8/Source/WebCore/rendering/RenderTableSection.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="releasesWebKitGTKwebkit28SourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.8/Source/WebCore/ChangeLog (182701 => 182702)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.8/Source/WebCore/ChangeLog        2015-04-13 10:29:23 UTC (rev 182701)
+++ releases/WebKitGTK/webkit-2.8/Source/WebCore/ChangeLog        2015-04-13 10:34:45 UTC (rev 182702)
</span><span class="lines">@@ -1,3 +1,58 @@
</span><ins>+2015-04-01  Zalan Bujtas  &lt;zalan@apple.com&gt;
+
+        Lots of time spent querying table cell borders, when there are none.
+        https://bugs.webkit.org/show_bug.cgi?id=143277
+
+        Reviewed by Simon Fraser.
+
+        This patch speeds up collapsed border queries by using existing collapsed border
+        cache to calculate repaint rects and by introducing a fast path for zero width collapsed borders.
+
+        It reduces the number of calls to recompute collapsed borders from 36 000 to 1 600, while loading a page with a table of 400 rows (1 cell per row).
+        When scrolling the same page all the way down to the bottom, the number of calls to recompute collapsed borders falls from 290 000 to 0.
+
+        Covered by existing tests.
+
+        * rendering/RenderTable.cpp:
+        (WebCore::RenderTable::styleDidChange): This moves invalidation time from RenderTable::layout() to styleDidChange(). 
+        (WebCore::RenderTable::invalidateCollapsedBorders):
+        (WebCore::RenderTable::recalcCollapsedBorders):
+        * rendering/RenderTable.h:
+        (WebCore::RenderTable::collapsedBordersAreValid):
+        (WebCore::RenderTable::invalidateCollapsedBorders): Deleted.
+        * rendering/RenderTableCell.cpp:
+        (WebCore::RenderTableCell::RenderTableCell):
+        (WebCore::RenderTableCell::willBeRemovedFromTree): Invalidate caches so that when repaint rect is calculated, we don't end up using stale values.
+        (WebCore::RenderTableCell::styleDidChange): Same as willBeRemovedFromTree.
+        (WebCore::RenderTableCell::collapsedStartBorder): Check if collapsed border is zero -also query cache. 
+        (WebCore::RenderTableCell::collapsedEndBorder):
+        (WebCore::RenderTableCell::collapsedBeforeBorder):
+        (WebCore::RenderTableCell::collapsedAfterBorder):
+        (WebCore::RenderTableCell::cachedCollapsedLeftBorder):
+        (WebCore::RenderTableCell::cachedCollapsedRightBorder):
+        (WebCore::RenderTableCell::cachedCollapsedTopBorder):
+        (WebCore::RenderTableCell::cachedCollapsedBottomBorder):
+        (WebCore::RenderTableCell::paintCollapsedBorders):
+        (WebCore::RenderTableCell::cellAtLeft): Deleted.
+        (WebCore::RenderTableCell::cellAtRight): Deleted.
+        (WebCore::RenderTableCell::cellAtTop): Deleted.
+        (WebCore::RenderTableCell::cellAtBottom): Deleted.
+        * rendering/RenderTableCell.h:
+        (WebCore::RenderTableCell::invalidateHasEmptyCollapsedBorders):
+        * rendering/RenderTableCol.cpp:
+        (WebCore::RenderTableCol::styleDidChange):
+        * rendering/RenderTableRow.cpp:
+        (WebCore::RenderTableRow::styleDidChange):
+        (WebCore::RenderTableRow::addChild):
+        * rendering/RenderTableSection.cpp:
+        (WebCore::RenderTableSection::styleDidChange):
+        (WebCore::RenderTableSection::clearCachedCollapsedBorders): This is just an extra safety to invalidate collapsed border cache. This is always
+        called together with RenderTable::invalidateCollapsedBorders() -and that should prevent the RenderCells to use the cache.  
+        (WebCore::RenderTableSection::removeCachedCollapsedBorders):
+        (WebCore::RenderTableSection::setCachedCollapsedBorder):
+        (WebCore::RenderTableSection::cachedCollapsedBorder):
+        * rendering/RenderTableSection.h:
+
</ins><span class="cx"> 2015-02-17  Zalan Bujtas  &lt;zalan@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Minor RenderTable* class cleanups.
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit28SourceWebCorerenderingRenderTablecpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.8/Source/WebCore/rendering/RenderTable.cpp (182701 => 182702)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.8/Source/WebCore/rendering/RenderTable.cpp        2015-04-13 10:29:23 UTC (rev 182701)
+++ releases/WebKitGTK/webkit-2.8/Source/WebCore/rendering/RenderTable.cpp        2015-04-13 10:34:45 UTC (rev 182702)
</span><span class="lines">@@ -57,6 +57,7 @@
</span><span class="cx">     , m_firstBody(nullptr)
</span><span class="cx">     , m_currentBorder(nullptr)
</span><span class="cx">     , m_collapsedBordersValid(false)
</span><ins>+    , m_collapsedEmptyBorderIsPresent(false)
</ins><span class="cx">     , m_hasColElements(false)
</span><span class="cx">     , m_needsSectionRecalc(false)
</span><span class="cx">     , m_columnLogicalWidthChanged(false)
</span><span class="lines">@@ -80,6 +81,7 @@
</span><span class="cx">     , m_firstBody(nullptr)
</span><span class="cx">     , m_currentBorder(nullptr)
</span><span class="cx">     , m_collapsedBordersValid(false)
</span><ins>+    , m_collapsedEmptyBorderIsPresent(false)
</ins><span class="cx">     , m_hasColElements(false)
</span><span class="cx">     , m_needsSectionRecalc(false)
</span><span class="cx">     , m_columnLogicalWidthChanged(false)
</span><span class="lines">@@ -120,7 +122,7 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     // If border was changed, invalidate collapsed borders cache.
</span><del>-    if (!needsLayout() &amp;&amp; oldStyle &amp;&amp; oldStyle-&gt;border() != style().border())
</del><ins>+    if (oldStyle &amp;&amp; oldStyle-&gt;border() != style().border())
</ins><span class="cx">         invalidateCollapsedBorders();
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -586,14 +588,30 @@
</span><span class="cx">     clearNeedsLayout();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void RenderTable::invalidateCollapsedBorders()
+{
+    m_collapsedBordersValid = false;
+    m_collapsedBorders.clear();
+    for (auto&amp; section : childrenOfType&lt;RenderTableSection&gt;(*this)) {
+        section.clearCachedCollapsedBorders();
+        if (!m_collapsedEmptyBorderIsPresent)
+            continue;
+        for (auto* row = section.firstRow(); row; row = row-&gt;nextRow()) {
+            for (auto* cell = row-&gt;firstCell(); cell; cell = cell-&gt;nextCell()) {
+                ASSERT(cell-&gt;table() == this);
+                cell-&gt;invalidateHasEmptyCollapsedBorders();
+            }
+        }
+    }
+    m_collapsedEmptyBorderIsPresent = false;
+}
+
</ins><span class="cx"> // Collect all the unique border values that we want to paint in a sorted list.
</span><span class="cx"> void RenderTable::recalcCollapsedBorders()
</span><span class="cx"> {
</span><span class="cx">     if (m_collapsedBordersValid)
</span><span class="cx">         return;
</span><del>-    m_collapsedBordersValid = true;
</del><span class="cx">     m_collapsedBorders.clear();
</span><del>-
</del><span class="cx">     for (auto&amp; section : childrenOfType&lt;RenderTableSection&gt;(*this)) {
</span><span class="cx">         for (RenderTableRow* row = section.firstRow(); row; row = row-&gt;nextRow()) {
</span><span class="cx">             for (RenderTableCell* cell = row-&gt;firstCell(); cell; cell = cell-&gt;nextCell()) {
</span><span class="lines">@@ -603,9 +621,9 @@
</span><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx">     RenderTableCell::sortBorderValues(m_collapsedBorders);
</span><ins>+    m_collapsedBordersValid = true;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-
</del><span class="cx"> void RenderTable::addOverflowFromChildren()
</span><span class="cx"> {
</span><span class="cx">     // Add overflow from borders.
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit28SourceWebCorerenderingRenderTableh"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.8/Source/WebCore/rendering/RenderTable.h (182701 => 182702)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.8/Source/WebCore/rendering/RenderTable.h        2015-04-13 10:29:23 UTC (rev 182701)
+++ releases/WebKitGTK/webkit-2.8/Source/WebCore/rendering/RenderTable.h        2015-04-13 10:34:45 UTC (rev 182702)
</span><span class="lines">@@ -242,11 +242,9 @@
</span><span class="cx">     RenderTableCell* cellAfter(const RenderTableCell*) const;
</span><span class="cx">  
</span><span class="cx">     typedef Vector&lt;CollapsedBorderValue&gt; CollapsedBorderValues;
</span><del>-    void invalidateCollapsedBorders()
-    {
-        m_collapsedBordersValid = false;
-        m_collapsedBorders.clear();
-    }
</del><ins>+    bool collapsedBordersAreValid() const { return m_collapsedBordersValid; }
+    void invalidateCollapsedBorders();
+    void collapsedEmptyBorderIsPresent() { m_collapsedEmptyBorderIsPresent = true; }
</ins><span class="cx">     const CollapsedBorderValue* currentBorderValue() const { return m_currentBorder; }
</span><span class="cx">     
</span><span class="cx">     bool hasSections() const { return m_head || m_foot || m_firstBody; }
</span><span class="lines">@@ -348,6 +346,7 @@
</span><span class="cx">     CollapsedBorderValues m_collapsedBorders;
</span><span class="cx">     const CollapsedBorderValue* m_currentBorder;
</span><span class="cx">     bool m_collapsedBordersValid : 1;
</span><ins>+    bool m_collapsedEmptyBorderIsPresent : 1;
</ins><span class="cx"> 
</span><span class="cx">     mutable bool m_hasColElements : 1;
</span><span class="cx">     mutable bool m_needsSectionRecalc : 1;
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit28SourceWebCorerenderingRenderTableCellcpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.8/Source/WebCore/rendering/RenderTableCell.cpp (182701 => 182702)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.8/Source/WebCore/rendering/RenderTableCell.cpp        2015-04-13 10:29:23 UTC (rev 182701)
+++ releases/WebKitGTK/webkit-2.8/Source/WebCore/rendering/RenderTableCell.cpp        2015-04-13 10:34:45 UTC (rev 182702)
</span><span class="lines">@@ -60,6 +60,10 @@
</span><span class="cx">     , m_cellWidthChanged(false)
</span><span class="cx">     , m_hasColSpan(false)
</span><span class="cx">     , m_hasRowSpan(false)
</span><ins>+    , m_hasEmptyCollapsedBeforeBorder(false)
+    , m_hasEmptyCollapsedAfterBorder(false)
+    , m_hasEmptyCollapsedStartBorder(false)
+    , m_hasEmptyCollapsedEndBorder(false)
</ins><span class="cx"> {
</span><span class="cx">     // We only update the flags when notified of DOM changes in colSpanOrRowSpanChanged()
</span><span class="cx">     // so we need to set their initial values here in case something asks for colSpan()/rowSpan() before then.
</span><span class="lines">@@ -72,15 +76,21 @@
</span><span class="cx">     , m_cellWidthChanged(false)
</span><span class="cx">     , m_hasColSpan(false)
</span><span class="cx">     , m_hasRowSpan(false)
</span><ins>+    , m_hasEmptyCollapsedBeforeBorder(false)
+    , m_hasEmptyCollapsedAfterBorder(false)
+    , m_hasEmptyCollapsedStartBorder(false)
+    , m_hasEmptyCollapsedEndBorder(false)
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void RenderTableCell::willBeRemovedFromTree()
</span><span class="cx"> {
</span><span class="cx">     RenderBlockFlow::willBeRemovedFromTree();
</span><del>-
-    section()-&gt;setNeedsCellRecalc();
-    section()-&gt;removeCachedCollapsedBorders(this);
</del><ins>+    if (!table() || !section())
+        return;
+    RenderTableSection* section = this-&gt;section();
+    table()-&gt;invalidateCollapsedBorders();
+    section-&gt;setNeedsCellRecalc();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> unsigned RenderTableCell::parseColSpanFromDOM() const
</span><span class="lines">@@ -265,7 +275,7 @@
</span><span class="cx">         setNeedsLayout(MarkOnlyThis);
</span><span class="cx">         layoutBlock(cellWidthChanged());
</span><span class="cx">     }
</span><del>-
</del><ins>+    invalidateHasEmptyCollapsedBorders();
</ins><span class="cx">     setCellWidthChanged(false);
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -416,11 +426,9 @@
</span><span class="cx">         clearIntrinsicPadding();
</span><span class="cx"> 
</span><span class="cx">     // If border was changed, notify table.
</span><del>-    if (parent()) {
-        RenderTable* table = this-&gt;table();
-        if (table &amp;&amp; !table-&gt;selfNeedsLayout() &amp;&amp; !table-&gt;normalChildNeedsLayout()&amp;&amp; oldStyle &amp;&amp; oldStyle-&gt;border() != style().border())
-            table-&gt;invalidateCollapsedBorders();
-    }
</del><ins>+    RenderTable* table = this-&gt;table();
+    if (table &amp;&amp; oldStyle &amp;&amp; oldStyle-&gt;border() != style().border())
+        table-&gt;invalidateCollapsedBorders();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> // The following rules apply for resolving conflicts and figuring out which border
</span><span class="lines">@@ -507,11 +515,26 @@
</span><span class="cx">     return (isStartColumn &amp;&amp; !hasSameDirectionAsTable) || (isEndColumn &amp;&amp; hasSameDirectionAsTable);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+static CollapsedBorderValue emptyBorder()
+{
+    return CollapsedBorderValue(BorderValue(), Color(), BCELL);
+}
+
</ins><span class="cx"> CollapsedBorderValue RenderTableCell::collapsedStartBorder(IncludeBorderColorOrNot includeColor) const
</span><span class="cx"> {
</span><ins>+    if (!table() || !section())
+        return emptyBorder();
+
+    if (m_hasEmptyCollapsedStartBorder)
+        return emptyBorder();
+
+    if (table()-&gt;collapsedBordersAreValid())
+        return section()-&gt;cachedCollapsedBorder(*this, CBSStart);
+
</ins><span class="cx">     CollapsedBorderValue result = computeCollapsedStartBorder(includeColor);
</span><del>-    if (includeColor)
-        section()-&gt;setCachedCollapsedBorder(this, CBSStart, result);
</del><ins>+    setHasEmptyCollapsedBorder(CBSStart, !result.width());
+    if (includeColor &amp;&amp; !m_hasEmptyCollapsedStartBorder)
+        section()-&gt;setCachedCollapsedBorder(*this, CBSStart, result);
</ins><span class="cx">     return result;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -609,9 +632,19 @@
</span><span class="cx"> 
</span><span class="cx"> CollapsedBorderValue RenderTableCell::collapsedEndBorder(IncludeBorderColorOrNot includeColor) const
</span><span class="cx"> {
</span><ins>+    if (!table() || !section())
+        return emptyBorder();
+
+    if (m_hasEmptyCollapsedEndBorder)
+        return emptyBorder();
+
+    if (table()-&gt;collapsedBordersAreValid())
+        return section()-&gt;cachedCollapsedBorder(*this, CBSEnd);
+
</ins><span class="cx">     CollapsedBorderValue result = computeCollapsedEndBorder(includeColor);
</span><del>-    if (includeColor)
-        section()-&gt;setCachedCollapsedBorder(this, CBSEnd, result);
</del><ins>+    setHasEmptyCollapsedBorder(CBSEnd, !result.width());
+    if (includeColor &amp;&amp; !m_hasEmptyCollapsedEndBorder)
+        section()-&gt;setCachedCollapsedBorder(*this, CBSEnd, result);
</ins><span class="cx">     return result;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -711,9 +744,19 @@
</span><span class="cx"> 
</span><span class="cx"> CollapsedBorderValue RenderTableCell::collapsedBeforeBorder(IncludeBorderColorOrNot includeColor) const
</span><span class="cx"> {
</span><ins>+    if (!table() || !section())
+        return emptyBorder();
+
+    if (m_hasEmptyCollapsedBeforeBorder)
+        return emptyBorder();
+
+    if (table()-&gt;collapsedBordersAreValid())
+        return section()-&gt;cachedCollapsedBorder(*this, CBSBefore);
+
</ins><span class="cx">     CollapsedBorderValue result = computeCollapsedBeforeBorder(includeColor);
</span><del>-    if (includeColor)
-        section()-&gt;setCachedCollapsedBorder(this, CBSBefore, result);
</del><ins>+    setHasEmptyCollapsedBorder(CBSBefore, !result.width());
+    if (includeColor &amp;&amp; !m_hasEmptyCollapsedBeforeBorder)
+        section()-&gt;setCachedCollapsedBorder(*this, CBSBefore, result);
</ins><span class="cx">     return result;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -797,9 +840,19 @@
</span><span class="cx"> 
</span><span class="cx"> CollapsedBorderValue RenderTableCell::collapsedAfterBorder(IncludeBorderColorOrNot includeColor) const
</span><span class="cx"> {
</span><ins>+    if (!table() || !section())
+        return emptyBorder();
+
+    if (m_hasEmptyCollapsedAfterBorder)
+        return emptyBorder();
+
+    if (table()-&gt;collapsedBordersAreValid())
+        return section()-&gt;cachedCollapsedBorder(*this, CBSAfter);
+
</ins><span class="cx">     CollapsedBorderValue result = computeCollapsedAfterBorder(includeColor);
</span><del>-    if (includeColor)
-        section()-&gt;setCachedCollapsedBorder(this, CBSAfter, result);
</del><ins>+    setHasEmptyCollapsedBorder(CBSAfter, !result.width());
+    if (includeColor &amp;&amp; !m_hasEmptyCollapsedAfterBorder)
+        section()-&gt;setCachedCollapsedBorder(*this, CBSAfter, result);
</ins><span class="cx">     return result;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -872,62 +925,34 @@
</span><span class="cx">     return result;    
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-inline CollapsedBorderValue RenderTableCell::cachedCollapsedLeftBorder(const RenderStyle* styleForCellFlow) const
</del><ins>+inline CollapsedBorderValue RenderTableCell::cachedCollapsedLeftBorder(const RenderStyle&amp; styleForCellFlow) const
</ins><span class="cx"> {
</span><del>-    if (styleForCellFlow-&gt;isHorizontalWritingMode())
-        return styleForCellFlow-&gt;isLeftToRightDirection() ? section()-&gt;cachedCollapsedBorder(this, CBSStart) : section()-&gt;cachedCollapsedBorder(this, CBSEnd);
-    return styleForCellFlow-&gt;isFlippedBlocksWritingMode() ? section()-&gt;cachedCollapsedBorder(this, CBSAfter) : section()-&gt;cachedCollapsedBorder(this, CBSBefore);
</del><ins>+    if (styleForCellFlow.isHorizontalWritingMode())
+        return styleForCellFlow.isLeftToRightDirection() ? section()-&gt;cachedCollapsedBorder(*this, CBSStart) : section()-&gt;cachedCollapsedBorder(*this, CBSEnd);
+    return styleForCellFlow.isFlippedBlocksWritingMode() ? section()-&gt;cachedCollapsedBorder(*this, CBSAfter) : section()-&gt;cachedCollapsedBorder(*this, CBSBefore);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-inline CollapsedBorderValue RenderTableCell::cachedCollapsedRightBorder(const RenderStyle* styleForCellFlow) const
</del><ins>+inline CollapsedBorderValue RenderTableCell::cachedCollapsedRightBorder(const RenderStyle&amp; styleForCellFlow) const
</ins><span class="cx"> {
</span><del>-    if (styleForCellFlow-&gt;isHorizontalWritingMode())
-        return styleForCellFlow-&gt;isLeftToRightDirection() ? section()-&gt;cachedCollapsedBorder(this, CBSEnd) : section()-&gt;cachedCollapsedBorder(this, CBSStart);
-    return styleForCellFlow-&gt;isFlippedBlocksWritingMode() ? section()-&gt;cachedCollapsedBorder(this, CBSBefore) : section()-&gt;cachedCollapsedBorder(this, CBSAfter);
</del><ins>+    if (styleForCellFlow.isHorizontalWritingMode())
+        return styleForCellFlow.isLeftToRightDirection() ? section()-&gt;cachedCollapsedBorder(*this, CBSEnd) : section()-&gt;cachedCollapsedBorder(*this, CBSStart);
+    return styleForCellFlow.isFlippedBlocksWritingMode() ? section()-&gt;cachedCollapsedBorder(*this, CBSBefore) : section()-&gt;cachedCollapsedBorder(*this, CBSAfter);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-inline CollapsedBorderValue RenderTableCell::cachedCollapsedTopBorder(const RenderStyle* styleForCellFlow) const
</del><ins>+inline CollapsedBorderValue RenderTableCell::cachedCollapsedTopBorder(const RenderStyle&amp; styleForCellFlow) const
</ins><span class="cx"> {
</span><del>-    if (styleForCellFlow-&gt;isHorizontalWritingMode())
-        return styleForCellFlow-&gt;isFlippedBlocksWritingMode() ? section()-&gt;cachedCollapsedBorder(this, CBSAfter) : section()-&gt;cachedCollapsedBorder(this, CBSBefore);
-    return styleForCellFlow-&gt;isLeftToRightDirection() ? section()-&gt;cachedCollapsedBorder(this, CBSStart) : section()-&gt;cachedCollapsedBorder(this, CBSEnd);
</del><ins>+    if (styleForCellFlow.isHorizontalWritingMode())
+        return styleForCellFlow.isFlippedBlocksWritingMode() ? section()-&gt;cachedCollapsedBorder(*this, CBSAfter) : section()-&gt;cachedCollapsedBorder(*this, CBSBefore);
+    return styleForCellFlow.isLeftToRightDirection() ? section()-&gt;cachedCollapsedBorder(*this, CBSStart) : section()-&gt;cachedCollapsedBorder(*this, CBSEnd);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-inline CollapsedBorderValue RenderTableCell::cachedCollapsedBottomBorder(const RenderStyle* styleForCellFlow) const
</del><ins>+inline CollapsedBorderValue RenderTableCell::cachedCollapsedBottomBorder(const RenderStyle&amp; styleForCellFlow) const
</ins><span class="cx"> {
</span><del>-    if (styleForCellFlow-&gt;isHorizontalWritingMode())
-        return styleForCellFlow-&gt;isFlippedBlocksWritingMode() ? section()-&gt;cachedCollapsedBorder(this, CBSBefore) : section()-&gt;cachedCollapsedBorder(this, CBSAfter);
-    return styleForCellFlow-&gt;isLeftToRightDirection() ? section()-&gt;cachedCollapsedBorder(this, CBSEnd) : section()-&gt;cachedCollapsedBorder(this, CBSStart);
</del><ins>+    if (styleForCellFlow.isHorizontalWritingMode())
+        return styleForCellFlow.isFlippedBlocksWritingMode() ? section()-&gt;cachedCollapsedBorder(*this, CBSBefore) : section()-&gt;cachedCollapsedBorder(*this, CBSAfter);
+    return styleForCellFlow.isLeftToRightDirection() ? section()-&gt;cachedCollapsedBorder(*this, CBSEnd) : section()-&gt;cachedCollapsedBorder(*this, CBSStart);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-inline RenderTableCell* RenderTableCell::cellAtLeft(const RenderStyle* styleForCellFlow) const
-{
-    if (styleForCellFlow-&gt;isHorizontalWritingMode())
-        return styleForCellFlow-&gt;isLeftToRightDirection() ? table()-&gt;cellBefore(this) : table()-&gt;cellAfter(this);
-    return styleForCellFlow-&gt;isFlippedBlocksWritingMode() ? table()-&gt;cellBelow(this) : table()-&gt;cellAbove(this);
-}
-
-inline RenderTableCell* RenderTableCell::cellAtRight(const RenderStyle* styleForCellFlow) const
-{
-    if (styleForCellFlow-&gt;isHorizontalWritingMode())
-        return styleForCellFlow-&gt;isLeftToRightDirection() ? table()-&gt;cellAfter(this) : table()-&gt;cellBefore(this);
-    return styleForCellFlow-&gt;isFlippedBlocksWritingMode() ? table()-&gt;cellAbove(this) : table()-&gt;cellBelow(this);
-}
-
-inline RenderTableCell* RenderTableCell::cellAtTop(const RenderStyle* styleForCellFlow) const
-{
-    if (styleForCellFlow-&gt;isHorizontalWritingMode())
-        return styleForCellFlow-&gt;isFlippedBlocksWritingMode() ? table()-&gt;cellBelow(this) : table()-&gt;cellAbove(this);
-    return styleForCellFlow-&gt;isLeftToRightDirection() ? table()-&gt;cellBefore(this) : table()-&gt;cellAfter(this);
-}
-
-inline RenderTableCell* RenderTableCell::cellAtBottom(const RenderStyle* styleForCellFlow) const
-{
-    if (styleForCellFlow-&gt;isHorizontalWritingMode())
-        return styleForCellFlow-&gt;isFlippedBlocksWritingMode() ? table()-&gt;cellAbove(this) : table()-&gt;cellBelow(this);
-    return styleForCellFlow-&gt;isLeftToRightDirection() ? table()-&gt;cellAfter(this) : table()-&gt;cellBefore(this);
-}
-
</del><span class="cx"> LayoutUnit RenderTableCell::borderLeft() const
</span><span class="cx"> {
</span><span class="cx">     RenderTable* table = this-&gt;table();
</span><span class="lines">@@ -1180,10 +1205,10 @@
</span><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     const RenderStyle&amp; styleForCellFlow = this-&gt;styleForCellFlow();
</span><del>-    CollapsedBorderValue leftVal = cachedCollapsedLeftBorder(&amp;styleForCellFlow);
-    CollapsedBorderValue rightVal = cachedCollapsedRightBorder(&amp;styleForCellFlow);
-    CollapsedBorderValue topVal = cachedCollapsedTopBorder(&amp;styleForCellFlow);
-    CollapsedBorderValue bottomVal = cachedCollapsedBottomBorder(&amp;styleForCellFlow);
</del><ins>+    CollapsedBorderValue leftVal = cachedCollapsedLeftBorder(styleForCellFlow);
+    CollapsedBorderValue rightVal = cachedCollapsedRightBorder(styleForCellFlow);
+    CollapsedBorderValue topVal = cachedCollapsedTopBorder(styleForCellFlow);
+    CollapsedBorderValue bottomVal = cachedCollapsedBottomBorder(styleForCellFlow);
</ins><span class="cx">      
</span><span class="cx">     // Adjust our x/y/width/height so that we paint the collapsed borders at the correct location.
</span><span class="cx">     int topWidth = topVal.width();
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit28SourceWebCorerenderingRenderTableCellh"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.8/Source/WebCore/rendering/RenderTableCell.h (182701 => 182702)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.8/Source/WebCore/rendering/RenderTableCell.h        2015-04-13 10:29:23 UTC (rev 182701)
+++ releases/WebKitGTK/webkit-2.8/Source/WebCore/rendering/RenderTableCell.h        2015-04-13 10:34:45 UTC (rev 182702)
</span><span class="lines">@@ -31,8 +31,9 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-static const unsigned unsetColumnIndex = 0x1FFFFFFF;
-static const unsigned maxColumnIndex = 0x1FFFFFFE; // 536,870,910
</del><ins>+// These is limited by the size of RenderTableCell::m_column bitfield.
+static const unsigned unsetColumnIndex = 0x1FFFFFF;
+static const unsigned maxColumnIndex = 0x1FFFFFE; // 33554430
</ins><span class="cx"> 
</span><span class="cx"> enum IncludeBorderColorOrNot { DoNotIncludeBorderColor, IncludeBorderColor };
</span><span class="cx"> 
</span><span class="lines">@@ -130,6 +131,9 @@
</span><span class="cx">     
</span><span class="cx">     virtual LayoutRect clippedOverflowRectForRepaint(const RenderLayerModelObject* repaintContainer) const override;
</span><span class="cx"> 
</span><ins>+    void invalidateHasEmptyCollapsedBorders();
+    void setHasEmptyCollapsedBorder(CollapsedBorderSide, bool empty) const;
+
</ins><span class="cx"> protected:
</span><span class="cx">     virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle) override;
</span><span class="cx">     virtual void computePreferredLogicalWidths() override;
</span><span class="lines">@@ -173,21 +177,16 @@
</span><span class="cx">     CollapsedBorderValue collapsedBeforeBorder(IncludeBorderColorOrNot = IncludeBorderColor) const;
</span><span class="cx">     CollapsedBorderValue collapsedAfterBorder(IncludeBorderColorOrNot = IncludeBorderColor) const;
</span><span class="cx"> 
</span><del>-    CollapsedBorderValue cachedCollapsedLeftBorder(const RenderStyle*) const;
-    CollapsedBorderValue cachedCollapsedRightBorder(const RenderStyle*) const;
-    CollapsedBorderValue cachedCollapsedTopBorder(const RenderStyle*) const;
-    CollapsedBorderValue cachedCollapsedBottomBorder(const RenderStyle*) const;
</del><ins>+    CollapsedBorderValue cachedCollapsedLeftBorder(const RenderStyle&amp;) const;
+    CollapsedBorderValue cachedCollapsedRightBorder(const RenderStyle&amp;) const;
+    CollapsedBorderValue cachedCollapsedTopBorder(const RenderStyle&amp;) const;
+    CollapsedBorderValue cachedCollapsedBottomBorder(const RenderStyle&amp;) const;
</ins><span class="cx"> 
</span><span class="cx">     CollapsedBorderValue computeCollapsedStartBorder(IncludeBorderColorOrNot = IncludeBorderColor) const;
</span><span class="cx">     CollapsedBorderValue computeCollapsedEndBorder(IncludeBorderColorOrNot = IncludeBorderColor) const;
</span><span class="cx">     CollapsedBorderValue computeCollapsedBeforeBorder(IncludeBorderColorOrNot = IncludeBorderColor) const;
</span><span class="cx">     CollapsedBorderValue computeCollapsedAfterBorder(IncludeBorderColorOrNot = IncludeBorderColor) const;
</span><span class="cx"> 
</span><del>-    RenderTableCell* cellAtLeft(const RenderStyle*) const;
-    RenderTableCell* cellAtRight(const RenderStyle*) const;
-    RenderTableCell* cellAtTop(const RenderStyle*) const;
-    RenderTableCell* cellAtBottom(const RenderStyle*) const;
-
</del><span class="cx">     Length logicalWidthFromColumns(RenderTableCol* firstColForThisCell, Length widthFromStyle) const;
</span><span class="cx"> 
</span><span class="cx">     void updateColAndRowSpanFlags();
</span><span class="lines">@@ -199,10 +198,14 @@
</span><span class="cx">     void previousSibling() const = delete;
</span><span class="cx"> 
</span><span class="cx">     // Note MSVC will only pack members if they have identical types, hence we use unsigned instead of bool here.
</span><del>-    unsigned m_column : 29;
</del><ins>+    unsigned m_column : 25;
</ins><span class="cx">     unsigned m_cellWidthChanged : 1;
</span><span class="cx">     unsigned m_hasColSpan: 1;
</span><span class="cx">     unsigned m_hasRowSpan: 1;
</span><ins>+    mutable unsigned m_hasEmptyCollapsedBeforeBorder: 1;
+    mutable unsigned m_hasEmptyCollapsedAfterBorder: 1;
+    mutable unsigned m_hasEmptyCollapsedStartBorder: 1;
+    mutable unsigned m_hasEmptyCollapsedEndBorder: 1;
</ins><span class="cx">     int m_intrinsicPaddingBefore { 0 };
</span><span class="cx">     int m_intrinsicPaddingAfter { 0 };
</span><span class="cx"> };
</span><span class="lines">@@ -337,6 +340,38 @@
</span><span class="cx">     return downcast&lt;RenderTableCell&gt;(RenderBox::lastChild());
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+inline void RenderTableCell::setHasEmptyCollapsedBorder(CollapsedBorderSide side, bool empty) const
+{
+    switch (side) {
+    case CBSAfter: {
+        m_hasEmptyCollapsedAfterBorder = empty;
+        break;
+    }
+    case CBSBefore: {
+        m_hasEmptyCollapsedBeforeBorder = empty;
+        break;
+    }
+    case CBSStart: {
+        m_hasEmptyCollapsedStartBorder = empty;
+        break;
+    }
+    case CBSEnd: {
+        m_hasEmptyCollapsedEndBorder = empty;
+        break;
+    }
+    }
+    if (empty)
+        table()-&gt;collapsedEmptyBorderIsPresent();
+}
+
+inline void RenderTableCell::invalidateHasEmptyCollapsedBorders()
+{
+    m_hasEmptyCollapsedBeforeBorder = false;
+    m_hasEmptyCollapsedAfterBorder = false;
+    m_hasEmptyCollapsedStartBorder = false;
+    m_hasEmptyCollapsedEndBorder = false;
+}
+
</ins><span class="cx"> } // namespace WebCore
</span><span class="cx"> 
</span><span class="cx"> SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderTableCell, isTableCell())
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit28SourceWebCorerenderingRenderTableColcpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.8/Source/WebCore/rendering/RenderTableCol.cpp (182701 => 182702)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.8/Source/WebCore/rendering/RenderTableCol.cpp        2015-04-13 10:29:23 UTC (rev 182701)
+++ releases/WebKitGTK/webkit-2.8/Source/WebCore/rendering/RenderTableCol.cpp        2015-04-13 10:34:45 UTC (rev 182702)
</span><span class="lines">@@ -48,24 +48,23 @@
</span><span class="cx"> void RenderTableCol::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle)
</span><span class="cx"> {
</span><span class="cx">     RenderBox::styleDidChange(diff, oldStyle);
</span><del>-
</del><ins>+    RenderTable* table = this-&gt;table();
+    if (!table)
+        return;
</ins><span class="cx">     // If border was changed, notify table.
</span><del>-    if (parent()) {
-        RenderTable* table = this-&gt;table();
-        if (table &amp;&amp; !table-&gt;selfNeedsLayout() &amp;&amp; !table-&gt;normalChildNeedsLayout() &amp;&amp; oldStyle &amp;&amp; oldStyle-&gt;border() != style().border())
-            table-&gt;invalidateCollapsedBorders();
-        else if (oldStyle-&gt;width() != style().width()) {
-            table-&gt;recalcSectionsIfNeeded();
-            for (auto&amp; section : childrenOfType&lt;RenderTableSection&gt;(*table)) {
-                unsigned nEffCols = table-&gt;numEffCols();
-                for (unsigned j = 0; j &lt; nEffCols; j++) {
-                    unsigned rowCount = section.numRows();
-                    for (unsigned i = 0; i &lt; rowCount; i++) {
-                        RenderTableCell* cell = section.primaryCellAt(i, j);
-                        if (!cell)
-                            continue;
-                        cell-&gt;setPreferredLogicalWidthsDirty(true);
-                    }
</del><ins>+    if (oldStyle &amp;&amp; oldStyle-&gt;border() != style().border())
+        table-&gt;invalidateCollapsedBorders();
+    else if (oldStyle-&gt;width() != style().width()) {
+        table-&gt;recalcSectionsIfNeeded();
+        for (auto&amp; section : childrenOfType&lt;RenderTableSection&gt;(*table)) {
+            unsigned nEffCols = table-&gt;numEffCols();
+            for (unsigned j = 0; j &lt; nEffCols; j++) {
+                unsigned rowCount = section.numRows();
+                for (unsigned i = 0; i &lt; rowCount; i++) {
+                    RenderTableCell* cell = section.primaryCellAt(i, j);
+                    if (!cell)
+                        continue;
+                    cell-&gt;setPreferredLogicalWidthsDirty(true);
</ins><span class="cx">                 }
</span><span class="cx">             }
</span><span class="cx">         }
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit28SourceWebCorerenderingRenderTableRowcpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.8/Source/WebCore/rendering/RenderTableRow.cpp (182701 => 182702)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.8/Source/WebCore/rendering/RenderTableRow.cpp        2015-04-13 10:29:23 UTC (rev 182701)
+++ releases/WebKitGTK/webkit-2.8/Source/WebCore/rendering/RenderTableRow.cpp        2015-04-13 10:34:45 UTC (rev 182702)
</span><span class="lines">@@ -79,9 +79,9 @@
</span><span class="cx"> 
</span><span class="cx">     // If border was changed, notify table.
</span><span class="cx">     if (RenderTable* table = this-&gt;table()) {
</span><del>-        if (!table-&gt;selfNeedsLayout() &amp;&amp; !table-&gt;normalChildNeedsLayout() &amp;&amp; oldStyle &amp;&amp; oldStyle-&gt;border() != style().border())
</del><ins>+        if (oldStyle &amp;&amp; oldStyle-&gt;border() != style().border())
</ins><span class="cx">             table-&gt;invalidateCollapsedBorders();
</span><del>-        
</del><ins>+
</ins><span class="cx">         if (oldStyle &amp;&amp; diff == StyleDifferenceLayout &amp;&amp; needsLayout() &amp;&amp; table-&gt;collapseBorders() &amp;&amp; borderWidthChanged(oldStyle, &amp;style())) {
</span><span class="cx">             // If the border width changes on a row, we need to make sure the cells in the row know to lay out again.
</span><span class="cx">             // This only happens when borders are collapsed, since they end up affecting the border sides of the cell
</span><span class="lines">@@ -154,6 +154,8 @@
</span><span class="cx"> 
</span><span class="cx">     if (beforeChild || nextRow())
</span><span class="cx">         section()-&gt;setNeedsCellRecalc();
</span><ins>+    if (RenderTable* table = this-&gt;table())
+        table-&gt;invalidateCollapsedBorders();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void RenderTableRow::layout()
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit28SourceWebCorerenderingRenderTableSectioncpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.8/Source/WebCore/rendering/RenderTableSection.cpp (182701 => 182702)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.8/Source/WebCore/rendering/RenderTableSection.cpp        2015-04-13 10:29:23 UTC (rev 182701)
+++ releases/WebKitGTK/webkit-2.8/Source/WebCore/rendering/RenderTableSection.cpp        2015-04-13 10:34:45 UTC (rev 182702)
</span><span class="lines">@@ -105,7 +105,7 @@
</span><span class="cx"> 
</span><span class="cx">     // If border was changed, notify table.
</span><span class="cx">     RenderTable* table = this-&gt;table();
</span><del>-    if (table &amp;&amp; !table-&gt;selfNeedsLayout() &amp;&amp; !table-&gt;normalChildNeedsLayout() &amp;&amp; oldStyle &amp;&amp; oldStyle-&gt;border() != style().border())
</del><ins>+    if (table &amp;&amp; oldStyle &amp;&amp; oldStyle-&gt;border() != style().border())
</ins><span class="cx">         table-&gt;invalidateCollapsedBorders();
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -1546,26 +1546,36 @@
</span><span class="cx">     return false;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void RenderTableSection::removeCachedCollapsedBorders(const RenderTableCell* cell)
</del><ins>+void RenderTableSection::clearCachedCollapsedBorders()
</ins><span class="cx"> {
</span><span class="cx">     if (!table()-&gt;collapseBorders())
</span><span class="cx">         return;
</span><ins>+    m_cellsCollapsedBorders.clear();
+}
+
+void RenderTableSection::removeCachedCollapsedBorders(const RenderTableCell&amp; cell)
+{
+    if (!table()-&gt;collapseBorders())
+        return;
</ins><span class="cx">     
</span><span class="cx">     for (int side = CBSBefore; side &lt;= CBSEnd; ++side)
</span><del>-        m_cellsCollapsedBorders.remove(std::make_pair(cell, side));
</del><ins>+        m_cellsCollapsedBorders.remove(std::make_pair(&amp;cell, side));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void RenderTableSection::setCachedCollapsedBorder(const RenderTableCell* cell, CollapsedBorderSide side, CollapsedBorderValue border)
</del><ins>+void RenderTableSection::setCachedCollapsedBorder(const RenderTableCell&amp; cell, CollapsedBorderSide side, CollapsedBorderValue border)
</ins><span class="cx"> {
</span><span class="cx">     ASSERT(table()-&gt;collapseBorders());
</span><del>-    m_cellsCollapsedBorders.set(std::make_pair(cell, side), border);
</del><ins>+    ASSERT(border.width());
+    m_cellsCollapsedBorders.set(std::make_pair(&amp;cell, side), border);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-CollapsedBorderValue&amp; RenderTableSection::cachedCollapsedBorder(const RenderTableCell* cell, CollapsedBorderSide side)
</del><ins>+CollapsedBorderValue RenderTableSection::cachedCollapsedBorder(const RenderTableCell&amp; cell, CollapsedBorderSide side)
</ins><span class="cx"> {
</span><del>-    ASSERT(table()-&gt;collapseBorders());
-    HashMap&lt;std::pair&lt;const RenderTableCell*, int&gt;, CollapsedBorderValue&gt;::iterator it = m_cellsCollapsedBorders.find(std::make_pair(cell, side));
-    ASSERT(it != m_cellsCollapsedBorders.end());
</del><ins>+    ASSERT(table()-&gt;collapseBorders() &amp;&amp; table()-&gt;collapsedBordersAreValid());
+    auto it = m_cellsCollapsedBorders.find(std::make_pair(&amp;cell, side));
+    // Only non-empty collapsed borders are in the hashmap.
+    if (it == m_cellsCollapsedBorders.end())
+        return CollapsedBorderValue(BorderValue(), Color(), BCELL);
</ins><span class="cx">     return it-&gt;value;
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit28SourceWebCorerenderingRenderTableSectionh"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.8/Source/WebCore/rendering/RenderTableSection.h (182701 => 182702)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.8/Source/WebCore/rendering/RenderTableSection.h        2015-04-13 10:29:23 UTC (rev 182701)
+++ releases/WebKitGTK/webkit-2.8/Source/WebCore/rendering/RenderTableSection.h        2015-04-13 10:34:45 UTC (rev 182702)
</span><span class="lines">@@ -134,9 +134,10 @@
</span><span class="cx">     LayoutUnit rowBaseline(unsigned row);
</span><span class="cx">     void rowLogicalHeightChanged(unsigned rowIndex);
</span><span class="cx"> 
</span><del>-    void removeCachedCollapsedBorders(const RenderTableCell*);
-    void setCachedCollapsedBorder(const RenderTableCell*, CollapsedBorderSide, CollapsedBorderValue);
-    CollapsedBorderValue&amp; cachedCollapsedBorder(const RenderTableCell*, CollapsedBorderSide);
</del><ins>+    void clearCachedCollapsedBorders();
+    void removeCachedCollapsedBorders(const RenderTableCell&amp;);
+    void setCachedCollapsedBorder(const RenderTableCell&amp;, CollapsedBorderSide, CollapsedBorderValue);
+    CollapsedBorderValue cachedCollapsedBorder(const RenderTableCell&amp;, CollapsedBorderSide);
</ins><span class="cx"> 
</span><span class="cx">     // distributeExtraLogicalHeightToRows methods return the *consumed* extra logical height.
</span><span class="cx">     // FIXME: We may want to introduce a structure holding the in-flux layout information.
</span></span></pre>
</div>
</div>

</body>
</html>