https://bugs.webkit.org/show_bug.cgi?id=161980
Reviewed by Zalan Bujtas.
Move some functions that are only needed for RenderElement there.
Move collapsing anonymous table rows to RenderTableRow.
* rendering/RenderElement.cpp:
(WebCore::RenderElement::hasOutlineAnnotation):
(WebCore::RenderElement::hasSelfPaintingLayer):
(WebCore::RenderElement::checkForRepaintDuringLayout):
* rendering/RenderElement.h:
(WebCore::RenderElement::hasOutline):
(WebCore::RenderElement::hasHiddenBackface): Deleted.
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::rootOrBodyStyleChanged):
* rendering/RenderObject.cpp:
(WebCore::RenderObject::pixelSnappedAbsoluteClippedOverflowRect):
(WebCore::RenderObject::destroyAndCleanupAnonymousWrappers):
(WebCore::RenderObject::hasSelfPaintingLayer): Deleted.
(WebCore::RenderObject::checkForRepaintDuringLayout): Deleted.
(WebCore::RenderObject::hasOutlineAnnotation): Deleted.
(WebCore::RenderObject::hasEntirelyFixedBackground): Deleted.
(WebCore::collapseAnonymousTableRowsIfNeeded): Deleted.
* rendering/RenderObject.h:
(WebCore::RenderObject::hasLayer):
(WebCore::RenderObject::canBeSelectionLeaf):
(WebCore::RenderObject::hasOutline): Deleted.
(WebCore::RenderObject::hasSelectedChildren): Deleted.
* rendering/RenderTableRow.cpp:
(WebCore::RenderTableRow::destroyAndCollapseAnonymousSiblingRows):
* rendering/RenderTableRow.h:
* rendering/RenderView.cpp:
(WebCore::RenderView::rootBackgroundIsEntirelyFixed):
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205927
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2016-09-14 Antti Koivisto <antti@apple.com>
+
+ Move more code out from RenderObject
+ https://bugs.webkit.org/show_bug.cgi?id=161980
+
+ Reviewed by Zalan Bujtas.
+
+ Move some functions that are only needed for RenderElement there.
+ Move collapsing anonymous table rows to RenderTableRow.
+
+ * rendering/RenderElement.cpp:
+ (WebCore::RenderElement::hasOutlineAnnotation):
+ (WebCore::RenderElement::hasSelfPaintingLayer):
+ (WebCore::RenderElement::checkForRepaintDuringLayout):
+ * rendering/RenderElement.h:
+ (WebCore::RenderElement::hasOutline):
+ (WebCore::RenderElement::hasHiddenBackface): Deleted.
+ * rendering/RenderLayerCompositor.cpp:
+ (WebCore::RenderLayerCompositor::rootOrBodyStyleChanged):
+ * rendering/RenderObject.cpp:
+ (WebCore::RenderObject::pixelSnappedAbsoluteClippedOverflowRect):
+ (WebCore::RenderObject::destroyAndCleanupAnonymousWrappers):
+ (WebCore::RenderObject::hasSelfPaintingLayer): Deleted.
+ (WebCore::RenderObject::checkForRepaintDuringLayout): Deleted.
+ (WebCore::RenderObject::hasOutlineAnnotation): Deleted.
+ (WebCore::RenderObject::hasEntirelyFixedBackground): Deleted.
+ (WebCore::collapseAnonymousTableRowsIfNeeded): Deleted.
+ * rendering/RenderObject.h:
+ (WebCore::RenderObject::hasLayer):
+ (WebCore::RenderObject::canBeSelectionLeaf):
+ (WebCore::RenderObject::hasOutline): Deleted.
+ (WebCore::RenderObject::hasSelectedChildren): Deleted.
+ * rendering/RenderTableRow.cpp:
+ (WebCore::RenderTableRow::destroyAndCollapseAnonymousSiblingRows):
+ * rendering/RenderTableRow.h:
+ * rendering/RenderView.cpp:
+ (WebCore::RenderView::rootBackgroundIsEntirelyFixed):
+
2016-09-14 Daniel Bates <dabates@apple.com>
Switch CSSParser to use CSSParserFastPaths::isKeywordPropertyID()
downcast<RenderBoxModelObject>(*this).continuation()->updateOutlineAutoAncestor(hasOutlineAuto);
}
+bool RenderElement::hasOutlineAnnotation() const
+{
+ return element() && element()->isLink() && document().printing();
+}
+
+bool RenderElement::hasSelfPaintingLayer() const
+{
+ if (!hasLayer())
+ return false;
+ auto& layerModelObject = downcast<RenderLayerModelObject>(*this);
+ return layerModelObject.hasSelfPaintingLayer();
+}
+
+bool RenderElement::checkForRepaintDuringLayout() const
+{
+ return !document().view()->needsFullRepaint() && everHadLayout() && !hasSelfPaintingLayer();
+}
+
#if ENABLE(IOS_TEXT_AUTOSIZING)
static RenderObject::BlockContentHeightType includeNonFixedHeight(const RenderObject& renderer)
{
bool hasClipOrOverflowClip() const { return hasClip() || hasOverflowClip(); }
bool hasClipPath() const { return style().clipPath(); }
bool hasHiddenBackface() const { return style().backfaceVisibility() == BackfaceVisibilityHidden; }
+ bool hasOutlineAnnotation() const;
+ bool hasOutline() const { return style().hasOutline() || hasOutlineAnnotation(); }
+ bool hasSelfPaintingLayer() const;
+
+ bool checkForRepaintDuringLayout() const;
// anchorRect() is conceptually similar to absoluteBoundingBoxRect(), but is intended for scrolling to an anchor.
// For inline renderers, this gets the logical top left of the first leaf child and the logical bottom right of the
#endif
}
+
#if ENABLE(CSS_COMPOSITING)
bool hasBlendMode() const { return style().hasBlendMode(); }
#else
rootBackgroundTransparencyChanged();
bool hadFixedBackground = oldStyle && oldStyle->hasEntirelyFixedBackground();
- if (hadFixedBackground != renderer.hasEntirelyFixedBackground()) {
+ if (hadFixedBackground != renderer.style().hasEntirelyFixedBackground()) {
setCompositingLayersNeedRebuild();
scheduleCompositingLayerUpdate();
}
#include "RenderSVGResourceContainer.h"
#include "RenderScrollbarPart.h"
#include "RenderTableRow.h"
-#include "RenderTableSection.h"
#include "RenderTheme.h"
#include "RenderView.h"
#include "RenderWidget.h"
{
return snappedIntRect(absoluteClippedOverflowRect());
}
-
-bool RenderObject::hasSelfPaintingLayer() const
-{
- if (!hasLayer())
- return false;
- auto* layer = downcast<RenderLayerModelObject>(*this).layer();
- if (!layer)
- return false;
- return layer->isSelfPaintingLayer();
-}
-bool RenderObject::checkForRepaintDuringLayout() const
-{
- return !document().view()->needsFullRepaint() && everHadLayout() && !hasSelfPaintingLayer();
-}
-
LayoutRect RenderObject::rectWithOutlineForRepaint(const RenderLayerModelObject* repaintContainer, LayoutUnit outlineWidth) const
{
LayoutRect r(clippedOverflowRectForRepaint(repaintContainer));
return (frame().settings().shouldRespectImageOrientation() && is<HTMLImageElement>(node())) ? RespectImageOrientation : DoNotRespectImageOrientation;
}
-bool RenderObject::hasOutlineAnnotation() const
-{
- return node() && node()->isLink() && document().printing();
-}
-
-bool RenderObject::hasEntirelyFixedBackground() const
-{
- return style().hasEntirelyFixedBackground();
-}
-
static inline RenderElement* containerForElement(const RenderObject& renderer, const RenderLayerModelObject* repaintContainer, bool* repaintContainerSkipped)
{
// This method is extremely similar to containingBlock(), but with a few notable
child.invalidateFlowThreadContainingBlockIncludingDescendants(flowThread);
}
-static void collapseAnonymousTableRowsIfNeeded(const RenderObject& rendererToBeDestroyed)
-{
- if (!is<RenderTableRow>(rendererToBeDestroyed))
- return;
-
- auto& rowToBeDestroyed = downcast<RenderTableRow>(rendererToBeDestroyed);
- auto* section = downcast<RenderTableSection>(rowToBeDestroyed.parent());
- if (!section)
- return;
-
- // All siblings generated?
- for (auto* current = section->firstRow(); current; current = current->nextRow()) {
- if (current == &rendererToBeDestroyed)
- continue;
- if (!current->isAnonymous())
- return;
- }
-
- RenderTableRow* rowToInsertInto = nullptr;
- auto* currentRow = section->firstRow();
- while (currentRow) {
- if (currentRow == &rendererToBeDestroyed) {
- currentRow = currentRow->nextRow();
- continue;
- }
- if (!rowToInsertInto) {
- rowToInsertInto = currentRow;
- currentRow = currentRow->nextRow();
- continue;
- }
- currentRow->moveAllChildrenTo(rowToInsertInto);
- auto* destroyThis = currentRow;
- currentRow = currentRow->nextRow();
- destroyThis->destroy();
- }
- if (rowToInsertInto)
- rowToInsertInto->setNeedsLayout();
-}
-
void RenderObject::destroyAndCleanupAnonymousWrappers()
{
// If the tree is destroyed, there is no need for a clean-up phase.
destroyRoot = destroyRootParent;
destroyRootParent = destroyRootParent->parent();
}
- collapseAnonymousTableRowsIfNeeded(*destroyRoot);
+
+ if (is<RenderTableRow>(*destroyRoot)) {
+ downcast<RenderTableRow>(*destroyRoot).destroyAndCollapseAnonymousSiblingRows();
+ return;
+ }
+
destroyRoot->destroy();
// WARNING: |this| is deleted here.
}
VisibleInViewportState visibleInViewportState() { return m_bitfields.hasRareData() ? rareData().visibleInViewportState() : VisibilityUnknown; }
bool hasLayer() const { return m_bitfields.hasLayer(); }
- bool hasSelfPaintingLayer() const;
enum BoxDecorationState {
NoBoxDecorations,
};
bool hasVisibleBoxDecorations() const { return m_bitfields.boxDecorationState() != NoBoxDecorations; }
bool backgroundIsKnownToBeObscured(const LayoutPoint& paintOffset);
- bool hasEntirelyFixedBackground() const;
bool needsLayout() const
{
Document& document() const { return m_node.document(); }
Frame& frame() const;
- bool hasOutlineAnnotation() const;
- bool hasOutline() const { return style().hasOutline() || hasOutlineAnnotation(); }
-
// Returns the object containing this one. Can be different from parent for positioned elements.
// If repaintContainer and repaintContainerSkipped are not null, on return *repaintContainerSkipped
// is true if the renderer returned is an ancestor of repaintContainer.
// Repaint a slow repaint object, which, at this time, means we are repainting an object with background-attachment:fixed.
void repaintSlowRepaintObject() const;
- bool checkForRepaintDuringLayout() const;
-
// Returns the rect that should be repainted whenever this object changes. The rect is in the view's
// coordinate space. This method deals with outlines and overflow.
LayoutRect absoluteClippedOverflowRect() const
virtual LayoutRect selectionRectForRepaint(const RenderLayerModelObject* /*repaintContainer*/, bool /*clipToVisibleContent*/ = true) { return LayoutRect(); }
virtual bool canBeSelectionLeaf() const { return false; }
- bool hasSelectedChildren() const { return selectionState() != SelectionNone; }
// Whether or not a given block needs to paint selection gaps.
virtual bool shouldPaintSelectionGaps() const { return false; }
return RenderTableRow::createTableRowWithStyle(parent.document(), parent.style());
}
+void RenderTableRow::destroyAndCollapseAnonymousSiblingRows()
+{
+ auto collapseAnonymousSiblingRows = [&] {
+ auto* section = this->section();
+ if (!section)
+ return;
+
+ // All siblings generated?
+ for (auto* current = section->firstRow(); current; current = current->nextRow()) {
+ if (current == this)
+ continue;
+ if (!current->isAnonymous())
+ return;
+ }
+
+ RenderTableRow* rowToInsertInto = nullptr;
+ auto* currentRow = section->firstRow();
+ while (currentRow) {
+ if (currentRow == this) {
+ currentRow = currentRow->nextRow();
+ continue;
+ }
+ if (!rowToInsertInto) {
+ rowToInsertInto = currentRow;
+ currentRow = currentRow->nextRow();
+ continue;
+ }
+ currentRow->moveAllChildrenTo(rowToInsertInto);
+ auto* destroyThis = currentRow;
+ currentRow = currentRow->nextRow();
+ destroyThis->destroy();
+ }
+ if (rowToInsertInto)
+ rowToInsertInto->setNeedsLayout();
+ };
+
+ collapseAnonymousSiblingRows();
+ destroy();
+}
+
} // namespace WebCore
bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAction) override;
+ void destroyAndCollapseAnonymousSiblingRows();
+
private:
static std::unique_ptr<RenderTableRow> createTableRowWithStyle(Document&, const RenderStyle&);
if (!rootObject)
return false;
- return rootObject->rendererForRootBackground().hasEntirelyFixedBackground();
+ return rootObject->rendererForRootBackground().style().hasEntirelyFixedBackground();
}
LayoutRect RenderView::unextendedBackgroundRect() const