Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(34)

Side by Side Diff: Source/core/rendering/RenderThemeChromiumDefault.cpp

Issue 19697011: Change rendering code to use RenderObject::resolveColor (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/rendering/RenderTheme.cpp ('k') | Source/core/rendering/RenderTreeAsText.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007 Apple Inc. 2 * Copyright (C) 2007 Apple Inc.
3 * Copyright (C) 2007 Alp Toker <alp@atoker.com> 3 * Copyright (C) 2007 Alp Toker <alp@atoker.com>
4 * Copyright (C) 2008 Collabora Ltd. 4 * Copyright (C) 2008 Collabora Ltd.
5 * Copyright (C) 2008, 2009 Google Inc. 5 * Copyright (C) 2008, 2009 Google Inc.
6 * Copyright (C) 2009 Kenneth Rohde Christiansen 6 * Copyright (C) 2009 Kenneth Rohde Christiansen
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 setSizeIfAuto(style, size); 265 setSizeIfAuto(style, size);
266 } 266 }
267 267
268 bool RenderThemeChromiumDefault::paintButton(RenderObject* o, const PaintInfo& i , const IntRect& rect) 268 bool RenderThemeChromiumDefault::paintButton(RenderObject* o, const PaintInfo& i , const IntRect& rect)
269 { 269 {
270 WebKit::WebThemeEngine::ExtraParams extraParams; 270 WebKit::WebThemeEngine::ExtraParams extraParams;
271 WebKit::WebCanvas* canvas = i.context->canvas(); 271 WebKit::WebCanvas* canvas = i.context->canvas();
272 extraParams.button.hasBorder = true; 272 extraParams.button.hasBorder = true;
273 extraParams.button.backgroundColor = defaultButtonBackgroundColor; 273 extraParams.button.backgroundColor = defaultButtonBackgroundColor;
274 if (o->hasBackground()) 274 if (o->hasBackground())
275 extraParams.button.backgroundColor = o->style()->visitedDependentColor(C SSPropertyBackgroundColor).rgb(); 275 extraParams.button.backgroundColor = o->resolveColor(CSSPropertyBackgrou ndColor).rgb();
276 276
277 WebKit::Platform::current()->themeEngine()->paint(canvas, WebKit::WebThemeEn gine::PartButton, getWebThemeState(this, o), WebKit::WebRect(rect), &extraParams ); 277 WebKit::Platform::current()->themeEngine()->paint(canvas, WebKit::WebThemeEn gine::PartButton, getWebThemeState(this, o), WebKit::WebRect(rect), &extraParams );
278 return false; 278 return false;
279 } 279 }
280 280
281 bool RenderThemeChromiumDefault::paintTextField(RenderObject* o, const PaintInfo & i, const IntRect& rect) 281 bool RenderThemeChromiumDefault::paintTextField(RenderObject* o, const PaintInfo & i, const IntRect& rect)
282 { 282 {
283 // WebThemeEngine does not handle border rounded corner and background image 283 // WebThemeEngine does not handle border rounded corner and background image
284 // so return true to draw CSS border and background. 284 // so return true to draw CSS border and background.
285 if (o->style()->hasBorderRadius() || o->style()->hasBackgroundImage()) 285 if (o->style()->hasBorderRadius() || o->style()->hasBackgroundImage())
286 return true; 286 return true;
287 287
288 ControlPart part = o->style()->appearance(); 288 ControlPart part = o->style()->appearance();
289 289
290 WebKit::WebThemeEngine::ExtraParams extraParams; 290 WebKit::WebThemeEngine::ExtraParams extraParams;
291 extraParams.textField.isTextArea = part == TextAreaPart; 291 extraParams.textField.isTextArea = part == TextAreaPart;
292 extraParams.textField.isListbox = part == ListboxPart; 292 extraParams.textField.isListbox = part == ListboxPart;
293 293
294 WebKit::WebCanvas* canvas = i.context->canvas(); 294 WebKit::WebCanvas* canvas = i.context->canvas();
295 295
296 // Fallback to white if the specified color object is invalid. 296 // Fallback to white if the specified color object is invalid.
297 Color backgroundColor(Color::white); 297 Color backgroundColor = o->resolveColor(CSSPropertyBackgroundColor, Color::w hite);
298 if (o->style()->visitedDependentColor(CSSPropertyBackgroundColor).isValid())
299 backgroundColor = o->style()->visitedDependentColor(CSSPropertyBackgroun dColor);
300 extraParams.textField.backgroundColor = backgroundColor.rgb(); 298 extraParams.textField.backgroundColor = backgroundColor.rgb();
301 299
302 WebKit::Platform::current()->themeEngine()->paint(canvas, WebKit::WebThemeEn gine::PartTextField, getWebThemeState(this, o), WebKit::WebRect(rect), &extraPar ams); 300 WebKit::Platform::current()->themeEngine()->paint(canvas, WebKit::WebThemeEn gine::PartTextField, getWebThemeState(this, o), WebKit::WebRect(rect), &extraPar ams);
303 return false; 301 return false;
304 } 302 }
305 303
306 bool RenderThemeChromiumDefault::paintMenuList(RenderObject* o, const PaintInfo& i, const IntRect& rect) 304 bool RenderThemeChromiumDefault::paintMenuList(RenderObject* o, const PaintInfo& i, const IntRect& rect)
307 { 305 {
308 if (!o->isBox()) 306 if (!o->isBox())
309 return false; 307 return false;
310 308
311 const int right = rect.x() + rect.width(); 309 const int right = rect.x() + rect.width();
312 const int middle = rect.y() + rect.height() / 2; 310 const int middle = rect.y() + rect.height() / 2;
313 311
314 WebKit::WebThemeEngine::ExtraParams extraParams; 312 WebKit::WebThemeEngine::ExtraParams extraParams;
315 extraParams.menuList.arrowX = (o->style()->direction() == RTL) ? rect.x() + 7 : right - 13; 313 extraParams.menuList.arrowX = (o->style()->direction() == RTL) ? rect.x() + 7 : right - 13;
316 extraParams.menuList.arrowY = middle; 314 extraParams.menuList.arrowY = middle;
317 const RenderBox* box = toRenderBox(o); 315 const RenderBox* box = toRenderBox(o);
318 // Match Chromium Win behaviour of showing all borders if any are shown. 316 // Match Chromium Win behaviour of showing all borders if any are shown.
319 extraParams.menuList.hasBorder = box->borderRight() || box->borderLeft() || box->borderTop() || box->borderBottom(); 317 extraParams.menuList.hasBorder = box->borderRight() || box->borderLeft() || box->borderTop() || box->borderBottom();
320 extraParams.menuList.hasBorderRadius = o->style()->hasBorderRadius(); 318 extraParams.menuList.hasBorderRadius = o->style()->hasBorderRadius();
321 // Fallback to transparent if the specified color object is invalid. 319 // Fallback to transparent if the specified color object is invalid.
322 extraParams.menuList.backgroundColor = Color::transparent; 320 extraParams.menuList.backgroundColor = Color::transparent;
323 if (o->hasBackground()) 321 if (o->hasBackground())
324 extraParams.menuList.backgroundColor = o->style()->visitedDependentColor (CSSPropertyBackgroundColor).rgb(); 322 extraParams.menuList.backgroundColor = o->resolveColor(CSSPropertyBackgr oundColor).rgb();
325 323
326 WebKit::WebCanvas* canvas = i.context->canvas(); 324 WebKit::WebCanvas* canvas = i.context->canvas();
327 325
328 WebKit::Platform::current()->themeEngine()->paint(canvas, WebKit::WebThemeEn gine::PartMenuList, getWebThemeState(this, o), WebKit::WebRect(rect), &extraPara ms); 326 WebKit::Platform::current()->themeEngine()->paint(canvas, WebKit::WebThemeEn gine::PartMenuList, getWebThemeState(this, o), WebKit::WebRect(rect), &extraPara ms);
329 return false; 327 return false;
330 } 328 }
331 329
332 bool RenderThemeChromiumDefault::paintSliderTrack(RenderObject* o, const PaintIn fo& i, const IntRect& rect) 330 bool RenderThemeChromiumDefault::paintSliderTrack(RenderObject* o, const PaintIn fo& i, const IntRect& rect)
333 { 331 {
334 WebKit::WebThemeEngine::ExtraParams extraParams; 332 WebKit::WebThemeEngine::ExtraParams extraParams;
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 WebKit::Platform::current()->themeEngine()->paint(canvas, WebKit::WebThemeEn gine::PartProgressBar, getWebThemeState(this, o), WebKit::WebRect(rect), &extraP arams); 412 WebKit::Platform::current()->themeEngine()->paint(canvas, WebKit::WebThemeEn gine::PartProgressBar, getWebThemeState(this, o), WebKit::WebRect(rect), &extraP arams);
415 return false; 413 return false;
416 } 414 }
417 415
418 bool RenderThemeChromiumDefault::shouldOpenPickerWithF4Key() const 416 bool RenderThemeChromiumDefault::shouldOpenPickerWithF4Key() const
419 { 417 {
420 return true; 418 return true;
421 } 419 }
422 420
423 } // namespace WebCore 421 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderTheme.cpp ('k') | Source/core/rendering/RenderTreeAsText.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698