These two functions do almost the same operations:
forward=true), given a rect to filter, what rect will change in the filtered output?
For example, FEOffset would return rect.move(offset.x, offset.y).
forward=false), given a rect in the filtered output, what input rect is needed by the filter to compute it?
For example, FEOffset would return rect.move(-offset.x, -offset.y).
The one difference is in how effects like FETile, FEImage, FETurbulence, FEDisplacementMap, etc are handled. FETurbulence fills the entire filter region with a turbulence pattern (including the margin) regardless of the filter input. When mapping an object's background rect (which doesn't include margin) forward through FETurbulence, mapRect simply passes the rect through without inflating to fill the margin, but mapPaintRect should inflate the rect to fill the margin too.
One approach to merging these is to have mapPaintRect take an enum. Trial balloon: MapDirtyRectForward, MapMaxEffectRectForward, MapDirtyRectBackward.
Merging mapPaintRect and mapRect is not trivial because of some implementation details:
1) Not all filter effects implement mapPaintRect (e.g., FETile has mapPaintRect but FETurbulence does not). https://src.chromium.org/viewvc/blink?revision=164682&view=revision only implemented a subset of what was needed. See: https://crbug.com/641854
2) mapPaintRect has a dependency on mapRect. FETile::mapPaintRect uses maxEffectRect which is only set by determineFilterPrimitiveSubregion which uses mapRect.
Comment 1 by f...@opera.com
, Aug 30 2016