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

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

Issue 87503003: Moving fontSelector from StyleResolver to StyleEngine. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years 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
OLDNEW
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
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
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
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
OLDNEW
« no previous file with comments | « Source/core/html/canvas/CanvasRenderingContext2D.cpp ('k') | Source/core/rendering/RenderMenuList.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698