← Another post?
Available languages:
English

Firefox code memo

Table of Contents

I leave findings about the Firefox code here for future reference.

General

base points

flow

caveats / glossary

Rendering

base points

flow

basic flow

  1. Parse
  2. Style (Servo)
  1. Layout
  1. Rendering by WebRender

reference

frame lifecycle in Gecko

  1. created by nsCSSFrameConstructor.
  2. destroyed via nsIFrame::Destroy().

reference

code patterns

Variant Matching

https://searchfox.org/firefox-main/rev/fdd583cd5a10d051053acda8b760c3bd5d800034/gfx/layers/apz/util/APZTaskRunnable.cpp#23-51

auto requests = std::move(mPendingRequestQueue);
[...]
while (!requests.empty()) {
    struct RequestProcessor {
        GeckoContentController* mController;
        void operator()(const RepaintRequest& aRequest) {
            mController->RequestContentRepaint(aRequest);
        }
        void operator()(const APZStateChangeRequest& aRequest) {
            mController->NotifyAPZStateChange(aRequest.mGuid, aRequest.mChange,
                                                aRequest.mArg,
                                                aRequest.mInputBlockId);
        }
    };
    requests.front().match(RequestProcessor{controller.get()});
    requests.pop_front();
}

caveats / glossary

Servo

base points

flow

Who parses and styles?

  1. cssparser parses CSS.
  2. stylist does styling such as selector matching, cascade, and so on.

caveats / glossary

APZ

base points

flow

Rendering flow

See above.

How are scrolls happened on the APZ side reflected on the content process?

  1. APZ controller on the compositor thread calls RemoteContentController::RequestContentRepaint().
  2. Via IPC, that makes APZ child on the main thread put an early runner.
  3. The early runner is processed at the beginning of nsRefreshDriver::Tick(), which is almost equivalent to "update the rendering".
  4. The early runner eventually calls ScrollContainerFrame::ScrollToImpl() and it sets the received APZ scroll info to ScrollContainerFrame::mApzScrollPos.

caveats / glossary

IPDL

base points

flow

caveats / glossary

← Another post?