Title: [203705] trunk/Source/WebCore
Revision
203705
Author
za...@apple.com
Date
2016-07-25 19:15:56 -0700 (Mon, 25 Jul 2016)

Log Message

RenderBox::haveSameDirection is used only by table items.
https://bugs.webkit.org/show_bug.cgi?id=160141

Reviewed by Simon Fraser.

Remove RenderBox::haveSameDirection() since it's used only by RenderTable*
classes. The new stand alone function (with 2 arguments) now checks if both of
the objects are valid.

No change in functionality.

* rendering/RenderBox.h:
(WebCore::RenderBox::hasSameDirectionAs): Deleted.
* rendering/RenderTable.cpp:
(WebCore::RenderTable::tableStartBorderAdjoiningCell):
(WebCore::RenderTable::tableEndBorderAdjoiningCell):
* rendering/RenderTable.h:
(WebCore::haveSameDirection):
* rendering/RenderTableCell.cpp:
(WebCore::RenderTableCell::hasStartBorderAdjoiningTable):
(WebCore::RenderTableCell::hasEndBorderAdjoiningTable):
* rendering/RenderTableCell.h:
(WebCore::RenderTableCell::borderAdjoiningTableStart):
(WebCore::RenderTableCell::borderAdjoiningTableEnd):
* rendering/RenderTableRow.h:
(WebCore::RenderTableRow::borderAdjoiningTableStart):
(WebCore::RenderTableRow::borderAdjoiningTableEnd):
* rendering/RenderTableSection.cpp:
(WebCore::RenderTableSection::borderAdjoiningStartCell):
(WebCore::RenderTableSection::borderAdjoiningEndCell):
(WebCore::RenderTableSection::firstRowCellAdjoiningTableStart):
(WebCore::RenderTableSection::firstRowCellAdjoiningTableEnd):
* rendering/RenderTableSection.h:
(WebCore::RenderTableSection::borderAdjoiningTableStart):
(WebCore::RenderTableSection::borderAdjoiningTableEnd):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (203704 => 203705)


--- trunk/Source/WebCore/ChangeLog	2016-07-26 01:05:43 UTC (rev 203704)
+++ trunk/Source/WebCore/ChangeLog	2016-07-26 02:15:56 UTC (rev 203705)
@@ -1,3 +1,41 @@
+2016-07-25  Zalan Bujtas  <za...@apple.com>
+
+        RenderBox::haveSameDirection is used only by table items.
+        https://bugs.webkit.org/show_bug.cgi?id=160141
+
+        Reviewed by Simon Fraser.
+
+        Remove RenderBox::haveSameDirection() since it's used only by RenderTable*
+        classes. The new stand alone function (with 2 arguments) now checks if both of
+        the objects are valid. 
+
+        No change in functionality.
+
+        * rendering/RenderBox.h:
+        (WebCore::RenderBox::hasSameDirectionAs): Deleted.
+        * rendering/RenderTable.cpp:
+        (WebCore::RenderTable::tableStartBorderAdjoiningCell):
+        (WebCore::RenderTable::tableEndBorderAdjoiningCell):
+        * rendering/RenderTable.h:
+        (WebCore::haveSameDirection):
+        * rendering/RenderTableCell.cpp:
+        (WebCore::RenderTableCell::hasStartBorderAdjoiningTable):
+        (WebCore::RenderTableCell::hasEndBorderAdjoiningTable):
+        * rendering/RenderTableCell.h:
+        (WebCore::RenderTableCell::borderAdjoiningTableStart):
+        (WebCore::RenderTableCell::borderAdjoiningTableEnd):
+        * rendering/RenderTableRow.h:
+        (WebCore::RenderTableRow::borderAdjoiningTableStart):
+        (WebCore::RenderTableRow::borderAdjoiningTableEnd):
+        * rendering/RenderTableSection.cpp:
+        (WebCore::RenderTableSection::borderAdjoiningStartCell):
+        (WebCore::RenderTableSection::borderAdjoiningEndCell):
+        (WebCore::RenderTableSection::firstRowCellAdjoiningTableStart):
+        (WebCore::RenderTableSection::firstRowCellAdjoiningTableEnd):
+        * rendering/RenderTableSection.h:
+        (WebCore::RenderTableSection::borderAdjoiningTableStart):
+        (WebCore::RenderTableSection::borderAdjoiningTableEnd):
+
 2016-07-25  Chris Dumez  <cdu...@apple.com>
 
         ClientRect properties should be on the prototype

Modified: trunk/Source/WebCore/rendering/RenderBox.h (203704 => 203705)


--- trunk/Source/WebCore/rendering/RenderBox.h	2016-07-26 01:05:43 UTC (rev 203704)
+++ trunk/Source/WebCore/rendering/RenderBox.h	2016-07-26 02:15:56 UTC (rev 203705)
@@ -604,8 +604,6 @@
         return nullptr;
     }
 
-    bool hasSameDirectionAs(const RenderBox* object) const { return style().direction() == object->style().direction(); }
-
 #if ENABLE(CSS_SHAPES)
     ShapeOutsideInfo* shapeOutsideInfo() const
     {

Modified: trunk/Source/WebCore/rendering/RenderTable.cpp (203704 => 203705)


--- trunk/Source/WebCore/rendering/RenderTable.cpp	2016-07-26 01:05:43 UTC (rev 203704)
+++ trunk/Source/WebCore/rendering/RenderTable.cpp	2016-07-26 02:15:56 UTC (rev 203705)
@@ -1565,7 +1565,7 @@
 const BorderValue& RenderTable::tableStartBorderAdjoiningCell(const RenderTableCell& cell) const
 {
     ASSERT(cell.isFirstOrLastCellInRow());
-    if (hasSameDirectionAs(cell.row()))
+    if (isDirectionSame(this, cell.row()))
         return style().borderStart();
 
     return style().borderEnd();
@@ -1574,7 +1574,7 @@
 const BorderValue& RenderTable::tableEndBorderAdjoiningCell(const RenderTableCell& cell) const
 {
     ASSERT(cell.isFirstOrLastCellInRow());
-    if (hasSameDirectionAs(cell.row()))
+    if (isDirectionSame(this, cell.row()))
         return style().borderEnd();
 
     return style().borderStart();

Modified: trunk/Source/WebCore/rendering/RenderTable.h (203704 => 203705)


--- trunk/Source/WebCore/rendering/RenderTable.h	2016-07-26 01:05:43 UTC (rev 203704)
+++ trunk/Source/WebCore/rendering/RenderTable.h	2016-07-26 02:15:56 UTC (rev 203705)
@@ -378,6 +378,8 @@
     return m_foot;
 }
 
+inline bool isDirectionSame(const RenderBox* tableItem, const RenderBox* otherTableItem) { return tableItem && otherTableItem ? tableItem->style().direction() == otherTableItem->style().direction() : true; }
+
 } // namespace WebCore
 
 SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderTable, isTable())

Modified: trunk/Source/WebCore/rendering/RenderTableCell.cpp (203704 => 203705)


--- trunk/Source/WebCore/rendering/RenderTableCell.cpp	2016-07-26 01:05:43 UTC (rev 203704)
+++ trunk/Source/WebCore/rendering/RenderTableCell.cpp	2016-07-26 02:15:56 UTC (rev 203705)
@@ -506,7 +506,7 @@
 {
     bool isStartColumn = !col();
     bool isEndColumn = table()->colToEffCol(col() + colSpan() - 1) == table()->numEffCols() - 1;
-    bool hasSameDirectionAsTable = hasSameDirectionAs(section());
+    bool hasSameDirectionAsTable = isDirectionSame(this, section());
 
     // The table direction determines the row direction. In mixed directionality, we cannot guarantee that
     // we have a common border with the table (think a ltr table with rtl start cell).
@@ -517,7 +517,7 @@
 {
     bool isStartColumn = !col();
     bool isEndColumn = table()->colToEffCol(col() + colSpan() - 1) == table()->numEffCols() - 1;
-    bool hasSameDirectionAsTable = hasSameDirectionAs(section());
+    bool hasSameDirectionAsTable = isDirectionSame(this, section());
 
     // The table direction determines the row direction. In mixed directionality, we cannot guarantee that
     // we have a common border with the table (think a ltr table with ltr end cell).

Modified: trunk/Source/WebCore/rendering/RenderTableCell.h (203704 => 203705)


--- trunk/Source/WebCore/rendering/RenderTableCell.h	2016-07-26 01:05:43 UTC (rev 203704)
+++ trunk/Source/WebCore/rendering/RenderTableCell.h	2016-07-26 02:15:56 UTC (rev 203705)
@@ -301,7 +301,7 @@
 inline const BorderValue& RenderTableCell::borderAdjoiningTableStart() const
 {
     ASSERT(isFirstOrLastCellInRow());
-    if (section()->hasSameDirectionAs(table()))
+    if (isDirectionSame(section(), table()))
         return style().borderStart();
 
     return style().borderEnd();
@@ -310,7 +310,7 @@
 inline const BorderValue& RenderTableCell::borderAdjoiningTableEnd() const
 {
     ASSERT(isFirstOrLastCellInRow());
-    if (section()->hasSameDirectionAs(table()))
+    if (isDirectionSame(section(), table()))
         return style().borderEnd();
 
     return style().borderStart();

Modified: trunk/Source/WebCore/rendering/RenderTableRow.h (203704 => 203705)


--- trunk/Source/WebCore/rendering/RenderTableRow.h	2016-07-26 01:05:43 UTC (rev 203704)
+++ trunk/Source/WebCore/rendering/RenderTableRow.h	2016-07-26 02:15:56 UTC (rev 203705)
@@ -107,8 +107,7 @@
 
 inline const BorderValue& RenderTableRow::borderAdjoiningTableStart() const
 {
-    RenderTableSection* section = this->section();
-    if (section && section->hasSameDirectionAs(table()))
+    if (isDirectionSame(section(), table()))
         return style().borderStart();
     return style().borderEnd();
 }
@@ -115,8 +114,7 @@
 
 inline const BorderValue& RenderTableRow::borderAdjoiningTableEnd() const
 {
-    RenderTableSection* section = this->section();
-    if (section && section->hasSameDirectionAs(table()))
+    if (isDirectionSame(section(), table()))
         return style().borderEnd();
     return style().borderStart();
 }

Modified: trunk/Source/WebCore/rendering/RenderTableSection.cpp (203704 => 203705)


--- trunk/Source/WebCore/rendering/RenderTableSection.cpp	2016-07-26 01:05:43 UTC (rev 203704)
+++ trunk/Source/WebCore/rendering/RenderTableSection.cpp	2016-07-26 02:15:56 UTC (rev 203705)
@@ -1422,24 +1422,24 @@
 const BorderValue& RenderTableSection::borderAdjoiningStartCell(const RenderTableCell& cell) const
 {
     ASSERT(cell.isFirstOrLastCellInRow());
-    return hasSameDirectionAs(&cell) ? style().borderStart() : style().borderEnd();
+    return isDirectionSame(this, &cell) ? style().borderStart() : style().borderEnd();
 }
 
 const BorderValue& RenderTableSection::borderAdjoiningEndCell(const RenderTableCell& cell) const
 {
     ASSERT(cell.isFirstOrLastCellInRow());
-    return hasSameDirectionAs(&cell) ? style().borderEnd() : style().borderStart();
+    return isDirectionSame(this, &cell) ? style().borderEnd() : style().borderStart();
 }
 
 const RenderTableCell* RenderTableSection::firstRowCellAdjoiningTableStart() const
 {
-    unsigned adjoiningStartCellColumnIndex = hasSameDirectionAs(table()) ? 0 : table()->lastColumnIndex();
+    unsigned adjoiningStartCellColumnIndex = isDirectionSame(this, table()) ? 0 : table()->lastColumnIndex();
     return cellAt(0, adjoiningStartCellColumnIndex).primaryCell();
 }
 
 const RenderTableCell* RenderTableSection::firstRowCellAdjoiningTableEnd() const
 {
-    unsigned adjoiningEndCellColumnIndex = hasSameDirectionAs(table()) ? table()->lastColumnIndex() : 0;
+    unsigned adjoiningEndCellColumnIndex = isDirectionSame(this, table()) ? table()->lastColumnIndex() : 0;
     return cellAt(0, adjoiningEndCellColumnIndex).primaryCell();
 }
 

Modified: trunk/Source/WebCore/rendering/RenderTableSection.h (203704 => 203705)


--- trunk/Source/WebCore/rendering/RenderTableSection.h	2016-07-26 01:05:43 UTC (rev 203704)
+++ trunk/Source/WebCore/rendering/RenderTableSection.h	2016-07-26 02:15:56 UTC (rev 203705)
@@ -242,7 +242,7 @@
 
 inline const BorderValue& RenderTableSection::borderAdjoiningTableStart() const
 {
-    if (hasSameDirectionAs(table()))
+    if (isDirectionSame(this, table()))
         return style().borderStart();
     return style().borderEnd();
 }
@@ -249,7 +249,7 @@
 
 inline const BorderValue& RenderTableSection::borderAdjoiningTableEnd() const
 {
-    if (hasSameDirectionAs(table()))
+    if (isDirectionSame(this, table()))
         return style().borderEnd();
     return style().borderStart();
 }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to