| 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 Dirk Mueller <mueller@kde.org> | 5 * 2000 Dirk Mueller <mueller@kde.org> |
| 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. |
| 7 * (C) 2006 Graham Dennis (graham.dennis@gmail.com) | 7 * (C) 2006 Graham Dennis (graham.dennis@gmail.com) |
| 8 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) | 8 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) |
| 9 * Copyright (C) 2009 Google Inc. All rights reserved. | 9 * Copyright (C) 2009 Google Inc. All rights reserved. |
| 10 * | 10 * |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 #include "core/inspector/InspectorTraceEvents.h" | 40 #include "core/inspector/InspectorTraceEvents.h" |
| 41 #include "core/loader/FrameLoaderClient.h" | 41 #include "core/loader/FrameLoaderClient.h" |
| 42 #include "core/page/Chrome.h" | 42 #include "core/page/Chrome.h" |
| 43 #include "core/page/ChromeClient.h" | 43 #include "core/page/ChromeClient.h" |
| 44 #include "core/page/EventHandler.h" | 44 #include "core/page/EventHandler.h" |
| 45 #include "core/page/FocusController.h" | 45 #include "core/page/FocusController.h" |
| 46 #include "core/page/Page.h" | 46 #include "core/page/Page.h" |
| 47 #include "core/page/scrolling/ScrollingCoordinator.h" | 47 #include "core/page/scrolling/ScrollingCoordinator.h" |
| 48 #include "core/rendering/RenderLayer.h" | 48 #include "core/rendering/RenderLayer.h" |
| 49 #include "core/rendering/RenderView.h" | 49 #include "core/rendering/RenderView.h" |
| 50 #include "core/rendering/RenderWidget.h" | |
| 51 #include "core/rendering/compositing/CompositedLayerMapping.h" | 50 #include "core/rendering/compositing/CompositedLayerMapping.h" |
| 52 #include "core/rendering/compositing/RenderLayerCompositor.h" | 51 #include "core/rendering/compositing/RenderLayerCompositor.h" |
| 53 #include "core/rendering/style/RenderStyle.h" | 52 #include "core/rendering/style/RenderStyle.h" |
| 54 #include "platform/RuntimeEnabledFeatures.h" | 53 #include "platform/RuntimeEnabledFeatures.h" |
| 55 #include "platform/ScriptForbiddenScope.h" | 54 #include "platform/ScriptForbiddenScope.h" |
| 56 #include "platform/TraceEvent.h" | 55 #include "platform/TraceEvent.h" |
| 57 #include "platform/fonts/FontCache.h" | 56 #include "platform/fonts/FontCache.h" |
| 58 #include "platform/geometry/FloatRect.h" | 57 #include "platform/geometry/FloatRect.h" |
| 59 #include "platform/graphics/GraphicsContext.h" | 58 #include "platform/graphics/GraphicsContext.h" |
| 60 #include "platform/graphics/GraphicsLayerDebugInfo.h" | 59 #include "platform/graphics/GraphicsLayerDebugInfo.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 84 , m_overflowStatusDirty(true) | 83 , m_overflowStatusDirty(true) |
| 85 , m_viewportRenderer(0) | 84 , m_viewportRenderer(0) |
| 86 , m_wasScrolledByUser(false) | 85 , m_wasScrolledByUser(false) |
| 87 , m_inProgrammaticScroll(false) | 86 , m_inProgrammaticScroll(false) |
| 88 , m_isTrackingPaintInvalidations(false) | 87 , m_isTrackingPaintInvalidations(false) |
| 89 , m_hasSoftwareFilters(false) | 88 , m_hasSoftwareFilters(false) |
| 90 , m_visibleContentScaleFactor(1) | 89 , m_visibleContentScaleFactor(1) |
| 91 , m_inputEventsScaleFactorForEmulation(1) | 90 , m_inputEventsScaleFactorForEmulation(1) |
| 92 , m_layoutSizeFixedToFrameSize(true) | 91 , m_layoutSizeFixedToFrameSize(true) |
| 93 , m_didScrollTimer(this, &FrameView::didScrollTimerFired) | 92 , m_didScrollTimer(this, &FrameView::didScrollTimerFired) |
| 94 , m_needsUpdateWidgetPositions(false) | |
| 95 { | 93 { |
| 96 ASSERT(m_frame); | 94 ASSERT(m_frame); |
| 97 init(); | 95 init(); |
| 98 } | 96 } |
| 99 | 97 |
| 100 PassRefPtr<FrameView> FrameView::create(LocalFrame* frame) | 98 PassRefPtr<FrameView> FrameView::create(LocalFrame* frame) |
| 101 { | 99 { |
| 102 RefPtr<FrameView> view = adoptRef(new FrameView(frame)); | 100 RefPtr<FrameView> view = adoptRef(new FrameView(frame)); |
| 103 view->show(); | 101 view->show(); |
| 104 return view.release(); | 102 return view.release(); |
| (...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 630 for (RenderObject* renderer = layoutRoot; renderer; renderer = renderer->nex
tInPreOrder()) { | 628 for (RenderObject* renderer = layoutRoot; renderer; renderer = renderer->nex
tInPreOrder()) { |
| 631 if (renderer->layoutDidGetCalled()) { | 629 if (renderer->layoutDidGetCalled()) { |
| 632 FloatQuad quad = renderer->localToAbsoluteQuad(FloatQuad(renderer->p
reviousPaintInvalidationRect())); | 630 FloatQuad quad = renderer->localToAbsoluteQuad(FloatQuad(renderer->p
reviousPaintInvalidationRect())); |
| 633 LayoutRect rect = quad.enclosingBoundingBox(); | 631 LayoutRect rect = quad.enclosingBoundingBox(); |
| 634 debugInfo.currentLayoutRects().append(rect); | 632 debugInfo.currentLayoutRects().append(rect); |
| 635 renderer->setLayoutDidGetCalled(false); | 633 renderer->setLayoutDidGetCalled(false); |
| 636 } | 634 } |
| 637 } | 635 } |
| 638 } | 636 } |
| 639 | 637 |
| 640 void FrameView::addWidget(RenderWidget* object) | |
| 641 { | |
| 642 m_widgets.add(object); | |
| 643 } | |
| 644 | |
| 645 void FrameView::removeWidget(RenderWidget* object) | |
| 646 { | |
| 647 m_widgets.remove(object); | |
| 648 } | |
| 649 | |
| 650 void FrameView::updateWidgetPositions() | |
| 651 { | |
| 652 Vector<RefPtr<RenderWidget> > widgets; | |
| 653 copyToVector(m_widgets, widgets); | |
| 654 | |
| 655 // Script or plugins could detach the frame so abort processing if that happ
ens. | |
| 656 | |
| 657 for (size_t i = 0; i < widgets.size() && renderView(); ++i) | |
| 658 widgets[i]->updateWidgetPosition(); | |
| 659 | |
| 660 for (size_t i = 0; i < widgets.size() && renderView(); ++i) | |
| 661 widgets[i]->widgetPositionsUpdated(); | |
| 662 } | |
| 663 | |
| 664 void FrameView::setMediaType(const AtomicString& mediaType) | 638 void FrameView::setMediaType(const AtomicString& mediaType) |
| 665 { | 639 { |
| 666 ASSERT(m_frame->document()); | 640 ASSERT(m_frame->document()); |
| 667 m_frame->document()->mediaQueryAffectingValueChanged(); | 641 m_frame->document()->mediaQueryAffectingValueChanged(); |
| 668 m_mediaType = mediaType; | 642 m_mediaType = mediaType; |
| 669 } | 643 } |
| 670 | 644 |
| 671 AtomicString FrameView::mediaType() const | 645 AtomicString FrameView::mediaType() const |
| 672 { | 646 { |
| 673 // See if we have an override type. | 647 // See if we have an override type. |
| (...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1013 } | 987 } |
| 1014 | 988 |
| 1015 ASSERT(m_frame->document()); | 989 ASSERT(m_frame->document()); |
| 1016 if (m_nestedLayoutCount <= 1) { | 990 if (m_nestedLayoutCount <= 1) { |
| 1017 if (m_firstLayoutCallbackPending) | 991 if (m_firstLayoutCallbackPending) |
| 1018 m_firstLayoutCallbackPending = false; | 992 m_firstLayoutCallbackPending = false; |
| 1019 } | 993 } |
| 1020 | 994 |
| 1021 FontFaceSet::didLayout(*m_frame->document()); | 995 FontFaceSet::didLayout(*m_frame->document()); |
| 1022 | 996 |
| 1023 updateWidgetPositions(); | |
| 1024 | |
| 1025 // Plugins could have torn down the page inside updateWidgetPositions(). | |
| 1026 if (!renderView()) | |
| 1027 return; | |
| 1028 | |
| 1029 if (Page* page = m_frame->page()) { | 997 if (Page* page = m_frame->page()) { |
| 1030 if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordina
tor()) | 998 if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordina
tor()) |
| 1031 scrollingCoordinator->notifyLayoutUpdated(); | 999 scrollingCoordinator->notifyLayoutUpdated(); |
| 1032 } | 1000 } |
| 1033 | 1001 |
| 1034 sendResizeEventIfNeeded(); | 1002 sendResizeEventIfNeeded(); |
| 1035 } | 1003 } |
| 1036 | 1004 |
| 1037 bool FrameView::wasViewportResized() | 1005 bool FrameView::wasViewportResized() |
| 1038 { | 1006 { |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1270 bool FrameView::isPainting() const | 1238 bool FrameView::isPainting() const |
| 1271 { | 1239 { |
| 1272 return m_isPainting; | 1240 return m_isPainting; |
| 1273 } | 1241 } |
| 1274 | 1242 |
| 1275 void FrameView::setNodeToDraw(Node* node) | 1243 void FrameView::setNodeToDraw(Node* node) |
| 1276 { | 1244 { |
| 1277 m_nodeToDraw = node; | 1245 m_nodeToDraw = node; |
| 1278 } | 1246 } |
| 1279 | 1247 |
| 1280 void FrameView::updateWidgetPositionsIfNeeded() | |
| 1281 { | |
| 1282 if (!m_needsUpdateWidgetPositions) | |
| 1283 return; | |
| 1284 | |
| 1285 m_needsUpdateWidgetPositions = false; | |
| 1286 | |
| 1287 updateWidgetPositions(); | |
| 1288 } | |
| 1289 | |
| 1290 void FrameView::updateLayoutAndStyleForPainting() | 1248 void FrameView::updateLayoutAndStyleForPainting() |
| 1291 { | 1249 { |
| 1292 // Updating layout can run script, which can tear down the FrameView. | 1250 // Updating layout can run script, which can tear down the FrameView. |
| 1293 RefPtr<FrameView> protector(this); | 1251 RefPtr<FrameView> protector(this); |
| 1294 | 1252 |
| 1295 updateLayoutAndStyleIfNeededRecursive(); | 1253 updateLayoutAndStyleIfNeededRecursive(); |
| 1296 | 1254 |
| 1297 updateWidgetPositionsIfNeeded(); | |
| 1298 | |
| 1299 if (RenderView* view = renderView()) { | 1255 if (RenderView* view = renderView()) { |
| 1300 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Up
dateLayerTree", "frame", m_frame.get()); | 1256 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Up
dateLayerTree", "frame", m_frame.get()); |
| 1301 view->compositor()->updateIfNeededRecursive(); | 1257 view->compositor()->updateIfNeededRecursive(); |
| 1302 | 1258 |
| 1303 if (view->compositor()->inCompositingMode()) | 1259 if (view->compositor()->inCompositingMode()) |
| 1304 m_frame->page()->scrollingCoordinator()->updateAfterCompositingChang
eIfNeeded(); | 1260 m_frame->page()->scrollingCoordinator()->updateAfterCompositingChang
eIfNeeded(); |
| 1305 | 1261 |
| 1306 updateCompositedSelectionBoundsIfNeeded(); | 1262 updateCompositedSelectionBoundsIfNeeded(); |
| 1307 | 1263 |
| 1308 invalidateTreeIfNeededRecursive(); | 1264 invalidateTreeIfNeededRecursive(); |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1534 void FrameView::setLayoutSizeInternal(const IntSize& size) | 1490 void FrameView::setLayoutSizeInternal(const IntSize& size) |
| 1535 { | 1491 { |
| 1536 if (m_layoutSize == size) | 1492 if (m_layoutSize == size) |
| 1537 return; | 1493 return; |
| 1538 | 1494 |
| 1539 m_layoutSize = size; | 1495 m_layoutSize = size; |
| 1540 contentsResized(); | 1496 contentsResized(); |
| 1541 } | 1497 } |
| 1542 | 1498 |
| 1543 } // namespace blink | 1499 } // namespace blink |
| OLD | NEW |