Commit 3c98d0a3 authored by dpapad's avatar dpapad Committed by Commit Bot

PDF Viewer Update: Add basic sidenav skeleton.

Known issue: Scrolling in the new layout is not detected by the C++
plugin code and therefore the contents of the plugin do not repaint
upon scrolling.

This is addressed in follow up CLs.

Bug: 1101598
Change-Id: I137e5fea6ac924ee360392d2f06ef3259cc8d72b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2278441
Commit-Queue: dpapad <dpapad@chromium.org>
Auto-Submit: dpapad <dpapad@chromium.org>
Reviewed-by: default avatarLei Zhang <thestig@chromium.org>
Reviewed-by: default avatarJohn Lee <johntlee@chromium.org>
Cr-Commit-Position: refs/heads/master@{#791545}
parent 30726563
...@@ -6,6 +6,14 @@ ...@@ -6,6 +6,14 @@
<link rel="stylesheet" href="chrome://resources/css/text_defaults_md.css"> <link rel="stylesheet" href="chrome://resources/css/text_defaults_md.css">
<link rel="stylesheet" href="index.css"> <link rel="stylesheet" href="index.css">
<style>
html[pdf-viewer-update-enabled],
html[pdf-viewer-update-enabled] body {
height: 100%;
width: 100%;
}
</style>
</head> </head>
<body> <body>
<pdf-viewer id="viewer"></pdf-viewer> <pdf-viewer id="viewer"></pdf-viewer>
......
<style include="pdf-viewer-shared-style"> <style include="pdf-viewer-shared-style">
viewer-pdf-toolbar, viewer-pdf-toolbar {
viewer-pdf-toolbar-new {
position: fixed; position: fixed;
width: 100%; width: 100%;
z-index: 4; z-index: 4;
...@@ -17,6 +16,50 @@ ...@@ -17,6 +16,50 @@
display: none; display: none;
} }
} }
/* Styles only applying when the pdfViewerUpdateEnabled flag is on. */
:host-context([pdf-viewer-update-enabled]):host {
display: flex;
flex-direction: column;
height: 100%;
width: 100%;
}
#container {
display: flex;
flex: 1;
overflow: hidden;
}
#sidenav {
background-color: red;
min-width: 260px;
}
:host-context([pdf-viewer-update-enabled]) #plugin {
position: initial;
}
:host-context([pdf-viewer-update-enabled]) #content {
height: 100%;
left: 0;
position: sticky;
top: 0;
z-index: initial;
}
:host-context([pdf-viewer-update-enabled]) #sizer {
top: 0;
width: 100%;
z-index: initial;
}
#main {
flex: 1;
overflow: auto;
position: relative;
}
</style> </style>
<template is="dom-if" if="[[!pdfViewerUpdateEnabled_]]"> <template is="dom-if" if="[[!pdfViewerUpdateEnabled_]]">
...@@ -71,7 +114,20 @@ ...@@ -71,7 +114,20 @@
</viewer-pdf-toolbar-new> </viewer-pdf-toolbar-new>
</template> </template>
<div id="sizer"></div> <template is="dom-if" if="[[pdfViewerUpdateEnabled_]]">
<div id="container">
<div id="sidenav">sidenav</div>
<div id="main">
<div id="sizer"></div>
<div id="content"></div>
</div>
</div>
</template>
<template is="dom-if" if="[[!pdfViewerUpdateEnabled_]]">
<div id="sizer"></div>
</template>
<viewer-password-screen id="password-screen" <viewer-password-screen id="password-screen"
on-password-submitted="onPasswordSubmitted_"> on-password-submitted="onPasswordSubmitted_">
</viewer-password-screen> </viewer-password-screen>
...@@ -89,5 +145,6 @@ ...@@ -89,5 +145,6 @@
<viewer-form-warning id="form-warning"></viewer-form-warning> <viewer-form-warning id="form-warning"></viewer-form-warning>
</if> </if>
<div id="content"></div> <template is="dom-if" if="[[!pdfViewerUpdateEnabled_]]">
<div id="content"></div>
</template>
...@@ -248,6 +248,13 @@ export class PDFViewerElement extends PDFViewerBaseElement { ...@@ -248,6 +248,13 @@ export class PDFViewerElement extends PDFViewerBaseElement {
assert(this.paramsParser); assert(this.paramsParser);
this.toolbarEnabled_ = this.toolbarEnabled_ =
this.paramsParser.shouldShowToolbar(this.originalUrl); this.paramsParser.shouldShowToolbar(this.originalUrl);
// The toolbar does not need to be manually accounted in the
// PDFViewerUpdate UI.
if (this.pdfViewerUpdateEnabled_) {
return 0;
}
return this.toolbarEnabled_ ? MATERIAL_TOOLBAR_HEIGHT : 0; return this.toolbarEnabled_ ? MATERIAL_TOOLBAR_HEIGHT : 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment