Source/WebCore/ChangeLog

 12011-06-03 Emil A Eklund <eae@chromium.org>
 2
 3 Reviewed by NOBODY (OOPS!).
 4
 5 Convert RenderBox::clipRect to IntPoint
 6 https://bugs.webkit.org/show_bug.cgi?id=62045
 7
 8 Covered by existing tests.
 9
 10 * platform/graphics/IntRect.h:
 11 (WebCore::IntRect::contract):
 12 * rendering/RenderBox.cpp:
 13 (WebCore::RenderBox::clipRect):
 14 * rendering/RenderBox.h:
 15 * rendering/RenderLayer.cpp:
 16 (WebCore::RenderLayer::calculateClipRects):
 17 (WebCore::RenderLayer::calculateRects):
 18 (WebCore::RenderLayer::repaintBlockSelectionGaps):
 19 * rendering/RenderLayerBacking.cpp:
 20 (WebCore::clipBox):
 21
1222011-06-03 Alexis Menard <alexis.menard@openbossa.org>
223
324 Reviewed by Andreas Kling.
88046

Source/WebCore/platform/graphics/IntRect.h

@@public:
113113
114114 void expand(const IntSize& size) { m_location += size; }
115115 void expand(int dw, int dh) { m_size.expand(dw, dh); }
 116 void contract(int dw, int dh) { m_size.expand(-dw, -dh); }
116117
117118 void shiftXEdgeTo(int edge)
118119 {
87865

Source/WebCore/rendering/RenderBox.cpp

@@IntRect RenderBox::overflowClipRect(int
11591159 return IntRect(clipX, clipY, clipWidth, clipHeight);
11601160}
11611161
1162 IntRect RenderBox::clipRect(int tx, int ty)
 1162IntRect RenderBox::clipRect(const IntPoint& location)
11631163{
1164  int clipX = tx;
1165  int clipY = ty;
1166  int clipWidth = width();
1167  int clipHeight = height();
1168 
 1164 IntRect clipRect(location, size());
11691165 if (!style()->clipLeft().isAuto()) {
11701166 int c = style()->clipLeft().calcValue(width());
1171  clipX += c;
1172  clipWidth -= c;
 1167 clipRect.move(c, 0);
 1168 clipRect.contract(c, 0);
11731169 }
11741170
11751171 if (!style()->clipRight().isAuto())
1176  clipWidth -= width() - style()->clipRight().calcValue(width());
 1172 clipRect.contract(width() - style()->clipRight().calcValue(width()), 0);
11771173
11781174 if (!style()->clipTop().isAuto()) {
11791175 int c = style()->clipTop().calcValue(height());
1180  clipY += c;
1181  clipHeight -= c;
 1176 clipRect.move(0, c);
 1177 clipRect.contract(0, c);
11821178 }
11831179
11841180 if (!style()->clipBottom().isAuto())
1185  clipHeight -= height() - style()->clipBottom().calcValue(height());
 1181 clipRect.contract(0, height() - style()->clipBottom().calcValue(height()));
11861182
1187  return IntRect(clipX, clipY, clipWidth, clipHeight);
 1183 return clipRect;
11881184}
11891185
11901186int RenderBox::containingBlockLogicalWidthForContent() const
87865

Source/WebCore/rendering/RenderBox.h

@@public:
346346 virtual IntRect localCaretRect(InlineBox*, int caretOffset, int* extraWidthToEndOfLine = 0);
347347
348348 virtual IntRect overflowClipRect(int tx, int ty, OverlayScrollbarSizeRelevancy relevancy = IgnoreOverlayScrollbarSize);
349  IntRect clipRect(int tx, int ty);
 349 IntRect clipRect(const IntPoint& location);
350350 virtual bool hasControlClip() const { return false; }
351351 virtual IntRect controlClipRect(const IntPoint&) const { return IntRect(); }
352352 bool pushContentsClip(PaintInfo&, int tx, int ty);
87865

Source/WebCore/rendering/RenderLayer.cpp

@@void RenderLayer::calculateClipRects(con
33943394 clipRects.setPosClipRect(intersection(newOverflowClip, clipRects.posClipRect()));
33953395 }
33963396 if (renderer()->hasClip()) {
3397  IntRect newPosClip = toRenderBox(renderer())->clipRect(x, y);
 3397 IntRect newPosClip = toRenderBox(renderer())->clipRect(IntPoint(x, y));
33983398 clipRects.setPosClipRect(intersection(newPosClip, clipRects.posClipRect()));
33993399 clipRects.setOverflowClipRect(intersection(newPosClip, clipRects.overflowClipRect()));
34003400 clipRects.setFixedClipRect(intersection(newPosClip, clipRects.fixedClipRect()));

@@void RenderLayer::calculateRects(const R
34563456 foregroundRect.intersect(toRenderBox(renderer())->overflowClipRect(x, y, relevancy));
34573457 if (renderer()->hasClip()) {
34583458 // Clip applies to *us* as well, so go ahead and update the damageRect.
3459  IntRect newPosClip = toRenderBox(renderer())->clipRect(x, y);
 3459 IntRect newPosClip = toRenderBox(renderer())->clipRect(IntPoint(x, y));
34603460 backgroundRect.intersect(newPosClip);
34613461 foregroundRect.intersect(newPosClip);
34623462 outlineRect.intersect(newPosClip);

@@void RenderLayer::repaintBlockSelectionG
35273527 if (renderer()->hasOverflowClip())
35283528 rect.intersect(toRenderBox(renderer())->overflowClipRect(0, 0));
35293529 if (renderer()->hasClip())
3530  rect.intersect(toRenderBox(renderer())->clipRect(0, 0));
 3530 rect.intersect(toRenderBox(renderer())->clipRect(IntPoint()));
35313531 if (!rect.isEmpty())
35323532 renderer()->repaintRectangle(rect);
35333533}
87865

Source/WebCore/rendering/RenderLayerBacking.cpp

@@static IntRect clipBox(RenderBox* render
320320 result = renderer->overflowClipRect(0, 0);
321321
322322 if (renderer->hasClip())
323  result.intersect(renderer->clipRect(0, 0));
 323 result.intersect(renderer->clipRect(IntPoint()));
324324
325325 return result;
326326}
87865