diff --git a/engine/core/animation/DocumentAnimations.cpp b/engine/core/animation/DocumentAnimations.cpp index 082e4bf667d..ab8a32e817f 100644 --- a/engine/core/animation/DocumentAnimations.cpp +++ b/engine/core/animation/DocumentAnimations.cpp @@ -40,7 +40,6 @@ #include "sky/engine/core/frame/FrameView.h" #include "sky/engine/core/frame/LocalFrame.h" #include "sky/engine/core/rendering/RenderView.h" -#include "sky/engine/core/rendering/compositing/RenderLayerCompositor.h" namespace blink { diff --git a/engine/core/core.gni b/engine/core/core.gni index 6e6662aa72f..5b3addac91e 100644 --- a/engine/core/core.gni +++ b/engine/core/core.gni @@ -1137,12 +1137,6 @@ sky_core_files = [ "rendering/ClipRect.h", "rendering/ClipRects.h", "rendering/ClipRectsCache.h", - "rendering/compositing/CompositingReasonFinder.cpp", - "rendering/compositing/CompositingReasonFinder.h", - "rendering/compositing/CompositingState.h", - "rendering/compositing/CompositingTriggers.h", - "rendering/compositing/RenderLayerCompositor.cpp", - "rendering/compositing/RenderLayerCompositor.h", "rendering/EllipsisBox.cpp", "rendering/EllipsisBox.h", "rendering/FilterEffectRenderer.cpp", diff --git a/engine/core/css/MediaQueryEvaluator.cpp b/engine/core/css/MediaQueryEvaluator.cpp index 4ca117a24b2..1485c1e6c97 100644 --- a/engine/core/css/MediaQueryEvaluator.cpp +++ b/engine/core/css/MediaQueryEvaluator.cpp @@ -51,7 +51,6 @@ #include "sky/engine/core/frame/Settings.h" #include "sky/engine/core/frame/UseCounter.h" #include "sky/engine/core/rendering/RenderView.h" -#include "sky/engine/core/rendering/compositing/RenderLayerCompositor.h" #include "sky/engine/core/rendering/style/RenderStyle.h" #include "sky/engine/platform/PlatformScreen.h" #include "sky/engine/platform/geometry/FloatRect.h" diff --git a/engine/core/css/MediaValues.cpp b/engine/core/css/MediaValues.cpp index 967c1a6dd61..cc7b42d6c5b 100644 --- a/engine/core/css/MediaValues.cpp +++ b/engine/core/css/MediaValues.cpp @@ -18,7 +18,6 @@ #include "sky/engine/core/page/Page.h" #include "sky/engine/core/rendering/RenderObject.h" #include "sky/engine/core/rendering/RenderView.h" -#include "sky/engine/core/rendering/compositing/RenderLayerCompositor.h" #include "sky/engine/core/rendering/style/RenderStyle.h" #include "sky/engine/platform/PlatformScreen.h" @@ -99,11 +98,8 @@ const String MediaValues::calculateMediaType(LocalFrame* frame) const bool MediaValues::calculateThreeDEnabled(LocalFrame* frame) const { - ASSERT(frame && frame->contentRenderer() && frame->contentRenderer()->compositor()); - bool threeDEnabled = false; - if (RenderView* view = frame->contentRenderer()) - threeDEnabled = view->compositor()->hasAcceleratedCompositing(); - return threeDEnabled; + // FIXME(sky): Remove + return false; } PointerType MediaValues::calculatePrimaryPointerType(LocalFrame* frame) const diff --git a/engine/core/dom/Document.cpp b/engine/core/dom/Document.cpp index cacc9f54502..76314ba809e 100644 --- a/engine/core/dom/Document.cpp +++ b/engine/core/dom/Document.cpp @@ -127,7 +127,6 @@ #include "sky/engine/core/page/Page.h" #include "sky/engine/core/rendering/HitTestResult.h" #include "sky/engine/core/rendering/RenderView.h" -#include "sky/engine/core/rendering/compositing/RenderLayerCompositor.h" #include "sky/engine/platform/DateComponents.h" #include "sky/engine/platform/EventDispatchForbiddenScope.h" #include "sky/engine/platform/Language.h" @@ -1259,9 +1258,7 @@ void Document::attach(const AttachContext& context) m_renderView = new RenderView(this); setRenderer(m_renderView); - m_renderView->setIsInWindow(true); m_renderView->setStyle(StyleResolver::styleForDocument(*this)); - m_renderView->compositor()->setNeedsCompositingUpdate(CompositingUpdateAfterCompositingInputChange); ContainerNode::attach(context); @@ -1287,9 +1284,6 @@ void Document::detach(const AttachContext& context) if (m_domWindow) m_domWindow->clearEventQueue(); - if (m_renderView) - m_renderView->setIsInWindow(false); - m_hoverNode = nullptr; m_focusedElement = nullptr; m_activeHoverElement = nullptr; @@ -1732,7 +1726,7 @@ void Document::styleResolverChanged(StyleResolverUpdateMode updateMode) ASSERT(renderView() || importsController()); if (renderView()) - renderView()->invalidatePaintForViewAndCompositedLayers(); + renderView()->setShouldDoFullPaintInvalidation(true); } } diff --git a/engine/core/dom/Element.cpp b/engine/core/dom/Element.cpp index 8cee479481d..c08831d23bf 100644 --- a/engine/core/dom/Element.cpp +++ b/engine/core/dom/Element.cpp @@ -82,7 +82,6 @@ #include "sky/engine/core/page/Page.h" #include "sky/engine/core/rendering/RenderLayer.h" #include "sky/engine/core/rendering/RenderView.h" -#include "sky/engine/core/rendering/compositing/RenderLayerCompositor.h" #include "sky/engine/platform/EventDispatchForbiddenScope.h" #include "sky/engine/platform/UserGestureIndicator.h" #include "sky/engine/platform/scroll/ScrollableArea.h" diff --git a/engine/core/frame/FrameView.cpp b/engine/core/frame/FrameView.cpp index 79004724f25..7163e74d12c 100644 --- a/engine/core/frame/FrameView.cpp +++ b/engine/core/frame/FrameView.cpp @@ -46,7 +46,6 @@ #include "sky/engine/core/page/Page.h" #include "sky/engine/core/rendering/RenderLayer.h" #include "sky/engine/core/rendering/RenderView.h" -#include "sky/engine/core/rendering/compositing/RenderLayerCompositor.h" #include "sky/engine/core/rendering/style/RenderStyle.h" #include "sky/engine/platform/ScriptForbiddenScope.h" #include "sky/engine/platform/TraceEvent.h" @@ -172,11 +171,6 @@ void FrameView::setFrameRect(const IntRect& newRect) return; Widget::setFrameRect(newRect); - - if (RenderView* renderView = this->renderView()) { - if (renderView->usesCompositing()) - renderView->compositor()->frameViewDidChangeSize(); - } } Page* FrameView::page() const @@ -201,12 +195,6 @@ IntPoint FrameView::clampOffsetAtScale(const IntPoint& offset, float scale) cons return clampedOffset; } -void FrameView::updateAcceleratedCompositingSettings() -{ - if (RenderView* renderView = this->renderView()) - renderView->compositor()->updateAcceleratedCompositingSettings(); -} - void FrameView::recalcOverflowAfterStyleChange() { RenderView* renderView = this->renderView(); @@ -396,10 +384,6 @@ void FrameView::layout(bool allowSubtree) layer->updateLayerPositionsAfterLayout(); - if (m_doFullPaintInvalidation) - renderView()->compositor()->fullyInvalidatePaint(); - renderView()->compositor()->didLayout(); - m_layoutCount++; ASSERT(!rootForThisLayout->needsLayout()); @@ -897,11 +881,8 @@ void FrameView::updateLayoutAndStyleForPainting() updateLayoutAndStyleIfNeededRecursive(); if (RenderView* view = renderView()) { - TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "UpdateLayerTree", TRACE_EVENT_SCOPE_PROCESS, "frame", m_frame.get()); - view->compositor()->updateIfNeededRecursive(); - + TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "InvalidateTreeAndUpdateIframes", TRACE_EVENT_SCOPE_PROCESS, "frame", m_frame.get()); invalidateTreeIfNeededRecursive(); - view->updateIFramesAfterLayout(); } @@ -972,13 +953,10 @@ IntPoint FrameView::convertToRenderer(const RenderObject& renderer, const IntPoi void FrameView::setTracksPaintInvalidations(bool trackPaintInvalidations) { + // FIXME(sky): Does this code work anymore now that we don't have the compositor? if (trackPaintInvalidations == m_isTrackingPaintInvalidations) return; - // FIXME(sky): simplify - if (RenderView* renderView = m_frame->contentRenderer()) - renderView->compositor()->setTracksPaintInvalidations(trackPaintInvalidations); - TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("blink.invalidation"), "FrameView::setTracksPaintInvalidations", TRACE_EVENT_SCOPE_PROCESS, "enabled", trackPaintInvalidations); @@ -989,8 +967,6 @@ void FrameView::setTracksPaintInvalidations(bool trackPaintInvalidations) void FrameView::resetTrackedPaintInvalidations() { m_trackedPaintInvalidationRects.clear(); - if (RenderView* renderView = this->renderView()) - renderView->compositor()->resetTrackedPaintInvalidationRects(); } String FrameView::trackedPaintInvalidationRectsAsText() const diff --git a/engine/core/frame/FrameView.h b/engine/core/frame/FrameView.h index fe926d1aa97..c92936ced87 100644 --- a/engine/core/frame/FrameView.h +++ b/engine/core/frame/FrameView.h @@ -103,8 +103,6 @@ public: bool needsFullPaintInvalidation() const { return m_doFullPaintInvalidation; } - void updateAcceleratedCompositingSettings(); - void recalcOverflowAfterStyleChange(); bool isEnclosedInCompositingLayer() const; diff --git a/engine/core/frame/LocalFrame.cpp b/engine/core/frame/LocalFrame.cpp index 5b36434808e..450fa2534a0 100644 --- a/engine/core/frame/LocalFrame.cpp +++ b/engine/core/frame/LocalFrame.cpp @@ -56,7 +56,6 @@ #include "sky/engine/core/rendering/HitTestResult.h" #include "sky/engine/core/rendering/RenderLayer.h" #include "sky/engine/core/rendering/RenderView.h" -#include "sky/engine/core/rendering/compositing/RenderLayerCompositor.h" #include "sky/engine/platform/graphics/GraphicsContext.h" #include "sky/engine/platform/graphics/ImageBuffer.h" #include "sky/engine/platform/text/TextStream.h" @@ -324,21 +323,6 @@ void LocalFrame::countObjectsNeedingLayout(unsigned& needsLayoutObjects, unsigne } } -String LocalFrame::layerTreeAsText(LayerTreeFlags flags) const -{ - TextStream textStream; - textStream << localLayerTreeAsText(flags); - return textStream.release(); -} - -String LocalFrame::localLayerTreeAsText(unsigned flags) const -{ - if (!contentRenderer()) - return String(); - - return contentRenderer()->compositor()->layerTreeAsText(static_cast(flags)); -} - void LocalFrame::deviceOrPageScaleFactorChanged() { document()->mediaQueryAffectingValueChanged(); diff --git a/engine/core/frame/LocalFrame.h b/engine/core/frame/LocalFrame.h index 31829dc6140..d7d90bdd16c 100644 --- a/engine/core/frame/LocalFrame.h +++ b/engine/core/frame/LocalFrame.h @@ -105,9 +105,6 @@ namespace blink { void countObjectsNeedingLayout(unsigned& needsLayoutObjects, unsigned& totalObjects, bool& isPartial); - // See GraphicsLayerClient.h for accepted flags. - String layerTreeAsText(unsigned flags = 0) const; - FloatSize resizePageRectsKeepingRatio(const FloatSize& originalSize, const FloatSize& expectedSize); void deviceOrPageScaleFactorChanged(); @@ -126,8 +123,6 @@ namespace blink { private: LocalFrame(FrameLoaderClient*, FrameHost*); - String localLayerTreeAsText(unsigned flags) const; - HashSet m_destructionObservers; mutable FrameLoader m_deprecatedLoader; OwnPtr m_mojoLoader; diff --git a/engine/core/page/Page.cpp b/engine/core/page/Page.cpp index 49f0465d5d0..9ce87b2ad33 100644 --- a/engine/core/page/Page.cpp +++ b/engine/core/page/Page.cpp @@ -239,7 +239,7 @@ void Page::settingsChanged(SettingsDelegate::ChangeType changeType) setNeedsRecalcStyleInAllFrames(); break; case SettingsDelegate::AcceleratedCompositingChange: - updateAcceleratedCompositingSettings(); + // FIXME(sky): Remove break; case SettingsDelegate::MediaQueryChange: if (mainFrame()->document()) @@ -249,12 +249,6 @@ void Page::settingsChanged(SettingsDelegate::ChangeType changeType) } } -void Page::updateAcceleratedCompositingSettings() -{ - if (FrameView* view = mainFrame()->view()) - view->updateAcceleratedCompositingSettings(); -} - void Page::didCommitLoad(LocalFrame* frame) { lifecycleNotifier().notifyDidCommitLoad(frame); diff --git a/engine/core/page/Page.h b/engine/core/page/Page.h index 616d88a24b9..8352e52c172 100644 --- a/engine/core/page/Page.h +++ b/engine/core/page/Page.h @@ -96,7 +96,6 @@ public: void setInspectorHost(inspector::InspectorHost* host) { m_inspectorHost = host; } void setNeedsRecalcStyleInAllFrames(); - void updateAcceleratedCompositingSettings(); EditorClient& editorClient() const { return *m_editorClient; } SpellCheckerClient& spellCheckerClient() const { return *m_spellCheckerClient; } diff --git a/engine/core/rendering/RenderBox.cpp b/engine/core/rendering/RenderBox.cpp index eaa4339067f..2706c3bc46b 100644 --- a/engine/core/rendering/RenderBox.cpp +++ b/engine/core/rendering/RenderBox.cpp @@ -45,7 +45,6 @@ #include "sky/engine/core/rendering/RenderInline.h" #include "sky/engine/core/rendering/RenderLayer.h" #include "sky/engine/core/rendering/RenderView.h" -#include "sky/engine/core/rendering/compositing/RenderLayerCompositor.h" #include "sky/engine/platform/LengthFunctions.h" #include "sky/engine/platform/geometry/FloatQuad.h" #include "sky/engine/platform/geometry/TransformState.h" diff --git a/engine/core/rendering/RenderBoxModelObject.cpp b/engine/core/rendering/RenderBoxModelObject.cpp index 8df04777b5b..21f1ce317ac 100644 --- a/engine/core/rendering/RenderBoxModelObject.cpp +++ b/engine/core/rendering/RenderBoxModelObject.cpp @@ -34,7 +34,6 @@ #include "sky/engine/core/rendering/RenderLayer.h" #include "sky/engine/core/rendering/RenderObjectInlines.h" #include "sky/engine/core/rendering/RenderView.h" -#include "sky/engine/core/rendering/compositing/RenderLayerCompositor.h" #include "sky/engine/core/rendering/style/ShadowList.h" #include "sky/engine/platform/LengthFunctions.h" #include "sky/engine/platform/geometry/TransformState.h" @@ -74,7 +73,8 @@ void RenderBoxModelObject::contentChanged(ContentChangeType changeType) bool RenderBoxModelObject::hasAcceleratedCompositing() const { - return view()->compositor()->hasAcceleratedCompositing(); + // FIXME(sky): Remove + return false; } InterpolationQuality RenderBoxModelObject::chooseInterpolationQuality(GraphicsContext* context, Image* image, const void* layer, const LayoutSize& size) diff --git a/engine/core/rendering/RenderLayer.cpp b/engine/core/rendering/RenderLayer.cpp index 5dd47d7e606..767c21525e9 100644 --- a/engine/core/rendering/RenderLayer.cpp +++ b/engine/core/rendering/RenderLayer.cpp @@ -60,7 +60,6 @@ #include "sky/engine/core/rendering/RenderInline.h" #include "sky/engine/core/rendering/RenderTreeAsText.h" #include "sky/engine/core/rendering/RenderView.h" -#include "sky/engine/core/rendering/compositing/RenderLayerCompositor.h" #include "sky/engine/platform/LengthFunctions.h" #include "sky/engine/platform/Partitions.h" #include "sky/engine/platform/TraceEvent.h" @@ -131,13 +130,6 @@ String RenderLayer::debugName() const return renderer()->debugName(); } -RenderLayerCompositor* RenderLayer::compositor() const -{ - if (!renderer()->view()) - return 0; - return renderer()->view()->compositor(); -} - void RenderLayer::contentChanged(ContentChangeType changeType) { // FIXME(sky): Remove @@ -223,7 +215,7 @@ void RenderLayer::updateTransformationMatrix() ASSERT(box); m_transform->makeIdentity(); box->style()->applyTransform(*m_transform, box->pixelSnappedBorderBoxRect().size(), RenderStyle::IncludeTransformOrigin); - makeMatrixRenderable(*m_transform, compositor()->hasAcceleratedCompositing()); + makeMatrixRenderable(*m_transform); } } @@ -286,7 +278,7 @@ TransformationMatrix RenderLayer::currentTransform(RenderStyle::ApplyTransformOr RenderBox* box = renderBox(); TransformationMatrix currTransform; box->style()->applyTransform(currTransform, box->pixelSnappedBorderBoxRect().size(), RenderStyle::ExcludeTransformOrigin); - makeMatrixRenderable(currTransform, compositor()->hasAcceleratedCompositing()); + makeMatrixRenderable(currTransform); return currTransform; } @@ -300,7 +292,7 @@ TransformationMatrix RenderLayer::renderableTransform(PaintBehavior paintBehavio if (paintBehavior & PaintBehaviorFlattenCompositingLayers) { TransformationMatrix matrix = *m_transform; - makeMatrixRenderable(matrix, false /* flatten 3d */); + makeMatrixRenderable(matrix); return matrix; } @@ -546,16 +538,7 @@ bool RenderLayer::isPaintInvalidationContainer() const // receive graphics layers that are parented to the compositing ancestor of the squashed layer. RenderLayer* RenderLayer::enclosingLayerWithCompositedLayerMapping(IncludeSelfOrNot includeSelf) const { - ASSERT(isAllowedToQueryCompositingState()); - - if ((includeSelf == IncludeSelf) && compositingState() != NotComposited && compositingState() != PaintsIntoGroupedBacking) - return const_cast(this); - - for (const RenderLayer* curr = compositingContainer(); curr; curr = curr->compositingContainer()) { - if (curr->compositingState() != NotComposited && curr->compositingState() != PaintsIntoGroupedBacking) - return const_cast(curr); - } - + // FIXME(sky): Remove return 0; } @@ -569,8 +552,6 @@ RenderLayer* RenderLayer::enclosingLayerForPaintInvalidationCrossingFrameBoundar RenderLayer* RenderLayer::enclosingLayerForPaintInvalidation() const { - ASSERT(isAllowedToQueryCompositingState()); - if (isPaintInvalidationContainer()) return const_cast(this); @@ -595,13 +576,7 @@ RenderLayer* RenderLayer::enclosingFilterLayer(IncludeSelfOrNot includeSelf) con void RenderLayer::setNeedsCompositingInputsUpdate() { - m_needsAncestorDependentCompositingInputsUpdate = true; - m_needsDescendantDependentCompositingInputsUpdate = true; - - for (RenderLayer* current = this; current && !current->m_childNeedsCompositingInputsUpdate; current = current->parent()) - current->m_childNeedsCompositingInputsUpdate = true; - - compositor()->setNeedsCompositingUpdate(CompositingUpdateAfterCompositingInputChange); + // FIXME(sky): Remove } void RenderLayer::updateAncestorDependentCompositingInputs(const AncestorDependentCompositingInputs& compositingInputs) @@ -616,14 +591,6 @@ void RenderLayer::updateDescendantDependentCompositingInputs(const DescendantDep m_needsDescendantDependentCompositingInputsUpdate = false; } -void RenderLayer::didUpdateCompositingInputs() -{ - ASSERT(!needsCompositingInputsUpdate()); - m_childNeedsCompositingInputsUpdate = false; - if (m_scrollableArea) - m_scrollableArea->updateNeedsCompositedScrolling(); -} - void RenderLayer::setCompositingReasons(CompositingReasons reasons, CompositingReasons mask) { if ((compositingReasons() & mask) == (reasons & mask)) @@ -1429,15 +1396,6 @@ void RenderLayer::updatePaintingInfoForFragments(LayerFragments& fragments, cons } } -static inline LayoutSize subPixelAccumulationIfNeeded(const LayoutSize& subPixelAccumulation, CompositingState compositingState) -{ - // Only apply the sub-pixel accumulation if we don't paint into our own backing layer, otherwise the position - // of the renderer already includes any sub-pixel offset. - if (compositingState == PaintsIntoOwnBacking) - return LayoutSize(); - return subPixelAccumulation; -} - void RenderLayer::paintBackgroundForFragments(const LayerFragments& layerFragments, GraphicsContext* context, GraphicsContext* transparencyLayerContext, const LayoutRect& transparencyPaintDirtyRect, bool haveTransparency, const LayerPaintingInfo& localPaintingInfo, PaintBehavior paintBehavior, RenderObject* paintingRootForRenderer, PaintLayerFlags paintFlags) @@ -1460,7 +1418,7 @@ void RenderLayer::paintBackgroundForFragments(const LayerFragments& layerFragmen // Paint the background. // FIXME: Eventually we will collect the region from the fragment itself instead of just from the paint info. PaintInfo paintInfo(context, pixelSnappedIntRect(fragment.backgroundRect.rect()), PaintPhaseBlockBackground, paintBehavior, paintingRootForRenderer, 0, localPaintingInfo.rootLayer->renderer()); - renderer()->paint(paintInfo, toPoint(fragment.layerBounds.location() - renderBoxLocation() + subPixelAccumulationIfNeeded(localPaintingInfo.subPixelAccumulation, compositingState()))); + renderer()->paint(paintInfo, toPoint(fragment.layerBounds.location() - renderBoxLocation() + localPaintingInfo.subPixelAccumulation)); if (localPaintingInfo.clipToDirtyRect) restoreClip(context, localPaintingInfo.paintDirtyRect, fragment.backgroundRect); @@ -1515,7 +1473,7 @@ void RenderLayer::paintForegroundForFragmentsWithPhase(PaintPhase phase, const L clipToRect(localPaintingInfo, context, fragment.foregroundRect, paintFlags); PaintInfo paintInfo(context, pixelSnappedIntRect(fragment.foregroundRect.rect()), phase, paintBehavior, paintingRootForRenderer, 0, localPaintingInfo.rootLayer->renderer()); - renderer()->paint(paintInfo, toPoint(fragment.layerBounds.location() - renderBoxLocation() + subPixelAccumulationIfNeeded(localPaintingInfo.subPixelAccumulation, compositingState()))); + renderer()->paint(paintInfo, toPoint(fragment.layerBounds.location() - renderBoxLocation() + localPaintingInfo.subPixelAccumulation)); if (shouldClip) restoreClip(context, localPaintingInfo.paintDirtyRect, fragment.foregroundRect); @@ -1533,7 +1491,7 @@ void RenderLayer::paintOutlineForFragments(const LayerFragments& layerFragments, // Paint our own outline PaintInfo paintInfo(context, pixelSnappedIntRect(fragment.outlineRect.rect()), PaintPhaseSelfOutline, paintBehavior, paintingRootForRenderer, 0, localPaintingInfo.rootLayer->renderer()); clipToRect(localPaintingInfo, context, fragment.outlineRect, paintFlags, DoNotIncludeSelfForBorderRadius); - renderer()->paint(paintInfo, toPoint(fragment.layerBounds.location() - renderBoxLocation() + subPixelAccumulationIfNeeded(localPaintingInfo.subPixelAccumulation, compositingState()))); + renderer()->paint(paintInfo, toPoint(fragment.layerBounds.location() - renderBoxLocation() + localPaintingInfo.subPixelAccumulation)); restoreClip(context, localPaintingInfo.paintDirtyRect, fragment.outlineRect); } } @@ -1552,7 +1510,7 @@ void RenderLayer::paintMaskForFragments(const LayerFragments& layerFragments, Gr // Paint the mask. // FIXME: Eventually we will collect the region from the fragment itself instead of just from the paint info. PaintInfo paintInfo(context, pixelSnappedIntRect(fragment.backgroundRect.rect()), PaintPhaseMask, PaintBehaviorNormal, paintingRootForRenderer, 0, localPaintingInfo.rootLayer->renderer()); - renderer()->paint(paintInfo, toPoint(fragment.layerBounds.location() - renderBoxLocation() + subPixelAccumulationIfNeeded(localPaintingInfo.subPixelAccumulation, compositingState()))); + renderer()->paint(paintInfo, toPoint(fragment.layerBounds.location() - renderBoxLocation() + localPaintingInfo.subPixelAccumulation)); if (localPaintingInfo.clipToDirtyRect) restoreClip(context, localPaintingInfo.paintDirtyRect, fragment.backgroundRect); @@ -1572,7 +1530,7 @@ void RenderLayer::paintChildClippingMaskForFragments(const LayerFragments& layer // Paint the the clipped mask. PaintInfo paintInfo(context, pixelSnappedIntRect(fragment.backgroundRect.rect()), PaintPhaseClippingMask, PaintBehaviorNormal, paintingRootForRenderer, 0, localPaintingInfo.rootLayer->renderer()); - renderer()->paint(paintInfo, toPoint(fragment.layerBounds.location() - renderBoxLocation() + subPixelAccumulationIfNeeded(localPaintingInfo.subPixelAccumulation, compositingState()))); + renderer()->paint(paintInfo, toPoint(fragment.layerBounds.location() - renderBoxLocation() + localPaintingInfo.subPixelAccumulation)); if (localPaintingInfo.clipToDirtyRect) restoreClip(context, localPaintingInfo.paintDirtyRect, fragment.foregroundRect); @@ -1585,7 +1543,7 @@ void RenderLayer::paintOverflowControlsForFragments(const LayerFragments& layerF const LayerFragment& fragment = layerFragments.at(i); clipToRect(localPaintingInfo, context, fragment.backgroundRect, paintFlags); if (RenderLayerScrollableArea* scrollableArea = this->scrollableArea()) - scrollableArea->paintOverflowControls(context, roundedIntPoint(toPoint(fragment.layerBounds.location() - renderBoxLocation() + subPixelAccumulationIfNeeded(localPaintingInfo.subPixelAccumulation, compositingState()))), pixelSnappedIntRect(fragment.backgroundRect.rect()), true); + scrollableArea->paintOverflowControls(context, roundedIntPoint(toPoint(fragment.layerBounds.location() - renderBoxLocation() + localPaintingInfo.subPixelAccumulation)), pixelSnappedIntRect(fragment.backgroundRect.rect()), true); restoreClip(context, localPaintingInfo.paintDirtyRect, fragment.backgroundRect); } } @@ -2175,19 +2133,6 @@ LayoutRect RenderLayer::boundingBoxForCompositing(const RenderLayer* ancestorLay return result; } -CompositingState RenderLayer::compositingState() const -{ - // FIXME(sky): Remove - return NotComposited; -} - -bool RenderLayer::isAllowedToQueryCompositingState() const -{ - if (gCompositingQueryMode == CompositingQueriesAreAllowed) - return true; - return renderer()->document().lifecycle().state() >= DocumentLifecycle::InCompositingUpdate; -} - GraphicsLayer* RenderLayer::graphicsLayerBacking() const { return 0; @@ -2207,11 +2152,8 @@ bool RenderLayer::hasCompositedClippingMask() const bool RenderLayer::clipsCompositingDescendantsWithBorderRadius() const { - RenderStyle* style = renderer()->style(); - if (!style) - return false; - - return compositor()->clipsCompositingDescendants(this) && style->hasBorderRadius(); + // FIXME(sky): Remove + return false; } bool RenderLayer::paintsWithTransform(PaintBehavior paintBehavior) const @@ -2347,33 +2289,8 @@ void RenderLayer::updateFilters(const RenderStyle* oldStyle, const RenderStyle* updateOrRemoveFilterEffectRenderer(); } -bool RenderLayer::attemptDirectCompositingUpdate(StyleDifference diff, const RenderStyle* oldStyle) -{ - // FIXME(sky): Remove this function now that we don't have compositing layers. - CompositingReasons oldPotentialCompositingReasonsFromStyle = m_potentialCompositingReasonsFromStyle; - compositor()->updatePotentialCompositingReasonsFromStyle(this); - - // This function implements an optimization for transforms and opacity. - // A common pattern is for a touchmove handler to update the transform - // and/or an opacity of an element every frame while the user moves their - // finger across the screen. The conditions below recognize when the - // compositing state is set up to receive a direct transform or opacity - // update. - - if (!diff.hasAtMostPropertySpecificDifferences(StyleDifference::TransformChanged | StyleDifference::OpacityChanged)) - return false; - // The potentialCompositingReasonsFromStyle could have changed without - // a corresponding StyleDifference if an animation started or ended. - if (m_potentialCompositingReasonsFromStyle != oldPotentialCompositingReasonsFromStyle) - return false; - return false; -} - void RenderLayer::styleChanged(StyleDifference diff, const RenderStyle* oldStyle) { - if (attemptDirectCompositingUpdate(diff, oldStyle)) - return; - m_stackingNode->updateIsNormalFlowOnly(); m_stackingNode->updateStackingNodesAfterStyleChange(oldStyle); diff --git a/engine/core/rendering/RenderLayer.h b/engine/core/rendering/RenderLayer.h index b2e5c630af2..5a32362ef84 100644 --- a/engine/core/rendering/RenderLayer.h +++ b/engine/core/rendering/RenderLayer.h @@ -54,6 +54,7 @@ #include "sky/engine/core/rendering/RenderLayerScrollableArea.h" #include "sky/engine/core/rendering/RenderLayerStackingNode.h" #include "sky/engine/core/rendering/RenderLayerStackingNodeIterator.h" +#include "sky/engine/core/rendering/compositing/CompositingState.h" #include "sky/engine/platform/graphics/CompositingReasons.h" #include "sky/engine/public/platform/WebBlendMode.h" #include "sky/engine/wtf/OwnPtr.h" @@ -65,7 +66,6 @@ class FilterOperations; class HitTestRequest; class HitTestResult; class HitTestingTransformState; -class RenderLayerCompositor; class RenderStyle; class TransformationMatrix; @@ -136,8 +136,6 @@ public: bool isRootLayer() const { return m_isRootLayer; } - RenderLayerCompositor* compositor() const; - // Notification from the renderer that its content changed (e.g. current frame of image changed). // Allows updates of layer content without invalidating paint. void contentChanged(ContentChangeType); @@ -263,11 +261,8 @@ public: // Only safe to call from RenderLayerModelObject::destroyLayer() void operator delete(void*); - CompositingState compositingState() const; - - // This returns true if our document is in a phase of its lifestyle during which - // compositing state may legally be read. - bool isAllowedToQueryCompositingState() const; + // FIXME(sky): Remove + CompositingState compositingState() const { return NotComposited; } GraphicsLayer* graphicsLayerBacking() const; @@ -427,7 +422,6 @@ public: void updateAncestorDependentCompositingInputs(const AncestorDependentCompositingInputs&); void updateDescendantDependentCompositingInputs(const DescendantDependentCompositingInputs&); - void didUpdateCompositingInputs(); const AncestorDependentCompositingInputs& ancestorDependentCompositingInputs() const { ASSERT(!m_needsAncestorDependentCompositingInputsUpdate); return m_ancestorDependentCompositingInputs; } const DescendantDependentCompositingInputs& descendantDependentCompositingInputs() const { ASSERT(!m_needsDescendantDependentCompositingInputsUpdate); return m_descendantDependentCompositingInputs; } @@ -444,13 +438,13 @@ public: bool hasAncestorWithClipPath() const { return ancestorDependentCompositingInputs().hasAncestorWithClipPath; } bool hasDescendantWithClipPath() const { return descendantDependentCompositingInputs().hasDescendantWithClipPath; } - bool lostGroupedMapping() const { ASSERT(isAllowedToQueryCompositingState()); return m_lostGroupedMapping; } + bool lostGroupedMapping() const { return m_lostGroupedMapping; } void setLostGroupedMapping(bool b) { m_lostGroupedMapping = b; } - CompositingReasons compositingReasons() const { ASSERT(isAllowedToQueryCompositingState()); return m_compositingReasons; } + CompositingReasons compositingReasons() const { return m_compositingReasons; } void setCompositingReasons(CompositingReasons, CompositingReasons mask = CompositingReasonAll); - bool hasCompositingDescendant() const { ASSERT(isAllowedToQueryCompositingState()); return m_hasCompositingDescendant; } + bool hasCompositingDescendant() const { return m_hasCompositingDescendant; } void setHasCompositingDescendant(bool); void updateOrRemoveFilterEffectRenderer(); @@ -552,7 +546,6 @@ private: bool requiresScrollableArea() const { return renderBox(); } void updateScrollableArea(); - bool attemptDirectCompositingUpdate(StyleDifference, const RenderStyle* oldStyle); void updateTransform(const RenderStyle* oldStyle, RenderStyle* newStyle); void dirty3DTransformedDescendantStatus(); diff --git a/engine/core/rendering/RenderLayerScrollableArea.cpp b/engine/core/rendering/RenderLayerScrollableArea.cpp index d3e76eb7640..8e3c1382e6b 100644 --- a/engine/core/rendering/RenderLayerScrollableArea.cpp +++ b/engine/core/rendering/RenderLayerScrollableArea.cpp @@ -57,7 +57,6 @@ #include "sky/engine/core/rendering/HitTestResult.h" #include "sky/engine/core/rendering/RenderGeometryMap.h" #include "sky/engine/core/rendering/RenderView.h" -#include "sky/engine/core/rendering/compositing/RenderLayerCompositor.h" #include "sky/engine/platform/PlatformGestureEvent.h" #include "sky/engine/platform/PlatformMouseEvent.h" #include "sky/engine/platform/graphics/GraphicsContextStateSaver.h" @@ -244,7 +243,6 @@ void RenderLayerScrollableArea::setScrollOffset(const IntPoint& newScrollOffset) // If we're in the middle of layout, we'll just update layers once layout has finished. layer()->clipper().clearClipRectsIncludingDescendants(); box().setPreviousPaintInvalidationRect(box().boundsRectForPaintInvalidation(paintInvalidationContainer)); - updateCompositingLayersAfterScroll(); } // The caret rect needs to be invalidated after scrolling @@ -814,31 +812,6 @@ void RenderLayerScrollableArea::updateScrollableAreaSet(bool hasOverflow) frameView->removeScrollableArea(this); } -void RenderLayerScrollableArea::updateCompositingLayersAfterScroll() -{ - RenderLayerCompositor* compositor = box().view()->compositor(); - if (compositor->inCompositingMode()) { - layer()->setNeedsCompositingInputsUpdate(); - } -} - -static bool layerNeedsCompositedScrolling(const RenderLayer* layer) -{ - return layer->scrollsOverflow() - && layer->compositor()->preferCompositingToLCDTextEnabled() - && !layer->hasDescendantWithClipPath() - && !layer->hasAncestorWithClipPath(); -} - -void RenderLayerScrollableArea::updateNeedsCompositedScrolling() -{ - const bool needsCompositedScrolling = layerNeedsCompositedScrolling(layer()); - if (static_cast(m_needsCompositedScrolling) != needsCompositedScrolling) { - m_needsCompositedScrolling = needsCompositedScrolling; - layer()->didUpdateNeedsCompositedScrolling(); - } -} - void RenderLayerScrollableArea::setTopmostScrollChild(RenderLayer* scrollChild) { // We only want to track the topmost scroll child for scrollable areas with diff --git a/engine/core/rendering/RenderLayerScrollableArea.h b/engine/core/rendering/RenderLayerScrollableArea.h index c95daa60211..1ea1c568a60 100644 --- a/engine/core/rendering/RenderLayerScrollableArea.h +++ b/engine/core/rendering/RenderLayerScrollableArea.h @@ -127,7 +127,7 @@ public: // layers never get added to the FrameView's collection. bool scrollsOverflow() const { return m_scrollsOverflow; } - void updateNeedsCompositedScrolling(); + // FIXME(sky): Remove bool needsCompositedScrolling() const { return m_needsCompositedScrolling; } // These are used during compositing updates to determine if the overflow @@ -166,8 +166,6 @@ private: void updateScrollableAreaSet(bool hasOverflow); - void updateCompositingLayersAfterScroll(); - RenderLayer& m_layer; unsigned m_scrollsOverflow : 1; diff --git a/engine/core/rendering/RenderLayerStackingNode.cpp b/engine/core/rendering/RenderLayerStackingNode.cpp index 0d3022a30c4..45c45209643 100644 --- a/engine/core/rendering/RenderLayerStackingNode.cpp +++ b/engine/core/rendering/RenderLayerStackingNode.cpp @@ -46,7 +46,6 @@ #include "sky/engine/core/rendering/RenderLayer.h" #include "sky/engine/core/rendering/RenderView.h" -#include "sky/engine/core/rendering/compositing/RenderLayerCompositor.h" #include "sky/engine/public/platform/Platform.h" namespace blink { @@ -88,12 +87,6 @@ static inline bool compareZIndex(RenderLayerStackingNode* first, RenderLayerStac return first->zIndex() < second->zIndex(); } -RenderLayerCompositor* RenderLayerStackingNode::compositor() const -{ - ASSERT(renderer()->view()); - return renderer()->view()->compositor(); -} - void RenderLayerStackingNode::dirtyZOrderLists() { ASSERT(m_layerListMutationAllowed); @@ -108,9 +101,6 @@ void RenderLayerStackingNode::dirtyZOrderLists() if (m_negZOrderList) m_negZOrderList->clear(); m_zOrderListsDirty = true; - - if (!renderer()->documentBeingDestroyed()) - compositor()->setNeedsCompositingUpdate(CompositingUpdateRebuildTree); } void RenderLayerStackingNode::dirtyStackingContextZOrderLists() @@ -130,9 +120,6 @@ void RenderLayerStackingNode::dirtyNormalFlowList() if (m_normalFlowList) m_normalFlowList->clear(); m_normalFlowListDirty = true; - - if (!renderer()->documentBeingDestroyed()) - compositor()->setNeedsCompositingUpdate(CompositingUpdateRebuildTree); } void RenderLayerStackingNode::rebuildZOrderLists() diff --git a/engine/core/rendering/RenderLayerStackingNode.h b/engine/core/rendering/RenderLayerStackingNode.h index 8dfa674dd3f..2b0a7b17230 100644 --- a/engine/core/rendering/RenderLayerStackingNode.h +++ b/engine/core/rendering/RenderLayerStackingNode.h @@ -53,7 +53,6 @@ namespace blink { class RenderLayer; -class RenderLayerCompositor; class RenderStyle; class RenderLayerStackingNode { @@ -142,7 +141,6 @@ private: bool isDirtyStackingContext() const { return m_zOrderListsDirty && isStackingContext(); } - RenderLayerCompositor* compositor() const; // FIXME: Investigate changing this to Renderbox. RenderLayerModelObject* renderer() const; diff --git a/engine/core/rendering/RenderObject.cpp b/engine/core/rendering/RenderObject.cpp index 7b90c5aa5da..97c7478bf0e 100644 --- a/engine/core/rendering/RenderObject.cpp +++ b/engine/core/rendering/RenderObject.cpp @@ -58,7 +58,6 @@ #include "sky/engine/core/rendering/RenderText.h" #include "sky/engine/core/rendering/RenderTheme.h" #include "sky/engine/core/rendering/RenderView.h" -#include "sky/engine/core/rendering/compositing/RenderLayerCompositor.h" #include "sky/engine/core/rendering/style/ShadowList.h" #include "sky/engine/platform/JSONValues.h" #include "sky/engine/platform/Partitions.h" @@ -1286,10 +1285,6 @@ void RenderObject::invalidatePaintUsingContainer(const RenderLayerModelObject* p toRenderView(paintInvalidationContainer)->invalidatePaintForRectangle(r); return; } - if (paintInvalidationContainer->view()->usesCompositing()) { - ASSERT(paintInvalidationContainer->hasLayer() && (paintInvalidationContainer->layer()->compositingState() == PaintsIntoOwnBacking || paintInvalidationContainer->layer()->compositingState() == PaintsIntoGroupedBacking)); - paintInvalidationContainer->layer()->paintInvalidator().setBackingNeedsPaintInvalidationInRect(r); - } } void RenderObject::invalidatePaintForWholeRenderer() const diff --git a/engine/core/rendering/RenderObject.h b/engine/core/rendering/RenderObject.h index d5a9eec7e09..f3b67306903 100644 --- a/engine/core/rendering/RenderObject.h +++ b/engine/core/rendering/RenderObject.h @@ -39,7 +39,6 @@ #include "sky/engine/core/rendering/ScrollAlignment.h" #include "sky/engine/core/rendering/SubtreeLayoutScope.h" #include "sky/engine/core/rendering/compositing/CompositingState.h" -#include "sky/engine/core/rendering/compositing/CompositingTriggers.h" #include "sky/engine/core/rendering/style/RenderStyle.h" #include "sky/engine/core/rendering/style/StyleInheritedData.h" #include "sky/engine/platform/geometry/FloatQuad.h" @@ -1177,10 +1176,11 @@ inline bool RenderObject::boxDecorationBackgroundIsKnownToBeObscured() return m_bitfields.boxDecorationBackgroundState() == HasBoxDecorationBackgroundKnownToBeObscured; } -inline void makeMatrixRenderable(TransformationMatrix& matrix, bool has3DRendering) +inline void makeMatrixRenderable(TransformationMatrix& matrix) { - if (!has3DRendering) - matrix.makeAffine(); + // FIXME(sky): We shouldn't need to do this once Skia has 4x4 matrix support. + // Until then, 3d transforms don't work right. + matrix.makeAffine(); } #define DEFINE_RENDER_OBJECT_TYPE_CASTS(thisType, predicate) \ diff --git a/engine/core/rendering/RenderView.cpp b/engine/core/rendering/RenderView.cpp index d07125e59d2..3331fc14d77 100644 --- a/engine/core/rendering/RenderView.cpp +++ b/engine/core/rendering/RenderView.cpp @@ -31,7 +31,6 @@ #include "sky/engine/core/rendering/RenderGeometryMap.h" #include "sky/engine/core/rendering/RenderLayer.h" #include "sky/engine/core/rendering/RenderSelectionInfo.h" -#include "sky/engine/core/rendering/compositing/RenderLayerCompositor.h" #include "sky/engine/platform/TraceEvent.h" #include "sky/engine/platform/geometry/FloatQuad.h" #include "sky/engine/platform/geometry/TransformState.h" @@ -140,11 +139,9 @@ bool RenderView::shouldDoFullPaintInvalidationForNextLayout() const // i.e. html or body) as the background positioning area, and we should full paint invalidation // viewport resize if the background image is not composited and needs full paint invalidation on // background positioning area resize. - if (!m_compositor || !m_compositor->needsFixedRootBackgroundLayer(layer())) { - if (backgroundRenderer->style()->hasFixedBackgroundImage() - && mustInvalidateFillLayersPaintOnHeightChange(backgroundRenderer->style()->backgroundLayers())) - return true; - } + if (backgroundRenderer->style()->hasFixedBackgroundImage() + && mustInvalidateFillLayersPaintOnHeightChange(backgroundRenderer->style()->backgroundLayers())) + return true; } } @@ -316,17 +313,6 @@ void RenderView::invalidatePaintForRectangle(const LayoutRect& paintInvalidation } } -void RenderView::invalidatePaintForViewAndCompositedLayers() -{ - setShouldDoFullPaintInvalidation(true); - - // The only way we know how to hit these ASSERTS below this point is via the Chromium OS login screen. - DisableCompositingQueryAsserts disabler; - - if (compositor()->inCompositingMode()) - compositor()->fullyInvalidatePaint(); -} - void RenderView::mapRectToPaintInvalidationBacking(const RenderLayerModelObject* paintInvalidationContainer, LayoutRect& rect, const PaintInvalidationState* state) const { // Apply our transform if we have one (because of full page zooming). @@ -706,25 +692,6 @@ void RenderView::updateHitTestResult(HitTestResult& result, const LayoutPoint& p } } -bool RenderView::usesCompositing() const -{ - return m_compositor && m_compositor->staleInCompositingMode(); -} - -RenderLayerCompositor* RenderView::compositor() -{ - if (!m_compositor) - m_compositor = adoptPtr(new RenderLayerCompositor(*this)); - - return m_compositor.get(); -} - -void RenderView::setIsInWindow(bool isInWindow) -{ - if (m_compositor) - m_compositor->setIsInWindow(isInWindow); -} - void RenderView::pushLayoutState(LayoutState& layoutState) { m_layoutState = &layoutState; diff --git a/engine/core/rendering/RenderView.h b/engine/core/rendering/RenderView.h index 872df224f14..d342a12584e 100644 --- a/engine/core/rendering/RenderView.h +++ b/engine/core/rendering/RenderView.h @@ -32,8 +32,6 @@ namespace blink { -class RenderLayerCompositor; - // The root of the render tree, corresponding to the CSS initial containing block. // It's dimensions match that of the logical viewport (which may be different from // the visible viewport in fixed-layout mode), and it is always at position (0,0) @@ -79,8 +77,6 @@ public: void invalidatePaintForRectangle(const LayoutRect&) const; - void invalidatePaintForViewAndCompositedLayers(); - virtual void paint(PaintInfo&, const LayoutPoint&) override; virtual void paintBoxDecorationBackground(PaintInfo&, const LayoutPoint&) override; @@ -106,12 +102,6 @@ public: virtual void updateHitTestResult(HitTestResult&, const LayoutPoint&) override; - // Notification that this view moved into or out of a native window. - void setIsInWindow(bool); - - RenderLayerCompositor* compositor(); - bool usesCompositing() const; - IntRect unscaledDocumentRect() const; LayoutRect backgroundRect(RenderBox* backgroundRenderer) const; @@ -161,7 +151,6 @@ private: int m_selectionEndPos; LayoutState* m_layoutState; - OwnPtr m_compositor; unsigned m_renderCounterCount; diff --git a/engine/core/rendering/compositing/CompositingReasonFinder.cpp b/engine/core/rendering/compositing/CompositingReasonFinder.cpp deleted file mode 100644 index b9e7e06de33..00000000000 --- a/engine/core/rendering/compositing/CompositingReasonFinder.cpp +++ /dev/null @@ -1,141 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "sky/engine/config.h" -#include "sky/engine/core/rendering/compositing/CompositingReasonFinder.h" - -#include "gen/sky/core/CSSPropertyNames.h" -#include "sky/engine/core/dom/Document.h" -#include "sky/engine/core/frame/FrameView.h" -#include "sky/engine/core/frame/Settings.h" -#include "sky/engine/core/page/Page.h" -#include "sky/engine/core/rendering/RenderView.h" -#include "sky/engine/core/rendering/compositing/RenderLayerCompositor.h" - -namespace blink { - -CompositingReasonFinder::CompositingReasonFinder(RenderView& renderView) - : m_renderView(renderView) - , m_compositingTriggers(static_cast(AllCompositingTriggers)) -{ - updateTriggers(); -} - -void CompositingReasonFinder::updateTriggers() -{ - m_compositingTriggers = 0; - - Settings& settings = m_renderView.document().page()->settings(); - if (settings.preferCompositingToLCDTextEnabled()) { - m_compositingTriggers |= ScrollableInnerFrameTrigger; - m_compositingTriggers |= OverflowScrollTrigger; - } -} - -bool CompositingReasonFinder::hasOverflowScrollTrigger() const -{ - return m_compositingTriggers & OverflowScrollTrigger; -} - -CompositingReasons CompositingReasonFinder::directReasons(const RenderLayer* layer) const -{ - ASSERT(potentialCompositingReasonsFromStyle(layer->renderer()) == layer->potentialCompositingReasonsFromStyle()); - CompositingReasons styleDeterminedDirectCompositingReasons = layer->potentialCompositingReasonsFromStyle() & CompositingReasonComboAllDirectStyleDeterminedReasons; - return styleDeterminedDirectCompositingReasons | nonStyleDeterminedDirectReasons(layer); -} - -// This information doesn't appear to be incorporated into CompositingReasons. -bool CompositingReasonFinder::requiresCompositingForScrollableFrame() const -{ - // FIXME(sky) - return false; -} - -CompositingReasons CompositingReasonFinder::potentialCompositingReasonsFromStyle(RenderObject* renderer) const -{ - CompositingReasons reasons = CompositingReasonNone; - - RenderStyle* style = renderer->style(); - - if (requiresCompositingForTransform(renderer)) - reasons |= CompositingReason3DTransform; - - if (style->backfaceVisibility() == BackfaceVisibilityHidden) - reasons |= CompositingReasonBackfaceVisibilityHidden; - - if (requiresCompositingForAnimation(style)) - reasons |= CompositingReasonActiveAnimation; - - if (style->hasWillChangeCompositingHint() && !style->subtreeWillChangeContents()) - reasons |= CompositingReasonWillChangeCompositingHint; - - if (style->hasInlineTransform()) - reasons |= CompositingReasonInlineTransform; - - if (style->transformStyle3D() == TransformStyle3DPreserve3D) - reasons |= CompositingReasonPreserve3DWith3DDescendants; - - if (style->hasPerspective()) - reasons |= CompositingReasonPerspectiveWith3DDescendants; - - // If the implementation of createsGroup changes, we need to be aware of that in this part of code. - ASSERT((renderer->isTransparent() || renderer->hasMask() || renderer->hasFilter()) == renderer->createsGroup()); - - if (style->hasMask()) - reasons |= CompositingReasonMaskWithCompositedDescendants; - - if (style->hasFilter()) - reasons |= CompositingReasonFilterWithCompositedDescendants; - - // See RenderLayer::updateTransform for an explanation of why we check both. - if (renderer->hasTransform() && style->hasTransform()) - reasons |= CompositingReasonTransformWithCompositedDescendants; - - if (renderer->isTransparent()) - reasons |= CompositingReasonOpacityWithCompositedDescendants; - - ASSERT(!(reasons & ~CompositingReasonComboAllStyleDeterminedReasons)); - return reasons; -} - -bool CompositingReasonFinder::requiresCompositingForTransform(RenderObject* renderer) const -{ - // Note that we ask the renderer if it has a transform, because the style may have transforms, - // but the renderer may be an inline that doesn't suppport them. - return renderer->hasTransform() && renderer->style()->transform().has3DOperation(); -} - -CompositingReasons CompositingReasonFinder::nonStyleDeterminedDirectReasons(const RenderLayer* layer) const -{ - CompositingReasons directReasons = CompositingReasonNone; - RenderObject* renderer = layer->renderer(); - - if (hasOverflowScrollTrigger()) { - if (layer->clipParent()) - directReasons |= CompositingReasonOutOfFlowClipping; - - if (const RenderLayer* scrollingAncestor = layer->ancestorScrollingLayer()) { - if (scrollingAncestor->needsCompositedScrolling() && layer->scrollParent()) - directReasons |= CompositingReasonOverflowScrollingParent; - } - - if (layer->needsCompositedScrolling()) - directReasons |= CompositingReasonOverflowScrollingTouch; - } - - directReasons |= renderer->additionalCompositingReasons(); - - ASSERT(!(directReasons & CompositingReasonComboAllStyleDeterminedReasons)); - return directReasons; -} - -bool CompositingReasonFinder::requiresCompositingForAnimation(RenderStyle* style) const -{ - if (style->subtreeWillChangeContents()) - return style->isRunningAnimationOnCompositor(); - - return style->shouldCompositeForCurrentAnimations(); -} - -} diff --git a/engine/core/rendering/compositing/CompositingReasonFinder.h b/engine/core/rendering/compositing/CompositingReasonFinder.h deleted file mode 100644 index b750131006c..00000000000 --- a/engine/core/rendering/compositing/CompositingReasonFinder.h +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef SKY_ENGINE_CORE_RENDERING_COMPOSITING_COMPOSITINGREASONFINDER_H_ -#define SKY_ENGINE_CORE_RENDERING_COMPOSITING_COMPOSITINGREASONFINDER_H_ - -#include "sky/engine/core/rendering/RenderLayer.h" -#include "sky/engine/core/rendering/compositing/CompositingTriggers.h" -#include "sky/engine/platform/graphics/CompositingReasons.h" - -namespace blink { - -class RenderObject; -class RenderView; - -class CompositingReasonFinder { - WTF_MAKE_NONCOPYABLE(CompositingReasonFinder); -public: - explicit CompositingReasonFinder(RenderView&); - - CompositingReasons potentialCompositingReasonsFromStyle(RenderObject*) const; - CompositingReasons directReasons(const RenderLayer*) const; - - void updateTriggers(); - - bool hasOverflowScrollTrigger() const; - bool requiresCompositingForScrollableFrame() const; - -private: - CompositingReasons nonStyleDeterminedDirectReasons(const RenderLayer*) const; - - bool requiresCompositingForTransform(RenderObject*) const; - bool requiresCompositingForAnimation(RenderStyle*) const; - - RenderView& m_renderView; - CompositingTriggerFlags m_compositingTriggers; -}; - -} // namespace blink - -#endif // SKY_ENGINE_CORE_RENDERING_COMPOSITING_COMPOSITINGREASONFINDER_H_ diff --git a/engine/core/rendering/compositing/CompositingTriggers.h b/engine/core/rendering/compositing/CompositingTriggers.h deleted file mode 100644 index 32c731b08e5..00000000000 --- a/engine/core/rendering/compositing/CompositingTriggers.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple, Inc. All rights reserved. - * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). - * Copyright (C) 2012 Samsung Electronics. All rights reserved. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public License - * along with this library; see the file COPYING.LIB. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - -#ifndef SKY_ENGINE_CORE_RENDERING_COMPOSITING_COMPOSITINGTRIGGERS_H_ -#define SKY_ENGINE_CORE_RENDERING_COMPOSITING_COMPOSITINGTRIGGERS_H_ - -namespace blink { - -enum CompositingTrigger { - ScrollableInnerFrameTrigger = 1 << 1, - OverflowScrollTrigger = 1 << 2, - AllCompositingTriggers = 0xFFFFFFFF, -}; - -typedef unsigned CompositingTriggerFlags; - -} - -#endif // SKY_ENGINE_CORE_RENDERING_COMPOSITING_COMPOSITINGTRIGGERS_H_ diff --git a/engine/core/rendering/compositing/RenderLayerCompositor.cpp b/engine/core/rendering/compositing/RenderLayerCompositor.cpp deleted file mode 100644 index c95023f2ebf..00000000000 --- a/engine/core/rendering/compositing/RenderLayerCompositor.cpp +++ /dev/null @@ -1,620 +0,0 @@ -/* - * Copyright (C) 2009, 2010 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 COMPUTER, 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 "sky/engine/config.h" - -#include "sky/engine/core/rendering/compositing/RenderLayerCompositor.h" - -#include "gen/sky/platform/RuntimeEnabledFeatures.h" -#include "sky/engine/core/animation/DocumentAnimations.h" -#include "sky/engine/core/frame/FrameView.h" -#include "sky/engine/core/frame/LocalFrame.h" -#include "sky/engine/core/frame/Settings.h" -#include "sky/engine/core/inspector/InspectorNodeIds.h" -#include "sky/engine/core/page/Chrome.h" -#include "sky/engine/core/page/ChromeClient.h" -#include "sky/engine/core/page/Page.h" -#include "sky/engine/core/rendering/RenderLayerStackingNode.h" -#include "sky/engine/core/rendering/RenderLayerStackingNodeIterator.h" -#include "sky/engine/core/rendering/RenderView.h" -#include "sky/engine/platform/ScriptForbiddenScope.h" -#include "sky/engine/platform/TraceEvent.h" -#include "sky/engine/platform/graphics/GraphicsLayer.h" -#include "sky/engine/public/platform/Platform.h" - -namespace blink { - -RenderLayerCompositor::RenderLayerCompositor(RenderView& renderView) - : m_renderView(renderView) - , m_compositingReasonFinder(renderView) - , m_pendingUpdateType(CompositingUpdateNone) - , m_compositing(false) - , m_rootShouldAlwaysCompositeDirty(true) - , m_needsUpdateFixedBackground(false) - , m_isTrackingPaintInvalidations(false) - , m_rootLayerAttachment(RootLayerUnattached) -{ - updateAcceleratedCompositingSettings(); -} - -RenderLayerCompositor::~RenderLayerCompositor() -{ - ASSERT(m_rootLayerAttachment == RootLayerUnattached); -} - -bool RenderLayerCompositor::inCompositingMode() const -{ - // FIXME: This should assert that lificycle is >= CompositingClean since - // the last step of updateIfNeeded can set this bit to false. - ASSERT(!m_rootShouldAlwaysCompositeDirty); - return m_compositing; -} - -bool RenderLayerCompositor::staleInCompositingMode() const -{ - return m_compositing; -} - -void RenderLayerCompositor::setCompositingModeEnabled(bool enable) -{ - if (enable == m_compositing) - return; - - m_compositing = enable; - - if (m_compositing) - ensureRootLayer(); - else - destroyRootLayer(); -} - -void RenderLayerCompositor::enableCompositingModeIfNeeded() -{ - if (!m_rootShouldAlwaysCompositeDirty) - return; - - m_rootShouldAlwaysCompositeDirty = false; - if (m_compositing) - return; - - if (rootShouldAlwaysComposite()) { - // FIXME: Is this needed? It was added in https://bugs.webkit.org/show_bug.cgi?id=26651. - // No tests fail if it's deleted. - setNeedsCompositingUpdate(CompositingUpdateRebuildTree); - setCompositingModeEnabled(true); - } -} - -bool RenderLayerCompositor::rootShouldAlwaysComposite() const -{ - return false; -} - -void RenderLayerCompositor::updateAcceleratedCompositingSettings() -{ - m_compositingReasonFinder.updateTriggers(); - m_rootShouldAlwaysCompositeDirty = true; -} - -bool RenderLayerCompositor::hasAcceleratedCompositing() const -{ - return false; -} - -bool RenderLayerCompositor::layerSquashingEnabled() const -{ - if (!RuntimeEnabledFeatures::layerSquashingEnabled()) - return false; - return true; -} - -bool RenderLayerCompositor::preferCompositingToLCDTextEnabled() const -{ - return m_compositingReasonFinder.hasOverflowScrollTrigger(); -} - -void RenderLayerCompositor::updateIfNeededRecursive() -{ - TRACE_EVENT0("blink", "RenderLayerCompositor::updateIfNeededRecursive"); - - ASSERT(!m_renderView.needsLayout()); - - ScriptForbiddenScope forbidScript; - - // FIXME: enableCompositingModeIfNeeded can trigger a CompositingUpdateRebuildTree, - // which asserts that it's not InCompositingUpdate. - enableCompositingModeIfNeeded(); - - lifecycle().advanceTo(DocumentLifecycle::InCompositingUpdate); - updateIfNeeded(); - lifecycle().advanceTo(DocumentLifecycle::CompositingClean); - - DocumentAnimations::startPendingAnimations(m_renderView.document()); - -#if ENABLE(ASSERT) - ASSERT(lifecycle().state() == DocumentLifecycle::CompositingClean); - assertNoUnresolvedDirtyBits(); -#endif -} - -void RenderLayerCompositor::setNeedsCompositingUpdate(CompositingUpdateType updateType) -{ - ASSERT(updateType != CompositingUpdateNone); - m_pendingUpdateType = std::max(m_pendingUpdateType, updateType); - page()->animator().scheduleVisualUpdate(); - lifecycle().ensureStateAtMost(DocumentLifecycle::LayoutClean); -} - -void RenderLayerCompositor::didLayout() -{ - // FIXME: Technically we only need to do this when the FrameView's - // isScrollable method would return a different value. - m_rootShouldAlwaysCompositeDirty = true; - enableCompositingModeIfNeeded(); - - // FIXME: Rather than marking the entire RenderView as dirty, we should - // track which RenderLayers moved during layout and only dirty those - // specific RenderLayers. - rootRenderLayer()->setNeedsCompositingInputsUpdate(); -} - -#if ENABLE(ASSERT) - -void RenderLayerCompositor::assertNoUnresolvedDirtyBits() -{ - ASSERT(m_pendingUpdateType == CompositingUpdateNone); - ASSERT(!m_rootShouldAlwaysCompositeDirty); -} - -#endif - -void RenderLayerCompositor::updateWithoutAcceleratedCompositing(CompositingUpdateType updateType) -{ -} - -void RenderLayerCompositor::updateIfNeeded() -{ - m_pendingUpdateType = CompositingUpdateNone; -} - -bool RenderLayerCompositor::allocateOrClearCompositedLayerMapping(RenderLayer*, const CompositingStateTransitionType) -{ - return false; -} - -void RenderLayerCompositor::paintInvalidationOnCompositingChange(RenderLayer* layer) -{ - // If the renderer is not attached yet, no need to issue paint invalidations. - if (layer->renderer() != &m_renderView && !layer->renderer()->parent()) - return; - - // For querying RenderLayer::compositingState() - // Eager invalidation here is correct, since we are invalidating with respect to the previous frame's - // compositing state when changing the compositing backing of the layer. - DisableCompositingQueryAsserts disabler; - - layer->paintInvalidator().paintInvalidationIncludingNonCompositingDescendants(); -} - -void RenderLayerCompositor::frameViewDidChangeLocation(const IntPoint& contentsOffset) -{ - if (m_overflowControlsHostLayer) - m_overflowControlsHostLayer->setPosition(contentsOffset); -} - -void RenderLayerCompositor::frameViewDidChangeSize() -{ - if (m_containerLayer) { - FrameView* frameView = m_renderView.frameView(); - m_containerLayer->setSize(frameView->unscaledVisibleContentSize()); - } -} - -void RenderLayerCompositor::rootFixedBackgroundsChanged() -{ - if (!supportsFixedRootBackgroundCompositing()) - return; - - // To avoid having to make the fixed root background layer fixed positioned to - // stay put, we position it in the layer tree as follows: - // - // + Overflow controls host - // + LocalFrame clip - // + (Fixed root background) <-- Here. - // + LocalFrame scroll - // + Root content layer - // + Scrollbars - // - // That is, it needs to be the first child of the frame clip, the sibling of - // the frame scroll layer. The compositor does not own the background layer, it - // just positions it (like the foreground layer). - if (GraphicsLayer* backgroundLayer = fixedRootBackgroundLayer()) - m_containerLayer->addChildBelow(backgroundLayer, m_scrollLayer.get()); -} - -String RenderLayerCompositor::layerTreeAsText(LayerTreeFlags flags) -{ - ASSERT(lifecycle().state() >= DocumentLifecycle::PaintInvalidationClean); - - if (!m_rootContentLayer) - return String(); - - // We skip dumping the scroll and clip layers to keep layerTreeAsText output - // similar between platforms (unless we explicitly request dumping from the - // root. - GraphicsLayer* rootLayer = m_rootContentLayer.get(); - if (flags & LayerTreeIncludesRootLayer) - rootLayer = rootGraphicsLayer(); - - String layerTreeText = rootLayer->layerTreeAsText(flags); - - // The true root layer is not included in the dump, so if we want to report - // its paint invalidation rects, they must be included here. - if (flags & LayerTreeIncludesPaintInvalidationRects) - return m_renderView.frameView()->trackedPaintInvalidationRectsAsText() + layerTreeText; - - return layerTreeText; -} - -static void fullyInvalidatePaintRecursive(RenderLayer* layer) -{ - for (RenderLayer* child = layer->firstChild(); child; child = child->nextSibling()) - fullyInvalidatePaintRecursive(child); -} - -void RenderLayerCompositor::fullyInvalidatePaint() -{ - // We're walking all compositing layers and invalidating them, so there's - // no need to have up-to-date compositing state. - DisableCompositingQueryAsserts disabler; - fullyInvalidatePaintRecursive(rootRenderLayer()); -} - -RenderLayer* RenderLayerCompositor::rootRenderLayer() const -{ - return m_renderView.layer(); -} - -GraphicsLayer* RenderLayerCompositor::rootGraphicsLayer() const -{ - if (m_overflowControlsHostLayer) - return m_overflowControlsHostLayer.get(); - return m_rootContentLayer.get(); -} - -GraphicsLayer* RenderLayerCompositor::scrollLayer() const -{ - return m_scrollLayer.get(); -} - -GraphicsLayer* RenderLayerCompositor::containerLayer() const -{ - return m_containerLayer.get(); -} - -GraphicsLayer* RenderLayerCompositor::ensureRootTransformLayer() -{ - ASSERT(rootGraphicsLayer()); - - if (!m_rootTransformLayer.get()) { - m_rootTransformLayer = GraphicsLayer::create(graphicsLayerFactory(), this); - m_overflowControlsHostLayer->addChild(m_rootTransformLayer.get()); - m_rootTransformLayer->addChild(m_containerLayer.get()); - } - - return m_rootTransformLayer.get(); -} - -void RenderLayerCompositor::setIsInWindow(bool isInWindow) -{ - if (!staleInCompositingMode()) - return; - - if (isInWindow) { - if (m_rootLayerAttachment != RootLayerUnattached) - return; - - RootLayerAttachment attachment = RootLayerAttachedViaChromeClient; - attachRootLayer(attachment); - } else { - if (m_rootLayerAttachment == RootLayerUnattached) - return; - - detachRootLayer(); - } -} - -void RenderLayerCompositor::updateRootLayerPosition() -{ - if (m_rootContentLayer) { - const IntRect& documentRect = m_renderView.documentRect(); - m_rootContentLayer->setSize(documentRect.size()); - m_rootContentLayer->setPosition(documentRect.location()); - } - if (m_containerLayer) { - FrameView* frameView = m_renderView.frameView(); - m_containerLayer->setSize(frameView->unscaledVisibleContentSize()); - } -} - -void RenderLayerCompositor::updatePotentialCompositingReasonsFromStyle(RenderLayer* layer) -{ - layer->setPotentialCompositingReasonsFromStyle(m_compositingReasonFinder.potentialCompositingReasonsFromStyle(layer->renderer())); -} - -void RenderLayerCompositor::updateDirectCompositingReasons(RenderLayer* layer) -{ - layer->setCompositingReasons(m_compositingReasonFinder.directReasons(layer), CompositingReasonComboAllDirectReasons); -} - -void RenderLayerCompositor::setOverlayLayer(GraphicsLayer* layer) -{ - ASSERT(rootGraphicsLayer()); - - if (layer->parent() != m_overflowControlsHostLayer.get()) - m_overflowControlsHostLayer->addChild(layer); -} - -bool RenderLayerCompositor::canBeComposited(const RenderLayer* layer) const -{ - // FIXME: We disable accelerated compositing for elements in a RenderFlowThread as it doesn't work properly. - // See http://webkit.org/b/84900 to re-enable it. - return layer->isSelfPaintingLayer(); -} - -// Return true if the given layer is a stacking context and has compositing child -// layers that it needs to clip. In this case we insert a clipping GraphicsLayer -// into the hierarchy between this layer and its children in the z-order hierarchy. -bool RenderLayerCompositor::clipsCompositingDescendants(const RenderLayer* layer) const -{ - return layer->hasCompositingDescendant() && layer->renderer()->hasClipOrOverflowClip(); -} - -// If an element has negative z-index children, those children render in front of the -// layer background, so we need an extra 'contents' layer for the foreground of the layer -// object. -bool RenderLayerCompositor::needsContentsCompositingLayer(const RenderLayer* layer) const -{ - return layer->stackingNode()->hasNegativeZOrderList(); -} - -void RenderLayerCompositor::paintContents(const GraphicsLayer* graphicsLayer, GraphicsContext& context, GraphicsLayerPaintingPhase, const IntRect& clip) -{ - // FIXME(sky): Remove. -} - -bool RenderLayerCompositor::supportsFixedRootBackgroundCompositing() const -{ - if (Settings* settings = m_renderView.document().settings()) - return settings->preferCompositingToLCDTextEnabled(); - return false; -} - -bool RenderLayerCompositor::needsFixedRootBackgroundLayer(const RenderLayer* layer) const -{ - if (layer != m_renderView.layer()) - return false; - - return supportsFixedRootBackgroundCompositing() && m_renderView.rootBackgroundIsEntirelyFixed(); -} - -GraphicsLayer* RenderLayerCompositor::fixedRootBackgroundLayer() const -{ - return 0; -} - -static void resetTrackedPaintInvalidationRectsRecursive(GraphicsLayer* graphicsLayer) -{ - if (!graphicsLayer) - return; - - graphicsLayer->resetTrackedPaintInvalidations(); - - for (size_t i = 0; i < graphicsLayer->children().size(); ++i) - resetTrackedPaintInvalidationRectsRecursive(graphicsLayer->children()[i]); - - if (GraphicsLayer* maskLayer = graphicsLayer->maskLayer()) - resetTrackedPaintInvalidationRectsRecursive(maskLayer); - - if (GraphicsLayer* clippingMaskLayer = graphicsLayer->contentsClippingMaskLayer()) - resetTrackedPaintInvalidationRectsRecursive(clippingMaskLayer); -} - -void RenderLayerCompositor::resetTrackedPaintInvalidationRects() -{ - if (GraphicsLayer* rootLayer = rootGraphicsLayer()) - resetTrackedPaintInvalidationRectsRecursive(rootLayer); -} - -void RenderLayerCompositor::setTracksPaintInvalidations(bool tracksPaintInvalidations) -{ - ASSERT(lifecycle().state() == DocumentLifecycle::PaintInvalidationClean); - m_isTrackingPaintInvalidations = tracksPaintInvalidations; -} - -bool RenderLayerCompositor::isTrackingPaintInvalidations() const -{ - return m_isTrackingPaintInvalidations; -} - -void RenderLayerCompositor::ensureRootLayer() -{ - RootLayerAttachment expectedAttachment = RootLayerAttachedViaChromeClient; - if (expectedAttachment == m_rootLayerAttachment) - return; - - if (!m_rootContentLayer) { - m_rootContentLayer = GraphicsLayer::create(graphicsLayerFactory(), this); - IntRect overflowRect = m_renderView.pixelSnappedLayoutOverflowRect(); - m_rootContentLayer->setSize(FloatSize(overflowRect.maxX(), overflowRect.maxY())); - m_rootContentLayer->setPosition(FloatPoint()); - m_rootContentLayer->setOwnerNodeId(InspectorNodeIds::idForNode(m_renderView.node())); - - // Need to clip to prevent transformed content showing outside this frame - m_rootContentLayer->setMasksToBounds(true); - } - - if (!m_overflowControlsHostLayer) { - ASSERT(!m_scrollLayer); - ASSERT(!m_containerLayer); - - // Create a layer to host the clipping layer and the overflow controls layers. - m_overflowControlsHostLayer = GraphicsLayer::create(graphicsLayerFactory(), this); - - // Create a clipping layer if this is an iframe or settings require to clip. - m_containerLayer = GraphicsLayer::create(graphicsLayerFactory(), this); - bool containerMasksToBounds = false; - if (Settings* settings = m_renderView.document().settings()) { - if (settings->mainFrameClipsContent()) - containerMasksToBounds = true; - } - m_containerLayer->setMasksToBounds(containerMasksToBounds); - - m_scrollLayer = GraphicsLayer::create(graphicsLayerFactory(), this); - - // Hook them up - m_overflowControlsHostLayer->addChild(m_containerLayer.get()); - m_containerLayer->addChild(m_scrollLayer.get()); - m_scrollLayer->addChild(m_rootContentLayer.get()); - - frameViewDidChangeSize(); - } - - // Check to see if we have to change the attachment - if (m_rootLayerAttachment != RootLayerUnattached) - detachRootLayer(); - - attachRootLayer(expectedAttachment); -} - -void RenderLayerCompositor::destroyRootLayer() -{ - if (!m_rootContentLayer) - return; - - detachRootLayer(); - - if (m_overflowControlsHostLayer) { - m_overflowControlsHostLayer = nullptr; - m_containerLayer = nullptr; - m_scrollLayer = nullptr; - } - ASSERT(!m_scrollLayer); - m_rootContentLayer = nullptr; - m_rootTransformLayer = nullptr; -} - -void RenderLayerCompositor::attachRootLayer(RootLayerAttachment attachment) -{ - if (!m_rootContentLayer) - return; - - switch (attachment) { - case RootLayerUnattached: - ASSERT_NOT_REACHED(); - break; - case RootLayerAttachedViaChromeClient: { - LocalFrame& frame = m_renderView.frameView()->frame(); - Page* page = frame.page(); - if (!page) - return; - page->chrome().client().attachRootGraphicsLayer(rootGraphicsLayer()); - break; - } - case RootLayerAttachedViaEnclosingFrame: { - ASSERT_NOT_REACHED(); - } - } - - m_rootLayerAttachment = attachment; -} - -void RenderLayerCompositor::detachRootLayer() -{ - if (!m_rootContentLayer || m_rootLayerAttachment == RootLayerUnattached) - return; - - switch (m_rootLayerAttachment) { - case RootLayerAttachedViaEnclosingFrame: { - ASSERT_NOT_REACHED(); - } - case RootLayerAttachedViaChromeClient: { - LocalFrame& frame = m_renderView.frameView()->frame(); - Page* page = frame.page(); - if (!page) - return; - page->chrome().client().attachRootGraphicsLayer(0); - } - break; - case RootLayerUnattached: - break; - } - - m_rootLayerAttachment = RootLayerUnattached; -} - -void RenderLayerCompositor::updateRootLayerAttachment() -{ - ensureRootLayer(); -} - -GraphicsLayerFactory* RenderLayerCompositor::graphicsLayerFactory() const -{ - if (Page* page = this->page()) - return page->chrome().client().graphicsLayerFactory(); - return 0; -} - -Page* RenderLayerCompositor::page() const -{ - return m_renderView.frameView()->frame().page(); -} - -DocumentLifecycle& RenderLayerCompositor::lifecycle() const -{ - return m_renderView.document().lifecycle(); -} - -String RenderLayerCompositor::debugName(const GraphicsLayer* graphicsLayer) -{ - String name; - if (graphicsLayer == m_rootContentLayer.get()) { - name = "Content Root Layer"; - } else if (graphicsLayer == m_rootTransformLayer.get()) { - name = "Root Transform Layer"; - } else if (graphicsLayer == m_overflowControlsHostLayer.get()) { - name = "Overflow Controls Host Layer"; - } else if (graphicsLayer == m_containerLayer.get()) { - name = "LocalFrame Clipping Layer"; - } else if (graphicsLayer == m_scrollLayer.get()) { - name = "LocalFrame Scrolling Layer"; - } else { - ASSERT_NOT_REACHED(); - } - - return name; -} - -} // namespace blink diff --git a/engine/core/rendering/compositing/RenderLayerCompositor.h b/engine/core/rendering/compositing/RenderLayerCompositor.h deleted file mode 100644 index 3cbc316cf25..00000000000 --- a/engine/core/rendering/compositing/RenderLayerCompositor.h +++ /dev/null @@ -1,219 +0,0 @@ -/* - * Copyright (C) 2009 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 COMPUTER, 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. - */ - -#ifndef SKY_ENGINE_CORE_RENDERING_COMPOSITING_RENDERLAYERCOMPOSITOR_H_ -#define SKY_ENGINE_CORE_RENDERING_COMPOSITING_RENDERLAYERCOMPOSITOR_H_ - -#include "sky/engine/core/rendering/RenderLayer.h" -#include "sky/engine/core/rendering/compositing/CompositingReasonFinder.h" -#include "sky/engine/platform/graphics/GraphicsLayerClient.h" -#include "sky/engine/wtf/HashMap.h" - -namespace blink { - -class DocumentLifecycle; -class GraphicsLayer; -class GraphicsLayerFactory; -class Page; - -enum CompositingUpdateType { - CompositingUpdateNone, - CompositingUpdateAfterGeometryChange, - CompositingUpdateAfterCompositingInputChange, - CompositingUpdateRebuildTree, -}; - -enum CompositingStateTransitionType { - NoCompositingStateChange, - AllocateOwnCompositedLayerMapping, - RemoveOwnCompositedLayerMapping, - PutInSquashingLayer, - RemoveFromSquashingLayer -}; - -// RenderLayerCompositor manages the hierarchy of -// composited RenderLayers. It determines which RenderLayers -// become compositing, and creates and maintains a hierarchy of -// GraphicsLayers based on the RenderLayer painting order. -// -// There is one RenderLayerCompositor per RenderView. - -class RenderLayerCompositor final : public GraphicsLayerClient { - WTF_MAKE_FAST_ALLOCATED; -public: - explicit RenderLayerCompositor(RenderView&); - virtual ~RenderLayerCompositor(); - - void updateIfNeededRecursive(); - - // Return true if this RenderView is in "compositing mode" (i.e. has one or more - // composited RenderLayers) - bool inCompositingMode() const; - // FIXME: Replace all callers with inCompositingMdoe and remove this function. - bool staleInCompositingMode() const; - // This will make a compositing layer at the root automatically, and hook up to - // the native view/window system. - void setCompositingModeEnabled(bool); - - // Returns true if the accelerated compositing is enabled - // FIXME(sky): Remove - bool hasAcceleratedCompositing() const; - bool layerSquashingEnabled() const; - - bool preferCompositingToLCDTextEnabled() const; - - bool rootShouldAlwaysComposite() const; - - // Copy the accelerated compositing related flags from Settings - void updateAcceleratedCompositingSettings(); - - // Used to indicate that a compositing update will be needed for the next frame that gets drawn. - void setNeedsCompositingUpdate(CompositingUpdateType); - - void didLayout(); - - // Whether layer's compositedLayerMapping needs a GraphicsLayer to clip z-order children of the given RenderLayer. - bool clipsCompositingDescendants(const RenderLayer*) const; - - // Whether the given layer needs an extra 'contents' layer. - bool needsContentsCompositingLayer(const RenderLayer*) const; - - bool supportsFixedRootBackgroundCompositing() const; - bool needsFixedRootBackgroundLayer(const RenderLayer*) const; - GraphicsLayer* fixedRootBackgroundLayer() const; - void setNeedsUpdateFixedBackground() { m_needsUpdateFixedBackground = true; } - - // Issue paint invalidations of the appropriate layers when the given RenderLayer starts or stops being composited. - void paintInvalidationOnCompositingChange(RenderLayer*); - - void fullyInvalidatePaint(); - - RenderLayer* rootRenderLayer() const; - GraphicsLayer* rootGraphicsLayer() const; - GraphicsLayer* scrollLayer() const; - GraphicsLayer* containerLayer() const; - - // We don't always have a root transform layer. This function lazily allocates one - // and returns it as required. - GraphicsLayer* ensureRootTransformLayer(); - - enum RootLayerAttachment { - RootLayerUnattached, - RootLayerAttachedViaChromeClient, - RootLayerAttachedViaEnclosingFrame - }; - - RootLayerAttachment rootLayerAttachment() const { return m_rootLayerAttachment; } - void updateRootLayerAttachment(); - void updateRootLayerPosition(); - - void setIsInWindow(bool); - - // Update the geometry of the layers used for clipping and scrolling in frames. - void frameViewDidChangeLocation(const IntPoint& contentsOffset); - void frameViewDidChangeSize(); - void rootFixedBackgroundsChanged(); - - String layerTreeAsText(LayerTreeFlags); - - void resetTrackedPaintInvalidationRects(); - void setTracksPaintInvalidations(bool); - - virtual String debugName(const GraphicsLayer*) override; - DocumentLifecycle& lifecycle() const; - - void updatePotentialCompositingReasonsFromStyle(RenderLayer*); - - // Whether the layer could ever be composited. - bool canBeComposited(const RenderLayer*) const; - - // FIXME: Move allocateOrClearCompositedLayerMapping to CompositingLayerAssigner once we've fixed - // the compositing chicken/egg issues. - bool allocateOrClearCompositedLayerMapping(RenderLayer*, CompositingStateTransitionType compositedLayerUpdate); - - void updateDirectCompositingReasons(RenderLayer*); - - void setOverlayLayer(GraphicsLayer*); - -private: -#if ENABLE(ASSERT) - void assertNoUnresolvedDirtyBits(); -#endif - - // GraphicsLayerClient implementation - virtual void notifyAnimationStarted(const GraphicsLayer*, double) override { } - virtual void paintContents(const GraphicsLayer*, GraphicsContext&, GraphicsLayerPaintingPhase, const IntRect&) override; - - virtual bool isTrackingPaintInvalidations() const override; - - void updateWithoutAcceleratedCompositing(CompositingUpdateType); - void updateIfNeeded(); - - void ensureRootLayer(); - void destroyRootLayer(); - - void attachRootLayer(RootLayerAttachment); - void detachRootLayer(); - - Page* page() const; - - GraphicsLayerFactory* graphicsLayerFactory() const; - - void enableCompositingModeIfNeeded(); - - RenderView& m_renderView; - OwnPtr m_rootContentLayer; - OwnPtr m_rootTransformLayer; - - CompositingReasonFinder m_compositingReasonFinder; - - CompositingUpdateType m_pendingUpdateType; - - bool m_compositing; - - // The root layer doesn't composite if it's a non-scrollable frame. - // So, after a layout we set this dirty bit to know that we need - // to recompute whether the root layer should composite even if - // none of its descendants composite. - // FIXME: Get rid of all the callers of setCompositingModeEnabled - // except the one in updateIfNeeded, then rename this to - // m_compositingDirty. - bool m_rootShouldAlwaysCompositeDirty; - bool m_needsUpdateFixedBackground; - bool m_isTrackingPaintInvalidations; // Used for testing. - - RootLayerAttachment m_rootLayerAttachment; - - // Enclosing container layer, which clips for iframe content - OwnPtr m_containerLayer; - OwnPtr m_scrollLayer; - - // Enclosing layer for overflow controls and the clipping layer - OwnPtr m_overflowControlsHostLayer; -}; - -} // namespace blink - -#endif // SKY_ENGINE_CORE_RENDERING_COMPOSITING_RENDERLAYERCOMPOSITOR_H_ diff --git a/engine/platform/graphics/GraphicsLayer.cpp b/engine/platform/graphics/GraphicsLayer.cpp index 9ddb8224a0b..42ed3b6304b 100644 --- a/engine/platform/graphics/GraphicsLayer.cpp +++ b/engine/platform/graphics/GraphicsLayer.cpp @@ -426,215 +426,6 @@ void GraphicsLayer::addRepaintRect(const FloatRect& repaintRect) } } -static bool compareFloatRects(const FloatRect& a, const FloatRect& b) -{ - if (a.x() != b.x()) - return a.x() > b.x(); - if (a.y() != b.y()) - return a.y() > b.y(); - if (a.width() != b.width()) - return a.width() > b.width(); - return a.height() > b.height(); -} - -template -static PassRefPtr pointAsJSONArray(const T& point) -{ - RefPtr array = adoptRef(new JSONArray); - array->pushNumber(point.x()); - array->pushNumber(point.y()); - return array; -} - -template -static PassRefPtr sizeAsJSONArray(const T& size) -{ - RefPtr array = adoptRef(new JSONArray); - array->pushNumber(size.width()); - array->pushNumber(size.height()); - return array; -} - -template -static PassRefPtr rectAsJSONArray(const T& rect) -{ - RefPtr array = adoptRef(new JSONArray); - array->pushNumber(rect.x()); - array->pushNumber(rect.y()); - array->pushNumber(rect.width()); - array->pushNumber(rect.height()); - return array; -} - -static double roundCloseToZero(double number) -{ - return std::abs(number) < 1e-7 ? 0 : number; -} - -static PassRefPtr transformAsJSONArray(const TransformationMatrix& t) -{ - RefPtr array = adoptRef(new JSONArray); - { - RefPtr row = adoptRef(new JSONArray); - row->pushNumber(roundCloseToZero(t.m11())); - row->pushNumber(roundCloseToZero(t.m12())); - row->pushNumber(roundCloseToZero(t.m13())); - row->pushNumber(roundCloseToZero(t.m14())); - array->pushArray(row); - } - { - RefPtr row = adoptRef(new JSONArray); - row->pushNumber(roundCloseToZero(t.m21())); - row->pushNumber(roundCloseToZero(t.m22())); - row->pushNumber(roundCloseToZero(t.m23())); - row->pushNumber(roundCloseToZero(t.m24())); - array->pushArray(row); - } - { - RefPtr row = adoptRef(new JSONArray); - row->pushNumber(roundCloseToZero(t.m31())); - row->pushNumber(roundCloseToZero(t.m32())); - row->pushNumber(roundCloseToZero(t.m33())); - row->pushNumber(roundCloseToZero(t.m34())); - array->pushArray(row); - } - { - RefPtr row = adoptRef(new JSONArray); - row->pushNumber(roundCloseToZero(t.m41())); - row->pushNumber(roundCloseToZero(t.m42())); - row->pushNumber(roundCloseToZero(t.m43())); - row->pushNumber(roundCloseToZero(t.m44())); - array->pushArray(row); - } - return array; -} - -static String pointerAsString(const void* ptr) -{ - TextStream ts; - ts << ptr; - return ts.release(); -} - -PassRefPtr GraphicsLayer::layerTreeAsJSON(LayerTreeFlags flags, RenderingContextMap& renderingContextMap) const -{ - RefPtr json = adoptRef(new JSONObject); - - if (flags & LayerTreeIncludesDebugInfo) { - json->setString("this", pointerAsString(this)); - json->setString("debugName", m_client->debugName(this)); - } - - if (m_position != FloatPoint()) - json->setArray("position", pointAsJSONArray(m_position)); - - if (m_hasTransformOrigin && m_transformOrigin != FloatPoint3D(m_size.width() * 0.5f, m_size.height() * 0.5f, 0)) - json->setArray("transformOrigin", pointAsJSONArray(m_transformOrigin)); - - if (m_size != IntSize()) - json->setArray("bounds", sizeAsJSONArray(m_size)); - - if (m_opacity != 1) - json->setNumber("opacity", m_opacity); - - if (m_blendMode != WebBlendModeNormal) - json->setString("blendMode", compositeOperatorName(CompositeSourceOver, m_blendMode)); - - if (m_contentsOpaque) - json->setBoolean("contentsOpaque", m_contentsOpaque); - - if (!m_shouldFlattenTransform) - json->setBoolean("shouldFlattenTransform", m_shouldFlattenTransform); - - if (m_3dRenderingContext) { - RenderingContextMap::const_iterator it = renderingContextMap.find(m_3dRenderingContext); - int contextId = renderingContextMap.size() + 1; - if (it == renderingContextMap.end()) - renderingContextMap.set(m_3dRenderingContext, contextId); - else - contextId = it->value; - - json->setNumber("3dRenderingContext", contextId); - } - - if (m_drawsContent) - json->setBoolean("drawsContent", m_drawsContent); - - if (!m_contentsVisible) - json->setBoolean("contentsVisible", m_contentsVisible); - - if (!m_backfaceVisibility) - json->setString("backfaceVisibility", m_backfaceVisibility ? "visible" : "hidden"); - - if (flags & LayerTreeIncludesDebugInfo) - json->setString("client", pointerAsString(m_client)); - - if (m_backgroundColor.alpha()) - json->setString("backgroundColor", m_backgroundColor.nameForRenderTreeAsText()); - - if (!m_transform.isIdentity()) - json->setArray("transform", transformAsJSONArray(m_transform)); - - if ((flags & LayerTreeIncludesPaintInvalidationRects) && repaintRectMap().contains(this) && !repaintRectMap().get(this).isEmpty()) { - Vector repaintRectsCopy = repaintRectMap().get(this); - std::sort(repaintRectsCopy.begin(), repaintRectsCopy.end(), &compareFloatRects); - RefPtr repaintRectsJSON = adoptRef(new JSONArray); - for (size_t i = 0; i < repaintRectsCopy.size(); ++i) { - if (repaintRectsCopy[i].isEmpty()) - continue; - repaintRectsJSON->pushArray(rectAsJSONArray(repaintRectsCopy[i])); - } - json->setArray("repaintRects", repaintRectsJSON); - } - - if ((flags & LayerTreeIncludesPaintingPhases) && m_paintingPhase) { - RefPtr paintingPhasesJSON = adoptRef(new JSONArray); - if (m_paintingPhase & GraphicsLayerPaintBackground) - paintingPhasesJSON->pushString("GraphicsLayerPaintBackground"); - if (m_paintingPhase & GraphicsLayerPaintForeground) - paintingPhasesJSON->pushString("GraphicsLayerPaintForeground"); - if (m_paintingPhase & GraphicsLayerPaintMask) - paintingPhasesJSON->pushString("GraphicsLayerPaintMask"); - if (m_paintingPhase & GraphicsLayerPaintChildClippingMask) - paintingPhasesJSON->pushString("GraphicsLayerPaintChildClippingMask"); - if (m_paintingPhase & GraphicsLayerPaintOverflowContents) - paintingPhasesJSON->pushString("GraphicsLayerPaintOverflowContents"); - json->setArray("paintingPhases", paintingPhasesJSON); - } - - if (flags & LayerTreeIncludesClipAndScrollParents) { - if (m_hasScrollParent) - json->setBoolean("hasScrollParent", true); - if (m_hasClipParent) - json->setBoolean("hasClipParent", true); - } - - if (flags & LayerTreeIncludesDebugInfo) { - RefPtr compositingReasonsJSON = adoptRef(new JSONArray); - for (size_t i = 0; i < kNumberOfCompositingReasons; ++i) { - if (m_debugInfo.compositingReasons() & kCompositingReasonStringMap[i].reason) - compositingReasonsJSON->pushString(kCompositingReasonStringMap[i].description); - } - json->setArray("compositingReasons", compositingReasonsJSON); - } - - if (m_children.size()) { - RefPtr childrenJSON = adoptRef(new JSONArray); - for (size_t i = 0; i < m_children.size(); i++) - childrenJSON->pushObject(m_children[i]->layerTreeAsJSON(flags, renderingContextMap)); - json->setArray("children", childrenJSON); - } - - return json; -} - -String GraphicsLayer::layerTreeAsText(LayerTreeFlags flags) const -{ - RenderingContextMap renderingContextMap; - RefPtr json = layerTreeAsJSON(flags, renderingContextMap); - return json->toPrettyJSONString(); -} - String GraphicsLayer::debugName(WebLayer* webLayer) const { String name; @@ -988,14 +779,3 @@ void GraphicsLayer::didScroll() } } // namespace blink - -#ifndef NDEBUG -void showGraphicsLayerTree(const blink::GraphicsLayer* layer) -{ - if (!layer) - return; - - String output = layer->layerTreeAsText(blink::LayerTreeIncludesDebugInfo); - fprintf(stderr, "%s\n", output.utf8().data()); -} -#endif diff --git a/engine/platform/graphics/GraphicsLayer.h b/engine/platform/graphics/GraphicsLayer.h index 89253847c11..8e2e5710189 100644 --- a/engine/platform/graphics/GraphicsLayer.h +++ b/engine/platform/graphics/GraphicsLayer.h @@ -195,15 +195,8 @@ public: // For hosting this GraphicsLayer in a native layer hierarchy. WebLayer* platformLayer() const; - typedef HashMap RenderingContextMap; - PassRefPtr layerTreeAsJSON(LayerTreeFlags, RenderingContextMap&) const; - int paintCount() const { return m_paintCount; } - // Return a string with a human readable form of the layer tree, If debug is true - // pointers for the layers and timing data will be included in the returned string. - String layerTreeAsText(LayerTreeFlags = LayerTreeNormal) const; - void resetTrackedPaintInvalidations(); void addRepaintRect(const FloatRect&); @@ -325,9 +318,4 @@ private: } // namespace blink -#ifndef NDEBUG -// Outside the WebCore namespace for ease of invocation from gdb. -void PLATFORM_EXPORT showGraphicsLayerTree(const blink::GraphicsLayer*); -#endif - #endif // SKY_ENGINE_PLATFORM_GRAPHICS_GRAPHICSLAYER_H_ diff --git a/engine/public/web/WebFrame.h b/engine/public/web/WebFrame.h index ca9ba0dca68..636ae1b550f 100644 --- a/engine/public/web/WebFrame.h +++ b/engine/public/web/WebFrame.h @@ -300,10 +300,6 @@ public: // Returns true if selection.anchorNode has a marker on range from |from| with |length|. virtual bool selectionStartHasSpellingMarkerFor(int from, int length) const = 0; - // Dumps the layer tree, used by the accelerated compositor, in - // text form. This is used only by layout tests. - virtual WebString layerTreeAsText(bool showDebugInfo = false) const = 0; - #if BLINK_IMPLEMENTATION static WebFrame* fromFrame(Frame*); #endif diff --git a/engine/web/PageWidgetDelegate.cpp b/engine/web/PageWidgetDelegate.cpp index 7e42f7c807b..d2ca447270d 100644 --- a/engine/web/PageWidgetDelegate.cpp +++ b/engine/web/PageWidgetDelegate.cpp @@ -37,7 +37,6 @@ #include "sky/engine/core/page/EventHandler.h" #include "sky/engine/core/page/Page.h" #include "sky/engine/core/rendering/RenderView.h" -#include "sky/engine/core/rendering/compositing/RenderLayerCompositor.h" #include "sky/engine/platform/Logging.h" #include "sky/engine/platform/graphics/GraphicsContext.h" #include "sky/engine/public/web/WebInputEvent.h" diff --git a/engine/web/WebLocalFrameImpl.cpp b/engine/web/WebLocalFrameImpl.cpp index 885be06432e..923573ad4b3 100644 --- a/engine/web/WebLocalFrameImpl.cpp +++ b/engine/web/WebLocalFrameImpl.cpp @@ -683,14 +683,6 @@ bool WebLocalFrameImpl::selectionStartHasSpellingMarkerFor(int from, int length) return frame()->spellChecker().selectionStartHasSpellingMarkerFor(from, length); } -WebString WebLocalFrameImpl::layerTreeAsText(bool showDebugInfo) const -{ - if (!frame()) - return WebString(); - - return WebString(frame()->layerTreeAsText(showDebugInfo ? LayerTreeIncludesDebugInfo : LayerTreeNormal)); -} - // WebLocalFrameImpl public --------------------------------------------------------- WebLocalFrame* WebLocalFrame::create(WebFrameClient* client) diff --git a/engine/web/WebLocalFrameImpl.h b/engine/web/WebLocalFrameImpl.h index 696e0d448e2..7cb5576b6fc 100644 --- a/engine/web/WebLocalFrameImpl.h +++ b/engine/web/WebLocalFrameImpl.h @@ -127,7 +127,6 @@ public: virtual WebRect selectionBoundsRect() const override; virtual bool selectionStartHasSpellingMarkerFor(int from, int length) const override; - virtual WebString layerTreeAsText(bool showDebugInfo = false) const override; static WebLocalFrameImpl* create(WebFrameClient*); virtual ~WebLocalFrameImpl(); diff --git a/engine/web/WebViewImpl.cpp b/engine/web/WebViewImpl.cpp index d5f7cb80209..bbebd422432 100644 --- a/engine/web/WebViewImpl.cpp +++ b/engine/web/WebViewImpl.cpp @@ -61,7 +61,6 @@ #include "sky/engine/core/page/Page.h" #include "sky/engine/core/page/TouchDisambiguation.h" #include "sky/engine/core/rendering/RenderView.h" -#include "sky/engine/core/rendering/compositing/RenderLayerCompositor.h" #include "sky/engine/platform/Cursor.h" #include "sky/engine/platform/KeyboardCodes.h" #include "sky/engine/platform/Logging.h" @@ -1892,21 +1891,6 @@ void WebViewImpl::setBackgroundColorOverride(WebColor color) m_backgroundColorOverride = color; } -void WebViewImpl::setOverlayLayer(GraphicsLayer* layer) -{ - if (!m_rootGraphicsLayer) - return; - - // FIXME(bokan): This path goes away after virtual viewport pinch is enabled everywhere. - if (!m_rootTransformLayer) - m_rootTransformLayer = m_page->mainFrame()->view()->renderView()->compositor()->ensureRootTransformLayer(); - - if (m_rootTransformLayer) { - if (layer->parent() != m_rootTransformLayer) - m_rootTransformLayer->addChild(layer); - } -} - Element* WebViewImpl::focusedElement() const { LocalFrame* frame = m_page->focusController().focusedFrame(); @@ -1964,17 +1948,6 @@ GraphicsLayerFactory* WebViewImpl::graphicsLayerFactory() const return m_graphicsLayerFactory.get(); } -RenderLayerCompositor* WebViewImpl::compositor() const -{ - if (!page() || !page()->mainFrame()) - return 0; - - if (!page()->mainFrame()->document() || !page()->mainFrame()->document()->renderView()) - return 0; - - return page()->mainFrame()->document()->renderView()->compositor(); -} - GraphicsLayer* WebViewImpl::rootGraphicsLayer() { return m_rootGraphicsLayer; @@ -1992,22 +1965,7 @@ void WebViewImpl::updateMainFrameScrollPosition(const IntPoint& scrollPosition, void WebViewImpl::updateRootLayerTransform() { - // If we don't have a root graphics layer, we won't bother trying to find - // or update the transform layer. - if (!m_rootGraphicsLayer) - return; - - // FIXME(bokan): m_rootTransformLayer is always set here in pinch virtual viewport. This can go away once - // that's default everywhere. - if (!m_rootTransformLayer) - m_rootTransformLayer = m_page->mainFrame()->view()->renderView()->compositor()->ensureRootTransformLayer(); - - if (m_rootTransformLayer) { - TransformationMatrix transform; - transform.translate(m_rootLayerOffset.width, m_rootLayerOffset.height); - transform = transform.scale(m_rootLayerScale); - m_rootTransformLayer->setTransform(transform); - } + // FIXME(sky): Remove } bool WebViewImpl::detectContentOnTouch(const WebPoint& position) diff --git a/engine/web/WebViewImpl.h b/engine/web/WebViewImpl.h index 91b3c05e753..712a8d0b5e7 100644 --- a/engine/web/WebViewImpl.h +++ b/engine/web/WebViewImpl.h @@ -56,7 +56,6 @@ namespace blink { class Frame; class LinkHighlight; -class RenderLayerCompositor; class UserGestureToken; class WebActiveGestureAnimation; class WebLocalFrameImpl; @@ -176,8 +175,6 @@ public: Color baseBackgroundColor() const { return m_baseBackgroundColor; } - void setOverlayLayer(GraphicsLayer*); - const WebPoint& lastMouseDownPoint() const { return m_lastMouseDownPoint; @@ -248,7 +245,6 @@ public: GraphicsLayer* rootGraphicsLayer(); void setRootGraphicsLayer(GraphicsLayer*); GraphicsLayerFactory* graphicsLayerFactory() const; - RenderLayerCompositor* compositor() const; void scheduleAnimation(); virtual void setVisibilityState(WebPageVisibilityState, bool) override;