Changeset 88102 in webkit


Ignore:
Timestamp:
Jun 4, 2011 2:53:36 AM (13 years ago)
Author:
eae@chromium.org
Message:

2011-06-04 Emil A Eklund <eae@chromium.org>

Reviewed by Eric Seidel.

Convert RenderBox::overflowClipRect to IntPoint
https://bugs.webkit.org/show_bug.cgi?id=62032

Covered by existing tests.

  • editing/Editor.cpp: (WebCore::Editor::insideVisibleArea):
  • platform/graphics/IntRect.h: (WebCore::IntRect::contract):
  • rendering/RenderBlock.cpp: (WebCore::RenderBlock::nodeAtPoint):
  • rendering/RenderBox.cpp: (WebCore::RenderBox::pushContentsClip): (WebCore::RenderBox::overflowClipRect):
  • rendering/RenderBox.h:
  • rendering/RenderBoxModelObject.cpp: (WebCore::RenderBoxModelObject::paintFillLayerExtended):
  • rendering/RenderLayer.cpp: (WebCore::RenderLayer::calculateClipRects): (WebCore::RenderLayer::calculateRects): (WebCore::RenderLayer::repaintBlockSelectionGaps):
  • rendering/RenderLayerBacking.cpp: (WebCore::clipBox):
  • rendering/RenderTable.cpp: (WebCore::RenderTable::overflowClipRect): (WebCore::RenderTable::nodeAtPoint):
  • rendering/RenderTable.h:
  • rendering/RenderTableSection.cpp: (WebCore::RenderTableSection::nodeAtPoint):
  • rendering/svg/RenderSVGRoot.cpp: (WebCore::RenderSVGRoot::paint):
Location:
trunk/Source/WebCore
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r88100 r88102  
     12011-06-04  Emil A Eklund  <eae@chromium.org>
     2
     3        Reviewed by Eric Seidel.
     4
     5        Convert RenderBox::overflowClipRect to IntPoint
     6        https://bugs.webkit.org/show_bug.cgi?id=62032
     7
     8        Covered by existing tests.
     9
     10        * editing/Editor.cpp:
     11        (WebCore::Editor::insideVisibleArea):
     12        * platform/graphics/IntRect.h:
     13        (WebCore::IntRect::contract):
     14        * rendering/RenderBlock.cpp:
     15        (WebCore::RenderBlock::nodeAtPoint):
     16        * rendering/RenderBox.cpp:
     17        (WebCore::RenderBox::pushContentsClip):
     18        (WebCore::RenderBox::overflowClipRect):
     19        * rendering/RenderBox.h:
     20        * rendering/RenderBoxModelObject.cpp:
     21        (WebCore::RenderBoxModelObject::paintFillLayerExtended):
     22        * rendering/RenderLayer.cpp:
     23        (WebCore::RenderLayer::calculateClipRects):
     24        (WebCore::RenderLayer::calculateRects):
     25        (WebCore::RenderLayer::repaintBlockSelectionGaps):
     26        * rendering/RenderLayerBacking.cpp:
     27        (WebCore::clipBox):
     28        * rendering/RenderTable.cpp:
     29        (WebCore::RenderTable::overflowClipRect):
     30        (WebCore::RenderTable::nodeAtPoint):
     31        * rendering/RenderTable.h:
     32        * rendering/RenderTableSection.cpp:
     33        (WebCore::RenderTableSection::nodeAtPoint):
     34        * rendering/svg/RenderSVGRoot.cpp:
     35        (WebCore::RenderSVGRoot::paint):
     36
    1372011-06-04  Adam Barth  <abarth@webkit.org>
    238
  • trunk/Source/WebCore/editing/Editor.cpp

    r87770 r88102  
    25692569        return true;
    25702570
    2571     IntRect rectInPageCoords = container->overflowClipRect(0, 0);
     2571    IntRect rectInPageCoords = container->overflowClipRect(IntPoint());
    25722572    IntRect rectInFrameCoords = IntRect(renderer->x() * -1, renderer->y() * -1,
    25732573                                    rectInPageCoords.width(), rectInPageCoords.height());
     
    25982598        return true;
    25992599
    2600     IntRect rectInPageCoords = container->overflowClipRect(0, 0);
     2600    IntRect rectInPageCoords = container->overflowClipRect(IntPoint());
    26012601    IntRect rectInFrameCoords = IntRect(renderer->x() * -1, renderer->y() * -1,
    26022602                                    rectInPageCoords.width(), rectInPageCoords.height());
  • trunk/Source/WebCore/platform/graphics/IntRect.h

    r88096 r88102  
    114114    void expand(const IntSize& size) { m_size += size; }
    115115    void expand(int dw, int dh) { m_size.expand(dw, dh); }
     116    void contract(const IntSize& size) { m_size -= size; }
     117    void contract(int dw, int dh) { m_size.expand(-dw, -dh); }
    116118
    117119    void shiftXEdgeTo(int edge)
  • trunk/Source/WebCore/rendering/RenderBlock.cpp

    r88087 r88102  
    39243924    bool useClip = (hasControlClip() || useOverflowClip);
    39253925    IntRect hitTestArea(result.rectForPoint(pointInContainer));
    3926     bool checkChildren = !useClip || (hasControlClip() ? controlClipRect(toPoint(localOffset)).intersects(hitTestArea) : overflowClipRect(localOffset.width(), localOffset.height(), IncludeOverlayScrollbarSize).intersects(hitTestArea));
     3926    bool checkChildren = !useClip || (hasControlClip() ? controlClipRect(toPoint(localOffset)).intersects(hitTestArea) : overflowClipRect(toPoint(localOffset), IncludeOverlayScrollbarSize).intersects(hitTestArea));
    39273927    if (checkChildren) {
    39283928        // Hit test descendants first.
  • trunk/Source/WebCore/rendering/RenderBox.cpp

    r88087 r88102  
    11151115        paintInfo.phase = PaintPhaseChildBlockBackgrounds;
    11161116    }
    1117     IntRect clipRect(isControlClip ? controlClipRect(IntPoint(tx, ty)) : overflowClipRect(tx, ty));
     1117    IntRect clipRect(isControlClip ? controlClipRect(IntPoint(tx, ty)) : overflowClipRect(IntPoint(tx, ty)));
    11181118    paintInfo.context->save();
    11191119    if (style()->hasBorderRadius())
     
    11361136}
    11371137
    1138 IntRect RenderBox::overflowClipRect(int tx, int ty, OverlayScrollbarSizeRelevancy relevancy)
     1138IntRect RenderBox::overflowClipRect(const IntPoint& location, OverlayScrollbarSizeRelevancy relevancy)
    11391139{
    11401140    // FIXME: When overflow-clip (CSS3) is implemented, we'll obtain the property
    11411141    // here.
    1142 
    1143     int bLeft = borderLeft();
    1144     int bTop = borderTop();
    1145 
    1146     int clipX = tx + bLeft;
    1147     int clipY = ty + bTop;
    1148     int clipWidth = width() - bLeft - borderRight();
    1149     int clipHeight = height() - bTop - borderBottom();
     1142    IntRect clipRect(location + IntSize(borderLeft(), borderTop()),
     1143        size() - IntSize(borderLeft() + borderRight(), borderTop() + borderBottom()));
    11501144
    11511145    // Subtract out scrollbars if we have them.
    1152     if (layer()) {
    1153         clipWidth -= layer()->verticalScrollbarWidth(relevancy);
    1154         clipHeight -= layer()->horizontalScrollbarHeight(relevancy);
    1155     }
    1156 
    1157     return IntRect(clipX, clipY, clipWidth, clipHeight);
     1146    if (layer())
     1147        clipRect.contract(layer()->verticalScrollbarWidth(relevancy), layer()->horizontalScrollbarHeight(relevancy));
     1148
     1149    return clipRect;
    11581150}
    11591151
  • trunk/Source/WebCore/rendering/RenderBox.h

    r88087 r88102  
    346346    virtual IntRect localCaretRect(InlineBox*, int caretOffset, int* extraWidthToEndOfLine = 0);
    347347
    348     virtual IntRect overflowClipRect(int tx, int ty, OverlayScrollbarSizeRelevancy relevancy = IgnoreOverlayScrollbarSize);
     348    virtual IntRect overflowClipRect(const IntPoint& location, OverlayScrollbarSizeRelevancy = IgnoreOverlayScrollbarSize);
    349349    IntRect clipRect(int tx, int ty);
    350350    virtual bool hasControlClip() const { return false; }
  • trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp

    r87753 r88102  
    656656    if (clippedWithLocalScrolling) {
    657657        // Clip to the overflow area.
    658         context->clip(toRenderBox(this)->overflowClipRect(rect.x(), rect.y()));
     658        context->clip(toRenderBox(this)->overflowClipRect(rect.location()));
    659659       
    660660        // Adjust the paint rect to reflect a scrolled content box with borders at the ends.
  • trunk/Source/WebCore/rendering/RenderLayer.cpp

    r87989 r88102  
    33753375       
    33763376        if (renderer()->hasOverflowClip()) {
    3377             IntRect newOverflowClip = toRenderBox(renderer())->overflowClipRect(offset.x(), offset.y(), relevancy);
     3377            IntRect newOverflowClip = toRenderBox(renderer())->overflowClipRect(offset, relevancy);
    33783378            clipRects.setOverflowClipRect(intersection(newOverflowClip, clipRects.overflowClipRect()));
    33793379            if (renderer()->isPositioned() || renderer()->isRelPositioned())
     
    34393439        // This layer establishes a clip of some kind.
    34403440        if (renderer()->hasOverflowClip())
    3441             foregroundRect.intersect(toRenderBox(renderer())->overflowClipRect(offset.x(), offset.y(), relevancy));
     3441            foregroundRect.intersect(toRenderBox(renderer())->overflowClipRect(offset, relevancy));
    34423442        if (renderer()->hasClip()) {
    34433443            // Clip applies to *us* as well, so go ahead and update the damageRect.
     
    35113511    rect.move(-scrolledContentOffset());
    35123512    if (renderer()->hasOverflowClip())
    3513         rect.intersect(toRenderBox(renderer())->overflowClipRect(0, 0));
     3513        rect.intersect(toRenderBox(renderer())->overflowClipRect(IntPoint()));
    35143514    if (renderer()->hasClip())
    35153515        rect.intersect(toRenderBox(renderer())->clipRect(0, 0));
  • trunk/Source/WebCore/rendering/RenderLayerBacking.cpp

    r87989 r88102  
    317317    IntRect result = PaintInfo::infiniteRect();
    318318    if (renderer->hasOverflowClip())
    319         result = renderer->overflowClipRect(0, 0);
     319        result = renderer->overflowClipRect(IntPoint());
    320320
    321321    if (renderer->hasClip())
  • trunk/Source/WebCore/rendering/RenderTable.cpp

    r88087 r88102  
    11721172}
    11731173
    1174 IntRect RenderTable::overflowClipRect(int tx, int ty, OverlayScrollbarSizeRelevancy relevancy)
    1175 {
    1176     IntRect rect = RenderBlock::overflowClipRect(tx, ty, relevancy);
     1174IntRect RenderTable::overflowClipRect(const IntPoint& location, OverlayScrollbarSizeRelevancy relevancy)
     1175{
     1176    IntRect rect = RenderBlock::overflowClipRect(location, relevancy);
    11771177   
    11781178    // If we have a caption, expand the clip to include the caption.
     
    11851185        if (style()->isHorizontalWritingMode()) {
    11861186            rect.setHeight(height());
    1187             rect.setY(ty);
     1187            rect.setY(location.y());
    11881188        } else {
    11891189            rect.setWidth(width());
    1190             rect.setX(tx);
     1190            rect.setX(location.x());
    11911191        }
    11921192    }
     
    12011201
    12021202    // Check kids first.
    1203     if (!hasOverflowClip() || overflowClipRect(tx, ty).intersects(result.rectForPoint(pointInContainer))) {
     1203    if (!hasOverflowClip() || overflowClipRect(IntPoint(tx, ty)).intersects(result.rectForPoint(pointInContainer))) {
    12041204        for (RenderObject* child = lastChild(); child; child = child->previousSibling()) {
    12051205            if (child->isBox() && !toRenderBox(child)->hasSelfPaintingLayer() && (child->isTableSection() || child == m_caption)) {
  • trunk/Source/WebCore/rendering/RenderTable.h

    r88087 r88102  
    232232    virtual void computeLogicalWidth();
    233233
    234     virtual IntRect overflowClipRect(int tx, int ty, OverlayScrollbarSizeRelevancy relevancy = IgnoreOverlayScrollbarSize);
     234    virtual IntRect overflowClipRect(const IntPoint& location, OverlayScrollbarSizeRelevancy = IgnoreOverlayScrollbarSize);
    235235
    236236    virtual void addOverflowFromChildren();
  • trunk/Source/WebCore/rendering/RenderTableSection.cpp

    r88087 r88102  
    11541154    ty += y();
    11551155
    1156     if (hasOverflowClip() && !overflowClipRect(tx, ty).intersects(result.rectForPoint(pointInContainer)))
     1156    if (hasOverflowClip() && !overflowClipRect(IntPoint(tx, ty)).intersects(result.rectForPoint(pointInContainer)))
    11571157        return false;
    11581158
  • trunk/Source/WebCore/rendering/svg/RenderSVGRoot.cpp

    r88033 r88102  
    291291
    292292    // Apply initial viewport clip - not affected by overflow handling
    293     childPaintInfo.context->clip(overflowClipRect(borderBoxOriginInContainer.x(), borderBoxOriginInContainer.y()));
     293    childPaintInfo.context->clip(overflowClipRect(borderBoxOriginInContainer));
    294294
    295295    // Convert from container offsets (html renderers) to a relative transform (svg renderers).
Note: See TracChangeset for help on using the changeset viewer.