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 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
400 return; | 400 return; |
401 | 401 |
402 String itemText; | 402 String itemText; |
403 bool isOptionElement = element->hasTagName(optionTag); | 403 bool isOptionElement = element->hasTagName(optionTag); |
404 if (isOptionElement) | 404 if (isOptionElement) |
405 itemText = toHTMLOptionElement(element)->textIndentedToRespectGroupLabel
(); | 405 itemText = toHTMLOptionElement(element)->textIndentedToRespectGroupLabel
(); |
406 else if (isHTMLOptGroupElement(element)) | 406 else if (isHTMLOptGroupElement(element)) |
407 itemText = toHTMLOptGroupElement(element)->groupLabelText(); | 407 itemText = toHTMLOptGroupElement(element)->groupLabelText(); |
408 applyTextTransform(style(), itemText, ' '); | 408 applyTextTransform(style(), itemText, ' '); |
409 | 409 |
410 Color textColor = element->renderStyle() ? element->renderStyle()->visitedDe
pendentColor(CSSPropertyColor) : style()->visitedDependentColor(CSSPropertyColor
); | 410 Color textColor = element->renderStyle() ? resolveColor(element->renderStyle
(), CSSPropertyColor) : resolveColor(CSSPropertyColor); |
411 if (isOptionElement && toHTMLOptionElement(element)->selected()) { | 411 if (isOptionElement && toHTMLOptionElement(element)->selected()) { |
412 if (frame()->selection()->isFocusedAndActive() && document()->focusedEle
ment() == node()) | 412 if (frame()->selection()->isFocusedAndActive() && document()->focusedEle
ment() == node()) |
413 textColor = theme()->activeListBoxSelectionForegroundColor(); | 413 textColor = theme()->activeListBoxSelectionForegroundColor(); |
414 // Honor the foreground color for disabled items | 414 // Honor the foreground color for disabled items |
415 else if (!element->isDisabledFormControl() && !select->isDisabledFormCon
trol()) | 415 else if (!element->isDisabledFormControl() && !select->isDisabledFormCon
trol()) |
416 textColor = theme()->inactiveListBoxSelectionForegroundColor(); | 416 textColor = theme()->inactiveListBoxSelectionForegroundColor(); |
417 } | 417 } |
418 | 418 |
419 paintInfo.context->setFillColor(textColor); | 419 paintInfo.context->setFillColor(textColor); |
420 | 420 |
(...skipping 19 matching lines...) Expand all Loading... |
440 { | 440 { |
441 const Vector<HTMLElement*>& listItems = selectElement()->listItems(); | 441 const Vector<HTMLElement*>& listItems = selectElement()->listItems(); |
442 HTMLElement* element = listItems[listIndex]; | 442 HTMLElement* element = listItems[listIndex]; |
443 | 443 |
444 Color backColor; | 444 Color backColor; |
445 if (element->hasTagName(optionTag) && toHTMLOptionElement(element)->selected
()) { | 445 if (element->hasTagName(optionTag) && toHTMLOptionElement(element)->selected
()) { |
446 if (frame()->selection()->isFocusedAndActive() && document()->focusedEle
ment() == node()) | 446 if (frame()->selection()->isFocusedAndActive() && document()->focusedEle
ment() == node()) |
447 backColor = theme()->activeListBoxSelectionBackgroundColor(); | 447 backColor = theme()->activeListBoxSelectionBackgroundColor(); |
448 else | 448 else |
449 backColor = theme()->inactiveListBoxSelectionBackgroundColor(); | 449 backColor = theme()->inactiveListBoxSelectionBackgroundColor(); |
450 } else | 450 } else { |
451 backColor = element->renderStyle() ? element->renderStyle()->visitedDepe
ndentColor(CSSPropertyBackgroundColor) : style()->visitedDependentColor(CSSPrope
rtyBackgroundColor); | 451 backColor = element->renderStyle() ? resolveColor(element->renderStyle()
, CSSPropertyBackgroundColor) : resolveColor(CSSPropertyBackgroundColor); |
| 452 } |
452 | 453 |
453 // Draw the background for this list box item | 454 // Draw the background for this list box item |
454 if (!element->renderStyle() || element->renderStyle()->visibility() != HIDDE
N) { | 455 if (!element->renderStyle() || element->renderStyle()->visibility() != HIDDE
N) { |
455 LayoutRect itemRect = itemBoundingBoxRect(paintOffset, listIndex); | 456 LayoutRect itemRect = itemBoundingBoxRect(paintOffset, listIndex); |
456 itemRect.intersect(controlClipRect(paintOffset)); | 457 itemRect.intersect(controlClipRect(paintOffset)); |
457 paintInfo.context->fillRect(pixelSnappedIntRect(itemRect), backColor); | 458 paintInfo.context->fillRect(pixelSnappedIntRect(itemRect), backColor); |
458 } | 459 } |
459 } | 460 } |
460 | 461 |
461 bool RenderListBox::isPointInOverflowControl(HitTestResult& result, const Layout
Point& locationInContainer, const LayoutPoint& accumulatedOffset) | 462 bool RenderListBox::isPointInOverflowControl(HitTestResult& result, const Layout
Point& locationInContainer, const LayoutPoint& accumulatedOffset) |
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
888 | 889 |
889 if (m_vBar) | 890 if (m_vBar) |
890 m_vBar->styleChanged(); | 891 m_vBar->styleChanged(); |
891 | 892 |
892 // Force an update since we know the scrollbars have changed things. | 893 // Force an update since we know the scrollbars have changed things. |
893 if (document()->hasAnnotatedRegions()) | 894 if (document()->hasAnnotatedRegions()) |
894 document()->setAnnotatedRegionsDirty(true); | 895 document()->setAnnotatedRegionsDirty(true); |
895 } | 896 } |
896 | 897 |
897 } // namespace WebCore | 898 } // namespace WebCore |
OLD | NEW |