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

Side by Side Diff: sky/engine/core/rendering/RenderBox.cpp

Issue 963253002: Move FilterEffectRenderer out of RenderLayer into RenderBox. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « sky/engine/core/rendering/RenderBox.h ('k') | sky/engine/core/rendering/RenderLayer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) 4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com)
5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) 5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com)
6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv ed. 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv ed.
7 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. 7 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved.
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 19 matching lines...) Expand all
30 #include <algorithm> 30 #include <algorithm>
31 #include "sky/engine/core/dom/Document.h" 31 #include "sky/engine/core/dom/Document.h"
32 #include "sky/engine/core/editing/htmlediting.h" 32 #include "sky/engine/core/editing/htmlediting.h"
33 #include "sky/engine/core/frame/FrameHost.h" 33 #include "sky/engine/core/frame/FrameHost.h"
34 #include "sky/engine/core/frame/FrameView.h" 34 #include "sky/engine/core/frame/FrameView.h"
35 #include "sky/engine/core/frame/LocalFrame.h" 35 #include "sky/engine/core/frame/LocalFrame.h"
36 #include "sky/engine/core/frame/Settings.h" 36 #include "sky/engine/core/frame/Settings.h"
37 #include "sky/engine/core/html/HTMLElement.h" 37 #include "sky/engine/core/html/HTMLElement.h"
38 #include "sky/engine/core/page/EventHandler.h" 38 #include "sky/engine/core/page/EventHandler.h"
39 #include "sky/engine/core/page/Page.h" 39 #include "sky/engine/core/page/Page.h"
40 #include "sky/engine/core/rendering/FilterEffectRenderer.h"
41 #include "sky/engine/core/rendering/HitTestResult.h" 40 #include "sky/engine/core/rendering/HitTestResult.h"
42 #include "sky/engine/core/rendering/HitTestingTransformState.h" 41 #include "sky/engine/core/rendering/HitTestingTransformState.h"
43 #include "sky/engine/core/rendering/PaintInfo.h" 42 #include "sky/engine/core/rendering/PaintInfo.h"
44 #include "sky/engine/core/rendering/RenderFlexibleBox.h" 43 #include "sky/engine/core/rendering/RenderFlexibleBox.h"
45 #include "sky/engine/core/rendering/RenderGeometryMap.h" 44 #include "sky/engine/core/rendering/RenderGeometryMap.h"
46 #include "sky/engine/core/rendering/RenderInline.h" 45 #include "sky/engine/core/rendering/RenderInline.h"
47 #include "sky/engine/core/rendering/RenderLayer.h" 46 #include "sky/engine/core/rendering/RenderLayer.h"
48 #include "sky/engine/core/rendering/RenderView.h" 47 #include "sky/engine/core/rendering/RenderView.h"
49 #include "sky/engine/platform/LengthFunctions.h" 48 #include "sky/engine/platform/LengthFunctions.h"
50 #include "sky/engine/platform/geometry/FloatQuad.h" 49 #include "sky/engine/platform/geometry/FloatQuad.h"
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 164
166 if (isRenderView()) { 165 if (isRenderView()) {
167 // TODO(ojan): Merge this into the same call above. 166 // TODO(ojan): Merge this into the same call above.
168 setHasBoxDecorationBackground(true); 167 setHasBoxDecorationBackground(true);
169 } else if (isRenderBlock()) { 168 } else if (isRenderBlock()) {
170 // TODO(esprehn): Why do we not want to set this on the RenderView? 169 // TODO(esprehn): Why do we not want to set this on the RenderView?
171 setHasOverflowClip(!styleToUse->isOverflowVisible()); 170 setHasOverflowClip(!styleToUse->isOverflowVisible());
172 } 171 }
173 172
174 setHasTransform(styleToUse->hasTransformRelatedProperty()); 173 setHasTransform(styleToUse->hasTransformRelatedProperty());
174 updateFilters();
175 }
176
177 void RenderBox::updateFilters()
178 {
179 if (!style()->hasFilter()) {
180 m_filterRenderer = nullptr;
181 return;
182 }
183
184 m_filterRenderer = FilterEffectRenderer::create();
185
186 // If the filter fails to build, remove it from the layer. It will still att empt to
187 // go through regular processing (e.g. compositing), but never apply anythin g.
188 if (!m_filterRenderer->build(this, style()->filter()))
189 m_filterRenderer = nullptr;
175 } 190 }
176 191
177 void RenderBox::layout() 192 void RenderBox::layout()
178 { 193 {
179 ASSERT(needsLayout()); 194 ASSERT(needsLayout());
180 195
181 RenderObject* child = slowFirstChild(); 196 RenderObject* child = slowFirstChild();
182 if (!child) { 197 if (!child) {
183 clearNeedsLayout(); 198 clearNeedsLayout();
184 return; 199 return;
(...skipping 664 matching lines...) Expand 10 before | Expand all | Expand 10 after
849 if (isTransparent()) { 864 if (isTransparent()) {
850 context->save(); 865 context->save();
851 LayoutRect clipRect = intersection(paintingInfo.paintDirtyRect, 866 LayoutRect clipRect = intersection(paintingInfo.paintDirtyRect,
852 transparencyClipBox(layer(), localPaintingInfo.rootLayer, localPaint ingInfo.subPixelAccumulation)); 867 transparencyClipBox(layer(), localPaintingInfo.rootLayer, localPaint ingInfo.subPixelAccumulation));
853 context->clip(clipRect); 868 context->clip(clipRect);
854 context->beginTransparencyLayer(opacity()); 869 context->beginTransparencyLayer(opacity());
855 } 870 }
856 871
857 layer()->clipToRect(localPaintingInfo, context, contentRect); 872 layer()->clipToRect(localPaintingInfo, context, contentRect);
858 873
859 FilterEffectRendererHelper filterPainter(layer()->filterRenderer() && hasFil ter()); 874 FilterEffectRendererHelper filterPainter(m_filterRenderer && style()->hasFil ter());
860 875
861 if (filterPainter.haveFilterEffect()) { 876 if (filterPainter.haveFilterEffect()) {
862 if (!rootRelativeBoundsComputed) 877 if (!rootRelativeBoundsComputed)
863 rootRelativeBounds = layer()->physicalBoundingBoxIncludingReflection AndStackingChildren(paintingInfo.rootLayer, offsetFromRoot); 878 rootRelativeBounds = layer()->physicalBoundingBoxIncludingReflection AndStackingChildren(paintingInfo.rootLayer, offsetFromRoot);
864 879
865 if (filterPainter.prepareFilterEffect(layer(), rootRelativeBounds, paint ingInfo.paintDirtyRect)) 880 if (filterPainter.prepareFilterEffect(m_filterRenderer.get(), rootRelati veBounds, paintingInfo.paintDirtyRect))
866 context = filterPainter.beginFilterEffect(context); 881 context = filterPainter.beginFilterEffect(context);
867 } 882 }
868 883
869 LayoutPoint layerLocation = toPoint(layerBounds.location() - location() + lo calPaintingInfo.subPixelAccumulation); 884 LayoutPoint layerLocation = toPoint(layerBounds.location() - location() + lo calPaintingInfo.subPixelAccumulation);
870 885
871 Vector<RenderBox*> layers; 886 Vector<RenderBox*> layers;
872 PaintInfo paintInfo(context, pixelSnappedIntRect(contentRect.rect()), localP aintingInfo.rootLayer->renderer()); 887 PaintInfo paintInfo(context, pixelSnappedIntRect(contentRect.rect()), localP aintingInfo.rootLayer->renderer());
873 paint(paintInfo, layerLocation, layers); 888 paint(paintInfo, layerLocation, layers);
874 889
875 std::stable_sort(layers.begin(), layers.end(), forwardCompareZIndex); 890 std::stable_sort(layers.begin(), layers.end(), forwardCompareZIndex);
(...skipping 2147 matching lines...) Expand 10 before | Expand all | Expand 10 after
3023 3038
3024 RenderBox::BoxDecorationData::BoxDecorationData(const RenderStyle& style) 3039 RenderBox::BoxDecorationData::BoxDecorationData(const RenderStyle& style)
3025 { 3040 {
3026 backgroundColor = style.colorIncludingFallback(CSSPropertyBackgroundColor); 3041 backgroundColor = style.colorIncludingFallback(CSSPropertyBackgroundColor);
3027 hasBackground = backgroundColor.alpha() || style.hasBackgroundImage(); 3042 hasBackground = backgroundColor.alpha() || style.hasBackgroundImage();
3028 ASSERT(hasBackground == style.hasBackground()); 3043 ASSERT(hasBackground == style.hasBackground());
3029 hasBorder = style.hasBorder(); 3044 hasBorder = style.hasBorder();
3030 } 3045 }
3031 3046
3032 } // namespace blink 3047 } // namespace blink
OLDNEW
« no previous file with comments | « sky/engine/core/rendering/RenderBox.h ('k') | sky/engine/core/rendering/RenderLayer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698