layout/style/test/gtest/generate_example_stylesheet.py
author Kashav Madan <kshvmdn@gmail.com>
Sat, 31 Jul 2021 01:39:09 +0000
changeset 587301 e02e9a1e0b154758dba67fbb06dfc0440da9277f
parent 554551 994ae8e4833c90447d91f0e26a718573cff5a514
permissions -rw-r--r--
Bug 1718761 - Move {Start,Stop}ApzAutoscroll to CanonicalBrowsingContext, r=Gijs,hiro This accomplishes 2 things: 1. Allows us to directly fetch the layersId of the process that is autoscrolling, which avoids having to fetch it in AutoScrollChild and pass it around. This fixes autoscrolling out-of-process frames with Fission enabled. 2. Makes it easier to handle autoscrolling of in-process documents, since that can't happen through PBrowser. Differential Revision: https://phabricator.services.mozilla.com/D120766

def main(output, stylesheet):
    css = open(stylesheet, "r").read()
    css = (
        css.replace("\\", "\\\\")
        .replace("\r", "\\r")
        .replace("\n", "\\n")
        .replace('"', '\\"')
    )

    # Work around "error C2026: string too big"
    # https://msdn.microsoft.com/en-us/library/dddywwsc.aspx
    chunk_size = 10000
    chunks = ('"%s"' % css[i : i + chunk_size] for i in range(0, len(css), chunk_size))

    header = "#define EXAMPLE_STYLESHEET " + " ".join(chunks)
    output.write(header)