Changeset 21900 in webkit
- Timestamp:
- May 30, 2007 12:16:19 PM (17 years ago)
- Location:
- trunk
- Files:
-
- 4 added
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r21899 r21900 1 2007-05-30 Mitz Pettel <mitz@webkit.org> 2 3 Reviewed by Darin. 4 5 - test for http://bugs.webkit.org/show_bug.cgi?id=13775 6 REGRESSION: Popup button text should use "natural" directionality to match the items in the popup menu 7 8 * fast/forms/select-writing-direction-natural-expected.checksum: Added. 9 * fast/forms/select-writing-direction-natural-expected.png: Added. 10 * fast/forms/select-writing-direction-natural-expected.txt: Added. 11 * fast/forms/select-writing-direction-natural.html: Added. 12 1 13 2007-05-30 Mitz Pettel <mitz@webkit.org> 2 14 -
trunk/WebCore/ChangeLog
r21897 r21900 1 2007-05-30 Mitz Pettel <mitz@webkit.org> 2 3 Reviewed by Darin. 4 5 - fix http://bugs.webkit.org/show_bug.cgi?id=13775 6 REGRESSION: Popup button text should use "natural" directionality to match the items in the popup menu 7 8 Test: fast/forms/select-writing-direction-natural.html 9 10 * platform/PopupMenu.h: Added the static method itemWritingDirectionIsNatural 11 which says whether items in the popup ignore the CSS text-align and direction 12 properties and instead are left-aligned and use natural writing direction. 13 * platform/gdk/PopupMenuGdk.cpp: 14 (WebCore::PopupMenu::itemWritingDirectionIsNatural): 15 * platform/mac/PopupMenuMac.mm: 16 (WebCore::PopupMenu::itemWritingDirectionIsNatural): 17 * platform/qt/PopupMenuQt.cpp: 18 (WebCore::PopupMenu::itemWritingDirectionIsNatural): 19 * platform/win/TemporaryLinkStubs.cpp: 20 (WebCore::PopupMenu::itemWritingDirectionIsNatural): 21 * platform/wx/TemporaryLinkStubs.cpp: 22 (PopupMenu::itemWritingDirectionIsNatural): 23 * rendering/RenderMenuList.cpp: 24 (WebCore::textDirectionForParagraph): Added this helper function that uses 25 the Unicode Bidi Algorithm rules P2 and P3 to determine the writing direction 26 of text. 27 (WebCore::RenderMenuList::adjustInnerStyle): Made the alignment and direction 28 adjustment conditional on the popup implementation. 29 (WebCore::RenderMenuList::setText): Added call to adjustInnerStyle() since 30 the style depends on the text when natural writing direction is used. 31 1 32 2007-05-30 Timothy Hatcher <timothy@apple.com> 2 33 -
trunk/WebCore/platform/PopupMenu.h
r20761 r21900 69 69 70 70 PopupMenuClient* client() const { return m_popupClient; } 71 72 static bool itemWritingDirectionIsNatural(); 71 73 72 74 #if PLATFORM(WIN) -
trunk/WebCore/platform/gdk/PopupMenuGdk.cpp
r21827 r21900 56 56 } 57 57 58 bool PopupMenu::itemWritingDirectionIsNatural() 59 { 60 return false; 58 61 } 59 62 63 } 64 -
trunk/WebCore/platform/mac/PopupMenuMac.mm
r21463 r21900 185 185 } 186 186 187 bool PopupMenu::itemWritingDirectionIsNatural() 188 { 189 return true; 187 190 } 191 192 } -
trunk/WebCore/platform/qt/PopupMenuQt.cpp
r21827 r21900 106 106 } 107 107 108 bool PopupMenu::itemWritingDirectionIsNatural() 109 { 110 return false; 111 } 112 108 113 } 109 114 -
trunk/WebCore/platform/win/TemporaryLinkStubs.cpp
r21827 r21900 330 330 void PopupMenu::hide() { notImplemented(); } 331 331 void PopupMenu::updateFromElement() { notImplemented(); } 332 bool PopupMenu::itemWritingDirectionIsNatural() { notImplemented(); return false; } 332 333 333 334 void RenderThemeWin::systemFont(int propId, FontDescription& fontDescription) const { notImplemented(); } -
trunk/WebCore/platform/wx/TemporaryLinkStubs.cpp
r21827 r21900 191 191 void PopupMenu::hide() { notImplemented(); } 192 192 void PopupMenu::updateFromElement() { notImplemented(); } 193 bool PopupMenu::itemWritingDirectionIsNatural() { notImplemented(); return false; } 193 194 194 195 Icon::Icon() { notImplemented(); } -
trunk/WebCore/rendering/RenderMenuList.cpp
r21544 r21900 77 77 } 78 78 79 // Determines the writing direction using the Unicode Bidi Algorithm rules P2 and P3. 80 static TextDirection textDirectionForParagraph(StringImpl* paragraph) 81 { 82 int length = paragraph->length(); 83 for (int i = 0; i < length; ++i) { 84 WTF::Unicode::Direction charDirection = WTF::Unicode::direction((*paragraph)[i]); 85 if (charDirection == WTF::Unicode::LeftToRight) 86 return LTR; 87 if (charDirection == WTF::Unicode::RightToLeft || charDirection == WTF::Unicode::RightToLeftArabic) 88 return RTL; 89 } 90 return LTR; 91 } 92 79 93 void RenderMenuList::adjustInnerStyle() 80 94 { 81 95 m_innerBlock->style()->setBoxFlex(1.0f); 82 m_innerBlock->style()->setDirection(LTR); 83 m_innerBlock->style()->setTextAlign(LEFT); 96 97 if (PopupMenu::itemWritingDirectionIsNatural()) { 98 // Items in the popup will not respect the CSS text-align and direction properties, 99 // so we must adjust our own style to match. 100 m_innerBlock->style()->setTextAlign(LEFT); 101 TextDirection direction = m_buttonText ? textDirectionForParagraph(m_buttonText->text()) : LTR; 102 m_innerBlock->style()->setDirection(direction); 103 } 84 104 } 85 105 … … 190 210 addChild(m_buttonText); 191 211 } 212 adjustInnerStyle(); 192 213 } 193 214 }
Note: See TracChangeset
for help on using the changeset viewer.