Commit 55f28e5e authored by rniwa@webkit.org's avatar rniwa@webkit.org

Range::ownerDocument should return Document&

https://bugs.webkit.org/show_bug.cgi?id=120908

Reviewed by Andreas Kling.

Source/WebCore: 

Return Document& in Range::ownerDocument(). Also make setDocument take Document& so that this invariant is self-evident.

* bindings/objc/DOM.mm:
(-[DOMRange boundingBox]):
(-[DOMRange renderedImageForcingBlackText:]):
(-[DOMRange textRects]):
* dom/Range.cpp:
(WebCore::Range::setDocument):
(WebCore::Range::setStart):
(WebCore::Range::setEnd):
(WebCore::Range::selectNode):
(WebCore::Range::selectNodeContents):
* dom/Range.h:
(WebCore::Range::ownerDocument):
* editing/AlternativeTextController.cpp:
(WebCore::AlternativeTextController::handleAlternativeTextUIResult):
* editing/Editor.cpp:
(WebCore::Editor::avoidIntersectionWithDeleteButtonController):
(WebCore::isFrameInRange):
(WebCore::Editor::countMatchesForText):
* editing/EditorCommand.cpp:
(WebCore::unionDOMRanges):
* editing/TextCheckingHelper.cpp:
(WebCore::TextCheckingHelper::unifiedTextCheckerEnabled):
* editing/TextIterator.cpp:
(WebCore::plainText):
(WebCore::findPlainText):
* editing/htmlediting.cpp:
(WebCore::extendRangeToWrappingNodes):
* editing/markup.cpp:
(WebCore::createMarkup):
(WebCore::createFragmentFromText):
* page/DragController.cpp:
(WebCore::documentFragmentFromDragData):
(WebCore::DragController::concludeEditDrag):
* page/Page.cpp:
(WebCore::Page::rangeOfString):
* rendering/RenderObject.cpp:
(WebCore::RenderObject::absoluteBoundingBoxRectForRange):
* testing/Internals.cpp:
(WebCore::Internals::addTextMatchMarker):

Source/WebKit/blackberry: 

* WebKitSupport/InPageSearchManager.cpp:
(BlackBerry::WebKit::InPageSearchManager::findNextString):
(BlackBerry::WebKit::InPageSearchManager::findAndMarkText):
(BlackBerry::WebKit::InPageSearchManager::clearTextMatches):
(BlackBerry::WebKit::InPageSearchManager::setActiveMatchAndMarker):
(BlackBerry::WebKit::InPageSearchManager::frameUnloaded):
(BlackBerry::WebKit::InPageSearchManager::scopeStringMatches):

Source/WebKit/mac: 

* WebView/WebPDFView.mm:
(isFrameInRange):

Source/WebKit2: 

* WebProcess/InjectedBundle/API/mac/WKDOMRange.mm:
(-[WKDOMRange textRects]):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@155228 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 9d82db6d
2013-09-06 Ryosuke Niwa <rniwa@webkit.org>
Range::ownerDocument should return Document&
https://bugs.webkit.org/show_bug.cgi?id=120908
Reviewed by Andreas Kling.
Return Document& in Range::ownerDocument(). Also make setDocument take Document& so that this invariant is self-evident.
* bindings/objc/DOM.mm:
(-[DOMRange boundingBox]):
(-[DOMRange renderedImageForcingBlackText:]):
(-[DOMRange textRects]):
* dom/Range.cpp:
(WebCore::Range::setDocument):
(WebCore::Range::setStart):
(WebCore::Range::setEnd):
(WebCore::Range::selectNode):
(WebCore::Range::selectNodeContents):
* dom/Range.h:
(WebCore::Range::ownerDocument):
* editing/AlternativeTextController.cpp:
(WebCore::AlternativeTextController::handleAlternativeTextUIResult):
* editing/Editor.cpp:
(WebCore::Editor::avoidIntersectionWithDeleteButtonController):
(WebCore::isFrameInRange):
(WebCore::Editor::countMatchesForText):
* editing/EditorCommand.cpp:
(WebCore::unionDOMRanges):
* editing/TextCheckingHelper.cpp:
(WebCore::TextCheckingHelper::unifiedTextCheckerEnabled):
* editing/TextIterator.cpp:
(WebCore::plainText):
(WebCore::findPlainText):
* editing/htmlediting.cpp:
(WebCore::extendRangeToWrappingNodes):
* editing/markup.cpp:
(WebCore::createMarkup):
(WebCore::createFragmentFromText):
* page/DragController.cpp:
(WebCore::documentFragmentFromDragData):
(WebCore::DragController::concludeEditDrag):
* page/Page.cpp:
(WebCore::Page::rangeOfString):
* rendering/RenderObject.cpp:
(WebCore::RenderObject::absoluteBoundingBoxRectForRange):
* testing/Internals.cpp:
(WebCore::Internals::addTextMatchMarker):
2013-09-06 Brent Fulgham <bfulgham@apple.com>
[Windows] StructuredExceptionHandlerSuppressor Causes Bad Interactions with Support Libraries
......@@ -319,14 +319,14 @@ id <DOMEventTarget> kit(WebCore::EventTarget* eventTarget)
- (NSRect)boundingBox
{
// FIXME: The call to updateLayoutIgnorePendingStylesheets should be moved into WebCore::Range.
core(self)->ownerDocument()->updateLayoutIgnorePendingStylesheets();
core(self)->ownerDocument().updateLayoutIgnorePendingStylesheets();
return core(self)->boundingBox();
}
- (NSImage *)renderedImageForcingBlackText:(BOOL)forceBlackText
{
WebCore::Range* range = core(self);
WebCore::Frame* frame = range->ownerDocument()->frame();
WebCore::Frame* frame = range->ownerDocument().frame();
if (!frame)
return nil;
......@@ -337,7 +337,7 @@ id <DOMEventTarget> kit(WebCore::EventTarget* eventTarget)
{
// FIXME: The call to updateLayoutIgnorePendingStylesheets should be moved into WebCore::Range.
Vector<WebCore::IntRect> rects;
core(self)->ownerDocument()->updateLayoutIgnorePendingStylesheets();
core(self)->ownerDocument().updateLayoutIgnorePendingStylesheets();
core(self)->textRects(rects);
return kit(rects);
}
......
......@@ -116,14 +116,14 @@ Range::~Range()
#endif
}
void Range::setDocument(Document* document)
void Range::setDocument(Document& document)
{
ASSERT(m_ownerDocument != document);
ASSERT(m_ownerDocument != &document);
if (m_ownerDocument)
m_ownerDocument->detachRange(this);
m_ownerDocument = document;
m_start.setToStartOfNode(document);
m_end.setToStartOfNode(document);
m_ownerDocument = &document;
m_start.setToStartOfNode(&document);
m_end.setToStartOfNode(&document);
m_ownerDocument->attachRange(this);
}
......@@ -224,7 +224,7 @@ void Range::setStart(PassRefPtr<Node> refNode, int offset, ExceptionCode& ec)
bool didMoveDocument = false;
if (&refNode->document() != m_ownerDocument) {
setDocument(&refNode->document());
setDocument(refNode->document());
didMoveDocument = true;
}
......@@ -253,7 +253,7 @@ void Range::setEnd(PassRefPtr<Node> refNode, int offset, ExceptionCode& ec)
bool didMoveDocument = false;
if (&refNode->document() != m_ownerDocument) {
setDocument(&refNode->document());
setDocument(refNode->document());
didMoveDocument = true;
}
......@@ -1344,7 +1344,7 @@ void Range::selectNode(Node* refNode, ExceptionCode& ec)
}
if (m_ownerDocument != &refNode->document())
setDocument(&refNode->document());
setDocument(refNode->document());
ec = 0;
setStartBefore(refNode, ec);
......@@ -1389,7 +1389,7 @@ void Range::selectNodeContents(Node* refNode, ExceptionCode& ec)
}
if (m_ownerDocument != &refNode->document())
setDocument(&refNode->document());
setDocument(refNode->document());
m_start.setToStartOfNode(refNode);
m_end.setToEndOfNode(refNode);
......
......@@ -53,7 +53,7 @@ public:
static PassRefPtr<Range> create(PassRefPtr<Document>, const Position&, const Position&);
~Range();
Document* ownerDocument() const { return m_ownerDocument.get(); }
Document& ownerDocument() const { return *m_ownerDocument; }
Node* startContainer() const { return m_start.container(); }
int startOffset() const { return m_start.offset(); }
Node* endContainer() const { return m_end.container(); }
......@@ -152,7 +152,7 @@ private:
explicit Range(PassRefPtr<Document>);
Range(PassRefPtr<Document>, PassRefPtr<Node> startContainer, int startOffset, PassRefPtr<Node> endContainer, int endOffset);
void setDocument(Document*);
void setDocument(Document&);
Node* checkNodeWOffset(Node*, int offset, ExceptionCode&) const;
void checkNodeBA(Node*, ExceptionCode&) const;
......
......@@ -397,7 +397,7 @@ void AlternativeTextController::timerFired(Timer<AlternativeTextController>*)
void AlternativeTextController::handleAlternativeTextUIResult(const String& result)
{
Range* rangeWithAlternative = m_alternativeTextInfo.rangeWithAlternative.get();
if (!rangeWithAlternative || m_frame.document() != rangeWithAlternative->ownerDocument())
if (!rangeWithAlternative || m_frame.document() != &rangeWithAlternative->ownerDocument())
return;
String currentWord = plainText(rangeWithAlternative);
......
......@@ -110,8 +110,6 @@ PassRefPtr<Range> Editor::avoidIntersectionWithDeleteButtonController(const Rang
if (!range || !controller)
return 0;
Document* document = range->ownerDocument();
Node* startContainer = range->startContainer();
int startOffset = range->startOffset();
Node* endContainer = range->endContainer();
......@@ -134,7 +132,7 @@ PassRefPtr<Range> Editor::avoidIntersectionWithDeleteButtonController(const Rang
endOffset = element->nodeIndex();
}
return Range::create(document, startContainer, startOffset, endContainer, endOffset);
return Range::create(&range->ownerDocument(), startContainer, startOffset, endContainer, endOffset);
}
VisibleSelection Editor::avoidIntersectionWithDeleteButtonController(const VisibleSelection& selection) const
......@@ -2919,7 +2917,7 @@ static bool isFrameInRange(Frame* frame, Range* range)
{
bool inRange = false;
for (HTMLFrameOwnerElement* ownerElement = frame->ownerElement(); ownerElement; ownerElement = ownerElement->document().ownerElement()) {
if (&ownerElement->document() == range->ownerDocument()) {
if (&ownerElement->document() == &range->ownerDocument()) {
inRange = range->intersectsNode(ownerElement, IGNORE_EXCEPTION);
break;
}
......@@ -2934,7 +2932,7 @@ unsigned Editor::countMatchesForText(const String& target, Range* range, FindOpt
RefPtr<Range> searchRange;
if (range) {
if (range->ownerDocument() == m_frame.document())
if (&range->ownerDocument() == m_frame.document())
searchRange = range;
else if (!isFrameInRange(&m_frame, range))
return 0;
......
......@@ -270,7 +270,7 @@ static RefPtr<Range> unionDOMRanges(Range* a, Range* b)
Range* start = a->compareBoundaryPoints(Range::START_TO_START, b, ASSERT_NO_EXCEPTION) <= 0 ? a : b;
Range* end = a->compareBoundaryPoints(Range::END_TO_END, b, ASSERT_NO_EXCEPTION) <= 0 ? b : a;
return Range::create(a->ownerDocument(), start->startContainer(), start->startOffset(), end->endContainer(), end->endOffset());
return Range::create(&a->ownerDocument(), start->startContainer(), start->startOffset(), end->endContainer(), end->endOffset());
}
// Execute command functions
......
......@@ -633,14 +633,7 @@ void TextCheckingHelper::markAllBadGrammar()
bool TextCheckingHelper::unifiedTextCheckerEnabled() const
{
if (!m_range)
return false;
Document* doc = m_range->ownerDocument();
if (!doc)
return false;
return WebCore::unifiedTextCheckerEnabled(doc->frame());
return m_range && WebCore::unifiedTextCheckerEnabled(m_range->ownerDocument().frame());
}
void checkTextOfParagraph(TextCheckerClient* client, const UChar* text, int length,
......
......@@ -2535,8 +2535,8 @@ String plainText(const Range* r, TextIteratorBehavior defaultBehavior, bool isDi
String result = builder.toString();
if (isDisplayString && r->ownerDocument())
r->ownerDocument()->displayStringModifiedByEncoding(result);
if (isDisplayString)
r->ownerDocument().displayStringModifiedByEncoding(result);
return result;
}
......@@ -2557,7 +2557,7 @@ static size_t findPlainText(CharacterIterator& it, const String& target, FindOpt
if (buffer.needsMoreContext()) {
RefPtr<Range> startRange = it.range();
RefPtr<Range> beforeStartRange = startRange->ownerDocument()->createRange();
RefPtr<Range> beforeStartRange = startRange->ownerDocument().createRange();
beforeStartRange->setEnd(startRange->startContainer(), startRange->startOffset(), IGNORE_EXCEPTION);
for (SimplifiedBackwardsTextIterator backwardsIterator(beforeStartRange.get()); !backwardsIterator.atEnd(); backwardsIterator.advance()) {
buffer.prependContext(backwardsIterator.characters(), backwardsIterator.length());
......@@ -2594,7 +2594,7 @@ tryAgain:
PassRefPtr<Range> findPlainText(const Range* range, const String& target, FindOptions options)
{
// CharacterIterator requires renderers to be up-to-date
range->ownerDocument()->updateLayout();
range->ownerDocument().updateLayout();
// First, find the text.
size_t matchStart;
......
......@@ -571,7 +571,7 @@ PassRefPtr<Range> extendRangeToWrappingNodes(PassRefPtr<Range> range, const Rang
return range;
// Create new range with the highest editable node contained within the range
RefPtr<Range> extendedRange = Range::create(range->ownerDocument());
RefPtr<Range> extendedRange = Range::create(&range->ownerDocument());
extendedRange->selectNode(highestNode, IGNORE_EXCEPTION);
return extendedRange.release();
}
......
......@@ -637,16 +637,13 @@ String createMarkup(const Range* range, Vector<Node*>* nodes, EAnnotateForInterc
if (!range)
return emptyString();
Document* document = range->ownerDocument();
if (!document)
return emptyString();
Document& document = range->ownerDocument();
const Range* updatedRange = range;
#if ENABLE(DELETION_UI)
// Disable the delete button so it's elements are not serialized into the markup,
// but make sure neither endpoint is inside the delete user interface.
Frame* frame = document->frame();
Frame* frame = document.frame();
DeleteButtonControllerDisableScope deleteButtonControllerDisableScope(frame);
RefPtr<Range> updatedRangeRef;
......@@ -658,7 +655,7 @@ String createMarkup(const Range* range, Vector<Node*>* nodes, EAnnotateForInterc
}
#endif
return createMarkupInternal(document, range, updatedRange, nodes, shouldAnnotate, convertBlocksToInlines, shouldResolveURLs);
return createMarkupInternal(&document, range, updatedRange, nodes, shouldAnnotate, convertBlocksToInlines, shouldResolveURLs);
}
PassRefPtr<DocumentFragment> createFragmentFromMarkup(Document* document, const String& markup, const String& baseURL, ParserContentPolicy parserContentPolicy)
......@@ -840,8 +837,8 @@ PassRefPtr<DocumentFragment> createFragmentFromText(Range* context, const String
if (!context)
return 0;
Document* document = context->ownerDocument();
RefPtr<DocumentFragment> fragment = document->createDocumentFragment();
Document& document = context->ownerDocument();
RefPtr<DocumentFragment> fragment = document.createDocumentFragment();
if (text.isEmpty())
return fragment.release();
......@@ -851,9 +848,9 @@ PassRefPtr<DocumentFragment> createFragmentFromText(Range* context, const String
string.replace('\r', '\n');
if (contextPreservesNewline(*context)) {
fragment->appendChild(document->createTextNode(string), ASSERT_NO_EXCEPTION);
fragment->appendChild(document.createTextNode(string), ASSERT_NO_EXCEPTION);
if (string.endsWith('\n')) {
RefPtr<Element> element = createBreakElement(document);
RefPtr<Element> element = createBreakElement(&document);
element->setAttribute(classAttr, AppleInterchangeNewline);
fragment->appendChild(element.release(), ASSERT_NO_EXCEPTION);
}
......@@ -885,16 +882,16 @@ PassRefPtr<DocumentFragment> createFragmentFromText(Range* context, const String
RefPtr<Element> element;
if (s.isEmpty() && i + 1 == numLines) {
// For last line, use the "magic BR" rather than a P.
element = createBreakElement(document);
element = createBreakElement(&document);
element->setAttribute(classAttr, AppleInterchangeNewline);
} else if (useLineBreak) {
element = createBreakElement(document);
element = createBreakElement(&document);
fillContainerFromString(fragment.get(), s);
} else {
if (useClonesOfEnclosingBlock)
element = block->cloneElementWithoutChildren();
else
element = createDefaultParagraphElement(document);
element = createDefaultParagraphElement(&document);
fillContainerFromString(element.get(), s);
}
fragment->appendChild(element.release(), ASSERT_NO_EXCEPTION);
......
......@@ -123,15 +123,13 @@ PassOwnPtr<DragController> DragController::create(Page* page, DragClient* client
return adoptPtr(new DragController(page, client));
}
static PassRefPtr<DocumentFragment> documentFragmentFromDragData(DragData* dragData, Frame* frame, RefPtr<Range> context,
bool allowPlainText, bool& chosePlainText)
static PassRefPtr<DocumentFragment> documentFragmentFromDragData(DragData* dragData, Frame* frame, PassRefPtr<Range> context, bool allowPlainText, bool& chosePlainText)
{
ASSERT(dragData);
chosePlainText = false;
Document* document = context->ownerDocument();
ASSERT(document);
if (document && dragData->containsCompatibleContent()) {
Document& document = context->ownerDocument();
if (dragData->containsCompatibleContent()) {
if (PassRefPtr<DocumentFragment> fragment = dragData->asFragment(frame, context, allowPlainText, chosePlainText))
return fragment;
......@@ -139,7 +137,7 @@ static PassRefPtr<DocumentFragment> documentFragmentFromDragData(DragData* dragD
String title;
String url = dragData->asURL(frame, DragData::DoNotConvertFilenames, &title);
if (!url.isEmpty()) {
RefPtr<HTMLAnchorElement> anchor = HTMLAnchorElement::create(document);
RefPtr<HTMLAnchorElement> anchor = HTMLAnchorElement::create(&document);
anchor->setHref(url);
if (title.isEmpty()) {
// Try the plain text first because the url might be normalized or escaped.
......@@ -148,9 +146,9 @@ static PassRefPtr<DocumentFragment> documentFragmentFromDragData(DragData* dragD
if (title.isEmpty())
title = url;
}
RefPtr<Node> anchorText = document->createTextNode(title);
RefPtr<Node> anchorText = document.createTextNode(title);
anchor->appendChild(anchorText, IGNORE_EXCEPTION);
RefPtr<DocumentFragment> fragment = document->createDocumentFragment();
RefPtr<DocumentFragment> fragment = document.createDocumentFragment();
fragment->appendChild(anchor, IGNORE_EXCEPTION);
return fragment.get();
}
......@@ -505,7 +503,7 @@ bool DragController::concludeEditDrag(DragData* dragData)
// manually controlling drag behaviour
if (!range)
return false;
CachedResourceLoader* cachedResourceLoader = range->ownerDocument()->cachedResourceLoader();
CachedResourceLoader* cachedResourceLoader = range->ownerDocument().cachedResourceLoader();
ResourceCacheValidationSuppressor validationSuppressor(cachedResourceLoader);
if (dragIsMove(innerFrame->selection(), dragData) || dragCaret.isContentRichlyEditable()) {
bool chosePlainText = false;
......
......@@ -630,11 +630,11 @@ PassRefPtr<Range> Page::rangeOfString(const String& target, Range* referenceRang
if (target.isEmpty())
return 0;
if (referenceRange && referenceRange->ownerDocument()->page() != this)
if (referenceRange && referenceRange->ownerDocument().page() != this)
return 0;
bool shouldWrap = options & WrapAround;
Frame* frame = referenceRange ? referenceRange->ownerDocument()->frame() : &mainFrame();
Frame* frame = referenceRange ? referenceRange->ownerDocument().frame() : &mainFrame();
Frame* startFrame = frame;
do {
if (RefPtr<Range> resultRange = frame->editor().rangeOfString(target, frame == startFrame ? referenceRange : 0, options & ~WrapAround))
......
......@@ -1259,8 +1259,7 @@ FloatRect RenderObject::absoluteBoundingBoxRectForRange(const Range* range)
if (!range || !range->startContainer())
return FloatRect();
if (range->ownerDocument())
range->ownerDocument()->updateLayout();
range->ownerDocument().updateLayout();
Vector<FloatQuad> quads;
range->textQuads(quads);
......
......@@ -843,8 +843,8 @@ String Internals::markerDescriptionForNode(Node* node, const String& markerType,
void Internals::addTextMatchMarker(const Range* range, bool isActive)
{
range->ownerDocument()->updateLayoutIgnorePendingStylesheets();
range->ownerDocument()->markers().addTextMatchMarker(range, isActive);
range->ownerDocument().updateLayoutIgnorePendingStylesheets();
range->ownerDocument().markers().addTextMatchMarker(range, isActive);
}
void Internals::setScrollViewPosition(Document* document, long x, long y, ExceptionCode& ec)
......
2013-09-06 Ryosuke Niwa <rniwa@webkit.org>
Range::ownerDocument should return Document&
https://bugs.webkit.org/show_bug.cgi?id=120908
Reviewed by Andreas Kling.
* WebKitSupport/InPageSearchManager.cpp:
(BlackBerry::WebKit::InPageSearchManager::findNextString):
(BlackBerry::WebKit::InPageSearchManager::findAndMarkText):
(BlackBerry::WebKit::InPageSearchManager::clearTextMatches):
(BlackBerry::WebKit::InPageSearchManager::setActiveMatchAndMarker):
(BlackBerry::WebKit::InPageSearchManager::frameUnloaded):
(BlackBerry::WebKit::InPageSearchManager::scopeStringMatches):
2013-08-30 Antti Koivisto <antti@apple.com>
Remove code behind ENABLE(DIALOG_ELEMENT)
......
......@@ -135,7 +135,7 @@ bool InPageSearchManager::findNextString(const String& text, FindOptions findOpt
startFromSelection = true;
}
Frame* currentActiveMatchFrame = selection.isNone() && m_activeMatch ? m_activeMatch->ownerDocument()->frame() : m_webPage->focusedOrMainFrame();
Frame* currentActiveMatchFrame = selection.isNone() && m_activeMatch ? m_activeMatch->ownerDocument().frame() : m_webPage->focusedOrMainFrame();
if (findAndMarkText(text, searchStartingPoint.get(), currentActiveMatchFrame, findOptions, newSearch, startFromSelection))
return true;
......@@ -189,7 +189,7 @@ bool InPageSearchManager::findAndMarkText(const String& text, Range* range, Fram
// Not highlighting all matches, we need to add the marker here,
// because scopeStringMatches does not add any markers, it only counts the number.
// No need to unmarkAllTextMatches, it is already done from the caller because of newSearch
m_activeMatch->ownerDocument()->markers().addTextMatchMarker(m_activeMatch.get(), true);
m_activeMatch->ownerDocument().markers().addTextMatchMarker(m_activeMatch.get(), true);
frame->editor().setMarkedTextMatchesAreHighlighted(true /* highlight */);
}
return true;
......@@ -222,7 +222,7 @@ bool InPageSearchManager::findAndMarkText(const String& text, Range* range, Fram
// When only showing single matches, the scoping effort won't highlight
// all matches but count them.
m_webPage->m_page->unmarkAllTextMatches();
m_activeMatch->ownerDocument()->markers().addTextMatchMarker(m_activeMatch.get(), true);
m_activeMatch->ownerDocument().markers().addTextMatchMarker(m_activeMatch.get(), true);
frame->editor().setMarkedTextMatchesAreHighlighted(true /* highlight */);
}
......@@ -235,7 +235,7 @@ void InPageSearchManager::clearTextMatches(bool selectActiveMatchOnClear)
{
if (selectActiveMatchOnClear && m_activeMatch.get()) {
VisibleSelection selection(m_activeMatch.get());
m_activeMatch->ownerDocument()->frame()->selection().setSelection(selection);
m_activeMatch->ownerDocument().frame()->selection().setSelection(selection);
}
m_webPage->m_page->unmarkAllTextMatches();
m_activeMatch = 0;
......@@ -246,16 +246,12 @@ void InPageSearchManager::clearTextMatches(bool selectActiveMatchOnClear)
void InPageSearchManager::setActiveMatchAndMarker(PassRefPtr<Range> range)
{
// Clear the old marker, update our range, and highlight the new range.
if (m_activeMatch.get()) {
if (Document* doc = m_activeMatch->ownerDocument())
doc->markers().setMarkersActive(m_activeMatch.get(), false);
}
if (m_activeMatch.get())
m_activeMatch->ownerDocument().markers().setMarkersActive(m_activeMatch.get(), false);
m_activeMatch = range;
if (m_activeMatch.get()) {
if (Document* doc = m_activeMatch->ownerDocument())
doc->markers().setMarkersActive(m_activeMatch.get(), true);
}
if (m_activeMatch.get())
m_activeMatch->ownerDocument().markers().setMarkersActive(m_activeMatch.get(), true);
}
void InPageSearchManager::frameUnloaded(const Frame* frame)
......@@ -273,7 +269,7 @@ void InPageSearchManager::frameUnloaded(const Frame* frame)
return;
}
Frame* currentActiveMatchFrame = m_activeMatch->ownerDocument()->frame();
Frame* currentActiveMatchFrame = m_activeMatch->ownerDocument().frame();
if (currentActiveMatchFrame == frame) {
// FIXME: We need to re-scope this frame instead of cancelling all effort?
cancelPendingScopingEffort();
......@@ -302,7 +298,7 @@ void InPageSearchManager::scopeStringMatches(const String& text, bool reset, boo
return;
}
if (m_resumeScopingFromRange && scopingFrame != m_resumeScopingFromRange->ownerDocument()->frame())
if (m_resumeScopingFromRange && scopingFrame != m_resumeScopingFromRange->ownerDocument().frame())
m_resumeScopingFromRange = 0;
RefPtr<Range> searchRange(rangeOfContents(scopingFrame->document()));
......@@ -343,7 +339,7 @@ void InPageSearchManager::scopeStringMatches(const String& text, bool reset, boo
m_activeMatchIndex = m_activeMatchCount + matchCount;
}
if (!locateActiveMatchOnly && m_highlightAllMatches)
resultRange->ownerDocument()->markers().addTextMatchMarker(resultRange.get(), foundActiveMatch);
resultRange->ownerDocument().markers().addTextMatchMarker(resultRange.get(), foundActiveMatch);
searchRange->setStart(resultRange->endContainer(ec), resultRange->endOffset(ec), ec);
ShadowRoot* shadowTreeRoot = searchRange->shadowRoot();
......
2013-09-06 Ryosuke Niwa <rniwa@webkit.org>
Range::ownerDocument should return Document&
https://bugs.webkit.org/show_bug.cgi?id=120908
Reviewed by Andreas Kling.
* WebView/WebPDFView.mm:
(isFrameInRange):
2013-09-05 Andreas Kling <akling@apple.com>
ScrollView::children() should return a reference.
......
......@@ -637,7 +637,7 @@ static BOOL isFrameInRange(WebFrame *frame, DOMRange *range)
{
BOOL inRange = NO;
for (HTMLFrameOwnerElement* ownerElement = core(frame)->ownerElement(); ownerElement; ownerElement = ownerElement->document().frame()->ownerElement()) {
if (&ownerElement->document() == core(range)->ownerDocument()) {
if (&ownerElement->document() == &core(range)->ownerDocument()) {
inRange = [range intersectsNode:kit(ownerElement)];
break;
}
......
2013-09-06 Ryosuke Niwa <rniwa@webkit.org>
Range::ownerDocument should return Document&
https://bugs.webkit.org/show_bug.cgi?id=120908
Reviewed by Andreas Kling.
* WebProcess/InjectedBundle/API/mac/WKDOMRange.mm:
(-[WKDOMRange textRects]):
2013-09-05 Ryuan Choi <ryuan.choi@samsung.com>
[CMAKE] Add c++0x into CXX_FLAGS as a default
......
......@@ -142,7 +142,7 @@
- (NSArray *)textRects
{
_impl->ownerDocument()->updateLayoutIgnorePendingStylesheets();
_impl->ownerDocument().updateLayoutIgnorePendingStylesheets();
Vector<WebCore::IntRect> rects;
_impl->textRects(rects);
return WebKit::toNSArray(rects);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment