Bug 22550 - Add WML <timer> element support
Summary: Add WML <timer> element support
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: XML (show other bugs)
Version: 528+ (Nightly build)
Hardware: Macintosh OS X 10.5
: P2 Normal
Assignee: Nikolas Zimmermann
URL:
Keywords:
Depends on:
Blocks: 20393
  Show dependency treegraph
 
Reported: 2008-11-28 19:22 PST by Nikolas Zimmermann
Modified: 2008-11-28 20:00 PST (History)
0 users

See Also:


Attachments
Initial patch (15.21 KB, patch)
2008-11-28 19:32 PST, Nikolas Zimmermann
zwarich: review+
Details | Formatted Diff | Diff
Layout test results (53 bytes, patch)
2008-11-28 19:32 PST, Nikolas Zimmermann
no flags Details | Formatted Diff | Diff
Updated layout test results (3.73 KB, patch)
2008-11-28 19:55 PST, Nikolas Zimmermann
zwarich: review+
Details | Formatted Diff | Diff
Updated patch (18.83 KB, patch)
2008-11-28 19:57 PST, Nikolas Zimmermann
zwarich: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Nikolas Zimmermann 2008-11-28 19:22:09 PST
Add WML <timer> element support.
Comment 1 Nikolas Zimmermann 2008-11-28 19:32:17 PST
Created attachment 25581 [details]
Initial patch
Comment 2 Nikolas Zimmermann 2008-11-28 19:32:38 PST
Created attachment 25582 [details]
Layout test results
Comment 3 Cameron Zwarich (cpst) 2008-11-28 19:43:37 PST
Comment on attachment 25581 [details]
Initial patch

The comment

// The value of timeout must be a positive integral number, or ignore it

would probably be more clear as

// If the value of timeout is not a positive integer, ignore it

In WMLTimerElement::insertedIntoDocument(), you have both

     ASSERT(parent);

and

    if (!parent || !parent->isWMLElement())

You should decide if parent should ever be null and make a decision accordingly. 

+    if (interval <= 0)
+        interval = m_value.toInt();
+
+    if (interval > 0)
+        m_timer.startOneShot(interval / 10.0f);

Can't the second conditional be an else?
Comment 4 Cameron Zwarich (cpst) 2008-11-28 19:44:02 PST
Oops, I forgot to say: if you address those comments, r=me.
Comment 5 Nikolas Zimmermann 2008-11-28 19:53:40 PST
> 
> // If the value of timeout is not a positive integer, ignore it
Fixed.

> 
> In WMLTimerElement::insertedIntoDocument(), you have both
> 
>      ASSERT(parent);
> 
> and
> 
>     if (!parent || !parent->isWMLElement())
> 
> You should decide if parent should ever be null and make a decision
> accordingly. 
Yeah, Holger also noted this while reviewing the <do> patch. I'll come up with a follow-up patch fixing these, as there are 7 other places which use the same piece of code.

> 
> +    if (interval <= 0)
> +        interval = m_value.toInt();
> +
> +    if (interval > 0)
> +        m_timer.startOneShot(interval / 10.0f);
> 
> Can't the second conditional be an else?
The interval may change inbetween?

Thanks for the first review
Comment 6 Nikolas Zimmermann 2008-11-28 19:55:40 PST
Created attachment 25583 [details]
Updated layout test results
Comment 7 Cameron Zwarich (cpst) 2008-11-28 19:57:15 PST
(In reply to comment #5)
> > In WMLTimerElement::insertedIntoDocument(), you have both
> > 
> >      ASSERT(parent);
> > 
> > and
> > 
> >     if (!parent || !parent->isWMLElement())
> > 
> > You should decide if parent should ever be null and make a decision
> > accordingly. 
> Yeah, Holger also noted this while reviewing the <do> patch. I'll come up with
> a follow-up patch fixing these, as there are 7 other places which use the same
> piece of code.

If it occurs elsewhere, a followup patch is okay. Be sure to do it soon, though.

> > +    if (interval <= 0)
> > +        interval = m_value.toInt();
> > +
> > +    if (interval > 0)
> > +        m_timer.startOneShot(interval / 10.0f);
> > 
> > Can't the second conditional be an else?
> The interval may change inbetween?

Wow, I'm stupid. Sorry about that. ;-)
Comment 8 Nikolas Zimmermann 2008-11-28 19:57:23 PST
Created attachment 25584 [details]
Updated patch
Comment 9 Cameron Zwarich (cpst) 2008-11-28 19:58:22 PST
Comment on attachment 25584 [details]
Updated patch

r=me
Comment 10 Cameron Zwarich (cpst) 2008-11-28 19:58:32 PST
Comment on attachment 25583 [details]
Updated layout test results

r=me
Comment 11 Nikolas Zimmermann 2008-11-28 20:00:38 PST
Landed in r38838.