Index: /trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/Selector.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/Selector.java	(revision 15729)
+++ /trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/Selector.java	(revision 15730)
@@ -343,13 +343,6 @@
                 if (toCheck == null || toCheck.isEmpty())
                     return;
-
-                if (e.osm instanceof IWay) {
-                    for (IPrimitive p : Geometry.filterInsidePolygon(toCheck, (IWay<?>) e.osm)) {
-                        addToChildren(e, p);
-                    }
-                } else if (e.osm instanceof Relation && e.osm.isMultipolygon()) {
-                    for (IPrimitive p : Geometry.filterInsideMultipolygon(toCheck, (Relation) e.osm)) {
-                        addToChildren(e, p);
-                    }
+                for (IPrimitive p : Geometry.filterInsideAnyPolygon(toCheck, e.osm)) {
+                    addToChildren(e, p);
                 }
             }
Index: /trunk/src/org/openstreetmap/josm/tools/Geometry.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/tools/Geometry.java	(revision 15729)
+++ /trunk/src/org/openstreetmap/josm/tools/Geometry.java	(revision 15730)
@@ -1043,12 +1043,31 @@
     /**
      * Find all primitives in the given collection which are inside the given polygon.
+     *
+     * @param primitives the primitives
+     * @param polygon the closed way or multipolygon relation
+     * @return a new list containing the found primitives, empty if polygon is invalid or nothing was found.
+     * @see Geometry#filterInsidePolygon
+     * @see Geometry#filterInsideMultipolygon
+     * @since 15730
+     */
+    public static List<IPrimitive> filterInsideAnyPolygon(Collection<IPrimitive> primitives, IPrimitive polygon) {
+        if (polygon instanceof IWay<?>) {
+            return filterInsidePolygon(primitives, (IWay<?>) polygon);
+        } else if (polygon instanceof Relation && polygon.isMultipolygon()) {
+            return filterInsideMultipolygon(primitives, (Relation) polygon);
+        }
+        return Collections.emptyList();
+    }
+
+    /**
+     * Find all primitives in the given collection which are inside the given polygon.
      * Unclosed ways and multipolygon relations with unclosed outer rings are ignored.
+     *
      * @param primitives the primitives
      * @param polygon the polygon
      * @return a new list containing the found primitives, empty if polygon is invalid or nothing was found.
-     * @since 15069
-     */
-
-    public static List<IPrimitive> filterInsidePolygon(List<IPrimitive> primitives, IWay<?> polygon) {
+     * @since 15069 (for {@link List} of {@code primitives}, 15730 for a {@link Collection} of {@code primitives})
+     */
+    public static List<IPrimitive> filterInsidePolygon(Collection<IPrimitive> primitives, IWay<?> polygon) {
         List<IPrimitive> res = new ArrayList<>();
         if (!polygon.isClosed() || polygon.getNodesCount() <= 3)
