diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 2fa7444d8ed..6d026141496 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -2,9 +2,6 @@ name: Linux workflow on: workflow_call: inputs: - layout: - required: true - type: string wpt: required: false type: string @@ -21,10 +18,6 @@ on: type: string workflow_dispatch: inputs: - layout: - required: true - type: choice - options: ["2013", "2020"] wpt: default: "test" required: false @@ -44,8 +37,6 @@ on: env: RUST_BACKTRACE: 1 SHELL: /bin/bash - LAYOUT: "${{ (contains(inputs.layout, '2020') || github.ref_name == 'try-wpt-2020') && 'layout-2020' || 'layout-2013' }}" - PACKAGE: "${{ (contains(inputs.layout, '2020') || github.ref_name == 'try-wpt-2020') && 'linux-layout2020' || 'linux' }}" SCCACHE_GHA_ENABLED: "true" RUSTC_WRAPPER: "sccache" CCACHE: "sccache" @@ -72,22 +63,22 @@ jobs: - name: Tidy run: python3 ./mach test-tidy --no-progress --all - name: Release build - run: python3 ./mach build --release --with-${{ env.LAYOUT }} + run: python3 ./mach build --release - name: Smoketest run: xvfb-run python3 ./mach smoketest - name: Script tests run: ./mach test-scripts - name: Unit tests if: ${{ inputs.unit-tests || github.ref_name == 'try-linux' }} - run: python3 ./mach test-unit --release --with-${{ env.LAYOUT }} + run: python3 ./mach test-unit --release - name: Rename build timing - run: cp -r target/cargo-timings target/cargo-timings-linux-${{ env.LAYOUT }} + run: cp -r target/cargo-timings target/cargo-timings-linux - name: Archive build timing uses: actions/upload-artifact@v3 with: name: cargo-timings # Using a wildcard here ensures that the archive includes the path. - path: target/cargo-timings-*-${{ env.LAYOUT }} + path: target/cargo-timings-* - name: Lockfile check run: ./etc/ci/lockfile_changed.sh - name: Package @@ -95,12 +86,12 @@ jobs: - name: Upload Package uses: actions/upload-artifact@v3 with: - name: ${{ env.PACKAGE }} + name: linux path: target/release/servo-tech-demo.tar.gz - name: Upload if: ${{ inputs.upload }} run: | - python3 ./mach upload-nightly ${{ env.PACKAGE }} \ + python3 ./mach upload-nightly linux \ --secret-from-environment \ --github-release-id ${{ inputs.github-release-id }} env: @@ -112,7 +103,7 @@ jobs: - name: Archive binary uses: actions/upload-artifact@v3 with: - name: ${{ env.LAYOUT }}-release-binary + name: release-binary path: target.tar.gz linux-wpt: @@ -125,6 +116,7 @@ jobs: strategy: fail-fast: false matrix: + layout: ["layout-2020", "layout-2013"] chunk_id: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20] steps: - uses: actions/checkout@v3 @@ -132,7 +124,7 @@ jobs: fetch-depth: 2 - uses: actions/download-artifact@v3 with: - name: ${{ env.LAYOUT }}-release-binary + name: release-binary path: release-binary - name: unPackage binary run: tar -xzf release-binary/target.tar.gz @@ -151,45 +143,43 @@ jobs: - name: Run tests if: ${{ inputs.wpt != 'sync' }} run: | - python3 ./mach test-wpt --with-${{ env.LAYOUT }} \ + python3 ./mach test-wpt --with-${{ matrix.layout }} \ --release --processes $(nproc) --timeout-multiplier 2 \ --total-chunks ${{ env.max_chunk_id }} --this-chunk ${{ matrix.chunk_id }} \ - --log-raw test-wpt.${{ matrix.chunk_id }}.log \ - --log-raw-unexpected unexpected-test-wpt.${{ matrix.chunk_id }}.log \ - --filter-intermittents filtered-test-wpt.${{ matrix.chunk_id }}.json + --log-raw test-wpt-${{ matrix.layout }}.${{ matrix.chunk_id }}.log \ + --log-raw-unexpected unexpected-test-wpt-${{ matrix.layout }}.${{ matrix.chunk_id }}.log \ + --filter-intermittents filtered-test-wpt-${{ matrix.layout }}.${{ matrix.chunk_id }}.json env: GITHUB_CONTEXT: ${{ toJson(github) }} INTERMITTENT_TRACKER_DASHBOARD_SECRET: ${{ secrets.INTERMITTENT_TRACKER_DASHBOARD_SECRET }} - name: Run tests (sync) if: ${{ inputs.wpt == 'sync' }} run: | - python3 ./mach test-wpt --with-${{ env.LAYOUT }} \ + python3 ./mach test-wpt --with-${{ matrix.layout }} \ --release --processes $(nproc) --timeout-multiplier 2 \ --total-chunks ${{ env.max_chunk_id }} --this-chunk ${{ matrix.chunk_id }} \ --log-raw test-wpt.${{ matrix.chunk_id }}.log \ - --log-servojson wpt-jsonsummary.${{ matrix.chunk_id }}.log \ --always-succeed - name: Archive filtered results uses: actions/upload-artifact@v3 if: ${{ always() && inputs.wpt != 'sync' }} with: - name: wpt-filtered-results-linux-${{ env.LAYOUT }} + name: wpt-filtered-results-linux path: | - filtered-test-wpt.${{ matrix.chunk_id }}.json - unexpected-test-wpt.${{ matrix.chunk_id }}.log + filtered-test-wpt-${{ matrix.layout }}.${{ matrix.chunk_id }}.json + unexpected-test-wpt-${{ matrix.layout }}.${{ matrix.chunk_id }}.log - name: Archive logs uses: actions/upload-artifact@v3 if: ${{ failure() && inputs.wpt != 'sync' }} with: - name: wpt-logs-linux-${{ env.LAYOUT }} + name: wpt-logs-linux path: | - test-wpt.${{ matrix.chunk_id }}.log - filtered-wpt-results.${{ matrix.chunk_id }}.json + test-wpt-${{ matrix.layout }}.${{ matrix.chunk_id }}.log - name: Archive logs uses: actions/upload-artifact@v3 if: ${{ inputs.wpt == 'sync' }} with: - name: wpt-logs-linux-${{ env.LAYOUT }} + name: wpt-logs-linux-${{ matrix.layout }} path: | test-wpt.${{ matrix.chunk_id }}.log wpt-jsonsummary.${{ matrix.chunk_id }}.log @@ -206,18 +196,23 @@ jobs: fetch-depth: 2 - uses: actions/download-artifact@v3 with: - name: wpt-filtered-results-linux-${{ env.LAYOUT }} + name: wpt-filtered-results-linux path: wpt-filtered-results-linux - name: Create aggregated unexpected results - run: cat wpt-filtered-results-linux/*.log > unexpected-test-wpt.log + run: | + cat wpt-filtered-results-linux/*-layout-2020.*.log > unexpected-test-wpt-layout-2020.log + cat wpt-filtered-results-linux/*-layout-2013.*.log > unexpected-test-wpt-layout-2013.log - name: Archive aggregate results uses: actions/upload-artifact@v3 with: - name: wpt-filtered-results-linux-${{ env.LAYOUT }} + name: wpt-filtered-results-linux path: | - unexpected-test-wpt.log + unexpected-test-wpt-layout-2020.log + unexpected-test-wpt-layout-2013.log - name: Comment on PR with results - run: etc/ci/report_aggregated_expected_results.py --tag="linux-wpt-${{ env.LAYOUT }}" wpt-filtered-results-linux/*.json + run: | + etc/ci/report_aggregated_expected_results.py --tag="linux-wpt-2020" wpt-filtered-results-linux/*-layout-2020.*.json + etc/ci/report_aggregated_expected_results.py --tag="linux-wpt-2013" wpt-filtered-results-linux/*-layout-2013.*.json env: GITHUB_CONTEXT: ${{ toJson(github) }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/mac.yml b/.github/workflows/mac.yml index 030900050e5..28d8cef1a84 100644 --- a/.github/workflows/mac.yml +++ b/.github/workflows/mac.yml @@ -3,9 +3,6 @@ name: Mac workflow on: workflow_call: inputs: - layout: - required: true - type: string unit-tests: required: false default: false @@ -19,10 +16,6 @@ on: type: string workflow_dispatch: inputs: - layout: - required: true - type: choice - options: ["2013", "2020"] unit-tests: required: false default: false @@ -37,8 +30,6 @@ on: env: RUST_BACKTRACE: 1 SHELL: /bin/bash - LAYOUT: "${{ contains(inputs.layout, '2020') && 'layout-2020' || 'layout-2013' }}" - PACKAGE: "${{ contains(inputs.layout, '2020') && 'mac-layout2020' || 'mac' }}" SCCACHE_GHA_ENABLED: "true" RUSTC_WRAPPER: "sccache" CCACHE: "sccache" @@ -60,35 +51,35 @@ jobs: python3 ./mach bootstrap - name: Release build run: | - python3 ./mach build --release --with-${{ env.LAYOUT }} + python3 ./mach build --release - name: Smoketest run: python3 ./mach smoketest - name: Script tests run: ./mach test-scripts - name: Unit tests if: ${{ inputs.unit-tests || github.ref_name == 'try-mac' }} - run: python3 ./mach test-unit --release --with-${{ env.LAYOUT }} + run: python3 ./mach test-unit --release - name: Package run: python3 ./mach package --release - name: Package smoketest run: ./etc/ci/macos_package_smoketest.sh target/release/servo-tech-demo.dmg - name: Rename build timing - run: cp -r target/cargo-timings target/cargo-timings-macos-${{ env.LAYOUT }} + run: cp -r target/cargo-timings target/cargo-timings-macos - name: Archive build timing uses: actions/upload-artifact@v3 with: name: cargo-timings # Using a wildcard here ensures that the archive includes the path. - path: target/cargo-timings-*-${{ env.LAYOUT }} + path: target/cargo-timings-* - name: Upload package uses: actions/upload-artifact@v3 with: - name: ${{ env.PACKAGE }} + name: mac path: target/release/servo-tech-demo.dmg - name: Upload if: ${{ inputs.upload }} run: | - python3 ./mach upload-nightly ${{ env.PACKAGE }} --secret-from-environment \ + python3 ./mach upload-nightly mac --secret-from-environment \ --github-release-id ${{ inputs.github-release-id }} env: S3_UPLOAD_CREDENTIALS: ${{ secrets.S3_UPLOAD_CREDENTIALS }} @@ -100,7 +91,7 @@ jobs: - name: Archive binary uses: actions/upload-artifact@v3 with: - name: release-${{ env.LAYOUT }}-binary-macos + name: release-binary-macos path: target.tar.gz # mac-wpt: diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 7905f2fbcfb..68995f38f09 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -38,7 +38,6 @@ jobs: needs: ["decision"] uses: ./.github/workflows/windows.yml with: - layout: '2013' unit-tests: true build-mac: @@ -46,7 +45,6 @@ jobs: needs: ["decision"] uses: ./.github/workflows/mac.yml with: - layout: '2013' unit-tests: true build-linux: @@ -54,16 +52,6 @@ jobs: needs: ["decision"] uses: ./.github/workflows/linux.yml with: - layout: '2013' - wpt: 'test' - unit-tests: true - - build-linux-layout-2020: - name: Linux (layout-2020) - needs: ["decision"] - uses: ./.github/workflows/linux.yml - with: - layout: '2020' wpt: 'test' unit-tests: true @@ -77,7 +65,6 @@ jobs: - "build-win" - "build-mac" - "build-linux" - - "build-linux-layout-2020" steps: - name: Mark the job as successful diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 15ad5407771..f210d320d87 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -59,11 +59,8 @@ jobs: needs: - create-draft-release - upload-linux - - upload-linux-2013 - upload-win - - upload-win-2013 - upload-mac - - upload-mac-2013 upload-win: # This job is only useful when run on upstream servo. @@ -73,20 +70,6 @@ jobs: - create-draft-release uses: ./.github/workflows/windows.yml with: - layout: '2020' - upload: true - github-release-id: ${{ needs.create-draft-release.outputs.release-id }} - secrets: inherit - - upload-win-2013: - # This job is only useful when run on upstream servo. - if: github.repository == 'servo/servo' || github.event_name == 'workflow_dispatch' - name: Upload nightly (Windows layout-2013) - needs: - - create-draft-release - uses: ./.github/workflows/windows.yml - with: - layout: '2013' upload: true github-release-id: ${{ needs.create-draft-release.outputs.release-id }} secrets: inherit @@ -99,20 +82,6 @@ jobs: - create-draft-release uses: ./.github/workflows/mac.yml with: - layout: '2020' - upload: true - github-release-id: ${{ needs.create-draft-release.outputs.release-id }} - secrets: inherit - - upload-mac-2013: - # This job is only useful when run on upstream servo. - if: github.repository == 'servo/servo' || github.event_name == 'workflow_dispatch' - name: Upload nightly (macOS layout-2013) - needs: - - create-draft-release - uses: ./.github/workflows/mac.yml - with: - layout: '2013' upload: true github-release-id: ${{ needs.create-draft-release.outputs.release-id }} secrets: inherit @@ -125,20 +94,6 @@ jobs: - create-draft-release uses: ./.github/workflows/linux.yml with: - layout: '2020' upload: true github-release-id: ${{ needs.create-draft-release.outputs.release-id }} - secrets: inherit - - upload-linux-2013: - # This job is only useful when run on upstream servo. - if: github.repository == 'servo/servo' || github.event_name == 'workflow_dispatch' - name: Upload nightly (Linux layout-2013) - needs: - - create-draft-release - uses: ./.github/workflows/linux.yml - with: - layout: '2013' - upload: true - github-release-id: ${{ needs.create-draft-release.outputs.release-id }} - secrets: inherit + secrets: inherit \ No newline at end of file diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index ab8f64ed687..bbd66dd7f30 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -11,13 +11,4 @@ jobs: if: github.repository == 'servo/servo' uses: ./.github/workflows/linux.yml with: - layout: '2013' - unit-tests: true - - build-linux-layout-2020: - name: Linux (layout-2020) - if: github.repository == 'servo/servo' - uses: ./.github/workflows/linux.yml - with: - layout: '2020' - unit-tests: false \ No newline at end of file + unit-tests: true \ No newline at end of file diff --git a/.github/workflows/quick-check.yml b/.github/workflows/quick-check.yml index 0c48233c83d..e7fbc28d239 100644 --- a/.github/workflows/quick-check.yml +++ b/.github/workflows/quick-check.yml @@ -13,14 +13,4 @@ jobs: if: github.repository != 'servo/servo' || github.event_name == 'workflow_dispatch' uses: ./.github/workflows/linux.yml with: - layout: '2013' - unit-tests: true - - build-linux-layout-2020: - name: Linux (layout-2020) - if: github.repository != 'servo/servo' || github.event_name == 'workflow_dispatch' - uses: ./.github/workflows/linux.yml - with: - layout: '2020' - # TODO: unit tests on layout-2020 - unit-tests: false + unit-tests: true \ No newline at end of file diff --git a/.github/workflows/scheduled-wpt-import.yml b/.github/workflows/scheduled-wpt-import.yml index 49bdda984e7..f60d9eec460 100644 --- a/.github/workflows/scheduled-wpt-import.yml +++ b/.github/workflows/scheduled-wpt-import.yml @@ -15,17 +15,6 @@ jobs: name: Linux uses: ./.github/workflows/linux.yml with: - layout: '2013' - wpt: 'sync' - unit-tests: false - - linux-layout-2020: - # This job is only useful when run on upstream servo. - if: github.repository == 'servo/servo' || github.event_name == 'workflow_dispatch' - name: Linux (layout-2020) - uses: ./.github/workflows/linux.yml - with: - layout: '2020' wpt: 'sync' unit-tests: false @@ -36,7 +25,6 @@ jobs: runs-on: ubuntu-latest needs: - "linux" - - "linux-layout-2020" steps: - name: Checkout code uses: actions/checkout@v3 diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 5702efeb0c7..ce7c96fb603 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -3,9 +3,6 @@ name: Windows workflow on: workflow_call: inputs: - layout: - required: true - type: string unit-tests: required: false default: false @@ -19,10 +16,6 @@ on: type: string workflow_dispatch: inputs: - layout: - required: true - type: choice - options: ["2013", "2020"] unit-tests: required: false default: false @@ -37,8 +30,6 @@ on: env: RUST_BACKTRACE: 1 SHELL: /bin/bash - LAYOUT: "${{ contains(inputs.layout, '2020') && 'layout-2020' || 'layout-2013' }}" - PACKAGE: "${{ contains(inputs.layout, '2020') && 'windows-msvc-layout2020' || 'windows-msvc' }}" CCACHE: "ccache" CARGO_TARGET_DIR: C:\\a\\servo\\servo\\target @@ -64,28 +55,28 @@ jobs: python mach fetch python mach bootstrap-gstreamer - name: Release build - run: python mach build --release --with-${{ env.LAYOUT }} + run: python mach build --release - name: Copy resources run: cp D:\a\servo\servo\resources C:\a\servo\servo -Recurse - name: Smoketest run: python mach smoketest --angle - name: Unit tests if: ${{ inputs.unit-tests || github.ref_name == 'try-windows' }} - run: python mach test-unit --release --with-${{ env.LAYOUT }} + run: python mach test-unit --release - name: Rename build timing - run: cp C:\a\servo\servo\target\cargo-timings C:\a\servo\servo\target\cargo-timings-windows-${{ env.LAYOUT }} -Recurse + run: cp C:\a\servo\servo\target\cargo-timings C:\a\servo\servo\target\cargo-timings-windows -Recurse - name: Archive build timing uses: actions/upload-artifact@v3 with: name: cargo-timings # Using a wildcard here ensures that the archive includes the path. - path: target/cargo-timings-*-${{ env.LAYOUT }} + path: target/cargo-timings-* - name: Package run: python mach package --release - name: Upload Package uses: actions/upload-artifact@v3 with: - name: ${{ env.PACKAGE }} + name: win # These files are available # MSI Installer: C:\a\servo\servo\target\release\msi\Installer.msi # Bundle: C:\a\servo\servo\target\release\msi\Servo.exe @@ -94,7 +85,7 @@ jobs: - name: Upload if: ${{ inputs.upload }} run: | - python mach upload-nightly ${{ env.PACKAGE }} --secret-from-environment ` + python mach upload-nightly win --secret-from-environment ` --github-release-id ${{ inputs.github-release-id }} env: S3_UPLOAD_CREDENTIALS: ${{ secrets.S3_UPLOAD_CREDENTIALS }} diff --git a/components/config/opts.rs b/components/config/opts.rs index 793f9a85566..7e36c6b4fab 100644 --- a/components/config/opts.rs +++ b/components/config/opts.rs @@ -27,6 +27,9 @@ pub struct Opts { /// The initial URL to load. pub url: Option, + /// Whether or not the legacy layout system is enabled. + pub legacy_layout: bool, + /// The maximum size of each tile in pixels (`-s`). pub tile_size: usize, @@ -376,6 +379,7 @@ pub fn default_opts() -> Opts { Opts { is_running_problem_test: false, url: None, + legacy_layout: false, tile_size: 512, time_profiling: None, time_profiler_trace_path: None, @@ -410,6 +414,7 @@ pub fn default_opts() -> Opts { pub fn from_cmdline_args(mut opts: Options, args: &[String]) -> ArgumentParsingResult { let (app_name, args) = args.split_first().unwrap(); + opts.optflag("", "legacy-layout", "Use the legacy layout engine"); opts.optflag("c", "cpu", "CPU painting"); opts.optflag("g", "gpu", "GPU painting"); opts.optopt("o", "output", "Output file", "output.png"); @@ -731,10 +736,17 @@ pub fn from_cmdline_args(mut opts: Options, args: &[String]) -> ArgumentParsingR let is_printing_version = opt_match.opt_present("v") || opt_match.opt_present("version"); + let legacy_layout = opt_match.opt_present("legacy-layout"); + if legacy_layout { + set_pref!(layout.legacy_layout, true); + set_pref!(layout.flexbox.enabled, true); + } + let opts = Opts { debug: debug_options.clone(), is_running_problem_test, url: url_opt, + legacy_layout, tile_size, time_profiling, time_profiler_trace_path: opt_match.opt_str("profiler-trace-path"), diff --git a/components/config/prefs.rs b/components/config/prefs.rs index 7d97cbd6c19..82f3884bf70 100644 --- a/components/config/prefs.rs +++ b/components/config/prefs.rs @@ -440,6 +440,7 @@ mod gen { flexbox: { enabled: bool, }, + legacy_layout: bool, #[serde(default = "default_layout_threads")] threads: i64, writing_mode: { diff --git a/components/layout/Cargo.toml b/components/layout/Cargo.toml index c73e56e186c..d11f508c502 100644 --- a/components/layout/Cargo.toml +++ b/components/layout/Cargo.toml @@ -7,7 +7,7 @@ edition = "2018" publish = false [lib] -name = "layout" +name = "layout_2013" path = "lib.rs" test = false doctest = false @@ -45,7 +45,7 @@ servo_config = { path = "../config" } servo_geometry = { path = "../geometry" } servo_url = { path = "../url" } smallvec = { workspace = true, features = ["union"] } -style = { path = "../style", features = ["servo", "servo-layout-2013"] } +style = { path = "../style", features = ["servo"] } style_traits = { path = "../style_traits" } unicode-bidi = { workspace = true, features = ["with_serde"] } unicode-script = { workspace = true } diff --git a/components/layout/tests/size_of.rs b/components/layout/tests/size_of.rs index 74314a38cae..dec10937177 100644 --- a/components/layout/tests/size_of.rs +++ b/components/layout/tests/size_of.rs @@ -7,8 +7,8 @@ #[macro_use] extern crate size_of_test; -use layout::Fragment; -use layout::SpecificFragmentInfo; +use layout_2013::Fragment; +use layout_2013::SpecificFragmentInfo; #[cfg(debug_assertions)] size_of_test!(test_size_of_fragment, Fragment, 176); diff --git a/components/layout_2020/Cargo.toml b/components/layout_2020/Cargo.toml index ca7ca77bfe3..64e46b3ff2f 100644 --- a/components/layout_2020/Cargo.toml +++ b/components/layout_2020/Cargo.toml @@ -7,7 +7,7 @@ edition = "2018" publish = false [lib] -name = "layout" +name = "layout_2020" path = "lib.rs" test = false doctest = false @@ -41,7 +41,7 @@ serde = { workspace = true } serde_json = { workspace = true } servo_arc = { path = "../servo_arc" } servo_url = { path = "../url" } -style = { path = "../style", features = ["servo", "servo-layout-2020"] } +style = { path = "../style", features = ["servo"] } style_traits = { path = "../style_traits" } unicode-script = { workspace = true } webrender_api = { workspace = true } diff --git a/components/layout_2020/display_list/mod.rs b/components/layout_2020/display_list/mod.rs index 2103d62bb09..b06308a4e84 100644 --- a/components/layout_2020/display_list/mod.rs +++ b/components/layout_2020/display_list/mod.rs @@ -638,6 +638,9 @@ impl<'a> BuilderForBoxFragment<'a> { } } }, + Image::PaintWorklet(_) => { + // TODO: Add support for PaintWorklet rendering. + }, // Gecko-only value, represented as a (boxed) empty enum on non-Gecko. Image::Rect(ref rect) => match **rect {}, Image::ImageSet(..) | Image::CrossFade(..) => { diff --git a/components/layout_2020/dom_traversal.rs b/components/layout_2020/dom_traversal.rs index 7b619dacf45..711aca27d64 100644 --- a/components/layout_2020/dom_traversal.rs +++ b/components/layout_2020/dom_traversal.rs @@ -361,6 +361,14 @@ where vec.push(PseudoElementContentItem::Replaced(replaced_content)); } }, + ContentItem::Counter(_, _) | + ContentItem::Counters(_, _, _) | + ContentItem::OpenQuote | + ContentItem::CloseQuote | + ContentItem::NoOpenQuote | + ContentItem::NoCloseQuote => { + // TODO: Add support for counters and quotes. + }, } } vec diff --git a/components/layout_2020/flow/inline.rs b/components/layout_2020/flow/inline.rs index 045d5aaceba..c274e615042 100644 --- a/components/layout_2020/flow/inline.rs +++ b/components/layout_2020/flow/inline.rs @@ -473,6 +473,16 @@ impl Lines { TextAlign::Start } }, + TextAlignKeyword::Justify => { + // TODO: Add support for justfied text. + TextAlign::Start + }, + TextAlignKeyword::ServoCenter | + TextAlignKeyword::ServoLeft | + TextAlignKeyword::ServoRight => { + // TODO: Implement these modes which seem to be used by quirks mode. + TextAlign::Start + }, }; let move_by = match text_align { TextAlign::Start => Length::zero(), diff --git a/components/layout_2020/lists.rs b/components/layout_2020/lists.rs index e24bc9d542d..c58f28b06a8 100644 --- a/components/layout_2020/lists.rs +++ b/components/layout_2020/lists.rs @@ -33,6 +33,7 @@ where Image::Rect(..) | Image::Gradient(..) | Image::CrossFade(..) | + Image::PaintWorklet(..) | Image::None => None, }; marker_image().or_else(|| { @@ -44,7 +45,6 @@ where /// https://drafts.csswg.org/css-lists/#marker-string fn marker_string(style: &style_structs::List) -> Option<&'static str> { - // FIXME: add support for counters and other style types match style.list_style_type { ListStyleType::None => None, ListStyleType::Disc => Some("• "), @@ -52,5 +52,36 @@ fn marker_string(style: &style_structs::List) -> Option<&'static str> { ListStyleType::Square => Some("▪ "), ListStyleType::DisclosureOpen => Some("▾ "), ListStyleType::DisclosureClosed => Some("‣ "), + ListStyleType::Decimal | + ListStyleType::LowerAlpha | + ListStyleType::UpperAlpha | + ListStyleType::ArabicIndic | + ListStyleType::Bengali | + ListStyleType::Cambodian | + ListStyleType::CjkDecimal | + ListStyleType::Devanagari | + ListStyleType::Gujarati | + ListStyleType::Gurmukhi | + ListStyleType::Kannada | + ListStyleType::Khmer | + ListStyleType::Lao | + ListStyleType::Malayalam | + ListStyleType::Mongolian | + ListStyleType::Myanmar | + ListStyleType::Oriya | + ListStyleType::Persian | + ListStyleType::Telugu | + ListStyleType::Thai | + ListStyleType::Tibetan | + ListStyleType::CjkEarthlyBranch | + ListStyleType::CjkHeavenlyStem | + ListStyleType::LowerGreek | + ListStyleType::Hiragana | + ListStyleType::HiraganaIroha | + ListStyleType::Katakana | + ListStyleType::KatakanaIroha => { + // TODO: Implement support for counters. + None + }, } } diff --git a/components/layout_2020/positioned.rs b/components/layout_2020/positioned.rs index 666bd69c8af..65492a1afa3 100644 --- a/components/layout_2020/positioned.rs +++ b/components/layout_2020/positioned.rs @@ -290,7 +290,7 @@ impl PositioningContext { match position { Position::Fixed => {}, // fall through Position::Absolute => return nearest.push(box_), - Position::Static | Position::Relative => unreachable!(), + Position::Static | Position::Relative | Position::Sticky => unreachable!(), } } self.for_nearest_containing_block_for_all_descendants diff --git a/components/layout_2020/query.rs b/components/layout_2020/query.rs index ed5e7f1b54c..d766709f6f8 100644 --- a/components/layout_2020/query.rs +++ b/components/layout_2020/query.rs @@ -492,8 +492,9 @@ fn process_offset_parent_query_inner( // TODO: Handle case 2 (true, _) | (false, Position::Absolute) | + (false, Position::Fixed) | (false, Position::Relative) | - (false, Position::Fixed) => true, + (false, Position::Sticky) => true, // Otherwise, it's not a valid parent (false, Position::Static) => false, diff --git a/components/layout_2020/style_ext.rs b/components/layout_2020/style_ext.rs index 636ba0ab728..e242863ac6f 100644 --- a/components/layout_2020/style_ext.rs +++ b/components/layout_2020/style_ext.rs @@ -497,6 +497,18 @@ impl From for Display { // These should not be values of DisplayInside, but oh well stylo::DisplayInside::None => return Display::None, stylo::DisplayInside::Contents => return Display::Contents, + + // TODO: Implement support for tables. + stylo::DisplayInside::Table | + stylo::DisplayInside::TableRowGroup | + stylo::DisplayInside::TableColumn | + stylo::DisplayInside::TableColumnGroup | + stylo::DisplayInside::TableHeaderGroup | + stylo::DisplayInside::TableFooterGroup | + stylo::DisplayInside::TableRow | + stylo::DisplayInside::TableCell => DisplayInside::Flow { + is_list_item: packed.is_list_item(), + }, }; let outside = match packed.outside() { stylo::DisplayOutside::Block => DisplayOutside::Block, @@ -504,6 +516,11 @@ impl From for Display { // This should not be a value of DisplayInside, but oh well stylo::DisplayOutside::None => return Display::None, + + // TODO: Implement support for tables. + stylo::DisplayOutside::TableCaption | stylo::DisplayOutside::InternalTable => { + DisplayOutside::Block + }, }; Display::GeneratingBox(DisplayGeneratingBox::OutsideInside { outside, inside }) } diff --git a/components/layout_thread/Cargo.toml b/components/layout_thread/Cargo.toml index 9f9dbee4d1f..52a5f7919ef 100644 --- a/components/layout_thread/Cargo.toml +++ b/components/layout_thread/Cargo.toml @@ -7,7 +7,7 @@ edition = "2018" publish = false [lib] -name = "layout_thread" +name = "layout_thread_2013" path = "lib.rs" [dependencies] diff --git a/components/layout_thread_2020/Cargo.toml b/components/layout_thread_2020/Cargo.toml index e94ece4f934..e88a258858c 100644 --- a/components/layout_thread_2020/Cargo.toml +++ b/components/layout_thread_2020/Cargo.toml @@ -7,7 +7,7 @@ edition = "2018" publish = false [lib] -name = "layout_thread" +name = "layout_thread_2020" path = "lib.rs" [dependencies] diff --git a/components/servo/Cargo.toml b/components/servo/Cargo.toml index 4e4b8da58d3..15c20d20979 100644 --- a/components/servo/Cargo.toml +++ b/components/servo/Cargo.toml @@ -16,8 +16,6 @@ debugmozjs = ["script/debugmozjs"] googlevr = ["webxr/googlevr"] jitspew = ["script/jitspew"] js_backtrace = ["script/js_backtrace"] -layout-2013 = ["layout_thread_2013"] -layout-2020 = ["layout_thread_2020"] max_log_level = ["log/release_max_level_info"] media-dummy = ["servo-media-dummy"] media-gstreamer = ["servo-media-gstreamer", "gstreamer"] @@ -55,8 +53,8 @@ gleam = { workspace = true } gstreamer = { version = "0.15", features = ["v1_16"], optional = true } ipc-channel = { workspace = true } keyboard-types = { workspace = true } -layout_thread_2013 = { path = "../layout_thread", optional = true } -layout_thread_2020 = { path = "../layout_thread_2020", optional = true } +layout_thread_2013 = { path = "../layout_thread" } +layout_thread_2020 = { path = "../layout_thread_2020" } log = { workspace = true } media = { path = "../media" } mozangle = { workspace = true } diff --git a/components/servo/build.rs b/components/servo/build.rs index 936ed712dc6..278afb641eb 100644 --- a/components/servo/build.rs +++ b/components/servo/build.rs @@ -8,16 +8,6 @@ use std::path::Path; use std::process::Command; fn main() { - let layout_2013 = std::env::var_os("CARGO_FEATURE_LAYOUT_2013").is_some(); - let layout_2020 = std::env::var_os("CARGO_FEATURE_LAYOUT_2020").is_some(); - - if !(layout_2013 || layout_2020) { - error("Must enable one of the `layout-2013` or `layout-2020` features.") - } - if layout_2013 && layout_2020 { - error("Must not enable both of the `layout-2013` or `layout-2020` features.") - } - println!("cargo:rerun-if-changed=../../python/servo/gstreamer.py"); let output = Command::new(find_python()) @@ -34,11 +24,6 @@ fn main() { fs::write(path, output.stdout).unwrap(); } -fn error(message: &str) { - print!("\n\n Error: {}\n\n", message); - std::process::exit(1); -} - fn find_python() -> String { env::var("PYTHON3").ok().unwrap_or_else(|| { let candidates = if cfg!(windows) { diff --git a/components/servo/lib.rs b/components/servo/lib.rs index 25d89187f0c..4b9b37a178b 100644 --- a/components/servo/lib.rs +++ b/components/servo/lib.rs @@ -33,7 +33,8 @@ pub use embedder_traits; pub use euclid; pub use gfx; pub use ipc_channel; -pub use layout_thread; +pub use layout_thread_2013; +pub use layout_thread_2020; pub use media; pub use msg; pub use net; @@ -887,12 +888,23 @@ fn create_constellation( wgpu_image_map, }; - let constellation_chan = Constellation::< - script_layout_interface::message::Msg, - layout_thread::LayoutThread, - script::script_thread::ScriptThread, - script::serviceworker_manager::ServiceWorkerManager, - >::start( + let start_constellation_chan = if opts::get().legacy_layout { + Constellation::< + script_layout_interface::message::Msg, + layout_thread_2013::LayoutThread, + script::script_thread::ScriptThread, + script::serviceworker_manager::ServiceWorkerManager, + >::start + } else { + Constellation::< + script_layout_interface::message::Msg, + layout_thread_2020::LayoutThread, + script::script_thread::ScriptThread, + script::serviceworker_manager::ServiceWorkerManager, + >::start + }; + + start_constellation_chan( initial_state, initial_window_size, opts.random_pipeline_closure_probability, @@ -902,9 +914,7 @@ fn create_constellation( !opts.debug.disable_canvas_antialiasing, canvas_create_sender, canvas_ipc_sender, - ); - - constellation_chan + ) } struct FontCacheWR(CompositorProxy); @@ -1017,14 +1027,23 @@ pub fn run_content_process(token: String) { set_logger(content.script_to_constellation_chan().clone()); let background_hang_monitor_register = content.register_with_background_hang_monitor(); - - content.start_all::( - true, - background_hang_monitor_register, - None, - ); + if opts::get().legacy_layout { + content.start_all::( + true, + background_hang_monitor_register, + None, + ); + } else { + content.start_all::( + true, + background_hang_monitor_register, + None, + ); + } }, UnprivilegedContent::ServiceWorker(content) => { content.start::(); diff --git a/components/style/Cargo.toml b/components/style/Cargo.toml index bbb75880b53..6c5196d93f8 100644 --- a/components/style/Cargo.toml +++ b/components/style/Cargo.toml @@ -22,8 +22,6 @@ servo = ["serde", "style_traits/servo", "servo_atoms", "servo_config", "html5eve "cssparser/serde", "encoding_rs", "malloc_size_of/servo", "servo_url", "string_cache", "to_shmem/servo", "servo_arc/servo"] -servo-layout-2013 = [] -servo-layout-2020 = [] gecko_debug = [] gecko_refcount_logging = [] diff --git a/components/style/build.rs b/components/style/build.rs index d8f87f8bae5..eacb9b3fc99 100644 --- a/components/style/build.rs +++ b/components/style/build.rs @@ -71,16 +71,12 @@ fn generate_properties(engine: &str) { fn main() { let gecko = cfg!(feature = "gecko"); let servo = cfg!(feature = "servo"); - let l2013 = cfg!(feature = "servo-layout-2013"); - let l2020 = cfg!(feature = "servo-layout-2020"); - let engine = match (gecko, servo, l2013, l2020) { - (true, false, false, false) => "gecko", - (false, true, true, false) => "servo-2013", - (false, true, false, true) => "servo-2020", + let engine = match (gecko, servo) { + (true, false) => "gecko", + (false, true) => "servo", _ => panic!( "\n\n\ - The style crate requires enabling one of its 'servo' or 'gecko' feature flags \ - and, in the 'servo' case, one of 'servo-layout-2013' or 'servo-layout-2020'.\ + The style crate requires enabling one of its 'servo' or 'gecko' feature flags. \ \n\n" ), }; diff --git a/components/style/properties/build.py b/components/style/properties/build.py index 6df38fcefe3..c03d9023a7e 100644 --- a/components/style/properties/build.py +++ b/components/style/properties/build.py @@ -50,7 +50,7 @@ STYLE_STRUCT_LIST = [ def main(): usage = ( - "Usage: %s [ servo-2013 | servo-2020 | gecko ] [ style-crate | geckolib