Bug 117216 - [GTK] Make precedence of logical operators explicit
Summary: [GTK] Make precedence of logical operators explicit
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKitGTK (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
Depends on:
Reported: 2013-06-04 16:27 PDT by Alberto Garcia
Modified: 2013-06-04 21:38 PDT (History)
2 users (show)

See Also:

Patch (2.82 KB, patch)
2013-06-04 16:33 PDT, Alberto Garcia
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alberto Garcia 2013-06-04 16:27:47 PDT
There's a couple of cases where we're mixing && and || in the same
expression without using parentheses.

In particular ChromeClient::contentsSizeChanged() has this:

   if (gtk_widget_get_realized(widget)
      && (requisition.height != size.height())
      || (requisition.width != size.width()))

Due to the operator precedence rules, this means

   if ((A && B) || C)

rather than

   if (A && (B || C))

which is what we want.

AcceleratedCompositingContext::renderLayersToWindow() has a similar
case. If I'm not wrong here the parentheses are not really necessary
but I'd suggest using them as well to make the precedence explicit.
Comment 1 Alberto Garcia 2013-06-04 16:33:28 PDT
Created attachment 203739 [details]
Comment 2 WebKit Commit Bot 2013-06-04 21:38:41 PDT
Comment on attachment 203739 [details]

Clearing flags on attachment: 203739

Committed r151198: <http://trac.webkit.org/changeset/151198>
Comment 3 WebKit Commit Bot 2013-06-04 21:38:43 PDT
All reviewed patches have been landed.  Closing bug.