| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2008, 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008, 2011 Apple Inc. All rights reserved. |
| 3 * 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) | 3 * 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * | 8 * |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 419 | 419 |
| 420 String itemText; | 420 String itemText; |
| 421 bool isOptionElement = isHTMLOptionElement(*element); | 421 bool isOptionElement = isHTMLOptionElement(*element); |
| 422 if (isOptionElement) | 422 if (isOptionElement) |
| 423 itemText = toHTMLOptionElement(*element).textIndentedToRespectGroupLabel
(); | 423 itemText = toHTMLOptionElement(*element).textIndentedToRespectGroupLabel
(); |
| 424 else if (isHTMLOptGroupElement(*element)) | 424 else if (isHTMLOptGroupElement(*element)) |
| 425 itemText = toHTMLOptGroupElement(*element).groupLabelText(); | 425 itemText = toHTMLOptGroupElement(*element).groupLabelText(); |
| 426 applyTextTransform(style(), itemText, ' '); | 426 applyTextTransform(style(), itemText, ' '); |
| 427 | 427 |
| 428 Color textColor = element->renderStyle() ? resolveColor(element->renderStyle
(), CSSPropertyColor) : resolveColor(CSSPropertyColor); | 428 Color textColor = element->renderStyle() ? resolveColor(element->renderStyle
(), CSSPropertyColor) : resolveColor(CSSPropertyColor); |
| 429 if (isOptionElement && toHTMLOptionElement(*element).selected()) { | 429 if (isOptionElement && ((toHTMLOptionElement(*element).selected() && select-
>suggestedIndex() < 0) || listIndex == select->suggestedIndex())) { |
| 430 if (frame()->selection().isFocusedAndActive() && document().focusedEleme
nt() == node()) | 430 if (frame()->selection().isFocusedAndActive() && document().focusedEleme
nt() == node()) |
| 431 textColor = RenderTheme::theme().activeListBoxSelectionForegroundCol
or(); | 431 textColor = RenderTheme::theme().activeListBoxSelectionForegroundCol
or(); |
| 432 // Honor the foreground color for disabled items | 432 // Honor the foreground color for disabled items |
| 433 else if (!element->isDisabledFormControl() && !select->isDisabledFormCon
trol()) | 433 else if (!element->isDisabledFormControl() && !select->isDisabledFormCon
trol()) |
| 434 textColor = RenderTheme::theme().inactiveListBoxSelectionForegroundC
olor(); | 434 textColor = RenderTheme::theme().inactiveListBoxSelectionForegroundC
olor(); |
| 435 } | 435 } |
| 436 | 436 |
| 437 paintInfo.context->setFillColor(textColor); | 437 paintInfo.context->setFillColor(textColor); |
| 438 | 438 |
| 439 TextRun textRun(itemText, 0, 0, TextRun::AllowTrailingExpansion, itemStyle->
direction(), isOverride(itemStyle->unicodeBidi()), true, TextRun::NoRounding); | 439 TextRun textRun(itemText, 0, 0, TextRun::AllowTrailingExpansion, itemStyle->
direction(), isOverride(itemStyle->unicodeBidi()), true, TextRun::NoRounding); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 453 textRunPaintInfo.bounds = r; | 453 textRunPaintInfo.bounds = r; |
| 454 paintInfo.context->drawBidiText(itemFont, textRunPaintInfo, roundedIntPoint(
r.location())); | 454 paintInfo.context->drawBidiText(itemFont, textRunPaintInfo, roundedIntPoint(
r.location())); |
| 455 } | 455 } |
| 456 | 456 |
| 457 void RenderListBox::paintItemBackground(PaintInfo& paintInfo, const LayoutPoint&
paintOffset, int listIndex) | 457 void RenderListBox::paintItemBackground(PaintInfo& paintInfo, const LayoutPoint&
paintOffset, int listIndex) |
| 458 { | 458 { |
| 459 const Vector<HTMLElement*>& listItems = selectElement()->listItems(); | 459 const Vector<HTMLElement*>& listItems = selectElement()->listItems(); |
| 460 HTMLElement* element = listItems[listIndex]; | 460 HTMLElement* element = listItems[listIndex]; |
| 461 | 461 |
| 462 Color backColor; | 462 Color backColor; |
| 463 if (isHTMLOptionElement(*element) && toHTMLOptionElement(*element).selected(
)) { | 463 if (isHTMLOptionElement(*element) && ((toHTMLOptionElement(*element).selecte
d() && selectElement()->suggestedIndex() < 0) || listIndex == selectElement()->s
uggestedIndex())) { |
| 464 if (frame()->selection().isFocusedAndActive() && document().focusedEleme
nt() == node()) | 464 if (frame()->selection().isFocusedAndActive() && document().focusedEleme
nt() == node()) |
| 465 backColor = RenderTheme::theme().activeListBoxSelectionBackgroundCol
or(); | 465 backColor = RenderTheme::theme().activeListBoxSelectionBackgroundCol
or(); |
| 466 else | 466 else |
| 467 backColor = RenderTheme::theme().inactiveListBoxSelectionBackgroundC
olor(); | 467 backColor = RenderTheme::theme().inactiveListBoxSelectionBackgroundC
olor(); |
| 468 } else { | 468 } else { |
| 469 backColor = element->renderStyle() ? resolveColor(element->renderStyle()
, CSSPropertyBackgroundColor) : resolveColor(CSSPropertyBackgroundColor); | 469 backColor = element->renderStyle() ? resolveColor(element->renderStyle()
, CSSPropertyBackgroundColor) : resolveColor(CSSPropertyBackgroundColor); |
| 470 } | 470 } |
| 471 | 471 |
| 472 // Draw the background for this list box item | 472 // Draw the background for this list box item |
| 473 if (!element->renderStyle() || element->renderStyle()->visibility() != HIDDE
N) { | 473 if (!element->renderStyle() || element->renderStyle()->visibility() != HIDDE
N) { |
| (...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 950 | 950 |
| 951 if (m_vBar) | 951 if (m_vBar) |
| 952 m_vBar->styleChanged(); | 952 m_vBar->styleChanged(); |
| 953 | 953 |
| 954 // Force an update since we know the scrollbars have changed things. | 954 // Force an update since we know the scrollbars have changed things. |
| 955 if (document().hasAnnotatedRegions()) | 955 if (document().hasAnnotatedRegions()) |
| 956 document().setAnnotatedRegionsDirty(true); | 956 document().setAnnotatedRegionsDirty(true); |
| 957 } | 957 } |
| 958 | 958 |
| 959 } // namespace WebCore | 959 } // namespace WebCore |
| OLD | NEW |