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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 HTMLElement* element = listItems[i]; | 121 HTMLElement* element = listItems[i]; |
122 String text; | 122 String text; |
123 Font itemFont = style()->font(); | 123 Font itemFont = style()->font(); |
124 if (element->hasTagName(optionTag)) { | 124 if (element->hasTagName(optionTag)) { |
125 text = toHTMLOptionElement(element)->textIndentedToRespectGroupL
abel(); | 125 text = toHTMLOptionElement(element)->textIndentedToRespectGroupL
abel(); |
126 } else if (isHTMLOptGroupElement(element)) { | 126 } else if (isHTMLOptGroupElement(element)) { |
127 text = toHTMLOptGroupElement(element)->groupLabelText(); | 127 text = toHTMLOptGroupElement(element)->groupLabelText(); |
128 FontDescription d = itemFont.fontDescription(); | 128 FontDescription d = itemFont.fontDescription(); |
129 d.setWeight(d.bolderWeight()); | 129 d.setWeight(d.bolderWeight()); |
130 itemFont = Font(d, itemFont.letterSpacing(), itemFont.wordSpacin
g()); | 130 itemFont = Font(d, itemFont.letterSpacing(), itemFont.wordSpacin
g()); |
131 itemFont.update(document().ensureStyleResolver().fontSelector())
; | 131 itemFont.update(document().styleEngine()->fontSelector()); |
132 } | 132 } |
133 | 133 |
134 if (!text.isEmpty()) { | 134 if (!text.isEmpty()) { |
135 applyTextTransform(style(), text, ' '); | 135 applyTextTransform(style(), text, ' '); |
136 // FIXME: Why is this always LTR? Can't text direction affect th
e width? | 136 // FIXME: Why is this always LTR? Can't text direction affect th
e width? |
137 TextRun textRun = constructTextRun(this, itemFont, text, style()
, TextRun::AllowTrailingExpansion); | 137 TextRun textRun = constructTextRun(this, itemFont, text, style()
, TextRun::AllowTrailingExpansion); |
138 textRun.disableRoundingHacks(); | 138 textRun.disableRoundingHacks(); |
139 float textWidth = itemFont.width(textRun); | 139 float textWidth = itemFont.width(textRun); |
140 width = max(width, textWidth); | 140 width = max(width, textWidth); |
141 } | 141 } |
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
426 | 426 |
427 TextRun textRun(itemText, 0, 0, TextRun::AllowTrailingExpansion, itemStyle->
direction(), isOverride(itemStyle->unicodeBidi()), true, TextRun::NoRounding); | 427 TextRun textRun(itemText, 0, 0, TextRun::AllowTrailingExpansion, itemStyle->
direction(), isOverride(itemStyle->unicodeBidi()), true, TextRun::NoRounding); |
428 Font itemFont = style()->font(); | 428 Font itemFont = style()->font(); |
429 LayoutRect r = itemBoundingBoxRect(paintOffset, listIndex); | 429 LayoutRect r = itemBoundingBoxRect(paintOffset, listIndex); |
430 r.move(itemOffsetForAlignment(textRun, itemStyle, itemFont, r)); | 430 r.move(itemOffsetForAlignment(textRun, itemStyle, itemFont, r)); |
431 | 431 |
432 if (isHTMLOptGroupElement(element)) { | 432 if (isHTMLOptGroupElement(element)) { |
433 FontDescription d = itemFont.fontDescription(); | 433 FontDescription d = itemFont.fontDescription(); |
434 d.setWeight(d.bolderWeight()); | 434 d.setWeight(d.bolderWeight()); |
435 itemFont = Font(d, itemFont.letterSpacing(), itemFont.wordSpacing()); | 435 itemFont = Font(d, itemFont.letterSpacing(), itemFont.wordSpacing()); |
436 itemFont.update(document().ensureStyleResolver().fontSelector()); | 436 itemFont.update(document().styleEngine()->fontSelector()); |
437 } | 437 } |
438 | 438 |
439 // Draw the item text | 439 // Draw the item text |
440 TextRunPaintInfo textRunPaintInfo(textRun); | 440 TextRunPaintInfo textRunPaintInfo(textRun); |
441 textRunPaintInfo.bounds = r; | 441 textRunPaintInfo.bounds = r; |
442 paintInfo.context->drawBidiText(itemFont, textRunPaintInfo, roundedIntPoint(
r.location())); | 442 paintInfo.context->drawBidiText(itemFont, textRunPaintInfo, roundedIntPoint(
r.location())); |
443 } | 443 } |
444 | 444 |
445 void RenderListBox::paintItemBackground(PaintInfo& paintInfo, const LayoutPoint&
paintOffset, int listIndex) | 445 void RenderListBox::paintItemBackground(PaintInfo& paintInfo, const LayoutPoint&
paintOffset, int listIndex) |
446 { | 446 { |
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
925 | 925 |
926 if (m_vBar) | 926 if (m_vBar) |
927 m_vBar->styleChanged(); | 927 m_vBar->styleChanged(); |
928 | 928 |
929 // Force an update since we know the scrollbars have changed things. | 929 // Force an update since we know the scrollbars have changed things. |
930 if (document().hasAnnotatedRegions()) | 930 if (document().hasAnnotatedRegions()) |
931 document().setAnnotatedRegionsDirty(true); | 931 document().setAnnotatedRegionsDirty(true); |
932 } | 932 } |
933 | 933 |
934 } // namespace WebCore | 934 } // namespace WebCore |
OLD | NEW |