diff options
Diffstat (limited to 'WebCore/page/Frame.cpp')
-rw-r--r-- | WebCore/page/Frame.cpp | 83 |
1 files changed, 63 insertions, 20 deletions
diff --git a/WebCore/page/Frame.cpp b/WebCore/page/Frame.cpp index b9bf94e..7e81b3d 100644 --- a/WebCore/page/Frame.cpp +++ b/WebCore/page/Frame.cpp @@ -82,6 +82,10 @@ #include <wtf/RefCountedLeakCounter.h> #include <wtf/StdLibExtras.h> +#if PLATFORM(MAC) || (PLATFORM(CHROMIUM) && PLATFORM(DARWIN)) +#import <Carbon/Carbon.h> +#endif + #if USE(JSC) #include "JSDOMWindowShell.h" #include "runtime_root.h" @@ -874,10 +878,10 @@ void Frame::injectUserScripts(UserScriptInjectionTime injectionTime) return; UserScriptMap::const_iterator end = userScripts->end(); for (UserScriptMap::const_iterator it = userScripts->begin(); it != end; ++it) - injectUserScriptsForWorld(it->first, *it->second, injectionTime); + injectUserScriptsForWorld(it->first.get(), *it->second, injectionTime); } -void Frame::injectUserScriptsForWorld(unsigned worldID, const UserScriptVector& userScripts, UserScriptInjectionTime injectionTime) +void Frame::injectUserScriptsForWorld(DOMWrapperWorld* world, const UserScriptVector& userScripts, UserScriptInjectionTime injectionTime) { if (userScripts.isEmpty()) return; @@ -891,9 +895,8 @@ void Frame::injectUserScriptsForWorld(unsigned worldID, const UserScriptVector& for (unsigned i = 0; i < count; ++i) { UserScript* script = userScripts[i].get(); if (script->injectionTime() == injectionTime && UserContentURLPattern::matchesPatterns(doc->url(), script->whitelist(), script->blacklist())) - sourceCode.append(ScriptSourceCode(script->source(), script->url())); + m_script.evaluateInWorld(ScriptSourceCode(script->source(), script->url()), world); } - script()->evaluateInIsolatedWorld(worldID, sourceCode); } bool Frame::shouldChangeSelection(const VisibleSelection& newSelection) const @@ -919,13 +922,36 @@ bool Frame::isContentEditable() const return m_doc->inDesignMode(); } -#if !PLATFORM(MAC) - -void Frame::setUseSecureKeyboardEntry(bool) +#if PLATFORM(MAC) || (PLATFORM(CHROMIUM) && PLATFORM(DARWIN)) +const short enableRomanKeyboardsOnly = -23; +#endif +void Frame::setUseSecureKeyboardEntry(bool enable) { -} - +#if PLATFORM(MAC) || (PLATFORM(CHROMIUM) && PLATFORM(DARWIN)) + if (enable == IsSecureEventInputEnabled()) + return; + if (enable) { + EnableSecureEventInput(); +#ifdef BUILDING_ON_TIGER + KeyScript(enableRomanKeyboardsOnly); +#else + // WebKit substitutes nil for input context when in password field, which corresponds to null TSMDocument. So, there is + // no need to call TSMGetActiveDocument(), which may return an incorrect result when selection hasn't been yet updated + // after focusing a node. + CFArrayRef inputSources = TISCreateASCIICapableInputSourceList(); + TSMSetDocumentProperty(0, kTSMDocumentEnabledInputSourcesPropertyTag, sizeof(CFArrayRef), &inputSources); + CFRelease(inputSources); +#endif + } else { + DisableSecureEventInput(); +#ifdef BUILDING_ON_TIGER + KeyScript(smKeyEnableKybds); +#else + TSMRemoveDocumentProperty(0, kTSMDocumentEnabledInputSourcesPropertyTag); +#endif + } #endif +} void Frame::updateSecureKeyboardEntryIfActive() { @@ -1244,7 +1270,7 @@ FloatRect Frame::selectionBounds(bool clipToVisibleContent) const return clipToVisibleContent ? intersection(selectionRect, view->visibleContentRect()) : selectionRect; } -void Frame::selectionTextRects(Vector<FloatRect>& rects, bool clipToVisibleContent) const +void Frame::selectionTextRects(Vector<FloatRect>& rects, SelectionRectRespectTransforms respectTransforms, bool clipToVisibleContent) const { RenderView* root = contentRenderer(); if (!root) @@ -1252,19 +1278,36 @@ void Frame::selectionTextRects(Vector<FloatRect>& rects, bool clipToVisibleConte RefPtr<Range> selectedRange = selection()->toNormalizedRange(); - Vector<IntRect> intRects; - selectedRange->textRects(intRects, true); - - unsigned size = intRects.size(); FloatRect visibleContentRect = m_view->visibleContentRect(); - for (unsigned i = 0; i < size; ++i) - if (clipToVisibleContent) - rects.append(intersection(intRects[i], visibleContentRect)); - else - rects.append(intRects[i]); + + // FIMXE: we are appending empty rects to the list for those that fall outside visibleContentRect. + // We may not want to do that. + if (respectTransforms) { + Vector<FloatQuad> quads; + selectedRange->textQuads(quads, true); + + unsigned size = quads.size(); + for (unsigned i = 0; i < size; ++i) { + IntRect currRect = quads[i].enclosingBoundingBox(); + if (clipToVisibleContent) + rects.append(intersection(currRect, visibleContentRect)); + else + rects.append(currRect); + } + } else { + Vector<IntRect> intRects; + selectedRange->textRects(intRects, true); + + unsigned size = intRects.size(); + for (unsigned i = 0; i < size; ++i) { + if (clipToVisibleContent) + rects.append(intersection(intRects[i], visibleContentRect)); + else + rects.append(intRects[i]); + } + } } - // Scans logically forward from "start", including any child frames static HTMLFormElement *scanForForm(Node *start) { |