LayoutTests/ChangeLog

 12011-10-06 Ben Wells <benwells@chromium.org>
 2
 3 CSS text-transform should apply to select elements
 4 https://bugs.webkit.org/show_bug.cgi?id=69503
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 * fast/css/text-transform-select-expected.txt: Added.
 9 * fast/css/text-transform-select.html: Added.
 10 * platform/chromium-linux/fast/css/text-transform-select-expected.png: Added.
 11 * platform/chromium/test_expectations.txt:
 12
1132011-10-04 Scott Graham <scottmg@chromium.org>
214
315 occasional crash in Chromium in dispatching keyEvent

LayoutTests/fast/css/text-transform-select-expected.txt

 1layer at (0,0) size 800x600
 2 RenderView at (0,0) size 800x600
 3layer at (0,0) size 800x474
 4 RenderBlock {HTML} at (0,0) size 800x474
 5 RenderBody {BODY} at (8,8) size 784x458
 6 RenderBlock (anonymous) at (0,0) size 784x20
 7 RenderText {#text} at (0,0) size 619x19
 8 text run at (0,0) width 619: "The text in the button, popup menu and list box should have the same case as in the accompanying text."
 9 RenderBlock {DIV} at (0,20) size 784x73
 10 RenderMenuList {SELECT} at (2,51) size 73x20 [bgcolor=#DDDDDD] [border: (1px solid #000000)]
 11 RenderBlock (anonymous) at (1,1) size 71x18
 12 RenderText at (4,1) size 42x16
 13 text run at (4,1) width 42: "HELLO"
 14 RenderText {#text} at (77,51) size 4x19
 15 text run at (77,51) width 4: " "
 16 RenderListBox {SELECT} at (83,2) size 69x69 [bgcolor=#DDDDDD] [border: (1px inset #808080)]
 17 RenderText {#text} at (154,51) size 4x19
 18 text run at (154,51) width 4: " "
 19 RenderInline {SPAN} at (0,0) size 111x19
 20 RenderText {#text} at (158,51) size 111x19
 21 text run at (158,51) width 111: "HELLO WORLD"
 22 RenderText {#text} at (0,0) size 0x0
 23 RenderBlock {DIV} at (0,93) size 784x73
 24 RenderMenuList {SELECT} at (2,51) size 68x20 [bgcolor=#DDDDDD] [border: (1px solid #000000)]
 25 RenderBlock (anonymous) at (1,1) size 66x18
 26 RenderText at (4,1) size 37x16
 27 text run at (4,1) width 37: "HeLLo"
 28 RenderText {#text} at (72,51) size 4x19
 29 text run at (72,51) width 4: " "
 30 RenderListBox {SELECT} at (78,2) size 64x69 [bgcolor=#DDDDDD] [border: (1px inset #808080)]
 31 RenderText {#text} at (144,51) size 4x19
 32 text run at (144,51) width 4: " "
 33 RenderInline {SPAN} at (0,0) size 98x19
 34 RenderText {#text} at (148,51) size 98x19
 35 text run at (148,51) width 98: "HeLLo WoRLd"
 36 RenderText {#text} at (0,0) size 0x0
 37 RenderBlock {DIV} at (0,166) size 784x73
 38 RenderMenuList {SELECT} at (2,51) size 55x20 [bgcolor=#DDDDDD] [border: (1px solid #000000)]
 39 RenderBlock (anonymous) at (1,1) size 53x18
 40 RenderText at (4,1) size 27x16
 41 text run at (4,1) width 27: "hello"
 42 RenderText {#text} at (59,51) size 4x19
 43 text run at (59,51) width 4: " "
 44 RenderListBox {SELECT} at (65,2) size 51x69 [bgcolor=#DDDDDD] [border: (1px inset #808080)]
 45 RenderText {#text} at (118,51) size 4x19
 46 text run at (118,51) width 4: " "
 47 RenderInline {SPAN} at (0,0) size 67x19
 48 RenderText {#text} at (122,51) size 67x19
 49 text run at (122,51) width 67: "hello world"
 50 RenderText {#text} at (0,0) size 0x0
 51 RenderBlock {DIV} at (0,239) size 784x73
 52 RenderMenuList {SELECT} at (2,51) size 61x20 [bgcolor=#DDDDDD] [border: (1px solid #000000)]
 53 RenderBlock (anonymous) at (1,1) size 59x18
 54 RenderText at (4,1) size 18x16
 55 text run at (4,1) width 18: "SS"
 56 RenderText {#text} at (65,51) size 4x19
 57 text run at (65,51) width 4: " "
 58 RenderListBox {SELECT} at (71,2) size 57x69 [bgcolor=#DDDDDD] [border: (1px inset #808080)]
 59 RenderText {#text} at (130,51) size 4x19
 60 text run at (130,51) width 4: " "
 61 RenderInline {SPAN} at (0,0) size 58x19
 62 RenderText {#text} at (134,51) size 58x19
 63 text run at (134,51) width 58: "SS SSSS"
 64 RenderText {#text} at (0,0) size 0x0
 65 RenderBlock {DIV} at (0,312) size 784x73
 66 RenderMenuList {SELECT} at (2,51) size 43x20 [bgcolor=#DDDDDD] [border: (1px solid #000000)]
 67 RenderBlock (anonymous) at (1,1) size 41x18
 68 RenderText at (4,1) size 9x16
 69 text run at (4,1) width 9: "\x{DF}"
 70 RenderText {#text} at (47,51) size 4x19
 71 text run at (47,51) width 4: " "
 72 RenderListBox {SELECT} at (53,2) size 39x69 [bgcolor=#DDDDDD] [border: (1px inset #808080)]
 73 RenderText {#text} at (94,51) size 4x19
 74 text run at (94,51) width 4: " "
 75 RenderInline {SPAN} at (0,0) size 28x19
 76 RenderText {#text} at (98,51) size 28x19
 77 text run at (98,51) width 28: "\x{DF} \x{DF}\x{DF}"
 78 RenderText {#text} at (0,0) size 0x0
 79 RenderBlock {DIV} at (0,385) size 784x73
 80 RenderMenuList {SELECT} at (2,51) size 43x20 [bgcolor=#DDDDDD] [border: (1px solid #000000)]
 81 RenderBlock (anonymous) at (1,1) size 41x18
 82 RenderText at (4,1) size 9x16
 83 text run at (4,1) width 9: "\x{DF}"
 84 RenderText {#text} at (47,51) size 4x19
 85 text run at (47,51) width 4: " "
 86 RenderListBox {SELECT} at (53,2) size 39x69 [bgcolor=#DDDDDD] [border: (1px inset #808080)]
 87 RenderText {#text} at (94,51) size 4x19
 88 text run at (94,51) width 4: " "
 89 RenderInline {SPAN} at (0,0) size 28x19
 90 RenderText {#text} at (98,51) size 28x19
 91 text run at (98,51) width 28: "\x{DF} \x{DF}\x{DF}"
 92 RenderText {#text} at (0,0) size 0x0

LayoutTests/fast/css/text-transform-select.html

 1<!doctype html>
 2<html>
 3<meta charset="iso-8859-1">
 4<head>
 5<style>
 6 .upper * { text-transform: uppercase; }
 7 .capitalized * { text-transform: capitalize; }
 8 .lower * { text-transform: lowercase; }
 9</style>
 10</head>
 11<body>
 12The text in the button, popup menu and list box should have the same case as in the
 13accompanying text.
 14<div class="upper">
 15<select><option>heLLo</option><option>woRLd</option></select>
 16<select multiple="true"><option>heLLo</option><option>woRLd</option></select>
 17<span>heLLo woRLd</span>
 18</div>
 19<div class="capitalized">
 20<select><option>heLLo</option><option>woRLd</option></select>
 21<select multiple="true"><option>heLLo</option><option>woRLd</option></select>
 22<span>heLLo woRLd</span>
 23</div>
 24<div class="lower">
 25<select><option>heLLo</option><option>woRLd</option></select>
 26<select multiple="true"><option>heLLo</option><option>woRLd</option></select>
 27<span>heLLo woRLd</span>
 28</div>
 29<div class="upper">
 30<select><option></option><option></option></select>
 31<select multiple="true"><option></option><option></option></select>
 32<span> </span>
 33</div>
 34<div class="capitalized">
 35<select><option></option><option></option></select>
 36<select multiple="true"><option></option><option></option></select>
 37<span> </span>
 38</div>
 39<div class="lower">
 40<select><option></option><option></option></select>
 41<select multiple="true"><option></option><option></option></select>
 42<span> </span>
 43</div>
 44</body>
 45</html>

LayoutTests/platform/chromium-linux/fast/css/text-transform-select-expected.png


Added

71ed938c12e21e94857288375fd7ed2c

LayoutTests/platform/chromium/test_expectations.txt

@@BUG_KEISHI : editing/style/non-inheritable-styles.html = FAIL PASS TEXT
36173617
36183618BUGWK68372 SNOWLEOPARD : svg/animations/svglength-animation-px-to-exs.html = PASS CRASH
36193619
 3620// New tests for webkit bug 69503. Should be rebaselined once fixed.
 3621BUGWK69503 MAC WIN : fast/css/text-transform-select.html = IMAGE
 3622
36203623// Tests that are known to fail on Mac10.6 with CPU-Skia graphics.
36213624BUGWK68436 SNOWLEOPARD CPU : fast/events/constructors/progress-event-constructor.html = TEXT
36223625BUGWK68436 SNOWLEOPARD CPU DEBUG : fast/repaint/background-clip-text.html = TIMEOUT

Source/WebCore/ChangeLog

 12011-10-06 Ben Wells <benwells@chromium.org>
 2
 3 CSS text-transform should apply to select elements
 4 https://bugs.webkit.org/show_bug.cgi?id=69503
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 Select elements are drawn in two ways depending on whether they are multiple and what their size is.
 9 Neither method previously handled text-transforms. Both of these rendering styles are now updated to transform
 10 their text correctly.
 11
 12 Test: fast/css/text-transform-select.html
 13
 14 * rendering/RenderListBox.cpp:
 15 (WebCore::RenderListBox::updateFromElement):
 16 (WebCore::RenderListBox::paintItemForeground):
 17 * rendering/RenderMenuList.cpp:
 18 (WebCore::RenderMenuList::updateOptionsWidth):
 19 (WebCore::RenderMenuList::setText):
 20 (WebCore::RenderMenuList::itemText):
 21 * rendering/RenderText.cpp:
 22 (WebCore::makeCapitalized):
 23 (WebCore::applyTextTransform):
 24 (WebCore::RenderText::setTextInternal):
 25 (WebCore::RenderText::textWithoutTranscoding):
 26 * rendering/RenderText.h:
 27
1282011-10-04 James Robinson <jamesr@chromium.org>
229
330 [chromium] Extract scheduling logic from CCThreadProxy to its own class

Source/WebCore/rendering/RenderListBox.cpp

5151#include "PaintInfo.h"
5252#include "RenderLayer.h"
5353#include "RenderScrollbar.h"
 54#include "RenderText.h"
5455#include "RenderTheme.h"
5556#include "RenderView.h"
5657#include "Scrollbar.h"

@@void RenderListBox::updateFromElement()
121122 }
122123
123124 if (!text.isEmpty()) {
 125 applyTextTransform(style(), text, ' ');
124126 // FIXME: Why is this always LTR? Can't text direction affect the width?
125127 TextRun textRun = constructTextRun(this, itemFont, text, style(), TextRun::AllowTrailingExpansion);
126128 textRun.disableRoundingHacks();

@@void RenderListBox::paintItemForeground(PaintInfo& paintInfo, const LayoutPoint&
382384 itemText = optionElement->textIndentedToRespectGroupLabel();
383385 else if (OptionGroupElement* optionGroupElement = toOptionGroupElement(element))
384386 itemText = optionGroupElement->groupLabelText();
385 
 387 applyTextTransform(style(), itemText, ' ');
 388
386389 Color textColor = element->renderStyle() ? element->renderStyle()->visitedDependentColor(CSSPropertyColor) : style()->visitedDependentColor(CSSPropertyColor);
387390 if (optionElement && optionElement->selected()) {
388391 if (frame()->selection()->isFocusedAndActive() && document()->focusedNode() == node())

Source/WebCore/rendering/RenderMenuList.cpp

@@void RenderMenuList::updateOptionsWidth()
154154 continue;
155155
156156 String text = optionElement->textIndentedToRespectGroupLabel();
 157 applyTextTransform(style(), text, ' ');
157158 if (theme()->popupOptionSupportsTextIndent()) {
158159 // Add in the option's text indent. We can't calculate percentage values for now.
159160 float optionWidth = 0;

@@void RenderMenuList::setText(const String& s)
220221 }
221222 } else {
222223 if (m_buttonText && !m_buttonText->isBR())
223  m_buttonText->setText(s.impl());
 224 m_buttonText->setText(s.impl(), true);
224225 else {
225226 if (m_buttonText)
226227 m_buttonText->destroy();

@@String RenderMenuList::itemText(unsigned listIndex) const
372373 const Vector<Element*>& listItems = select->listItems();
373374 if (listIndex >= listItems.size())
374375 return String();
 376
 377 String itemString;
375378 Element* element = listItems[listIndex];
376379 if (OptionGroupElement* optionGroupElement = toOptionGroupElement(element))
377  return optionGroupElement->groupLabelText();
 380 itemString = optionGroupElement->groupLabelText();
378381 else if (OptionElement* optionElement = toOptionElement(element))
379  return optionElement->textIndentedToRespectGroupLabel();
380  return String();
 382 itemString = optionElement->textIndentedToRespectGroupLabel();
 383 applyTextTransform(style(), itemString, ' ');
 384
 385 return itemString;
381386}
382387
383388String RenderMenuList::itemLabel(unsigned) const

Source/WebCore/rendering/RenderText.cpp

@@static void makeCapitalized(String* string, UChar previous)
114114 int32_t endOfWord;
115115 int32_t startOfWord = textBreakFirst(boundary);
116116 for (endOfWord = textBreakNext(boundary); endOfWord != TextBreakDone; startOfWord = endOfWord, endOfWord = textBreakNext(boundary)) {
117  if (startOfWord != 0) // Ignore first char of previous string
 117 if (startOfWord) // Ignore first char of previous string
118118 data[startOfWord - 1] = characters[startOfWord - 1] == noBreakSpace ? noBreakSpace : toTitleCase(stringWithPrevious[startOfWord]);
119119 for (int i = startOfWord + 1; i < endOfWord; i++)
120120 data[i - 1] = characters[i - 1];

@@UChar RenderText::previousCharacter() const
12651265 return prev;
12661266}
12671267
1268 void RenderText::transformText(String& text) const
 1268void applyTextTransform(const RenderStyle* style, String& text, UChar previousCharacter)
12691269{
1270  ASSERT(style());
1271  switch (style()->textTransform()) {
 1270 if (!style)
 1271 return;
 1272
 1273 switch (style->textTransform()) {
12721274 case TTNONE:
12731275 break;
12741276 case CAPITALIZE:
1275  makeCapitalized(&text, previousCharacter());
 1277 makeCapitalized(&text, previousCharacter);
12761278 break;
12771279 case UPPERCASE:
12781280 text.makeUpper();

@@void RenderText::setTextInternal(PassRefPtr<StringImpl> text)
12941296 ASSERT(m_text);
12951297
12961298 if (style()) {
1297  transformText(m_text);
 1299 applyTextTransform(style(), m_text, previousCharacter());
12981300
12991301 // We use the same characters here as for list markers.
13001302 // See the listMarkerText function in RenderListMarker.cpp.

@@String RenderText::textWithoutTranscoding() const
13651367 // Otherwise, we should use original text. If text-transform is
13661368 // specified, we should transform the text on the fly.
13671369 String text = originalText();
1368  if (style())
1369  transformText(text);
 1370 applyTextTransform(style(), text, previousCharacter());
13701371 return text;
13711372}
13721373

Source/WebCore/rendering/RenderText.h

@@inline void RenderText::checkConsistency() const
210210}
211211#endif
212212
 213void applyTextTransform(const RenderStyle*, String&, UChar);
 214
213215} // namespace WebCore
214216
215217#endif // RenderText_h