Skip to content
  • wangxianzhu's avatar
    Let LayoutObjects be const to painters · 36c3845d
    wangxianzhu authored
    Painters should not modify LayoutObject status except some status
    dedicated for painting. The exceptions are marked mutable.
    
    List of 'mutable's added in this CL:
    - FrameView::m_isPainting: for assertion (in FrameView::layout(),
      Document::updateLayoutTrees() and FramePainter::paintContents()).
      Will change to document cycle states.
    - LayoutObject::BitFields::m_boxDecorationBackgroundState: Lazily
      updated in LayoutObject::boxDecorationBackgroundIsKnownToBeObscured().
    - LayoutTable::m_currentBorder: Used temporarily during painting only.
      Will move into painter.
    
    List of 'const_cast's added in this CL:
    - ImageQualityController::highQualityRepaintTimerFired()
      when invalidating LayoutObject on timer. Will change to
      mutableForPainting[1].
    - LineBoxListPainter::paint()
      This is of const sementics, but LineLayoutBoxModel doesn't support
      const for now (crbug.com/535785)
    - SVGFilterPainter::prepareEffect()
      when calling m_filter.setFilterDataForLayoutObject. TODO(pdr).
    - ScrollbarPainter::paintIntoRect()
      a layer violation that the painter changes geometry of scrollbars.
      There is an existing FIXME.
    - When calling get() on a Map<non-const-pointer, ...>.
    - Used to implement const version of getters based on the non-const
      version.
    
    [1] mutableForPainting: https://codereview.chromium.org/1363613002/#msg6
    
    Review URL: https://codereview.chromium.org/1361363003
    
    Cr-Commit-Position: refs/heads/master@{#351868}
    36c3845d