| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights
reserved. | 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights
reserved. |
| 3 * | 3 * |
| 4 * Portions are Copyright (C) 1998 Netscape Communications Corporation. | 4 * Portions are Copyright (C) 1998 Netscape Communications Corporation. |
| 5 * | 5 * |
| 6 * Other contributors: | 6 * Other contributors: |
| 7 * Robert O'Callahan <roc+@cs.cmu.edu> | 7 * Robert O'Callahan <roc+@cs.cmu.edu> |
| 8 * David Baron <dbaron@fas.harvard.edu> | 8 * David Baron <dbaron@fas.harvard.edu> |
| 9 * Christian Biesinger <cbiesinger@web.de> | 9 * Christian Biesinger <cbiesinger@web.de> |
| 10 * Randall Jesup <rjesup@wgate.com> | 10 * Randall Jesup <rjesup@wgate.com> |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 #include "WebCoreMemoryInstrumentation.h" | 109 #include "WebCoreMemoryInstrumentation.h" |
| 110 #include <wtf/MemoryInstrumentationVector.h> | 110 #include <wtf/MemoryInstrumentationVector.h> |
| 111 #include <wtf/StdLibExtras.h> | 111 #include <wtf/StdLibExtras.h> |
| 112 #include <wtf/UnusedParam.h> | 112 #include <wtf/UnusedParam.h> |
| 113 #include <wtf/text/CString.h> | 113 #include <wtf/text/CString.h> |
| 114 | 114 |
| 115 #if ENABLE(SVG) | 115 #if ENABLE(SVG) |
| 116 #include "SVGNames.h" | 116 #include "SVGNames.h" |
| 117 #endif | 117 #endif |
| 118 | 118 |
| 119 #if ENABLE(CSS_SHADERS) && USE(3D_GRAPHICS) | 119 #if USE(3D_GRAPHICS) |
| 120 #include "CustomFilterGlobalContext.h" | 120 #include "CustomFilterGlobalContext.h" |
| 121 #include "CustomFilterOperation.h" | 121 #include "CustomFilterOperation.h" |
| 122 #include "CustomFilterValidatedProgram.h" | 122 #include "CustomFilterValidatedProgram.h" |
| 123 #include "ValidatedCustomFilterOperation.h" | 123 #include "ValidatedCustomFilterOperation.h" |
| 124 #endif | 124 #endif |
| 125 | 125 |
| 126 #define MIN_INTERSECT_FOR_REVEAL 32 | 126 #define MIN_INTERSECT_FOR_REVEAL 32 |
| 127 | 127 |
| 128 using namespace std; | 128 using namespace std; |
| 129 | 129 |
| (...skipping 1268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1398 { | 1398 { |
| 1399 if (rect.isEmpty()) | 1399 if (rect.isEmpty()) |
| 1400 return; | 1400 return; |
| 1401 | 1401 |
| 1402 LayoutRect rectForRepaint = rect; | 1402 LayoutRect rectForRepaint = rect; |
| 1403 renderer()->style()->filterOutsets().expandRect(rectForRepaint); | 1403 renderer()->style()->filterOutsets().expandRect(rectForRepaint); |
| 1404 | 1404 |
| 1405 RenderLayerFilterInfo* filterInfo = this->filterInfo(); | 1405 RenderLayerFilterInfo* filterInfo = this->filterInfo(); |
| 1406 ASSERT(filterInfo); | 1406 ASSERT(filterInfo); |
| 1407 filterInfo->expandDirtySourceRect(rectForRepaint); | 1407 filterInfo->expandDirtySourceRect(rectForRepaint); |
| 1408 | 1408 |
| 1409 #if ENABLE(CSS_SHADERS) | |
| 1410 ASSERT(filterInfo->renderer()); | 1409 ASSERT(filterInfo->renderer()); |
| 1411 if (filterInfo->renderer()->hasCustomShaderFilter()) { | 1410 if (filterInfo->renderer()->hasCustomShaderFilter()) { |
| 1412 // If we have at least one custom shader, we need to update the whole bo
unding box of the layer, because the | 1411 // If we have at least one custom shader, we need to update the whole bo
unding box of the layer, because the |
| 1413 // shader can address any ouput pixel. | 1412 // shader can address any ouput pixel. |
| 1414 // Note: This is only for output rect, so there's no need to expand the
dirty source rect. | 1413 // Note: This is only for output rect, so there's no need to expand the
dirty source rect. |
| 1415 rectForRepaint.unite(calculateLayerBounds(this)); | 1414 rectForRepaint.unite(calculateLayerBounds(this)); |
| 1416 } | 1415 } |
| 1417 #endif | |
| 1418 | 1416 |
| 1419 RenderLayer* parentLayer = enclosingFilterRepaintLayer(); | 1417 RenderLayer* parentLayer = enclosingFilterRepaintLayer(); |
| 1420 ASSERT(parentLayer); | 1418 ASSERT(parentLayer); |
| 1421 FloatQuad repaintQuad(rectForRepaint); | 1419 FloatQuad repaintQuad(rectForRepaint); |
| 1422 LayoutRect parentLayerRect = renderer()->localToContainerQuad(repaintQuad, p
arentLayer->renderer()).enclosingBoundingBox(); | 1420 LayoutRect parentLayerRect = renderer()->localToContainerQuad(repaintQuad, p
arentLayer->renderer()).enclosingBoundingBox(); |
| 1423 | 1421 |
| 1424 if (parentLayer->isComposited()) { | 1422 if (parentLayer->isComposited()) { |
| 1425 if (!parentLayer->backing()->paintsIntoWindow()) { | 1423 if (!parentLayer->backing()->paintsIntoWindow()) { |
| 1426 parentLayer->setBackingNeedsRepaintInRect(parentLayerRect); | 1424 parentLayer->setBackingNeedsRepaintInRect(parentLayerRect); |
| 1427 return; | 1425 return; |
| (...skipping 4745 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6173 break; | 6171 break; |
| 6174 } | 6172 } |
| 6175 newStyle->setTransform(transform); | 6173 newStyle->setTransform(transform); |
| 6176 | 6174 |
| 6177 // Map in our mask. | 6175 // Map in our mask. |
| 6178 newStyle->setMaskBoxImage(renderer()->style()->boxReflect()->mask()); | 6176 newStyle->setMaskBoxImage(renderer()->style()->boxReflect()->mask()); |
| 6179 | 6177 |
| 6180 m_reflection->setStyle(newStyle.release()); | 6178 m_reflection->setStyle(newStyle.release()); |
| 6181 } | 6179 } |
| 6182 | 6180 |
| 6183 #if ENABLE(CSS_SHADERS) | |
| 6184 bool RenderLayer::isCSSCustomFilterEnabled() const | 6181 bool RenderLayer::isCSSCustomFilterEnabled() const |
| 6185 { | 6182 { |
| 6186 // We only want to enable shaders if WebGL is also enabled on this platform. | 6183 // We only want to enable shaders if WebGL is also enabled on this platform. |
| 6187 const Settings* settings = renderer()->document()->settings(); | 6184 const Settings* settings = renderer()->document()->settings(); |
| 6188 return settings && settings->isCSSCustomFilterEnabled() && settings->webGLEn
abled(); | 6185 return settings && settings->isCSSCustomFilterEnabled() && settings->webGLEn
abled(); |
| 6189 } | 6186 } |
| 6190 #endif | |
| 6191 | 6187 |
| 6192 #if ENABLE(CSS_FILTERS) | 6188 #if ENABLE(CSS_FILTERS) |
| 6193 FilterOperations RenderLayer::computeFilterOperations(const RenderStyle* style) | 6189 FilterOperations RenderLayer::computeFilterOperations(const RenderStyle* style) |
| 6194 { | 6190 { |
| 6195 #if !ENABLE(CSS_SHADERS) | |
| 6196 return style->filter(); | |
| 6197 #else | |
| 6198 const FilterOperations& filters = style->filter(); | 6191 const FilterOperations& filters = style->filter(); |
| 6199 if (!filters.hasCustomFilter()) | 6192 if (!filters.hasCustomFilter()) |
| 6200 return filters; | 6193 return filters; |
| 6201 | 6194 |
| 6202 if (!isCSSCustomFilterEnabled()) { | 6195 if (!isCSSCustomFilterEnabled()) { |
| 6203 // CSS Custom filters should not parse at all in this case, but there mi
ght be | 6196 // CSS Custom filters should not parse at all in this case, but there mi
ght be |
| 6204 // remaining styles that were parsed when the flag was enabled. Reproduc
es in DumpRenderTree | 6197 // remaining styles that were parsed when the flag was enabled. Reproduc
es in DumpRenderTree |
| 6205 // because it resets the flag while the previous test is still loaded. | 6198 // because it resets the flag while the previous test is still loaded. |
| 6206 return FilterOperations(); | 6199 return FilterOperations(); |
| 6207 } | 6200 } |
| (...skipping 15 matching lines...) Expand all Loading... |
| 6223 continue; | 6216 continue; |
| 6224 | 6217 |
| 6225 RefPtr<ValidatedCustomFilterOperation> validatedOperation = Validate
dCustomFilterOperation::create(validatedProgram.release(), | 6218 RefPtr<ValidatedCustomFilterOperation> validatedOperation = Validate
dCustomFilterOperation::create(validatedProgram.release(), |
| 6226 customOperation->parameters(), customOperation->meshRows(), cust
omOperation->meshColumns(), customOperation->meshType()); | 6219 customOperation->parameters(), customOperation->meshRows(), cust
omOperation->meshColumns(), customOperation->meshType()); |
| 6227 outputFilters.operations().append(validatedOperation.release()); | 6220 outputFilters.operations().append(validatedOperation.release()); |
| 6228 continue; | 6221 continue; |
| 6229 } | 6222 } |
| 6230 outputFilters.operations().append(filterOperation.release()); | 6223 outputFilters.operations().append(filterOperation.release()); |
| 6231 } | 6224 } |
| 6232 return outputFilters; | 6225 return outputFilters; |
| 6233 #endif | |
| 6234 } | 6226 } |
| 6235 | 6227 |
| 6236 void RenderLayer::updateOrRemoveFilterClients() | 6228 void RenderLayer::updateOrRemoveFilterClients() |
| 6237 { | 6229 { |
| 6238 if (!hasFilter()) { | 6230 if (!hasFilter()) { |
| 6239 removeFilterInfoIfNeeded(); | 6231 removeFilterInfoIfNeeded(); |
| 6240 return; | 6232 return; |
| 6241 } | 6233 } |
| 6242 | 6234 |
| 6243 #if ENABLE(CSS_SHADERS) | |
| 6244 if (renderer()->style()->filter().hasCustomFilter()) | 6235 if (renderer()->style()->filter().hasCustomFilter()) |
| 6245 ensureFilterInfo()->updateCustomFilterClients(renderer()->style()->filte
r()); | 6236 ensureFilterInfo()->updateCustomFilterClients(renderer()->style()->filte
r()); |
| 6246 else if (hasFilterInfo()) | 6237 else if (hasFilterInfo()) |
| 6247 filterInfo()->removeCustomFilterClients(); | 6238 filterInfo()->removeCustomFilterClients(); |
| 6248 #endif | |
| 6249 | 6239 |
| 6250 #if ENABLE(SVG) | 6240 #if ENABLE(SVG) |
| 6251 if (renderer()->style()->filter().hasReferenceFilter()) | 6241 if (renderer()->style()->filter().hasReferenceFilter()) |
| 6252 ensureFilterInfo()->updateReferenceFilterClients(renderer()->style()->fi
lter()); | 6242 ensureFilterInfo()->updateReferenceFilterClients(renderer()->style()->fi
lter()); |
| 6253 else if (hasFilterInfo()) | 6243 else if (hasFilterInfo()) |
| 6254 filterInfo()->removeReferenceFilterClients(); | 6244 filterInfo()->removeReferenceFilterClients(); |
| 6255 #endif | 6245 #endif |
| 6256 } | 6246 } |
| 6257 | 6247 |
| 6258 void RenderLayer::updateOrRemoveFilterEffectRenderer() | 6248 void RenderLayer::updateOrRemoveFilterEffectRenderer() |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6340 } | 6330 } |
| 6341 } | 6331 } |
| 6342 | 6332 |
| 6343 void showLayerTree(const WebCore::RenderObject* renderer) | 6333 void showLayerTree(const WebCore::RenderObject* renderer) |
| 6344 { | 6334 { |
| 6345 if (!renderer) | 6335 if (!renderer) |
| 6346 return; | 6336 return; |
| 6347 showLayerTree(renderer->enclosingLayer()); | 6337 showLayerTree(renderer->enclosingLayer()); |
| 6348 } | 6338 } |
| 6349 #endif | 6339 #endif |
| OLD | NEW |