diff options
Diffstat (limited to 'WebKit/mac/WebView/WebFrame.mm')
| -rw-r--r-- | WebKit/mac/WebView/WebFrame.mm | 370 |
1 files changed, 239 insertions, 131 deletions
diff --git a/WebKit/mac/WebView/WebFrame.mm b/WebKit/mac/WebView/WebFrame.mm index 41d7e01..fb6d69c 100644 --- a/WebKit/mac/WebView/WebFrame.mm +++ b/WebKit/mac/WebView/WebFrame.mm @@ -39,11 +39,11 @@ #import "WebChromeClient.h" #import "WebDataSourceInternal.h" #import "WebDocumentLoaderMac.h" +#import "WebDynamicScrollBarsView.h" #import "WebFrameLoaderClient.h" #import "WebFrameViewInternal.h" #import "WebHTMLView.h" #import "WebHTMLViewInternal.h" -#import "WebIconFetcherInternal.h" #import "WebKitStatisticsPrivate.h" #import "WebKitVersionChecks.h" #import "WebNSObjectExtras.h" @@ -59,12 +59,13 @@ #import <WebCore/Chrome.h> #import <WebCore/ColorMac.h> #import <WebCore/DOMImplementation.h> -#import <WebCore/DocLoader.h> +#import <WebCore/CachedResourceLoader.h> #import <WebCore/DocumentFragment.h> #import <WebCore/EventHandler.h> #import <WebCore/EventNames.h> #import <WebCore/Frame.h> #import <WebCore/FrameLoader.h> +#import <WebCore/FrameLoaderStateMachine.h> #import <WebCore/FrameTree.h> #import <WebCore/GraphicsContext.h> #import <WebCore/HTMLFrameOwnerElement.h> @@ -73,6 +74,7 @@ #import <WebCore/LegacyWebArchive.h> #import <WebCore/Page.h> #import <WebCore/PluginData.h> +#import <WebCore/PrintContext.h> #import <WebCore/RenderLayer.h> #import <WebCore/RenderPart.h> #import <WebCore/RenderView.h> @@ -87,6 +89,7 @@ #import <WebCore/htmlediting.h> #import <WebCore/markup.h> #import <WebCore/visible_units.h> +#import <WebKitSystemInterface.h> #import <runtime/JSLock.h> #import <runtime/JSObject.h> #import <runtime/JSValue.h> @@ -193,6 +196,20 @@ EditableLinkBehavior core(WebKitEditableLinkBehavior editableLinkBehavior) return EditableLinkDefaultBehavior; } +WebCore::EditingBehaviorType core(WebKitEditingBehavior behavior) +{ + switch (behavior) { + case WebKitEditingMacBehavior: + return WebCore::EditingMacBehavior; + case WebKitEditingWinBehavior: + return WebCore::EditingWindowsBehavior; + case WebKitEditingUnixBehavior: + return WebCore::EditingUnixBehavior; + } + ASSERT_NOT_REACHED(); + return WebCore::EditingMacBehavior; +} + TextDirectionSubmenuInclusionBehavior core(WebTextDirectionSubmenuInclusionBehavior behavior) { switch (behavior) { @@ -269,6 +286,11 @@ WebView *getWebView(WebFrame *webFrame) return [self _createFrameWithPage:ownerElement->document()->frame()->page() frameName:name frameView:frameView ownerElement:ownerElement]; } +- (BOOL)_isIncludedInWebKitStatistics +{ + return _private && _private->includedInWebKitStatistics; +} + - (void)_attachScriptDebugger { ScriptController* scriptController = _private->coreFrame->script(); @@ -308,6 +330,11 @@ WebView *getWebView(WebFrame *webFrame) _private = [[WebFramePrivate alloc] init]; + // Set includedInWebKitStatistics before calling WebFrameView _setWebFrame, since + // it calls WebFrame _isIncludedInWebKitStatistics. + if ((_private->includedInWebKitStatistics = [[v class] shouldIncludeInWebKitStatistics])) + ++WebFrameCount; + if (fv) { [_private setWebFrameView:fv]; [fv _setWebFrame:self]; @@ -315,8 +342,6 @@ WebView *getWebView(WebFrame *webFrame) _private->shouldCreateRenderers = YES; - ++WebFrameCount; - return self; } @@ -371,7 +396,7 @@ WebView *getWebView(WebFrame *webFrame) Frame* coreFrame = _private->coreFrame; for (Frame* frame = coreFrame; frame; frame = frame->tree()->traverseNext(coreFrame)) { if (Document* document = frame->document()) - document->removeMarkers(DocumentMarker::Grammar); + document->markers()->removeMarkers(DocumentMarker::Grammar); } } #endif @@ -381,7 +406,7 @@ WebView *getWebView(WebFrame *webFrame) Frame* coreFrame = _private->coreFrame; for (Frame* frame = coreFrame; frame; frame = frame->tree()->traverseNext(coreFrame)) { if (Document* document = frame->document()) - document->removeMarkers(DocumentMarker::Spelling); + document->markers()->removeMarkers(DocumentMarker::Spelling); } } @@ -463,21 +488,6 @@ static inline WebDataSource *dataSource(DocumentLoader* loader) return dataSource(_private->coreFrame->loader()->documentLoader()); } -- (void)_addData:(NSData *)data -{ - Document* document = _private->coreFrame->document(); - - // Document may be nil if the part is about to redirect - // as a result of JS executing during load, i.e. one frame - // changing another's location before the frame's document - // has been created. - if (!document) - return; - - document->setShouldCreateRenderers(_private->shouldCreateRenderers); - _private->coreFrame->loader()->addData((const char *)[data bytes], [data length]); -} - - (NSString *)_stringWithDocumentTypeStringAndMarkupString:(NSString *)markupString { return _private->coreFrame->documentTypeString() + markupString; @@ -505,7 +515,7 @@ static inline WebDataSource *dataSource(DocumentLoader* loader) - (NSString *)_selectedString { - return _private->coreFrame->displayStringModifiedByEncoding(_private->coreFrame->selectedText()); + return _private->coreFrame->displayStringModifiedByEncoding(_private->coreFrame->editor()->selectedText()); } - (NSString *)_stringForRange:(DOMRange *)range @@ -521,16 +531,57 @@ static inline WebDataSource *dataSource(DocumentLoader* loader) return [[[NSString alloc] initWithCharactersNoCopy:buf length:length freeWhenDone:YES] autorelease]; } +- (BOOL)_shouldFlattenCompositingLayers:(CGContextRef)context +{ + // -currentContextDrawingToScreen returns YES for bitmap contexts. + BOOL isPrinting = ![NSGraphicsContext currentContextDrawingToScreen]; + if (isPrinting) + return YES; + + if (!WKCGContextIsBitmapContext(context)) + return NO; + + // If we're drawing into a bitmap, we might be snapshotting, or drawing into a layer-backed view. + if ([getWebView(self) _usesDocumentViews]) { + id documentView = [_private->webFrameView documentView]; + if ([documentView isKindOfClass:[WebHTMLView class]] && [(WebHTMLView *)documentView _web_isDrawingIntoLayer]) + return NO; + } + + return [getWebView(self) _includesFlattenedCompositingLayersWhenDrawingToBitmap]; +} + - (void)_drawRect:(NSRect)rect contentsOnly:(BOOL)contentsOnly { - PlatformGraphicsContext* platformContext = static_cast<PlatformGraphicsContext*>([[NSGraphicsContext currentContext] graphicsPort]); ASSERT([[NSGraphicsContext currentContext] isFlipped]); - GraphicsContext context(platformContext); + + CGContextRef ctx = static_cast<CGContextRef>([[NSGraphicsContext currentContext] graphicsPort]); + GraphicsContext context(ctx); + + FrameView* view = _private->coreFrame->view(); + + bool shouldFlatten = false; + if (Frame* parentFrame = _private->coreFrame->tree()->parent()) { + // For subframes, we need to inherit the paint behavior from our parent + FrameView* parentView = parentFrame ? parentFrame->view() : 0; + if (parentView) + shouldFlatten = parentView->paintBehavior() & PaintBehaviorFlattenCompositingLayers; + } else + shouldFlatten = [self _shouldFlattenCompositingLayers:ctx]; + + PaintBehavior oldBehavior = PaintBehaviorNormal; + if (shouldFlatten) { + oldBehavior = view->paintBehavior(); + view->setPaintBehavior(oldBehavior | PaintBehaviorFlattenCompositingLayers); + } if (contentsOnly) _private->coreFrame->view()->paintContents(&context, enclosingIntRect(rect)); else _private->coreFrame->view()->paint(&context, enclosingIntRect(rect)); + + if (shouldFlatten) + view->setPaintBehavior(oldBehavior); } // Used by pagination code called from AppKit when a standalone web page is printed. @@ -559,22 +610,16 @@ static inline WebDataSource *dataSource(DocumentLoader* loader) if (!documentView) return pages; - float currPageHeight = printHeight; - float docHeight = root->layer()->height(); float docWidth = root->layer()->width(); - float printWidth = docWidth/printWidthScaleFactor; - - // We need to give the part the opportunity to adjust the page height at each step. - for (float i = 0; i < docHeight; i += currPageHeight) { - float proposedBottom = min(docHeight, i + printHeight); - view->adjustPageHeight(&proposedBottom, i, proposedBottom, i); - currPageHeight = max(1.0f, proposedBottom - i); - for (float j = 0; j < docWidth; j += printWidth) { - NSValue* val = [NSValue valueWithRect: NSMakeRect(j, i, printWidth, currPageHeight)]; - [pages addObject: val]; - } - } - + float printWidth = docWidth / printWidthScaleFactor; + + PrintContext printContext(_private->coreFrame); + printContext.computePageRectsWithPageSize(FloatSize(printWidth, printHeight), true); + + const Vector<IntRect>& pageRects = printContext.pageRects(); + const size_t pageCount = pageRects.size(); + for (size_t pageNumber = 0; pageNumber < pageCount; ++pageNumber) + [pages addObject: [NSValue valueWithRect: NSRect(pageRects[pageNumber])]]; return pages; } @@ -612,7 +657,7 @@ static inline WebDataSource *dataSource(DocumentLoader* loader) return @""; JSLock lock(SilenceAssertionsOnly); - return String(result.toString(_private->coreFrame->script()->globalObject(mainThreadNormalWorld())->globalExec())); + return ustringToString(result.toString(_private->coreFrame->script()->globalObject(mainThreadNormalWorld())->globalExec())); } - (NSRect)_caretRectAtNode:(DOMNode *)node offset:(int)offset affinity:(NSSelectionAffinity)affinity @@ -623,7 +668,7 @@ static inline WebDataSource *dataSource(DocumentLoader* loader) - (NSRect)_firstRectForDOMRange:(DOMRange *)range { - return _private->coreFrame->firstRectForRange(core(range)); + return _private->coreFrame->editor()->firstRectForRange(core(range)); } - (void)_scrollDOMRangeToVisible:(DOMRange *)range @@ -676,7 +721,7 @@ static inline WebDataSource *dataSource(DocumentLoader* loader) - (TextGranularity)_selectionGranularity { - return _private->coreFrame->selectionGranularity(); + return _private->coreFrame->selection()->granularity(); } - (NSRange)_convertToNSRange:(Range *)range @@ -749,7 +794,7 @@ static inline WebDataSource *dataSource(DocumentLoader* loader) - (DOMRange *)_markDOMRange { - return kit(_private->coreFrame->mark().toNormalizedRange().get()); + return kit(_private->coreFrame->editor()->mark().toNormalizedRange().get()); } // Given proposedRange, returns an extended range that includes adjacent whitespace that should @@ -785,64 +830,6 @@ static inline WebDataSource *dataSource(DocumentLoader* loader) return kit(range.get()); } -// Determines whether whitespace needs to be added around aString to preserve proper spacing and -// punctuation when it’s inserted into the receiver’s text over charRange. Returns by reference -// in beforeString and afterString any whitespace that should be added, unless either or both are -// nil. Both are returned as nil if aString is nil or if smart insertion and deletion are disabled. -- (void)_smartInsertForString:(NSString *)pasteString replacingRange:(DOMRange *)rangeToReplace beforeString:(NSString **)beforeString afterString:(NSString **)afterString -{ - // give back nil pointers in case of early returns - if (beforeString) - *beforeString = nil; - if (afterString) - *afterString = nil; - - // inspect destination - Node *startContainer = core([rangeToReplace startContainer]); - Node *endContainer = core([rangeToReplace endContainer]); - - Position startPos(startContainer, [rangeToReplace startOffset]); - Position endPos(endContainer, [rangeToReplace endOffset]); - - VisiblePosition startVisiblePos = VisiblePosition(startPos, VP_DEFAULT_AFFINITY); - VisiblePosition endVisiblePos = VisiblePosition(endPos, VP_DEFAULT_AFFINITY); - - // this check also ensures startContainer, startPos, endContainer, and endPos are non-null - if (startVisiblePos.isNull() || endVisiblePos.isNull()) - return; - - bool addLeadingSpace = startPos.leadingWhitespacePosition(VP_DEFAULT_AFFINITY, true).isNull() && !isStartOfParagraph(startVisiblePos); - if (addLeadingSpace) - if (UChar previousChar = startVisiblePos.previous().characterAfter()) - addLeadingSpace = !isCharacterSmartReplaceExempt(previousChar, true); - - bool addTrailingSpace = endPos.trailingWhitespacePosition(VP_DEFAULT_AFFINITY, true).isNull() && !isEndOfParagraph(endVisiblePos); - if (addTrailingSpace) - if (UChar thisChar = endVisiblePos.characterAfter()) - addTrailingSpace = !isCharacterSmartReplaceExempt(thisChar, false); - - // inspect source - bool hasWhitespaceAtStart = false; - bool hasWhitespaceAtEnd = false; - unsigned pasteLength = [pasteString length]; - if (pasteLength > 0) { - NSCharacterSet *whiteSet = [NSCharacterSet whitespaceAndNewlineCharacterSet]; - - if ([whiteSet characterIsMember:[pasteString characterAtIndex:0]]) { - hasWhitespaceAtStart = YES; - } - if ([whiteSet characterIsMember:[pasteString characterAtIndex:(pasteLength - 1)]]) { - hasWhitespaceAtEnd = YES; - } - } - - // issue the verdict - if (beforeString && addLeadingSpace && !hasWhitespaceAtStart) - *beforeString = @" "; - if (afterString && addTrailingSpace && !hasWhitespaceAtEnd) - *afterString = @" "; -} - - (DOMDocumentFragment *)_documentFragmentWithMarkupString:(NSString *)markupString baseURLString:(NSString *)baseURLString { if (!_private->coreFrame || !_private->coreFrame->document()) @@ -878,7 +865,7 @@ static inline WebDataSource *dataSource(DocumentLoader* loader) return; TypingCommand::insertParagraphSeparatorInQuotedContent(_private->coreFrame->document()); - _private->coreFrame->revealSelection(ScrollAlignment::alignToEdgeIfNeeded); + _private->coreFrame->selection()->revealSelection(ScrollAlignment::alignToEdgeIfNeeded); } - (VisiblePosition)_visiblePositionForPoint:(NSPoint)point @@ -914,16 +901,16 @@ static inline WebDataSource *dataSource(DocumentLoader* loader) - (DOMCSSStyleDeclaration *)_typingStyle { - if (!_private->coreFrame || !_private->coreFrame->typingStyle()) + if (!_private->coreFrame || !_private->coreFrame->selection()->typingStyle()) return nil; - return kit(_private->coreFrame->typingStyle()->copy().get()); + return kit(_private->coreFrame->selection()->typingStyle()->copy().get()); } - (void)_setTypingStyle:(DOMCSSStyleDeclaration *)style withUndoAction:(EditAction)undoAction { if (!_private->coreFrame) return; - _private->coreFrame->computeAndSetTypingStyle(core(style), undoAction); + _private->coreFrame->editor()->computeAndSetTypingStyle(core(style), undoAction); } - (void)_dragSourceEndedAt:(NSPoint)windowLoc operation:(NSDragOperation)operation @@ -943,7 +930,7 @@ static inline WebDataSource *dataSource(DocumentLoader* loader) - (BOOL)_canProvideDocumentSource { Frame* frame = _private->coreFrame; - String mimeType = frame->loader()->responseMIMEType(); + String mimeType = frame->loader()->writer()->mimeType(); PluginData* pluginData = frame->page() ? frame->page()->pluginData() : 0; if (WebCore::DOMImplementation::isTextMIMEType(mimeType) || @@ -961,15 +948,13 @@ static inline WebDataSource *dataSource(DocumentLoader* loader) return [self _canProvideDocumentSource]; } -- (void)_receivedData:(NSData *)data textEncodingName:(NSString *)textEncodingName +- (void)_commitData:(NSData *)data { - // Set the encoding. This only needs to be done once, but it's harmless to do it again later. - String encoding = _private->coreFrame->loader()->documentLoader()->overrideEncoding(); - bool userChosen = !encoding.isNull(); - if (encoding.isNull()) - encoding = textEncodingName; - _private->coreFrame->loader()->setEncoding(encoding, userChosen); - [self _addData:data]; + // FIXME: This really should be a setting. + Document* document = _private->coreFrame->document(); + document->setShouldCreateRenderers(_private->shouldCreateRenderers); + + _private->coreFrame->loader()->documentLoader()->commitData((const char *)[data bytes], [data length]); } @end @@ -999,7 +984,7 @@ static inline WebDataSource *dataSource(DocumentLoader* loader) RenderObject* bodyRenderer = body->renderer(); if (!bodyRenderer) return nil; - Color color = bodyRenderer->style()->backgroundColor(); + Color color = bodyRenderer->style()->visitedDependentColor(CSSPropertyBackgroundColor); if (!color.isValid()) return nil; return nsColor(color); @@ -1013,7 +998,7 @@ static inline WebDataSource *dataSource(DocumentLoader* loader) - (BOOL)_firstLayoutDone { - return _private->coreFrame->loader()->firstLayoutDone(); + return _private->coreFrame->loader()->stateMachine()->firstLayoutDone(); } - (WebFrameLoadType)_loadType @@ -1044,14 +1029,6 @@ static inline WebDataSource *dataSource(DocumentLoader* loader) return _private->coreFrame->domWindow()->pendingUnloadEventListeners(); } -- (WebIconFetcher *)fetchApplicationIcon:(id)target - selector:(SEL)selector -{ - return [WebIconFetcher _fetchApplicationIconForFrame:self - target:target - selector:selector]; -} - - (void)_setIsDisconnected:(bool)isDisconnected { _private->coreFrame->setIsDisconnected(isDisconnected); @@ -1154,13 +1131,31 @@ static inline WebDataSource *dataSource(DocumentLoader* loader) return controller->numberOfActiveAnimations(); } +- (void) _suspendAnimations +{ + Frame* frame = core(self); + if (!frame) + return; + + frame->animation()->suspendAnimations(); +} + +- (void) _resumeAnimations +{ + Frame* frame = core(self); + if (!frame) + return; + + frame->animation()->resumeAnimations(); +} + - (void)_replaceSelectionWithFragment:(DOMDocumentFragment *)fragment selectReplacement:(BOOL)selectReplacement smartReplace:(BOOL)smartReplace matchStyle:(BOOL)matchStyle { if (_private->coreFrame->selection()->isNone() || !fragment) return; applyCommand(ReplaceSelectionCommand::create(_private->coreFrame->document(), core(fragment), selectReplacement, smartReplace, matchStyle)); - _private->coreFrame->revealSelection(ScrollAlignment::alignToEdgeIfNeeded); + _private->coreFrame->selection()->revealSelection(ScrollAlignment::alignToEdgeIfNeeded); } - (void)_replaceSelectionWithText:(NSString *)text selectReplacement:(BOOL)selectReplacement smartReplace:(BOOL)smartReplace @@ -1175,6 +1170,64 @@ static inline WebDataSource *dataSource(DocumentLoader* loader) [self _replaceSelectionWithFragment:fragment selectReplacement:selectReplacement smartReplace:smartReplace matchStyle:NO]; } +// Determines whether whitespace needs to be added around aString to preserve proper spacing and +// punctuation when it's inserted into the receiver's text over charRange. Returns by reference +// in beforeString and afterString any whitespace that should be added, unless either or both are +// nil. Both are returned as nil if aString is nil or if smart insertion and deletion are disabled. +- (void)_smartInsertForString:(NSString *)pasteString replacingRange:(DOMRange *)rangeToReplace beforeString:(NSString **)beforeString afterString:(NSString **)afterString +{ + // give back nil pointers in case of early returns + if (beforeString) + *beforeString = nil; + if (afterString) + *afterString = nil; + + // inspect destination + Node *startContainer = core([rangeToReplace startContainer]); + Node *endContainer = core([rangeToReplace endContainer]); + + Position startPos(startContainer, [rangeToReplace startOffset]); + Position endPos(endContainer, [rangeToReplace endOffset]); + + VisiblePosition startVisiblePos = VisiblePosition(startPos, VP_DEFAULT_AFFINITY); + VisiblePosition endVisiblePos = VisiblePosition(endPos, VP_DEFAULT_AFFINITY); + + // this check also ensures startContainer, startPos, endContainer, and endPos are non-null + if (startVisiblePos.isNull() || endVisiblePos.isNull()) + return; + + bool addLeadingSpace = startPos.leadingWhitespacePosition(VP_DEFAULT_AFFINITY, true).isNull() && !isStartOfParagraph(startVisiblePos); + if (addLeadingSpace) + if (UChar previousChar = startVisiblePos.previous().characterAfter()) + addLeadingSpace = !isCharacterSmartReplaceExempt(previousChar, true); + + bool addTrailingSpace = endPos.trailingWhitespacePosition(VP_DEFAULT_AFFINITY, true).isNull() && !isEndOfParagraph(endVisiblePos); + if (addTrailingSpace) + if (UChar thisChar = endVisiblePos.characterAfter()) + addTrailingSpace = !isCharacterSmartReplaceExempt(thisChar, false); + + // inspect source + bool hasWhitespaceAtStart = false; + bool hasWhitespaceAtEnd = false; + unsigned pasteLength = [pasteString length]; + if (pasteLength > 0) { + NSCharacterSet *whiteSet = [NSCharacterSet whitespaceAndNewlineCharacterSet]; + + if ([whiteSet characterIsMember:[pasteString characterAtIndex:0]]) { + hasWhitespaceAtStart = YES; + } + if ([whiteSet characterIsMember:[pasteString characterAtIndex:(pasteLength - 1)]]) { + hasWhitespaceAtEnd = YES; + } + } + + // issue the verdict + if (beforeString && addLeadingSpace && !hasWhitespaceAtStart) + *beforeString = @" "; + if (afterString && addTrailingSpace && !hasWhitespaceAtEnd) + *afterString = @" "; +} + - (NSMutableDictionary *)_cacheabilityDictionary { NSMutableDictionary *result = [NSMutableDictionary dictionary]; @@ -1184,7 +1237,7 @@ static inline WebDataSource *dataSource(DocumentLoader* loader) if (documentLoader && !documentLoader->mainDocumentError().isNull()) [result setObject:(NSError *)documentLoader->mainDocumentError() forKey:WebFrameMainDocumentError]; - if (frameLoader->containsPlugins()) + if (frameLoader->subframeLoader()->containsPlugins()) [result setObject:[NSNumber numberWithBool:YES] forKey:WebFrameHasPlugins]; if (DOMWindow* domWindow = _private->coreFrame->domWindow()) { @@ -1217,7 +1270,7 @@ static inline WebDataSource *dataSource(DocumentLoader* loader) { if (!_private->coreFrame) return YES; - return SecurityOrigin::canLoad(URL, String(), _private->coreFrame->document()); + return _private->coreFrame->document()->securityOrigin()->canDisplay(URL); } - (NSString *)_stringByEvaluatingJavaScriptFromString:(NSString *)string withGlobalObject:(JSObjectRef)globalObjectRef inScriptWorld:(WebScriptWorld *)world @@ -1245,7 +1298,7 @@ static inline WebDataSource *dataSource(DocumentLoader* loader) return @""; JSLock lock(SilenceAssertionsOnly); - return String(result.toString(anyWorldGlobalObject->globalExec())); + return ustringToString(result.toString(anyWorldGlobalObject->globalExec())); } - (JSGlobalContextRef)_globalContextForScriptWorld:(WebScriptWorld *)world @@ -1259,6 +1312,56 @@ static inline WebDataSource *dataSource(DocumentLoader* loader) return toGlobalRef(coreFrame->script()->globalObject(coreWorld)->globalExec()); } +- (void)setAllowsScrollersToOverlapContent:(BOOL)flag +{ + ASSERT([[[self frameView] _scrollView] isKindOfClass:[WebDynamicScrollBarsView class]]); + [(WebDynamicScrollBarsView *)[[self frameView] _scrollView] setAllowsScrollersToOverlapContent:flag]; +} + +- (void)setAlwaysHideHorizontalScroller:(BOOL)flag +{ + ASSERT([[[self frameView] _scrollView] isKindOfClass:[WebDynamicScrollBarsView class]]); + [(WebDynamicScrollBarsView *)[[self frameView] _scrollView] setAlwaysHideHorizontalScroller:flag]; +} +- (void)setAlwaysHideVerticalScroller:(BOOL)flag +{ + ASSERT([[[self frameView] _scrollView] isKindOfClass:[WebDynamicScrollBarsView class]]); + [(WebDynamicScrollBarsView *)[[self frameView] _scrollView] setAlwaysHideVerticalScroller:flag]; +} + +- (void)setAccessibleName:(NSString *)name +{ +#if HAVE(ACCESSIBILITY) + if (!AXObjectCache::accessibilityEnabled()) + return; + + RenderView* root = toRenderView(_private->coreFrame->document()->renderer()); + if (!root) + return; + + AccessibilityObject* rootObject = _private->coreFrame->document()->axObjectCache()->getOrCreate(root); + String strName(name); + rootObject->setAccessibleName(strName); +#endif +} + +- (NSString*)_layerTreeAsText +{ + Frame* coreFrame = _private->coreFrame; + if (!coreFrame) + return @""; + + return coreFrame->layerTreeAsText(); +} + +- (BOOL)hasSpellingMarker:(int)from length:(int)length +{ + Frame* coreFrame = _private->coreFrame; + if (!coreFrame) + return NO; + return coreFrame->editor()->selectionStartHasSpellingMarkerFor(from, length); +} + @end @implementation WebFrame @@ -1276,14 +1379,19 @@ static inline WebDataSource *dataSource(DocumentLoader* loader) - (void)dealloc { + if (_private && _private->includedInWebKitStatistics) + --WebFrameCount; + [_private release]; - --WebFrameCount; + [super dealloc]; } - (void)finalize { - --WebFrameCount; + if (_private && _private->includedInWebKitStatistics) + --WebFrameCount; + [super finalize]; } @@ -1292,7 +1400,7 @@ static inline WebDataSource *dataSource(DocumentLoader* loader) Frame* coreFrame = _private->coreFrame; if (!coreFrame) return nil; - return coreFrame->tree()->name(); + return coreFrame->tree()->uniqueName(); } - (WebFrameView *)frameView |
