Bug 50982 - ViewportArguments.h uses an enum to intialize a bool
Summary: ViewportArguments.h uses an enum to intialize a bool
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC OS X 10.5
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks: 51551
  Show dependency treegraph
 
Reported: 2010-12-13 15:02 PST by Evan Martin
Modified: 2010-12-23 20:32 PST (History)
2 users (show)

See Also:


Attachments
Patch (1.15 KB, patch)
2010-12-23 12:25 PST, Evan Martin
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Evan Martin 2010-12-13 15:02:34 PST
r69316 changed userScalable from a float to a bool.
However, userScalable is initialized from an enum in the constructor, and the enum value is ValueAuto (-1).  This produces a compiler warning and probably isn't doing what we want.

third_party/WebKit/WebCore/dom/ViewportArguments.h(78) : warning C4305: 'initializing' : truncation from '' to 'bool'
Comment 1 Evan Martin 2010-12-23 12:25:33 PST
Created attachment 77358 [details]
Patch
Comment 2 Evan Martin 2010-12-23 12:26:58 PST
I don't really know what I'm doing so please review carefully.  But I figure -1 is also true so this should be the same thing(?).
Comment 3 Kenneth Rohde Christiansen 2010-12-23 12:37:22 PST
Well ValueAuto means that it is unset and thus will use the default (which might depend on some of the other values). I guess the most right thing is to make userScalable a float and convert it to true or false in the compute* method. For instance if I set min-scale = 1.0 and max-scale = 1.0, it is basically not scalable, but I guess the iPhone might still consider it scalable, as it affects more than just the scale change. From docs: Setting user-scalable to no also prevents a webpage from scrolling when entering text in an input field.
Comment 4 Evan Martin 2010-12-23 13:16:58 PST
Kenneth, what do you think of the patch I uploaded?  It at least doesn't change the current behavior of the code.  I'm reluctant to try to change the semantics of userScalable since I don't really understand what it means or how it's used.
Comment 5 Kenneth Rohde Christiansen 2010-12-23 15:09:34 PST
(In reply to comment #4)
> Kenneth, what do you think of the patch I uploaded?  It at least doesn't change the current behavior of the code.  I'm reluctant to try to change the semantics of userScalable since I don't really understand what it means or how it's used.

It is fine, as you said it should give the correct behavior. Thanks for doing this.
Comment 6 WebKit Commit Bot 2010-12-23 20:32:04 PST
Comment on attachment 77358 [details]
Patch

Clearing flags on attachment: 77358

Committed r74610: <http://trac.webkit.org/changeset/74610>
Comment 7 WebKit Commit Bot 2010-12-23 20:32:10 PST
All reviewed patches have been landed.  Closing bug.