WP-2660: refactor borders with extend.