Changeset 58949 in webkit


Ignore:
Timestamp:
May 7, 2010 8:13:36 AM (14 years ago)
Author:
vestbo@webkit.org
Message:

[Qt] Fix rendering of -webkit-user-select: none

Reviewed by Simon Hausmann.

-webkit-user-select: none is implemented by filling
the area with an invalid default-constructed Color.
In most ports passing an invalid color down to the
graphics backend seems to produce transparent fills.

In Qt the behavior of painting with an invalid QColor
is undefined, and in practice it results in painting
black opaque areas.

One way to fix this would be to use Qt::transparent
when converting an undefined Color to a QColor, but
Qt does not have short circuits for fully transparent
painting, and we actually end up in slow code paths
due to the transparency. So, we're better of doing the
short circuit in WebKit.

https://bugs.webkit.org/show_bug.cgi?id=38523

  • platform/graphics/qt/GraphicsContextQt.cpp:
Location:
trunk/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r58948 r58949  
     12010-05-07  Tor Arne Vestbø  <tor.arne.vestbo@nokia.com>
     2
     3        Reviewed by Simon Hausmann.
     4
     5        [Qt] Fix rendering of -webkit-user-select: none
     6
     7        -webkit-user-select: none is implemented by filling
     8        the area with an invalid default-constructed Color.
     9        In most ports passing an invalid color down to the
     10        graphics backend seems to produce transparent fills.
     11
     12        In Qt the behavior of painting with an invalid QColor
     13        is undefined, and in practice it results in painting
     14        black opaque areas.
     15
     16        One way to fix this would be to use Qt::transparent
     17        when converting an undefined Color to a QColor, but
     18        Qt does not have short circuits for fully transparent
     19        painting, and we actually end up in slow code paths
     20        due to the transparency. So, we're better of doing the
     21        short circuit in WebKit.
     22
     23        https://bugs.webkit.org/show_bug.cgi?id=38523
     24
     25        * platform/graphics/qt/GraphicsContextQt.cpp:
     26
    1272010-05-07  Ben Murdoch  <benm@google.com>
    228
  • trunk/WebCore/platform/graphics/qt/GraphicsContextQt.cpp

    r56391 r58949  
    642642}
    643643
    644 void GraphicsContext::fillRect(const FloatRect& rect, const Color& c, ColorSpace colorSpace)
    645 {
    646     if (paintingDisabled())
    647         return;
    648 
    649     m_data->solidColor.setColor(c);
     644void GraphicsContext::fillRect(const FloatRect& rect, const Color& color, ColorSpace colorSpace)
     645{
     646    if (paintingDisabled() || !color.isValid())
     647        return;
     648
     649    m_data->solidColor.setColor(color);
    650650    QPainter* p = m_data->p();
    651651    if (m_common->state.shadowColor.isValid())
     
    656656void GraphicsContext::fillRoundedRect(const IntRect& rect, const IntSize& topLeft, const IntSize& topRight, const IntSize& bottomLeft, const IntSize& bottomRight, const Color& color, ColorSpace colorSpace)
    657657{
    658     if (paintingDisabled() || !color.alpha())
     658    if (paintingDisabled() || !color.isValid() || !color.alpha())
    659659        return;
    660660
     
    718718void GraphicsContext::drawFocusRing(const Vector<IntRect>& rects, int /* width */, int /* offset */, const Color& color)
    719719{
    720     if (paintingDisabled())
     720    if (paintingDisabled() || !color.isValid())
    721721        return;
    722722
     
    11421142void GraphicsContext::setPlatformStrokeColor(const Color& color, ColorSpace colorSpace)
    11431143{
    1144     if (paintingDisabled())
    1145         return;
     1144    if (paintingDisabled() || !color.isValid())
     1145        return;
     1146
    11461147    QPainter* p = m_data->p();
    11471148    QPen newPen(p->pen());
     
    11731174void GraphicsContext::setPlatformFillColor(const Color& color, ColorSpace colorSpace)
    11741175{
    1175     if (paintingDisabled())
    1176         return;
     1176    if (paintingDisabled() || !color.isValid())
     1177        return;
     1178
    11771179    m_data->solidColor.setColor(color);
    11781180    m_data->p()->setBrush(m_data->solidColor);
Note: See TracChangeset for help on using the changeset viewer.