Skip to content
Permalink
Browse files
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.


Canonical link: https://commits.webkit.org/96916@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@109157 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
Julien Chaffraix committed Feb 28, 2012
1 parent 4994e27 commit a1494aa20fad2e06c565c49cd9f15c9c3c3f5f84
@@ -1,3 +1,34 @@
2012-02-28 Julien Chaffraix <jchaffraix@webkit.org>

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 <tdresser@chromium.org>

Provide DefaultDeviceScaleFactor though WebSettings
@@ -70,8 +70,7 @@ LayoutState::LayoutState(LayoutState* prev, RenderBox* renderer, const LayoutSiz
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 @@ LayoutState::LayoutState(RenderObject* root)
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();
}
}
@@ -753,6 +753,14 @@ IntSize RenderBox::scrolledContentOffset() const
return layer()->scrolledContentOffset();
}

IntSize RenderBox::cachedSizeForOverflowClip() const
{
ASSERT(hasOverflowClip());
ASSERT(hasLayer());

return layer()->size();
}

LayoutUnit RenderBox::minPreferredLogicalWidth() const
{
if (preferredLogicalWidthsDirty())
@@ -1642,7 +1650,7 @@ void RenderBox::computeRectForRepaint(RenderBoxModelObject* repaintContainer, La
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;
@@ -448,6 +448,7 @@ class RenderBox : public RenderBoxModelObject {
virtual void computeIntrinsicRatioInformation(FloatSize& /* intrinsicSize */, double& /* intrinsicRatio */, bool& /* isPercentageIntrinsicSize */) const { }

IntSize scrolledContentOffset() const;
IntSize cachedSizeForOverflowClip() const;

virtual bool hasRelativeDimensions() const;

@@ -1033,7 +1033,7 @@ LayoutRect RenderInline::clippedOverflowRectForRepaint(RenderBoxModelObject* rep
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 @@ void RenderInline::computeRectForRepaint(RenderBoxModelObject* repaintContainer,
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;
@@ -1520,7 +1520,7 @@ void RenderObject::computeRectForRepaint(RenderBoxModelObject* repaintContainer,
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;

0 comments on commit a1494aa

Please sign in to comment.