I'm currently studying the HTML5 drag and drop API on MDN and I'm interested in learning a bit more about how DataTransfer.effectAllowed is implemented in firefox and chrome browser.
Because the source code for both browsers are huge and it is a difficult task for someone unfamiliar with the source code to find exact what they are looking for, so I was just wondering whether anyone can share their experience/strategy in searching through their source code?
1 Answers
Answers 1
I'm not sure about Chrome, but I'll try with Mozilla Firefox. Even though it's huge, the Firefox codebase is searchable using two different engines: Searchfox and DXR. Both are great and have different pros/cons.
Searchfox:
- it's fast;
- it's easy to follow the code by looking up symbols/implementations and keep digging through the code from there.
DXR:
- is much more flexible;
- doesn't render RST files automatically (that's a pro to me :D).
Now, to your question, let's look up DataTranfer.effectAllowed
using searchfox.
- In the searchbox on the left, write `effectAllowed".
- This gives a bunch of stuff, JS and C++. The second result comes from
dom/events/DataTransfer.h
, which might be what you're looking for. - Let's restrict the search to
.cpp
files by writing*.cpp
in the box on the top right. - The second result will be from
dom/events/DataTransfer.cpp
which is exactly where the implementation lives. See here.
From there, depending on what you're looking for, you can keep investigating. I hope this helps :)
Update: steps for searching Chromium's source
Turns out Chromium has a similar service for searching through the code base. The steps are quite similar as well!
- Go to https://cs.chromium.org/ .
- Write
EffectAllowed
in the searchbox at the center of the page. - You'll be presented with a drop down with some results. Pick
setEffectAllowed (in blink::DataTransfer)
, the one with the.cc
implementation file. - Browse to here and have fun!
0 comments:
Post a Comment