diff options
Diffstat (limited to 'WebCore/page/mac/FrameMac.mm')
| -rw-r--r-- | WebCore/page/mac/FrameMac.mm | 72 |
1 files changed, 8 insertions, 64 deletions
diff --git a/WebCore/page/mac/FrameMac.mm b/WebCore/page/mac/FrameMac.mm index c656624..fce5704 100644 --- a/WebCore/page/mac/FrameMac.mm +++ b/WebCore/page/mac/FrameMac.mm @@ -28,7 +28,6 @@ #import "config.h" #import "Frame.h" -#import "Base64.h" #import "BlockExceptions.h" #import "ColorMac.h" #import "Cursor.h" @@ -53,7 +52,6 @@ #import "RenderTableCell.h" #import "Scrollbar.h" #import "SimpleFontData.h" -#import "UserStyleSheetLoader.h" #import "WebCoreViewFactory.h" #import "visible_units.h" @@ -273,7 +271,9 @@ NSImage* Frame::imageFromRect(NSRect rect) const if (![view respondsToSelector:@selector(drawSingleRect:)]) return nil; - NSImage* resultImage; + PaintBehavior oldPaintBehavior = m_view->paintBehavior(); + m_view->setPaintBehavior(oldPaintBehavior | PaintBehaviorFlattenCompositingLayers); + BEGIN_BLOCK_OBJC_EXCEPTIONS; NSRect bounds = [view bounds]; @@ -284,7 +284,7 @@ NSImage* Frame::imageFromRect(NSRect rect) const rect.size.width = roundf(rect.size.width); rect = [view convertRect:rect fromView:nil]; - resultImage = [[[NSImage alloc] initWithSize:rect.size] autorelease]; + NSImage* resultImage = [[[NSImage alloc] initWithSize:rect.size] autorelease]; if (rect.size.width != 0 && rect.size.height != 0) { [resultImage setFlipped:YES]; @@ -303,19 +303,21 @@ NSImage* Frame::imageFromRect(NSRect rect) const [resultImage setFlipped:NO]; } + m_view->setPaintBehavior(oldPaintBehavior); return resultImage; END_BLOCK_OBJC_EXCEPTIONS; + m_view->setPaintBehavior(oldPaintBehavior); return nil; } NSImage* Frame::selectionImage(bool forceBlackText) const { - m_view->setPaintRestriction(forceBlackText ? PaintRestrictionSelectionOnlyBlackText : PaintRestrictionSelectionOnly); + m_view->setPaintBehavior(PaintBehaviorSelectionOnly | (forceBlackText ? PaintBehaviorForceBlackText : 0)); m_doc->updateLayout(); NSImage* result = imageFromRect(selectionBounds()); - m_view->setPaintRestriction(PaintRestrictionNone); + m_view->setPaintBehavior(PaintBehaviorNormal); return result; } @@ -461,33 +463,6 @@ NSWritingDirection Frame::baseWritingDirectionForSelectionStart() const return result; } -const short enableRomanKeyboardsOnly = -23; -void Frame::setUseSecureKeyboardEntry(bool enable) -{ - 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 - } -} - #if ENABLE(DASHBOARD_SUPPORT) NSMutableDictionary* Frame::dashboardRegionsDictionary() { @@ -533,35 +508,4 @@ DragImageRef Frame::dragImageForSelection() return selectionImage(); } -void Frame::setUserStyleSheetLocation(const KURL& url) -{ - delete m_userStyleSheetLoader; - m_userStyleSheetLoader = 0; - - // Data URLs with base64-encoded UTF-8 style sheets are common. We can process them - // synchronously and avoid using a loader. - if (url.protocolIs("data") && url.string().startsWith("data:text/css;charset=utf-8;base64,")) { - const unsigned prefixLength = 35; - Vector<char> encodedData(url.string().length() - prefixLength); - for (unsigned i = prefixLength; i < url.string().length(); ++i) - encodedData[i - prefixLength] = static_cast<char>(url.string()[i]); - - Vector<char> styleSheetAsUTF8; - if (base64Decode(encodedData, styleSheetAsUTF8)) { - m_doc->setUserStyleSheet(String::fromUTF8(styleSheetAsUTF8.data())); - return; - } - } - - if (m_doc->docLoader()) - m_userStyleSheetLoader = new UserStyleSheetLoader(m_doc, url.string()); -} - -void Frame::setUserStyleSheet(const String& styleSheet) -{ - delete m_userStyleSheetLoader; - m_userStyleSheetLoader = 0; - m_doc->setUserStyleSheet(styleSheet); -} - } // namespace WebCore |
