Having the codebase be as small as possible is a laudable goal - with browsers it is difficult since Web standards are fairly complex on their own, and being cross-platform brings along a lot of weirdness.
An important aspect of security is compartmentalization - for instance, using separate sandboxed processes for web content vs. the main UI (which runs with full user privileges).
Sandboxing is a good example here since it improves perf/stability/security but also adds to the size and complexity of the code.