[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
mitz at apple.com
mitz at apple.com
Wed Dec 22 15:26:43 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit 2722b37c9a777b9c645d98af060106504323d249
Author: mitz at apple.com <mitz at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Wed Nov 3 18:03:55 2010 +0000
Make collapsed borders in tables work with different block flows
https://bugs.webkit.org/show_bug.cgi?id=46191
Reviewed by Dave Hyatt.
No new tests since tables don’t support different block flows yet.
This change still doesn’t support cells whose block flow differs from the table’s.
* rendering/AutoTableLayout.cpp:
(WebCore::AutoTableLayout::recalcColumn): Updated for the renaming of styleOrColWidth().
(WebCore::AutoTableLayout::calcEffectiveWidth): Ditto.
* rendering/FixedTableLayout.cpp:
(WebCore::FixedTableLayout::calcWidthArray): Ditto.
* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::computePreferredLogicalWidths): Ditto.
* rendering/RenderTableCell.cpp:
(WebCore::RenderTableCell::styleOrColLogicalWidth): Renamed styleOrColWidth() to this and
changed to use logical widths.
(WebCore::RenderTableCell::computePreferredLogicalWidths): Updated for the above rename.
(WebCore::RenderTableCell::updateLogicalWidth): Renamed updateWidth() to this and changed
to set the logical width.
(WebCore::RenderTableCell::collapsedStartBorder): Changed collapsedLeftBorder() into this.
Note that “start” here will refer to the table’s block flow, not the cell’s, once we allow
the two to differ.
(WebCore::RenderTableCell::collapsedEndBorder): Similar.
(WebCore::RenderTableCell::collapsedBeforeBorder): Similar.
(WebCore::RenderTableCell::collapsedAfterBorder): Similar.
(WebCore::RenderTableCell::collapsedLeftBorder): Resolves “left” to a logical side using
the table’s block flow.
(WebCore::RenderTableCell::collapsedRightBorder): Similar.
(WebCore::RenderTableCell::collapsedTopBorder): Similar.
(WebCore::RenderTableCell::collapsedBottomBorder): Similar.
(WebCore::RenderTableCell::borderStart): Use borderHalfStart().
(WebCore::RenderTableCell::borderEnd): Similar.
(WebCore::RenderTableCell::borderBefore): Similar.
(WebCore::RenderTableCell::borderAfter): Similar.
(WebCore::RenderTableCell::borderHalfLeft): Resolves “left” to a logical side using the
table’s block flow.
(WebCore::RenderTableCell::borderHalfRight): Similar.
(WebCore::RenderTableCell::borderHalfTop): Similar.
(WebCore::RenderTableCell::borderHalfBottom): Similar.
(WebCore::RenderTableCell::borderHalfStart): Added. Uses collapsedStartBorder(). Splits odd
widths based on physical side.
(WebCore::RenderTableCell::borderHalfEnd): Similar.
(WebCore::RenderTableCell::borderHalfBefore): Similar.
(WebCore::RenderTableCell::borderHalfAfter): Similar.
(WebCore::RenderTableCell::collectBorderStyles): Use logical methods.
(WebCore::RenderTableCell::paintCollapsedBorder): Updated.
* rendering/RenderTableCell.h:
* rendering/RenderTableSection.cpp:
(WebCore::RenderTableSection::setCellWidths): Updated for the renaming of updateWidth().
* rendering/style/RenderStyle.cpp:
(WebCore::RenderStyle::borderBefore): Added.
(WebCore::RenderStyle::borderAfter): Added.
(WebCore::RenderStyle::borderStart): Added.
(WebCore::RenderStyle::borderEnd): Adeed.
* rendering/style/RenderStyle.h:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@71251 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index df61be0..0a1f2bb 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,64 @@
+2010-11-03 Dan Bernstein <mitz at apple.com>
+
+ Reviewed by Dave Hyatt.
+
+ Make collapsed borders in tables work with different block flows
+ https://bugs.webkit.org/show_bug.cgi?id=46191
+
+ No new tests since tables don’t support different block flows yet.
+
+ This change still doesn’t support cells whose block flow differs from the table’s.
+
+ * rendering/AutoTableLayout.cpp:
+ (WebCore::AutoTableLayout::recalcColumn): Updated for the renaming of styleOrColWidth().
+ (WebCore::AutoTableLayout::calcEffectiveWidth): Ditto.
+ * rendering/FixedTableLayout.cpp:
+ (WebCore::FixedTableLayout::calcWidthArray): Ditto.
+ * rendering/RenderBlock.cpp:
+ (WebCore::RenderBlock::computePreferredLogicalWidths): Ditto.
+ * rendering/RenderTableCell.cpp:
+ (WebCore::RenderTableCell::styleOrColLogicalWidth): Renamed styleOrColWidth() to this and
+ changed to use logical widths.
+ (WebCore::RenderTableCell::computePreferredLogicalWidths): Updated for the above rename.
+ (WebCore::RenderTableCell::updateLogicalWidth): Renamed updateWidth() to this and changed
+ to set the logical width.
+ (WebCore::RenderTableCell::collapsedStartBorder): Changed collapsedLeftBorder() into this.
+ Note that “start” here will refer to the table’s block flow, not the cell’s, once we allow
+ the two to differ.
+ (WebCore::RenderTableCell::collapsedEndBorder): Similar.
+ (WebCore::RenderTableCell::collapsedBeforeBorder): Similar.
+ (WebCore::RenderTableCell::collapsedAfterBorder): Similar.
+ (WebCore::RenderTableCell::collapsedLeftBorder): Resolves “left” to a logical side using
+ the table’s block flow.
+ (WebCore::RenderTableCell::collapsedRightBorder): Similar.
+ (WebCore::RenderTableCell::collapsedTopBorder): Similar.
+ (WebCore::RenderTableCell::collapsedBottomBorder): Similar.
+ (WebCore::RenderTableCell::borderStart): Use borderHalfStart().
+ (WebCore::RenderTableCell::borderEnd): Similar.
+ (WebCore::RenderTableCell::borderBefore): Similar.
+ (WebCore::RenderTableCell::borderAfter): Similar.
+ (WebCore::RenderTableCell::borderHalfLeft): Resolves “left” to a logical side using the
+ table’s block flow.
+ (WebCore::RenderTableCell::borderHalfRight): Similar.
+ (WebCore::RenderTableCell::borderHalfTop): Similar.
+ (WebCore::RenderTableCell::borderHalfBottom): Similar.
+ (WebCore::RenderTableCell::borderHalfStart): Added. Uses collapsedStartBorder(). Splits odd
+ widths based on physical side.
+ (WebCore::RenderTableCell::borderHalfEnd): Similar.
+ (WebCore::RenderTableCell::borderHalfBefore): Similar.
+ (WebCore::RenderTableCell::borderHalfAfter): Similar.
+ (WebCore::RenderTableCell::collectBorderStyles): Use logical methods.
+ (WebCore::RenderTableCell::paintCollapsedBorder): Updated.
+ * rendering/RenderTableCell.h:
+ * rendering/RenderTableSection.cpp:
+ (WebCore::RenderTableSection::setCellWidths): Updated for the renaming of updateWidth().
+ * rendering/style/RenderStyle.cpp:
+ (WebCore::RenderStyle::borderBefore): Added.
+ (WebCore::RenderStyle::borderAfter): Added.
+ (WebCore::RenderStyle::borderStart): Added.
+ (WebCore::RenderStyle::borderEnd): Adeed.
+ * rendering/style/RenderStyle.h:
+
2010-11-03 Dimitri Glazkov <dglazkov at chromium.org>
Fix Win build correctly after r71244 and r71248
diff --git a/WebCore/rendering/AutoTableLayout.cpp b/WebCore/rendering/AutoTableLayout.cpp
index 55a4afc..b267903 100644
--- a/WebCore/rendering/AutoTableLayout.cpp
+++ b/WebCore/rendering/AutoTableLayout.cpp
@@ -85,7 +85,7 @@ void AutoTableLayout::recalcColumn(int effCol)
maxContributor = cell;
}
- Length w = cell->styleOrColWidth();
+ Length w = cell->styleOrColLogicalWidth();
// FIXME: What is this arbitrary value?
if (w.rawValue() > 32760)
w.setRawValue(32760);
@@ -308,7 +308,7 @@ int AutoTableLayout::calcEffectiveWidth()
break;
int span = cell->colSpan();
- Length w = cell->styleOrColWidth();
+ Length w = cell->styleOrColLogicalWidth();
if (!w.isRelative() && w.isZero())
w = Length(); // make it Auto
diff --git a/WebCore/rendering/FixedTableLayout.cpp b/WebCore/rendering/FixedTableLayout.cpp
index ba99336..e1a33f4 100644
--- a/WebCore/rendering/FixedTableLayout.cpp
+++ b/WebCore/rendering/FixedTableLayout.cpp
@@ -158,7 +158,7 @@ int FixedTableLayout::calcWidthArray(int)
if (cell->preferredLogicalWidthsDirty())
cell->computePreferredLogicalWidths();
- Length w = cell->styleOrColWidth();
+ Length w = cell->styleOrColLogicalWidth();
int span = cell->colSpan();
int effWidth = 0;
if (w.isFixed() && w.isPositive())
diff --git a/WebCore/rendering/RenderBlock.cpp b/WebCore/rendering/RenderBlock.cpp
index 8dc02d8..1c39985 100644
--- a/WebCore/rendering/RenderBlock.cpp
+++ b/WebCore/rendering/RenderBlock.cpp
@@ -4712,7 +4712,7 @@ void RenderBlock::computePreferredLogicalWidths()
}
if (isTableCell()) {
- Length w = toRenderTableCell(this)->styleOrColWidth();
+ Length w = toRenderTableCell(this)->styleOrColLogicalWidth();
if (w.isFixed() && w.value() > 0)
m_maxPreferredLogicalWidth = max(m_minPreferredLogicalWidth, computeContentBoxLogicalWidth(w.value()));
}
diff --git a/WebCore/rendering/RenderTableCell.cpp b/WebCore/rendering/RenderTableCell.cpp
index 69d63cf..eec882f 100644
--- a/WebCore/rendering/RenderTableCell.cpp
+++ b/WebCore/rendering/RenderTableCell.cpp
@@ -80,20 +80,18 @@ void RenderTableCell::updateFromElement()
}
}
-Length RenderTableCell::styleOrColWidth() const
+Length RenderTableCell::styleOrColLogicalWidth() const
{
- Length w = style()->width();
+ Length w = style()->logicalWidth();
if (!w.isAuto())
return w;
- RenderTableCol* tableCol = table()->colElement(col());
-
- if (tableCol) {
+ if (RenderTableCol* tableCol = table()->colElement(col())) {
int colSpanCount = colSpan();
Length colWidthSum = Length(0, Fixed);
for (int i = 1; i <= colSpanCount; i++) {
- Length colWidth = tableCol->style()->width();
+ Length colWidth = tableCol->style()->logicalWidth();
// Percentage value should be returned only for colSpan == 1.
// Otherwise we return original width for the cell.
@@ -115,7 +113,7 @@ Length RenderTableCell::styleOrColWidth() const
// Percentages don't need to be handled since they're always treated this way (even when specified on the cells).
// See Bugzilla bug 8126 for details.
if (colWidthSum.isFixed() && colWidthSum.value() > 0)
- colWidthSum = Length(max(0, colWidthSum.value() - borderAndPaddingWidth()), Fixed);
+ colWidthSum = Length(max(0, colWidthSum.value() - borderAndPaddingLogicalWidth()), Fixed);
return colWidthSum;
}
@@ -132,7 +130,7 @@ void RenderTableCell::computePreferredLogicalWidths()
RenderBlock::computePreferredLogicalWidths();
if (node() && style()->autoWrap()) {
// See if nowrap was set.
- Length w = styleOrColWidth();
+ Length w = styleOrColLogicalWidth();
String nowrap = static_cast<Element*>(node())->getAttribute(nowrapAttr);
if (!nowrap.isNull() && w.isFixed())
// Nowrap is set, but we didn't actually use it because of the
@@ -148,12 +146,13 @@ void RenderTableCell::computeLogicalWidth()
{
}
-void RenderTableCell::updateWidth(int w)
+void RenderTableCell::updateLogicalWidth(int w)
{
- if (w != width()) {
- setWidth(w);
- setCellWidthChanged(true);
- }
+ if (w == logicalWidth())
+ return;
+
+ setLogicalWidth(w);
+ setCellWidthChanged(true);
}
void RenderTableCell::layout()
@@ -384,69 +383,62 @@ static CollapsedBorderValue chooseBorder(const CollapsedBorderValue& border1, co
return border.style() == BHIDDEN ? CollapsedBorderValue() : border;
}
-CollapsedBorderValue RenderTableCell::collapsedLeftBorder(bool rtl) const
+CollapsedBorderValue RenderTableCell::collapsedStartBorder() const
{
- RenderTable* tableElt = table();
- bool leftmostColumn;
- if (!rtl)
- leftmostColumn = col() == 0;
- else {
- int effCol = tableElt->colToEffCol(col() + colSpan() - 1);
- leftmostColumn = effCol == tableElt->numEffCols() - 1;
- }
-
- // For border left, we need to check, in order of precedence:
- // (1) Our left border.
- int left = CSSPropertyBorderLeftColor;
- int right = CSSPropertyBorderRightColor;
- CollapsedBorderValue result(&style()->borderLeft(), style()->visitedDependentColor(left), BCELL);
-
- // (2) The right border of the cell to the left.
- RenderTableCell* prevCell = rtl ? tableElt->cellAfter(this) : tableElt->cellBefore(this);
- if (prevCell) {
- CollapsedBorderValue prevCellBorder = CollapsedBorderValue(&prevCell->style()->borderRight(), prevCell->style()->visitedDependentColor(right), BCELL);
- result = rtl ? chooseBorder(result, prevCellBorder) : chooseBorder(prevCellBorder, result);
+ RenderTable* table = this->table();
+ bool isStartColumn = col() == 0;
+
+ // For the start border, we need to check, in order of precedence:
+ // (1) Our start border.
+ int start = CSSProperty::resolveDirectionAwareProperty(CSSPropertyWebkitBorderStartColor, table->style()->direction(), table->style()->writingMode());
+ int end = CSSProperty::resolveDirectionAwareProperty(CSSPropertyWebkitBorderEndColor, table->style()->direction(), table->style()->writingMode());
+ CollapsedBorderValue result(&style()->borderStart(), style()->visitedDependentColor(start), BCELL);
+
+ // (2) The end border of the preceding cell.
+ if (RenderTableCell* prevCell = table->cellBefore(this)) {
+ CollapsedBorderValue prevCellBorder = CollapsedBorderValue(&prevCell->style()->borderEnd(), prevCell->style()->visitedDependentColor(end), BCELL);
+ result = chooseBorder(prevCellBorder, result);
if (!result.exists())
return result;
- } else if (leftmostColumn) {
- // (3) Our row's left border.
- result = chooseBorder(result, CollapsedBorderValue(&parent()->style()->borderLeft(), parent()->style()->visitedDependentColor(left), BROW));
+ } else if (isStartColumn) {
+ // (3) Our row's start border.
+ result = chooseBorder(result, CollapsedBorderValue(&parent()->style()->borderStart(), parent()->style()->visitedDependentColor(start), BROW));
if (!result.exists())
return result;
- // (4) Our row group's left border.
- result = chooseBorder(result, CollapsedBorderValue(§ion()->style()->borderLeft(), section()->style()->visitedDependentColor(left), BROWGROUP));
+ // (4) Our row group's start border.
+ result = chooseBorder(result, CollapsedBorderValue(§ion()->style()->borderStart(), section()->style()->visitedDependentColor(start), BROWGROUP));
if (!result.exists())
return result;
}
- // (5) Our column and column group's left borders.
+ // (5) Our column and column group's start borders.
bool startColEdge;
bool endColEdge;
- RenderTableCol* colElt = tableElt->colElement(col() + (rtl ? colSpan() - 1 : 0), &startColEdge, &endColEdge);
- if (colElt && (!rtl ? startColEdge : endColEdge)) {
- result = chooseBorder(result, CollapsedBorderValue(&colElt->style()->borderLeft(), colElt->style()->visitedDependentColor(left), BCOL));
+ RenderTableCol* colElt = table->colElement(col(), &startColEdge, &endColEdge);
+ if (colElt && startColEdge) {
+ result = chooseBorder(result, CollapsedBorderValue(&colElt->style()->borderStart(), colElt->style()->visitedDependentColor(start), BCOL));
if (!result.exists())
return result;
- if (colElt->parent()->isTableCol() && (!rtl ? !colElt->previousSibling() : !colElt->nextSibling())) {
- result = chooseBorder(result, CollapsedBorderValue(&colElt->parent()->style()->borderLeft(), colElt->parent()->style()->visitedDependentColor(left), BCOLGROUP));
+ if (colElt->parent()->isTableCol() && !colElt->previousSibling()) {
+ result = chooseBorder(result, CollapsedBorderValue(&colElt->parent()->style()->borderStart(), colElt->parent()->style()->visitedDependentColor(start), BCOLGROUP));
if (!result.exists())
return result;
}
}
- // (6) The right border of the column to the left.
- if (!leftmostColumn) {
- colElt = tableElt->colElement(col() + (rtl ? colSpan() : -1), &startColEdge, &endColEdge);
- if (colElt && (!rtl ? endColEdge : startColEdge)) {
- CollapsedBorderValue rightBorder = CollapsedBorderValue(&colElt->style()->borderRight(), colElt->style()->visitedDependentColor(right), BCOL);
- result = rtl ? chooseBorder(result, rightBorder) : chooseBorder(rightBorder, result);
+ // (6) The end border of the preceding column.
+ if (!isStartColumn) {
+ colElt = table->colElement(col() -1, &startColEdge, &endColEdge);
+ if (colElt && endColEdge) {
+ CollapsedBorderValue endBorder = CollapsedBorderValue(&colElt->style()->borderEnd(), colElt->style()->visitedDependentColor(end), BCOL);
+ result = chooseBorder(endBorder, result);
if (!result.exists())
return result;
}
} else {
- // (7) The table's left border.
- result = chooseBorder(result, CollapsedBorderValue(&tableElt->style()->borderLeft(), tableElt->style()->visitedDependentColor(left), BTABLE));
+ // (7) The table's start border.
+ result = chooseBorder(result, CollapsedBorderValue(&table->style()->borderStart(), table->style()->visitedDependentColor(start), BTABLE));
if (!result.exists())
return result;
}
@@ -454,71 +446,65 @@ CollapsedBorderValue RenderTableCell::collapsedLeftBorder(bool rtl) const
return result;
}
-CollapsedBorderValue RenderTableCell::collapsedRightBorder(bool rtl) const
+CollapsedBorderValue RenderTableCell::collapsedEndBorder() const
{
- RenderTable* tableElt = table();
- bool rightmostColumn;
- if (rtl)
- rightmostColumn = col() == 0;
- else {
- int effCol = tableElt->colToEffCol(col() + colSpan() - 1);
- rightmostColumn = effCol == tableElt->numEffCols() - 1;
- }
-
- // For border right, we need to check, in order of precedence:
- // (1) Our right border.
- int left = CSSPropertyBorderLeftColor;
- int right = CSSPropertyBorderRightColor;
- CollapsedBorderValue result = CollapsedBorderValue(&style()->borderRight(), style()->visitedDependentColor(right), BCELL);
+ RenderTable* table = this->table();
+ bool isEndColumn = table->colToEffCol(col() + colSpan() - 1) == table->numEffCols() - 1;
+
+ // For end border, we need to check, in order of precedence:
+ // (1) Our end border.
+ int start = CSSProperty::resolveDirectionAwareProperty(CSSPropertyWebkitBorderStartColor, table->style()->direction(), table->style()->writingMode());
+ int end = CSSProperty::resolveDirectionAwareProperty(CSSPropertyWebkitBorderEndColor, table->style()->direction(), table->style()->writingMode());
+ CollapsedBorderValue result = CollapsedBorderValue(&style()->borderEnd(), style()->visitedDependentColor(end), BCELL);
- // (2) The left border of the cell to the right.
- if (!rightmostColumn) {
- RenderTableCell* nextCell = rtl ? tableElt->cellBefore(this) : tableElt->cellAfter(this);
+ // (2) The start border of the following cell.
+ if (!isEndColumn) {
+ RenderTableCell* nextCell = table->cellAfter(this);
if (nextCell && nextCell->style()) {
- CollapsedBorderValue leftBorder = CollapsedBorderValue(&nextCell->style()->borderLeft(), nextCell->style()->visitedDependentColor(left), BCELL);
- result = rtl ? chooseBorder(leftBorder, result) : chooseBorder(result, leftBorder);
+ CollapsedBorderValue startBorder = CollapsedBorderValue(&nextCell->style()->borderStart(), nextCell->style()->visitedDependentColor(start), BCELL);
+ result = chooseBorder(result, startBorder);
if (!result.exists())
return result;
}
} else {
- // (3) Our row's right border.
- result = chooseBorder(result, CollapsedBorderValue(&parent()->style()->borderRight(), parent()->style()->visitedDependentColor(right), BROW));
+ // (3) Our row's end border.
+ result = chooseBorder(result, CollapsedBorderValue(&parent()->style()->borderEnd(), parent()->style()->visitedDependentColor(end), BROW));
if (!result.exists())
return result;
- // (4) Our row group's right border.
- result = chooseBorder(result, CollapsedBorderValue(§ion()->style()->borderRight(), section()->style()->visitedDependentColor(right), BROWGROUP));
+ // (4) Our row group's end border.
+ result = chooseBorder(result, CollapsedBorderValue(§ion()->style()->borderEnd(), section()->style()->visitedDependentColor(end), BROWGROUP));
if (!result.exists())
return result;
}
- // (5) Our column and column group's right borders.
+ // (5) Our column and column group's end borders.
bool startColEdge;
bool endColEdge;
- RenderTableCol* colElt = tableElt->colElement(col() + (rtl ? 0 : colSpan() - 1), &startColEdge, &endColEdge);
- if (colElt && (!rtl ? endColEdge : startColEdge)) {
- result = chooseBorder(result, CollapsedBorderValue(&colElt->style()->borderRight(), colElt->style()->visitedDependentColor(right), BCOL));
+ RenderTableCol* colElt = table->colElement(col() + colSpan() - 1, &startColEdge, &endColEdge);
+ if (colElt && endColEdge) {
+ result = chooseBorder(result, CollapsedBorderValue(&colElt->style()->borderEnd(), colElt->style()->visitedDependentColor(end), BCOL));
if (!result.exists())
return result;
- if (colElt->parent()->isTableCol() && (!rtl ? !colElt->nextSibling() : !colElt->previousSibling())) {
- result = chooseBorder(result, CollapsedBorderValue(&colElt->parent()->style()->borderRight(), colElt->parent()->style()->visitedDependentColor(right), BCOLGROUP));
+ if (colElt->parent()->isTableCol() && !colElt->nextSibling()) {
+ result = chooseBorder(result, CollapsedBorderValue(&colElt->parent()->style()->borderEnd(), colElt->parent()->style()->visitedDependentColor(end), BCOLGROUP));
if (!result.exists())
return result;
}
}
- // (6) The left border of the column to the right.
- if (!rightmostColumn) {
- colElt = tableElt->colElement(col() + (rtl ? -1 : colSpan()), &startColEdge, &endColEdge);
- if (colElt && (!rtl ? startColEdge : endColEdge)) {
- CollapsedBorderValue leftBorder = CollapsedBorderValue(&colElt->style()->borderLeft(), colElt->style()->visitedDependentColor(left), BCOL);
- result = rtl ? chooseBorder(leftBorder, result) : chooseBorder(result, leftBorder);
+ // (6) The start border of the next column.
+ if (!isEndColumn) {
+ colElt = table->colElement(col() + colSpan(), &startColEdge, &endColEdge);
+ if (colElt && startColEdge) {
+ CollapsedBorderValue startBorder = CollapsedBorderValue(&colElt->style()->borderStart(), colElt->style()->visitedDependentColor(start), BCOL);
+ result = chooseBorder(result, startBorder);
if (!result.exists())
return result;
}
} else {
- // (7) The table's right border.
- result = chooseBorder(result, CollapsedBorderValue(&tableElt->style()->borderRight(), tableElt->style()->visitedDependentColor(right), BTABLE));
+ // (7) The table's end border.
+ result = chooseBorder(result, CollapsedBorderValue(&table->style()->borderEnd(), table->style()->visitedDependentColor(end), BTABLE));
if (!result.exists())
return result;
}
@@ -526,28 +512,30 @@ CollapsedBorderValue RenderTableCell::collapsedRightBorder(bool rtl) const
return result;
}
-CollapsedBorderValue RenderTableCell::collapsedTopBorder() const
+CollapsedBorderValue RenderTableCell::collapsedBeforeBorder() const
{
- // For border top, we need to check, in order of precedence:
- // (1) Our top border.
- int top = CSSPropertyBorderTopColor;
- int bottom = CSSPropertyBorderBottomColor;
- CollapsedBorderValue result = CollapsedBorderValue(&style()->borderTop(), style()->visitedDependentColor(top), BCELL);
+ RenderTable* table = this->table();
+
+ // For before border, we need to check, in order of precedence:
+ // (1) Our before border.
+ int before = CSSProperty::resolveDirectionAwareProperty(CSSPropertyWebkitBorderBeforeColor, table->style()->direction(), table->style()->writingMode());
+ int after = CSSProperty::resolveDirectionAwareProperty(CSSPropertyWebkitBorderAfterColor, table->style()->direction(), table->style()->writingMode());
+ CollapsedBorderValue result = CollapsedBorderValue(&style()->borderBefore(), style()->visitedDependentColor(before), BCELL);
- RenderTableCell* prevCell = table()->cellAbove(this);
+ RenderTableCell* prevCell = table->cellAbove(this);
if (prevCell) {
- // (2) A previous cell's bottom border.
- result = chooseBorder(CollapsedBorderValue(&prevCell->style()->borderBottom(), prevCell->style()->visitedDependentColor(bottom), BCELL), result);
- if (!result.exists())
+ // (2) A before cell's after border.
+ result = chooseBorder(CollapsedBorderValue(&prevCell->style()->borderAfter(), prevCell->style()->visitedDependentColor(after), BCELL), result);
+ if (!result.exists())
return result;
}
- // (3) Our row's top border.
- result = chooseBorder(result, CollapsedBorderValue(&parent()->style()->borderTop(), parent()->style()->visitedDependentColor(top), BROW));
+ // (3) Our row's before border.
+ result = chooseBorder(result, CollapsedBorderValue(&parent()->style()->borderBefore(), parent()->style()->visitedDependentColor(before), BROW));
if (!result.exists())
return result;
- // (4) The previous row's bottom border.
+ // (4) The previous row's after border.
if (prevCell) {
RenderObject* prevRow = 0;
if (prevCell->section() == section())
@@ -556,7 +544,7 @@ CollapsedBorderValue RenderTableCell::collapsedTopBorder() const
prevRow = prevCell->section()->lastChild();
if (prevRow) {
- result = chooseBorder(CollapsedBorderValue(&prevRow->style()->borderBottom(), prevRow->style()->visitedDependentColor(bottom), BROW), result);
+ result = chooseBorder(CollapsedBorderValue(&prevRow->style()->borderAfter(), prevRow->style()->visitedDependentColor(after), BROW), result);
if (!result.exists())
return result;
}
@@ -565,37 +553,36 @@ CollapsedBorderValue RenderTableCell::collapsedTopBorder() const
// Now check row groups.
RenderTableSection* currSection = section();
if (!row()) {
- // (5) Our row group's top border.
- result = chooseBorder(result, CollapsedBorderValue(&currSection->style()->borderTop(), currSection->style()->visitedDependentColor(top), BROWGROUP));
+ // (5) Our row group's before border.
+ result = chooseBorder(result, CollapsedBorderValue(&currSection->style()->borderBefore(), currSection->style()->visitedDependentColor(before), BROWGROUP));
if (!result.exists())
return result;
- // (6) Previous row group's bottom border.
- currSection = table()->sectionAbove(currSection);
+ // (6) Previous row group's after border.
+ currSection = table->sectionAbove(currSection);
if (currSection) {
- result = chooseBorder(CollapsedBorderValue(&currSection->style()->borderBottom(), currSection->style()->visitedDependentColor(bottom), BROWGROUP), result);
+ result = chooseBorder(CollapsedBorderValue(&currSection->style()->borderAfter(), currSection->style()->visitedDependentColor(after), BROWGROUP), result);
if (!result.exists())
return result;
}
}
if (!currSection) {
- // (8) Our column and column group's top borders.
- RenderTableCol* colElt = table()->colElement(col());
+ // (8) Our column and column group's before borders.
+ RenderTableCol* colElt = table->colElement(col());
if (colElt) {
- result = chooseBorder(result, CollapsedBorderValue(&colElt->style()->borderTop(), colElt->style()->visitedDependentColor(top), BCOL));
+ result = chooseBorder(result, CollapsedBorderValue(&colElt->style()->borderBefore(), colElt->style()->visitedDependentColor(before), BCOL));
if (!result.exists())
return result;
if (colElt->parent()->isTableCol()) {
- result = chooseBorder(result, CollapsedBorderValue(&colElt->parent()->style()->borderTop(), colElt->parent()->style()->visitedDependentColor(top), BCOLGROUP));
+ result = chooseBorder(result, CollapsedBorderValue(&colElt->parent()->style()->borderBefore(), colElt->parent()->style()->visitedDependentColor(before), BCOLGROUP));
if (!result.exists())
return result;
}
}
- // (9) The table's top border.
- RenderTable* enclosingTable = table();
- result = chooseBorder(result, CollapsedBorderValue(&enclosingTable->style()->borderTop(), enclosingTable->style()->visitedDependentColor(top), BTABLE));
+ // (9) The table's before border.
+ result = chooseBorder(result, CollapsedBorderValue(&table->style()->borderBefore(), table->style()->visitedDependentColor(before), BTABLE));
if (!result.exists())
return result;
}
@@ -603,30 +590,32 @@ CollapsedBorderValue RenderTableCell::collapsedTopBorder() const
return result;
}
-CollapsedBorderValue RenderTableCell::collapsedBottomBorder() const
+CollapsedBorderValue RenderTableCell::collapsedAfterBorder() const
{
- // For border top, we need to check, in order of precedence:
- // (1) Our bottom border.
- int top = CSSPropertyBorderTopColor;
- int bottom = CSSPropertyBorderBottomColor;
- CollapsedBorderValue result = CollapsedBorderValue(&style()->borderBottom(), style()->visitedDependentColor(bottom), BCELL);
+ RenderTable* table = this->table();
+
+ // For after border, we need to check, in order of precedence:
+ // (1) Our after border.
+ int before = CSSProperty::resolveDirectionAwareProperty(CSSPropertyWebkitBorderBeforeColor, table->style()->direction(), table->style()->writingMode());
+ int after = CSSProperty::resolveDirectionAwareProperty(CSSPropertyWebkitBorderAfterColor, table->style()->direction(), table->style()->writingMode());
+ CollapsedBorderValue result = CollapsedBorderValue(&style()->borderAfter(), style()->visitedDependentColor(after), BCELL);
- RenderTableCell* nextCell = table()->cellBelow(this);
+ RenderTableCell* nextCell = table->cellBelow(this);
if (nextCell) {
- // (2) A following cell's top border.
- result = chooseBorder(result, CollapsedBorderValue(&nextCell->style()->borderTop(), nextCell->style()->visitedDependentColor(top), BCELL));
+ // (2) An after cell's before border.
+ result = chooseBorder(result, CollapsedBorderValue(&nextCell->style()->borderBefore(), nextCell->style()->visitedDependentColor(before), BCELL));
if (!result.exists())
return result;
}
- // (3) Our row's bottom border. (FIXME: Deal with rowspan!)
- result = chooseBorder(result, CollapsedBorderValue(&parent()->style()->borderBottom(), parent()->style()->visitedDependentColor(bottom), BROW));
+ // (3) Our row's after border. (FIXME: Deal with rowspan!)
+ result = chooseBorder(result, CollapsedBorderValue(&parent()->style()->borderAfter(), parent()->style()->visitedDependentColor(after), BROW));
if (!result.exists())
return result;
- // (4) The next row's top border.
+ // (4) The next row's before border.
if (nextCell) {
- result = chooseBorder(result, CollapsedBorderValue(&nextCell->parent()->style()->borderTop(), nextCell->parent()->style()->visitedDependentColor(top), BROW));
+ result = chooseBorder(result, CollapsedBorderValue(&nextCell->parent()->style()->borderBefore(), nextCell->parent()->style()->visitedDependentColor(before), BROW));
if (!result.exists())
return result;
}
@@ -634,36 +623,35 @@ CollapsedBorderValue RenderTableCell::collapsedBottomBorder() const
// Now check row groups.
RenderTableSection* currSection = section();
if (row() + rowSpan() >= currSection->numRows()) {
- // (5) Our row group's bottom border.
- result = chooseBorder(result, CollapsedBorderValue(&currSection->style()->borderBottom(), currSection->style()->visitedDependentColor(bottom), BROWGROUP));
+ // (5) Our row group's after border.
+ result = chooseBorder(result, CollapsedBorderValue(&currSection->style()->borderAfter(), currSection->style()->visitedDependentColor(after), BROWGROUP));
if (!result.exists())
return result;
- // (6) Following row group's top border.
- currSection = table()->sectionBelow(currSection);
+ // (6) Following row group's before border.
+ currSection = table->sectionBelow(currSection);
if (currSection) {
- result = chooseBorder(result, CollapsedBorderValue(&currSection->style()->borderTop(), currSection->style()->visitedDependentColor(top), BROWGROUP));
+ result = chooseBorder(result, CollapsedBorderValue(&currSection->style()->borderBefore(), currSection->style()->visitedDependentColor(before), BROWGROUP));
if (!result.exists())
return result;
}
}
if (!currSection) {
- // (8) Our column and column group's bottom borders.
- RenderTableCol* colElt = table()->colElement(col());
+ // (8) Our column and column group's after borders.
+ RenderTableCol* colElt = table->colElement(col());
if (colElt) {
- result = chooseBorder(result, CollapsedBorderValue(&colElt->style()->borderBottom(), colElt->style()->visitedDependentColor(bottom), BCOL));
+ result = chooseBorder(result, CollapsedBorderValue(&colElt->style()->borderAfter(), colElt->style()->visitedDependentColor(after), BCOL));
if (!result.exists()) return result;
if (colElt->parent()->isTableCol()) {
- result = chooseBorder(result, CollapsedBorderValue(&colElt->parent()->style()->borderBottom(), colElt->parent()->style()->visitedDependentColor(bottom), BCOLGROUP));
+ result = chooseBorder(result, CollapsedBorderValue(&colElt->parent()->style()->borderAfter(), colElt->parent()->style()->visitedDependentColor(after), BCOLGROUP));
if (!result.exists())
return result;
}
}
- // (9) The table's bottom border.
- RenderTable* enclosingTable = table();
- result = chooseBorder(result, CollapsedBorderValue(&enclosingTable->style()->borderBottom(), enclosingTable->style()->visitedDependentColor(bottom), BTABLE));
+ // (9) The table's after border.
+ result = chooseBorder(result, CollapsedBorderValue(&table->style()->borderAfter(), table->style()->visitedDependentColor(after), BTABLE));
if (!result.exists())
return result;
}
@@ -671,6 +659,38 @@ CollapsedBorderValue RenderTableCell::collapsedBottomBorder() const
return result;
}
+CollapsedBorderValue RenderTableCell::collapsedLeftBorder() const
+{
+ RenderStyle* tableStyle = table()->style();
+ if (tableStyle->isHorizontalWritingMode())
+ return tableStyle->isLeftToRightDirection() ? collapsedStartBorder() : collapsedEndBorder();
+ return tableStyle->isFlippedBlocksWritingMode() ? collapsedAfterBorder() : collapsedBeforeBorder();
+}
+
+CollapsedBorderValue RenderTableCell::collapsedRightBorder() const
+{
+ RenderStyle* tableStyle = table()->style();
+ if (tableStyle->isHorizontalWritingMode())
+ return tableStyle->isLeftToRightDirection() ? collapsedEndBorder() : collapsedStartBorder();
+ return tableStyle->isFlippedBlocksWritingMode() ? collapsedBeforeBorder() : collapsedAfterBorder();
+}
+
+CollapsedBorderValue RenderTableCell::collapsedTopBorder() const
+{
+ RenderStyle* tableStyle = table()->style();
+ if (tableStyle->isHorizontalWritingMode())
+ return tableStyle->isFlippedBlocksWritingMode() ? collapsedAfterBorder() : collapsedBeforeBorder();
+ return tableStyle->isLeftToRightDirection() ? collapsedStartBorder() : collapsedEndBorder();
+}
+
+CollapsedBorderValue RenderTableCell::collapsedBottomBorder() const
+{
+ RenderStyle* tableStyle = table()->style();
+ if (tableStyle->isHorizontalWritingMode())
+ return tableStyle->isFlippedBlocksWritingMode() ? collapsedBeforeBorder() : collapsedAfterBorder();
+ return tableStyle->isLeftToRightDirection() ? collapsedEndBorder() : collapsedStartBorder();
+}
+
int RenderTableCell::borderLeft() const
{
return table()->collapseBorders() ? borderHalfLeft(false) : RenderBlock::borderLeft();
@@ -695,53 +715,85 @@ int RenderTableCell::borderBottom() const
// work with different block flow values instead of being hard-coded to top-to-bottom.
int RenderTableCell::borderStart() const
{
- return table()->collapseBorders() ? borderHalfLeft(false) : RenderBlock::borderStart();
+ return table()->collapseBorders() ? borderHalfStart(false) : RenderBlock::borderStart();
}
int RenderTableCell::borderEnd() const
{
- return table()->collapseBorders() ? borderHalfRight(false) : RenderBlock::borderEnd();
+ return table()->collapseBorders() ? borderHalfEnd(false) : RenderBlock::borderEnd();
}
int RenderTableCell::borderBefore() const
{
- return table()->collapseBorders() ? borderHalfTop(false) : RenderBlock::borderBefore();
+ return table()->collapseBorders() ? borderHalfBefore(false) : RenderBlock::borderBefore();
}
int RenderTableCell::borderAfter() const
{
- return table()->collapseBorders() ? borderHalfBottom(false) : RenderBlock::borderAfter();
+ return table()->collapseBorders() ? borderHalfAfter(false) : RenderBlock::borderAfter();
}
int RenderTableCell::borderHalfLeft(bool outer) const
{
- CollapsedBorderValue border = collapsedLeftBorder(!table()->style()->isLeftToRightDirection());
+ RenderStyle* tableStyle = table()->style();
+ if (tableStyle->isHorizontalWritingMode())
+ return tableStyle->isLeftToRightDirection() ? borderHalfStart(outer) : borderHalfEnd(outer);
+ return tableStyle->isFlippedBlocksWritingMode() ? borderHalfAfter(outer) : borderHalfBefore(outer);
+}
+
+int RenderTableCell::borderHalfRight(bool outer) const
+{
+ RenderStyle* tableStyle = table()->style();
+ if (tableStyle->isHorizontalWritingMode())
+ return tableStyle->isLeftToRightDirection() ? borderHalfEnd(outer) : borderHalfStart(outer);
+ return tableStyle->isFlippedBlocksWritingMode() ? borderHalfBefore(outer) : borderHalfAfter(outer);
+}
+
+int RenderTableCell::borderHalfTop(bool outer) const
+{
+ RenderStyle* tableStyle = table()->style();
+ if (tableStyle->isHorizontalWritingMode())
+ return tableStyle->isFlippedBlocksWritingMode() ? borderHalfAfter(outer) : borderHalfBefore(outer);
+ return tableStyle->isLeftToRightDirection() ? borderHalfStart(outer) : borderHalfEnd(outer);
+}
+
+int RenderTableCell::borderHalfBottom(bool outer) const
+{
+ RenderStyle* tableStyle = table()->style();
+ if (tableStyle->isHorizontalWritingMode())
+ return tableStyle->isFlippedBlocksWritingMode() ? borderHalfBefore(outer) : borderHalfAfter(outer);
+ return tableStyle->isLeftToRightDirection() ? borderHalfEnd(outer) : borderHalfStart(outer);
+}
+
+int RenderTableCell::borderHalfStart(bool outer) const
+{
+ CollapsedBorderValue border = collapsedStartBorder();
if (border.exists())
- return (border.width() + (outer ? 0 : 1)) / 2; // Give the extra pixel to top and left.
+ return (border.width() + ((table()->style()->isLeftToRightDirection() ^ outer) ? 1 : 0)) / 2; // Give the extra pixel to top and left.
return 0;
}
-int RenderTableCell::borderHalfRight(bool outer) const
+int RenderTableCell::borderHalfEnd(bool outer) const
{
- CollapsedBorderValue border = collapsedRightBorder(!table()->style()->isLeftToRightDirection());
+ CollapsedBorderValue border = collapsedEndBorder();
if (border.exists())
- return (border.width() + (outer ? 1 : 0)) / 2;
+ return (border.width() + ((table()->style()->isLeftToRightDirection() ^ outer) ? 0 : 1)) / 2;
return 0;
}
-int RenderTableCell::borderHalfTop(bool outer) const
+int RenderTableCell::borderHalfBefore(bool outer) const
{
- CollapsedBorderValue border = collapsedTopBorder();
+ CollapsedBorderValue border = collapsedBeforeBorder();
if (border.exists())
- return (border.width() + (outer ? 0 : 1)) / 2; // Give the extra pixel to top and left.
+ return (border.width() + ((table()->style()->isFlippedBlocksWritingMode() ^ outer) ? 0 : 1)) / 2; // Give the extra pixel to top and left.
return 0;
}
-int RenderTableCell::borderHalfBottom(bool outer) const
+int RenderTableCell::borderHalfAfter(bool outer) const
{
- CollapsedBorderValue border = collapsedBottomBorder();
+ CollapsedBorderValue border = collapsedAfterBorder();
if (border.exists())
- return (border.width() + (outer ? 1 : 0)) / 2;
+ return (border.width() + ((table()->style()->isFlippedBlocksWritingMode() ^ outer) ? 1 : 0)) / 2;
return 0;
}
@@ -835,11 +887,10 @@ static void addBorderStyle(RenderTableCell::CollapsedBorderStyles& borderStyles,
void RenderTableCell::collectBorderStyles(CollapsedBorderStyles& borderStyles) const
{
- bool rtl = !table()->style()->isLeftToRightDirection();
- addBorderStyle(borderStyles, collapsedLeftBorder(rtl));
- addBorderStyle(borderStyles, collapsedRightBorder(rtl));
- addBorderStyle(borderStyles, collapsedTopBorder());
- addBorderStyle(borderStyles, collapsedBottomBorder());
+ addBorderStyle(borderStyles, collapsedStartBorder());
+ addBorderStyle(borderStyles, collapsedEndBorder());
+ addBorderStyle(borderStyles, collapsedBeforeBorder());
+ addBorderStyle(borderStyles, collapsedAfterBorder());
}
static int compareBorderStylesForQSort(const void* pa, const void* pb)
@@ -862,9 +913,8 @@ void RenderTableCell::paintCollapsedBorder(GraphicsContext* graphicsContext, int
if (!table()->currentBorderStyle())
return;
- bool rtl = !table()->style()->isLeftToRightDirection();
- CollapsedBorderValue leftVal = collapsedLeftBorder(rtl);
- CollapsedBorderValue rightVal = collapsedRightBorder(rtl);
+ CollapsedBorderValue leftVal = collapsedLeftBorder();
+ CollapsedBorderValue rightVal = collapsedRightBorder();
CollapsedBorderValue topVal = collapsedTopBorder();
CollapsedBorderValue bottomVal = collapsedBottomBorder();
diff --git a/WebCore/rendering/RenderTableCell.h b/WebCore/rendering/RenderTableCell.h
index 31879d6..15e6bab 100644
--- a/WebCore/rendering/RenderTableCell.h
+++ b/WebCore/rendering/RenderTableCell.h
@@ -51,11 +51,11 @@ public:
RenderTableSection* section() const { return toRenderTableSection(parent()->parent()); }
RenderTable* table() const { return toRenderTable(parent()->parent()->parent()); }
- Length styleOrColWidth() const;
+ Length styleOrColLogicalWidth() const;
virtual void computePreferredLogicalWidths();
- void updateWidth(int);
+ void updateLogicalWidth(int);
virtual int borderLeft() const;
virtual int borderRight() const;
@@ -71,8 +71,18 @@ public:
int borderHalfTop(bool outer) const;
int borderHalfBottom(bool outer) const;
- CollapsedBorderValue collapsedLeftBorder(bool rtl) const;
- CollapsedBorderValue collapsedRightBorder(bool rtl) const;
+ int borderHalfStart(bool outer) const;
+ int borderHalfEnd(bool outer) const;
+ int borderHalfBefore(bool outer) const;
+ int borderHalfAfter(bool outer) const;
+
+ CollapsedBorderValue collapsedStartBorder() const;
+ CollapsedBorderValue collapsedEndBorder() const;
+ CollapsedBorderValue collapsedBeforeBorder() const;
+ CollapsedBorderValue collapsedAfterBorder() const;
+
+ CollapsedBorderValue collapsedLeftBorder() const;
+ CollapsedBorderValue collapsedRightBorder() const;
CollapsedBorderValue collapsedTopBorder() const;
CollapsedBorderValue collapsedBottomBorder() const;
diff --git a/WebCore/rendering/RenderTableSection.cpp b/WebCore/rendering/RenderTableSection.cpp
index 837cc03..8fb1d7f 100644
--- a/WebCore/rendering/RenderTableSection.cpp
+++ b/WebCore/rendering/RenderTableSection.cpp
@@ -281,7 +281,7 @@ void RenderTableSection::setCellWidths()
}
cell->repaint();
}
- cell->updateWidth(w);
+ cell->updateLogicalWidth(w);
}
}
}
diff --git a/WebCore/rendering/style/RenderStyle.cpp b/WebCore/rendering/style/RenderStyle.cpp
index 3273821..a6e7d59 100644
--- a/WebCore/rendering/style/RenderStyle.cpp
+++ b/WebCore/rendering/style/RenderStyle.cpp
@@ -1148,6 +1148,52 @@ Length RenderStyle::logicalMaxHeight() const
return maxWidth();
}
+const BorderValue& RenderStyle::borderBefore() const
+{
+ switch (writingMode()) {
+ case TopToBottomWritingMode:
+ return borderTop();
+ case BottomToTopWritingMode:
+ return borderBottom();
+ case LeftToRightWritingMode:
+ return borderLeft();
+ case RightToLeftWritingMode:
+ return borderRight();
+ }
+ ASSERT_NOT_REACHED();
+ return borderTop();
+}
+
+const BorderValue& RenderStyle::borderAfter() const
+{
+ switch (writingMode()) {
+ case TopToBottomWritingMode:
+ return borderBottom();
+ case BottomToTopWritingMode:
+ return borderTop();
+ case LeftToRightWritingMode:
+ return borderRight();
+ case RightToLeftWritingMode:
+ return borderLeft();
+ }
+ ASSERT_NOT_REACHED();
+ return borderBottom();
+}
+
+const BorderValue& RenderStyle::borderStart() const
+{
+ if (isHorizontalWritingMode())
+ return isLeftToRightDirection() ? borderLeft() : borderRight();
+ return isLeftToRightDirection() ? borderTop() : borderBottom();
+}
+
+const BorderValue& RenderStyle::borderEnd() const
+{
+ if (isHorizontalWritingMode())
+ return isLeftToRightDirection() ? borderRight() : borderLeft();
+ return isLeftToRightDirection() ? borderBottom() : borderTop();
+}
+
unsigned short RenderStyle::borderBeforeWidth() const
{
switch (writingMode()) {
diff --git a/WebCore/rendering/style/RenderStyle.h b/WebCore/rendering/style/RenderStyle.h
index 2345e05..69a0828 100644
--- a/WebCore/rendering/style/RenderStyle.h
+++ b/WebCore/rendering/style/RenderStyle.h
@@ -404,6 +404,11 @@ public:
const BorderValue& borderTop() const { return surround->border.top(); }
const BorderValue& borderBottom() const { return surround->border.bottom(); }
+ const BorderValue& borderBefore() const;
+ const BorderValue& borderAfter() const;
+ const BorderValue& borderStart() const;
+ const BorderValue& borderEnd() const;
+
const NinePieceImage& borderImage() const { return surround->border.image(); }
const LengthSize& borderTopLeftRadius() const { return surround->border.topLeft(); }
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list