00001
00021
#include "css_renderstyledeclarationimpl.h"
00022
00023
#include "rendering/render_style.h"
00024
#include "rendering/render_object.h"
00025
00026
#include "cssproperties.h"
00027
00028
using namespace DOM;
00029
using namespace khtml;
00030
00031
00032 RenderStyleDeclarationImpl::RenderStyleDeclarationImpl( DOM::NodeImpl *node )
00033 : CSSStyleDeclarationImpl( 0 )
00034 {
00035 m_node = node;
00036 m_renderer = m_node->renderer();
00037 }
00038
00039 RenderStyleDeclarationImpl::~RenderStyleDeclarationImpl()
00040 {
00041 }
00042
00043
DOM::DOMString RenderStyleDeclarationImpl::cssText()
const
00044
{
00045
return DOMString();
00046 }
00047
00048
void RenderStyleDeclarationImpl::setCssText(
DOM::DOMString )
00049 {
00050
00051 }
00052
00053 CSSValueImpl *RenderStyleDeclarationImpl::getPropertyCSSValue(
int propertyID )
const
00054
{
00055 CSSPrimitiveValueImpl *val = 0;
00056
00057
switch( propertyID )
00058 {
00059
case CSS_PROP_BACKGROUND_COLOR:
00060 val =
new CSSPrimitiveValueImpl( m_renderer->style()->backgroundColor().rgb() );
00061
break;
00062
case CSS_PROP_BACKGROUND_IMAGE:
00063
break;
00064
case CSS_PROP_BACKGROUND_REPEAT:
00065
break;
00066
case CSS_PROP_BACKGROUND_ATTACHMENT:
00067
break;
00068
case CSS_PROP_BACKGROUND_POSITION:
00069
break;
00070
case CSS_PROP_BACKGROUND_POSITION_X:
00071
break;
00072
case CSS_PROP_BACKGROUND_POSITION_Y:
00073
break;
00074
case CSS_PROP_BORDER_COLLAPSE:
00075
break;
00076
case CSS_PROP_BORDER_SPACING:
00077
break;
00078
case CSS_PROP__KHTML_BORDER_HORIZONTAL_SPACING:
00079
break;
00080
case CSS_PROP__KHTML_BORDER_VERTICAL_SPACING:
00081
break;
00082
case CSS_PROP_BORDER_TOP_COLOR:
00083
break;
00084
case CSS_PROP_BORDER_RIGHT_COLOR:
00085
break;
00086
case CSS_PROP_BORDER_BOTTOM_COLOR:
00087
break;
00088
case CSS_PROP_BORDER_LEFT_COLOR:
00089
break;
00090
case CSS_PROP_BORDER_TOP_STYLE:
00091
break;
00092
case CSS_PROP_BORDER_RIGHT_STYLE:
00093
break;
00094
case CSS_PROP_BORDER_BOTTOM_STYLE:
00095
break;
00096
case CSS_PROP_BORDER_LEFT_STYLE:
00097
break;
00098
case CSS_PROP_BORDER_TOP_WIDTH:
00099 val =
new CSSPrimitiveValueImpl( m_renderer->borderTop(), CSSPrimitiveValue::CSS_PX );
00100
break;
00101
case CSS_PROP_BORDER_RIGHT_WIDTH:
00102 val =
new CSSPrimitiveValueImpl( m_renderer->borderRight(), CSSPrimitiveValue::CSS_PX );
00103
break;
00104
case CSS_PROP_BORDER_BOTTOM_WIDTH:
00105 val =
new CSSPrimitiveValueImpl( m_renderer->borderBottom(), CSSPrimitiveValue::CSS_PX );
00106
break;
00107
case CSS_PROP_BORDER_LEFT_WIDTH:
00108 val =
new CSSPrimitiveValueImpl( m_renderer->borderLeft(), CSSPrimitiveValue::CSS_PX );
00109
break;
00110
case CSS_PROP_BOTTOM:
00111
break;
00112
case CSS_PROP_CAPTION_SIDE:
00113
break;
00114
case CSS_PROP_CLEAR:
00115
break;
00116
case CSS_PROP_CLIP:
00117
break;
00118
case CSS_PROP_COLOR:
00119
break;
00120
case CSS_PROP_CONTENT:
00121
break;
00122
case CSS_PROP_COUNTER_INCREMENT:
00123
break;
00124
case CSS_PROP_COUNTER_RESET:
00125
break;
00126
case CSS_PROP_CURSOR:
00127
break;
00128
case CSS_PROP_DIRECTION:
00129
break;
00130
case CSS_PROP_DISPLAY:
00131
break;
00132
case CSS_PROP_EMPTY_CELLS:
00133
break;
00134
case CSS_PROP_FLOAT:
00135
break;
00136
case CSS_PROP_FONT_FAMILY:
00137
break;
00138
case CSS_PROP_FONT_SIZE:
00139
break;
00140
case CSS_PROP_FONT_STYLE:
00141
break;
00142
case CSS_PROP_FONT_VARIANT:
00143
break;
00144
case CSS_PROP_FONT_WEIGHT:
00145
break;
00146
case CSS_PROP_HEIGHT:
00147 val =
new CSSPrimitiveValueImpl( m_renderer->height(),
00148 CSSPrimitiveValue::CSS_PX );
00149
break;
00150
case CSS_PROP_LEFT:
00151
break;
00152
case CSS_PROP_LETTER_SPACING:
00153
break;
00154
case CSS_PROP_LINE_HEIGHT:
00155
break;
00156
case CSS_PROP_LIST_STYLE_IMAGE:
00157
break;
00158
case CSS_PROP_LIST_STYLE_POSITION:
00159
break;
00160
case CSS_PROP_LIST_STYLE_TYPE:
00161
break;
00162
case CSS_PROP_MARGIN_TOP:
00163
break;
00164
case CSS_PROP_MARGIN_RIGHT:
00165
break;
00166
case CSS_PROP_MARGIN_BOTTOM:
00167
break;
00168
case CSS_PROP_MARGIN_LEFT:
00169
break;
00170
case CSS_PROP_MAX_HEIGHT:
00171 val =
new CSSPrimitiveValueImpl( m_renderer->availableHeight(),
00172 CSSPrimitiveValue::CSS_PX );
00173
break;
00174
case CSS_PROP_MAX_WIDTH:
00175 val =
new CSSPrimitiveValueImpl( m_renderer->maxWidth(),
00176 CSSPrimitiveValue::CSS_PX );
00177
break;
00178
case CSS_PROP_MIN_HEIGHT:
00179 val =
new CSSPrimitiveValueImpl( m_renderer->contentHeight(),
00180 CSSPrimitiveValue::CSS_PX );
00181
break;
00182
case CSS_PROP_MIN_WIDTH:
00183 val =
new CSSPrimitiveValueImpl( m_renderer->minWidth(),
00184 CSSPrimitiveValue::CSS_PX );
00185
break;
00186
case CSS_PROP_ORPHANS:
00187
break;
00188
case CSS_PROP_OUTLINE_COLOR:
00189
break;
00190
case CSS_PROP_OUTLINE_STYLE:
00191
break;
00192
case CSS_PROP_OUTLINE_WIDTH:
00193
break;
00194
case CSS_PROP_OVERFLOW:
00195
break;
00196
case CSS_PROP_PADDING_TOP:
00197 val =
new CSSPrimitiveValueImpl( m_renderer->paddingTop(),
00198 CSSPrimitiveValue::CSS_PX );
00199
break;
00200
case CSS_PROP_PADDING_RIGHT:
00201 val =
new CSSPrimitiveValueImpl( m_renderer->paddingRight(),
00202 CSSPrimitiveValue::CSS_PX );
00203
break;
00204
case CSS_PROP_PADDING_BOTTOM:
00205 val =
new CSSPrimitiveValueImpl( m_renderer->paddingBottom(),
00206 CSSPrimitiveValue::CSS_PX );
00207
break;
00208
case CSS_PROP_PADDING_LEFT:
00209 val =
new CSSPrimitiveValueImpl( m_renderer->paddingLeft(),
00210 CSSPrimitiveValue::CSS_PX );
00211
break;
00212
case CSS_PROP_PAGE_BREAK_AFTER:
00213
break;
00214
case CSS_PROP_PAGE_BREAK_BEFORE:
00215
break;
00216
case CSS_PROP_PAGE_BREAK_INSIDE:
00217
break;
00218
case CSS_PROP_POSITION:
00219
break;
00220
case CSS_PROP_QUOTES:
00221
break;
00222
case CSS_PROP_RIGHT:
00223
break;
00224
case CSS_PROP_SIZE:
00225
break;
00226
case CSS_PROP_TABLE_LAYOUT:
00227
break;
00228
case CSS_PROP_TEXT_ALIGN:
00229
break;
00230
case CSS_PROP_TEXT_DECORATION:
00231
break;
00232
case CSS_PROP_TEXT_INDENT:
00233
break;
00234
case CSS_PROP_TEXT_TRANSFORM:
00235
break;
00236
case CSS_PROP_TOP:
00237
break;
00238
case CSS_PROP_UNICODE_BIDI:
00239
break;
00240
case CSS_PROP_VERTICAL_ALIGN:
00241
break;
00242
case CSS_PROP_VISIBILITY:
00243
break;
00244
case CSS_PROP_WHITE_SPACE:
00245
break;
00246
case CSS_PROP_WIDOWS:
00247
break;
00248
case CSS_PROP_WIDTH:
00249 val =
new CSSPrimitiveValueImpl( m_renderer->width(),
00250 CSSPrimitiveValue::CSS_PX );
00251
break;
00252
case CSS_PROP_WORD_SPACING:
00253
break;
00254
case CSS_PROP_Z_INDEX:
00255
break;
00256
case CSS_PROP_BACKGROUND:
00257
break;
00258
case CSS_PROP_BORDER:
00259
break;
00260
case CSS_PROP_BORDER_COLOR:
00261
break;
00262
case CSS_PROP_BORDER_STYLE:
00263
break;
00264
case CSS_PROP_BORDER_TOP:
00265 val =
new CSSPrimitiveValueImpl( m_renderer->borderTop(),
00266 CSSPrimitiveValue::CSS_PX );
00267
break;
00268
case CSS_PROP_BORDER_RIGHT:
00269 val =
new CSSPrimitiveValueImpl( m_renderer->borderRight(),
00270 CSSPrimitiveValue::CSS_PX );
00271
break;
00272
case CSS_PROP_BORDER_BOTTOM:
00273 val =
new CSSPrimitiveValueImpl( m_renderer->borderBottom(),
00274 CSSPrimitiveValue::CSS_PX );
00275
break;
00276
case CSS_PROP_BORDER_LEFT:
00277 val =
new CSSPrimitiveValueImpl( m_renderer->borderLeft(),
00278 CSSPrimitiveValue::CSS_PX );
00279
break;
00280
case CSS_PROP_BORDER_WIDTH:
00281
break;
00282
case CSS_PROP_FONT:
00283
break;
00284
case CSS_PROP_LIST_STYLE:
00285
break;
00286
case CSS_PROP_MARGIN:
00287
break;
00288
case CSS_PROP_OUTLINE:
00289
break;
00290
case CSS_PROP_PADDING:
00291
break;
00292
case CSS_PROP_SCROLLBAR_BASE_COLOR:
00293
break;
00294
case CSS_PROP_SCROLLBAR_FACE_COLOR:
00295
break;
00296
case CSS_PROP_SCROLLBAR_SHADOW_COLOR:
00297
break;
00298
case CSS_PROP_SCROLLBAR_HIGHLIGHT_COLOR:
00299
break;
00300
case CSS_PROP_SCROLLBAR_3DLIGHT_COLOR:
00301
break;
00302
case CSS_PROP_SCROLLBAR_DARKSHADOW_COLOR:
00303
break;
00304
case CSS_PROP_SCROLLBAR_TRACK_COLOR:
00305
break;
00306
case CSS_PROP_SCROLLBAR_ARROW_COLOR:
00307
break;
00308
case CSS_PROP__KHTML_FLOW_MODE:
00309
break;
00310
case CSS_PROP__KHTML_USER_INPUT:
00311
break;
00312
case CSS_PROP__KHTML_TEXT_DECORATION_COLOR:
00313
break;
00314
default:
00315 Q_ASSERT( 0 );
00316
break;
00317 }
00318
return val;
00319 }
00320
00321
DOMString RenderStyleDeclarationImpl::getPropertyValue(
int propertyID )
const
00322
{
00323 CSSProperty var = property( propertyID );
00324
DOMString str = var.cssText();
00325
return str;
00326 }
00327
00328
bool RenderStyleDeclarationImpl::getPropertyPriority(
int )
const
00329
{
00330
return false;
00331 }
00332
00333
DOM::DOMString RenderStyleDeclarationImpl::removeProperty(
int,
bool )
00334 {
00335
00336
return DOMString();
00337 }
00338
00339
bool RenderStyleDeclarationImpl::setProperty (
int,
const DOM::DOMString&,
bool,
00340
bool )
00341 {
00342
00343
return false;
00344 }
00345
00346
void RenderStyleDeclarationImpl::setProperty (
int,
int,
bool,
00347
bool )
00348 {
00349
00350 }
00351
00352
void RenderStyleDeclarationImpl::setLengthProperty(
int,
const DOM::DOMString&,
bool,
00353
bool,
bool )
00354 {
00355
00356 }
00357
00358
void RenderStyleDeclarationImpl::setProperty(
const DOMString& )
00359 {
00360
00361 }
00362
00363
DOM::DOMString RenderStyleDeclarationImpl::item(
unsigned long )
const
00364
{
00365
00366
return DOMString();
00367 }
00368
00369
00370 CSSProperty RenderStyleDeclarationImpl::property(
int id )
const
00371
{
00372 CSSProperty prop;
00373 prop.m_id =
id;
00374 prop.m_bImportant =
false;
00375 prop.nonCSSHint =
false;
00376
00377 CSSValueImpl* v = getPropertyCSSValue(
id );
00378
if ( !v )
00379 v =
new CSSPrimitiveValueImpl;
00380 prop.setValue( v );
00381
return prop;
00382 }