Skip to content
  • hyatt@apple.com's avatar
    WebCore: https://bugs.webkit.org/show_bug.cgi?id=20329, shadows and reflections incorrectly · 5dc5a312
    hyatt@apple.com authored
    considered part of scrollable overflow.
    
    Reviewed by Dan Bernstein.
    
    This patch takes the engine's concept of overflow and splits it into two types:
    layout overflow and visual overflow.
            
    Layout overflow is about other boxes that spill out of an enclosing box,  For example,
    in the inline flow case a tall image could spill out of a line box. Examples of 
    visual overflow are shadows, text stroke (and eventually outline and
    border-image).
    
    Three objects tracked overflow before this patch: RenderBlock had 
    m_overflowLeft/Top/Width/Height variables.  RootInlineBox had an Overflow*
    that also had four overflow values.  Finally RenderReplaced elements tracked shadow/reflection
    overflow using a map that cached four values.
            
    This patch takes all of these different overflow models and unifies them into a single
    new class called RenderOverflow.   This class is now a member variable in RenderBox and
    InlineFlowBoxes.  It is only allocated if overflow actually exists.  Instead of tracking
    four values, it tracks eight: left/top/right/bottom for layout overflow and 
    left/top/right/bottom for visual overflow.
            
    Overflow computation is now done after layout is finished rather than during layout
    (when child objects can be churning and moving around).  A number of layout tests progressed
    by deferring overflow computation to a separate pass.
            
    All inline flow boxes now track overflow (and not just the root line box).  This allows
    repainting of line boxes to actually be tight and bail early if the overflow rect of a box
    doesn't intersect.  The old code always visited all object on a line if the root line box
    intersected at all.
            
    Line box overflow no longer propagates across self-painting layers.  This fixes a number of
    issues with incorrect scrollbars appearing when relative positioned inlines were used in a page.
            
    Layer bounds have been modified to exclude visual overflow.  The width/height members only really
    have one reason for continued existence, and that is that they happen to be used in repaint()
    when an overflow clip object's height isn't accurate.  In this case, the bounds should exclude
    visual overflow anyway, so this change tightens that repaint up.
            
    Root lines have renamed m_selectionTop/Bottom to m_lineTop/Bottom and positionForPoint methods have
    been changed to use these instead of relying on overflow (which was totally wrong).
    
    Significant changes have been made to the "almost strict mode" line box quirk where objects with no
    text children have no effect on the height of a line.  Instead of making the height() of the objects
    variable and dependent on overflow, the objects now have their full height and get placed on
    the baseline properly.  They simply don't contribute to overflow above lineTop/Bottom.
            
    Reflections are no longer considered overflow of any kind.  Because reflections have their own layers,
    it is not necessary to treat them as visual or layout overflow in the RenderObject tree.  The end result
    of not incorporating them into RenderOverflow is that they have no effect on scrolling.  transparencyClipBox
    has been extended to support fully reflecting the entire clip box when a reflection exists.  This fixes
    numerous repaint bugs in transparent objects with reflections when the transparent objects had self-painting
    sublayers.
    
    * WebCore.xcodeproj/project.pbxproj:
    * dom/ContainerNode.cpp:
    (WebCore::ContainerNode::getUpperLeftCorner):
    * editing/visible_units.cpp:
    (WebCore::previousLinePosition):
    (WebCore::nextLinePosition):
    * page/FrameView.cpp:
    (WebCore::FrameView::adjustViewSize):
    (WebCore::FrameView::adjustPageHeight):
    * rendering/InlineBox.cpp:
    (WebCore::InlineBox::height):
    * rendering/InlineBox.h:
    * rendering/InlineFlowBox.cpp:
    (WebCore::InlineFlowBox::adjustPosition):
    (WebCore::InlineFlowBox::placeBoxesHorizontally):
    (WebCore::InlineFlowBox::placeBoxesVertically):
    (WebCore::InlineFlowBox::computeVerticalOverflow):
    (WebCore::InlineFlowBox::nodeAtPoint):
    (WebCore::InlineFlowBox::paint):
    * rendering/InlineFlowBox.h:
    (WebCore::InlineFlowBox::InlineFlowBox):
    (WebCore::InlineFlowBox::topCombinedOverflow):
    (WebCore::InlineFlowBox::bottomCombinedOverflow):
    (WebCore::InlineFlowBox::leftCombinedOverflow):
    (WebCore::InlineFlowBox::rightCombinedOverflow):
    (WebCore::InlineFlowBox::combinedOverflowRect):
    (WebCore::InlineFlowBox::topLayoutOverflow):
    (WebCore::InlineFlowBox::bottomLayoutOverflow):
    (WebCore::InlineFlowBox::leftLayoutOverflow):
    (WebCore::InlineFlowBox::rightLayoutOverflow):
    (WebCore::InlineFlowBox::layoutOverflowRect):
    (WebCore::InlineFlowBox::topVisualOverflow):
    (WebCore::InlineFlowBox::bottomVisualOverflow):
    (WebCore::InlineFlowBox::leftVisualOverflow):
    (WebCore::InlineFlowBox::rightVisualOverflow):
    (WebCore::InlineFlowBox::visualOverflowRect):
    (WebCore::InlineFlowBox::setHorizontalOverflowPositions):
    (WebCore::InlineFlowBox::setVerticalOverflowPositions):
    * rendering/InlineTextBox.cpp:
    (WebCore::InlineTextBox::paint):
    * rendering/RenderBlock.cpp:
    (WebCore::RenderBlock::RenderBlock):
    (WebCore::RenderBlock::layout):
    (WebCore::RenderBlock::layoutBlock):
    (WebCore::RenderBlock::addOverflowFromBlockChildren):
    (WebCore::RenderBlock::handleBottomOfBlock):
    (WebCore::RenderBlock::layoutBlockChildren):
    (WebCore::RenderBlock::paint):
    (WebCore::RenderBlock::fillInlineSelectionGaps):
    (WebCore::RenderBlock::floatRect):
    (WebCore::RenderBlock::lowestPosition):
    (WebCore::RenderBlock::rightmostPosition):
    (WebCore::RenderBlock::leftmostPosition):
    (WebCore::RenderBlock::addOverhangingFloats):
    (WebCore::RenderBlock::nodeAtPoint):
    (WebCore::RenderBlock::positionForPointWithInlineChildren):
    (WebCore::RenderBlock::layoutColumns):
    (WebCore::getHeightForLineCount):
    * rendering/RenderBlock.h:
    * rendering/RenderBlockLineLayout.cpp:
    (WebCore::RenderBlock::computeHorizontalPositionsForLine):
    (WebCore::RenderBlock::computeVerticalPositionsForLine):
    (WebCore::RenderBlock::layoutInlineChildren):
    (WebCore::RenderBlock::matchedEndLine):
    (WebCore::RenderBlock::addOverflowFromInlineChildren):
    * rendering/RenderBox.cpp:
    (WebCore::RenderBox::destroy):
    (WebCore::RenderBox::clippedOverflowRectForRepaint):
    (WebCore::RenderBox::localCaretRect):
    (WebCore::RenderBox::addShadowAndReflectionOverflow):
    (WebCore::RenderBox::addOverflowFromChild):
    (WebCore::RenderBox::addLayoutOverflow):
    (WebCore::RenderBox::addVisualOverflow):
    (WebCore::RenderBox::clearLayoutOverflow):
    * rendering/RenderBox.h:
    (WebCore::RenderBox::combinedOverflowRect):
    (WebCore::RenderBox::topCombinedOverflow):
    (WebCore::RenderBox::bottomCombinedOverflow):
    (WebCore::RenderBox::leftCombinedOverflow):
    (WebCore::RenderBox::rightCombinedOverflow):
    (WebCore::RenderBox::layoutOverflowRect):
    (WebCore::RenderBox::topLayoutOverflow):
    (WebCore::RenderBox::bottomLayoutOverflow):
    (WebCore::RenderBox::leftLayoutOverflow):
    (WebCore::RenderBox::rightLayoutOverflow):
    (WebCore::RenderBox::visualOverflowRect):
    (WebCore::RenderBox::topVisualOverflow):
    (WebCore::RenderBox::bottomVisualOverflow):
    (WebCore::RenderBox::leftVisualOverflow):
    (WebCore::RenderBox::rightVisualOverflow):
    * rendering/RenderFlexibleBox.cpp:
    (WebCore::RenderFlexibleBox::layoutBlock):
    (WebCore::RenderFlexibleBox::layoutHorizontalBox):
    (WebCore::RenderFlexibleBox::layoutVerticalBox):
    * rendering/RenderLayer.cpp:
    (WebCore::RenderLayer::updateLayerPosition):
    (WebCore::RenderLayer::localBoundingBox):
    * rendering/RenderLayerCompositor.cpp:
    (WebCore::RenderLayerCompositor::updateRootLayerPosition):
    (WebCore::RenderLayerCompositor::ensureRootPlatformLayer):
    * rendering/RenderLineBoxList.cpp:
    (WebCore::RenderLineBoxList::paint):
    (WebCore::RenderLineBoxList::hitTest):
    * rendering/RenderListItem.cpp:
    (WebCore::RenderListItem::positionListMarker):
    * rendering/RenderObject.cpp:
    (WebCore::RenderObject::RenderObject):
    * rendering/RenderObject.h:
    * rendering/RenderOverflow.h: Added.
    (WebCore::RenderOverflow::RenderOverflow):
    (WebCore::RenderOverflow::topLayoutOverflow):
    (WebCore::RenderOverflow::bottomLayoutOverflow):
    (WebCore::RenderOverflow::leftLayoutOverflow):
    (WebCore::RenderOverflow::rightLayoutOverflow):
    (WebCore::RenderOverflow::topVisualOverflow):
    (WebCore::RenderOverflow::bottomVisualOverflow):
    (WebCore::RenderOverflow::leftVisualOverflow):
    (WebCore::RenderOverflow::rightVisualOverflow):
    (WebCore::RenderOverflow::setTopLayoutOverflow):
    (WebCore::RenderOverflow::setBottomLayoutOverflow):
    (WebCore::RenderOverflow::setLeftLayoutOverflow):
    (WebCore::RenderOverflow::setRightLayoutOverflow):
    (WebCore::RenderOverflow::setTopVisualOverflow):
    (WebCore::RenderOverflow::setBottomVisualOverflow):
    (WebCore::RenderOverflow::setLeftVisualOverflow):
    (WebCore::RenderOverflow::setRightVisualOverflow):
    (WebCore::RenderOverflow::layoutOverflowRect):
    (WebCore::RenderOverflow::visualOverflowRect):
    (WebCore::RenderOverflow::combinedOverflowRect):
    (WebCore::RenderOverflow::move):
    (WebCore::RenderOverflow::addLayoutOverflow):
    (WebCore::RenderOverflow::addVisualOverflow):
    (WebCore::RenderOverflow::resetLayoutOverflow):
    * rendering/RenderPartObject.cpp:
    (WebCore::RenderPartObject::layout):
    * rendering/RenderReplaced.cpp:
    (WebCore::RenderReplaced::~RenderReplaced):
    (WebCore::RenderReplaced::layout):
    (WebCore::RenderReplaced::shouldPaint):
    (WebCore::RenderReplaced::positionForPoint):
    (WebCore::RenderReplaced::clippedOverflowRectForRepaint):
    * rendering/RenderReplaced.h:
    * rendering/RenderScrollbarPart.cpp:
    (WebCore::RenderScrollbarPart::layout):
    (WebCore::RenderScrollbarPart::paintIntoRect):
    * rendering/RenderSlider.cpp:
    (WebCore::RenderSlider::layout):
    * rendering/RenderTable.cpp:
    (WebCore::RenderTable::layout):
    (WebCore::RenderTable::paint):
    * rendering/RenderTableCell.cpp:
    (WebCore::RenderTableCell::clippedOverflowRectForRepaint):
    * rendering/RenderTableSection.cpp:
    (WebCore::RenderTableSection::layoutRows):
    * rendering/RenderTableSection.h:
    * rendering/RenderText.cpp:
    (WebCore::RenderText::positionForPoint):
    (WebCore::RenderText::localCaretRect):
    * rendering/RenderView.cpp:
    (WebCore::RenderView::layout):
    * rendering/RootInlineBox.cpp:
    (WebCore::RootInlineBox::addHighlightOverflow):
    (WebCore::RootInlineBox::adjustPosition):
    (WebCore::RootInlineBox::verticallyAlignBoxes):
    (WebCore::RootInlineBox::selectionTop):
    * rendering/RootInlineBox.h:
    (WebCore::RootInlineBox::RootInlineBox):
    (WebCore::RootInlineBox::nextRootBox):
    (WebCore::RootInlineBox::prevRootBox):
    (WebCore::RootInlineBox::lineTop):
    (WebCore::RootInlineBox::lineBottom):
    (WebCore::RootInlineBox::selectionBottom):
    (WebCore::RootInlineBox::selectionHeight):
    (WebCore::RootInlineBox::floats):
    (WebCore::RootInlineBox::floatsPtr):
    (WebCore::RootInlineBox::setLineTopBottomPositions):
    * rendering/SVGRootInlineBox.cpp:
    (WebCore::SVGRootInlineBox::layoutInlineBoxes):
    
    LayoutTests: https://bugs.webkit.org/show_bug.cgi?id=20329, shadows and reflections incorrectly being included
    as part of scrollable overflow.
            
    Reviewed by Dan Bernstein.
    
    Update layout tests to account for all of the changes made to overflow to split it into two types.  Remove the layout
    tests that were recently added that assumed that shadows and reflections should be part of scrollable overflow.
    
    * fast/box-shadow/box-shadow-overflow-scroll-expected.txt: Removed.
    * fast/box-shadow/box-shadow-overflow-scroll.html: Removed.
    * fast/reflections/reflection-overflow-scroll-expected.txt: Removed.
    * fast/reflections/reflection-overflow-scroll.html: Removed.
    * platform/mac/compositing/overflow/ancestor-overflow-expected.txt:
    * platform/mac/compositing/reflections/reflection-on-composited-expected.txt:
    * platform/mac/editing/deleting/delete-br-011-expected.txt:
    * platform/mac/editing/deleting/delete-br-012-expected.txt:
    * platform/mac/editing/pasteboard/select-element-1-expected.txt:
    * platform/mac/fast/block/positioning/relative-overflow-block-expected.txt:
    * platform/mac/fast/body-propagation/background-color/002-expected.txt:
    * platform/mac/fast/body-propagation/background-color/002-xhtml-expected.txt:
    * platform/mac/fast/body-propagation/background-image/002-expected.txt:
    * platform/mac/fast/body-propagation/background-image/002-xhtml-expected.txt:
    * platform/mac/fast/body-propagation/overflow/001-expected.txt:
    * platform/mac/fast/body-propagation/overflow/001-xhtml-expected.txt:
    * platform/mac/fast/body-propagation/overflow/005-declarative-expected.txt:
    * platform/mac/fast/body-propagation/overflow/005-expected.txt:
    * platform/mac/fast/body-propagation/overflow/005-xhtml-expected.txt:
    * platform/mac/fast/borders/fieldsetBorderRadius-expected.txt:
    * platform/mac/fast/box-shadow/transform-fringing-expected.txt:
    * platform/mac/fast/clip/008-expected.txt:
    * platform/mac/fast/clip/011-expected.txt:
    * platform/mac/fast/clip/012-expected.txt:
    * platform/mac/fast/dynamic/genContentDestroyChildren-expected.txt:
    * platform/mac/fast/dynamic/window-resize-scrollbars-test-expected.txt:
    * platform/mac/fast/encoding/utf-16-big-endian-expected.txt:
    * platform/mac/fast/encoding/utf-16-little-endian-expected.txt:
    * platform/mac/fast/forms/form-element-geometry-expected.txt:
    * platform/mac/fast/images/image-in-map-expected.txt:
    * platform/mac/fast/inline-block/003-expected.txt:
    * platform/mac/fast/inline/inline-text-quirk-bpm-expected.txt:
    * platform/mac/fast/invalid/012-expected.txt:
    * platform/mac/fast/layers/normal-flow-hit-test-expected.txt:
    * platform/mac/fast/lists/inlineBoxWrapperNullCheck-expected.txt:
    * platform/mac/fast/overflow/scrollRevealButton-expected.txt:
    * platform/mac/fast/reflections/reflection-direction-expected.txt:
    * platform/mac/fast/reflections/reflection-masks-expected.checksum:
    * platform/mac/fast/reflections/reflection-masks-expected.png:
    * platform/mac/fast/reflections/reflection-masks-expected.txt:
    * platform/mac/fast/reflections/reflection-masks-opacity-expected.checksum:
    * platform/mac/fast/reflections/reflection-masks-opacity-expected.png:
    * platform/mac/fast/reflections/reflection-masks-opacity-expected.txt:
    * platform/mac/fast/reflections/reflection-nesting-expected.txt:
    * platform/mac/fast/reflections/reflection-overflow-hidden-expected.png:
    * platform/mac/fast/reflections/reflection-overflow-hidden-expected.txt:
    * platform/mac/fast/repaint/box-shadow-h-expected.txt:
    * platform/mac/fast/repaint/box-shadow-v-expected.txt:
    * platform/mac/fast/repaint/reflection-redraw-expected.txt:
    * platform/mac/fast/repaint/reflection-repaint-test-expected.txt:
    * platform/mac/fast/repaint/transform-absolute-in-positioned-container-expected.txt:
    * platform/mac/fast/repaint/transform-replaced-shadows-expected.txt:
    * platform/mac/fast/replaced/border-radius-clip-expected.txt:
    * platform/mac/fast/transforms/shadows-expected.txt:
    * platform/mac/fast/transforms/transforms-with-opacity-expected.txt:
    * platform/mac/media/video-layer-crash-expected.txt:
    * platform/mac/tables/mozilla/bugs/adforce_imgis_com-expected.txt:
    * platform/mac/tables/mozilla/bugs/bug10565-expected.txt:
    * platform/mac/tables/mozilla/bugs/bug10633-expected.txt:
    * platform/mac/tables/mozilla/bugs/bug113424-expected.txt:
    * platform/mac/tables/mozilla/bugs/bug1188-expected.txt:
    * platform/mac/tables/mozilla/bugs/bug131020-expected.txt:
    * platform/mac/tables/mozilla/bugs/bug1318-expected.txt:
    * platform/mac/tables/mozilla/bugs/bug22513-expected.txt:
    * platform/mac/tables/mozilla/bugs/bug26553-expected.txt:
    * platform/mac/tables/mozilla/bugs/bug3309-1-expected.txt:
    * platform/mac/tables/mozilla/bugs/bug4427-expected.txt:
    * platform/mac/tables/mozilla/bugs/bug4527-expected.txt:
    * platform/mac/tables/mozilla/bugs/bug5538-expected.txt:
    * platform/mac/tables/mozilla/bugs/bug78162-expected.txt:
    * platform/mac/tables/mozilla/bugs/bug8381-expected.txt:
    * platform/mac/tables/mozilla/bugs/bug86708-expected.txt:
    * platform/mac/tables/mozilla/core/bloomberg-expected.txt:
    * platform/mac/tables/mozilla/other/ms-expected.txt:
    * platform/mac/tables/mozilla_expected_failures/bugs/bug23847-expected.txt:
    * platform/mac/tables/mozilla_expected_failures/bugs/bug72393-expected.txt:
    * platform/mac/tables/mozilla_expected_failures/bugs/bug89315-expected.txt:
    * platform/mac/tables/mozilla_expected_failures/marvin/backgr_border-table-quirks-expected.txt:
    * platform/mac/tables/mozilla_expected_failures/marvin/table_overflow_caption_bottom-expected.txt:
    * platform/mac/transforms/3d/point-mapping/3d-point-mapping-2-expected.txt:
    * platform/mac/transforms/3d/point-mapping/3d-point-mapping-deep-expected.txt:
    * platform/mac/transforms/3d/point-mapping/3d-point-mapping-expected.txt:
    * platform/mac/transforms/3d/point-mapping/3d-point-mapping-origins-expected.txt:
    * platform/mac/transforms/3d/point-mapping/3d-point-mapping-overlapping-expected.txt:
    * platform/mac/transforms/3d/point-mapping/3d-point-mapping-preserve-3d-expected.txt:
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@47440 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    5dc5a312