<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>54764</bug_id>
          
          <creation_ts>2011-02-18 12:10:47 -0800</creation_ts>
          <short_desc>Remove redundant code in qt/WebCoreSupport</short_desc>
          <delta_ts>2011-02-28 13:19:30 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>WebKit Qt</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Trivial</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>0</everconfirmed>
          <reporter name="Fabrizio">fabrizio.machado</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>ademar</cc>
    
    <cc>commit-queue</cc>
    
    <cc>suresh.voruganti</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>353736</commentid>
    <comment_count>0</comment_count>
    <who name="Fabrizio">fabrizio.machado</who>
    <bug_when>2011-02-18 12:10:47 -0800</bug_when>
    <thetext>The source files NotificationPresenterClientQt.cpp and DumpRenderTreeSupportQt.cpp have redundant checks after static_cast.

In NotificationPresenterClientQt.cpp, the final &quot;if()&quot; is not needed:
=========================================================
    if (!context || context-&gt;isWorkerContext())
        return 0;

    Document* document = static_cast&lt;Document*&gt;(context);
    if (!document)
        return 0;
=========================================================

The context pointer has already been checked, so it must be non-NULL when the static_cast occurs.  Thus, document will not be NULL and the check is redundant.



Similarly, in DumpRenderTreeSupportQt.cpp:
=========================================================
    if (!coreNode || !coreNode-&gt;renderer())
        return false;

    HTMLInputElement* inputElement = static_cast&lt;HTMLInputElement*&gt;(coreNode);
    if (!inputElement)
        return false;
=========================================================

coreNode has already been checked and is non-NULL when the static_cast to HTMLInputElement* occurs.  The check after the cast is not needed.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>353743</commentid>
    <comment_count>1</comment_count>
      <attachid>82995</attachid>
    <who name="Fabrizio">fabrizio.machado</who>
    <bug_when>2011-02-18 12:20:54 -0800</bug_when>
    <thetext>Created attachment 82995
remove redundant checks</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>354060</commentid>
    <comment_count>2</comment_count>
      <attachid>82995</attachid>
    <who name="WebKit Commit Bot">commit-queue</who>
    <bug_when>2011-02-18 21:58:06 -0800</bug_when>
    <thetext>Comment on attachment 82995
remove redundant checks

Clearing flags on attachment: 82995

Committed r79098: &lt;http://trac.webkit.org/changeset/79098&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>354061</commentid>
    <comment_count>3</comment_count>
    <who name="WebKit Commit Bot">commit-queue</who>
    <bug_when>2011-02-18 21:58:11 -0800</bug_when>
    <thetext>All reviewed patches have been landed.  Closing bug.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>359050</commentid>
    <comment_count>4</comment_count>
    <who name="Suresh Voruganti">suresh.voruganti</who>
    <bug_when>2011-02-28 07:49:37 -0800</bug_when>
    <thetext>Please cherry pick the fix to Qtwebkit 2.1.x</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>359278</commentid>
    <comment_count>5</comment_count>
    <who name="Ademar Reis">ademar</who>
    <bug_when>2011-02-28 13:19:30 -0800</bug_when>
    <thetext>I don&apos;t see the point of adding refactorings like this to a stable branch (qtwebkit-2.1.x). Removing from meta-bug. If it fixes a real problem, let me know.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>82995</attachid>
            <date>2011-02-18 12:20:54 -0800</date>
            <delta_ts>2011-02-18 21:58:06 -0800</delta_ts>
            <desc>remove redundant checks</desc>
            <filename>54764.patch</filename>
            <type>text/plain</type>
            <size>1953</size>
            <attacher name="Fabrizio">fabrizio.machado</attacher>
            
              <data encoding="base64">SW5kZXg6IFNvdXJjZS9XZWJLaXQvcXQvQ2hhbmdlTG9nCj09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0KLS0tIFNvdXJjZS9X
ZWJLaXQvcXQvQ2hhbmdlTG9nCShyZXZpc2lvbiA3OTAxNykKKysrIFNvdXJjZS9XZWJLaXQvcXQv
Q2hhbmdlTG9nCSh3b3JraW5nIGNvcHkpCkBAIC0xLDMgKzEsMTYgQEAKKzIwMTEtMDItMTggIEZh
YnJpemlvIE1hY2hhZG8gIDxmYWJyaXppby5tYWNoYWRvQG5va2lhLmNvbT4KKworICAgICAgICBS
ZXZpZXdlZCBieSBOT0JPRFkgKE9PUFMhKS4KKworICAgICAgICBSZW1vdmUgcmVkdW50YW50IGNo
ZWNrcy4KKyAgICAgICAgaHR0cHM6Ly9idWdzLndlYmtpdC5vcmcvc2hvd19idWcuY2dpP2lkPTU0
NzY0CisgICAgICAgIAorCisgICAgICAgICogV2ViQ29yZVN1cHBvcnQvRHVtcFJlbmRlclRyZWVT
dXBwb3J0UXQuY3BwOgorICAgICAgICAoRHVtcFJlbmRlclRyZWVTdXBwb3J0UXQ6OmVsZW1lbnRE
b2VzQXV0b0NvbXBsZXRlRm9yRWxlbWVudFdpdGhJZCk6CisgICAgICAgICogV2ViQ29yZVN1cHBv
cnQvTm90aWZpY2F0aW9uUHJlc2VudGVyQ2xpZW50UXQuY3BwOgorICAgICAgICAoV2ViQ29yZTo6
Tm90aWZpY2F0aW9uUHJlc2VudGVyQ2xpZW50UXQ6OnRvUGFnZSk6CisKIDIwMTEtMDItMTAgIEx1
aXog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09PT09PT09PT09PT09PT09PT09Ci0tLSBTb3VyY2UvV2Vi
S2l0L3F0L1dlYkNvcmVTdXBwb3J0L05vdGlmaWNhdGlvblByZXNlbnRlckNsaWVudFF0LmNwcAko
cmV2aXNpb24gNzg4NTEpCisrKyBTb3VyY2UvV2ViS2l0L3F0L1dlYkNvcmVTdXBwb3J0L05vdGlm
aWNhdGlvblByZXNlbnRlckNsaWVudFF0LmNwcAkod29ya2luZyBjb3B5KQpAQCAtNDQwLDggKzQ0
MCw2IEBAIFFXZWJQYWdlKiBOb3RpZmljYXRpb25QcmVzZW50ZXJDbGllbnRRdDoKICAgICAgICAg
cmV0dXJuIDA7CiAKICAgICBEb2N1bWVudCogZG9jdW1lbnQgPSBzdGF0aWNfY2FzdDxEb2N1bWVu
dCo+KGNvbnRleHQpOwotICAgIGlmICghZG9jdW1lbnQpCi0gICAgICAgIHJldHVybiAwOwogCiAg
ICAgUGFnZSogcGFnZSA9IGRvY3VtZW50LT5wYWdlKCk7CiAgICAgaWYgKCFwYWdlIHx8ICFwYWdl
LT5tYWluRnJhbWUoKSkK
</data>

          </attachment>
      

    </bug>

</bugzilla>