Diff
Modified: trunk/Source/WebCore/ChangeLog (238962 => 238963)
--- trunk/Source/WebCore/ChangeLog 2018-12-07 19:32:23 UTC (rev 238962)
+++ trunk/Source/WebCore/ChangeLog 2018-12-07 20:10:14 UTC (rev 238963)
@@ -1,5 +1,85 @@
2018-12-07 Antti Koivisto <[email protected]>
+ Rename LayoutState to RenderLayoutState
+ https://bugs.webkit.org/show_bug.cgi?id=192504
+
+ Reviewed by Zalan Bujtas.
+
+ The name is better used in LFC.
+
+ * Sources.txt:
+ * WebCore.xcodeproj/project.pbxproj:
+ * page/FrameViewLayoutContext.cpp:
+ (WebCore::FrameViewLayoutContext::layoutState const):
+ (WebCore::FrameViewLayoutContext::pushLayoutState):
+ (WebCore::FrameViewLayoutContext::pushLayoutStateForPaginationIfNeeded):
+ * page/FrameViewLayoutContext.h:
+ * rendering/LayoutState.cpp: Removed.
+ * rendering/LayoutState.h: Removed.
+ * rendering/RenderBlock.cpp:
+ * rendering/RenderBlock.h:
+ * rendering/RenderBlockFlow.cpp:
+ (WebCore::RenderBlockFlow::checkForPaginationLogicalHeightChange):
+ * rendering/RenderBlockLineLayout.cpp:
+ * rendering/RenderBox.cpp:
+ * rendering/RenderEmbeddedObject.cpp:
+ * rendering/RenderFragmentedFlow.cpp:
+ * rendering/RenderGrid.cpp:
+ * rendering/RenderImage.cpp:
+ * rendering/RenderInline.cpp:
+ * rendering/RenderLayoutState.cpp: Copied from Source/WebCore/rendering/LayoutState.cpp.
+ (WebCore::RenderLayoutState::RenderLayoutState):
+ (WebCore::RenderLayoutState::computeOffsets):
+ (WebCore::RenderLayoutState::computeClipRect):
+ (WebCore::RenderLayoutState::computePaginationInformation):
+ (WebCore::RenderLayoutState::pageLogicalOffset const):
+ (WebCore::RenderLayoutState::computeLineGridPaginationOrigin):
+ (WebCore::RenderLayoutState::propagateLineGridInfo):
+ (WebCore::RenderLayoutState::establishLineGrid):
+ (WebCore::RenderLayoutState::addLayoutDelta):
+ (WebCore::RenderLayoutState::layoutDeltaMatches const):
+ (WebCore::LayoutState::LayoutState): Deleted.
+ (WebCore::LayoutState::computeOffsets): Deleted.
+ (WebCore::LayoutState::computeClipRect): Deleted.
+ (WebCore::LayoutState::computePaginationInformation): Deleted.
+ (WebCore::LayoutState::pageLogicalOffset const): Deleted.
+ (WebCore::LayoutState::computeLineGridPaginationOrigin): Deleted.
+ (WebCore::LayoutState::propagateLineGridInfo): Deleted.
+ (WebCore::LayoutState::establishLineGrid): Deleted.
+ (WebCore::LayoutState::addLayoutDelta): Deleted.
+ (WebCore::LayoutState::layoutDeltaMatches const): Deleted.
+ * rendering/RenderLayoutState.h: Copied from Source/WebCore/rendering/LayoutState.h.
+ (WebCore::RenderLayoutState::RenderLayoutState):
+ (WebCore::LayoutState::LayoutState): Deleted.
+ (WebCore::LayoutState::isPaginated const): Deleted.
+ (WebCore::LayoutState::pageLogicalHeight const): Deleted.
+ (WebCore::LayoutState::pageLogicalHeightChanged const): Deleted.
+ (WebCore::LayoutState::lineGrid const): Deleted.
+ (WebCore::LayoutState::lineGridOffset const): Deleted.
+ (WebCore::LayoutState::lineGridPaginationOrigin const): Deleted.
+ (WebCore::LayoutState::paintOffset const): Deleted.
+ (WebCore::LayoutState::layoutOffset const): Deleted.
+ (WebCore::LayoutState::pageOffset const): Deleted.
+ (WebCore::LayoutState::needsBlockDirectionLocationSetBeforeLayout const): Deleted.
+ (WebCore::LayoutState::renderer const): Deleted.
+ (WebCore::LayoutState::clipRect const): Deleted.
+ (WebCore::LayoutState::isClipped const): Deleted.
+ (WebCore::LayoutState::layoutDelta const): Deleted.
+ * rendering/RenderListBox.cpp:
+ * rendering/RenderMediaControlElements.cpp:
+ * rendering/RenderMultiColumnFlow.cpp:
+ * rendering/RenderTable.cpp:
+ * rendering/RenderTableRow.cpp:
+ * rendering/RenderTableSection.cpp:
+ * rendering/RenderVTTCue.cpp:
+ * rendering/RenderView.cpp:
+ * rendering/RenderView.h:
+ * rendering/RootInlineBox.cpp:
+ * rendering/svg/RenderSVGRoot.cpp:
+ (WebCore::RenderSVGRoot::layout):
+
+2018-12-07 Antti Koivisto <[email protected]>
+
[LFC] Rename formattingContext() to createFormattingContext()
https://bugs.webkit.org/show_bug.cgi?id=192500
Modified: trunk/Source/WebCore/Sources.txt (238962 => 238963)
--- trunk/Source/WebCore/Sources.txt 2018-12-07 19:32:23 UTC (rev 238962)
+++ trunk/Source/WebCore/Sources.txt 2018-12-07 20:10:14 UTC (rev 238963)
@@ -1917,7 +1917,6 @@
rendering/InlineTextBox.cpp
rendering/LayoutDisallowedScope.cpp
rendering/LayoutRepainter.cpp
-rendering/LayoutState.cpp
rendering/MarkedText.cpp
rendering/OrderIterator.cpp
rendering/PointerEventsHitRules.cpp
@@ -1956,6 +1955,7 @@
rendering/RenderLayerCompositor.cpp
rendering/RenderLayerFilters.cpp
rendering/RenderLayerModelObject.cpp
+rendering/RenderLayoutState.cpp
rendering/RenderLineBoxList.cpp
rendering/RenderLineBreak.cpp
rendering/RenderListBox.cpp
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (238962 => 238963)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2018-12-07 19:32:23 UTC (rev 238962)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2018-12-07 20:10:14 UTC (rev 238963)
@@ -807,7 +807,7 @@
2D8B92FE203D13E1009C868F /* UnifiedSource529.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DE5F85CF1FA23850006DB63B /* UnifiedSource529.cpp */; };
2D8B92FF203D13E1009C868F /* UnifiedSource530.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DE5F85D31FA23859006DB63B /* UnifiedSource530.cpp */; };
2D8FEBDD143E3EF70072502B /* CSSCrossfadeValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D8FEBDB143E3EF70072502B /* CSSCrossfadeValue.h */; };
- 2D9066070BE141D400956998 /* LayoutState.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D9066050BE141D400956998 /* LayoutState.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 2D9066070BE141D400956998 /* RenderLayoutState.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D9066050BE141D400956998 /* RenderLayoutState.h */; settings = {ATTRIBUTES = (Private, ); }; };
2D92A79A2134AD7900F493FD /* QuickLookSoftLink.mm in Sources */ = {isa = PBXBuildFile; fileRef = 443917FD1A91B2F8006E04F2 /* QuickLookSoftLink.mm */; };
2D92A79D2134AF9500F493FD /* UserAgentIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = A3AF9D8320325691006CAD06 /* UserAgentIOS.mm */; };
2D93AEE319DF5641002A86C3 /* ServicesOverlayController.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D93AEE119DF5641002A86C3 /* ServicesOverlayController.h */; };
@@ -6652,8 +6652,8 @@
2D8287F516E4A0380086BD00 /* HitTestLocation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HitTestLocation.h; sourceTree = "<group>"; };
2D8FEBDA143E3EF70072502B /* CSSCrossfadeValue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CSSCrossfadeValue.cpp; sourceTree = "<group>"; };
2D8FEBDB143E3EF70072502B /* CSSCrossfadeValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSSCrossfadeValue.h; sourceTree = "<group>"; };
- 2D9066040BE141D400956998 /* LayoutState.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = LayoutState.cpp; sourceTree = "<group>"; };
- 2D9066050BE141D400956998 /* LayoutState.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = LayoutState.h; sourceTree = "<group>"; };
+ 2D9066040BE141D400956998 /* RenderLayoutState.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = RenderLayoutState.cpp; sourceTree = "<group>"; };
+ 2D9066050BE141D400956998 /* RenderLayoutState.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = RenderLayoutState.h; sourceTree = "<group>"; };
2D90660C0665D937006B6F1A /* DataTransferMac.mm */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DataTransferMac.mm; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
2D93AEE119DF5641002A86C3 /* ServicesOverlayController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ServicesOverlayController.h; sourceTree = "<group>"; };
2D93AEE219DF5641002A86C3 /* ServicesOverlayController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ServicesOverlayController.mm; sourceTree = "<group>"; };
@@ -26507,8 +26507,6 @@
9BD1F6801F0462B8001C9CDD /* LayoutDisallowedScope.h */,
A120ACA113F9984600FE4AC7 /* LayoutRepainter.cpp */,
A120ACA013F9983700FE4AC7 /* LayoutRepainter.h */,
- 2D9066040BE141D400956998 /* LayoutState.cpp */,
- 2D9066050BE141D400956998 /* LayoutState.h */,
9BA273F3172206BB0097CE47 /* LogicalSelectionOffsetCaches.h */,
CE1866421F72E5B400A0CAB6 /* MarkedText.cpp */,
CE1866431F72E5B400A0CAB6 /* MarkedText.h */,
@@ -26595,6 +26593,8 @@
0F53FB89213B768400C40D34 /* RenderLayerFilters.h */,
3C244FE5A375AC633F88BE6F /* RenderLayerModelObject.cpp */,
3C244FE4A375AC633F88BE6F /* RenderLayerModelObject.h */,
+ 2D9066040BE141D400956998 /* RenderLayoutState.cpp */,
+ 2D9066050BE141D400956998 /* RenderLayoutState.h */,
BC33FB1A0F30EE85002CDD7C /* RenderLineBoxList.cpp */,
0BE030A10F3112FB003C1A46 /* RenderLineBoxList.h */,
BCEA4824097D93020094C9E4 /* RenderLineBreak.cpp */,
@@ -27993,8 +27993,8 @@
CD318623199F1E2A0030A0F7 /* CDMPrivateMediaSourceAVFObjC.h in Headers */,
CDE595971BF26E2100A1CBE8 /* CDMSessionMediaSourceAVFObjC.h in Headers */,
5FA904CA178E61F5004C8A2D /* CertificateInfo.h in Headers */,
- 91B8F0B521953D65000C2B00 /* CertificateInfoBase.h in Headers */,
- FE36FD1516C7826500F887C1 /* ChangeVersionData.h in Headers */,
+ 91B8F0B521953D65000C2B00 /* CertificateInfoBase.h in Headers */,
+ FE36FD1516C7826500F887C1 /* ChangeVersionData.h in Headers */,
97BC69DD1505F076001B74AC /* ChangeVersionWrapper.h in Headers */,
FD315FFF12B0267600C1A359 /* ChannelMergerNode.h in Headers */,
FD31600212B0267600C1A359 /* ChannelSplitterNode.h in Headers */,
@@ -29995,7 +29995,7 @@
A12538D413F9B60A00024754 /* LayoutRepainter.h in Headers */,
11310CF320BA4A370065A8D0 /* LayoutReplaced.h in Headers */,
141DC054164834B900371E5A /* LayoutSize.h in Headers */,
- 2D9066070BE141D400956998 /* LayoutState.h in Headers */,
+ 2D9066070BE141D400956998 /* RenderLayoutState.h in Headers */,
11310CF220BA4A320065A8D0 /* LayoutTreeBuilder.h in Headers */,
141DC0481648348F00371E5A /* LayoutUnit.h in Headers */,
CDE8B5ED1A69777300B4B66A /* LegacyCDMPrivateClearKey.h in Headers */,
Modified: trunk/Source/WebCore/page/FrameViewLayoutContext.cpp (238962 => 238963)
--- trunk/Source/WebCore/page/FrameViewLayoutContext.cpp 2018-12-07 19:32:23 UTC (rev 238962)
+++ trunk/Source/WebCore/page/FrameViewLayoutContext.cpp 2018-12-07 20:10:14 UTC (rev 238963)
@@ -32,9 +32,9 @@
#include "FrameView.h"
#include "InspectorInstrumentation.h"
#include "LayoutDisallowedScope.h"
-#include "LayoutState.h"
#include "Logging.h"
#include "RenderElement.h"
+#include "RenderLayoutState.h"
#include "RenderView.h"
#include "RuntimeEnabledFeatures.h"
#include "ScriptDisallowedScope.h"
@@ -584,7 +584,7 @@
}
#endif
-LayoutState* FrameViewLayoutContext::layoutState() const
+RenderLayoutState* FrameViewLayoutContext::layoutState() const
{
if (m_layoutStateStack.isEmpty())
return nullptr;
@@ -596,7 +596,7 @@
ASSERT(!m_paintOffsetCacheDisableCount);
ASSERT(!layoutState());
- m_layoutStateStack.append(std::make_unique<LayoutState>(root));
+ m_layoutStateStack.append(std::make_unique<RenderLayoutState>(root));
}
bool FrameViewLayoutContext::pushLayoutStateForPaginationIfNeeded(RenderBlockFlow& layoutRoot)
@@ -603,7 +603,7 @@
{
if (layoutState())
return false;
- m_layoutStateStack.append(std::make_unique<LayoutState>(layoutRoot, LayoutState::IsPaginated::Yes));
+ m_layoutStateStack.append(std::make_unique<RenderLayoutState>(layoutRoot, RenderLayoutState::IsPaginated::Yes));
return true;
}
@@ -613,7 +613,7 @@
auto* layoutState = this->layoutState();
if (!layoutState || !needsFullRepaint() || layoutState->isPaginated() || renderer.enclosingFragmentedFlow()
|| layoutState->lineGrid() || (renderer.style().lineGrid() != RenderStyle::initialLineGrid() && renderer.isRenderBlockFlow())) {
- m_layoutStateStack.append(std::make_unique<LayoutState>(m_layoutStateStack, renderer, offset, pageHeight, pageHeightChanged));
+ m_layoutStateStack.append(std::make_unique<RenderLayoutState>(m_layoutStateStack, renderer, offset, pageHeight, pageHeightChanged));
return true;
}
return false;
Modified: trunk/Source/WebCore/page/FrameViewLayoutContext.h (238962 => 238963)
--- trunk/Source/WebCore/page/FrameViewLayoutContext.h 2018-12-07 19:32:23 UTC (rev 238962)
+++ trunk/Source/WebCore/page/FrameViewLayoutContext.h 2018-12-07 20:10:14 UTC (rev 238963)
@@ -37,11 +37,11 @@
class FrameView;
class LayoutScope;
class LayoutSize;
-class LayoutState;
class RenderBlockFlow;
class RenderBox;
class RenderObject;
class RenderElement;
+class RenderLayoutState;
class RenderView;
class FrameViewLayoutContext {
@@ -93,7 +93,7 @@
void flushAsynchronousTasks();
- LayoutState* layoutState() const;
+ RenderLayoutState* layoutState() const;
// Returns true if layoutState should be used for its cached offset and clip.
bool isPaintOffsetCacheEnabled() const { return !m_paintOffsetCacheDisableCount && layoutState(); }
#ifndef NDEBUG
@@ -107,7 +107,7 @@
#if !ASSERT_DISABLED
bool layoutDeltaMatches(const LayoutSize& delta);
#endif
- using LayoutStateStack = Vector<std::unique_ptr<LayoutState>>;
+ using LayoutStateStack = Vector<std::unique_ptr<RenderLayoutState>>;
private:
friend class LayoutScope;
Deleted: trunk/Source/WebCore/rendering/LayoutState.cpp (238962 => 238963)
--- trunk/Source/WebCore/rendering/LayoutState.cpp 2018-12-07 19:32:23 UTC (rev 238962)
+++ trunk/Source/WebCore/rendering/LayoutState.cpp 2018-12-07 20:10:14 UTC (rev 238963)
@@ -1,348 +0,0 @@
-/*
- * Copyright (C) 2007, 2013 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "LayoutState.h"
-
-#include "RenderFragmentedFlow.h"
-#include "RenderInline.h"
-#include "RenderLayer.h"
-#include "RenderMultiColumnFlow.h"
-#include "RenderView.h"
-#include <wtf/WeakPtr.h>
-
-namespace WebCore {
-
-LayoutState::LayoutState(RenderElement& renderer, IsPaginated isPaginated)
- : m_clipped(false)
- , m_isPaginated(isPaginated == IsPaginated::Yes)
- , m_pageLogicalHeightChanged(false)
-#if !ASSERT_DISABLED
- , m_layoutDeltaXSaturated(false)
- , m_layoutDeltaYSaturated(false)
-#endif
-#ifndef NDEBUG
- , m_renderer(&renderer)
-#endif
-{
- if (RenderElement* container = renderer.container()) {
- FloatPoint absContentPoint = container->localToAbsolute(FloatPoint(), UseTransforms);
- m_paintOffset = LayoutSize(absContentPoint.x(), absContentPoint.y());
-
- if (container->hasOverflowClip()) {
- m_clipped = true;
- auto& containerBox = downcast<RenderBox>(*container);
- m_clipRect = LayoutRect(toLayoutPoint(m_paintOffset), containerBox.cachedSizeForOverflowClip());
- m_paintOffset -= toLayoutSize(containerBox.scrollPosition());
- }
- }
- if (m_isPaginated) {
- // This is just a flag for known page height (see RenderBlockFlow::checkForPaginationLogicalHeightChange).
- m_pageLogicalHeight = 1;
- }
-}
-
-LayoutState::LayoutState(const FrameViewLayoutContext::LayoutStateStack& layoutStateStack, RenderBox& renderer, const LayoutSize& offset, LayoutUnit pageLogicalHeight, bool pageLogicalHeightChanged)
- : m_clipped(false)
- , m_isPaginated(false)
- , m_pageLogicalHeightChanged(false)
-#if !ASSERT_DISABLED
- , m_layoutDeltaXSaturated(false)
- , m_layoutDeltaYSaturated(false)
-#endif
-#ifndef NDEBUG
- , m_renderer(&renderer)
-#endif
-{
- if (!layoutStateStack.isEmpty()) {
- auto& ancestor = *layoutStateStack.last().get();
- computeOffsets(ancestor, renderer, offset);
- computeClipRect(ancestor, renderer);
- }
- computePaginationInformation(layoutStateStack, renderer, pageLogicalHeight, pageLogicalHeightChanged);
-}
-
-void LayoutState::computeOffsets(const LayoutState& ancestor, RenderBox& renderer, LayoutSize offset)
-{
- bool fixed = renderer.isFixedPositioned();
- if (fixed) {
- FloatPoint fixedOffset = renderer.view().localToAbsolute(FloatPoint(), IsFixed);
- m_paintOffset = LayoutSize(fixedOffset.x(), fixedOffset.y()) + offset;
- } else
- m_paintOffset = ancestor.paintOffset() + offset;
-
- if (renderer.isOutOfFlowPositioned() && !fixed) {
- if (auto* container = renderer.container()) {
- if (container->isInFlowPositioned() && is<RenderInline>(*container))
- m_paintOffset += downcast<RenderInline>(*container).offsetForInFlowPositionedInline(&renderer);
- }
- }
-
- m_layoutOffset = m_paintOffset;
-
- if (renderer.isInFlowPositioned() && renderer.hasLayer())
- m_paintOffset += renderer.layer()->offsetForInFlowPosition();
-
- if (renderer.hasOverflowClip())
- m_paintOffset -= toLayoutSize(renderer.scrollPosition());
-
- m_layoutDelta = ancestor.layoutDelta();
-#if !ASSERT_DISABLED
- m_layoutDeltaXSaturated = ancestor.m_layoutDeltaXSaturated;
- m_layoutDeltaYSaturated = ancestor.m_layoutDeltaYSaturated;
-#endif
-}
-
-void LayoutState::computeClipRect(const LayoutState& ancestor, RenderBox& renderer)
-{
- m_clipped = !renderer.isFixedPositioned() && ancestor.isClipped();
- if (m_clipped)
- m_clipRect = ancestor.clipRect();
- if (!renderer.hasOverflowClip())
- return;
-
- auto paintOffsetForClipRect = toLayoutPoint(m_paintOffset + toLayoutSize(renderer.scrollPosition()));
- LayoutRect clipRect(paintOffsetForClipRect + renderer.view().frameView().layoutContext().layoutDelta(), renderer.cachedSizeForOverflowClip());
- if (m_clipped)
- m_clipRect.intersect(clipRect);
- else
- m_clipRect = clipRect;
- m_clipped = true;
- // FIXME: <http://bugs.webkit.org/show_bug.cgi?id=13443> Apply control clip if present.
-}
-
-void LayoutState::computePaginationInformation(const FrameViewLayoutContext::LayoutStateStack& layoutStateStack, RenderBox& renderer, LayoutUnit pageLogicalHeight, bool pageLogicalHeightChanged)
-{
- auto* ancestor = layoutStateStack.isEmpty() ? nullptr : layoutStateStack.last().get();
- // 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 || renderer.isRenderFragmentedFlow()) {
- m_pageLogicalHeight = pageLogicalHeight;
- bool isFlipped = renderer.style().isFlippedBlocksWritingMode();
- m_pageOffset = LayoutSize(m_layoutOffset.width() + (!isFlipped ? renderer.borderLeft() + renderer.paddingLeft() : renderer.borderRight() + renderer.paddingRight()), m_layoutOffset.height() + (!isFlipped ? renderer.borderTop() + renderer.paddingTop() : renderer.borderBottom() + renderer.paddingBottom()));
- m_pageLogicalHeightChanged = pageLogicalHeightChanged;
- m_isPaginated = true;
- } else if (ancestor) {
- // If we don't establish a new page height, then propagate the old page height and offset down.
- m_pageLogicalHeight = ancestor->pageLogicalHeight();
- m_pageLogicalHeightChanged = ancestor->pageLogicalHeightChanged();
- m_pageOffset = ancestor->pageOffset();
-
- // Disable pagination for objects we don't support. For now this includes overflow:scroll/auto, inline blocks and writing mode roots.
- if (renderer.isUnsplittableForPagination()) {
- m_pageLogicalHeight = 0;
- m_isPaginated = false;
- } else
- m_isPaginated = m_pageLogicalHeight || renderer.enclosingFragmentedFlow();
- }
-
- // Propagate line grid information.
- if (ancestor)
- propagateLineGridInfo(*ancestor, renderer);
-
- if (lineGrid() && (lineGrid()->style().writingMode() == renderer.style().writingMode()) && is<RenderMultiColumnFlow>(renderer))
- computeLineGridPaginationOrigin(downcast<RenderMultiColumnFlow>(renderer));
-
- // If we have a new grid to track, then add it to our set.
- if (renderer.style().lineGrid() != RenderStyle::initialLineGrid() && is<RenderBlockFlow>(renderer))
- establishLineGrid(layoutStateStack, downcast<RenderBlockFlow>(renderer));
-}
-
-LayoutUnit LayoutState::pageLogicalOffset(RenderBox* child, LayoutUnit childLogicalOffset) const
-{
- if (child->isHorizontalWritingMode())
- return m_layoutOffset.height() + childLogicalOffset - m_pageOffset.height();
- return m_layoutOffset.width() + childLogicalOffset - m_pageOffset.width();
-}
-
-void LayoutState::computeLineGridPaginationOrigin(const RenderMultiColumnFlow& multicol)
-{
- if (!isPaginated() || !pageLogicalHeight())
- return;
-
- if (!multicol.progressionIsInline())
- return;
- // We need to cache a line grid pagination origin so that we understand how to reset the line grid
- // at the top of each column.
- // Get the current line grid and offset.
- ASSERT(m_lineGrid);
- // Get the hypothetical line box used to establish the grid.
- auto* lineGridBox = m_lineGrid->lineGridBox();
- if (!lineGridBox)
- return;
-
- // Now determine our position on the grid. Our baseline needs to be adjusted to the nearest baseline multiple
- // as established by the line box.
- // FIXME: Need to handle crazy line-box-contain values that cause the root line box to not be considered. I assume
- // the grid should honor line-box-contain.
- LayoutUnit gridLineHeight = lineGridBox->lineBottomWithLeading() - lineGridBox->lineTopWithLeading();
- if (!gridLineHeight)
- return;
-
- bool isHorizontalWritingMode = m_lineGrid->isHorizontalWritingMode();
- LayoutUnit lineGridBlockOffset = isHorizontalWritingMode ? m_lineGridOffset.height() : m_lineGridOffset.width();
- LayoutUnit firstLineTopWithLeading = lineGridBlockOffset + lineGridBox->lineTopWithLeading();
- LayoutUnit pageLogicalTop = isHorizontalWritingMode ? m_pageOffset.height() : m_pageOffset.width();
- if (pageLogicalTop <= firstLineTopWithLeading)
- return;
-
- // Shift to the next highest line grid multiple past the page logical top. Cache the delta
- // between this new value and the page logical top as the pagination origin.
- LayoutUnit remainder = roundToInt(pageLogicalTop - firstLineTopWithLeading) % roundToInt(gridLineHeight);
- LayoutUnit paginationDelta = gridLineHeight - remainder;
- if (isHorizontalWritingMode)
- m_lineGridPaginationOrigin.setHeight(paginationDelta);
- else
- m_lineGridPaginationOrigin.setWidth(paginationDelta);
-}
-
-void LayoutState::propagateLineGridInfo(const LayoutState& ancestor, RenderBox& renderer)
-{
- // Disable line grids for objects we don't support. For now this includes overflow:scroll/auto, inline blocks and
- // writing mode roots.
- if (renderer.isUnsplittableForPagination())
- return;
-
- m_lineGrid = makeWeakPtr(ancestor.lineGrid());
- m_lineGridOffset = ancestor.lineGridOffset();
- m_lineGridPaginationOrigin = ancestor.lineGridPaginationOrigin();
-}
-
-void LayoutState::establishLineGrid(const FrameViewLayoutContext::LayoutStateStack& layoutStateStack, RenderBlockFlow& renderer)
-{
- // First check to see if this grid has been established already.
- if (m_lineGrid) {
- if (m_lineGrid->style().lineGrid() == renderer.style().lineGrid())
- return;
- auto* currentGrid = m_lineGrid.get();
- for (int i = layoutStateStack.size() - 1; i <= 0; --i) {
- auto& currentState = *layoutStateStack[i].get();
- if (currentState.m_lineGrid == currentGrid)
- continue;
- currentGrid = currentState.lineGrid();
- if (!currentGrid)
- break;
- if (currentGrid->style().lineGrid() == renderer.style().lineGrid()) {
- m_lineGrid = makeWeakPtr(currentGrid);
- m_lineGridOffset = currentState.m_lineGridOffset;
- return;
- }
- }
- }
-
- // We didn't find an already-established grid with this identifier. Our render object establishes the grid.
- m_lineGrid = makeWeakPtr(renderer);
- m_lineGridOffset = m_layoutOffset;
-}
-
-void LayoutState::addLayoutDelta(LayoutSize delta)
-{
- m_layoutDelta += delta;
-#if !ASSERT_DISABLED
- m_layoutDeltaXSaturated |= m_layoutDelta.width() == LayoutUnit::max() || m_layoutDelta.width() == LayoutUnit::min();
- m_layoutDeltaYSaturated |= m_layoutDelta.height() == LayoutUnit::max() || m_layoutDelta.height() == LayoutUnit::min();
-#endif
-}
-
-#if !ASSERT_DISABLED
-bool LayoutState::layoutDeltaMatches(LayoutSize delta) const
-{
- return (delta.width() == m_layoutDelta.width() || m_layoutDeltaXSaturated) && (delta.height() == m_layoutDelta.height() || m_layoutDeltaYSaturated);
-}
-#endif
-
-LayoutStateMaintainer::LayoutStateMaintainer(RenderBox& root, LayoutSize offset, bool disablePaintOffsetCache, LayoutUnit pageHeight, bool pageHeightChanged)
- : m_context(root.view().frameView().layoutContext())
- , m_paintOffsetCacheIsDisabled(disablePaintOffsetCache)
-{
- m_didPushLayoutState = m_context.pushLayoutState(root, offset, pageHeight, pageHeightChanged);
- if (m_didPushLayoutState && m_paintOffsetCacheIsDisabled)
- m_context.disablePaintOffsetCache();
-}
-
-LayoutStateMaintainer::~LayoutStateMaintainer()
-{
- if (!m_didPushLayoutState)
- return;
- m_context.popLayoutState();
- if (m_paintOffsetCacheIsDisabled)
- m_context.enablePaintOffsetCache();
-}
-
-LayoutStateDisabler::LayoutStateDisabler(FrameViewLayoutContext& context)
- : m_context(context)
-{
- m_context.disablePaintOffsetCache();
-}
-
-LayoutStateDisabler::~LayoutStateDisabler()
-{
- m_context.enablePaintOffsetCache();
-}
-
-static bool shouldDisablePaintOffsetCacheForSubtree(RenderElement& subtreeLayoutRoot)
-{
- for (auto* renderer = &subtreeLayoutRoot; renderer; renderer = renderer->container()) {
- if (renderer->hasTransform() || renderer->hasReflection())
- return true;
- }
- return false;
-}
-
-SubtreeLayoutStateMaintainer::SubtreeLayoutStateMaintainer(RenderElement* subtreeLayoutRoot)
-{
- if (subtreeLayoutRoot) {
- m_context = &subtreeLayoutRoot->view().frameView().layoutContext();
- m_context->pushLayoutState(*subtreeLayoutRoot);
- if (shouldDisablePaintOffsetCacheForSubtree(*subtreeLayoutRoot)) {
- m_context->disablePaintOffsetCache();
- m_didDisablePaintOffsetCache = true;
- }
- }
-}
-
-SubtreeLayoutStateMaintainer::~SubtreeLayoutStateMaintainer()
-{
- if (m_context) {
- m_context->popLayoutState();
- if (m_didDisablePaintOffsetCache)
- m_context->enablePaintOffsetCache();
- }
-}
-
-PaginatedLayoutStateMaintainer::PaginatedLayoutStateMaintainer(RenderBlockFlow& flow)
- : m_context(flow.view().frameView().layoutContext())
- , m_pushed(m_context.pushLayoutStateForPaginationIfNeeded(flow))
-{
-}
-
-PaginatedLayoutStateMaintainer::~PaginatedLayoutStateMaintainer()
-{
- if (m_pushed)
- m_context.popLayoutState();
-}
-
-} // namespace WebCore
-
Deleted: trunk/Source/WebCore/rendering/LayoutState.h (238962 => 238963)
--- trunk/Source/WebCore/rendering/LayoutState.h 2018-12-07 19:32:23 UTC (rev 238962)
+++ trunk/Source/WebCore/rendering/LayoutState.h 2018-12-07 20:10:14 UTC (rev 238963)
@@ -1,179 +0,0 @@
-/*
- * Copyright (C) 2007, 2013 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#pragma once
-
-#include "FrameViewLayoutContext.h"
-#include "LayoutRect.h"
-#include <wtf/Noncopyable.h>
-
-namespace WebCore {
-
-class RenderBlockFlow;
-class RenderBox;
-class RenderElement;
-class RenderFragmentedFlow;
-class RenderMultiColumnFlow;
-class RenderObject;
-
-class LayoutState {
- WTF_MAKE_NONCOPYABLE(LayoutState); WTF_MAKE_FAST_ALLOCATED;
-
-public:
- LayoutState()
- : m_clipped(false)
- , m_isPaginated(false)
- , m_pageLogicalHeightChanged(false)
-#if !ASSERT_DISABLED
- , m_layoutDeltaXSaturated(false)
- , m_layoutDeltaYSaturated(false)
-#endif
- {
- }
- LayoutState(const FrameViewLayoutContext::LayoutStateStack&, RenderBox&, const LayoutSize& offset, LayoutUnit pageHeight, bool pageHeightChanged);
- enum class IsPaginated { No, Yes };
- explicit LayoutState(RenderElement&, IsPaginated = IsPaginated::No);
-
- bool isPaginated() const { return m_isPaginated; }
-
- // The page logical offset is the object's offset from the top of the page in the page progression
- // direction (so an x-offset in vertical text and a y-offset for horizontal text).
- LayoutUnit pageLogicalOffset(RenderBox*, LayoutUnit childLogicalOffset) const;
-
- LayoutUnit pageLogicalHeight() const { return m_pageLogicalHeight; }
- bool pageLogicalHeightChanged() const { return m_pageLogicalHeightChanged; }
-
- RenderBlockFlow* lineGrid() const { return m_lineGrid.get(); }
- LayoutSize lineGridOffset() const { return m_lineGridOffset; }
- LayoutSize lineGridPaginationOrigin() const { return m_lineGridPaginationOrigin; }
-
- LayoutSize paintOffset() const { return m_paintOffset; }
- LayoutSize layoutOffset() const { return m_layoutOffset; }
-
- LayoutSize pageOffset() const { return m_pageOffset; }
-
- bool needsBlockDirectionLocationSetBeforeLayout() const { return m_lineGrid || (m_isPaginated && m_pageLogicalHeight); }
-
-#ifndef NDEBUG
- RenderElement* renderer() const { return m_renderer; }
-#endif
- LayoutRect clipRect() const { return m_clipRect; }
- bool isClipped() const { return m_clipped; }
-
- void addLayoutDelta(LayoutSize);
- LayoutSize layoutDelta() const { return m_layoutDelta; }
-#if !ASSERT_DISABLED
- bool layoutDeltaMatches(LayoutSize) const;
-#endif
-
-private:
- void computeOffsets(const LayoutState& ancestor, RenderBox&, LayoutSize offset);
- void computeClipRect(const LayoutState& ancestor, RenderBox&);
- // FIXME: webkit.org/b/179440 these functions should be part of the pagination code/FrameViewLayoutContext.
- void computePaginationInformation(const FrameViewLayoutContext::LayoutStateStack&, RenderBox&, LayoutUnit pageLogicalHeight, bool pageLogicalHeightChanged);
- void propagateLineGridInfo(const LayoutState& ancestor, RenderBox&);
- void establishLineGrid(const FrameViewLayoutContext::LayoutStateStack&, RenderBlockFlow&);
- void computeLineGridPaginationOrigin(const RenderMultiColumnFlow&);
-
- // Do not add anything apart from bitfields. See https://bugs.webkit.org/show_bug.cgi?id=100173
- bool m_clipped : 1;
- bool m_isPaginated : 1;
- // If our page height has changed, this will force all blocks to relayout.
- bool m_pageLogicalHeightChanged : 1;
-#if !ASSERT_DISABLED
- bool m_layoutDeltaXSaturated : 1;
- bool m_layoutDeltaYSaturated : 1;
-#endif
- // The current line grid that we're snapping to and the offset of the start of the grid.
- WeakPtr<RenderBlockFlow> m_lineGrid;
-
- // FIXME: Distinguish between the layout clip rect and the paint clip rect which may be larger,
- // e.g., because of composited scrolling.
- LayoutRect m_clipRect;
-
- // x/y offset from layout root. Includes in-flow positioning and scroll offsets.
- LayoutSize m_paintOffset;
- // x/y offset from layout root. Does not include in-flow positioning or scroll offsets.
- LayoutSize m_layoutOffset;
- // Transient offset from the final position of the object
- // used to ensure that repaints happen in the correct place.
- // This is a total delta accumulated from the root.
- LayoutSize m_layoutDelta;
-
- // The current page height for the pagination model that encloses us.
- LayoutUnit m_pageLogicalHeight;
- // The offset of the start of the first page in the nearest enclosing pagination model.
- LayoutSize m_pageOffset;
- LayoutSize m_lineGridOffset;
- LayoutSize m_lineGridPaginationOrigin;
-#ifndef NDEBUG
- RenderElement* m_renderer { nullptr };
-#endif
-};
-
-// Stack-based class to assist with LayoutState push/pop
-class LayoutStateMaintainer {
- WTF_MAKE_NONCOPYABLE(LayoutStateMaintainer);
-public:
- explicit LayoutStateMaintainer(RenderBox&, LayoutSize offset, bool disableState = false, LayoutUnit pageHeight = 0_lu, bool pageHeightChanged = false);
- ~LayoutStateMaintainer();
-
-private:
- FrameViewLayoutContext& m_context;
- bool m_paintOffsetCacheIsDisabled { false };
- bool m_didPushLayoutState { false };
-};
-
-class SubtreeLayoutStateMaintainer {
-public:
- SubtreeLayoutStateMaintainer(RenderElement* subtreeLayoutRoot);
- ~SubtreeLayoutStateMaintainer();
-
-private:
- FrameViewLayoutContext* m_context { nullptr };
- bool m_didDisablePaintOffsetCache { false };
-};
-
-class LayoutStateDisabler {
- WTF_MAKE_NONCOPYABLE(LayoutStateDisabler);
-public:
- LayoutStateDisabler(FrameViewLayoutContext&);
- ~LayoutStateDisabler();
-
-private:
- FrameViewLayoutContext& m_context;
-};
-
-class PaginatedLayoutStateMaintainer {
-public:
- PaginatedLayoutStateMaintainer(RenderBlockFlow&);
- ~PaginatedLayoutStateMaintainer();
-
-private:
- FrameViewLayoutContext& m_context;
- bool m_pushed { false };
-};
-
-} // namespace WebCore
Modified: trunk/Source/WebCore/rendering/RenderBlock.cpp (238962 => 238963)
--- trunk/Source/WebCore/rendering/RenderBlock.cpp 2018-12-07 19:32:23 UTC (rev 238962)
+++ trunk/Source/WebCore/rendering/RenderBlock.cpp 2018-12-07 20:10:14 UTC (rev 238963)
@@ -55,6 +55,7 @@
#include "RenderInline.h"
#include "RenderIterator.h"
#include "RenderLayer.h"
+#include "RenderLayoutState.h"
#include "RenderListMarker.h"
#include "RenderMenuList.h"
#include "RenderSVGResourceClipper.h"
Modified: trunk/Source/WebCore/rendering/RenderBlock.h (238962 => 238963)
--- trunk/Source/WebCore/rendering/RenderBlock.h 2018-12-07 19:32:23 UTC (rev 238962)
+++ trunk/Source/WebCore/rendering/RenderBlock.h 2018-12-07 20:10:14 UTC (rev 238963)
@@ -31,7 +31,6 @@
namespace WebCore {
-class LayoutState;
class LineLayoutState;
class LogicalSelectionOffsetCaches;
class RenderInline;
Modified: trunk/Source/WebCore/rendering/RenderBlockFlow.cpp (238962 => 238963)
--- trunk/Source/WebCore/rendering/RenderBlockFlow.cpp 2018-12-07 19:32:23 UTC (rev 238962)
+++ trunk/Source/WebCore/rendering/RenderBlockFlow.cpp 2018-12-07 20:10:14 UTC (rev 238963)
@@ -35,7 +35,6 @@
#include "HitTestLocation.h"
#include "InlineTextBox.h"
#include "LayoutRepainter.h"
-#include "LayoutState.h"
#include "Logging.h"
#include "RenderCombineText.h"
#include "RenderFlexibleBox.h"
@@ -42,6 +41,7 @@
#include "RenderInline.h"
#include "RenderIterator.h"
#include "RenderLayer.h"
+#include "RenderLayoutState.h"
#include "RenderLineBreak.h"
#include "RenderListItem.h"
#include "RenderMarquee.h"
@@ -3842,7 +3842,7 @@
RenderFragmentedFlow& fragmentedFlow = downcast<RenderFragmentedFlow>(*this);
// FIXME: This is a hack to always make sure we have a page logical height, if said height
- // is known. The page logical height thing in LayoutState is meaningless for flow
+ // is known. The page logical height thing in RenderLayoutState is meaningless for flow
// thread-based pagination (page height isn't necessarily uniform throughout the flow
// thread), but as long as it is used universally as a means to determine whether page
// height is known or not, we need this. Page height is unknown when column balancing is
Modified: trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp (238962 => 238963)
--- trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp 2018-12-07 19:32:23 UTC (rev 238962)
+++ trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp 2018-12-07 20:10:14 UTC (rev 238963)
@@ -33,12 +33,12 @@
#include "InlineIterator.h"
#include "InlineTextBox.h"
#include "InlineTextBoxStyle.h"
-#include "LayoutState.h"
#include "LineLayoutState.h"
#include "Logging.h"
#include "RenderBlockFlow.h"
#include "RenderFragmentContainer.h"
#include "RenderFragmentedFlow.h"
+#include "RenderLayoutState.h"
#include "RenderLineBreak.h"
#include "RenderRubyBase.h"
#include "RenderRubyText.h"
Modified: trunk/Source/WebCore/rendering/RenderBox.cpp (238962 => 238963)
--- trunk/Source/WebCore/rendering/RenderBox.cpp 2018-12-07 19:32:23 UTC (rev 238962)
+++ trunk/Source/WebCore/rendering/RenderBox.cpp 2018-12-07 20:10:14 UTC (rev 238963)
@@ -47,7 +47,6 @@
#include "HTMLTextAreaElement.h"
#include "HitTestResult.h"
#include "InlineElementBox.h"
-#include "LayoutState.h"
#include "Page.h"
#include "PaintInfo.h"
#include "RenderBoxFragmentInfo.h"
@@ -61,6 +60,7 @@
#include "RenderIterator.h"
#include "RenderLayer.h"
#include "RenderLayerCompositor.h"
+#include "RenderLayoutState.h"
#include "RenderMultiColumnFlow.h"
#include "RenderTableCell.h"
#include "RenderTheme.h"
Modified: trunk/Source/WebCore/rendering/RenderEmbeddedObject.cpp (238962 => 238963)
--- trunk/Source/WebCore/rendering/RenderEmbeddedObject.cpp 2018-12-07 19:32:23 UTC (rev 238962)
+++ trunk/Source/WebCore/rendering/RenderEmbeddedObject.cpp 2018-12-07 20:10:14 UTC (rev 238963)
@@ -42,7 +42,6 @@
#include "HTMLParamElement.h"
#include "HTMLPlugInElement.h"
#include "HitTestResult.h"
-#include "LayoutState.h"
#include "LocalizedStrings.h"
#include "MouseEvent.h"
#include "Page.h"
@@ -50,6 +49,7 @@
#include "Path.h"
#include "PlatformMouseEvent.h"
#include "PluginViewBase.h"
+#include "RenderLayoutState.h"
#include "RenderTheme.h"
#include "RenderView.h"
#include "Settings.h"
Modified: trunk/Source/WebCore/rendering/RenderFragmentedFlow.cpp (238962 => 238963)
--- trunk/Source/WebCore/rendering/RenderFragmentedFlow.cpp 2018-12-07 19:32:23 UTC (rev 238962)
+++ trunk/Source/WebCore/rendering/RenderFragmentedFlow.cpp 2018-12-07 20:10:14 UTC (rev 238963)
@@ -33,7 +33,6 @@
#include "HitTestRequest.h"
#include "HitTestResult.h"
#include "InlineElementBox.h"
-#include "LayoutState.h"
#include "Node.h"
#include "PODIntervalTree.h"
#include "RenderBoxFragmentInfo.h"
@@ -41,6 +40,7 @@
#include "RenderInline.h"
#include "RenderLayer.h"
#include "RenderLayerCompositor.h"
+#include "RenderLayoutState.h"
#include "RenderTableCell.h"
#include "RenderTableSection.h"
#include "RenderTheme.h"
Modified: trunk/Source/WebCore/rendering/RenderGrid.cpp (238962 => 238963)
--- trunk/Source/WebCore/rendering/RenderGrid.cpp 2018-12-07 19:32:23 UTC (rev 238962)
+++ trunk/Source/WebCore/rendering/RenderGrid.cpp 2018-12-07 20:10:14 UTC (rev 238963)
@@ -32,9 +32,9 @@
#include "GridPositionsResolver.h"
#include "GridTrackSizingAlgorithm.h"
#include "LayoutRepainter.h"
-#include "LayoutState.h"
#include "RenderChildIterator.h"
#include "RenderLayer.h"
+#include "RenderLayoutState.h"
#include "RenderTreeBuilder.h"
#include "RenderView.h"
#include <cstdlib>
Modified: trunk/Source/WebCore/rendering/RenderImage.cpp (238962 => 238963)
--- trunk/Source/WebCore/rendering/RenderImage.cpp 2018-12-07 19:32:23 UTC (rev 238962)
+++ trunk/Source/WebCore/rendering/RenderImage.cpp 2018-12-07 20:10:14 UTC (rev 238963)
@@ -45,11 +45,11 @@
#include "HTMLNames.h"
#include "HitTestResult.h"
#include "InlineElementBox.h"
-#include "LayoutState.h"
#include "Page.h"
#include "PaintInfo.h"
#include "RenderFragmentedFlow.h"
#include "RenderImageResourceStyleImage.h"
+#include "RenderLayoutState.h"
#include "RenderTheme.h"
#include "RenderView.h"
#include "RuntimeEnabledFeatures.h"
Modified: trunk/Source/WebCore/rendering/RenderInline.cpp (238962 => 238963)
--- trunk/Source/WebCore/rendering/RenderInline.cpp 2018-12-07 19:32:23 UTC (rev 238962)
+++ trunk/Source/WebCore/rendering/RenderInline.cpp 2018-12-07 20:10:14 UTC (rev 238963)
@@ -30,7 +30,6 @@
#include "HitTestResult.h"
#include "InlineElementBox.h"
#include "InlineTextBox.h"
-#include "LayoutState.h"
#include "RenderBlock.h"
#include "RenderChildIterator.h"
#include "RenderFragmentedFlow.h"
@@ -38,6 +37,7 @@
#include "RenderGeometryMap.h"
#include "RenderIterator.h"
#include "RenderLayer.h"
+#include "RenderLayoutState.h"
#include "RenderLineBreak.h"
#include "RenderListMarker.h"
#include "RenderTable.h"
Copied: trunk/Source/WebCore/rendering/RenderLayoutState.cpp (from rev 238962, trunk/Source/WebCore/rendering/LayoutState.cpp) (0 => 238963)
--- trunk/Source/WebCore/rendering/RenderLayoutState.cpp (rev 0)
+++ trunk/Source/WebCore/rendering/RenderLayoutState.cpp 2018-12-07 20:10:14 UTC (rev 238963)
@@ -0,0 +1,348 @@
+/*
+ * Copyright (C) 2007, 2013 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "RenderLayoutState.h"
+
+#include "RenderFragmentedFlow.h"
+#include "RenderInline.h"
+#include "RenderLayer.h"
+#include "RenderMultiColumnFlow.h"
+#include "RenderView.h"
+#include <wtf/WeakPtr.h>
+
+namespace WebCore {
+
+RenderLayoutState::RenderLayoutState(RenderElement& renderer, IsPaginated isPaginated)
+ : m_clipped(false)
+ , m_isPaginated(isPaginated == IsPaginated::Yes)
+ , m_pageLogicalHeightChanged(false)
+#if !ASSERT_DISABLED
+ , m_layoutDeltaXSaturated(false)
+ , m_layoutDeltaYSaturated(false)
+#endif
+#ifndef NDEBUG
+ , m_renderer(&renderer)
+#endif
+{
+ if (RenderElement* container = renderer.container()) {
+ FloatPoint absContentPoint = container->localToAbsolute(FloatPoint(), UseTransforms);
+ m_paintOffset = LayoutSize(absContentPoint.x(), absContentPoint.y());
+
+ if (container->hasOverflowClip()) {
+ m_clipped = true;
+ auto& containerBox = downcast<RenderBox>(*container);
+ m_clipRect = LayoutRect(toLayoutPoint(m_paintOffset), containerBox.cachedSizeForOverflowClip());
+ m_paintOffset -= toLayoutSize(containerBox.scrollPosition());
+ }
+ }
+ if (m_isPaginated) {
+ // This is just a flag for known page height (see RenderBlockFlow::checkForPaginationLogicalHeightChange).
+ m_pageLogicalHeight = 1;
+ }
+}
+
+RenderLayoutState::RenderLayoutState(const FrameViewLayoutContext::LayoutStateStack& layoutStateStack, RenderBox& renderer, const LayoutSize& offset, LayoutUnit pageLogicalHeight, bool pageLogicalHeightChanged)
+ : m_clipped(false)
+ , m_isPaginated(false)
+ , m_pageLogicalHeightChanged(false)
+#if !ASSERT_DISABLED
+ , m_layoutDeltaXSaturated(false)
+ , m_layoutDeltaYSaturated(false)
+#endif
+#ifndef NDEBUG
+ , m_renderer(&renderer)
+#endif
+{
+ if (!layoutStateStack.isEmpty()) {
+ auto& ancestor = *layoutStateStack.last().get();
+ computeOffsets(ancestor, renderer, offset);
+ computeClipRect(ancestor, renderer);
+ }
+ computePaginationInformation(layoutStateStack, renderer, pageLogicalHeight, pageLogicalHeightChanged);
+}
+
+void RenderLayoutState::computeOffsets(const RenderLayoutState& ancestor, RenderBox& renderer, LayoutSize offset)
+{
+ bool fixed = renderer.isFixedPositioned();
+ if (fixed) {
+ FloatPoint fixedOffset = renderer.view().localToAbsolute(FloatPoint(), IsFixed);
+ m_paintOffset = LayoutSize(fixedOffset.x(), fixedOffset.y()) + offset;
+ } else
+ m_paintOffset = ancestor.paintOffset() + offset;
+
+ if (renderer.isOutOfFlowPositioned() && !fixed) {
+ if (auto* container = renderer.container()) {
+ if (container->isInFlowPositioned() && is<RenderInline>(*container))
+ m_paintOffset += downcast<RenderInline>(*container).offsetForInFlowPositionedInline(&renderer);
+ }
+ }
+
+ m_layoutOffset = m_paintOffset;
+
+ if (renderer.isInFlowPositioned() && renderer.hasLayer())
+ m_paintOffset += renderer.layer()->offsetForInFlowPosition();
+
+ if (renderer.hasOverflowClip())
+ m_paintOffset -= toLayoutSize(renderer.scrollPosition());
+
+ m_layoutDelta = ancestor.layoutDelta();
+#if !ASSERT_DISABLED
+ m_layoutDeltaXSaturated = ancestor.m_layoutDeltaXSaturated;
+ m_layoutDeltaYSaturated = ancestor.m_layoutDeltaYSaturated;
+#endif
+}
+
+void RenderLayoutState::computeClipRect(const RenderLayoutState& ancestor, RenderBox& renderer)
+{
+ m_clipped = !renderer.isFixedPositioned() && ancestor.isClipped();
+ if (m_clipped)
+ m_clipRect = ancestor.clipRect();
+ if (!renderer.hasOverflowClip())
+ return;
+
+ auto paintOffsetForClipRect = toLayoutPoint(m_paintOffset + toLayoutSize(renderer.scrollPosition()));
+ LayoutRect clipRect(paintOffsetForClipRect + renderer.view().frameView().layoutContext().layoutDelta(), renderer.cachedSizeForOverflowClip());
+ if (m_clipped)
+ m_clipRect.intersect(clipRect);
+ else
+ m_clipRect = clipRect;
+ m_clipped = true;
+ // FIXME: <http://bugs.webkit.org/show_bug.cgi?id=13443> Apply control clip if present.
+}
+
+void RenderLayoutState::computePaginationInformation(const FrameViewLayoutContext::LayoutStateStack& layoutStateStack, RenderBox& renderer, LayoutUnit pageLogicalHeight, bool pageLogicalHeightChanged)
+{
+ auto* ancestor = layoutStateStack.isEmpty() ? nullptr : layoutStateStack.last().get();
+ // 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 || renderer.isRenderFragmentedFlow()) {
+ m_pageLogicalHeight = pageLogicalHeight;
+ bool isFlipped = renderer.style().isFlippedBlocksWritingMode();
+ m_pageOffset = LayoutSize(m_layoutOffset.width() + (!isFlipped ? renderer.borderLeft() + renderer.paddingLeft() : renderer.borderRight() + renderer.paddingRight()), m_layoutOffset.height() + (!isFlipped ? renderer.borderTop() + renderer.paddingTop() : renderer.borderBottom() + renderer.paddingBottom()));
+ m_pageLogicalHeightChanged = pageLogicalHeightChanged;
+ m_isPaginated = true;
+ } else if (ancestor) {
+ // If we don't establish a new page height, then propagate the old page height and offset down.
+ m_pageLogicalHeight = ancestor->pageLogicalHeight();
+ m_pageLogicalHeightChanged = ancestor->pageLogicalHeightChanged();
+ m_pageOffset = ancestor->pageOffset();
+
+ // Disable pagination for objects we don't support. For now this includes overflow:scroll/auto, inline blocks and writing mode roots.
+ if (renderer.isUnsplittableForPagination()) {
+ m_pageLogicalHeight = 0;
+ m_isPaginated = false;
+ } else
+ m_isPaginated = m_pageLogicalHeight || renderer.enclosingFragmentedFlow();
+ }
+
+ // Propagate line grid information.
+ if (ancestor)
+ propagateLineGridInfo(*ancestor, renderer);
+
+ if (lineGrid() && (lineGrid()->style().writingMode() == renderer.style().writingMode()) && is<RenderMultiColumnFlow>(renderer))
+ computeLineGridPaginationOrigin(downcast<RenderMultiColumnFlow>(renderer));
+
+ // If we have a new grid to track, then add it to our set.
+ if (renderer.style().lineGrid() != RenderStyle::initialLineGrid() && is<RenderBlockFlow>(renderer))
+ establishLineGrid(layoutStateStack, downcast<RenderBlockFlow>(renderer));
+}
+
+LayoutUnit RenderLayoutState::pageLogicalOffset(RenderBox* child, LayoutUnit childLogicalOffset) const
+{
+ if (child->isHorizontalWritingMode())
+ return m_layoutOffset.height() + childLogicalOffset - m_pageOffset.height();
+ return m_layoutOffset.width() + childLogicalOffset - m_pageOffset.width();
+}
+
+void RenderLayoutState::computeLineGridPaginationOrigin(const RenderMultiColumnFlow& multicol)
+{
+ if (!isPaginated() || !pageLogicalHeight())
+ return;
+
+ if (!multicol.progressionIsInline())
+ return;
+ // We need to cache a line grid pagination origin so that we understand how to reset the line grid
+ // at the top of each column.
+ // Get the current line grid and offset.
+ ASSERT(m_lineGrid);
+ // Get the hypothetical line box used to establish the grid.
+ auto* lineGridBox = m_lineGrid->lineGridBox();
+ if (!lineGridBox)
+ return;
+
+ // Now determine our position on the grid. Our baseline needs to be adjusted to the nearest baseline multiple
+ // as established by the line box.
+ // FIXME: Need to handle crazy line-box-contain values that cause the root line box to not be considered. I assume
+ // the grid should honor line-box-contain.
+ LayoutUnit gridLineHeight = lineGridBox->lineBottomWithLeading() - lineGridBox->lineTopWithLeading();
+ if (!gridLineHeight)
+ return;
+
+ bool isHorizontalWritingMode = m_lineGrid->isHorizontalWritingMode();
+ LayoutUnit lineGridBlockOffset = isHorizontalWritingMode ? m_lineGridOffset.height() : m_lineGridOffset.width();
+ LayoutUnit firstLineTopWithLeading = lineGridBlockOffset + lineGridBox->lineTopWithLeading();
+ LayoutUnit pageLogicalTop = isHorizontalWritingMode ? m_pageOffset.height() : m_pageOffset.width();
+ if (pageLogicalTop <= firstLineTopWithLeading)
+ return;
+
+ // Shift to the next highest line grid multiple past the page logical top. Cache the delta
+ // between this new value and the page logical top as the pagination origin.
+ LayoutUnit remainder = roundToInt(pageLogicalTop - firstLineTopWithLeading) % roundToInt(gridLineHeight);
+ LayoutUnit paginationDelta = gridLineHeight - remainder;
+ if (isHorizontalWritingMode)
+ m_lineGridPaginationOrigin.setHeight(paginationDelta);
+ else
+ m_lineGridPaginationOrigin.setWidth(paginationDelta);
+}
+
+void RenderLayoutState::propagateLineGridInfo(const RenderLayoutState& ancestor, RenderBox& renderer)
+{
+ // Disable line grids for objects we don't support. For now this includes overflow:scroll/auto, inline blocks and
+ // writing mode roots.
+ if (renderer.isUnsplittableForPagination())
+ return;
+
+ m_lineGrid = makeWeakPtr(ancestor.lineGrid());
+ m_lineGridOffset = ancestor.lineGridOffset();
+ m_lineGridPaginationOrigin = ancestor.lineGridPaginationOrigin();
+}
+
+void RenderLayoutState::establishLineGrid(const FrameViewLayoutContext::LayoutStateStack& layoutStateStack, RenderBlockFlow& renderer)
+{
+ // First check to see if this grid has been established already.
+ if (m_lineGrid) {
+ if (m_lineGrid->style().lineGrid() == renderer.style().lineGrid())
+ return;
+ auto* currentGrid = m_lineGrid.get();
+ for (int i = layoutStateStack.size() - 1; i <= 0; --i) {
+ auto& currentState = *layoutStateStack[i].get();
+ if (currentState.m_lineGrid == currentGrid)
+ continue;
+ currentGrid = currentState.lineGrid();
+ if (!currentGrid)
+ break;
+ if (currentGrid->style().lineGrid() == renderer.style().lineGrid()) {
+ m_lineGrid = makeWeakPtr(currentGrid);
+ m_lineGridOffset = currentState.m_lineGridOffset;
+ return;
+ }
+ }
+ }
+
+ // We didn't find an already-established grid with this identifier. Our render object establishes the grid.
+ m_lineGrid = makeWeakPtr(renderer);
+ m_lineGridOffset = m_layoutOffset;
+}
+
+void RenderLayoutState::addLayoutDelta(LayoutSize delta)
+{
+ m_layoutDelta += delta;
+#if !ASSERT_DISABLED
+ m_layoutDeltaXSaturated |= m_layoutDelta.width() == LayoutUnit::max() || m_layoutDelta.width() == LayoutUnit::min();
+ m_layoutDeltaYSaturated |= m_layoutDelta.height() == LayoutUnit::max() || m_layoutDelta.height() == LayoutUnit::min();
+#endif
+}
+
+#if !ASSERT_DISABLED
+bool RenderLayoutState::layoutDeltaMatches(LayoutSize delta) const
+{
+ return (delta.width() == m_layoutDelta.width() || m_layoutDeltaXSaturated) && (delta.height() == m_layoutDelta.height() || m_layoutDeltaYSaturated);
+}
+#endif
+
+LayoutStateMaintainer::LayoutStateMaintainer(RenderBox& root, LayoutSize offset, bool disablePaintOffsetCache, LayoutUnit pageHeight, bool pageHeightChanged)
+ : m_context(root.view().frameView().layoutContext())
+ , m_paintOffsetCacheIsDisabled(disablePaintOffsetCache)
+{
+ m_didPushLayoutState = m_context.pushLayoutState(root, offset, pageHeight, pageHeightChanged);
+ if (m_didPushLayoutState && m_paintOffsetCacheIsDisabled)
+ m_context.disablePaintOffsetCache();
+}
+
+LayoutStateMaintainer::~LayoutStateMaintainer()
+{
+ if (!m_didPushLayoutState)
+ return;
+ m_context.popLayoutState();
+ if (m_paintOffsetCacheIsDisabled)
+ m_context.enablePaintOffsetCache();
+}
+
+LayoutStateDisabler::LayoutStateDisabler(FrameViewLayoutContext& context)
+ : m_context(context)
+{
+ m_context.disablePaintOffsetCache();
+}
+
+LayoutStateDisabler::~LayoutStateDisabler()
+{
+ m_context.enablePaintOffsetCache();
+}
+
+static bool shouldDisablePaintOffsetCacheForSubtree(RenderElement& subtreeLayoutRoot)
+{
+ for (auto* renderer = &subtreeLayoutRoot; renderer; renderer = renderer->container()) {
+ if (renderer->hasTransform() || renderer->hasReflection())
+ return true;
+ }
+ return false;
+}
+
+SubtreeLayoutStateMaintainer::SubtreeLayoutStateMaintainer(RenderElement* subtreeLayoutRoot)
+{
+ if (subtreeLayoutRoot) {
+ m_context = &subtreeLayoutRoot->view().frameView().layoutContext();
+ m_context->pushLayoutState(*subtreeLayoutRoot);
+ if (shouldDisablePaintOffsetCacheForSubtree(*subtreeLayoutRoot)) {
+ m_context->disablePaintOffsetCache();
+ m_didDisablePaintOffsetCache = true;
+ }
+ }
+}
+
+SubtreeLayoutStateMaintainer::~SubtreeLayoutStateMaintainer()
+{
+ if (m_context) {
+ m_context->popLayoutState();
+ if (m_didDisablePaintOffsetCache)
+ m_context->enablePaintOffsetCache();
+ }
+}
+
+PaginatedLayoutStateMaintainer::PaginatedLayoutStateMaintainer(RenderBlockFlow& flow)
+ : m_context(flow.view().frameView().layoutContext())
+ , m_pushed(m_context.pushLayoutStateForPaginationIfNeeded(flow))
+{
+}
+
+PaginatedLayoutStateMaintainer::~PaginatedLayoutStateMaintainer()
+{
+ if (m_pushed)
+ m_context.popLayoutState();
+}
+
+} // namespace WebCore
+
Copied: trunk/Source/WebCore/rendering/RenderLayoutState.h (from rev 238962, trunk/Source/WebCore/rendering/LayoutState.h) (0 => 238963)
--- trunk/Source/WebCore/rendering/RenderLayoutState.h (rev 0)
+++ trunk/Source/WebCore/rendering/RenderLayoutState.h 2018-12-07 20:10:14 UTC (rev 238963)
@@ -0,0 +1,179 @@
+/*
+ * Copyright (C) 2007, 2013 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include "FrameViewLayoutContext.h"
+#include "LayoutRect.h"
+#include <wtf/Noncopyable.h>
+
+namespace WebCore {
+
+class RenderBlockFlow;
+class RenderBox;
+class RenderElement;
+class RenderFragmentedFlow;
+class RenderMultiColumnFlow;
+class RenderObject;
+
+class RenderLayoutState {
+ WTF_MAKE_NONCOPYABLE(RenderLayoutState); WTF_MAKE_FAST_ALLOCATED;
+
+public:
+ RenderLayoutState()
+ : m_clipped(false)
+ , m_isPaginated(false)
+ , m_pageLogicalHeightChanged(false)
+#if !ASSERT_DISABLED
+ , m_layoutDeltaXSaturated(false)
+ , m_layoutDeltaYSaturated(false)
+#endif
+ {
+ }
+ RenderLayoutState(const FrameViewLayoutContext::LayoutStateStack&, RenderBox&, const LayoutSize& offset, LayoutUnit pageHeight, bool pageHeightChanged);
+ enum class IsPaginated { No, Yes };
+ explicit RenderLayoutState(RenderElement&, IsPaginated = IsPaginated::No);
+
+ bool isPaginated() const { return m_isPaginated; }
+
+ // The page logical offset is the object's offset from the top of the page in the page progression
+ // direction (so an x-offset in vertical text and a y-offset for horizontal text).
+ LayoutUnit pageLogicalOffset(RenderBox*, LayoutUnit childLogicalOffset) const;
+
+ LayoutUnit pageLogicalHeight() const { return m_pageLogicalHeight; }
+ bool pageLogicalHeightChanged() const { return m_pageLogicalHeightChanged; }
+
+ RenderBlockFlow* lineGrid() const { return m_lineGrid.get(); }
+ LayoutSize lineGridOffset() const { return m_lineGridOffset; }
+ LayoutSize lineGridPaginationOrigin() const { return m_lineGridPaginationOrigin; }
+
+ LayoutSize paintOffset() const { return m_paintOffset; }
+ LayoutSize layoutOffset() const { return m_layoutOffset; }
+
+ LayoutSize pageOffset() const { return m_pageOffset; }
+
+ bool needsBlockDirectionLocationSetBeforeLayout() const { return m_lineGrid || (m_isPaginated && m_pageLogicalHeight); }
+
+#ifndef NDEBUG
+ RenderElement* renderer() const { return m_renderer; }
+#endif
+ LayoutRect clipRect() const { return m_clipRect; }
+ bool isClipped() const { return m_clipped; }
+
+ void addLayoutDelta(LayoutSize);
+ LayoutSize layoutDelta() const { return m_layoutDelta; }
+#if !ASSERT_DISABLED
+ bool layoutDeltaMatches(LayoutSize) const;
+#endif
+
+private:
+ void computeOffsets(const RenderLayoutState& ancestor, RenderBox&, LayoutSize offset);
+ void computeClipRect(const RenderLayoutState& ancestor, RenderBox&);
+ // FIXME: webkit.org/b/179440 these functions should be part of the pagination code/FrameViewLayoutContext.
+ void computePaginationInformation(const FrameViewLayoutContext::LayoutStateStack&, RenderBox&, LayoutUnit pageLogicalHeight, bool pageLogicalHeightChanged);
+ void propagateLineGridInfo(const RenderLayoutState& ancestor, RenderBox&);
+ void establishLineGrid(const FrameViewLayoutContext::LayoutStateStack&, RenderBlockFlow&);
+ void computeLineGridPaginationOrigin(const RenderMultiColumnFlow&);
+
+ // Do not add anything apart from bitfields. See https://bugs.webkit.org/show_bug.cgi?id=100173
+ bool m_clipped : 1;
+ bool m_isPaginated : 1;
+ // If our page height has changed, this will force all blocks to relayout.
+ bool m_pageLogicalHeightChanged : 1;
+#if !ASSERT_DISABLED
+ bool m_layoutDeltaXSaturated : 1;
+ bool m_layoutDeltaYSaturated : 1;
+#endif
+ // The current line grid that we're snapping to and the offset of the start of the grid.
+ WeakPtr<RenderBlockFlow> m_lineGrid;
+
+ // FIXME: Distinguish between the layout clip rect and the paint clip rect which may be larger,
+ // e.g., because of composited scrolling.
+ LayoutRect m_clipRect;
+
+ // x/y offset from layout root. Includes in-flow positioning and scroll offsets.
+ LayoutSize m_paintOffset;
+ // x/y offset from layout root. Does not include in-flow positioning or scroll offsets.
+ LayoutSize m_layoutOffset;
+ // Transient offset from the final position of the object
+ // used to ensure that repaints happen in the correct place.
+ // This is a total delta accumulated from the root.
+ LayoutSize m_layoutDelta;
+
+ // The current page height for the pagination model that encloses us.
+ LayoutUnit m_pageLogicalHeight;
+ // The offset of the start of the first page in the nearest enclosing pagination model.
+ LayoutSize m_pageOffset;
+ LayoutSize m_lineGridOffset;
+ LayoutSize m_lineGridPaginationOrigin;
+#ifndef NDEBUG
+ RenderElement* m_renderer { nullptr };
+#endif
+};
+
+// Stack-based class to assist with LayoutState push/pop
+class LayoutStateMaintainer {
+ WTF_MAKE_NONCOPYABLE(LayoutStateMaintainer);
+public:
+ explicit LayoutStateMaintainer(RenderBox&, LayoutSize offset, bool disableState = false, LayoutUnit pageHeight = 0_lu, bool pageHeightChanged = false);
+ ~LayoutStateMaintainer();
+
+private:
+ FrameViewLayoutContext& m_context;
+ bool m_paintOffsetCacheIsDisabled { false };
+ bool m_didPushLayoutState { false };
+};
+
+class SubtreeLayoutStateMaintainer {
+public:
+ SubtreeLayoutStateMaintainer(RenderElement* subtreeLayoutRoot);
+ ~SubtreeLayoutStateMaintainer();
+
+private:
+ FrameViewLayoutContext* m_context { nullptr };
+ bool m_didDisablePaintOffsetCache { false };
+};
+
+class LayoutStateDisabler {
+ WTF_MAKE_NONCOPYABLE(LayoutStateDisabler);
+public:
+ LayoutStateDisabler(FrameViewLayoutContext&);
+ ~LayoutStateDisabler();
+
+private:
+ FrameViewLayoutContext& m_context;
+};
+
+class PaginatedLayoutStateMaintainer {
+public:
+ PaginatedLayoutStateMaintainer(RenderBlockFlow&);
+ ~PaginatedLayoutStateMaintainer();
+
+private:
+ FrameViewLayoutContext& m_context;
+ bool m_pushed { false };
+};
+
+} // namespace WebCore
Modified: trunk/Source/WebCore/rendering/RenderListBox.cpp (238962 => 238963)
--- trunk/Source/WebCore/rendering/RenderListBox.cpp 2018-12-07 19:32:23 UTC (rev 238962)
+++ trunk/Source/WebCore/rendering/RenderListBox.cpp 2018-12-07 20:10:14 UTC (rev 238963)
@@ -46,11 +46,11 @@
#include "HTMLOptGroupElement.h"
#include "HTMLSelectElement.h"
#include "HitTestResult.h"
-#include "LayoutState.h"
#include "NodeRenderStyle.h"
#include "Page.h"
#include "PaintInfo.h"
#include "RenderLayer.h"
+#include "RenderLayoutState.h"
#include "RenderScrollbar.h"
#include "RenderText.h"
#include "RenderTheme.h"
Modified: trunk/Source/WebCore/rendering/RenderMediaControlElements.cpp (238962 => 238963)
--- trunk/Source/WebCore/rendering/RenderMediaControlElements.cpp 2018-12-07 19:32:23 UTC (rev 238962)
+++ trunk/Source/WebCore/rendering/RenderMediaControlElements.cpp 2018-12-07 20:10:14 UTC (rev 238963)
@@ -30,8 +30,8 @@
#if ENABLE(VIDEO)
#include "RenderMediaControlElements.h"
-#include "LayoutState.h"
#include "MediaControlElements.h"
+#include "RenderLayoutState.h"
#include "RenderTheme.h"
#include "RenderView.h"
#include <wtf/IsoMallocInlines.h>
Modified: trunk/Source/WebCore/rendering/RenderMultiColumnFlow.cpp (238962 => 238963)
--- trunk/Source/WebCore/rendering/RenderMultiColumnFlow.cpp 2018-12-07 19:32:23 UTC (rev 238962)
+++ trunk/Source/WebCore/rendering/RenderMultiColumnFlow.cpp 2018-12-07 20:10:14 UTC (rev 238963)
@@ -27,8 +27,8 @@
#include "RenderMultiColumnFlow.h"
#include "HitTestResult.h"
-#include "LayoutState.h"
#include "RenderIterator.h"
+#include "RenderLayoutState.h"
#include "RenderMultiColumnSet.h"
#include "RenderMultiColumnSpannerPlaceholder.h"
#include "RenderTreeBuilder.h"
Modified: trunk/Source/WebCore/rendering/RenderTable.cpp (238962 => 238963)
--- trunk/Source/WebCore/rendering/RenderTable.cpp 2018-12-07 19:32:23 UTC (rev 238962)
+++ trunk/Source/WebCore/rendering/RenderTable.cpp 2018-12-07 20:10:14 UTC (rev 238963)
@@ -35,12 +35,12 @@
#include "HTMLNames.h"
#include "HTMLTableElement.h"
#include "LayoutRepainter.h"
-#include "LayoutState.h"
#include "RenderBlockFlow.h"
#include "RenderChildIterator.h"
#include "RenderDescendantIterator.h"
#include "RenderIterator.h"
#include "RenderLayer.h"
+#include "RenderLayoutState.h"
#include "RenderTableCaption.h"
#include "RenderTableCell.h"
#include "RenderTableCol.h"
Modified: trunk/Source/WebCore/rendering/RenderTableRow.cpp (238962 => 238963)
--- trunk/Source/WebCore/rendering/RenderTableRow.cpp 2018-12-07 19:32:23 UTC (rev 238962)
+++ trunk/Source/WebCore/rendering/RenderTableRow.cpp 2018-12-07 20:10:14 UTC (rev 238963)
@@ -28,8 +28,8 @@
#include "Document.h"
#include "HTMLNames.h"
#include "HitTestResult.h"
-#include "LayoutState.h"
#include "PaintInfo.h"
+#include "RenderLayoutState.h"
#include "RenderTableCell.h"
#include "RenderTreeBuilder.h"
#include "RenderView.h"
Modified: trunk/Source/WebCore/rendering/RenderTableSection.cpp (238962 => 238963)
--- trunk/Source/WebCore/rendering/RenderTableSection.cpp 2018-12-07 19:32:23 UTC (rev 238962)
+++ trunk/Source/WebCore/rendering/RenderTableSection.cpp 2018-12-07 20:10:14 UTC (rev 238963)
@@ -28,9 +28,9 @@
#include "Document.h"
#include "HitTestResult.h"
#include "HTMLNames.h"
-#include "LayoutState.h"
#include "PaintInfo.h"
#include "RenderChildIterator.h"
+#include "RenderLayoutState.h"
#include "RenderTableCell.h"
#include "RenderTableCol.h"
#include "RenderTableRow.h"
Modified: trunk/Source/WebCore/rendering/RenderVTTCue.cpp (238962 => 238963)
--- trunk/Source/WebCore/rendering/RenderVTTCue.cpp 2018-12-07 19:32:23 UTC (rev 238962)
+++ trunk/Source/WebCore/rendering/RenderVTTCue.cpp 2018-12-07 20:10:14 UTC (rev 238963)
@@ -29,8 +29,8 @@
#if ENABLE(VIDEO_TRACK)
#include "RenderVTTCue.h"
-#include "LayoutState.h"
#include "RenderInline.h"
+#include "RenderLayoutState.h"
#include "RenderView.h"
#include "TextTrackCueGeneric.h"
#include "VTTCue.h"
Modified: trunk/Source/WebCore/rendering/RenderView.cpp (238962 => 238963)
--- trunk/Source/WebCore/rendering/RenderView.cpp 2018-12-07 19:32:23 UTC (rev 238962)
+++ trunk/Source/WebCore/rendering/RenderView.cpp 2018-12-07 20:10:14 UTC (rev 238963)
@@ -34,7 +34,6 @@
#include "HTMLIFrameElement.h"
#include "HitTestResult.h"
#include "ImageQualityController.h"
-#include "LayoutState.h"
#include "NodeTraversal.h"
#include "Page.h"
#include "RenderDescendantIterator.h"
@@ -43,6 +42,7 @@
#include "RenderLayer.h"
#include "RenderLayerBacking.h"
#include "RenderLayerCompositor.h"
+#include "RenderLayoutState.h"
#include "RenderMultiColumnFlow.h"
#include "RenderMultiColumnSet.h"
#include "RenderMultiColumnSpannerPlaceholder.h"
Modified: trunk/Source/WebCore/rendering/RenderView.h (238962 => 238963)
--- trunk/Source/WebCore/rendering/RenderView.h 2018-12-07 19:32:23 UTC (rev 238962)
+++ trunk/Source/WebCore/rendering/RenderView.h 2018-12-07 20:10:14 UTC (rev 238963)
@@ -33,8 +33,8 @@
namespace WebCore {
class ImageQualityController;
-class LayoutState;
class RenderLayerCompositor;
+class RenderLayoutState;
class RenderQuote;
class RenderView final : public RenderBlockFlow {
@@ -210,7 +210,7 @@
bool shouldRepaint(const LayoutRect&) const;
void flushAccumulatedRepaintRegion() const;
- void layoutContent(const LayoutState&);
+ void layoutContent(const RenderLayoutState&);
bool isScrollableOrRubberbandableBox() const override;
Modified: trunk/Source/WebCore/rendering/RootInlineBox.cpp (238962 => 238963)
--- trunk/Source/WebCore/rendering/RootInlineBox.cpp 2018-12-07 19:32:23 UTC (rev 238962)
+++ trunk/Source/WebCore/rendering/RootInlineBox.cpp 2018-12-07 20:10:14 UTC (rev 238963)
@@ -29,11 +29,11 @@
#include "GraphicsContext.h"
#include "HitTestResult.h"
#include "InlineTextBox.h"
-#include "LayoutState.h"
#include "LogicalSelectionOffsetCaches.h"
#include "PaintInfo.h"
#include "RenderFragmentedFlow.h"
#include "RenderInline.h"
+#include "RenderLayoutState.h"
#include "RenderRubyBase.h"
#include "RenderRubyRun.h"
#include "RenderRubyText.h"
Modified: trunk/Source/WebCore/rendering/svg/RenderSVGRoot.cpp (238962 => 238963)
--- trunk/Source/WebCore/rendering/svg/RenderSVGRoot.cpp 2018-12-07 19:32:23 UTC (rev 238962)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGRoot.cpp 2018-12-07 20:10:14 UTC (rev 238963)
@@ -28,10 +28,10 @@
#include "GraphicsContext.h"
#include "HitTestResult.h"
#include "LayoutRepainter.h"
-#include "LayoutState.h"
#include "Page.h"
#include "RenderIterator.h"
#include "RenderLayer.h"
+#include "RenderLayoutState.h"
#include "RenderSVGResource.h"
#include "RenderSVGResourceContainer.h"
#include "RenderSVGResourceFilter.h"
@@ -145,7 +145,7 @@
m_resourcesNeedingToInvalidateClients.clear();
- // Arbitrary affine transforms are incompatible with LayoutState.
+ // Arbitrary affine transforms are incompatible with RenderLayoutState.
LayoutStateDisabler layoutStateDisabler(view().frameView().layoutContext());
bool needsLayout = selfNeedsLayout();