- Revision
- 109157
- Author
- [email protected]
- Date
- 2012-02-28 15:09:06 -0800 (Tue, 28 Feb 2012)
Log Message
Move RenderLayer::size() calls to a common function
https://bugs.webkit.org/show_bug.cgi?id=76972
Reviewed by Simon Fraser.
Refactoring only.
This change introduces RenderBox::cachedSizeForOverflowClip() that handles all the cached size
requests that currently goes through the RenderLayer. This indirection helps to decouple the need
for a RenderLayer so that we can lazily allocate RenderLayers as part of bug 75568.
* rendering/RenderBox.cpp:
(WebCore::RenderBox::cachedSizeForOverflowClip):
Added this function to handle the calls to RenderLayer's size(). Unfortunately a lot of the
code calls RenderLayer::size() directly so I could not make it private.
* rendering/LayoutState.cpp:
(WebCore::LayoutState::LayoutState):
* rendering/RenderBox.cpp:
(WebCore::RenderBox::computeRectForRepaint):
* rendering/RenderBox.h:
(RenderBox):
* rendering/RenderInline.cpp:
(WebCore::RenderInline::clippedOverflowRectForRepaint):
(WebCore::RenderInline::computeRectForRepaint):
* rendering/RenderObject.cpp:
(WebCore::RenderObject::computeRectForRepaint):
Fixed the call sites above.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (109156 => 109157)
--- trunk/Source/WebCore/ChangeLog 2012-02-28 23:08:56 UTC (rev 109156)
+++ trunk/Source/WebCore/ChangeLog 2012-02-28 23:09:06 UTC (rev 109157)
@@ -1,3 +1,34 @@
+2012-02-28 Julien Chaffraix <[email protected]>
+
+ Move RenderLayer::size() calls to a common function
+ https://bugs.webkit.org/show_bug.cgi?id=76972
+
+ Reviewed by Simon Fraser.
+
+ Refactoring only.
+
+ This change introduces RenderBox::cachedSizeForOverflowClip() that handles all the cached size
+ requests that currently goes through the RenderLayer. This indirection helps to decouple the need
+ for a RenderLayer so that we can lazily allocate RenderLayers as part of bug 75568.
+
+ * rendering/RenderBox.cpp:
+ (WebCore::RenderBox::cachedSizeForOverflowClip):
+ Added this function to handle the calls to RenderLayer's size(). Unfortunately a lot of the
+ code calls RenderLayer::size() directly so I could not make it private.
+
+ * rendering/LayoutState.cpp:
+ (WebCore::LayoutState::LayoutState):
+ * rendering/RenderBox.cpp:
+ (WebCore::RenderBox::computeRectForRepaint):
+ * rendering/RenderBox.h:
+ (RenderBox):
+ * rendering/RenderInline.cpp:
+ (WebCore::RenderInline::clippedOverflowRectForRepaint):
+ (WebCore::RenderInline::computeRectForRepaint):
+ * rendering/RenderObject.cpp:
+ (WebCore::RenderObject::computeRectForRepaint):
+ Fixed the call sites above.
+
2012-02-28 Tim Dresser <[email protected]>
Provide DefaultDeviceScaleFactor though WebSettings
Modified: trunk/Source/WebCore/rendering/LayoutState.cpp (109156 => 109157)
--- trunk/Source/WebCore/rendering/LayoutState.cpp 2012-02-28 23:08:56 UTC (rev 109156)
+++ trunk/Source/WebCore/rendering/LayoutState.cpp 2012-02-28 23:09:06 UTC (rev 109157)
@@ -70,8 +70,7 @@
m_clipRect = prev->m_clipRect;
if (renderer->hasOverflowClip()) {
- RenderLayer* layer = renderer->layer();
- LayoutRect clipRect(toPoint(m_paintOffset) + renderer->view()->layoutDelta(), layer->size());
+ LayoutRect clipRect(toPoint(m_paintOffset) + renderer->view()->layoutDelta(), renderer->cachedSizeForOverflowClip());
if (m_clipped)
m_clipRect.intersect(clipRect);
else {
@@ -156,10 +155,9 @@
m_paintOffset = LayoutSize(absContentPoint.x(), absContentPoint.y());
if (container->hasOverflowClip()) {
- RenderBox* containerBox = toRenderBox(container);
- RenderLayer* layer = containerBox->layer();
m_clipped = true;
- m_clipRect = LayoutRect(toPoint(m_paintOffset), layer->size());
+ RenderBox* containerBox = toRenderBox(container);
+ m_clipRect = LayoutRect(toPoint(m_paintOffset), containerBox->cachedSizeForOverflowClip());
m_paintOffset -= containerBox->scrolledContentOffset();
}
}
Modified: trunk/Source/WebCore/rendering/RenderBox.cpp (109156 => 109157)
--- trunk/Source/WebCore/rendering/RenderBox.cpp 2012-02-28 23:08:56 UTC (rev 109156)
+++ trunk/Source/WebCore/rendering/RenderBox.cpp 2012-02-28 23:09:06 UTC (rev 109157)
@@ -753,6 +753,14 @@
return layer()->scrolledContentOffset();
}
+IntSize RenderBox::cachedSizeForOverflowClip() const
+{
+ ASSERT(hasOverflowClip());
+ ASSERT(hasLayer());
+
+ return layer()->size();
+}
+
LayoutUnit RenderBox::minPreferredLogicalWidth() const
{
if (preferredLogicalWidthsDirty())
@@ -1642,7 +1650,7 @@
topLeft -= containerBox->scrolledContentOffset(); // For overflow:auto/scroll/hidden.
LayoutRect repaintRect(topLeft, rect.size());
- LayoutRect boxRect(LayoutPoint(), containerBox->layer()->size());
+ LayoutRect boxRect(LayoutPoint(), containerBox->cachedSizeForOverflowClip());
rect = intersection(repaintRect, boxRect);
if (rect.isEmpty())
return;
Modified: trunk/Source/WebCore/rendering/RenderBox.h (109156 => 109157)
--- trunk/Source/WebCore/rendering/RenderBox.h 2012-02-28 23:08:56 UTC (rev 109156)
+++ trunk/Source/WebCore/rendering/RenderBox.h 2012-02-28 23:09:06 UTC (rev 109157)
@@ -448,6 +448,7 @@
virtual void computeIntrinsicRatioInformation(FloatSize& /* intrinsicSize */, double& /* intrinsicRatio */, bool& /* isPercentageIntrinsicSize */) const { }
IntSize scrolledContentOffset() const;
+ IntSize cachedSizeForOverflowClip() const;
virtual bool hasRelativeDimensions() const;
Modified: trunk/Source/WebCore/rendering/RenderInline.cpp (109156 => 109157)
--- trunk/Source/WebCore/rendering/RenderInline.cpp 2012-02-28 23:08:56 UTC (rev 109156)
+++ trunk/Source/WebCore/rendering/RenderInline.cpp 2012-02-28 23:09:06 UTC (rev 109157)
@@ -1033,7 +1033,7 @@
LayoutRect repaintRect(r);
repaintRect.move(-cb->scrolledContentOffset()); // For overflow:auto/scroll/hidden.
- LayoutRect boxRect(LayoutPoint(), cb->layer()->size());
+ LayoutRect boxRect(LayoutPoint(), cb->cachedSizeForOverflowClip());
r = intersection(repaintRect, boxRect);
}
@@ -1135,7 +1135,7 @@
topLeft -= containerBox->scrolledContentOffset(); // For overflow:auto/scroll/hidden.
LayoutRect repaintRect(topLeft, rect.size());
- LayoutRect boxRect(LayoutPoint(), containerBox->layer()->size());
+ LayoutRect boxRect(LayoutPoint(), containerBox->cachedSizeForOverflowClip());
rect = intersection(repaintRect, boxRect);
if (rect.isEmpty())
return;
Modified: trunk/Source/WebCore/rendering/RenderObject.cpp (109156 => 109157)
--- trunk/Source/WebCore/rendering/RenderObject.cpp 2012-02-28 23:08:56 UTC (rev 109156)
+++ trunk/Source/WebCore/rendering/RenderObject.cpp 2012-02-28 23:09:06 UTC (rev 109157)
@@ -1520,7 +1520,7 @@
LayoutRect repaintRect(rect);
repaintRect.move(-boxParent->scrolledContentOffset()); // For overflow:auto/scroll/hidden.
- LayoutRect boxRect(LayoutPoint(), boxParent->layer()->size());
+ LayoutRect boxRect(LayoutPoint(), boxParent->cachedSizeForOverflowClip());
rect = intersection(repaintRect, boxRect);
if (rect.isEmpty())
return;