Changeset 71251 in webkit
- Timestamp:
- Nov 3, 2010 11:03:55 AM (13 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r71250 r71251 1 2010-11-03 Dan Bernstein <mitz@apple.com> 2 3 Reviewed by Dave Hyatt. 4 5 Make collapsed borders in tables work with different block flows 6 https://bugs.webkit.org/show_bug.cgi?id=46191 7 8 No new tests since tables don’t support different block flows yet. 9 10 This change still doesn’t support cells whose block flow differs from the table’s. 11 12 * rendering/AutoTableLayout.cpp: 13 (WebCore::AutoTableLayout::recalcColumn): Updated for the renaming of styleOrColWidth(). 14 (WebCore::AutoTableLayout::calcEffectiveWidth): Ditto. 15 * rendering/FixedTableLayout.cpp: 16 (WebCore::FixedTableLayout::calcWidthArray): Ditto. 17 * rendering/RenderBlock.cpp: 18 (WebCore::RenderBlock::computePreferredLogicalWidths): Ditto. 19 * rendering/RenderTableCell.cpp: 20 (WebCore::RenderTableCell::styleOrColLogicalWidth): Renamed styleOrColWidth() to this and 21 changed to use logical widths. 22 (WebCore::RenderTableCell::computePreferredLogicalWidths): Updated for the above rename. 23 (WebCore::RenderTableCell::updateLogicalWidth): Renamed updateWidth() to this and changed 24 to set the logical width. 25 (WebCore::RenderTableCell::collapsedStartBorder): Changed collapsedLeftBorder() into this. 26 Note that “start” here will refer to the table’s block flow, not the cell’s, once we allow 27 the two to differ. 28 (WebCore::RenderTableCell::collapsedEndBorder): Similar. 29 (WebCore::RenderTableCell::collapsedBeforeBorder): Similar. 30 (WebCore::RenderTableCell::collapsedAfterBorder): Similar. 31 (WebCore::RenderTableCell::collapsedLeftBorder): Resolves “left” to a logical side using 32 the table’s block flow. 33 (WebCore::RenderTableCell::collapsedRightBorder): Similar. 34 (WebCore::RenderTableCell::collapsedTopBorder): Similar. 35 (WebCore::RenderTableCell::collapsedBottomBorder): Similar. 36 (WebCore::RenderTableCell::borderStart): Use borderHalfStart(). 37 (WebCore::RenderTableCell::borderEnd): Similar. 38 (WebCore::RenderTableCell::borderBefore): Similar. 39 (WebCore::RenderTableCell::borderAfter): Similar. 40 (WebCore::RenderTableCell::borderHalfLeft): Resolves “left” to a logical side using the 41 table’s block flow. 42 (WebCore::RenderTableCell::borderHalfRight): Similar. 43 (WebCore::RenderTableCell::borderHalfTop): Similar. 44 (WebCore::RenderTableCell::borderHalfBottom): Similar. 45 (WebCore::RenderTableCell::borderHalfStart): Added. Uses collapsedStartBorder(). Splits odd 46 widths based on physical side. 47 (WebCore::RenderTableCell::borderHalfEnd): Similar. 48 (WebCore::RenderTableCell::borderHalfBefore): Similar. 49 (WebCore::RenderTableCell::borderHalfAfter): Similar. 50 (WebCore::RenderTableCell::collectBorderStyles): Use logical methods. 51 (WebCore::RenderTableCell::paintCollapsedBorder): Updated. 52 * rendering/RenderTableCell.h: 53 * rendering/RenderTableSection.cpp: 54 (WebCore::RenderTableSection::setCellWidths): Updated for the renaming of updateWidth(). 55 * rendering/style/RenderStyle.cpp: 56 (WebCore::RenderStyle::borderBefore): Added. 57 (WebCore::RenderStyle::borderAfter): Added. 58 (WebCore::RenderStyle::borderStart): Added. 59 (WebCore::RenderStyle::borderEnd): Adeed. 60 * rendering/style/RenderStyle.h: 61 1 62 2010-11-03 Dimitri Glazkov <dglazkov@chromium.org> 2 63 -
trunk/WebCore/rendering/AutoTableLayout.cpp
r71138 r71251 86 86 } 87 87 88 Length w = cell->styleOrCol Width();88 Length w = cell->styleOrColLogicalWidth(); 89 89 // FIXME: What is this arbitrary value? 90 90 if (w.rawValue() > 32760) … … 309 309 int span = cell->colSpan(); 310 310 311 Length w = cell->styleOrCol Width();311 Length w = cell->styleOrColLogicalWidth(); 312 312 if (!w.isRelative() && w.isZero()) 313 313 w = Length(); // make it Auto -
trunk/WebCore/rendering/FixedTableLayout.cpp
r68276 r71251 159 159 cell->computePreferredLogicalWidths(); 160 160 161 Length w = cell->styleOrCol Width();161 Length w = cell->styleOrColLogicalWidth(); 162 162 int span = cell->colSpan(); 163 163 int effWidth = 0; -
trunk/WebCore/rendering/RenderBlock.cpp
r71246 r71251 4713 4713 4714 4714 if (isTableCell()) { 4715 Length w = toRenderTableCell(this)->styleOrCol Width();4715 Length w = toRenderTableCell(this)->styleOrColLogicalWidth(); 4716 4716 if (w.isFixed() && w.value() > 0) 4717 4717 m_maxPreferredLogicalWidth = max(m_minPreferredLogicalWidth, computeContentBoxLogicalWidth(w.value())); -
trunk/WebCore/rendering/RenderTableCell.cpp
r70072 r71251 81 81 } 82 82 83 Length RenderTableCell::styleOrCol Width() const84 { 85 Length w = style()-> width();83 Length RenderTableCell::styleOrColLogicalWidth() const 84 { 85 Length w = style()->logicalWidth(); 86 86 if (!w.isAuto()) 87 87 return w; 88 88 89 RenderTableCol* tableCol = table()->colElement(col()); 90 91 if (tableCol) { 89 if (RenderTableCol* tableCol = table()->colElement(col())) { 92 90 int colSpanCount = colSpan(); 93 91 94 92 Length colWidthSum = Length(0, Fixed); 95 93 for (int i = 1; i <= colSpanCount; i++) { 96 Length colWidth = tableCol->style()-> width();94 Length colWidth = tableCol->style()->logicalWidth(); 97 95 98 96 // Percentage value should be returned only for colSpan == 1. … … 116 114 // See Bugzilla bug 8126 for details. 117 115 if (colWidthSum.isFixed() && colWidthSum.value() > 0) 118 colWidthSum = Length(max(0, colWidthSum.value() - borderAndPadding Width()), Fixed);116 colWidthSum = Length(max(0, colWidthSum.value() - borderAndPaddingLogicalWidth()), Fixed); 119 117 return colWidthSum; 120 118 } … … 133 131 if (node() && style()->autoWrap()) { 134 132 // See if nowrap was set. 135 Length w = styleOrCol Width();133 Length w = styleOrColLogicalWidth(); 136 134 String nowrap = static_cast<Element*>(node())->getAttribute(nowrapAttr); 137 135 if (!nowrap.isNull() && w.isFixed()) … … 149 147 } 150 148 151 void RenderTableCell::updateWidth(int w) 152 { 153 if (w != width()) { 154 setWidth(w); 155 setCellWidthChanged(true); 156 } 149 void RenderTableCell::updateLogicalWidth(int w) 150 { 151 if (w == logicalWidth()) 152 return; 153 154 setLogicalWidth(w); 155 setCellWidthChanged(true); 157 156 } 158 157 … … 385 384 } 386 385 387 CollapsedBorderValue RenderTableCell::collapsedLeftBorder(bool rtl) const 388 { 389 RenderTable* tableElt = table(); 390 bool leftmostColumn; 391 if (!rtl) 392 leftmostColumn = col() == 0; 393 else { 394 int effCol = tableElt->colToEffCol(col() + colSpan() - 1); 395 leftmostColumn = effCol == tableElt->numEffCols() - 1; 396 } 397 398 // For border left, we need to check, in order of precedence: 399 // (1) Our left border. 400 int left = CSSPropertyBorderLeftColor; 401 int right = CSSPropertyBorderRightColor; 402 CollapsedBorderValue result(&style()->borderLeft(), style()->visitedDependentColor(left), BCELL); 403 404 // (2) The right border of the cell to the left. 405 RenderTableCell* prevCell = rtl ? tableElt->cellAfter(this) : tableElt->cellBefore(this); 406 if (prevCell) { 407 CollapsedBorderValue prevCellBorder = CollapsedBorderValue(&prevCell->style()->borderRight(), prevCell->style()->visitedDependentColor(right), BCELL); 408 result = rtl ? chooseBorder(result, prevCellBorder) : chooseBorder(prevCellBorder, result); 409 if (!result.exists()) 410 return result; 411 } else if (leftmostColumn) { 412 // (3) Our row's left border. 413 result = chooseBorder(result, CollapsedBorderValue(&parent()->style()->borderLeft(), parent()->style()->visitedDependentColor(left), BROW)); 386 CollapsedBorderValue RenderTableCell::collapsedStartBorder() const 387 { 388 RenderTable* table = this->table(); 389 bool isStartColumn = col() == 0; 390 391 // For the start border, we need to check, in order of precedence: 392 // (1) Our start border. 393 int start = CSSProperty::resolveDirectionAwareProperty(CSSPropertyWebkitBorderStartColor, table->style()->direction(), table->style()->writingMode()); 394 int end = CSSProperty::resolveDirectionAwareProperty(CSSPropertyWebkitBorderEndColor, table->style()->direction(), table->style()->writingMode()); 395 CollapsedBorderValue result(&style()->borderStart(), style()->visitedDependentColor(start), BCELL); 396 397 // (2) The end border of the preceding cell. 398 if (RenderTableCell* prevCell = table->cellBefore(this)) { 399 CollapsedBorderValue prevCellBorder = CollapsedBorderValue(&prevCell->style()->borderEnd(), prevCell->style()->visitedDependentColor(end), BCELL); 400 result = chooseBorder(prevCellBorder, result); 401 if (!result.exists()) 402 return result; 403 } else if (isStartColumn) { 404 // (3) Our row's start border. 405 result = chooseBorder(result, CollapsedBorderValue(&parent()->style()->borderStart(), parent()->style()->visitedDependentColor(start), BROW)); 414 406 if (!result.exists()) 415 407 return result; 416 408 417 // (4) Our row group's left border.418 result = chooseBorder(result, CollapsedBorderValue(§ion()->style()->border Left(), section()->style()->visitedDependentColor(left), BROWGROUP));419 if (!result.exists()) 420 return result; 421 } 422 423 // (5) Our column and column group's left borders.409 // (4) Our row group's start border. 410 result = chooseBorder(result, CollapsedBorderValue(§ion()->style()->borderStart(), section()->style()->visitedDependentColor(start), BROWGROUP)); 411 if (!result.exists()) 412 return result; 413 } 414 415 // (5) Our column and column group's start borders. 424 416 bool startColEdge; 425 417 bool endColEdge; 426 RenderTableCol* colElt = table Elt->colElement(col() + (rtl ? colSpan() - 1 : 0), &startColEdge, &endColEdge);427 if (colElt && (!rtl ? startColEdge : endColEdge)) {428 result = chooseBorder(result, CollapsedBorderValue(&colElt->style()->border Left(), colElt->style()->visitedDependentColor(left), BCOL));429 if (!result.exists()) 430 return result; 431 if (colElt->parent()->isTableCol() && (!rtl ? !colElt->previousSibling() : !colElt->nextSibling())) {432 result = chooseBorder(result, CollapsedBorderValue(&colElt->parent()->style()->border Left(), colElt->parent()->style()->visitedDependentColor(left), BCOLGROUP));418 RenderTableCol* colElt = table->colElement(col(), &startColEdge, &endColEdge); 419 if (colElt && startColEdge) { 420 result = chooseBorder(result, CollapsedBorderValue(&colElt->style()->borderStart(), colElt->style()->visitedDependentColor(start), BCOL)); 421 if (!result.exists()) 422 return result; 423 if (colElt->parent()->isTableCol() && !colElt->previousSibling()) { 424 result = chooseBorder(result, CollapsedBorderValue(&colElt->parent()->style()->borderStart(), colElt->parent()->style()->visitedDependentColor(start), BCOLGROUP)); 433 425 if (!result.exists()) 434 426 return result; … … 436 428 } 437 429 438 // (6) The right border of the column to the left.439 if (! leftmostColumn) {440 colElt = table Elt->colElement(col() + (rtl ? colSpan() : -1), &startColEdge, &endColEdge);441 if (colElt && (!rtl ? endColEdge : startColEdge)) {442 CollapsedBorderValue rightBorder = CollapsedBorderValue(&colElt->style()->borderRight(), colElt->style()->visitedDependentColor(right), BCOL);443 result = rtl ? chooseBorder(result, rightBorder) : chooseBorder(rightBorder, result);430 // (6) The end border of the preceding column. 431 if (!isStartColumn) { 432 colElt = table->colElement(col() -1, &startColEdge, &endColEdge); 433 if (colElt && endColEdge) { 434 CollapsedBorderValue endBorder = CollapsedBorderValue(&colElt->style()->borderEnd(), colElt->style()->visitedDependentColor(end), BCOL); 435 result = chooseBorder(endBorder, result); 444 436 if (!result.exists()) 445 437 return result; 446 438 } 447 439 } else { 448 // (7) The table's left border.449 result = chooseBorder(result, CollapsedBorderValue(&table Elt->style()->borderLeft(), tableElt->style()->visitedDependentColor(left), BTABLE));440 // (7) The table's start border. 441 result = chooseBorder(result, CollapsedBorderValue(&table->style()->borderStart(), table->style()->visitedDependentColor(start), BTABLE)); 450 442 if (!result.exists()) 451 443 return result; … … 455 447 } 456 448 457 CollapsedBorderValue RenderTableCell::collapsedRightBorder(bool rtl) const 458 { 459 RenderTable* tableElt = table(); 460 bool rightmostColumn; 461 if (rtl) 462 rightmostColumn = col() == 0; 463 else { 464 int effCol = tableElt->colToEffCol(col() + colSpan() - 1); 465 rightmostColumn = effCol == tableElt->numEffCols() - 1; 466 } 467 468 // For border right, we need to check, in order of precedence: 469 // (1) Our right border. 470 int left = CSSPropertyBorderLeftColor; 471 int right = CSSPropertyBorderRightColor; 472 CollapsedBorderValue result = CollapsedBorderValue(&style()->borderRight(), style()->visitedDependentColor(right), BCELL); 473 474 // (2) The left border of the cell to the right. 475 if (!rightmostColumn) { 476 RenderTableCell* nextCell = rtl ? tableElt->cellBefore(this) : tableElt->cellAfter(this); 449 CollapsedBorderValue RenderTableCell::collapsedEndBorder() const 450 { 451 RenderTable* table = this->table(); 452 bool isEndColumn = table->colToEffCol(col() + colSpan() - 1) == table->numEffCols() - 1; 453 454 // For end border, we need to check, in order of precedence: 455 // (1) Our end border. 456 int start = CSSProperty::resolveDirectionAwareProperty(CSSPropertyWebkitBorderStartColor, table->style()->direction(), table->style()->writingMode()); 457 int end = CSSProperty::resolveDirectionAwareProperty(CSSPropertyWebkitBorderEndColor, table->style()->direction(), table->style()->writingMode()); 458 CollapsedBorderValue result = CollapsedBorderValue(&style()->borderEnd(), style()->visitedDependentColor(end), BCELL); 459 460 // (2) The start border of the following cell. 461 if (!isEndColumn) { 462 RenderTableCell* nextCell = table->cellAfter(this); 477 463 if (nextCell && nextCell->style()) { 478 CollapsedBorderValue leftBorder = CollapsedBorderValue(&nextCell->style()->borderLeft(), nextCell->style()->visitedDependentColor(left), BCELL);479 result = rtl ? chooseBorder(leftBorder, result) : chooseBorder(result, leftBorder);464 CollapsedBorderValue startBorder = CollapsedBorderValue(&nextCell->style()->borderStart(), nextCell->style()->visitedDependentColor(start), BCELL); 465 result = chooseBorder(result, startBorder); 480 466 if (!result.exists()) 481 467 return result; 482 468 } 483 469 } else { 484 // (3) Our row's rightborder.485 result = chooseBorder(result, CollapsedBorderValue(&parent()->style()->border Right(), parent()->style()->visitedDependentColor(right), BROW));470 // (3) Our row's end border. 471 result = chooseBorder(result, CollapsedBorderValue(&parent()->style()->borderEnd(), parent()->style()->visitedDependentColor(end), BROW)); 486 472 if (!result.exists()) 487 473 return result; 488 474 489 // (4) Our row group's rightborder.490 result = chooseBorder(result, CollapsedBorderValue(§ion()->style()->border Right(), section()->style()->visitedDependentColor(right), BROWGROUP));491 if (!result.exists()) 492 return result; 493 } 494 495 // (5) Our column and column group's rightborders.475 // (4) Our row group's end border. 476 result = chooseBorder(result, CollapsedBorderValue(§ion()->style()->borderEnd(), section()->style()->visitedDependentColor(end), BROWGROUP)); 477 if (!result.exists()) 478 return result; 479 } 480 481 // (5) Our column and column group's end borders. 496 482 bool startColEdge; 497 483 bool endColEdge; 498 RenderTableCol* colElt = table Elt->colElement(col() + (rtl ? 0 : colSpan() - 1), &startColEdge, &endColEdge);499 if (colElt && (!rtl ? endColEdge : startColEdge)) {500 result = chooseBorder(result, CollapsedBorderValue(&colElt->style()->border Right(), colElt->style()->visitedDependentColor(right), BCOL));501 if (!result.exists()) 502 return result; 503 if (colElt->parent()->isTableCol() && (!rtl ? !colElt->nextSibling() : !colElt->previousSibling())) {504 result = chooseBorder(result, CollapsedBorderValue(&colElt->parent()->style()->border Right(), colElt->parent()->style()->visitedDependentColor(right), BCOLGROUP));484 RenderTableCol* colElt = table->colElement(col() + colSpan() - 1, &startColEdge, &endColEdge); 485 if (colElt && endColEdge) { 486 result = chooseBorder(result, CollapsedBorderValue(&colElt->style()->borderEnd(), colElt->style()->visitedDependentColor(end), BCOL)); 487 if (!result.exists()) 488 return result; 489 if (colElt->parent()->isTableCol() && !colElt->nextSibling()) { 490 result = chooseBorder(result, CollapsedBorderValue(&colElt->parent()->style()->borderEnd(), colElt->parent()->style()->visitedDependentColor(end), BCOLGROUP)); 505 491 if (!result.exists()) 506 492 return result; … … 508 494 } 509 495 510 // (6) The left border of the column to the right.511 if (! rightmostColumn) {512 colElt = table Elt->colElement(col() + (rtl ? -1 : colSpan()), &startColEdge, &endColEdge);513 if (colElt && (!rtl ? startColEdge : endColEdge)) {514 CollapsedBorderValue leftBorder = CollapsedBorderValue(&colElt->style()->borderLeft(), colElt->style()->visitedDependentColor(left), BCOL);515 result = rtl ? chooseBorder(leftBorder, result) : chooseBorder(result, leftBorder);496 // (6) The start border of the next column. 497 if (!isEndColumn) { 498 colElt = table->colElement(col() + colSpan(), &startColEdge, &endColEdge); 499 if (colElt && startColEdge) { 500 CollapsedBorderValue startBorder = CollapsedBorderValue(&colElt->style()->borderStart(), colElt->style()->visitedDependentColor(start), BCOL); 501 result = chooseBorder(result, startBorder); 516 502 if (!result.exists()) 517 503 return result; 518 504 } 519 505 } else { 520 // (7) The table's rightborder.521 result = chooseBorder(result, CollapsedBorderValue(&table Elt->style()->borderRight(), tableElt->style()->visitedDependentColor(right), BTABLE));506 // (7) The table's end border. 507 result = chooseBorder(result, CollapsedBorderValue(&table->style()->borderEnd(), table->style()->visitedDependentColor(end), BTABLE)); 522 508 if (!result.exists()) 523 509 return result; … … 527 513 } 528 514 529 CollapsedBorderValue RenderTableCell::collapsedTopBorder() const 530 { 531 // For border top, we need to check, in order of precedence: 532 // (1) Our top border. 533 int top = CSSPropertyBorderTopColor; 534 int bottom = CSSPropertyBorderBottomColor; 535 CollapsedBorderValue result = CollapsedBorderValue(&style()->borderTop(), style()->visitedDependentColor(top), BCELL); 536 537 RenderTableCell* prevCell = table()->cellAbove(this); 515 CollapsedBorderValue RenderTableCell::collapsedBeforeBorder() const 516 { 517 RenderTable* table = this->table(); 518 519 // For before border, we need to check, in order of precedence: 520 // (1) Our before border. 521 int before = CSSProperty::resolveDirectionAwareProperty(CSSPropertyWebkitBorderBeforeColor, table->style()->direction(), table->style()->writingMode()); 522 int after = CSSProperty::resolveDirectionAwareProperty(CSSPropertyWebkitBorderAfterColor, table->style()->direction(), table->style()->writingMode()); 523 CollapsedBorderValue result = CollapsedBorderValue(&style()->borderBefore(), style()->visitedDependentColor(before), BCELL); 524 525 RenderTableCell* prevCell = table->cellAbove(this); 538 526 if (prevCell) { 539 // (2) A previous cell's bottomborder.540 result = chooseBorder(CollapsedBorderValue(&prevCell->style()->border Bottom(), prevCell->style()->visitedDependentColor(bottom), BCELL), result);541 if (!result.exists()) 542 return result; 543 } 544 545 // (3) Our row's topborder.546 result = chooseBorder(result, CollapsedBorderValue(&parent()->style()->border Top(), parent()->style()->visitedDependentColor(top), BROW));527 // (2) A before cell's after border. 528 result = chooseBorder(CollapsedBorderValue(&prevCell->style()->borderAfter(), prevCell->style()->visitedDependentColor(after), BCELL), result); 529 if (!result.exists()) 530 return result; 531 } 532 533 // (3) Our row's before border. 534 result = chooseBorder(result, CollapsedBorderValue(&parent()->style()->borderBefore(), parent()->style()->visitedDependentColor(before), BROW)); 547 535 if (!result.exists()) 548 536 return result; 549 537 550 // (4) The previous row's bottomborder.538 // (4) The previous row's after border. 551 539 if (prevCell) { 552 540 RenderObject* prevRow = 0; … … 557 545 558 546 if (prevRow) { 559 result = chooseBorder(CollapsedBorderValue(&prevRow->style()->border Bottom(), prevRow->style()->visitedDependentColor(bottom), BROW), result);547 result = chooseBorder(CollapsedBorderValue(&prevRow->style()->borderAfter(), prevRow->style()->visitedDependentColor(after), BROW), result); 560 548 if (!result.exists()) 561 549 return result; … … 566 554 RenderTableSection* currSection = section(); 567 555 if (!row()) { 568 // (5) Our row group's topborder.569 result = chooseBorder(result, CollapsedBorderValue(&currSection->style()->border Top(), currSection->style()->visitedDependentColor(top), BROWGROUP));556 // (5) Our row group's before border. 557 result = chooseBorder(result, CollapsedBorderValue(&currSection->style()->borderBefore(), currSection->style()->visitedDependentColor(before), BROWGROUP)); 570 558 if (!result.exists()) 571 559 return result; 572 560 573 // (6) Previous row group's bottomborder.574 currSection = table ()->sectionAbove(currSection);561 // (6) Previous row group's after border. 562 currSection = table->sectionAbove(currSection); 575 563 if (currSection) { 576 result = chooseBorder(CollapsedBorderValue(&currSection->style()->border Bottom(), currSection->style()->visitedDependentColor(bottom), BROWGROUP), result);564 result = chooseBorder(CollapsedBorderValue(&currSection->style()->borderAfter(), currSection->style()->visitedDependentColor(after), BROWGROUP), result); 577 565 if (!result.exists()) 578 566 return result; … … 581 569 582 570 if (!currSection) { 583 // (8) Our column and column group's topborders.584 RenderTableCol* colElt = table ()->colElement(col());571 // (8) Our column and column group's before borders. 572 RenderTableCol* colElt = table->colElement(col()); 585 573 if (colElt) { 586 result = chooseBorder(result, CollapsedBorderValue(&colElt->style()->border Top(), colElt->style()->visitedDependentColor(top), BCOL));574 result = chooseBorder(result, CollapsedBorderValue(&colElt->style()->borderBefore(), colElt->style()->visitedDependentColor(before), BCOL)); 587 575 if (!result.exists()) 588 576 return result; 589 577 if (colElt->parent()->isTableCol()) { 590 result = chooseBorder(result, CollapsedBorderValue(&colElt->parent()->style()->border Top(), colElt->parent()->style()->visitedDependentColor(top), BCOLGROUP));578 result = chooseBorder(result, CollapsedBorderValue(&colElt->parent()->style()->borderBefore(), colElt->parent()->style()->visitedDependentColor(before), BCOLGROUP)); 591 579 if (!result.exists()) 592 580 return result; … … 594 582 } 595 583 596 // (9) The table's top border. 597 RenderTable* enclosingTable = table(); 598 result = chooseBorder(result, CollapsedBorderValue(&enclosingTable->style()->borderTop(), enclosingTable->style()->visitedDependentColor(top), BTABLE)); 584 // (9) The table's before border. 585 result = chooseBorder(result, CollapsedBorderValue(&table->style()->borderBefore(), table->style()->visitedDependentColor(before), BTABLE)); 599 586 if (!result.exists()) 600 587 return result; … … 604 591 } 605 592 606 CollapsedBorderValue RenderTableCell::collapsedBottomBorder() const 607 { 608 // For border top, we need to check, in order of precedence: 609 // (1) Our bottom border. 610 int top = CSSPropertyBorderTopColor; 611 int bottom = CSSPropertyBorderBottomColor; 612 CollapsedBorderValue result = CollapsedBorderValue(&style()->borderBottom(), style()->visitedDependentColor(bottom), BCELL); 613 614 RenderTableCell* nextCell = table()->cellBelow(this); 593 CollapsedBorderValue RenderTableCell::collapsedAfterBorder() const 594 { 595 RenderTable* table = this->table(); 596 597 // For after border, we need to check, in order of precedence: 598 // (1) Our after border. 599 int before = CSSProperty::resolveDirectionAwareProperty(CSSPropertyWebkitBorderBeforeColor, table->style()->direction(), table->style()->writingMode()); 600 int after = CSSProperty::resolveDirectionAwareProperty(CSSPropertyWebkitBorderAfterColor, table->style()->direction(), table->style()->writingMode()); 601 CollapsedBorderValue result = CollapsedBorderValue(&style()->borderAfter(), style()->visitedDependentColor(after), BCELL); 602 603 RenderTableCell* nextCell = table->cellBelow(this); 615 604 if (nextCell) { 616 // (2) A following cell's topborder.617 result = chooseBorder(result, CollapsedBorderValue(&nextCell->style()->border Top(), nextCell->style()->visitedDependentColor(top), BCELL));618 if (!result.exists()) 619 return result; 620 } 621 622 // (3) Our row's bottomborder. (FIXME: Deal with rowspan!)623 result = chooseBorder(result, CollapsedBorderValue(&parent()->style()->border Bottom(), parent()->style()->visitedDependentColor(bottom), BROW));605 // (2) An after cell's before border. 606 result = chooseBorder(result, CollapsedBorderValue(&nextCell->style()->borderBefore(), nextCell->style()->visitedDependentColor(before), BCELL)); 607 if (!result.exists()) 608 return result; 609 } 610 611 // (3) Our row's after border. (FIXME: Deal with rowspan!) 612 result = chooseBorder(result, CollapsedBorderValue(&parent()->style()->borderAfter(), parent()->style()->visitedDependentColor(after), BROW)); 624 613 if (!result.exists()) 625 614 return result; 626 615 627 // (4) The next row's topborder.616 // (4) The next row's before border. 628 617 if (nextCell) { 629 result = chooseBorder(result, CollapsedBorderValue(&nextCell->parent()->style()->border Top(), nextCell->parent()->style()->visitedDependentColor(top), BROW));618 result = chooseBorder(result, CollapsedBorderValue(&nextCell->parent()->style()->borderBefore(), nextCell->parent()->style()->visitedDependentColor(before), BROW)); 630 619 if (!result.exists()) 631 620 return result; … … 635 624 RenderTableSection* currSection = section(); 636 625 if (row() + rowSpan() >= currSection->numRows()) { 637 // (5) Our row group's bottomborder.638 result = chooseBorder(result, CollapsedBorderValue(&currSection->style()->border Bottom(), currSection->style()->visitedDependentColor(bottom), BROWGROUP));626 // (5) Our row group's after border. 627 result = chooseBorder(result, CollapsedBorderValue(&currSection->style()->borderAfter(), currSection->style()->visitedDependentColor(after), BROWGROUP)); 639 628 if (!result.exists()) 640 629 return result; 641 630 642 // (6) Following row group's topborder.643 currSection = table ()->sectionBelow(currSection);631 // (6) Following row group's before border. 632 currSection = table->sectionBelow(currSection); 644 633 if (currSection) { 645 result = chooseBorder(result, CollapsedBorderValue(&currSection->style()->border Top(), currSection->style()->visitedDependentColor(top), BROWGROUP));634 result = chooseBorder(result, CollapsedBorderValue(&currSection->style()->borderBefore(), currSection->style()->visitedDependentColor(before), BROWGROUP)); 646 635 if (!result.exists()) 647 636 return result; … … 650 639 651 640 if (!currSection) { 652 // (8) Our column and column group's bottomborders.653 RenderTableCol* colElt = table ()->colElement(col());641 // (8) Our column and column group's after borders. 642 RenderTableCol* colElt = table->colElement(col()); 654 643 if (colElt) { 655 result = chooseBorder(result, CollapsedBorderValue(&colElt->style()->border Bottom(), colElt->style()->visitedDependentColor(bottom), BCOL));644 result = chooseBorder(result, CollapsedBorderValue(&colElt->style()->borderAfter(), colElt->style()->visitedDependentColor(after), BCOL)); 656 645 if (!result.exists()) return result; 657 646 if (colElt->parent()->isTableCol()) { 658 result = chooseBorder(result, CollapsedBorderValue(&colElt->parent()->style()->border Bottom(), colElt->parent()->style()->visitedDependentColor(bottom), BCOLGROUP));647 result = chooseBorder(result, CollapsedBorderValue(&colElt->parent()->style()->borderAfter(), colElt->parent()->style()->visitedDependentColor(after), BCOLGROUP)); 659 648 if (!result.exists()) 660 649 return result; … … 662 651 } 663 652 664 // (9) The table's bottom border. 665 RenderTable* enclosingTable = table(); 666 result = chooseBorder(result, CollapsedBorderValue(&enclosingTable->style()->borderBottom(), enclosingTable->style()->visitedDependentColor(bottom), BTABLE)); 653 // (9) The table's after border. 654 result = chooseBorder(result, CollapsedBorderValue(&table->style()->borderAfter(), table->style()->visitedDependentColor(after), BTABLE)); 667 655 if (!result.exists()) 668 656 return result; … … 670 658 671 659 return result; 660 } 661 662 CollapsedBorderValue RenderTableCell::collapsedLeftBorder() const 663 { 664 RenderStyle* tableStyle = table()->style(); 665 if (tableStyle->isHorizontalWritingMode()) 666 return tableStyle->isLeftToRightDirection() ? collapsedStartBorder() : collapsedEndBorder(); 667 return tableStyle->isFlippedBlocksWritingMode() ? collapsedAfterBorder() : collapsedBeforeBorder(); 668 } 669 670 CollapsedBorderValue RenderTableCell::collapsedRightBorder() const 671 { 672 RenderStyle* tableStyle = table()->style(); 673 if (tableStyle->isHorizontalWritingMode()) 674 return tableStyle->isLeftToRightDirection() ? collapsedEndBorder() : collapsedStartBorder(); 675 return tableStyle->isFlippedBlocksWritingMode() ? collapsedBeforeBorder() : collapsedAfterBorder(); 676 } 677 678 CollapsedBorderValue RenderTableCell::collapsedTopBorder() const 679 { 680 RenderStyle* tableStyle = table()->style(); 681 if (tableStyle->isHorizontalWritingMode()) 682 return tableStyle->isFlippedBlocksWritingMode() ? collapsedAfterBorder() : collapsedBeforeBorder(); 683 return tableStyle->isLeftToRightDirection() ? collapsedStartBorder() : collapsedEndBorder(); 684 } 685 686 CollapsedBorderValue RenderTableCell::collapsedBottomBorder() const 687 { 688 RenderStyle* tableStyle = table()->style(); 689 if (tableStyle->isHorizontalWritingMode()) 690 return tableStyle->isFlippedBlocksWritingMode() ? collapsedBeforeBorder() : collapsedAfterBorder(); 691 return tableStyle->isLeftToRightDirection() ? collapsedEndBorder() : collapsedStartBorder(); 672 692 } 673 693 … … 696 716 int RenderTableCell::borderStart() const 697 717 { 698 return table()->collapseBorders() ? borderHalf Left(false) : RenderBlock::borderStart();718 return table()->collapseBorders() ? borderHalfStart(false) : RenderBlock::borderStart(); 699 719 } 700 720 701 721 int RenderTableCell::borderEnd() const 702 722 { 703 return table()->collapseBorders() ? borderHalf Right(false) : RenderBlock::borderEnd();723 return table()->collapseBorders() ? borderHalfEnd(false) : RenderBlock::borderEnd(); 704 724 } 705 725 706 726 int RenderTableCell::borderBefore() const 707 727 { 708 return table()->collapseBorders() ? borderHalf Top(false) : RenderBlock::borderBefore();728 return table()->collapseBorders() ? borderHalfBefore(false) : RenderBlock::borderBefore(); 709 729 } 710 730 711 731 int RenderTableCell::borderAfter() const 712 732 { 713 return table()->collapseBorders() ? borderHalf Bottom(false) : RenderBlock::borderAfter();733 return table()->collapseBorders() ? borderHalfAfter(false) : RenderBlock::borderAfter(); 714 734 } 715 735 716 736 int RenderTableCell::borderHalfLeft(bool outer) const 717 737 { 718 CollapsedBorderValue border = collapsedLeftBorder(!table()->style()->isLeftToRightDirection()); 738 RenderStyle* tableStyle = table()->style(); 739 if (tableStyle->isHorizontalWritingMode()) 740 return tableStyle->isLeftToRightDirection() ? borderHalfStart(outer) : borderHalfEnd(outer); 741 return tableStyle->isFlippedBlocksWritingMode() ? borderHalfAfter(outer) : borderHalfBefore(outer); 742 } 743 744 int RenderTableCell::borderHalfRight(bool outer) const 745 { 746 RenderStyle* tableStyle = table()->style(); 747 if (tableStyle->isHorizontalWritingMode()) 748 return tableStyle->isLeftToRightDirection() ? borderHalfEnd(outer) : borderHalfStart(outer); 749 return tableStyle->isFlippedBlocksWritingMode() ? borderHalfBefore(outer) : borderHalfAfter(outer); 750 } 751 752 int RenderTableCell::borderHalfTop(bool outer) const 753 { 754 RenderStyle* tableStyle = table()->style(); 755 if (tableStyle->isHorizontalWritingMode()) 756 return tableStyle->isFlippedBlocksWritingMode() ? borderHalfAfter(outer) : borderHalfBefore(outer); 757 return tableStyle->isLeftToRightDirection() ? borderHalfStart(outer) : borderHalfEnd(outer); 758 } 759 760 int RenderTableCell::borderHalfBottom(bool outer) const 761 { 762 RenderStyle* tableStyle = table()->style(); 763 if (tableStyle->isHorizontalWritingMode()) 764 return tableStyle->isFlippedBlocksWritingMode() ? borderHalfBefore(outer) : borderHalfAfter(outer); 765 return tableStyle->isLeftToRightDirection() ? borderHalfEnd(outer) : borderHalfStart(outer); 766 } 767 768 int RenderTableCell::borderHalfStart(bool outer) const 769 { 770 CollapsedBorderValue border = collapsedStartBorder(); 719 771 if (border.exists()) 720 return (border.width() + ( outer ? 0 : 1)) / 2; // Give the extra pixel to top and left.772 return (border.width() + ((table()->style()->isLeftToRightDirection() ^ outer) ? 1 : 0)) / 2; // Give the extra pixel to top and left. 721 773 return 0; 722 774 } 723 775 724 int RenderTableCell::borderHalf Right(bool outer) const725 { 726 CollapsedBorderValue border = collapsed RightBorder(!table()->style()->isLeftToRightDirection());776 int RenderTableCell::borderHalfEnd(bool outer) const 777 { 778 CollapsedBorderValue border = collapsedEndBorder(); 727 779 if (border.exists()) 728 return (border.width() + ( outer ? 1 : 0)) / 2;780 return (border.width() + ((table()->style()->isLeftToRightDirection() ^ outer) ? 0 : 1)) / 2; 729 781 return 0; 730 782 } 731 783 732 int RenderTableCell::borderHalf Top(bool outer) const733 { 734 CollapsedBorderValue border = collapsed TopBorder();784 int RenderTableCell::borderHalfBefore(bool outer) const 785 { 786 CollapsedBorderValue border = collapsedBeforeBorder(); 735 787 if (border.exists()) 736 return (border.width() + ( outer? 0 : 1)) / 2; // Give the extra pixel to top and left.788 return (border.width() + ((table()->style()->isFlippedBlocksWritingMode() ^ outer) ? 0 : 1)) / 2; // Give the extra pixel to top and left. 737 789 return 0; 738 790 } 739 791 740 int RenderTableCell::borderHalf Bottom(bool outer) const741 { 742 CollapsedBorderValue border = collapsed BottomBorder();792 int RenderTableCell::borderHalfAfter(bool outer) const 793 { 794 CollapsedBorderValue border = collapsedAfterBorder(); 743 795 if (border.exists()) 744 return (border.width() + ( outer? 1 : 0)) / 2;796 return (border.width() + ((table()->style()->isFlippedBlocksWritingMode() ^ outer) ? 1 : 0)) / 2; 745 797 return 0; 746 798 } … … 836 888 void RenderTableCell::collectBorderStyles(CollapsedBorderStyles& borderStyles) const 837 889 { 838 bool rtl = !table()->style()->isLeftToRightDirection(); 839 addBorderStyle(borderStyles, collapsedLeftBorder(rtl)); 840 addBorderStyle(borderStyles, collapsedRightBorder(rtl)); 841 addBorderStyle(borderStyles, collapsedTopBorder()); 842 addBorderStyle(borderStyles, collapsedBottomBorder()); 890 addBorderStyle(borderStyles, collapsedStartBorder()); 891 addBorderStyle(borderStyles, collapsedEndBorder()); 892 addBorderStyle(borderStyles, collapsedBeforeBorder()); 893 addBorderStyle(borderStyles, collapsedAfterBorder()); 843 894 } 844 895 … … 863 914 return; 864 915 865 bool rtl = !table()->style()->isLeftToRightDirection(); 866 CollapsedBorderValue leftVal = collapsedLeftBorder(rtl); 867 CollapsedBorderValue rightVal = collapsedRightBorder(rtl); 916 CollapsedBorderValue leftVal = collapsedLeftBorder(); 917 CollapsedBorderValue rightVal = collapsedRightBorder(); 868 918 CollapsedBorderValue topVal = collapsedTopBorder(); 869 919 CollapsedBorderValue bottomVal = collapsedBottomBorder(); -
trunk/WebCore/rendering/RenderTableCell.h
r70072 r71251 52 52 RenderTable* table() const { return toRenderTable(parent()->parent()->parent()); } 53 53 54 Length styleOrCol Width() const;54 Length styleOrColLogicalWidth() const; 55 55 56 56 virtual void computePreferredLogicalWidths(); 57 57 58 void update Width(int);58 void updateLogicalWidth(int); 59 59 60 60 virtual int borderLeft() const; … … 72 72 int borderHalfBottom(bool outer) const; 73 73 74 CollapsedBorderValue collapsedLeftBorder(bool rtl) const; 75 CollapsedBorderValue collapsedRightBorder(bool rtl) const; 74 int borderHalfStart(bool outer) const; 75 int borderHalfEnd(bool outer) const; 76 int borderHalfBefore(bool outer) const; 77 int borderHalfAfter(bool outer) const; 78 79 CollapsedBorderValue collapsedStartBorder() const; 80 CollapsedBorderValue collapsedEndBorder() const; 81 CollapsedBorderValue collapsedBeforeBorder() const; 82 CollapsedBorderValue collapsedAfterBorder() const; 83 84 CollapsedBorderValue collapsedLeftBorder() const; 85 CollapsedBorderValue collapsedRightBorder() const; 76 86 CollapsedBorderValue collapsedTopBorder() const; 77 87 CollapsedBorderValue collapsedBottomBorder() const; -
trunk/WebCore/rendering/RenderTableSection.cpp
r70170 r71251 282 282 cell->repaint(); 283 283 } 284 cell->update Width(w);284 cell->updateLogicalWidth(w); 285 285 } 286 286 } -
trunk/WebCore/rendering/style/RenderStyle.cpp
r71218 r71251 1149 1149 } 1150 1150 1151 const BorderValue& RenderStyle::borderBefore() const 1152 { 1153 switch (writingMode()) { 1154 case TopToBottomWritingMode: 1155 return borderTop(); 1156 case BottomToTopWritingMode: 1157 return borderBottom(); 1158 case LeftToRightWritingMode: 1159 return borderLeft(); 1160 case RightToLeftWritingMode: 1161 return borderRight(); 1162 } 1163 ASSERT_NOT_REACHED(); 1164 return borderTop(); 1165 } 1166 1167 const BorderValue& RenderStyle::borderAfter() const 1168 { 1169 switch (writingMode()) { 1170 case TopToBottomWritingMode: 1171 return borderBottom(); 1172 case BottomToTopWritingMode: 1173 return borderTop(); 1174 case LeftToRightWritingMode: 1175 return borderRight(); 1176 case RightToLeftWritingMode: 1177 return borderLeft(); 1178 } 1179 ASSERT_NOT_REACHED(); 1180 return borderBottom(); 1181 } 1182 1183 const BorderValue& RenderStyle::borderStart() const 1184 { 1185 if (isHorizontalWritingMode()) 1186 return isLeftToRightDirection() ? borderLeft() : borderRight(); 1187 return isLeftToRightDirection() ? borderTop() : borderBottom(); 1188 } 1189 1190 const BorderValue& RenderStyle::borderEnd() const 1191 { 1192 if (isHorizontalWritingMode()) 1193 return isLeftToRightDirection() ? borderRight() : borderLeft(); 1194 return isLeftToRightDirection() ? borderBottom() : borderTop(); 1195 } 1196 1151 1197 unsigned short RenderStyle::borderBeforeWidth() const 1152 1198 { -
trunk/WebCore/rendering/style/RenderStyle.h
r71218 r71251 404 404 const BorderValue& borderTop() const { return surround->border.top(); } 405 405 const BorderValue& borderBottom() const { return surround->border.bottom(); } 406 407 const BorderValue& borderBefore() const; 408 const BorderValue& borderAfter() const; 409 const BorderValue& borderStart() const; 410 const BorderValue& borderEnd() const; 406 411 407 412 const NinePieceImage& borderImage() const { return surround->border.image(); }
Note: See TracChangeset
for help on using the changeset viewer.