Ignore:
Timestamp:
Oct 28, 2013, 7:58:43 PM (12 years ago)
Author:
[email protected]
Message:

RenderElement::style() should return a reference.
<https://webkit.org/b/123414>

Now that renderers always have style, go ahead and make style()
return a RenderStyle&.

There are countless opportunities for further cleanup enabled by
this change. I'm simply passing &style() in many cases where we
can really do something nicer instead.

Reviewed by Anders Carlsson.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/rendering/RenderScrollbarPart.cpp

    r158097 r158163  
    9696    // FIXME: We are querying layout information but nothing guarantees that it's up-to-date, especially since we are called at style change.
    9797    // FIXME: Querying the style's border information doesn't work on table cells with collapsing borders.
    98     int visibleSize = m_scrollbar->owningRenderer()->width() - m_scrollbar->owningRenderer()->style()->borderLeftWidth() - m_scrollbar->owningRenderer()->style()->borderRightWidth();
    99     int w = calcScrollbarThicknessUsing(MainOrPreferredSize, style()->width(), visibleSize, renderView);
    100     int minWidth = calcScrollbarThicknessUsing(MinSize, style()->minWidth(), visibleSize, renderView);
    101     int maxWidth = style()->maxWidth().isUndefined() ? w : calcScrollbarThicknessUsing(MaxSize, style()->maxWidth(), visibleSize, renderView);
     98    int visibleSize = m_scrollbar->owningRenderer()->width() - m_scrollbar->owningRenderer()->style().borderLeftWidth() - m_scrollbar->owningRenderer()->style().borderRightWidth();
     99    int w = calcScrollbarThicknessUsing(MainOrPreferredSize, style().width(), visibleSize, renderView);
     100    int minWidth = calcScrollbarThicknessUsing(MinSize, style().minWidth(), visibleSize, renderView);
     101    int maxWidth = style().maxWidth().isUndefined() ? w : calcScrollbarThicknessUsing(MaxSize, style().maxWidth(), visibleSize, renderView);
    102102    setWidth(max(minWidth, min(maxWidth, w)));
    103103   
    104104    // Buttons and track pieces can all have margins along the axis of the scrollbar.
    105     m_marginBox.setLeft(minimumValueForLength(style()->marginLeft(), visibleSize, renderView));
    106     m_marginBox.setRight(minimumValueForLength(style()->marginRight(), visibleSize, renderView));
     105    m_marginBox.setLeft(minimumValueForLength(style().marginLeft(), visibleSize, renderView));
     106    m_marginBox.setRight(minimumValueForLength(style().marginRight(), visibleSize, renderView));
    107107}
    108108
     
    114114    // FIXME: We are querying layout information but nothing guarantees that it's up-to-date, especially since we are called at style change.
    115115    // FIXME: Querying the style's border information doesn't work on table cells with collapsing borders.
    116     int visibleSize = m_scrollbar->owningRenderer()->height() -  m_scrollbar->owningRenderer()->style()->borderTopWidth() - m_scrollbar->owningRenderer()->style()->borderBottomWidth();
    117     int h = calcScrollbarThicknessUsing(MainOrPreferredSize, style()->height(), visibleSize, renderView);
    118     int minHeight = calcScrollbarThicknessUsing(MinSize, style()->minHeight(), visibleSize, renderView);
    119     int maxHeight = style()->maxHeight().isUndefined() ? h : calcScrollbarThicknessUsing(MaxSize, style()->maxHeight(), visibleSize, renderView);
     116    int visibleSize = m_scrollbar->owningRenderer()->height() -  m_scrollbar->owningRenderer()->style().borderTopWidth() - m_scrollbar->owningRenderer()->style().borderBottomWidth();
     117    int h = calcScrollbarThicknessUsing(MainOrPreferredSize, style().height(), visibleSize, renderView);
     118    int minHeight = calcScrollbarThicknessUsing(MinSize, style().minHeight(), visibleSize, renderView);
     119    int maxHeight = style().maxHeight().isUndefined() ? h : calcScrollbarThicknessUsing(MaxSize, style().maxHeight(), visibleSize, renderView);
    120120    setHeight(max(minHeight, min(maxHeight, h)));
    121121
    122122    // Buttons and track pieces can all have margins along the axis of the scrollbar.
    123     m_marginBox.setTop(minimumValueForLength(style()->marginTop(), visibleSize, renderView));
    124     m_marginBox.setBottom(minimumValueForLength(style()->marginBottom(), visibleSize, renderView));
     123    m_marginBox.setTop(minimumValueForLength(style().marginTop(), visibleSize, renderView));
     124    m_marginBox.setBottom(minimumValueForLength(style().marginBottom(), visibleSize, renderView));
    125125}
    126126
     
    167167    setHeight(rect.height());
    168168
    169     if (graphicsContext->paintingDisabled() || !style()->opacity())
     169    if (graphicsContext->paintingDisabled() || !style().opacity())
    170170        return;
    171171
    172172    // We don't use RenderLayers for scrollbar parts, so we need to handle opacity here.
    173173    // Opacity for ScrollbarBGPart is handled by RenderScrollbarTheme::willPaintScrollbar().
    174     bool needsTransparencyLayer = m_part != ScrollbarBGPart && style()->opacity() < 1;
     174    bool needsTransparencyLayer = m_part != ScrollbarBGPart && style().opacity() < 1;
    175175    if (needsTransparencyLayer) {
    176176        graphicsContext->save();
    177177        graphicsContext->clip(rect);
    178         graphicsContext->beginTransparencyLayer(style()->opacity());
     178        graphicsContext->beginTransparencyLayer(style().opacity());
    179179    }
    180180   
Note: See TracChangeset for help on using the changeset viewer.