blob: 864193f79c81a2ae33f778e59b2fe7bfdfc07690 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
// Function called from WebCore.
function createOverlay(shadowRoot, titleText, subtitleText)
{
// Generate the following structure:
//
// <div pseudo="-webkit-snapshotted-plugin-content">
// <div class="snapshot-overlay" aria-label="[Title]: [Subtitle]" role="button">
// <div class="snapshot-label">
// <div class="snapshot-title">[Title]</div>
// <div class="snapshot-subtitle">[Subtitle]</div>
// </div>
// </div>
// </div>
var shadowContainer = document.createElement("div");
shadowContainer.setAttribute("pseudo", "-webkit-snapshotted-plugin-content");
var overlay = shadowContainer.appendChild(document.createElement("div"));
overlay.setAttribute("aria-label", titleText + ": " + subtitleText);
overlay.setAttribute("role", "button");
overlay.className = "snapshot-overlay";
var snapshotLabel = overlay.appendChild(document.createElement("div"));
snapshotLabel.className = "snapshot-label";
var title = snapshotLabel.appendChild(document.createElement("div"));
title.className = "snapshot-title";
title.textContent = titleText;
var subtitle = snapshotLabel.appendChild(document.createElement("div"));
subtitle.className = "snapshot-subtitle";
subtitle.textContent = subtitleText;
shadowRoot.appendChild(shadowContainer);
};
|