Hacker News new | ask | show | jobs
by Centigonal 1156 days ago
Dumb question: if CSS is under-specified and everyone designs their sites for Chrome, could we analyze Chromium's CSS rendering code and use that to create a more well-defined CSS spec which other browsers can implement?
5 comments

Perl was in exactly that situation many years ago. The specification for Perl 5.x was `perl` itself; if `perl` was found to conflict with the spec, sometimes the spec would change.

It was a nightmare, and part of the reason (I believe) that Perl 6 got so over-specified. It meant you couldn’t count on the spec, that you never knew if something was a bug or intended behavior.

HTML4 was in a similar situation. Microsoft and Netscape developed competing variations of under-specified features, leading to a decade of the worst Dark Ages for web development.

So if we use Chromium’s CSS engine, then either (a) Google now controls a fundamental part of the web (and there’s no evidence that they’ll behave in any sort of responsible manner), or (b) we now have the same specification problem.

Getting complex code and specs to agree 100% is a Hard Problem, unsolved almost everywhere. Giving more power to Google won’t help.

For a while while Google had a minority and everyone was still targeting IE instead of the standard, they would detect that and take a different rendering path even if it meant preserving broken behavior. At the same time they tried to fix/improve the spec and wage a publicity campaign against Microsoft for not following standards.

While that’s not necessarily a capability a smaller not well funded browser might have, certainly they have lots of forums to advertise “hey Google is doing this incorrect thing, this is how we detect existing sites relying on that buggy behavior, and this is how you fix it”. You could even show a banner while browsing “standard confirming vs not”. You leave that banner out for places the standard is underspecified to be fair and reinstitute it once you’ve got it clarified, assuming websites are still relying on those nonstandard paths / Chrome isn’t addressing the behavior.

That being said, it’s no surprise this is the situation when all commercial investment into browser tech is by commercial companies giving it away for free. Think about the hundreds of millions of dollars being pored in. That’s not out of the goodness of their heart and it’s going to be difficult to impossible for anyone else to compete.

For what it’s worth I think a huge regulatory improvement to monopoly laws would be an anti-dumping provisions for software. You’re not allowed to sell something below what it costs you to make (including accounting for R&D) and the only person’s effort your allowed to 0-rate is your own and any unpaid volunteers you convince to join you. It would mean that browsers would now cost actual money that could fund third party efforts (ie if my budget for browsers is X then maybe I want to invest in a browser that treats me better). Of course the challenge with this model is that it makes it hard to actually enforce. Are you giving a feature away for free or are you improving an existing product and it’s part of that overall cost? How do you budget recurring revenues for products that want to amortize the cost over periodic payments instead of upfront ones? Etc etc. I don’t necessarily know what the answers are. There may be none. But certainly Google’s control of the web comes from the fact that they’re poring in huge amounts of money to maintain a controlling interest over the thing that enables a good chunk of their revenue stream. It’s not as important to Apple and we see them not investing as heavily (it’s important for the product but it’s not intrinsically strategically as key hence the historic neglect). Same goes to Microsoft which ceded its spot in the internet ecosystem to Google back in the day.

Anyway, what I’m trying to say is that Google’s control won’t weaken because you cede to duplicate their particular implementation. Their control weakens when you can take away their market share and for a smaller entrant you want to replicate as much behavior verbatim as possible to lower friction for users. It doesn’t matter what the spec says. Aggressively prioritize what is important to customers and serve the market where Google is incapable of doing it. For example, memory usage is a trivial one to get them on. They’ve lost control of that beast and can’t figure out how to get better. Clobber them in the head over that failure. They can’t handle many simultaneous tabs. Make your browser work smoothly and without crashing or using terabytes of memory even if it’s handling 100k tabs. If I were to take on that endeavor, that’s how I would take on Google (and no, I wouldn’t use Blink as a starting point because you’re just picking up all the tech debt and you’re not going to do a better job than Google at trying to shovel shit away - you need to start greenfield like Chrome did and firefox and opera did for a time when they showed what a performance hog IE was and how it didn’t even have valuable features that people cares about). Similarly, ship the browser with adblock and actively fight websites that waste resources. Prioritize aggressively the user’s health and digital well being (meaningful privacy improvements by closing as many side channel data gathering techniques as possible) and respect the well being of the machine you’re running on.

>you need to start greenfield like Chrome

Chrome wasn't entirely greenfield. The rendering engine is a fork of webkit's.

Which was forked from KDE I think?
yep - KHTML!
tl;dr
The issue with this approach is that it would encode all the bugs and quirks into the specification which isn't a good idea.

(I'm an engineer on Blink's layout engine).

We've recently finished re-architecting Blink's layout engine, part of the reason why we did this investment was we were concerned that we couldn't fix WebKit era bugs (e.g. too many sites would depend on them due to our shared heritage). This makes other engines jobs (e.g. Gecko) super difficult as they'd need to encode even more quirks than they have time for.

I think we've broadly mitigated a large part of that risk. There are still large parts of CSS which are underspecified, e.g. tables/block/float layout. But its slowly getting better.

And this is kind of a huge deal. 3 different implementations rather than 2 is kind of like the old saying "never go to sea with two chronometers, take one or three".

I'm not saying Blink exactly matched WebKit anymore, before your re-architecture. But it shared a lot.

If you have a difference in behavior between 2 implementations, then it's easy to see think of it as saying one or the other is right. And which one is right will be partly influenced by the amount of exposure the feature has had, multiplied by market share. Which is not a great criterion to use if you want a spec that hangs together, especially if a reimagining like Servo is going to come along and rub against the grain of every arbitrary decision ever made.

Is CSS under-specified? when I've been curious about some thing, there has been a pretty detailed spec. There are differences in behavior on newer things as things get worked out, but I feel like so much is due to actual bugs relative to the spec than the spec itself.

Is there an example of under-specification that sticks around in practice?

That’s basically what’s happening, chrome implements something, it gets put into the standard, some others choose to implement or not.
In many cases has already happened (although most of it was written when IE, Firefox and Opera were the browsers to align with and Chrome just implemented the spec). There are bits that are still underspecified, but work is already ongoing to specify those.