This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 22770 - add global onpaint, onresize attributes?
Summary: add global onpaint, onresize attributes?
Status: RESOLVED WONTFIX
Alias: None
Product: HTML WG
Classification: Unclassified
Component: HTML5 spec (show other bugs)
Version: unspecified
Hardware: PC Windows NT
: P2 enhancement
Target Milestone: ---
Assignee: This bug has no owner yet - up for the taking
QA Contact: HTML WG Bugzilla archive list
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-07-23 10:44 UTC by Jim Michaels
Modified: 2013-09-03 13:21 UTC (History)
6 users (show)

See Also:


Attachments

Description Jim Michaels 2013-07-23 10:44:48 UTC
please add:

- global onpaint="" attribute which gets activated on a browser window repaint, with which it executes the code therein, such as a javascript function call.can call a js function that 
Example 1:
<div id="o" style="z-index:2;" onpaint="dopaint()">yahoo!</div>
<script>
function dopaint() {
    //move an element around
    var e=document.getElementById('o');
    var old=e.style.top.toString();
    //get rid of "px off of end and get value, add 4 mod document.height
    e.style.top = (((parseInt(old.substr(0,old.length)-2)+4)%document.height)+'px';
    //however, this code COULD be a problem, since it causes a repaint, 
    //and might be the kind of thing people try...
}
</script>
Example 2:
<p>document pixel area=<span id="t" onpaint="document.getElementById('t').innerHTML = document.width * document.height">????</span></p>

specifically, I needed the onpaint thing for working with a live rotating 4D <canvas></canvas> with support for red-blue 3D glasses someday I am trying to port from Java, which requires a paint hook do do animation using double-buffering as fast as it can. *IF* I can do double-buffering with canvas... this is for math folks who want to study 4D.


- window.onresize="" or global onresize="" attribute which activates when the browser document window is resized and executes the code in the string following the = sign. I don't know exactly in what to place this, whether as a DOM method/property (?) or if it's more appropriate for 

this comes in handy for games, but also for regular DHTML for element positioning and page sizing. many times a web developer will make a page hard-coded for certain screen sizes, but knowing the document width and height, and being able to rework the document for that could be handy for some. may get popular. I know I could use these both.

Example:
<!--form controls for 4D-->
<div id="o2" onresize="doresize()"><canvas id="c">4D canvas</canvas></div>
<script>
function doresize() {
    var formControls=document.getElementById('f').height;
    var nw=getElementById('nnavigation').width;
    var c=document.getElementById('c');
    c.width = document.width - nw; 
    c.height = document.viewport.height - formControls.height;
}
</script>
Comment 1 Kornel Lesinski 2013-07-23 13:45:42 UTC
Have you tried requestAnimationFrame and window.onresize?
Comment 2 Robin Berjon 2013-09-03 13:21:34 UTC
EDITOR'S RESPONSE: This is an Editor's Response to your comment. If you are
satisfied with this response, please change the state of this bug to CLOSED. If
you have additional information and would like the Editor to reconsider, please
reopen this bug. If you would like to escalate the issue to the full HTML
Working Group, please add the TrackerRequest keyword to this bug, and suggest
title and text for the Tracker Issue; or you may create a Tracker Issue
yourself, if you are able to do so. For more details, see this document:

   http://dev.w3.org/html5/decision-policy/decision-policy.html

Status: Rejected
Change Description: none
Rationale: We already have onresize, and painting at the "right" frequency can already be done with requestAnimationFrame().