+2013-12-04 Andy Estes <aestes@apple.com>
+
+ [iOS] Upstream build fixes in Source/WebKit/ios/
+ https://bugs.webkit.org/show_bug.cgi?id=125230
+
+ Reviewed by Sam Weinig.
+
+ * DefaultDelegates/WebDefaultUIKitDelegate.m:
+ (-[WebDefaultUIKitDelegate webViewDidReceiveMobileDocType:]):
+ * Misc/WebNSStringDrawing.mm:
+ (needsBidiLayout):
+ (-[NSString __web_drawAtPoint:forWidth:withFont:ellipsis:letterSpacing:includeEmoji:measureOnly:renderedStringOut:drawUnderline:]):
+ (-[NSString __web_drawInRect:withFont:ellipsis:alignment:letterSpacing:lineSpacing:includeEmoji:truncationRect:measureOnly:renderedStringOut:drawUnderline:]):
+ * Misc/WebUIKitSupport.mm:
+ (WebKitInitialize):
+ * WebCoreSupport/WebChromeClientIOS.h:
+ * WebCoreSupport/WebChromeClientIOS.mm:
+ (WebChromeClientIOS::didReceiveMobileDocType):
+ (WebChromeClientIOS::focusedElementChanged):
+ * WebCoreSupport/WebFrameIOS.mm:
+ (-[WebFrame clearSelection]):
+ (-[WebFrame selectionState]):
+ (-[WebFrame collapseSelection]):
+ (-[WebFrame extendSelection:]):
+ (-[WebFrame selectionRects]):
+ (-[WebFrame setRangedSelectionWithExtentPoint:]):
+ (-[WebFrame setRangedSelectionExtentPoint:baseIsStart:allowFlipping:]):
+ (-[WebFrame setSelectionWithBasePoint:extentPoint:baseIsStart:allowFlipping:]):
+ (-[WebFrame setSelectionWithFirstPoint:secondPoint:]):
+ (-[WebFrame ensureRangedSelectionContainsInitialStartPoint:initialEndPoint:]):
+ (-[WebFrame aggressivelyExpandSelectionToWordContainingCaretSelection]):
+ (-[WebFrame expandSelectionToSentence]):
+ (-[WebFrame setBaseWritingDirection:]):
+ (-[WebFrame moveSelectionToStart]):
+ (-[WebFrame moveSelectionToEnd]):
+ (-[WebFrame moveSelectionToPoint:]):
+ (-[WebFrame setSelectionGranularity:]):
+ (-[WebFrame smartExtendRangedSelection:]):
+ (-[WebFrame previousUnperturbedDictationResultBoundaryFromPosition:]):
+ (-[WebFrame nextUnperturbedDictationResultBoundaryFromPosition:]):
+ * WebCoreSupport/WebInspectorClientIOS.mm:
+ (WebInspectorClient::WebInspectorClient):
+ (WebInspectorClient::didSetSearchingForNode):
+ (WebInspectorClient::setupRemoteConnection):
+ (WebInspectorClient::teardownRemoteConnection):
+ * WebCoreSupport/WebVisiblePosition.mm:
+ (-[WebVisiblePosition enclosingRangeWithDictationPhraseAlternatives:]):
+ (-[WebVisiblePosition enclosingRangeWithCorrectionIndicator]):
+ (-[DOMHTMLInputElement startPosition]):
+ (-[DOMHTMLInputElement endPosition]):
+ (-[DOMHTMLTextAreaElement startPosition]):
+ (-[DOMHTMLTextAreaElement endPosition]):
+ * WebView/WebPDFViewIOS.mm:
+ (+[WebPDFView shadowColor]):
+ (+[WebPDFView backgroundColor]):
+ (-[WebPDFView _checkPDFTitle]):
+ * WebView/WebPDFViewPlaceholder.mm:
+ (-[WebPDFViewPlaceholder simulateClickOnLinkToURL:]):
+ * WebView/WebUIKitDelegate.h:
+
2013-12-03 Joseph Pecoraro <pecoraro@apple.com>
Web Inspector: Push Remote Inspector debugging connection management into JavaScriptCore
{
}
-- (void)webView:(WebView *)webView didReceiveDocTypeForFrame:(WebFrame *)frame
+- (void)webViewDidReceiveMobileDocType:(WebView *)webView
{
}
return width;
}
-static bool needsBidiLayout(const UChar *characters, unsigned length, WTF::Unicode::Direction& baseDirection, bool oneParagraph = false)
+static bool needsBidiLayout(const UChar *characters, unsigned length, UCharDirection& baseDirection, bool oneParagraph = false)
{
bool foundFirstStrong = false;
bool result = false;
- baseDirection = WTF::Unicode::LeftToRight;
+ baseDirection = U_LEFT_TO_RIGHT;
for (unsigned i = 0; i < length;) {
UChar32 c;
U16_NEXT(characters, i, length, c);
- switch (WTF::Unicode::direction(c)) {
- case WTF::Unicode::RightToLeft:
- case WTF::Unicode::RightToLeftArabic:
+ switch (UCharDirection(c)) {
+ case U_RIGHT_TO_LEFT:
+ case U_RIGHT_TO_LEFT_ARABIC:
if (!foundFirstStrong) {
foundFirstStrong = true;
- baseDirection = WTF::Unicode::RightToLeft;
+ baseDirection = U_RIGHT_TO_LEFT;
}
// Fall through to rest of strongly directional cases
- case WTF::Unicode::LeftToRightEmbedding:
- case WTF::Unicode::LeftToRightOverride:
- case WTF::Unicode::RightToLeftEmbedding:
- case WTF::Unicode::RightToLeftOverride:
- case WTF::Unicode::PopDirectionalFormat:
+ case U_LEFT_TO_RIGHT_EMBEDDING:
+ case U_LEFT_TO_RIGHT_OVERRIDE:
+ case U_RIGHT_TO_LEFT_EMBEDDING:
+ case U_RIGHT_TO_LEFT_OVERRIDE:
+ case U_POP_DIRECTIONAL_FORMAT:
result = true;
if (foundFirstStrong)
return result;
break;
- case WTF::Unicode::LeftToRight:
+ case U_LEFT_TO_RIGHT:
foundFirstStrong = true;
if (result)
return result;
break;
- case WTF::Unicode::BlockSeparator:
+ case U_BLOCK_SEPARATOR:
if (oneParagraph)
return result;
break;
renderer.setLetterSpacing(letterSpacing);
String fullString(self);
- WTF::Unicode::Direction base = WTF::Unicode::LeftToRight;
+ UCharDirection base = U_LEFT_TO_RIGHT;
bool stringNeedsBidi = needsBidiLayout(fullString.characters(), fullString.length(), base);
float stringWidth;
String s = (width >= FLT_MAX && !measureOnly) ? fullString : applyEllipsisStyle(fullString, ellipsisStyle, width, renderer, shouldDisableWordRounding() ? StringTruncator::DisableRoundingHacks : StringTruncator::EnableRoundingHacks, &stringWidth);
context.setEmojiDrawingEnabled(includeEmoji);
if (stringNeedsBidi) {
- BidiStatus status(base, base, base, BidiContext::create((base == WTF::Unicode::LeftToRight) ? 0 : 1, base, false));
+ BidiStatus status(base, base, base, BidiContext::create((base == U_LEFT_TO_RIGHT) ? 0 : 1, base, false));
// FIXME: For proper bidi rendering, we need to pass the whole string, rather than the truncated string.
// Otherwise, weak/neutral characters on either side of the ellipsis may pick up the wrong direction
// if there are strong characters ellided.
BOOL lastLine = NO;
BOOL finishedLastLine = NO;
- WTF::Unicode::Direction base;
+ UCharDirection base;
BOOL paragraphNeedsBidi = needsBidiLayout(buffer, length, base, true);
BidiStatus status;
if (paragraphNeedsBidi)
- status = BidiStatus(base, base, base, BidiContext::create((base == WTF::Unicode::LeftToRight) ? 0 : 1, base, false));
+ status = BidiStatus(base, base, base, BidiContext::create((base == U_LEFT_TO_RIGHT) ? 0 : 1, base, false));
int lengthRemaining = length;
} else {
ellipsisResult = applyEllipsisStyle(lastLine, ellipsisStyle, rect.size.width, renderer, shouldDisableWordRounding() ? StringTruncator::DisableRoundingHacks : StringTruncator::EnableRoundingHacks, &lastLineWidth, insertEllipsis, customTruncationElementWidth, forceTruncation);
if (truncationRect && (ellipsisResult != lastLine || droppingLines)
- && lastLineWidth && base == WTF::Unicode::RightToLeft)
+ && lastLineWidth && base == U_RIGHT_TO_LEFT)
textPoint.x += truncationRect->size.width;
}
CGContextRef cgContext = WKGetCurrentGraphicsContext();
*truncationRect = CGRectNull;
} else {
truncationRect->origin = textPoint;
- truncationRect->origin.x += (base == WTF::Unicode::RightToLeft) ? (-truncationRect->size.width) : lineWidth;
+ truncationRect->origin.x += (base == U_RIGHT_TO_LEFT) ? (-truncationRect->size.width) : lineWidth;
truncationRect->origin.y -= ascent;
truncationRect->size.height = ascent - GSFontGetDescent(font);
}
// Redetermine whether the succeeding paragraph needs bidi layout, and if so, determine the base direction
paragraphNeedsBidi = needsBidiLayout(startOfLine, lengthRemaining, base, true);
if (paragraphNeedsBidi)
- status = BidiStatus(base, base, base, BidiContext::create((base == WTF::Unicode::LeftToRight) ? 0 : 1, base, false));
+ status = BidiStatus(base, base, base, BidiContext::create((base == U_LEFT_TO_RIGHT) ? 0 : 1, base, false));
}
maxLineWidth = max(maxLineWidth, lineWidth);
cursor.y += lineSpacing;
// This needs to be called before any requests are made in the process, <rdar://problem/9691871>
WebCore::initializeHTTPConnectionSettingsOnStartup();
- WebCore::enableKURLSchemeCanonicalization(linkedOnOrAfterIOS5());
+ WebCore::enableURLSchemeCanonicalization(linkedOnOrAfterIOS5());
}
void WebKitSetIsClassic(BOOL flag)
#if ENABLE(TOUCH_EVENTS)
virtual void didPreventDefaultForEvent() OVERRIDE;
#endif
- virtual void didReceiveDocType(WebCore::Frame*) OVERRIDE;
+ virtual void didReceiveMobileDocType() OVERRIDE;
virtual void setNeedsScrollNotifications(WebCore::Frame*, bool) OVERRIDE;
virtual void observedContentChange(WebCore::Frame*) OVERRIDE;
virtual void clearContentChangeObservers(WebCore::Frame*) OVERRIDE;
virtual PassRefPtr<WebCore::SearchPopupMenu> createSearchPopupMenu(WebCore::PopupMenuClient*) const OVERRIDE;
virtual void webAppOrientationsUpdated() OVERRIDE;
- virtual void focusedNodeChanged(WebCore::Node*) OVERRIDE;
+ virtual void focusedElementChanged(WebCore::Element*) OVERRIDE;
private:
int m_formNotificationSuppressions;
}
#endif
-void WebChromeClientIOS::didReceiveDocType(WebCore::Frame* frame)
+void WebChromeClientIOS::didReceiveMobileDocType()
{
- [[webView() _UIKitDelegateForwarder] webView:webView() didReceiveDocTypeForFrame:kit(frame)];
+ [[webView() _UIKitDelegateForwarder] webViewDidReceiveMobileDocType:webView() ];
}
void WebChromeClientIOS::setNeedsScrollNotifications(WebCore::Frame* frame, bool flag)
[[webView() _UIDelegateForwarder] webViewSupportedOrientationsUpdated:webView()];
}
-void WebChromeClientIOS::focusedNodeChanged(Node* node)
+void WebChromeClientIOS::focusedElementChanged(Element* element)
{
- if (!node)
+ if (!element)
return;
- if (!node->hasTagName(HTMLNames::inputTag))
+ if (!isHTMLInputElement(element))
return;
- HTMLInputElement* inputElement = static_cast<HTMLInputElement*>(node);
+ HTMLInputElement* inputElement = toHTMLInputElement(element);
if (!inputElement->isText())
return;
- CallFormDelegate(webView(), @selector(didFocusTextField:inFrame:), kit(inputElement), kit(inputElement->document()->frame()));
+ CallFormDelegate(webView(), @selector(didFocusTextField:inFrame:), kit(inputElement), kit(inputElement->document().frame()));
}
#endif // PLATFORM(IOS)
{
Frame *frame = [self coreFrame];
if (frame)
- frame->selection()->clearCurrentSelection();
+ frame->selection().clearCurrentSelection();
}
- (WebTextSelectionState)selectionState
{
- WebTextSelectionState state;
-
+ WebTextSelectionState state = WebTextSelectionStateNone;
+
Frame *frame = [self coreFrame];
- FrameSelection* frameSelection = frame->selection();
-
- if (!frameSelection) {
- state = WebTextSelectionStateNone;
- } else if (frameSelection->isCaret()) {
+ FrameSelection& frameSelection = frame->selection();
+
+ if (frameSelection.isCaret())
state = WebTextSelectionStateCaret;
- } else if (frameSelection->isRange()) {
+ else if (frameSelection.isRange())
state = WebTextSelectionStateRange;
- } else {
- state = WebTextSelectionStateNone;
- }
-
+
return state;
}
-
- (BOOL)hasSelection
{
WebTextSelectionState state = [self selectionState];
{
if ([self selectionState] == WebTextSelectionStateRange) {
Frame *frame = [self coreFrame];
- FrameSelection* frameSelection = frame->selection();
- VisiblePosition end(frameSelection->end());
- frameSelection->moveTo(end);
+ FrameSelection& frameSelection = frame->selection();
+ VisiblePosition end(frameSelection.end());
+ frameSelection.moveTo(end);
}
}
{
if ([self selectionState] == WebTextSelectionStateRange) {
Frame *frame = [self coreFrame];
- FrameSelection* frameSelection = frame->selection();
+ FrameSelection& frameSelection = frame->selection();
if (start) {
- VisiblePosition start = startOfWord(frameSelection->start());
- frameSelection->moveTo(start, frameSelection->end());
+ VisiblePosition start = startOfWord(frameSelection.start());
+ frameSelection.moveTo(start, frameSelection.end());
} else {
- VisiblePosition end = endOfWord(frameSelection->end());
- frameSelection->moveTo(frameSelection->start(), end);
+ VisiblePosition end = endOfWord(frameSelection.end());
+ frameSelection.moveTo(frameSelection.start(), end);
}
}
}
return nil;
Frame *frame = [self coreFrame];
- Range *range = frame->selection()->toNormalizedRange().get();
+ Range *range = frame->selection().toNormalizedRange().get();
return [self selectionRectsForCoreRange:range];
}
- (void)setRangedSelectionWithExtentPoint:(CGPoint)point
{
Frame *frame = [self coreFrame];
- FrameSelection* frameSelection = frame->selection();
+ FrameSelection& frameSelection = frame->selection();
VisiblePosition pos = [self visiblePositionForPoint:point];
VisibleSelection base = frame->rangedSelectionBase();
VisiblePosition end(base.end());
if (pos < start) {
- frameSelection->moveTo(pos, end);
+ frameSelection.moveTo(pos, end);
}
else if (pos > end) {
- frameSelection->moveTo(start, pos);
+ frameSelection.moveTo(start, pos);
}
else {
- frameSelection->moveTo(start, end);
+ frameSelection.moveTo(start, end);
}
}
VisiblePosition extent([self visiblePositionForPoint:extentPoint]);
if (rangedSelectionBase.isRange() && baseStart < extent && extent < baseEnd) {
- frame->selection()->moveTo(baseStart, baseEnd);
+ frame->selection().moveTo(baseStart, baseEnd);
return NO;
}
extent = base.previous();
}
- frame->selection()->moveTo(base, extent);
+ frame->selection().moveTo(base, extent);
return didFlipStartEnd ? !baseIsStart : baseIsStart;
}
// least as long as a single, logical selection session continues).
Frame *frame = [self coreFrame];
- FrameSelection* frameSelection = frame->selection();
+ FrameSelection& frameSelection = frame->selection();
VisiblePosition base([self visiblePositionForPoint:basePoint]);
VisiblePosition extent([self visiblePositionForPoint:extentPoint]);
extent = base.previous();
}
- frameSelection->moveTo(base, extent);
+ frameSelection.moveTo(base, extent);
return didFlipStartEnd ? !baseIsStart : baseIsStart;
}
VisiblePosition first([self visiblePositionForPoint:firstPoint]);
VisiblePosition second([self visiblePositionForPoint:secondPoint]);
Frame *frame = [self coreFrame];
- FrameSelection* frameSelection = frame->selection();
- frameSelection->moveTo(first, second);
+ FrameSelection& frameSelection = frame->selection();
+ frameSelection.moveTo(first, second);
}
- (void)ensureRangedSelectionContainsInitialStartPoint:(CGPoint)initialStartPoint initialEndPoint:(CGPoint)initialEndPoint
// longer contains these points. This is the desirable behavior when the
// user does the tap-and-a-half + drag operation.
Frame *frame = [self coreFrame];
- FrameSelection* frameSelection = frame->selection();
+ FrameSelection& frameSelection = frame->selection();
Position ensureStart([self visiblePositionForPoint:initialStartPoint].deepEquivalent());
Position ensureEnd([self visiblePositionForPoint:initialEndPoint].deepEquivalent());
- if (frameSelection->start() > ensureStart) {
- frameSelection->moveTo(ensureStart, frameSelection->end());
+ if (frameSelection.start() > ensureStart) {
+ frameSelection.moveTo(ensureStart, frameSelection.end());
}
- else if (frameSelection->end() < ensureEnd) {
- frameSelection->moveTo(frameSelection->start(), ensureEnd);
+ else if (frameSelection.end() < ensureEnd) {
+ frameSelection.moveTo(frameSelection.start(), ensureEnd);
}
}
- (void)aggressivelyExpandSelectionToWordContainingCaretSelection
{
Frame *frame = [self coreFrame];
- FrameSelection* frameSelection = frame->selection();
- VisiblePosition end(frameSelection->end());
+ FrameSelection& frameSelection = frame->selection();
+ VisiblePosition end(frameSelection.end());
if (end == endOfDocument(end) && end != startOfDocument(end) && end == startOfLine(end)) {
- frameSelection->moveTo(end.previous(), end);
+ frameSelection.moveTo(end.previous(), end);
}
[self expandSelectionToWordContainingCaretSelection];
// This is a temporary hack until we get the improvements
// I'm working on for RTL selection.
- if (frameSelection->granularity() == WordGranularity) {
- frameSelection->moveTo(frameSelection->start(), frameSelection->end());
+ if (frameSelection.granularity() == WordGranularity) {
+ frameSelection.moveTo(frameSelection.start(), frameSelection.end());
}
- if (frameSelection->isCaret()) {
- VisiblePosition pos(frameSelection->end());
+ if (frameSelection.isCaret()) {
+ VisiblePosition pos(frameSelection.end());
if (isStartOfLine(pos) && isEndOfLine(pos)) {
VisiblePosition next(pos.next());
if (next.isNotNull()) {
- frameSelection->moveTo(end, next);
+ frameSelection.moveTo(end, next);
}
}
else {
while (pos.isNotNull()) {
VisiblePosition wordStart(startOfWord(pos));
if (wordStart != pos) {
- frameSelection->moveTo(wordStart, frameSelection->end());
+ frameSelection.moveTo(wordStart, frameSelection.end());
break;
}
pos = pos.previous();
- (void)expandSelectionToSentence
{
Frame *frame = [self coreFrame];
- FrameSelection* frameSelection = frame->selection();
- VisiblePosition pos = frameSelection->start();
+ FrameSelection& frameSelection = frame->selection();
+ VisiblePosition pos = frameSelection.start();
VisiblePosition start = startOfSentence(pos);
VisiblePosition end = endOfSentence(pos);
- frameSelection->moveTo(start, end);
+ frameSelection.moveTo(start, end);
}
- (WKWritingDirection)selectionBaseWritingDirection
WKWritingDirection originalDirection = [self selectionBaseWritingDirection];
Frame *frame = [self coreFrame];
- if (!frame->selection()->isContentEditable())
+ if (!frame->selection().isContentEditable())
return;
WritingDirection wcDirection = LeftToRightWritingDirection;
- (void)moveSelectionToStart
{
Frame *frame = [self coreFrame];
- FrameSelection* frameSelection = frame->selection();
- VisiblePosition start = startOfDocument(frameSelection->selection().start());
- frameSelection->moveTo(start);
+ FrameSelection& frameSelection = frame->selection();
+ VisiblePosition start = startOfDocument(frameSelection.selection().start());
+ frameSelection.moveTo(start);
}
- (void)moveSelectionToEnd
{
Frame *frame = [self coreFrame];
- FrameSelection* frameSelection = frame->selection();
- VisiblePosition end = endOfDocument(frameSelection->selection().end());
- frameSelection->moveTo(end);
+ FrameSelection& frameSelection = frame->selection();
+ VisiblePosition end = endOfDocument(frameSelection.selection().end());
+ frameSelection.moveTo(end);
}
- (void)moveSelectionToPoint:(CGPoint)point
{
Frame *frame = [self coreFrame];
- FrameSelection* frameSelection = frame->selection();
+ FrameSelection& frameSelection = frame->selection();
VisiblePosition pos = [self _visiblePositionForPoint:point];
- frameSelection->moveTo(pos);
+ frameSelection.moveTo(pos);
}
- (void)setSelectionGranularity:(WebTextGranularity)granularity
ASSERT_NOT_REACHED();
break;
}
- FrameSelection* frameSelection = _private->coreFrame->selection();
- frameSelection->setSelection(frameSelection->selection(), wcGranularity);
+ FrameSelection& frameSelection = _private->coreFrame->selection();
+ frameSelection.setSelection(frameSelection.selection(), wcGranularity);
}
static inline bool isAlphaNumericCharacter(UChar32 c)
return;
Frame *frame = [self coreFrame];
- FrameSelection* frameSelection = frame->selection();
- EAffinity affinity = frameSelection->selection().affinity();
- VisiblePosition start(frameSelection->start(), affinity);
- VisiblePosition end(frameSelection->end(), affinity);
+ FrameSelection& frameSelection = frame->selection();
+ EAffinity affinity = frameSelection.selection().affinity();
+ VisiblePosition start(frameSelection.start(), affinity);
+ VisiblePosition end(frameSelection.end(), affinity);
VisiblePosition base(frame->rangedSelectionBase().base()); // should equal start or end
// Base must equal start or end
if (base != start && base != end)
return;
- VisiblePosition extent(frameSelection->selection().extent(), affinity);
+ VisiblePosition extent(frameSelection.selection().extent(), affinity);
// We don't yet support smart extension for languages which
// require context for word boundary.
}
if (smartExtent.isNotNull() && smartExtent != extent)
- frameSelection->moveTo(base, smartExtent);
+ frameSelection.moveTo(base, smartExtent);
}
if (currentVisiblePosition.isNull())
return position;
- Document* document = currentVisiblePosition.deepEquivalent().anchorNode()->document();
- if (!document)
- return position;
-
+ Document& document = currentVisiblePosition.deepEquivalent().anchorNode()->document();
+
id uikitDelegate = [[self webView] _UIKitDelegate];
if (![uikitDelegate respondsToSelector:@selector(isUnperturbedDictationResultMarker:)])
return position;
RefPtr<Range> graphemeRange = Range::create(document, previousVisiblePosition.deepEquivalent(), currentVisiblePosition.deepEquivalent());
- Vector<DocumentMarker*> markers = document->markers()->markersInRange(graphemeRange.get(), DocumentMarker::DictationResult);
+ Vector<DocumentMarker*> markers = document.markers().markersInRange(graphemeRange.get(), DocumentMarker::DictationResult);
if (markers.isEmpty())
return currentWebVisiblePosition;
if (currentVisiblePosition.isNull())
return position;
- Document* document = currentVisiblePosition.deepEquivalent().anchorNode()->document();
- if (!document)
- return position;
+ Document& document = currentVisiblePosition.deepEquivalent().anchorNode()->document();
id uikitDelegate = [[self webView] _UIKitDelegate];
if (![uikitDelegate respondsToSelector:@selector(isUnperturbedDictationResultMarker:)])
RefPtr<Range> graphemeRange = Range::create(document, currentVisiblePosition.deepEquivalent(), nextVisiblePosition.deepEquivalent());
- Vector<DocumentMarker*> markers = document->markers()->markersInRange(graphemeRange.get(), DocumentMarker::DictationResult);
+ Vector<DocumentMarker*> markers = document.markers().markersInRange(graphemeRange.get(), DocumentMarker::DictationResult);
if (markers.isEmpty())
return currentWebVisiblePosition;
#import "WebFrameInternal.h"
#import "WebInspector.h"
-#import "WebNSNotificationCenterExtras.h"
#import "WebNodeHighlighter.h"
#import "WebViewInternal.h"
#import <WebCore/InspectorController.h>
WebInspectorClient::WebInspectorClient(WebView *webView)
: m_webView(webView)
- , m_highlighter(AdoptNS, [[WebNodeHighlighter alloc] initWithInspectedWebView:webView])
+ , m_highlighter(adoptNS([[WebNodeHighlighter alloc] initWithInspectedWebView:webView]))
, m_frontendPage(0)
, m_frontendClient(0)
{
void WebInspectorClient::didSetSearchingForNode(bool enabled)
{
WebInspector *inspector = [m_webView inspector];
-
- if (enabled)
- [[NSNotificationCenter defaultCenter] postNotificationOnMainThreadWithName:WebInspectorDidStartSearchingForNode object:inspector];
- else
- [[NSNotificationCenter defaultCenter] postNotificationOnMainThreadWithName:WebInspectorDidStopSearchingForNode object:inspector];
+ NSString *notificationName = enabled ? WebInspectorDidStartSearchingForNode : WebInspectorDidStopSearchingForNode;
+ dispatch_async(dispatch_get_main_queue(), ^{
+ [[NSNotificationCenter defaultCenter] postNotificationName:notificationName object:inspector];
+ });
}
-
#pragma mark -
#pragma mark WebInspectorFrontendClient Implementation
void WebInspectorFrontendClient::setToolbarHeight(unsigned) { }
void WebInspectorFrontendClient::inspectedURLChanged(const String&) { }
void WebInspectorFrontendClient::updateWindowTitle() const { }
-void WebInspectorFrontendClient::save(const String&, const String&, bool) { }
void WebInspectorFrontendClient::append(const String&, const String&) { }
#endif // PLATFORM(IOS)
unsigned offset = o;
Node* node = p.deepEquivalent().anchorNode();
- Document* document = node->document();
- if (!document)
- return nil;
+ Document& document = node->document();
- const Vector<DocumentMarker*>& markers = document->markers()->markersFor(node);
+ const Vector<DocumentMarker*>& markers = document.markers().markersFor(node, DocumentMarker::MarkerTypes(DocumentMarker::DictationPhraseWithAlternatives));
if (markers.isEmpty())
return nil;
for (size_t i = 0; i < markers.size(); i++) {
const DocumentMarker* marker = markers[i];
- if (marker->type() != DocumentMarker::DictationPhraseWithAlternatives)
- continue;
-
if (marker->startOffset() <= offset && marker->endOffset() >= offset) {
const Vector<String>& markerAlternatives = marker->alternatives();
*alternatives = [NSMutableArray arrayWithCapacity:markerAlternatives.size()];
unsigned offset = o;
Node* node = p.deepEquivalent().anchorNode();
- Document* document = node->document();
- if (!document)
- return nil;
+ Document& document = node->document();
- const Vector<DocumentMarker>& markers = document->markers()->markersForNode(node);
+ const Vector<DocumentMarker*>& markers = document.markers().markersFor(node, DocumentMarker::MarkerTypes(DocumentMarker::Spelling));
if (markers.isEmpty())
return nil;
for (size_t i = 0; i < markers.size(); i++) {
- const DocumentMarker& marker = markers[i];
- if (marker.type() != DocumentMarker::Spelling)
- continue;
-
- if (marker.startOffset() <= offset && marker.endOffset() >= offset) {
- RefPtr<Range> range = Range::create(document, node, marker.startOffset(), node, marker.endOffset());
+ const DocumentMarker* marker = markers[i];
+ if (marker->startOffset() <= offset && marker->endOffset() >= offset) {
+ RefPtr<Range> range = Range::create(document, node, marker->startOffset(), node, marker->endOffset());
return kit(range.get());
}
}
return [super startPosition];
RenderTextControl *textControl = toRenderTextControl(object);
- VisiblePosition visiblePosition = textControl->visiblePositionForIndex(0);
+ VisiblePosition visiblePosition = textControl->textFormControlElement().visiblePositionForIndex(0);
return [WebVisiblePosition _wrapVisiblePosition:visiblePosition];
}
return [super endPosition];
RenderTextControl *textControl = toRenderTextControl(object);
- VisiblePosition visiblePosition = textControl->visiblePositionForIndex(textControl->textFormControlElement()->value().length());
+ VisiblePosition visiblePosition = textControl->textFormControlElement().visiblePositionForIndex(textControl->textFormControlElement().value().length());
return [WebVisiblePosition _wrapVisiblePosition:visiblePosition];
}
return [super startPosition];
RenderTextControl *textControl = toRenderTextControl(object);
- VisiblePosition visiblePosition = textControl->visiblePositionForIndex(0);
+ VisiblePosition visiblePosition = textControl->textFormControlElement().visiblePositionForIndex(0);
return [WebVisiblePosition _wrapVisiblePosition:visiblePosition];
}
return [super endPosition];
RenderTextControl *textControl = toRenderTextControl(object);
- VisiblePosition visiblePosition = textControl->visiblePositionForIndex(textControl->textFormControlElement()->value().length());
+ VisiblePosition visiblePosition = textControl->textFormControlElement().visiblePositionForIndex(textControl->textFormControlElement().value().length());
return [WebVisiblePosition _wrapVisiblePosition:visiblePosition];
}
+ (CGColorRef)shadowColor
{
- DEFINE_STATIC_LOCAL(RetainPtr<CGColorRef>, shadowColor, (AdoptCF, createCGColorWithDeviceWhite(0.0, 2.0 / 3.0)));
- return shadowColor.get();
+ static CGColorRef shadowColor = createCGColorWithDeviceWhite(0, 2.0 / 3);
+ return shadowColor;
}
+ (CGColorRef)backgroundColor
{
- DEFINE_STATIC_LOCAL(RetainPtr<CGColorRef>, backgroundColor, (AdoptCF, createCGColorWithDeviceWhite(204.0 / 255.0, 1.0)));
- return backgroundColor.get();
+ static CGColorRef backgroundColor = createCGColorWithDeviceWhite(204.0 / 255, 1);
+ return backgroundColor;
}
// This is a secret protocol for WebDataSource and WebFrameView to offer us the opportunity to do something different
if ([title length]) {
[_title release];
_title = [title copy];
- core([self _frame])->loader()->client()->dispatchDidReceiveTitle(StringWithDirection(title, LTR));
+ core([self _frame])->loader().client().dispatchDidReceiveTitle(StringWithDirection(title, LTR));
}
}
#import <WebKit/WebNSViewExtras.h>
#import <WebKit/WebPDFDocumentExtras.h>
#import <WebKit/WebViewPrivate.h>
+#import <wtf/CurrentTime.h>
#import <wtf/Vector.h>
using namespace WebCore;
return;
// Construct an event to simulate a click.
- RefPtr<Event> event = MouseEvent::create(eventNames().clickEvent, true, true, 0, 1, 0, 0, 0, 0, false, false, false, false, 0, 0, 0, true);
+ RefPtr<Event> event = MouseEvent::create(eventNames().clickEvent, true, true, currentTime(), 0, 1, 0, 0, 0, 0, false, false, false, false, 0, 0, 0, true);
// Call to the frame loader because this is where our security checks are made.
Frame* frame = core([_dataSource webFrame]);
- frame->loader()->loadFrameRequest(FrameLoadRequest(frame->document()->securityOrigin(), ResourceRequest(URL)), false, false, event.get(), 0, MaybeSendReferrer);
+ frame->loader().loadFrameRequest(FrameLoadRequest(frame->document()->securityOrigin(), ResourceRequest(URL)), false, false, event.get(), 0, MaybeSendReferrer);
}
@end
- (void)webView:(WebView *)sender didFinishLoadForFrame:(WebFrame *)frame;
- (void)webView:(WebView *)sender didFailLoadWithError:(NSError *)error forFrame:(WebFrame *)frame;
- (void)webView:(WebView *)sender didChangeLocationWithinPageForFrame:(WebFrame *)frame;
-- (void)webView:(WebView *)webView didReceiveDocTypeForFrame:(WebFrame *)frame;
+- (void)webViewDidReceiveMobileDocType:(WebView *)webView;
- (void)webView:(WebView *)aWebView didReceiveViewportArguments:(NSDictionary *)arguments;
- (void)webView:(WebView *)aWebView needsScrollNotifications:(NSNumber *)aNumber forFrame:(WebFrame *)aFrame;
- (void)webView:(WebView *)webView saveStateToHistoryItem:(WebHistoryItem *)item forFrame:(WebFrame *)frame;