refactoring webkit code