⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rendertablecell.cpp

📁 linux下开源浏览器WebKit的源码,市面上的很多商用浏览器都是移植自WebKit
💻 CPP
📖 第 1 页 / 共 3 页
字号:
    if (border1.style() == BHIDDEN || border2.style() == BHIDDEN)        return CollapsedBorderValue(); // No border should exist at this location.        // Rule #2 above.  A style of 'none' has lowest priority and always loses to any other border.    if (border2.style() == BNONE)        return border1;    if (border1.style() == BNONE)        return border2;    // The first part of rule #3 above. Wider borders win.    if (border1.width() != border2.width())        return border1.width() > border2.width() ? border1 : border2;        // The borders have equal width.  Sort by border style.    if (border1.style() != border2.style())        return border1.style() > border2.style() ? border1 : border2;        // The border have the same width and style.  Rely on precedence (cell over row over row group, etc.)    return border1.precedence >= border2.precedence ? border1 : border2;}CollapsedBorderValue RenderTableCell::collapsedLeftBorder(bool rtl) 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.    CollapsedBorderValue result(&style()->borderLeft(), BCELL);        // (2) The right border of the cell to the left.    RenderTableCell* prevCell = rtl ? tableElt->cellAfter(this) : tableElt->cellBefore(this);    if (prevCell) {        result = rtl ? compareBorders(result, CollapsedBorderValue(&prevCell->style()->borderRight(), BCELL)) : compareBorders(CollapsedBorderValue(&prevCell->style()->borderRight(), BCELL), result);        if (!result.exists())            return result;    } else if (leftmostColumn) {        // (3) Our row's left border.        result = compareBorders(result, CollapsedBorderValue(&parent()->style()->borderLeft(), BROW));        if (!result.exists())            return result;                // (4) Our row group's left border.        result = compareBorders(result, CollapsedBorderValue(&section()->style()->borderLeft(), BROWGROUP));        if (!result.exists())            return result;    }        // (5) Our column and column group's left borders.    bool startColEdge;    bool endColEdge;    RenderTableCol* colElt = tableElt->colElement(col() + (rtl ? colSpan() - 1 : 0), &startColEdge, &endColEdge);    if (colElt && (!rtl ? startColEdge : endColEdge)) {        result = compareBorders(result, CollapsedBorderValue(&colElt->style()->borderLeft(), BCOL));        if (!result.exists())            return result;        if (colElt->parent()->isTableCol() && (!rtl ? !colElt->previousSibling() : !colElt->nextSibling())) {            result = compareBorders(result, CollapsedBorderValue(&colElt->parent()->style()->borderLeft(), 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)) {            result = rtl ? compareBorders(result, CollapsedBorderValue(&colElt->style()->borderRight(), BCOL)) : compareBorders(CollapsedBorderValue(&colElt->style()->borderRight(), BCOL), result);            if (!result.exists())                return result;        }    } else {        // (7) The table's left border.        result = compareBorders(result, CollapsedBorderValue(&tableElt->style()->borderLeft(), BTABLE));        if (!result.exists())            return result;    }        return result;}CollapsedBorderValue RenderTableCell::collapsedRightBorder(bool rtl) 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.    CollapsedBorderValue result = CollapsedBorderValue(&style()->borderRight(), BCELL);        // (2) The left border of the cell to the right.    if (!rightmostColumn) {        RenderTableCell* nextCell = rtl ? tableElt->cellBefore(this) : tableElt->cellAfter(this);        if (nextCell && nextCell->style()) {            result = rtl ? compareBorders(CollapsedBorderValue(&nextCell->style()->borderLeft(), BCELL), result) : compareBorders(result, CollapsedBorderValue(&nextCell->style()->borderLeft(), BCELL));            if (!result.exists())                return result;        }    } else {        // (3) Our row's right border.        result = compareBorders(result, CollapsedBorderValue(&parent()->style()->borderRight(), BROW));        if (!result.exists())            return result;                // (4) Our row group's right border.        result = compareBorders(result, CollapsedBorderValue(&section()->style()->borderRight(), BROWGROUP));        if (!result.exists())            return result;    }        // (5) Our column and column group's right borders.    bool startColEdge;    bool endColEdge;    RenderTableCol* colElt = tableElt->colElement(col() + (rtl ? 0 : colSpan() - 1), &startColEdge, &endColEdge);    if (colElt && (!rtl ? endColEdge : startColEdge)) {        result = compareBorders(result, CollapsedBorderValue(&colElt->style()->borderRight(), BCOL));        if (!result.exists())            return result;        if (colElt->parent()->isTableCol() && (!rtl ? !colElt->nextSibling() : !colElt->previousSibling())) {            result = compareBorders(result, CollapsedBorderValue(&colElt->parent()->style()->borderRight(), 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)) {            result = rtl ? compareBorders(CollapsedBorderValue(&colElt->style()->borderLeft(), BCOL), result) : compareBorders(result, CollapsedBorderValue(&colElt->style()->borderLeft(), BCOL));            if (!result.exists())                return result;        }    } else {        // (7) The table's right border.        result = compareBorders(result, CollapsedBorderValue(&tableElt->style()->borderRight(), BTABLE));        if (!result.exists())            return result;    }        return result;}CollapsedBorderValue RenderTableCell::collapsedTopBorder() const{    // For border top, we need to check, in order of precedence:    // (1) Our top border.    CollapsedBorderValue result = CollapsedBorderValue(&style()->borderTop(), BCELL);        RenderTableCell* prevCell = table()->cellAbove(this);    if (prevCell) {        // (2) A previous cell's bottom border.        result = compareBorders(CollapsedBorderValue(&prevCell->style()->borderBottom(), BCELL), result);        if (!result.exists())             return result;    }        // (3) Our row's top border.    result = compareBorders(result, CollapsedBorderValue(&parent()->style()->borderTop(), BROW));    if (!result.exists())        return result;        // (4) The previous row's bottom border.    if (prevCell) {        RenderObject* prevRow = 0;        if (prevCell->section() == section())            prevRow = parent()->previousSibling();        else            prevRow = prevCell->section()->lastChild();            if (prevRow) {            result = compareBorders(CollapsedBorderValue(&prevRow->style()->borderBottom(), BROW), result);            if (!result.exists())                return result;        }    }        // Now check row groups.    RenderTableSection* currSection = section();    if (!row()) {        // (5) Our row group's top border.        result = compareBorders(result, CollapsedBorderValue(&currSection->style()->borderTop(), BROWGROUP));        if (!result.exists())            return result;                // (6) Previous row group's bottom border.        currSection = table()->sectionAbove(currSection);        if (currSection) {            result = compareBorders(CollapsedBorderValue(&currSection->style()->borderBottom(), BROWGROUP), result);            if (!result.exists())                return result;        }    }        if (!currSection) {        // (8) Our column and column group's top borders.        RenderTableCol* colElt = table()->colElement(col());        if (colElt) {            result = compareBorders(result, CollapsedBorderValue(&colElt->style()->borderTop(), BCOL));            if (!result.exists())                return result;            if (colElt->parent()->isTableCol()) {                result = compareBorders(result, CollapsedBorderValue(&colElt->parent()->style()->borderTop(), BCOLGROUP));                if (!result.exists())                    return result;            }        }                // (9) The table's top border.        result = compareBorders(result, CollapsedBorderValue(&table()->style()->borderTop(), BTABLE));        if (!result.exists())            return result;    }        return result;}CollapsedBorderValue RenderTableCell::collapsedBottomBorder() const{    // For border top, we need to check, in order of precedence:    // (1) Our bottom border.    CollapsedBorderValue result = CollapsedBorderValue(&style()->borderBottom(), BCELL);        RenderTableCell* nextCell = table()->cellBelow(this);    if (nextCell) {        // (2) A following cell's top border.        result = compareBorders(result, CollapsedBorderValue(&nextCell->style()->borderTop(), BCELL));        if (!result.exists())            return result;    }        // (3) Our row's bottom border. (FIXME: Deal with rowspan!)    result = compareBorders(result, CollapsedBorderValue(&parent()->style()->borderBottom(), BROW));    if (!result.exists())        return result;        // (4) The next row's top border.    if (nextCell) {        result = compareBorders(result, CollapsedBorderValue(&nextCell->parent()->style()->borderTop(), BROW));        if (!result.exists())            return result;    }        // Now check row groups.    RenderTableSection* currSection = section();    if (row() + rowSpan() >= static_cast<RenderTableSection*>(currSection)->numRows()) {        // (5) Our row group's bottom border.        result = compareBorders(result, CollapsedBorderValue(&currSection->style()->borderBottom(), BROWGROUP));        if (!result.exists())            return result;                // (6) Following row group's top border.        currSection = table()->sectionBelow(currSection);        if (currSection) {            result = compareBorders(result, CollapsedBorderValue(&currSection->style()->borderTop(), BROWGROUP));            if (!result.exists())                return result;        }    }        if (!currSection) {        // (8) Our column and column group's bottom borders.        RenderTableCol* colElt = table()->colElement(col());        if (colElt) {            result = compareBorders(result, CollapsedBorderValue(&colElt->style()->borderBottom(), BCOL));            if (!result.exists()) return result;            if (colElt->parent()->isTableCol()) {                result = compareBorders(result, CollapsedBorderValue(&colElt->parent()->style()->borderBottom(), BCOLGROUP));                if (!result.exists())                    return result;            }        }                // (9) The table's bottom border.        result = compareBorders(result, CollapsedBorderValue(&table()->style()->borderBottom(), BTABLE));        if (!result.exists())            return result;    }        return result;    }int RenderTableCell::borderLeft() const

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -