⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 286608 in webkit


Ignore:
Timestamp:
Dec 7, 2021, 12:40:06 PM (5 years ago)
Author:
Cameron McCormack
Message:

Tweak puzzle to use feature detection
https://bugs.webkit.org/show_bug.cgi?id=233946

Unreviewed.

  • blog-files/wide-gamut-canvas/puzzle.html:
Location:
trunk/Websites/webkit.org
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Websites/webkit.org/ChangeLog

    r286348 r286608  
     12021-12-07  Cameron McCormack  <heycam@apple.com>
     2
     3        Tweak puzzle to use feature detection
     4        https://bugs.webkit.org/show_bug.cgi?id=233946
     5
     6        Unreviewed.
     7
     8        * blog-files/wide-gamut-canvas/puzzle.html:
     9
    1102021-11-30  Cameron McCormack  <heycam@apple.com>
    211
  • trunk/Websites/webkit.org/blog-files/wide-gamut-canvas/puzzle.html

    r286348 r286608  
    33<meta name="viewport" content="width=device-width, initial-scale=1">
    44<style>
    5 body { text-align: center; white-space: nowrap; }
     5body { text-align: center; white-space: nowrap; font: 16px Helvetica, sans-serif; }
    66img, #puzzleboard { box-shadow: 0 0 4px black; }
    77img { margin: 32px 8px 0; }
    88#puzzleboard { display: inline-flex; flex-direction: column; background-color: tan; padding: 16px; border-radius: 8px; }
    99canvas { border: 2px solid; border-color: rgba(0, 0, 0, 0.2) rgba(255, 255, 255, 0.2) rgba(255, 255, 255, 0.2) rgba(0, 0, 0, 0.2); background-color: rgba(255, 255, 255, 0.2); padding: 2px; }
    10 label { padding-top: 16px; font: bold 16px Helvetica, sans-serif; color: #864; text-shadow: 0px 2px 0px rgba(255, 255, 255, 0.3); color: rgb(104, 90, 70); border-radius: 8px; -webkit-user-select: none; user-select: none; text-align: center; }
     10label { padding-top: 16px; font-weight: bold; color: #864; text-shadow: 0px 2px 0px rgba(255, 255, 255, 0.3); color: rgb(104, 90, 70); border-radius: 8px; -webkit-user-select: none; user-select: none; text-align: center; }
    1111input { vertical-align: middle; }
    1212label span { display: none; }
     13.warning { display: none; }
     14.unsupported .warning { display: block; position: absolute; top: 0; left: 0; right: 0; }
     15.warning span { background-color: rgba(0, 0, 0, 0.5); padding: 4px; border; border-radius: 4px; color: white; }
     16.unsupported label { text-decoration: line-through; }
    1317@media (prefers-color-scheme: dark) {
    1418    html { background-color: black; }
     
    179183    canvas.style.height = `${height / scale}px`;
    180184
    181     ctx = canvas.getContext("2d", { colorSpace });
     185    try {
     186        ctx = canvas.getContext("2d", { colorSpace });
     187    } catch {
     188        ctx = canvas.getContext("2d");
     189        document.body.className = "unsupported";
     190    }
     191
    182192    drawBoard();
    183193}
     
    246256  <label><input id=displayP3 type=checkbox onchange="updateCanvas()"> Use Display P3 <span>canvas</span></label>
    247257</div>
     258<div class="warning"><span>This browser does not support Display P3 canvas.</span></div>
Note: See TracChangeset for help on using the changeset viewer.