Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1573)

Unified Diff: Source/core/rendering/LayoutState.cpp

Issue 360833002: Divorce PaintInvalidationState from LayoutState (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: ToT again... Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/rendering/LayoutState.cpp
diff --git a/Source/core/rendering/LayoutState.cpp b/Source/core/rendering/LayoutState.cpp
index 7015a53f1747a4e382335807140d0e8106d900c3..e7e4abf0cea0f58f1410ff16bd9e02a32b656b73 100644
--- a/Source/core/rendering/LayoutState.cpp
+++ b/Source/core/rendering/LayoutState.cpp
@@ -34,10 +34,8 @@
namespace WebCore {
LayoutState::LayoutState(LayoutUnit pageLogicalHeight, bool pageLogicalHeightChanged, RenderView& view)
- : m_clipped(false)
- , m_isPaginated(pageLogicalHeight)
+ : m_isPaginated(pageLogicalHeight)
, m_pageLogicalHeightChanged(pageLogicalHeightChanged)
- , m_cachedOffsetsEnabled(true)
, m_columnInfo(0)
, m_next(0)
, m_pageLogicalHeight(pageLogicalHeight)
@@ -53,44 +51,21 @@ LayoutState::LayoutState(RenderBox& renderer, const LayoutSize& offset, LayoutUn
, m_renderer(renderer)
{
renderer.view()->pushLayoutState(*this);
- m_cachedOffsetsEnabled = m_next->m_cachedOffsetsEnabled && renderer.supportsLayoutStateCachedOffsets();
bool fixed = renderer.isOutOfFlowPositioned() && renderer.style()->position() == FixedPosition;
if (fixed) {
// FIXME: This doesn't work correctly with transforms.
FloatPoint fixedOffset = renderer.view()->localToAbsolute(FloatPoint(), IsFixed);
- m_paintOffset = LayoutSize(fixedOffset.x(), fixedOffset.y()) + offset;
+ m_layoutOffset = LayoutSize(fixedOffset.x(), fixedOffset.y()) + offset;
} else {
- m_paintOffset = m_next->m_paintOffset + offset;
+ m_layoutOffset = m_next->m_layoutOffset + offset;
}
if (renderer.isOutOfFlowPositioned() && !fixed) {
if (RenderObject* container = renderer.container()) {
- if (container->isRelPositioned() && container->isRenderInline())
- m_paintOffset += toRenderInline(container)->offsetForInFlowPositionedInline(renderer);
+ if (container->style()->hasInFlowPosition() && container->isRenderInline())
+ m_layoutOffset += toRenderInline(container)->offsetForInFlowPositionedInline(renderer);
}
}
-
- m_layoutOffset = m_paintOffset;
-
- if (renderer.isRelPositioned() && renderer.hasLayer())
- m_paintOffset += renderer.layer()->offsetForInFlowPosition();
-
- m_clipped = !fixed && m_next->m_clipped;
- if (m_clipped)
- m_clipRect = m_next->m_clipRect;
-
- if (renderer.hasOverflowClip()) {
- LayoutRect clipRect(toPoint(m_paintOffset), renderer.cachedSizeForOverflowClip());
- if (m_clipped)
- m_clipRect.intersect(clipRect);
- else {
- m_clipRect = clipRect;
- m_clipped = true;
- }
-
- m_paintOffset -= renderer.scrolledContentOffset();
- }
-
// If we establish a new page height, then cache the offset to the top of the first page.
// We can compare this later on to figure out what part of the page we're actually on,
if (pageLogicalHeight || m_columnInfo || renderer.isRenderFlowThread()) {
@@ -122,49 +97,9 @@ LayoutState::LayoutState(RenderBox& renderer, const LayoutSize& offset, LayoutUn
// FIXME: <http://bugs.webkit.org/show_bug.cgi?id=13443> Apply control clip if present.
}
-LayoutState::LayoutState(RenderInline& renderer)
- : m_next(renderer.view()->layoutState())
- , m_renderer(renderer)
-{
- ASSERT(m_next);
-
- renderer.view()->pushLayoutState(*this);
- m_cachedOffsetsEnabled = m_next->m_cachedOffsetsEnabled && renderer.supportsLayoutStateCachedOffsets();
-
- m_paintOffset = m_next->m_paintOffset;
- // Handle relative positioned inline.
- if (renderer.style()->hasInFlowPosition() && renderer.layer())
- m_paintOffset += renderer.layer()->offsetForInFlowPosition();
-
- // RenderInline can't be out-of-flow positioned.
-
- // The following can't apply to RenderInline so we just propagate them.
- m_clipped = m_next->m_clipped;
- m_clipRect = m_next->m_clipRect;
-
- m_pageLogicalHeight = m_next->m_pageLogicalHeight;
- m_pageLogicalHeightChanged = m_next->m_pageLogicalHeightChanged;
- m_pageOffset = m_next->m_pageOffset;
-
- m_columnInfo = m_next->m_columnInfo;
-}
-
-inline static bool shouldDisableLayoutStateForSubtree(RenderObject& renderer)
-{
- RenderObject* object = &renderer;
- while (object) {
- if (object->supportsLayoutStateCachedOffsets())
- return true;
- object = object->container();
- }
- return false;
-}
-
LayoutState::LayoutState(RenderObject& root)
- : m_clipped(false)
- , m_isPaginated(false)
+ : m_isPaginated(false)
, m_pageLogicalHeightChanged(false)
- , m_cachedOffsetsEnabled(shouldDisableLayoutStateForSubtree(root))
, m_columnInfo(0)
, m_next(root.view()->layoutState())
, m_pageLogicalHeight(0)
@@ -180,14 +115,7 @@ LayoutState::LayoutState(RenderObject& root)
RenderObject* container = root.container();
FloatPoint absContentPoint = container->localToAbsolute(FloatPoint(), UseTransforms);
- m_paintOffset = LayoutSize(absContentPoint.x(), absContentPoint.y());
-
- if (container->hasOverflowClip()) {
- m_clipped = true;
- RenderBox* containerBox = toRenderBox(container);
- m_clipRect = LayoutRect(toPoint(m_paintOffset), containerBox->cachedSizeForOverflowClip());
- m_paintOffset -= containerBox->scrolledContentOffset();
- }
+ m_layoutOffset = LayoutSize(absContentPoint.x(), absContentPoint.y());
}
LayoutState::~LayoutState()

Powered by Google App Engine
This is Rietveld 408576698