OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org> | 2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org> |
3 * 1999 Lars Knoll <knoll@kde.org> | 3 * 1999 Lars Knoll <knoll@kde.org> |
4 * 1999 Antti Koivisto <koivisto@kde.org> | 4 * 1999 Antti Koivisto <koivisto@kde.org> |
5 * 2000 Simon Hausmann <hausmann@kde.org> | 5 * 2000 Simon Hausmann <hausmann@kde.org> |
6 * 2000 Stefan Schimanski <1Stein@gmx.de> | 6 * 2000 Stefan Schimanski <1Stein@gmx.de> |
7 * 2001 George Staikos <staikos@kde.org> | 7 * 2001 George Staikos <staikos@kde.org> |
8 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r
ights reserved. | 8 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r
ights reserved. |
9 * Copyright (C) 2005 Alexey Proskuryakov <ap@nypop.com> | 9 * Copyright (C) 2005 Alexey Proskuryakov <ap@nypop.com> |
10 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) | 10 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 { | 129 { |
130 RefPtr<Frame> frame = adoptRef(new Frame(frameInit)); | 130 RefPtr<Frame> frame = adoptRef(new Frame(frameInit)); |
131 if (!frame->ownerElement()) | 131 if (!frame->ownerElement()) |
132 frame->page()->setMainFrame(frame); | 132 frame->page()->setMainFrame(frame); |
133 InspectorInstrumentation::frameAttachedToParent(frame.get()); | 133 InspectorInstrumentation::frameAttachedToParent(frame.get()); |
134 return frame.release(); | 134 return frame.release(); |
135 } | 135 } |
136 | 136 |
137 Frame::~Frame() | 137 Frame::~Frame() |
138 { | 138 { |
139 setView(0); | 139 setView(nullptr); |
140 loader().clear(); | 140 loader().clear(); |
141 setDOMWindow(0); | 141 setDOMWindow(nullptr); |
142 | 142 |
143 // FIXME: We should not be doing all this work inside the destructor | 143 // FIXME: We should not be doing all this work inside the destructor |
144 | 144 |
145 #ifndef NDEBUG | 145 #ifndef NDEBUG |
146 frameCounter.decrement(); | 146 frameCounter.decrement(); |
147 #endif | 147 #endif |
148 | 148 |
149 disconnectOwnerElement(); | 149 disconnectOwnerElement(); |
150 | 150 |
151 HashSet<FrameDestructionObserver*>::iterator stop = m_destructionObservers.e
nd(); | 151 HashSet<FrameDestructionObserver*>::iterator stop = m_destructionObservers.e
nd(); |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
348 parent->loader().checkLoadComplete(); | 348 parent->loader().checkLoadComplete(); |
349 | 349 |
350 HashSet<FrameDestructionObserver*>::iterator stop = m_destructionObservers.e
nd(); | 350 HashSet<FrameDestructionObserver*>::iterator stop = m_destructionObservers.e
nd(); |
351 for (HashSet<FrameDestructionObserver*>::iterator it = m_destructionObserver
s.begin(); it != stop; ++it) | 351 for (HashSet<FrameDestructionObserver*>::iterator it = m_destructionObserver
s.begin(); it != stop; ++it) |
352 (*it)->willDetachFrameHost(); | 352 (*it)->willDetachFrameHost(); |
353 | 353 |
354 // FIXME: Page should take care of updating focus/scrolling instead of Frame
. | 354 // FIXME: Page should take care of updating focus/scrolling instead of Frame
. |
355 // FIXME: It's unclear as to why this is called more than once, but it is, | 355 // FIXME: It's unclear as to why this is called more than once, but it is, |
356 // so page() could be NULL. | 356 // so page() could be NULL. |
357 if (page() && page()->focusController().focusedFrame() == this) | 357 if (page() && page()->focusController().focusedFrame() == this) |
358 page()->focusController().setFocusedFrame(0); | 358 page()->focusController().setFocusedFrame(nullptr); |
359 | 359 |
360 if (page() && page()->scrollingCoordinator() && m_view) | 360 if (page() && page()->scrollingCoordinator() && m_view) |
361 page()->scrollingCoordinator()->willDestroyScrollableArea(m_view.get()); | 361 page()->scrollingCoordinator()->willDestroyScrollableArea(m_view.get()); |
362 | 362 |
363 script().clearScriptObjects(); | 363 script().clearScriptObjects(); |
364 } | 364 } |
365 | 365 |
366 void Frame::detachFromFrameHost() | 366 void Frame::detachFromFrameHost() |
367 { | 367 { |
368 // We should never be detatching the page during a Layout. | 368 // We should never be detatching the page during a Layout. |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
431 | 431 |
432 if (contentRenderer()) | 432 if (contentRenderer()) |
433 result = eventHandler().hitTestResultAtPoint(pt, HitTestRequest::ReadOnl
y | HitTestRequest::Active | HitTestRequest::ConfusingAndOftenMisusedDisallowSha
dowContent); | 433 result = eventHandler().hitTestResultAtPoint(pt, HitTestRequest::ReadOnl
y | HitTestRequest::Active | HitTestRequest::ConfusingAndOftenMisusedDisallowSha
dowContent); |
434 return result.innerNode() ? &result.innerNode()->document() : 0; | 434 return result.innerNode() ? &result.innerNode()->document() : 0; |
435 } | 435 } |
436 | 436 |
437 PassRefPtr<Range> Frame::rangeForPoint(const IntPoint& framePoint) | 437 PassRefPtr<Range> Frame::rangeForPoint(const IntPoint& framePoint) |
438 { | 438 { |
439 VisiblePosition position = visiblePositionForPoint(framePoint); | 439 VisiblePosition position = visiblePositionForPoint(framePoint); |
440 if (position.isNull()) | 440 if (position.isNull()) |
441 return 0; | 441 return nullptr; |
442 | 442 |
443 VisiblePosition previous = position.previous(); | 443 VisiblePosition previous = position.previous(); |
444 if (previous.isNotNull()) { | 444 if (previous.isNotNull()) { |
445 RefPtr<Range> previousCharacterRange = makeRange(previous, position); | 445 RefPtr<Range> previousCharacterRange = makeRange(previous, position); |
446 LayoutRect rect = editor().firstRectForRange(previousCharacterRange.get(
)); | 446 LayoutRect rect = editor().firstRectForRange(previousCharacterRange.get(
)); |
447 if (rect.contains(framePoint)) | 447 if (rect.contains(framePoint)) |
448 return previousCharacterRange.release(); | 448 return previousCharacterRange.release(); |
449 } | 449 } |
450 | 450 |
451 VisiblePosition next = position.next(); | 451 VisiblePosition next = position.next(); |
452 if (RefPtr<Range> nextCharacterRange = makeRange(position, next)) { | 452 if (RefPtr<Range> nextCharacterRange = makeRange(position, next)) { |
453 LayoutRect rect = editor().firstRectForRange(nextCharacterRange.get()); | 453 LayoutRect rect = editor().firstRectForRange(nextCharacterRange.get()); |
454 if (rect.contains(framePoint)) | 454 if (rect.contains(framePoint)) |
455 return nextCharacterRange.release(); | 455 return nextCharacterRange.release(); |
456 } | 456 } |
457 | 457 |
458 return 0; | 458 return nullptr; |
459 } | 459 } |
460 | 460 |
461 void Frame::createView(const IntSize& viewportSize, const Color& backgroundColor
, bool transparent, | 461 void Frame::createView(const IntSize& viewportSize, const Color& backgroundColor
, bool transparent, |
462 ScrollbarMode horizontalScrollbarMode, bool horizontalLock, | 462 ScrollbarMode horizontalScrollbarMode, bool horizontalLock, |
463 ScrollbarMode verticalScrollbarMode, bool verticalLock) | 463 ScrollbarMode verticalScrollbarMode, bool verticalLock) |
464 { | 464 { |
465 ASSERT(this); | 465 ASSERT(this); |
466 ASSERT(page()); | 466 ASSERT(page()); |
467 | 467 |
468 bool isMainFrame = this->isMainFrame(); | 468 bool isMainFrame = this->isMainFrame(); |
469 | 469 |
470 if (isMainFrame && view()) | 470 if (isMainFrame && view()) |
471 view()->setParentVisible(false); | 471 view()->setParentVisible(false); |
472 | 472 |
473 setView(0); | 473 setView(nullptr); |
474 | 474 |
475 RefPtr<FrameView> frameView; | 475 RefPtr<FrameView> frameView; |
476 if (isMainFrame) { | 476 if (isMainFrame) { |
477 frameView = FrameView::create(this, viewportSize); | 477 frameView = FrameView::create(this, viewportSize); |
478 | 478 |
479 // The layout size is set by WebViewImpl to support @viewport | 479 // The layout size is set by WebViewImpl to support @viewport |
480 frameView->setLayoutSizeFixedToFrameSize(false); | 480 frameView->setLayoutSizeFixedToFrameSize(false); |
481 } else | 481 } else |
482 frameView = FrameView::create(this); | 482 frameView = FrameView::create(this); |
483 | 483 |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
727 { | 727 { |
728 if (!m_host) | 728 if (!m_host) |
729 return 0; | 729 return 0; |
730 | 730 |
731 double ratio = m_host->deviceScaleFactor(); | 731 double ratio = m_host->deviceScaleFactor(); |
732 ratio *= pageZoomFactor(); | 732 ratio *= pageZoomFactor(); |
733 return ratio; | 733 return ratio; |
734 } | 734 } |
735 | 735 |
736 } // namespace WebCore | 736 } // namespace WebCore |
OLD | NEW |