Home | History | Annotate | Download | only in runner
      1 /*
      2  * Copyright (C) 2010 Google Inc. All rights reserved.
      3  *
      4  * Redistribution and use in source and binary forms, with or without
      5  * modification, are permitted provided that the following conditions are
      6  * met:
      7  *
      8  *     * Redistributions of source code must retain the above copyright
      9  * notice, this list of conditions and the following disclaimer.
     10  *     * Redistributions in binary form must reproduce the above
     11  * copyright notice, this list of conditions and the following disclaimer
     12  * in the documentation and/or other materials provided with the
     13  * distribution.
     14  *     * Neither the name of Google Inc. nor the names of its
     15  * contributors may be used to endorse or promote products derived from
     16  * this software without specific prior written permission.
     17  *
     18  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
     19  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     20  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
     21  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
     22  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
     23  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
     24  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     25  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     26  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     27  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
     28  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     29  */
     30 
     31 // This implements the WebThemeEngine API used by the Windows version of
     32 // Chromium to render native form controls like checkboxes, radio buttons,
     33 // and scroll bars.
     34 // The normal implementation (native_theme) renders the controls using either
     35 // the UXTheme theming engine present in XP, Vista, and Win 7, or the "classic"
     36 // theme used if that theme is selected in the Desktop settings.
     37 // Unfortunately, both of these themes render controls differently on the
     38 // different versions of Windows.
     39 //
     40 // In order to ensure maximum consistency of baselines across the different
     41 // Windows versions, we provide a simple implementation for DRT here
     42 // instead. These controls are actually platform-independent (they're rendered
     43 // using Skia) and could be used on Linux and the Mac as well, should we
     44 // choose to do so at some point.
     45 //
     46 
     47 #ifndef WebTestThemeEngineWin_h
     48 #define WebTestThemeEngineWin_h
     49 
     50 #include "public/platform/WebNonCopyable.h"
     51 #include "public/platform/win/WebThemeEngine.h"
     52 
     53 namespace WebTestRunner {
     54 
     55 class WebTestThemeEngineWin : public blink::WebThemeEngine, public blink::WebNonCopyable {
     56 public:
     57     WebTestThemeEngineWin() { }
     58     virtual ~WebTestThemeEngineWin() { }
     59 
     60     // WebThemeEngine methods:
     61     virtual void paintButton(
     62         blink::WebCanvas*, int part, int state, int classicState,
     63         const blink::WebRect&);
     64 
     65     virtual void paintMenuList(
     66         blink::WebCanvas*, int part, int state, int classicState,
     67         const blink::WebRect&);
     68 
     69     virtual void paintScrollbarArrow(
     70         blink::WebCanvas*, int state, int classicState,
     71         const blink::WebRect&);
     72 
     73     virtual void paintScrollbarThumb(
     74         blink::WebCanvas*, int part, int state, int classicState,
     75         const blink::WebRect&);
     76 
     77     virtual void paintScrollbarTrack(
     78         blink::WebCanvas*, int part, int state, int classicState,
     79         const blink::WebRect&, const blink::WebRect& alignRect);
     80 
     81     virtual void paintSpinButton(
     82         blink::WebCanvas*, int part, int state, int classicState,
     83         const blink::WebRect&);
     84 
     85     virtual void paintTextField(
     86         blink::WebCanvas*, int part, int state, int classicState,
     87         const blink::WebRect&, blink::WebColor, bool fillContentArea,
     88         bool drawEdges);
     89 
     90     virtual void paintTrackbar(
     91         blink::WebCanvas*, int part, int state, int classicState,
     92         const blink::WebRect&);
     93 
     94     virtual void paintProgressBar(
     95         blink::WebCanvas*, const blink::WebRect& barRect,
     96         const blink::WebRect& valueRect,
     97         bool determinate, double time);
     98 
     99     virtual blink::WebSize getSize(int part);
    100 };
    101 
    102 }
    103 
    104 #endif // WebTestThemeEngineWin_h
    105