diff options
author | Jocelyn Turcotte <jocelyn.turcotte@nokia.com> | 2010-04-06 10:36:47 (GMT) |
---|---|---|
committer | Jocelyn Turcotte <jocelyn.turcotte@nokia.com> | 2010-04-06 10:36:47 (GMT) |
commit | bb35b65bbfba82e0dd0ac306d3dab54436cdaff6 (patch) | |
tree | 8174cb262a960ff7b2e4aa8f1aaf154db71d2636 /src/3rdparty/webkit/WebCore/platform/mac | |
parent | 4b27d0d887269583a0f76e922948f8c25e96ab88 (diff) | |
download | Qt-bb35b65bbfba82e0dd0ac306d3dab54436cdaff6.zip Qt-bb35b65bbfba82e0dd0ac306d3dab54436cdaff6.tar.gz Qt-bb35b65bbfba82e0dd0ac306d3dab54436cdaff6.tar.bz2 |
Update src/3rdparty/webkit from trunk.
Imported from 839d8709327f925aacb3b6362c06152594def97e
in branch qtwebkit-2.0 of repository
git://gitorious.org/+qtwebkit-developers/webkit/qtwebkit.git
Rubber-stamped-by: Simon Hausmann
Diffstat (limited to 'src/3rdparty/webkit/WebCore/platform/mac')
22 files changed, 354 insertions, 764 deletions
diff --git a/src/3rdparty/webkit/WebCore/platform/mac/ClipboardMac.h b/src/3rdparty/webkit/WebCore/platform/mac/ClipboardMac.h index 3d3c78e..adde09c 100644 --- a/src/3rdparty/webkit/WebCore/platform/mac/ClipboardMac.h +++ b/src/3rdparty/webkit/WebCore/platform/mac/ClipboardMac.h @@ -72,6 +72,7 @@ public: #endif virtual void writeRange(Range*, Frame* frame); virtual void writeURL(const KURL&, const String&, Frame* frame); + virtual void writePlainText(const String&); // Methods for getting info in Cocoa's type system NSImage *dragNSImage(NSPoint&) const; // loc converted from dragLoc, based on whole image size diff --git a/src/3rdparty/webkit/WebCore/platform/mac/ClipboardMac.mm b/src/3rdparty/webkit/WebCore/platform/mac/ClipboardMac.mm index f4321ad..ddfa0d5 100644 --- a/src/3rdparty/webkit/WebCore/platform/mac/ClipboardMac.mm +++ b/src/3rdparty/webkit/WebCore/platform/mac/ClipboardMac.mm @@ -367,7 +367,12 @@ void ClipboardMac::writeRange(Range* range, Frame* frame) ASSERT(frame); Pasteboard::writeSelection(m_pasteboard.get(), range, frame->editor()->smartInsertDeleteEnabled() && frame->selectionGranularity() == WordGranularity, frame); } - + +void ClipboardMac::writePlainText(const String& text) +{ + Pasteboard::writePlainText(m_pasteboard.get(), text); +} + void ClipboardMac::writeURL(const KURL& url, const String& title, Frame* frame) { ASSERT(frame); diff --git a/src/3rdparty/webkit/WebCore/platform/mac/CookieJar.mm b/src/3rdparty/webkit/WebCore/platform/mac/CookieJar.mm index e1d3e5a..df24b03 100644 --- a/src/3rdparty/webkit/WebCore/platform/mac/CookieJar.mm +++ b/src/3rdparty/webkit/WebCore/platform/mac/CookieJar.mm @@ -86,6 +86,18 @@ String cookies(const Document*, const KURL& url) return String(); } +String cookieRequestHeaderFieldValue(const Document*, const KURL& url) +{ + BEGIN_BLOCK_OBJC_EXCEPTIONS; + + NSURL *cookieURL = url; + NSArray *cookies = [[NSHTTPCookieStorage sharedHTTPCookieStorage] cookiesForURL:cookieURL]; + return [[NSHTTPCookie requestHeaderFieldsWithCookies:cookies] objectForKey:@"Cookie"]; + + END_BLOCK_OBJC_EXCEPTIONS; + return String(); +} + void setCookies(Document* document, const KURL& url, const String& cookieStr) { BEGIN_BLOCK_OBJC_EXCEPTIONS; diff --git a/src/3rdparty/webkit/WebCore/platform/mac/GeolocationServiceMac.mm b/src/3rdparty/webkit/WebCore/platform/mac/GeolocationServiceMac.mm index 1093e69..9c781ad 100644 --- a/src/3rdparty/webkit/WebCore/platform/mac/GeolocationServiceMac.mm +++ b/src/3rdparty/webkit/WebCore/platform/mac/GeolocationServiceMac.mm @@ -25,7 +25,7 @@ #import "config.h" -#if ENABLE(GEOLOCATION) +#if ENABLE(GEOLOCATION) && !ENABLE(CLIENT_BASED_GEOLOCATION) #import "GeolocationServiceMac.h" diff --git a/src/3rdparty/webkit/WebCore/platform/mac/KeyEventMac.mm b/src/3rdparty/webkit/WebCore/platform/mac/KeyEventMac.mm index b6c3b21..14ad2e4 100644 --- a/src/3rdparty/webkit/WebCore/platform/mac/KeyEventMac.mm +++ b/src/3rdparty/webkit/WebCore/platform/mac/KeyEventMac.mm @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved. + * Copyright (C) 2004, 2006, 2007, 2010 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -20,342 +20,22 @@ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "config.h" #import "PlatformKeyboardEvent.h" +#if PLATFORM(MAC) + +#import "KeyEventCocoa.h" #import "Logging.h" #import <Carbon/Carbon.h> -#import <wtf/ASCIICType.h> using namespace WTF; namespace WebCore { -static String keyIdentifierForKeyEvent(NSEvent* event) -{ - if ([event type] == NSFlagsChanged) - switch ([event keyCode]) { - case 54: // Right Command - case 55: // Left Command - return "Meta"; - - case 57: // Capslock - return "CapsLock"; - - case 56: // Left Shift - case 60: // Right Shift - return "Shift"; - - case 58: // Left Alt - case 61: // Right Alt - return "Alt"; - - case 59: // Left Ctrl - case 62: // Right Ctrl - return "Control"; - - default: - ASSERT_NOT_REACHED(); - return ""; - } - - NSString *s = [event charactersIgnoringModifiers]; - if ([s length] != 1) { - LOG(Events, "received an unexpected number of characters in key event: %u", [s length]); - return "Unidentified"; - } - unichar c = [s characterAtIndex:0]; - switch (c) { - // Each identifier listed in the DOM spec is listed here. - // Many are simply commented out since they do not appear on standard Macintosh keyboards - // or are on a key that doesn't have a corresponding character. - - // "Accept" - // "AllCandidates" - - // "Alt" - case NSMenuFunctionKey: - return "Alt"; - - // "Apps" - // "BrowserBack" - // "BrowserForward" - // "BrowserHome" - // "BrowserRefresh" - // "BrowserSearch" - // "BrowserStop" - // "CapsLock" - - // "Clear" - case NSClearLineFunctionKey: - return "Clear"; - - // "CodeInput" - // "Compose" - // "Control" - // "Crsel" - // "Convert" - // "Copy" - // "Cut" - - // "Down" - case NSDownArrowFunctionKey: - return "Down"; - // "End" - case NSEndFunctionKey: - return "End"; - // "Enter" - case 0x3: case 0xA: case 0xD: // Macintosh calls the one on the main keyboard Return, but Windows calls it Enter, so we'll do the same for the DOM - return "Enter"; - - // "EraseEof" - - // "Execute" - case NSExecuteFunctionKey: - return "Execute"; - - // "Exsel" - - // "F1" - case NSF1FunctionKey: - return "F1"; - // "F2" - case NSF2FunctionKey: - return "F2"; - // "F3" - case NSF3FunctionKey: - return "F3"; - // "F4" - case NSF4FunctionKey: - return "F4"; - // "F5" - case NSF5FunctionKey: - return "F5"; - // "F6" - case NSF6FunctionKey: - return "F6"; - // "F7" - case NSF7FunctionKey: - return "F7"; - // "F8" - case NSF8FunctionKey: - return "F8"; - // "F9" - case NSF9FunctionKey: - return "F9"; - // "F10" - case NSF10FunctionKey: - return "F10"; - // "F11" - case NSF11FunctionKey: - return "F11"; - // "F12" - case NSF12FunctionKey: - return "F12"; - // "F13" - case NSF13FunctionKey: - return "F13"; - // "F14" - case NSF14FunctionKey: - return "F14"; - // "F15" - case NSF15FunctionKey: - return "F15"; - // "F16" - case NSF16FunctionKey: - return "F16"; - // "F17" - case NSF17FunctionKey: - return "F17"; - // "F18" - case NSF18FunctionKey: - return "F18"; - // "F19" - case NSF19FunctionKey: - return "F19"; - // "F20" - case NSF20FunctionKey: - return "F20"; - // "F21" - case NSF21FunctionKey: - return "F21"; - // "F22" - case NSF22FunctionKey: - return "F22"; - // "F23" - case NSF23FunctionKey: - return "F23"; - // "F24" - case NSF24FunctionKey: - return "F24"; - - // "FinalMode" - - // "Find" - case NSFindFunctionKey: - return "Find"; - - // "FullWidth" - // "HalfWidth" - // "HangulMode" - // "HanjaMode" - - // "Help" - case NSHelpFunctionKey: - return "Help"; - - // "Hiragana" - - // "Home" - case NSHomeFunctionKey: - return "Home"; - // "Insert" - case NSInsertFunctionKey: - return "Insert"; - - // "JapaneseHiragana" - // "JapaneseKatakana" - // "JapaneseRomaji" - // "JunjaMode" - // "KanaMode" - // "KanjiMode" - // "Katakana" - // "LaunchApplication1" - // "LaunchApplication2" - // "LaunchMail" - - // "Left" - case NSLeftArrowFunctionKey: - return "Left"; - - // "Meta" - // "MediaNextTrack" - // "MediaPlayPause" - // "MediaPreviousTrack" - // "MediaStop" - - // "ModeChange" - case NSModeSwitchFunctionKey: - return "ModeChange"; - - // "Nonconvert" - // "NumLock" - - // "PageDown" - case NSPageDownFunctionKey: - return "PageDown"; - // "PageUp" - case NSPageUpFunctionKey: - return "PageUp"; - - // "Paste" - - // "Pause" - case NSPauseFunctionKey: - return "Pause"; - - // "Play" - // "PreviousCandidate" - - // "PrintScreen" - case NSPrintScreenFunctionKey: - return "PrintScreen"; - - // "Process" - // "Props" - - // "Right" - case NSRightArrowFunctionKey: - return "Right"; - - // "RomanCharacters" - - // "Scroll" - case NSScrollLockFunctionKey: - return "Scroll"; - // "Select" - case NSSelectFunctionKey: - return "Select"; - - // "SelectMedia" - // "Shift" - - // "Stop" - case NSStopFunctionKey: - return "Stop"; - // "Up" - case NSUpArrowFunctionKey: - return "Up"; - // "Undo" - case NSUndoFunctionKey: - return "Undo"; - - // "VolumeDown" - // "VolumeMute" - // "VolumeUp" - // "Win" - // "Zoom" - - // More function keys, not in the key identifier specification. - case NSF25FunctionKey: - return "F25"; - case NSF26FunctionKey: - return "F26"; - case NSF27FunctionKey: - return "F27"; - case NSF28FunctionKey: - return "F28"; - case NSF29FunctionKey: - return "F29"; - case NSF30FunctionKey: - return "F30"; - case NSF31FunctionKey: - return "F31"; - case NSF32FunctionKey: - return "F32"; - case NSF33FunctionKey: - return "F33"; - case NSF34FunctionKey: - return "F34"; - case NSF35FunctionKey: - return "F35"; - - // Turn 0x7F into 0x08, because backspace needs to always be 0x08. - case 0x7F: - return "U+0008"; - // Standard says that DEL becomes U+007F. - case NSDeleteFunctionKey: - return "U+007F"; - - // Always use 0x09 for tab instead of AppKit's backtab character. - case NSBackTabCharacter: - return "U+0009"; - - case NSBeginFunctionKey: - case NSBreakFunctionKey: - case NSClearDisplayFunctionKey: - case NSDeleteCharFunctionKey: - case NSDeleteLineFunctionKey: - case NSInsertCharFunctionKey: - case NSInsertLineFunctionKey: - case NSNextFunctionKey: - case NSPrevFunctionKey: - case NSPrintFunctionKey: - case NSRedoFunctionKey: - case NSResetFunctionKey: - case NSSysReqFunctionKey: - case NSSystemFunctionKey: - case NSUserFunctionKey: - // FIXME: We should use something other than the vendor-area Unicode values for the above keys. - // For now, just fall through to the default. - default: - return String::format("U+%04X", toASCIIUpper(c)); - } -} - static bool isKeypadEvent(NSEvent* event) { // Check that this is the type of event that has a keyCode. @@ -368,6 +48,9 @@ static bool isKeypadEvent(NSEvent* event) return false; } + if ([event modifierFlags] & NSNumericPadKeyMask) + return true; + switch ([event keyCode]) { case 71: // Clear case 81: // = @@ -389,376 +72,8 @@ static bool isKeypadEvent(NSEvent* event) case 92: // 9 return true; } - - return false; -} - -static int windowsKeyCodeForKeyEvent(NSEvent* event) -{ - switch ([event keyCode]) { - // VK_TAB (09) TAB key - case 48: return 0x09; - - // VK_APPS (5D) Right windows/meta key - case 54: // Right Command - return 0x5D; - - // VK_LWIN (5B) Left windows/meta key - case 55: // Left Command - return 0x5B; - - // VK_CAPITAL (14) caps locks key - case 57: // Capslock - return 0x14; - - // VK_SHIFT (10) either shift key - case 56: // Left Shift - case 60: // Right Shift - return 0x10; - - // VK_MENU (12) either alt key - case 58: // Left Alt - case 61: // Right Alt - return 0x12; - - // VK_CONTROL (11) either ctrl key - case 59: // Left Ctrl - case 62: // Right Ctrl - return 0x11; - - // VK_CLEAR (0C) CLEAR key - case 71: return 0x0C; - - // VK_NUMPAD0 (60) Numeric keypad 0 key - case 82: return 0x60; - // VK_NUMPAD1 (61) Numeric keypad 1 key - case 83: return 0x61; - // VK_NUMPAD2 (62) Numeric keypad 2 key - case 84: return 0x62; - // VK_NUMPAD3 (63) Numeric keypad 3 key - case 85: return 0x63; - // VK_NUMPAD4 (64) Numeric keypad 4 key - case 86: return 0x64; - // VK_NUMPAD5 (65) Numeric keypad 5 key - case 87: return 0x65; - // VK_NUMPAD6 (66) Numeric keypad 6 key - case 88: return 0x66; - // VK_NUMPAD7 (67) Numeric keypad 7 key - case 89: return 0x67; - // VK_NUMPAD8 (68) Numeric keypad 8 key - case 91: return 0x68; - // VK_NUMPAD9 (69) Numeric keypad 9 key - case 92: return 0x69; - // VK_MULTIPLY (6A) Multiply key - case 67: return 0x6A; - // VK_ADD (6B) Add key - case 69: return 0x6B; - - // VK_SUBTRACT (6D) Subtract key - case 78: return 0x6D; - // VK_DECIMAL (6E) Decimal key - case 65: return 0x6E; - // VK_DIVIDE (6F) Divide key - case 75: return 0x6F; - } - - NSString* s = [event charactersIgnoringModifiers]; - if ([s length] != 1) - return 0; - - switch ([s characterAtIndex:0]) { - // VK_LBUTTON (01) Left mouse button - // VK_RBUTTON (02) Right mouse button - // VK_CANCEL (03) Control-break processing - // VK_MBUTTON (04) Middle mouse button (three-button mouse) - // VK_XBUTTON1 (05) - // VK_XBUTTON2 (06) - - // VK_BACK (08) BACKSPACE key - case 8: case 0x7F: return 0x08; - // VK_TAB (09) TAB key - case 9: return 0x09; - - // VK_CLEAR (0C) CLEAR key - // handled by key code above - - // VK_RETURN (0D) - case 0xD: case 3: return 0x0D; - - // VK_SHIFT (10) SHIFT key - // VK_CONTROL (11) CTRL key - // VK_MENU (12) ALT key - - // VK_PAUSE (13) PAUSE key - case NSPauseFunctionKey: return 0x13; - - // VK_CAPITAL (14) CAPS LOCK key - // VK_KANA (15) Input Method Editor (IME) Kana mode - // VK_HANGUEL (15) IME Hanguel mode (maintained for compatibility; use VK_HANGUL) - // VK_HANGUL (15) IME Hangul mode - // VK_JUNJA (17) IME Junja mode - // VK_FINAL (18) IME final mode - // VK_HANJA (19) IME Hanja mode - // VK_KANJI (19) IME Kanji mode - - // VK_ESCAPE (1B) ESC key - case 0x1B: return 0x1B; - - // VK_CONVERT (1C) IME convert - // VK_NONCONVERT (1D) IME nonconvert - // VK_ACCEPT (1E) IME accept - // VK_MODECHANGE (1F) IME mode change request - - // VK_SPACE (20) SPACEBAR - case ' ': return 0x20; - // VK_PRIOR (21) PAGE UP key - case NSPageUpFunctionKey: return 0x21; - // VK_NEXT (22) PAGE DOWN key - case NSPageDownFunctionKey: return 0x22; - // VK_END (23) END key - case NSEndFunctionKey: return 0x23; - // VK_HOME (24) HOME key - case NSHomeFunctionKey: return 0x24; - // VK_LEFT (25) LEFT ARROW key - case NSLeftArrowFunctionKey: return 0x25; - // VK_UP (26) UP ARROW key - case NSUpArrowFunctionKey: return 0x26; - // VK_RIGHT (27) RIGHT ARROW key - case NSRightArrowFunctionKey: return 0x27; - // VK_DOWN (28) DOWN ARROW key - case NSDownArrowFunctionKey: return 0x28; - // VK_SELECT (29) SELECT key - case NSSelectFunctionKey: return 0x29; - // VK_PRINT (2A) PRINT key - case NSPrintFunctionKey: return 0x2A; - // VK_EXECUTE (2B) EXECUTE key - case NSExecuteFunctionKey: return 0x2B; - // VK_SNAPSHOT (2C) PRINT SCREEN key - case NSPrintScreenFunctionKey: return 0x2C; - // VK_INSERT (2D) INS key - case NSInsertFunctionKey: case NSHelpFunctionKey: return 0x2D; - // VK_DELETE (2E) DEL key - case NSDeleteFunctionKey: return 0x2E; - - // VK_HELP (2F) HELP key - - // (30) 0 key - case '0': case ')': return 0x30; - // (31) 1 key - case '1': case '!': return 0x31; - // (32) 2 key - case '2': case '@': return 0x32; - // (33) 3 key - case '3': case '#': return 0x33; - // (34) 4 key - case '4': case '$': return 0x34; - // (35) 5 key - case '5': case '%': return 0x35; - // (36) 6 key - case '6': case '^': return 0x36; - // (37) 7 key - case '7': case '&': return 0x37; - // (38) 8 key - case '8': case '*': return 0x38; - // (39) 9 key - case '9': case '(': return 0x39; - // (41) A key - case 'a': case 'A': return 0x41; - // (42) B key - case 'b': case 'B': return 0x42; - // (43) C key - case 'c': case 'C': return 0x43; - // (44) D key - case 'd': case 'D': return 0x44; - // (45) E key - case 'e': case 'E': return 0x45; - // (46) F key - case 'f': case 'F': return 0x46; - // (47) G key - case 'g': case 'G': return 0x47; - // (48) H key - case 'h': case 'H': return 0x48; - // (49) I key - case 'i': case 'I': return 0x49; - // (4A) J key - case 'j': case 'J': return 0x4A; - // (4B) K key - case 'k': case 'K': return 0x4B; - // (4C) L key - case 'l': case 'L': return 0x4C; - // (4D) M key - case 'm': case 'M': return 0x4D; - // (4E) N key - case 'n': case 'N': return 0x4E; - // (4F) O key - case 'o': case 'O': return 0x4F; - // (50) P key - case 'p': case 'P': return 0x50; - // (51) Q key - case 'q': case 'Q': return 0x51; - // (52) R key - case 'r': case 'R': return 0x52; - // (53) S key - case 's': case 'S': return 0x53; - // (54) T key - case 't': case 'T': return 0x54; - // (55) U key - case 'u': case 'U': return 0x55; - // (56) V key - case 'v': case 'V': return 0x56; - // (57) W key - case 'w': case 'W': return 0x57; - // (58) X key - case 'x': case 'X': return 0x58; - // (59) Y key - case 'y': case 'Y': return 0x59; - // (5A) Z key - case 'z': case 'Z': return 0x5A; - - // VK_LWIN (5B) Left Windows key (Microsoft Natural keyboard) - // VK_RWIN (5C) Right Windows key (Natural keyboard) - // VK_APPS (5D) Applications key (Natural keyboard) - // VK_SLEEP (5F) Computer Sleep key - - // VK_NUMPAD0 (60) Numeric keypad 0 key - // VK_NUMPAD1 (61) Numeric keypad 1 key - // VK_NUMPAD2 (62) Numeric keypad 2 key - // VK_NUMPAD3 (63) Numeric keypad 3 key - // VK_NUMPAD4 (64) Numeric keypad 4 key - // VK_NUMPAD5 (65) Numeric keypad 5 key - // VK_NUMPAD6 (66) Numeric keypad 6 key - // VK_NUMPAD7 (67) Numeric keypad 7 key - // VK_NUMPAD8 (68) Numeric keypad 8 key - // VK_NUMPAD9 (69) Numeric keypad 9 key - // VK_MULTIPLY (6A) Multiply key - // VK_ADD (6B) Add key - // handled by key code above - - // VK_SEPARATOR (6C) Separator key - - // VK_SUBTRACT (6D) Subtract key - // VK_DECIMAL (6E) Decimal key - // VK_DIVIDE (6F) Divide key - // handled by key code above - - // VK_F1 (70) F1 key - case NSF1FunctionKey: return 0x70; - // VK_F2 (71) F2 key - case NSF2FunctionKey: return 0x71; - // VK_F3 (72) F3 key - case NSF3FunctionKey: return 0x72; - // VK_F4 (73) F4 key - case NSF4FunctionKey: return 0x73; - // VK_F5 (74) F5 key - case NSF5FunctionKey: return 0x74; - // VK_F6 (75) F6 key - case NSF6FunctionKey: return 0x75; - // VK_F7 (76) F7 key - case NSF7FunctionKey: return 0x76; - // VK_F8 (77) F8 key - case NSF8FunctionKey: return 0x77; - // VK_F9 (78) F9 key - case NSF9FunctionKey: return 0x78; - // VK_F10 (79) F10 key - case NSF10FunctionKey: return 0x79; - // VK_F11 (7A) F11 key - case NSF11FunctionKey: return 0x7A; - // VK_F12 (7B) F12 key - case NSF12FunctionKey: return 0x7B; - // VK_F13 (7C) F13 key - case NSF13FunctionKey: return 0x7C; - // VK_F14 (7D) F14 key - case NSF14FunctionKey: return 0x7D; - // VK_F15 (7E) F15 key - case NSF15FunctionKey: return 0x7E; - // VK_F16 (7F) F16 key - case NSF16FunctionKey: return 0x7F; - // VK_F17 (80H) F17 key - case NSF17FunctionKey: return 0x80; - // VK_F18 (81H) F18 key - case NSF18FunctionKey: return 0x81; - // VK_F19 (82H) F19 key - case NSF19FunctionKey: return 0x82; - // VK_F20 (83H) F20 key - case NSF20FunctionKey: return 0x83; - // VK_F21 (84H) F21 key - case NSF21FunctionKey: return 0x84; - // VK_F22 (85H) F22 key - case NSF22FunctionKey: return 0x85; - // VK_F23 (86H) F23 key - case NSF23FunctionKey: return 0x86; - // VK_F24 (87H) F24 key - case NSF24FunctionKey: return 0x87; - - // VK_NUMLOCK (90) NUM LOCK key - - // VK_SCROLL (91) SCROLL LOCK key - case NSScrollLockFunctionKey: return 0x91; - - // VK_LSHIFT (A0) Left SHIFT key - // VK_RSHIFT (A1) Right SHIFT key - // VK_LCONTROL (A2) Left CONTROL key - // VK_RCONTROL (A3) Right CONTROL key - // VK_LMENU (A4) Left MENU key - // VK_RMENU (A5) Right MENU key - // VK_BROWSER_BACK (A6) Windows 2000/XP: Browser Back key - // VK_BROWSER_FORWARD (A7) Windows 2000/XP: Browser Forward key - // VK_BROWSER_REFRESH (A8) Windows 2000/XP: Browser Refresh key - // VK_BROWSER_STOP (A9) Windows 2000/XP: Browser Stop key - // VK_BROWSER_SEARCH (AA) Windows 2000/XP: Browser Search key - // VK_BROWSER_FAVORITES (AB) Windows 2000/XP: Browser Favorites key - // VK_BROWSER_HOME (AC) Windows 2000/XP: Browser Start and Home key - // VK_VOLUME_MUTE (AD) Windows 2000/XP: Volume Mute key - // VK_VOLUME_DOWN (AE) Windows 2000/XP: Volume Down key - // VK_VOLUME_UP (AF) Windows 2000/XP: Volume Up key - // VK_MEDIA_NEXT_TRACK (B0) Windows 2000/XP: Next Track key - // VK_MEDIA_PREV_TRACK (B1) Windows 2000/XP: Previous Track key - // VK_MEDIA_STOP (B2) Windows 2000/XP: Stop Media key - // VK_MEDIA_PLAY_PAUSE (B3) Windows 2000/XP: Play/Pause Media key - // VK_LAUNCH_MAIL (B4) Windows 2000/XP: Start Mail key - // VK_LAUNCH_MEDIA_SELECT (B5) Windows 2000/XP: Select Media key - // VK_LAUNCH_APP1 (B6) Windows 2000/XP: Start Application 1 key - // VK_LAUNCH_APP2 (B7) Windows 2000/XP: Start Application 2 key - - // VK_OEM_1 (BA) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the ';:' key - case ';': case ':': return 0xBA; - // VK_OEM_PLUS (BB) Windows 2000/XP: For any country/region, the '+' key - case '=': case '+': return 0xBB; - // VK_OEM_COMMA (BC) Windows 2000/XP: For any country/region, the ',' key - case ',': case '<': return 0xBC; - // VK_OEM_MINUS (BD) Windows 2000/XP: For any country/region, the '-' key - case '-': case '_': return 0xBD; - // VK_OEM_PERIOD (BE) Windows 2000/XP: For any country/region, the '.' key - case '.': case '>': return 0xBE; - // VK_OEM_2 (BF) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the '/?' key - case '/': case '?': return 0xBF; - // VK_OEM_3 (C0) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the '`~' key - case '`': case '~': return 0xC0; - // VK_OEM_4 (DB) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the '[{' key - case '[': case '{': return 0xDB; - // VK_OEM_5 (DC) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the '\|' key - case '\\': case '|': return 0xDC; - // VK_OEM_6 (DD) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the ']}' key - case ']': case '}': return 0xDD; - // VK_OEM_7 (DE) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the 'single-quote/double-quote' key - case '\'': case '"': return 0xDE; - - // VK_OEM_8 (DF) Used for miscellaneous characters; it can vary by keyboard. - // VK_OEM_102 (E2) Windows 2000/XP: Either the angle bracket key or the backslash key on the RT 102-key keyboard - // VK_PROCESSKEY (E5) Windows 95/98/Me, Windows NT 4.0, Windows 2000/XP: IME PROCESS key - // VK_PACKET (E7) Windows 2000/XP: Used to pass Unicode characters as if they were keystrokes. The VK_PACKET key is the low word of a 32-bit Virtual Key value used for non-keyboard input methods. For more information, see Remark in KEYBDINPUT,SendInput, WM_KEYDOWN, and WM_KEYUP - // VK_ATTN (F6) Attn key - // VK_CRSEL (F7) CrSel key - // VK_EXSEL (F8) ExSel key - // VK_EREOF (F9) Erase EOF key - // VK_PLAY (FA) Play key - // VK_ZOOM (FB) Zoom key - // VK_NONAME (FC) Reserved for future use - // VK_PA1 (FD) PA1 key - // VK_OEM_CLEAR (FE) Clear key - } - return 0; + return false; } static inline bool isKeyUpEvent(NSEvent *event) @@ -771,22 +86,22 @@ static inline bool isKeyUpEvent(NSEvent *event) case 54: // Right Command case 55: // Left Command return ([event modifierFlags] & NSCommandKeyMask) == 0; - + case 57: // Capslock return ([event modifierFlags] & NSAlphaShiftKeyMask) == 0; - + case 56: // Left Shift case 60: // Right Shift return ([event modifierFlags] & NSShiftKeyMask) == 0; - + case 58: // Left Alt case 61: // Right Alt return ([event modifierFlags] & NSAlternateKeyMask) == 0; - + case 59: // Left Ctrl case 62: // Right Ctrl return ([event modifierFlags] & NSControlKeyMask) == 0; - + case 63: // Function return ([event modifierFlags] & NSFunctionKeyMask) == 0; } @@ -799,8 +114,8 @@ static inline String textFromEvent(NSEvent* event) return ""; return [event characters]; } - - + + static inline String unmodifiedTextFromEvent(NSEvent* event) { if ([event type] == NSFlagsChanged) @@ -808,6 +123,54 @@ static inline String unmodifiedTextFromEvent(NSEvent* event) return [event charactersIgnoringModifiers]; } +static String keyIdentifierForKeyEvent(NSEvent* event) +{ + if ([event type] == NSFlagsChanged) + switch ([event keyCode]) { + case 54: // Right Command + case 55: // Left Command + return "Meta"; + + case 57: // Capslock + return "CapsLock"; + + case 56: // Left Shift + case 60: // Right Shift + return "Shift"; + + case 58: // Left Alt + case 61: // Right Alt + return "Alt"; + + case 59: // Left Ctrl + case 62: // Right Ctrl + return "Control"; + + default: + ASSERT_NOT_REACHED(); + return ""; + } + + NSString *s = [event charactersIgnoringModifiers]; + if ([s length] != 1) { + LOG(Events, "received an unexpected number of characters in key event: %u", [s length]); + return "Unidentified"; + } + return keyIdentifierForCharCode([s characterAtIndex:0]); +} + +static int windowsKeyCodeForKeyEvent(NSEvent *event) +{ + int code = windowsKeyCodeForKeyCode([event keyCode]); + if (code) + return code; + + NSString* s = [event charactersIgnoringModifiers]; + if ([s length] != 1) + return 0; + return windowsKeyCodeForCharCode([s characterAtIndex:0]); +} + PlatformKeyboardEvent::PlatformKeyboardEvent(NSEvent *event) : m_type(isKeyUpEvent(event) ? PlatformKeyboardEvent::KeyUp : PlatformKeyboardEvent::KeyDown) , m_text(textFromEvent(event)) @@ -873,4 +236,15 @@ bool PlatformKeyboardEvent::currentCapsLockState() return GetCurrentKeyModifiers() & alphaLock; } +void PlatformKeyboardEvent::getCurrentModifierState(bool& shiftKey, bool& ctrlKey, bool& altKey, bool& metaKey) +{ + UInt32 currentModifiers = GetCurrentKeyModifiers(); + shiftKey = currentModifiers & ::shiftKey; + ctrlKey = currentModifiers & ::controlKey; + altKey = currentModifiers & ::optionKey; + metaKey = currentModifiers & ::cmdKey; +} + } + +#endif // PLATFORM(MAC) diff --git a/src/3rdparty/webkit/WebCore/platform/mac/LocalizedStringsMac.mm b/src/3rdparty/webkit/WebCore/platform/mac/LocalizedStringsMac.mm index 261347f..68f07b5 100644 --- a/src/3rdparty/webkit/WebCore/platform/mac/LocalizedStringsMac.mm +++ b/src/3rdparty/webkit/WebCore/platform/mac/LocalizedStringsMac.mm @@ -683,6 +683,30 @@ String AXLinkActionVerb() return String(); } +String AXMenuListPopupActionVerb() +{ + BEGIN_BLOCK_OBJC_EXCEPTIONS; + return [[WebCoreViewFactory sharedFactory] AXMenuListPopupActionVerb]; + END_BLOCK_OBJC_EXCEPTIONS; + return String(); +} + +String AXMenuListActionVerb() +{ + BEGIN_BLOCK_OBJC_EXCEPTIONS; + return [[WebCoreViewFactory sharedFactory] AXMenuListActionVerb]; + END_BLOCK_OBJC_EXCEPTIONS; + return String(); +} + +String missingPluginText() +{ + BEGIN_BLOCK_OBJC_EXCEPTIONS; + return [[WebCoreViewFactory sharedFactory] missingPluginText]; + END_BLOCK_OBJC_EXCEPTIONS; + return String(); +} + String multipleFileUploadText(unsigned numberOfFiles) { BEGIN_BLOCK_OBJC_EXCEPTIONS; @@ -747,5 +771,60 @@ String localizedMediaTimeDescription(float time) return String(); } +String validationMessageValueMissingText() +{ + BEGIN_BLOCK_OBJC_EXCEPTIONS; + return [[WebCoreViewFactory sharedFactory] validationMessageValueMissingText]; + END_BLOCK_OBJC_EXCEPTIONS; + return String(); +} + +String validationMessageTypeMismatchText() +{ + BEGIN_BLOCK_OBJC_EXCEPTIONS; + return [[WebCoreViewFactory sharedFactory] validationMessageTypeMismatchText]; + END_BLOCK_OBJC_EXCEPTIONS; + return String(); +} + +String validationMessagePatternMismatchText() +{ + BEGIN_BLOCK_OBJC_EXCEPTIONS; + return [[WebCoreViewFactory sharedFactory] validationMessagePatternMismatchText]; + END_BLOCK_OBJC_EXCEPTIONS; + return String(); +} + +String validationMessageTooLongText() +{ + BEGIN_BLOCK_OBJC_EXCEPTIONS; + return [[WebCoreViewFactory sharedFactory] validationMessageTooLongText]; + END_BLOCK_OBJC_EXCEPTIONS; + return String(); +} + +String validationMessageRangeUnderflowText() +{ + BEGIN_BLOCK_OBJC_EXCEPTIONS; + return [[WebCoreViewFactory sharedFactory] validationMessageRangeUnderflowText]; + END_BLOCK_OBJC_EXCEPTIONS; + return String(); +} + +String validationMessageRangeOverflowText() +{ + BEGIN_BLOCK_OBJC_EXCEPTIONS; + return [[WebCoreViewFactory sharedFactory] validationMessageRangeOverflowText]; + END_BLOCK_OBJC_EXCEPTIONS; + return String(); +} + +String validationMessageStepMismatchText() +{ + BEGIN_BLOCK_OBJC_EXCEPTIONS; + return [[WebCoreViewFactory sharedFactory] validationMessageStepMismatchText]; + END_BLOCK_OBJC_EXCEPTIONS; + return String(); +} } diff --git a/src/3rdparty/webkit/WebCore/platform/mac/LoggingMac.mm b/src/3rdparty/webkit/WebCore/platform/mac/LoggingMac.mm index d3ba4d7..3e83579 100644 --- a/src/3rdparty/webkit/WebCore/platform/mac/LoggingMac.mm +++ b/src/3rdparty/webkit/WebCore/platform/mac/LoggingMac.mm @@ -54,7 +54,7 @@ void InitializeLoggingChannelsIfNecessary() initializeWithUserDefault(LogPopupBlocking); initializeWithUserDefault(LogEvents); initializeWithUserDefault(LogEditing); - initializeWithUserDefault(LogTextConversion); + initializeWithUserDefault(LogLiveConnect); initializeWithUserDefault(LogIconDatabase); initializeWithUserDefault(LogSQLDatabase); initializeWithUserDefault(LogSpellingAndGrammar); diff --git a/src/3rdparty/webkit/WebCore/platform/mac/PasteboardMac.mm b/src/3rdparty/webkit/WebCore/platform/mac/PasteboardMac.mm index f048791..086b272 100644 --- a/src/3rdparty/webkit/WebCore/platform/mac/PasteboardMac.mm +++ b/src/3rdparty/webkit/WebCore/platform/mac/PasteboardMac.mm @@ -136,7 +136,7 @@ static NSAttributedString *stripAttachmentCharacters(NSAttributedString *string) void Pasteboard::writeSelection(NSPasteboard* pasteboard, Range* selectedRange, bool canSmartCopyOrDelete, Frame* frame) { if (!WebArchivePboardType) - Pasteboard::generalPasteboard(); // Initialises pasteboard types + Pasteboard::generalPasteboard(); // Initializes pasteboard types. ASSERT(selectedRange); NSAttributedString *attributedString = [[[NSAttributedString alloc] _initWithDOMRange:kit(selectedRange)] autorelease]; @@ -197,6 +197,14 @@ void Pasteboard::writeSelection(NSPasteboard* pasteboard, Range* selectedRange, [pasteboard setData:nil forType:WebSmartPastePboardType]; } } + +void Pasteboard::writePlainText(NSPasteboard* pasteboard, const String& text) +{ + NSArray *types = [NSArray arrayWithObject:NSStringPboardType]; + [pasteboard declareTypes:types owner:nil]; + + [pasteboard setString:text forType:NSStringPboardType]; +} void Pasteboard::writeSelection(Range* selectedRange, bool canSmartCopyOrDelete, Frame* frame) { @@ -206,7 +214,7 @@ void Pasteboard::writeSelection(Range* selectedRange, bool canSmartCopyOrDelete, void Pasteboard::writePlainText(const String& text) { if (!WebArchivePboardType) - Pasteboard::generalPasteboard(); // Initialises pasteboard types + Pasteboard::generalPasteboard(); // Initializes pasteboard types. NSArray *types = [NSArray arrayWithObject:NSStringPboardType]; NSPasteboard *pasteboard = m_pasteboard.get(); @@ -218,7 +226,7 @@ void Pasteboard::writePlainText(const String& text) void Pasteboard::writeURL(NSPasteboard* pasteboard, NSArray* types, const KURL& url, const String& titleStr, Frame* frame) { if (!WebArchivePboardType) - Pasteboard::generalPasteboard(); // Initialises pasteboard types + Pasteboard::generalPasteboard(); // Initializes pasteboard types. if (!types) { types = writableTypesForURL(); @@ -292,9 +300,7 @@ void Pasteboard::writeImage(Node* node, const KURL& url, const String& title) ASSERT(node->renderer() && node->renderer()->isImage()); RenderImage* renderer = toRenderImage(node->renderer()); CachedImage* cachedImage = renderer->cachedImage(); - ASSERT(cachedImage); - - if (cachedImage->errorOccurred()) + if (!cachedImage || cachedImage->errorOccurred()) return; NSArray* types = writableTypesForImage(); @@ -372,7 +378,7 @@ PassRefPtr<DocumentFragment> Pasteboard::documentFragment(Frame* frame, PassRefP } } if ([HTMLString length] != 0) { - RefPtr<DocumentFragment> fragment = createFragmentFromMarkup(frame->document(), HTMLString, ""); + RefPtr<DocumentFragment> fragment = createFragmentFromMarkup(frame->document(), HTMLString, "", FragmentScriptingNotAllowed); if (fragment) return fragment.release(); } diff --git a/src/3rdparty/webkit/WebCore/platform/mac/PlatformMouseEventMac.mm b/src/3rdparty/webkit/WebCore/platform/mac/PlatformMouseEventMac.mm index 74f694e..5b84b4f 100644 --- a/src/3rdparty/webkit/WebCore/platform/mac/PlatformMouseEventMac.mm +++ b/src/3rdparty/webkit/WebCore/platform/mac/PlatformMouseEventMac.mm @@ -158,4 +158,22 @@ PlatformMouseEvent::PlatformMouseEvent(NSEvent* event, NSView *windowView) { } +PlatformMouseEvent::PlatformMouseEvent(int x, int y, int globalX, int globalY, MouseButton button, MouseEventType eventType, + int clickCount, bool shiftKey, bool ctrlKey, bool altKey, bool metaKey, double timestamp, + unsigned modifierFlags, int eventNumber) + : m_position(IntPoint(x, y)) + , m_globalPosition(IntPoint(globalX, globalY)) + , m_button(button) + , m_eventType(eventType) + , m_clickCount(clickCount) + , m_shiftKey(shiftKey) + , m_ctrlKey(ctrlKey) + , m_altKey(altKey) + , m_metaKey(metaKey) + , m_timestamp(timestamp) + , m_modifierFlags(modifierFlags) + , m_eventNumber(eventNumber) +{ +} + } diff --git a/src/3rdparty/webkit/WebCore/platform/mac/PopupMenuMac.mm b/src/3rdparty/webkit/WebCore/platform/mac/PopupMenuMac.mm index dfb0fff..0ecaa13 100644 --- a/src/3rdparty/webkit/WebCore/platform/mac/PopupMenuMac.mm +++ b/src/3rdparty/webkit/WebCore/platform/mac/PopupMenuMac.mm @@ -20,6 +20,8 @@ #import "config.h" #import "PopupMenu.h" +#import "AXObjectCache.h" +#import "Chrome.h" #import "ChromeClient.h" #import "EventHandler.h" #import "Frame.h" @@ -80,8 +82,14 @@ void PopupMenu::populate() else { PopupMenuStyle style = client()->itemStyle(i); NSMutableDictionary* attributes = [[NSMutableDictionary alloc] init]; - if (style.font() != Font()) - [attributes setObject:style.font().primaryFont()->getNSFont() forKey:NSFontAttributeName]; + if (style.font() != Font()) { + NSFont *font = style.font().primaryFont()->getNSFont(); + if (!font) { + CGFloat size = style.font().primaryFont()->platformData().size(); + font = style.font().weight() < FontWeightBold ? [NSFont systemFontOfSize:size] : [NSFont boldSystemFontOfSize:size]; + } + [attributes setObject:font forKey:NSFontAttributeName]; + } // FIXME: Add support for styling the foreground and background colors. // FIXME: Find a way to customize text color when an item is highlighted. NSAttributedString* string = [[NSAttributedString alloc] initWithString:client()->itemText(i) attributes:attributes]; @@ -93,12 +101,21 @@ void PopupMenu::populate() [menuItem setEnabled:client()->itemIsEnabled(i)]; [menuItem setToolTip:client()->itemToolTip(i)]; [string release]; + + // Allow the accessible text of the item to be overriden if necessary. + if (AXObjectCache::accessibilityEnabled()) { + NSString *accessibilityOverride = client()->itemAccessibilityText(i); + if ([accessibilityOverride length]) + [menuItem accessibilitySetOverrideValue:accessibilityOverride forAttribute:NSAccessibilityDescriptionAttribute]; + } } } [[m_popup.get() menu] setMenuChangedMessagesEnabled:messagesEnabled]; } +#if !ENABLE(EXPERIMENTAL_SINGLE_VIEW_MODE) + void PopupMenu::show(const IntRect& r, FrameView* v, int index) { populate(); @@ -179,6 +196,14 @@ void PopupMenu::show(const IntRect& r, FrameView* v, int index) [event release]; } +#else + +void PopupMenu::show(const IntRect&, FrameView*, int) +{ +} + +#endif + void PopupMenu::hide() { [m_popup.get() dismissPopUp]; diff --git a/src/3rdparty/webkit/WebCore/platform/mac/PurgeableBufferMac.cpp b/src/3rdparty/webkit/WebCore/platform/mac/PurgeableBufferMac.cpp index 1b49de0..9902f77 100644 --- a/src/3rdparty/webkit/WebCore/platform/mac/PurgeableBufferMac.cpp +++ b/src/3rdparty/webkit/WebCore/platform/mac/PurgeableBufferMac.cpp @@ -31,11 +31,12 @@ #include <mach/mach.h> #include <wtf/Assertions.h> +#include <wtf/VMTags.h> namespace WebCore { - + static const size_t minPurgeableBufferSize = 4096; // one page - + PurgeableBuffer::PurgeableBuffer(char* data, size_t size) : m_data(data) , m_size(size) @@ -43,7 +44,7 @@ PurgeableBuffer::PurgeableBuffer(char* data, size_t size) , m_state(NonVolatile) { } - + PurgeableBuffer::~PurgeableBuffer() { vm_deallocate(mach_task_self(), reinterpret_cast<vm_address_t>(m_data), m_size); @@ -53,9 +54,9 @@ PurgeableBuffer* PurgeableBuffer::create(const char* data, size_t size) { if (size < minPurgeableBufferSize) return 0; - + vm_address_t buffer = 0; - kern_return_t ret = vm_allocate(mach_task_self(), &buffer, size, VM_FLAGS_PURGABLE | VM_FLAGS_ANYWHERE); + kern_return_t ret = vm_allocate(mach_task_self(), &buffer, size, VM_FLAGS_PURGABLE | VM_FLAGS_ANYWHERE | VM_TAG_FOR_WEBCORE_PURGEABLE_MEMORY); ASSERT(ret == KERN_SUCCESS); if (ret != KERN_SUCCESS) diff --git a/src/3rdparty/webkit/WebCore/platform/mac/RuntimeApplicationChecks.h b/src/3rdparty/webkit/WebCore/platform/mac/RuntimeApplicationChecks.h index f9c7079..24b8ae1 100644 --- a/src/3rdparty/webkit/WebCore/platform/mac/RuntimeApplicationChecks.h +++ b/src/3rdparty/webkit/WebCore/platform/mac/RuntimeApplicationChecks.h @@ -31,6 +31,7 @@ namespace WebCore { bool applicationIsAppleMail(); bool applicationIsSafari(); bool applicationIsMicrosoftMessenger(); +bool applicationIsAdobeInstaller(); } // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/platform/mac/RuntimeApplicationChecks.mm b/src/3rdparty/webkit/WebCore/platform/mac/RuntimeApplicationChecks.mm index a3c4aa5..bcc1dc9 100644 --- a/src/3rdparty/webkit/WebCore/platform/mac/RuntimeApplicationChecks.mm +++ b/src/3rdparty/webkit/WebCore/platform/mac/RuntimeApplicationChecks.mm @@ -47,4 +47,10 @@ bool applicationIsMicrosoftMessenger() return isMicrosoftMessenger; } +bool applicationIsAdobeInstaller() +{ + static bool isAdobeInstaller = [[[NSBundle mainBundle] bundleIdentifier] isEqualToString:@"com.adobe.Installers.Setup"]; + return isAdobeInstaller; +} + } // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/platform/mac/ScrollViewMac.mm b/src/3rdparty/webkit/WebCore/platform/mac/ScrollViewMac.mm index 202d49e..7ef5dc4 100644 --- a/src/3rdparty/webkit/WebCore/platform/mac/ScrollViewMac.mm +++ b/src/3rdparty/webkit/WebCore/platform/mac/ScrollViewMac.mm @@ -107,13 +107,12 @@ bool ScrollView::platformCanBlitOnScroll() const IntRect ScrollView::platformVisibleContentRect(bool includeScrollbars) const { - BEGIN_BLOCK_OBJC_EXCEPTIONS; - if (includeScrollbars) { - if (NSView* documentView = this->documentView()) - return enclosingIntRect([documentView visibleRect]); - } - return enclosingIntRect([scrollView() documentVisibleRect]); - END_BLOCK_OBJC_EXCEPTIONS; + BEGIN_BLOCK_OBJC_EXCEPTIONS; + IntRect result = enclosingIntRect([scrollView() documentVisibleRect]); + if (includeScrollbars) + result.setSize(IntSize([scrollView() frame].size)); + return result; + END_BLOCK_OBJC_EXCEPTIONS; return IntRect(); } @@ -203,4 +202,4 @@ bool ScrollView::platformIsOffscreen() const return ![platformWidget() window] || ![[platformWidget() window] isVisible]; } -} +} // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/platform/mac/ScrollbarThemeMac.h b/src/3rdparty/webkit/WebCore/platform/mac/ScrollbarThemeMac.h index 5af5fd5..c833ee7 100644 --- a/src/3rdparty/webkit/WebCore/platform/mac/ScrollbarThemeMac.h +++ b/src/3rdparty/webkit/WebCore/platform/mac/ScrollbarThemeMac.h @@ -57,6 +57,8 @@ protected: virtual IntRect forwardButtonRect(Scrollbar*, ScrollbarPart, bool painting = false); virtual IntRect trackRect(Scrollbar*, bool painting = false); + virtual int maxOverlapBetweenPages() { return 40; } + virtual int minimumThumbLength(Scrollbar*); virtual bool shouldCenterOnThumb(Scrollbar*, const PlatformMouseEvent&); diff --git a/src/3rdparty/webkit/WebCore/platform/mac/ScrollbarThemeMac.mm b/src/3rdparty/webkit/WebCore/platform/mac/ScrollbarThemeMac.mm index 0a20e2f..067f28f 100644 --- a/src/3rdparty/webkit/WebCore/platform/mac/ScrollbarThemeMac.mm +++ b/src/3rdparty/webkit/WebCore/platform/mac/ScrollbarThemeMac.mm @@ -362,7 +362,7 @@ bool ScrollbarThemeMac::paint(Scrollbar* scrollbar, GraphicsContext* context, co trackInfo.min = 0; trackInfo.max = scrollbar->maximum(); trackInfo.value = scrollbar->currentPos(); - trackInfo.trackInfo.scrollbar.viewsize = scrollbar->pageStep(); + trackInfo.trackInfo.scrollbar.viewsize = scrollbar->visibleSize(); trackInfo.attributes = 0; if (scrollbar->orientation() == HorizontalScrollbar) trackInfo.attributes |= kThemeTrackHorizontal; @@ -396,7 +396,7 @@ bool ScrollbarThemeMac::paint(Scrollbar* scrollbar, GraphicsContext* context, co return true; HIThemeDrawTrack(&trackInfo, 0, imageBuffer->context()->platformContext(), kHIThemeOrientationNormal); - context->drawImage(imageBuffer->image(), scrollbar->frameRect().location()); + context->drawImage(imageBuffer->image(), DeviceColorSpace, scrollbar->frameRect().location()); } return true; diff --git a/src/3rdparty/webkit/WebCore/platform/mac/ThemeMac.mm b/src/3rdparty/webkit/WebCore/platform/mac/ThemeMac.mm index fd2f944..b71a651 100644 --- a/src/3rdparty/webkit/WebCore/platform/mac/ThemeMac.mm +++ b/src/3rdparty/webkit/WebCore/platform/mac/ThemeMac.mm @@ -173,9 +173,9 @@ static LengthSize checkboxSize(const Font& font, const LengthSize& zoomedSize, f return sizeFromFont(font, zoomedSize, zoomFactor, checkboxSizes()); } -static NSButtonCell* checkbox(ControlStates states, const IntRect& zoomedRect, float zoomFactor) +static NSButtonCell *checkbox(ControlStates states, const IntRect& zoomedRect, float zoomFactor) { - static NSButtonCell* checkboxCell; + static NSButtonCell *checkboxCell; if (!checkboxCell) { checkboxCell = [[NSButtonCell alloc] init]; [checkboxCell setButtonType:NSSwitchButton]; @@ -199,7 +199,7 @@ static void paintCheckbox(ControlStates states, GraphicsContext* context, const BEGIN_BLOCK_OBJC_EXCEPTIONS // Determine the width and height needed for the control and prepare the cell for painting. - NSButtonCell* checkboxCell = checkbox(states, zoomedRect, zoomFactor); + NSButtonCell *checkboxCell = checkbox(states, zoomedRect, zoomFactor); context->save(); @@ -254,9 +254,9 @@ static LengthSize radioSize(const Font& font, const LengthSize& zoomedSize, floa return sizeFromFont(font, zoomedSize, zoomFactor, radioSizes()); } -static NSButtonCell* radio(ControlStates states, const IntRect& zoomedRect, float zoomFactor) +static NSButtonCell *radio(ControlStates states, const IntRect& zoomedRect, float zoomFactor) { - static NSButtonCell* radioCell; + static NSButtonCell *radioCell; if (!radioCell) { radioCell = [[NSButtonCell alloc] init]; [radioCell setButtonType:NSRadioButton]; @@ -276,7 +276,7 @@ static NSButtonCell* radio(ControlStates states, const IntRect& zoomedRect, floa static void paintRadio(ControlStates states, GraphicsContext* context, const IntRect& zoomedRect, float zoomFactor, ScrollView* scrollView) { // Determine the width and height needed for the control and prepare the cell for painting. - NSButtonCell* radioCell = radio(states, zoomedRect, zoomFactor); + NSButtonCell *radioCell = radio(states, zoomedRect, zoomFactor); context->save(); @@ -330,14 +330,14 @@ static const int* buttonMargins(NSControlSize controlSize) return margins[controlSize]; } -static NSButtonCell* button(ControlPart part, ControlStates states, const IntRect& zoomedRect, float zoomFactor) +static void setupButtonCell(NSButtonCell *&buttonCell, ControlPart part, ControlStates states, const IntRect& zoomedRect, float zoomFactor) { - static NSButtonCell *buttonCell; - static bool defaultButton; if (!buttonCell) { buttonCell = [[NSButtonCell alloc] init]; [buttonCell setTitle:nil]; [buttonCell setButtonType:NSMomentaryPushInButton]; + if (states & DefaultState) + [buttonCell setKeyEquivalent:@"\r"]; } // Set the control size based off the rectangle we're painting into. @@ -355,17 +355,18 @@ static NSButtonCell* button(ControlPart part, ControlStates states, const IntRec } else if ([buttonCell bezelStyle] != NSRoundedBezelStyle) [buttonCell setBezelStyle:NSRoundedBezelStyle]; - setControlSize(buttonCell, buttonSizes(), zoomedRect.size(), zoomFactor); - - if (defaultButton != (states & DefaultState)) { - defaultButton = !defaultButton; - [buttonCell setKeyEquivalent:(defaultButton ? @"\r" : @"")]; - } + setControlSize(buttonCell, sizes, zoomedRect.size(), zoomFactor); // Update the various states we respond to. updateStates(buttonCell, states); +} - return buttonCell; +static NSButtonCell *button(ControlPart part, ControlStates states, const IntRect& zoomedRect, float zoomFactor) +{ + bool isDefault = states & DefaultState; + static NSButtonCell *cells[2]; + setupButtonCell(cells[isDefault], part, states, zoomedRect, zoomFactor); + return cells[isDefault]; } static void paintButton(ControlPart part, ControlStates states, GraphicsContext* context, const IntRect& zoomedRect, float zoomFactor, ScrollView* scrollView) @@ -408,15 +409,26 @@ static void paintButton(ControlPart part, ControlStates states, GraphicsContext* NSWindow *window = [view window]; NSButtonCell *previousDefaultButtonCell = [window defaultButtonCell]; - if ((states & DefaultState) && [window isKeyWindow]) { + if (states & DefaultState) { [window setDefaultButtonCell:buttonCell]; wkAdvanceDefaultButtonPulseAnimation(buttonCell); } else if ([previousDefaultButtonCell isEqual:buttonCell]) [window setDefaultButtonCell:nil]; + if (!view) { + context->save(); + context->translate(inflatedRect.x(), inflatedRect.y()); + context->scale(FloatSize(1, -1)); + context->translate(0, -inflatedRect.height()); + inflatedRect.setLocation(IntPoint()); + } + [buttonCell drawWithFrame:NSRect(inflatedRect) inView:view]; [buttonCell setControlView:nil]; + if (!view) + context->restore(); + if (![previousDefaultButtonCell isEqual:buttonCell]) [window setDefaultButtonCell:previousDefaultButtonCell]; diff --git a/src/3rdparty/webkit/WebCore/platform/mac/WebCoreObjCExtras.mm b/src/3rdparty/webkit/WebCore/platform/mac/WebCoreObjCExtras.mm index cb8d504..4fc757c 100644 --- a/src/3rdparty/webkit/WebCore/platform/mac/WebCoreObjCExtras.mm +++ b/src/3rdparty/webkit/WebCore/platform/mac/WebCoreObjCExtras.mm @@ -72,8 +72,13 @@ bool WebCoreObjCScheduleDeallocateOnMainThread(Class cls, id object) { ASSERT([object isKindOfClass:cls]); +#if USE(WEB_THREAD) + if (isMainThread()) + return false; +#else if (pthread_main_np() != 0) return false; +#endif ClassAndIdPair* pair = new ClassAndIdPair(cls, object); callOnMainThread(deallocCallback, pair); diff --git a/src/3rdparty/webkit/WebCore/platform/mac/WebCoreSystemInterface.h b/src/3rdparty/webkit/WebCore/platform/mac/WebCoreSystemInterface.h index 768899e..f289ee4 100644 --- a/src/3rdparty/webkit/WebCore/platform/mac/WebCoreSystemInterface.h +++ b/src/3rdparty/webkit/WebCore/platform/mac/WebCoreSystemInterface.h @@ -1,5 +1,5 @@ /* - * Copyright 2006, 2007, 2008 Apple Inc. All rights reserved. + * Copyright 2006, 2007, 2008, 2010 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -48,6 +48,7 @@ typedef struct _NSRect NSRect; @class NSFont; @class NSImage; @class NSMenu; +@class NSMutableArray; @class NSMutableURLRequest; @class NSString; @class NSTextFieldCell; @@ -66,6 +67,7 @@ typedef struct NSEvent NSEvent; typedef struct NSFont NSFont; typedef struct NSImage NSImage; typedef struct NSMenu NSMenu; +typedef struct NSMutableArray NSMutableArray; typedef struct NSMutableURLRequest NSMutableURLRequest; typedef struct NSURLRequest NSURLRequest; typedef struct NSString NSString; @@ -114,9 +116,10 @@ extern ATSUFontID (*wkGetNSFontATSUFontId)(NSFont*); extern double (*wkGetNSURLResponseCalculatedExpiration)(NSURLResponse *response); extern NSDate *(*wkGetNSURLResponseLastModifiedDate)(NSURLResponse *response); extern BOOL (*wkGetNSURLResponseMustRevalidate)(NSURLResponse *response); -extern void (*wkGetWheelEventDeltas)(NSEvent*, float* deltaX, float* deltaY, BOOL* continuous); +extern void (*wkGetWheelEventDeltas)(NSEvent*, float* deltaX, float* deltaY, float* wheelTicksX, float* wheelTicksY, BOOL* continuous); extern BOOL (*wkHitTestMediaUIPart)(int part, int themeStyle, CGRect bounds, CGPoint point); extern void (*wkMeasureMediaUIPart)(int part, int themeStyle, CGRect *bounds, CGSize *naturalSize); +extern BOOL (*wkMediaControllerThemeAvailable)(int themeStyle); extern void (*wkPopupMenu)(NSMenu*, NSPoint location, float width, NSView*, int selectedItem, NSFont*); extern unsigned (*wkQTIncludeOnlyModernMediaFileTypes)(void); extern int (*wkQTMovieDataRate)(QTMovie*); @@ -124,6 +127,8 @@ extern float (*wkQTMovieMaxTimeLoaded)(QTMovie*); extern NSString *(*wkQTMovieMaxTimeLoadedChangeNotification)(void); extern float (*wkQTMovieMaxTimeSeekable)(QTMovie*); extern int (*wkQTMovieGetType)(QTMovie* movie); +extern BOOL (*wkQTMovieHasClosedCaptions)(QTMovie* movie); +extern void (*wkQTMovieSetShowClosedCaptions)(QTMovie* movie, BOOL showClosedCaptions); extern void (*wkQTMovieViewSetDrawSynchronously)(QTMovieView*, BOOL); extern void (*wkSetCGFontRenderingMode)(CGContextRef, NSFont*); extern void (*wkSetDragImage)(NSImage*, NSPoint offset); @@ -131,11 +136,15 @@ extern void (*wkSetNSURLConnectionDefersCallbacks)(NSURLConnection *, BOOL); extern void (*wkSetNSURLRequestShouldContentSniff)(NSMutableURLRequest *, BOOL); extern void (*wkSetPatternBaseCTM)(CGContextRef, CGAffineTransform); extern void (*wkSetPatternPhaseInUserSpace)(CGContextRef, CGPoint); +extern CGAffineTransform (*wkGetUserToBaseCTM)(CGContextRef); extern void (*wkSetUpFontCache)(); extern void (*wkSignalCFReadStreamEnd)(CFReadStreamRef stream); extern void (*wkSignalCFReadStreamError)(CFReadStreamRef stream, CFStreamError *error); extern void (*wkSignalCFReadStreamHasBytes)(CFReadStreamRef stream); extern unsigned (*wkInitializeMaximumHTTPConnectionCountPerHost)(unsigned preferredConnectionCount); +extern void (*wkSetCONNECTProxyForStream)(CFReadStreamRef, CFStringRef proxyHost, CFNumberRef proxyPort); +extern void (*wkSetCONNECTProxyAuthorizationForStream)(CFReadStreamRef, CFStringRef proxyAuthorizationString); +extern CFHTTPMessageRef (*wkCopyCONNECTProxyResponse)(CFReadStreamRef, CFURLRef responseURL); extern BOOL (*wkIsLatchingWheelEvent)(NSEvent *); #ifndef BUILDING_ON_TIGER @@ -160,6 +169,12 @@ extern BOOL (*wkSupportsMultipartXMixedReplace)(NSMutableURLRequest *); extern BOOL (*wkUseSharedMediaUI)(); +#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +extern NSMutableArray *(*wkNoteOpenPanelFiles)(NSArray *); +#else +extern void* wkNoteOpenPanelFiles; +#endif + #ifdef __cplusplus } #endif diff --git a/src/3rdparty/webkit/WebCore/platform/mac/WebCoreSystemInterface.mm b/src/3rdparty/webkit/WebCore/platform/mac/WebCoreSystemInterface.mm index d0e276f..b276467 100644 --- a/src/3rdparty/webkit/WebCore/platform/mac/WebCoreSystemInterface.mm +++ b/src/3rdparty/webkit/WebCore/platform/mac/WebCoreSystemInterface.mm @@ -1,5 +1,5 @@ /* - * Copyright 2006, 2007, 2008 Apple Computer, Inc. All rights reserved. + * Copyright 2006, 2007, 2008, 2010 Apple Computer, Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -44,13 +44,14 @@ void (*wkDrawMediaSliderTrack)(int themeStyle, CGContextRef context, CGRect rect BOOL (*wkHitTestMediaUIPart)(int part, int themeStyle, CGRect bounds, CGPoint point); void (*wkDrawMediaUIPart)(int part, int themeStyle, CGContextRef context, CGRect rect, unsigned state); void (*wkMeasureMediaUIPart)(int part, int themeStyle, CGRect *bounds, CGSize *naturalSize); +BOOL (*wkMediaControllerThemeAvailable)(int themeStyle); NSString* (*wkGetPreferredExtensionForMIMEType)(NSString*); NSArray* (*wkGetExtensionsForMIMEType)(NSString*); NSString* (*wkGetMIMETypeForExtension)(NSString*); NSTimeInterval (*wkGetNSURLResponseCalculatedExpiration)(NSURLResponse *response); NSDate *(*wkGetNSURLResponseLastModifiedDate)(NSURLResponse *response); BOOL (*wkGetNSURLResponseMustRevalidate)(NSURLResponse *response); -void (*wkGetWheelEventDeltas)(NSEvent*, float* deltaX, float* deltaY, BOOL* continuous); +void (*wkGetWheelEventDeltas)(NSEvent*, float* deltaX, float* deltaY, float* wheelTicksX, float* wheelTicksY, BOOL* continuous); void (*wkPopupMenu)(NSMenu*, NSPoint location, float width, NSView*, int selectedItem, NSFont*); unsigned (*wkQTIncludeOnlyModernMediaFileTypes)(void); int (*wkQTMovieDataRate)(QTMovie*); @@ -58,11 +59,14 @@ float (*wkQTMovieMaxTimeLoaded)(QTMovie*); NSString *(*wkQTMovieMaxTimeLoadedChangeNotification)(void); float (*wkQTMovieMaxTimeSeekable)(QTMovie*); int (*wkQTMovieGetType)(QTMovie* movie); +BOOL (*wkQTMovieHasClosedCaptions)(QTMovie* movie); +void (*wkQTMovieSetShowClosedCaptions)(QTMovie* movie, BOOL showClosedCaptions); void (*wkQTMovieViewSetDrawSynchronously)(QTMovieView*, BOOL); void (*wkSetCGFontRenderingMode)(CGContextRef, NSFont*); void (*wkSetDragImage)(NSImage*, NSPoint offset); void (*wkSetPatternBaseCTM)(CGContextRef, CGAffineTransform); void (*wkSetPatternPhaseInUserSpace)(CGContextRef, CGPoint point); +CGAffineTransform (*wkGetUserToBaseCTM)(CGContextRef); void (*wkSetUpFontCache)(); void (*wkSignalCFReadStreamEnd)(CFReadStreamRef stream); void (*wkSignalCFReadStreamHasBytes)(CFReadStreamRef stream); @@ -80,6 +84,9 @@ void (*wkSetNSURLConnectionDefersCallbacks)(NSURLConnection *, BOOL); void (*wkSetNSURLRequestShouldContentSniff)(NSMutableURLRequest *, BOOL); id (*wkCreateNSURLConnectionDelegateProxy)(void); unsigned (*wkInitializeMaximumHTTPConnectionCountPerHost)(unsigned preferredConnectionCount); +void (*wkSetCONNECTProxyForStream)(CFReadStreamRef, CFStringRef proxyHost, CFNumberRef proxyPort); +void (*wkSetCONNECTProxyAuthorizationForStream)(CFReadStreamRef, CFStringRef proxyAuthorizationString); +CFHTTPMessageRef (*wkCopyCONNECTProxyResponse)(CFReadStreamRef, CFURLRef responseURL); BOOL (*wkIsLatchingWheelEvent)(NSEvent *); #ifndef BUILDING_ON_TIGER @@ -100,3 +107,9 @@ void (*wkReleaseStyleGroup)(void* group); ATSUFontID (*wkGetNSFontATSUFontId)(NSFont*); BOOL (*wkSupportsMultipartXMixedReplace)(NSMutableURLRequest *); #endif + +#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +NSMutableArray *(*wkNoteOpenPanelFiles)(NSArray *); +#else +void* wkNoteOpenPanelFiles; +#endif diff --git a/src/3rdparty/webkit/WebCore/platform/mac/WheelEventMac.mm b/src/3rdparty/webkit/WebCore/platform/mac/WheelEventMac.mm index f380e3e..d7e2934 100644 --- a/src/3rdparty/webkit/WebCore/platform/mac/WheelEventMac.mm +++ b/src/3rdparty/webkit/WebCore/platform/mac/WheelEventMac.mm @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004, 2006 Apple Computer, Inc. All rights reserved. + * Copyright (C) 2004, 2006, 2010 Apple Computer, Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -43,15 +43,11 @@ PlatformWheelEvent::PlatformWheelEvent(NSEvent* event, NSView *windowView) , m_metaKey([event modifierFlags] & NSCommandKeyMask) { BOOL continuous; - wkGetWheelEventDeltas(event, &m_deltaX, &m_deltaY, &continuous); - if (continuous) { - m_wheelTicksX = m_deltaX / static_cast<float>(cScrollbarPixelsPerLineStep); - m_wheelTicksY = m_deltaY / static_cast<float>(cScrollbarPixelsPerLineStep); - } else { - m_wheelTicksX = m_deltaX; - m_wheelTicksY = m_deltaY; - m_deltaX *= static_cast<float>(cScrollbarPixelsPerLineStep); - m_deltaY *= static_cast<float>(cScrollbarPixelsPerLineStep); + wkGetWheelEventDeltas(event, &m_deltaX, &m_deltaY, &m_wheelTicksX, &m_wheelTicksY, &continuous); + + if (!continuous) { + m_deltaX *= static_cast<float>(Scrollbar::pixelsPerLineStep()); + m_deltaY *= static_cast<float>(Scrollbar::pixelsPerLineStep()); } } diff --git a/src/3rdparty/webkit/WebCore/platform/mac/WidgetMac.mm b/src/3rdparty/webkit/WebCore/platform/mac/WidgetMac.mm index 8653a03..1aad76f 100644 --- a/src/3rdparty/webkit/WebCore/platform/mac/WidgetMac.mm +++ b/src/3rdparty/webkit/WebCore/platform/mac/WidgetMac.mm @@ -31,12 +31,14 @@ #endif #import "BlockExceptions.h" +#import "Chrome.h" #import "Cursor.h" #import "Document.h" #import "Font.h" #import "FoundationExtras.h" #import "Frame.h" #import "GraphicsContext.h" +#import "NotImplemented.h" #import "Page.h" #import "PlatformMouseEvent.h" #import "ScrollView.h" @@ -54,12 +56,22 @@ - (void)webPlugInSetIsSelected:(BOOL)isSelected; @end +@interface NSView (Widget) +- (void)visibleRectDidChange; +@end + namespace WebCore { class WidgetPrivate { public: + WidgetPrivate() + : previousVisibleRect(NSZeroRect) + { + } + bool mustStayInWindow; bool removeFromSuperviewSoon; + NSRect previousVisibleRect; }; static void safeRemoveFromSuperview(NSView *view) @@ -78,7 +90,7 @@ static void safeRemoveFromSuperview(NSView *view) [window _setNeedsToResetDragMargins:resetDragMargins]; } -Widget::Widget(NSView* view) +Widget::Widget(NSView *view) : m_data(new WidgetPrivate) { init(view); @@ -157,11 +169,18 @@ void Widget::setFrameRect(const IntRect& rect) BEGIN_BLOCK_OBJC_EXCEPTIONS; NSView *v = getOuterView(); + if (!v) + return; + + NSRect visibleRect = [v visibleRect]; NSRect f = rect; if (!NSEqualRects(f, [v frame])) { [v setFrame:f]; - [v setNeedsDisplay: NO]; - } + [v setNeedsDisplay:NO]; + } else if (!NSEqualRects(visibleRect, m_data->previousVisibleRect) && [v respondsToSelector:@selector(visibleRectDidChange)]) + [v visibleRectDidChange]; + + m_data->previousVisibleRect = visibleRect; END_BLOCK_OBJC_EXCEPTIONS; } @@ -192,7 +211,7 @@ void Widget::paint(GraphicsContext* p, const IntRect& r) END_BLOCK_OBJC_EXCEPTIONS; } else { // This is the case of drawing into a bitmap context other than a window backing store. It gets hit beneath - // -cacheDisplayInRect:toBitmapImageRep:. + // -cacheDisplayInRect:toBitmapImageRep:, and when painting into compositing layers. // Transparent subframes are in fact implemented with scroll views that return YES from -drawsBackground (whenever the WebView // itself is in drawsBackground mode). In the normal drawing code path, the scroll views are never asked to draw the background, @@ -334,6 +353,7 @@ IntPoint Widget::convertFromContainingWindowToRoot(const Widget* rootWidget, con void Widget::releasePlatformWidget() { HardRelease(m_widget); + m_data->previousVisibleRect = NSZeroRect; } void Widget::retainPlatformWidget() @@ -341,5 +361,5 @@ void Widget::retainPlatformWidget() HardRetain(m_widget); } -} +} // namespace WebCore |