Changeset 163171 in webkit


Ignore:
Timestamp:
Jan 31, 2014 8:48:55 AM (10 years ago)
Author:
Alan Bujtas
Message:

Subpixel rendering: Change RenderBoxModelObject's border functions' signature to support subpixel border painting.
https://bugs.webkit.org/show_bug.cgi?id=127975

Reviewed by Simon Fraser.

From int to LayoutUnit.

Covered by existing tests. No change in functionality.

  • platform/text/TextStream.cpp:

(WebCore::TextStream::operator<<):

  • platform/text/TextStream.h:
  • rendering/RenderBoxModelObject.cpp:

(WebCore::RenderBoxModelObject::paintFillLayerExtended):

  • rendering/RenderBoxModelObject.h:

(WebCore::RenderBoxModelObject::borderTop):
(WebCore::RenderBoxModelObject::borderBottom):
(WebCore::RenderBoxModelObject::borderLeft):
(WebCore::RenderBoxModelObject::borderRight):
(WebCore::RenderBoxModelObject::borderBefore):
(WebCore::RenderBoxModelObject::borderAfter):
(WebCore::RenderBoxModelObject::borderStart):
(WebCore::RenderBoxModelObject::borderEnd):

  • rendering/RenderElement.cpp:

(WebCore::RenderElement::repaintAfterLayoutIfNeeded):

  • rendering/RenderTable.cpp:

(WebCore::RenderTable::borderBefore):
(WebCore::RenderTable::borderAfter):

  • rendering/RenderTable.h:
  • rendering/RenderTableCell.cpp:

(WebCore::RenderTableCell::borderLeft):
(WebCore::RenderTableCell::borderRight):
(WebCore::RenderTableCell::borderTop):
(WebCore::RenderTableCell::borderBottom):
(WebCore::RenderTableCell::borderStart):
(WebCore::RenderTableCell::borderEnd):
(WebCore::RenderTableCell::borderBefore):
(WebCore::RenderTableCell::borderAfter):

  • rendering/RenderTableCell.h:
Location:
trunk/Source/WebCore
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r163170 r163171  
     12014-01-31  Zalan Bujtas  <zalan@apple.com>
     2
     3        Subpixel rendering: Change RenderBoxModelObject's border functions' signature to support subpixel border painting.
     4        https://bugs.webkit.org/show_bug.cgi?id=127975
     5
     6        Reviewed by Simon Fraser.
     7
     8        From int to LayoutUnit.
     9
     10        Covered by existing tests. No change in functionality.
     11
     12        * platform/text/TextStream.cpp:
     13        (WebCore::TextStream::operator<<):
     14        * platform/text/TextStream.h:
     15        * rendering/RenderBoxModelObject.cpp:
     16        (WebCore::RenderBoxModelObject::paintFillLayerExtended):
     17        * rendering/RenderBoxModelObject.h:
     18        (WebCore::RenderBoxModelObject::borderTop):
     19        (WebCore::RenderBoxModelObject::borderBottom):
     20        (WebCore::RenderBoxModelObject::borderLeft):
     21        (WebCore::RenderBoxModelObject::borderRight):
     22        (WebCore::RenderBoxModelObject::borderBefore):
     23        (WebCore::RenderBoxModelObject::borderAfter):
     24        (WebCore::RenderBoxModelObject::borderStart):
     25        (WebCore::RenderBoxModelObject::borderEnd):
     26        * rendering/RenderElement.cpp:
     27        (WebCore::RenderElement::repaintAfterLayoutIfNeeded):
     28        * rendering/RenderTable.cpp:
     29        (WebCore::RenderTable::borderBefore):
     30        (WebCore::RenderTable::borderAfter):
     31        * rendering/RenderTable.h:
     32        * rendering/RenderTableCell.cpp:
     33        (WebCore::RenderTableCell::borderLeft):
     34        (WebCore::RenderTableCell::borderRight):
     35        (WebCore::RenderTableCell::borderTop):
     36        (WebCore::RenderTableCell::borderBottom):
     37        (WebCore::RenderTableCell::borderStart):
     38        (WebCore::RenderTableCell::borderEnd):
     39        (WebCore::RenderTableCell::borderBefore):
     40        (WebCore::RenderTableCell::borderAfter):
     41        * rendering/RenderTableCell.h:
     42
    1432014-01-31  Brady Eidson  <beidson@apple.com>
    244
  • trunk/Source/WebCore/platform/text/TextStream.cpp

    r159027 r163171  
    3232#include "IntRect.h"
    3333#include "LayoutRect.h"
     34#include "LayoutUnit.h"
    3435#include <wtf/MathExtras.h>
    3536#include <wtf/StringExtras.h>
     
    151152}
    152153
     154TextStream& TextStream::operator<<(const LayoutUnit& v)
     155{
     156    return *this << TextStream::FormatNumberRespectingIntegers(v.toFloat());
     157}
     158
    153159TextStream& TextStream::operator<<(const LayoutPoint& p)
    154160{
  • trunk/Source/WebCore/platform/text/TextStream.h

    r158183 r163171  
    3939class LayoutPoint;
    4040class LayoutRect;
     41class LayoutUnit;
    4142
    4243class TextStream {
     
    6566    TextStream& operator<<(const FloatPoint&);
    6667    TextStream& operator<<(const FloatSize&);
     68    TextStream& operator<<(const LayoutUnit&);
    6769    TextStream& operator<<(const LayoutPoint&);
    6870    TextStream& operator<<(const LayoutRect&);
  • trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp

    r163156 r163171  
    677677    }
    678678   
    679     int bLeft = includeLeftEdge ? borderLeft() : 0;
    680     int bRight = includeRightEdge ? borderRight() : 0;
     679    LayoutUnit bLeft = includeLeftEdge ? borderLeft() : LayoutUnit::fromPixel(0);
     680    LayoutUnit bRight = includeRightEdge ? borderRight() : LayoutUnit::fromPixel(0);
    681681    LayoutUnit pLeft = includeLeftEdge ? paddingLeft() : LayoutUnit();
    682682    LayoutUnit pRight = includeRightEdge ? paddingRight() : LayoutUnit();
  • trunk/Source/WebCore/rendering/RenderBoxModelObject.h

    r163156 r163171  
    114114    virtual LayoutUnit paddingEnd() const { return computedCSSPaddingEnd(); }
    115115
    116     virtual int borderTop() const { return style().borderTopWidth(); }
    117     virtual int borderBottom() const { return style().borderBottomWidth(); }
    118     virtual int borderLeft() const { return style().borderLeftWidth(); }
    119     virtual int borderRight() const { return style().borderRightWidth(); }
    120     virtual int borderBefore() const { return style().borderBeforeWidth(); }
    121     virtual int borderAfter() const { return style().borderAfterWidth(); }
    122     virtual int borderStart() const { return style().borderStartWidth(); }
    123     virtual int borderEnd() const { return style().borderEndWidth(); }
     116    virtual LayoutUnit borderTop() const { return style().borderTopWidth(); }
     117    virtual LayoutUnit borderBottom() const { return style().borderBottomWidth(); }
     118    virtual LayoutUnit borderLeft() const { return style().borderLeftWidth(); }
     119    virtual LayoutUnit borderRight() const { return style().borderRightWidth(); }
     120    virtual LayoutUnit borderBefore() const { return style().borderBeforeWidth(); }
     121    virtual LayoutUnit borderAfter() const { return style().borderAfterWidth(); }
     122    virtual LayoutUnit borderStart() const { return style().borderStartWidth(); }
     123    virtual LayoutUnit borderEnd() const { return style().borderEndWidth(); }
    124124
    125125    LayoutUnit borderAndPaddingStart() const { return borderStart() + paddingStart(); }
  • trunk/Source/WebCore/rendering/RenderElement.cpp

    r163079 r163171  
    12271227        LayoutUnit shadowRight;
    12281228        style().getBoxShadowHorizontalExtent(shadowLeft, shadowRight);
    1229         int borderRight = isBox() ? toRenderBox(this)->borderRight() : 0;
     1229        int borderRight = isBox() ? toRenderBox(this)->borderRight() : LayoutUnit::fromPixel(0);
    12301230        LayoutUnit boxWidth = isBox() ? toRenderBox(this)->width() : LayoutUnit();
    12311231        LayoutUnit minInsetRightShadowExtent = std::min<LayoutUnit>(-insetShadowExtent.right(), std::min<LayoutUnit>(newBounds.width(), oldBounds.width()));
     
    12471247        LayoutUnit shadowBottom;
    12481248        style().getBoxShadowVerticalExtent(shadowTop, shadowBottom);
    1249         int borderBottom = isBox() ? toRenderBox(this)->borderBottom() : 0;
     1249        int borderBottom = isBox() ? toRenderBox(this)->borderBottom() : LayoutUnit::fromPixel(0);
    12501250        LayoutUnit boxHeight = isBox() ? toRenderBox(this)->height() : LayoutUnit();
    12511251        LayoutUnit minInsetBottomShadowExtent = std::min<LayoutUnit>(-insetShadowExtent.bottom(), std::min<LayoutUnit>(newBounds.height(), oldBounds.height()));
  • trunk/Source/WebCore/rendering/RenderTable.cpp

    r163165 r163171  
    10741074}
    10751075
    1076 int RenderTable::borderBefore() const
     1076LayoutUnit RenderTable::borderBefore() const
    10771077{
    10781078    if (collapseBorders()) {
     
    10831083}
    10841084
    1085 int RenderTable::borderAfter() const
     1085LayoutUnit RenderTable::borderAfter() const
    10861086{
    10871087    if (collapseBorders()) {
  • trunk/Source/WebCore/rendering/RenderTable.h

    r162158 r163171  
    5454    bool collapseBorders() const { return style().borderCollapse(); }
    5555
    56     virtual int borderStart() const override { return m_borderStart; }
    57     virtual int borderEnd() const override { return m_borderEnd; }
    58     virtual int borderBefore() const override;
    59     virtual int borderAfter() const override;
    60 
    61     virtual int borderLeft() const override
     56    virtual LayoutUnit borderStart() const override { return m_borderStart; }
     57    virtual LayoutUnit borderEnd() const override { return m_borderEnd; }
     58    virtual LayoutUnit borderBefore() const override;
     59    virtual LayoutUnit borderAfter() const override;
     60
     61    virtual LayoutUnit borderLeft() const override
    6262    {
    6363        if (style().isHorizontalWritingMode())
     
    6666    }
    6767
    68     virtual int borderRight() const override
     68    virtual LayoutUnit borderRight() const override
    6969    {
    7070        if (style().isHorizontalWritingMode())
     
    7373    }
    7474
    75     virtual int borderTop() const override
     75    virtual LayoutUnit borderTop() const override
    7676    {
    7777        if (style().isHorizontalWritingMode())
     
    8080    }
    8181
    82     virtual int borderBottom() const override
     82    virtual LayoutUnit borderBottom() const override
    8383    {
    8484        if (style().isHorizontalWritingMode())
  • trunk/Source/WebCore/rendering/RenderTableCell.cpp

    r159856 r163171  
    931931}
    932932
    933 int RenderTableCell::borderLeft() const
    934 {
    935     return table()->collapseBorders() ? borderHalfLeft(false) : RenderBlockFlow::borderLeft();
    936 }
    937 
    938 int RenderTableCell::borderRight() const
    939 {
    940     return table()->collapseBorders() ? borderHalfRight(false) : RenderBlockFlow::borderRight();
    941 }
    942 
    943 int RenderTableCell::borderTop() const
    944 {
    945     return table()->collapseBorders() ? borderHalfTop(false) : RenderBlockFlow::borderTop();
    946 }
    947 
    948 int RenderTableCell::borderBottom() const
    949 {
    950     return table()->collapseBorders() ? borderHalfBottom(false) : RenderBlockFlow::borderBottom();
     933LayoutUnit RenderTableCell::borderLeft() const
     934{
     935    return table()->collapseBorders() ? LayoutUnit::fromPixel(borderHalfLeft(false)) : RenderBlockFlow::borderLeft();
     936}
     937
     938LayoutUnit RenderTableCell::borderRight() const
     939{
     940    return table()->collapseBorders() ? LayoutUnit::fromPixel(borderHalfRight(false)) : RenderBlockFlow::borderRight();
     941}
     942
     943LayoutUnit RenderTableCell::borderTop() const
     944{
     945    return table()->collapseBorders() ? LayoutUnit::fromPixel(borderHalfTop(false)) : RenderBlockFlow::borderTop();
     946}
     947
     948LayoutUnit RenderTableCell::borderBottom() const
     949{
     950    return table()->collapseBorders() ? LayoutUnit::fromPixel(borderHalfBottom(false)) : RenderBlockFlow::borderBottom();
    951951}
    952952
    953953// FIXME: https://bugs.webkit.org/show_bug.cgi?id=46191, make the collapsed border drawing
    954954// work with different block flow values instead of being hard-coded to top-to-bottom.
    955 int RenderTableCell::borderStart() const
    956 {
    957     return table()->collapseBorders() ? borderHalfStart(false) : RenderBlockFlow::borderStart();
    958 }
    959 
    960 int RenderTableCell::borderEnd() const
    961 {
    962     return table()->collapseBorders() ? borderHalfEnd(false) : RenderBlockFlow::borderEnd();
    963 }
    964 
    965 int RenderTableCell::borderBefore() const
    966 {
    967     return table()->collapseBorders() ? borderHalfBefore(false) : RenderBlockFlow::borderBefore();
    968 }
    969 
    970 int RenderTableCell::borderAfter() const
    971 {
    972     return table()->collapseBorders() ? borderHalfAfter(false) : RenderBlockFlow::borderAfter();
     955LayoutUnit RenderTableCell::borderStart() const
     956{
     957    return table()->collapseBorders() ? LayoutUnit::fromPixel(borderHalfStart(false)) : RenderBlockFlow::borderStart();
     958}
     959
     960LayoutUnit RenderTableCell::borderEnd() const
     961{
     962    return table()->collapseBorders() ? LayoutUnit::fromPixel(borderHalfEnd(false)) : RenderBlockFlow::borderEnd();
     963}
     964
     965LayoutUnit RenderTableCell::borderBefore() const
     966{
     967    return table()->collapseBorders() ? LayoutUnit::fromPixel(borderHalfBefore(false)) : RenderBlockFlow::borderBefore();
     968}
     969
     970LayoutUnit RenderTableCell::borderAfter() const
     971{
     972    return table()->collapseBorders() ? LayoutUnit::fromPixel(borderHalfAfter(false)) : RenderBlockFlow::borderAfter();
    973973}
    974974
  • trunk/Source/WebCore/rendering/RenderTableCell.h

    r162198 r163171  
    104104        // Call computedCSSPadding* directly to avoid including implicitPadding.
    105105        if (!document().inQuirksMode() && style().boxSizing() != BORDER_BOX)
    106             styleLogicalHeight += (computedCSSPaddingBefore() + computedCSSPaddingAfter()).floor() + borderBefore() + borderAfter();
     106            styleLogicalHeight += (computedCSSPaddingBefore() + computedCSSPaddingAfter()).floor() + (borderBefore() + borderAfter()).floor();
    107107        return std::max(styleLogicalHeight, adjustedLogicalHeight);
    108108    }
     
    111111    void setCellLogicalWidth(int constrainedLogicalWidth);
    112112
    113     virtual int borderLeft() const override;
    114     virtual int borderRight() const override;
    115     virtual int borderTop() const override;
    116     virtual int borderBottom() const override;
    117     virtual int borderStart() const override;
    118     virtual int borderEnd() const override;
    119     virtual int borderBefore() const override;
    120     virtual int borderAfter() const override;
     113    virtual LayoutUnit borderLeft() const override;
     114    virtual LayoutUnit borderRight() const override;
     115    virtual LayoutUnit borderTop() const override;
     116    virtual LayoutUnit borderBottom() const override;
     117    virtual LayoutUnit borderStart() const override;
     118    virtual LayoutUnit borderEnd() const override;
     119    virtual LayoutUnit borderBefore() const override;
     120    virtual LayoutUnit borderAfter() const override;
    121121
    122122    void collectBorderValues(RenderTable::CollapsedBorderValues&) const;
Note: See TracChangeset for help on using the changeset viewer.