Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ The release run heads these entries with the version and opens a fresh
that are not one no longer open as an image that cannot be shown.
- A text file reads in a quieter gutter: the line numbers line up with their
lines, stay out of a copy of the page, and the hovered line is marked.
- Every page states its own body margin and background instead of inheriting the
browser's, so no view opens inset by an eight-pixel border.

## v6.4.0 - 2026-08-09

Expand Down
4 changes: 3 additions & 1 deletion src/odr/internal/html/font_file.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,9 @@ class HtmlServiceImpl final : public HtmlService {
out.out() << "<style>";
out.out() << "@font-face{font-family:'odr-specimen';src:url(" << url
<< ");}";
out.out() << "body{font-family:sans-serif;}";
// The page's own margin, so it does not depend on the browser's.
out.out() << "body{margin:0;padding:8px;background:#fff;"
"font-family:sans-serif;}";
out.out() << ".grid{display:flex;flex-wrap:wrap;}";
out.out() << ".cell{width:4em;height:4em;border:1px solid #ddd;margin:2px;"
"display:flex;flex-direction:column;align-items:center;"
Expand Down
14 changes: 9 additions & 5 deletions src/odr/internal/html/frontend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,11 @@ namespace odr::internal::html {

namespace {

/// Every page we write states its own body margin and background, rather than
/// reading whatever the browser's default sheet says.
constexpr std::string_view document_css = R"css(
*{margin:0;position:relative}
body{margin:0;background:#fff}
x-p{display:block;font-size:0}
x-s{display:inline}
.odr-background{padding:0;background:#525659}
Expand Down Expand Up @@ -51,7 +54,7 @@ constexpr std::string_view spreadsheet_css = R"css(
--odr-sheet-font:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
}
/* A sheet is not a page: past the last row and column is canvas. */
body{background:var(--odr-sheet-canvas)}
body{margin:0;background:var(--odr-sheet-canvas)}
.odr-sheet{background:#fff}
table{border-collapse:collapse;table-layout:fixed}
td{vertical-align:bottom;height:inherit;padding:1px 6px}
Expand Down Expand Up @@ -120,8 +123,8 @@ constexpr std::string_view xml_css = R"css(
--odr-xml-meta:#8250df;
--odr-xml-mono:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;
}
body{background:#fff}
.odr-xml{color:var(--odr-xml-text);font:13px/1.6 var(--odr-xml-mono);word-break:break-word;overflow-wrap:anywhere}
body{margin:0;background:#fff}
.odr-xml{padding:16px;color:var(--odr-xml-text);font:13px/1.6 var(--odr-xml-mono);word-break:break-word;overflow-wrap:anywhere}
.odr-xml-line,.odr-xml summary{padding-left:1.5em}
.odr-xml summary{display:block;position:relative;list-style:none;cursor:pointer}
.odr-xml summary::-webkit-details-marker{display:none}
Expand Down Expand Up @@ -150,7 +153,7 @@ constexpr std::string_view filesystem_css = R"css(
--odr-files-font:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
--odr-files-mono:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;
}
body{background:#fff;color:#1f2328;font:13px/1.5 var(--odr-files-font)}
body{margin:0;background:#fff;color:#1f2328;font:13px/1.5 var(--odr-files-font)}
.odr-files{border-collapse:collapse;width:100%}
.odr-files td{padding:5px 12px;border-top:1px solid var(--odr-files-line)}
.odr-files tbody tr:hover>*{background-image:linear-gradient(rgba(0,0,0,.04),rgba(0,0,0,.04))}
Expand All @@ -165,7 +168,8 @@ body{background:#fff;color:#1f2328;font:13px/1.5 var(--odr-files-font)}
)css";

constexpr std::string_view media_css = R"css(
.odr-media{display:flex;align-items:center;justify-content:center;margin:0;min-height:100vh;background:#000}
body{margin:0;background:#000}
.odr-media{display:flex;align-items:center;justify-content:center;min-height:100vh}
.odr-media video{max-width:100%;max-height:100vh}
.odr-media audio{width:100%;max-width:40rem;margin:0 1rem}
)css";
Expand Down
3 changes: 3 additions & 0 deletions src/odr/internal/html/image_file.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@ class HtmlServiceImpl final : public HtmlService {
out.write_header_target("_blank");
out.write_header_title("odr");
write_viewport_meta(out, config(), true);
out.write_header_style_begin();
out.out() << "body{margin:0;background:#fff}";
out.write_header_style_end();
out.write_header_end();

out.write_body_begin();
Expand Down
2 changes: 1 addition & 1 deletion test/data.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ odr_test_data(
odr_test_data(
PATH "reference-output/odr-private"
URL "https://github.com/opendocument-app/OpenDocument.test-private.output.git"
REVISION "8f7383f64c795602793a8c20a9c76bea197ad9c1")
REVISION "d1fdace052b45f7744f24a7c6bb84a82332d37bb")
Loading