webengine/osswebengine/DerivedSources/WebCore/JSScreen.cpp
changeset 0 dd21522fd290
equal deleted inserted replaced
-1:000000000000 0:dd21522fd290
       
     1 /*
       
     2     This file is part of the WebKit open source project.
       
     3     This file has been generated by generate-bindings.pl. DO NOT MODIFY!
       
     4 
       
     5     This library is free software; you can redistribute it and/or
       
     6     modify it under the terms of the GNU Library General Public
       
     7     License as published by the Free Software Foundation; either
       
     8     version 2 of the License, or (at your option) any later version.
       
     9 
       
    10     This library is distributed in the hope that it will be useful,
       
    11     but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
       
    13     Library General Public License for more details.
       
    14 
       
    15     You should have received a copy of the GNU Library General Public License
       
    16     along with this library; see the file COPYING.LIB.  If not, write to
       
    17     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
       
    18     Boston, MA 02110-1301, USA.
       
    19 */
       
    20 
       
    21 #include "config.h"
       
    22 
       
    23 #include "JSScreen.h"
       
    24 
       
    25 #include <wtf/GetPtr.h>
       
    26 
       
    27 #include "Screen.h"
       
    28 
       
    29 using namespace KJS;
       
    30 
       
    31 namespace WebCore {
       
    32 
       
    33 /* Hash table */
       
    34 
       
    35 static const HashEntry JSScreenTableEntries[] =
       
    36 {
       
    37     { 0, 0, 0, 0, 0 },
       
    38     { "height", JSScreen::HeightAttrNum, DontDelete|ReadOnly, 0, &JSScreenTableEntries[8] },
       
    39     { 0, 0, 0, 0, 0 },
       
    40     { "width", JSScreen::WidthAttrNum, DontDelete|ReadOnly, 0, &JSScreenTableEntries[9] },
       
    41     { "availHeight", JSScreen::AvailHeightAttrNum, DontDelete|ReadOnly, 0, &JSScreenTableEntries[11] },
       
    42     { 0, 0, 0, 0, 0 },
       
    43     { 0, 0, 0, 0, 0 },
       
    44     { "availLeft", JSScreen::AvailLeftAttrNum, DontDelete|ReadOnly, 0, 0 },
       
    45     { "colorDepth", JSScreen::ColorDepthAttrNum, DontDelete|ReadOnly, 0, &JSScreenTableEntries[10] },
       
    46     { "pixelDepth", JSScreen::PixelDepthAttrNum, DontDelete|ReadOnly, 0, 0 },
       
    47     { "availTop", JSScreen::AvailTopAttrNum, DontDelete|ReadOnly, 0, 0 },
       
    48     { "availWidth", JSScreen::AvailWidthAttrNum, DontDelete|ReadOnly, 0, 0 }
       
    49 };
       
    50 
       
    51 static const HashTable JSScreenTable = 
       
    52 {
       
    53     2, 12, JSScreenTableEntries, 8
       
    54 };
       
    55 
       
    56 /* Hash table for prototype */
       
    57 
       
    58 static const HashEntry JSScreenPrototypeTableEntries[] =
       
    59 {
       
    60     { 0, 0, 0, 0, 0 }
       
    61 };
       
    62 
       
    63 static const HashTable JSScreenPrototypeTable = 
       
    64 {
       
    65     2, 1, JSScreenPrototypeTableEntries, 1
       
    66 };
       
    67 
       
    68 const ClassInfo JSScreenPrototype::info = { "ScreenPrototype", 0, &JSScreenPrototypeTable, 0 };
       
    69 
       
    70 JSObject* JSScreenPrototype::self(ExecState* exec)
       
    71 {
       
    72     return KJS::cacheGlobalObject<JSScreenPrototype>(exec, "[[JSScreen.prototype]]");
       
    73 }
       
    74 
       
    75 const ClassInfo JSScreen::info = { "Screen", 0, &JSScreenTable, 0 };
       
    76 
       
    77 JSScreen::JSScreen(ExecState* exec, Screen* impl)
       
    78     : m_impl(impl)
       
    79 {
       
    80     setPrototype(JSScreenPrototype::self(exec));
       
    81 }
       
    82 
       
    83 JSScreen::~JSScreen()
       
    84 {
       
    85     ScriptInterpreter::forgetDOMObject(m_impl.get());
       
    86 }
       
    87 
       
    88 bool JSScreen::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
       
    89 {
       
    90     return getStaticValueSlot<JSScreen, KJS::DOMObject>(exec, &JSScreenTable, this, propertyName, slot);
       
    91 }
       
    92 
       
    93 JSValue* JSScreen::getValueProperty(ExecState* exec, int token) const
       
    94 {
       
    95     switch (token) {
       
    96     case HeightAttrNum: {
       
    97         Screen* imp = static_cast<Screen*>(impl());
       
    98 
       
    99         return jsNumber(imp->height());
       
   100     }
       
   101     case WidthAttrNum: {
       
   102         Screen* imp = static_cast<Screen*>(impl());
       
   103 
       
   104         return jsNumber(imp->width());
       
   105     }
       
   106     case ColorDepthAttrNum: {
       
   107         Screen* imp = static_cast<Screen*>(impl());
       
   108 
       
   109         return jsNumber(imp->colorDepth());
       
   110     }
       
   111     case PixelDepthAttrNum: {
       
   112         Screen* imp = static_cast<Screen*>(impl());
       
   113 
       
   114         return jsNumber(imp->pixelDepth());
       
   115     }
       
   116     case AvailLeftAttrNum: {
       
   117         Screen* imp = static_cast<Screen*>(impl());
       
   118 
       
   119         return jsNumber(imp->availLeft());
       
   120     }
       
   121     case AvailTopAttrNum: {
       
   122         Screen* imp = static_cast<Screen*>(impl());
       
   123 
       
   124         return jsNumber(imp->availTop());
       
   125     }
       
   126     case AvailHeightAttrNum: {
       
   127         Screen* imp = static_cast<Screen*>(impl());
       
   128 
       
   129         return jsNumber(imp->availHeight());
       
   130     }
       
   131     case AvailWidthAttrNum: {
       
   132         Screen* imp = static_cast<Screen*>(impl());
       
   133 
       
   134         return jsNumber(imp->availWidth());
       
   135     }
       
   136     }
       
   137     return 0;
       
   138 }
       
   139 
       
   140 KJS::JSValue* toJS(KJS::ExecState* exec, Screen* obj)
       
   141 {
       
   142     return KJS::cacheDOMObject<Screen, JSScreen>(exec, obj);
       
   143 }
       
   144 Screen* toScreen(KJS::JSValue* val)
       
   145 {
       
   146     return val->isObject(&JSScreen::info) ? static_cast<JSScreen*>(val)->impl() : 0;
       
   147 }
       
   148 
       
   149 }