OLD | NEW |
1 /* | 1 /* |
2 Copyright (C) 1997 Martin Jones (mjones@kde.org) | 2 Copyright (C) 1997 Martin Jones (mjones@kde.org) |
3 (C) 1998 Waldo Bastian (bastian@kde.org) | 3 (C) 1998 Waldo Bastian (bastian@kde.org) |
4 (C) 1998, 1999 Torben Weis (weis@kde.org) | 4 (C) 1998, 1999 Torben Weis (weis@kde.org) |
5 (C) 1999 Lars Knoll (knoll@kde.org) | 5 (C) 1999 Lars Knoll (knoll@kde.org) |
6 (C) 1999 Antti Koivisto (koivisto@kde.org) | 6 (C) 1999 Antti Koivisto (koivisto@kde.org) |
7 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv
ed. | 7 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv
ed. |
8 | 8 |
9 This library is free software; you can redistribute it and/or | 9 This library is free software; you can redistribute it and/or |
10 modify it under the terms of the GNU Library General Public | 10 modify it under the terms of the GNU Library General Public |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 class RenderBox; | 50 class RenderBox; |
51 class RenderEmbeddedObject; | 51 class RenderEmbeddedObject; |
52 class RenderObject; | 52 class RenderObject; |
53 class RenderScrollbarPart; | 53 class RenderScrollbarPart; |
54 class RenderView; | 54 class RenderView; |
55 class RenderWidget; | 55 class RenderWidget; |
56 struct CompositedSelectionBound; | 56 struct CompositedSelectionBound; |
57 | 57 |
58 typedef unsigned long long DOMTimeStamp; | 58 typedef unsigned long long DOMTimeStamp; |
59 | 59 |
60 // FIXME: Oilpan: move Widget (and thereby FrameView) to the heap. | |
61 class FrameView final : public ScrollView { | 60 class FrameView final : public ScrollView { |
62 public: | 61 public: |
63 friend class RenderView; | 62 friend class RenderView; |
64 friend class Internals; | 63 friend class Internals; |
65 | 64 |
66 static PassRefPtr<FrameView> create(LocalFrame*); | 65 static PassRefPtrWillBeRawPtr<FrameView> create(LocalFrame*); |
67 static PassRefPtr<FrameView> create(LocalFrame*, const IntSize& initialSize)
; | 66 static PassRefPtrWillBeRawPtr<FrameView> create(LocalFrame*, const IntSize&
initialSize); |
68 | 67 |
69 virtual ~FrameView(); | 68 virtual ~FrameView(); |
70 | 69 |
71 virtual HostWindow* hostWindow() const override; | 70 virtual HostWindow* hostWindow() const override; |
72 | 71 |
73 virtual void invalidateRect(const IntRect&) override; | 72 virtual void invalidateRect(const IntRect&) override; |
74 virtual void setFrameRect(const IntRect&) override; | 73 virtual void setFrameRect(const IntRect&) override; |
75 | 74 |
76 LocalFrame& frame() const | 75 LocalFrame& frame() const |
77 { | 76 { |
78 ASSERT(m_frame); | 77 ASSERT(m_frame); |
79 return *m_frame; | 78 return *m_frame; |
80 } | 79 } |
81 | 80 |
82 Page* page() const; | 81 Page* page() const; |
83 | 82 |
84 RenderView* renderView() const; | 83 RenderView* renderView() const; |
85 | 84 |
86 virtual void setCanHaveScrollbars(bool) override; | 85 virtual void setCanHaveScrollbars(bool) override; |
87 | 86 |
88 virtual PassRefPtr<Scrollbar> createScrollbar(ScrollbarOrientation) override
; | 87 virtual PassRefPtrWillBeRawPtr<Scrollbar> createScrollbar(ScrollbarOrientati
on) override; |
89 | 88 |
90 virtual void setContentsSize(const IntSize&) override; | 89 virtual void setContentsSize(const IntSize&) override; |
91 IntPoint clampOffsetAtScale(const IntPoint& offset, float scale) const; | 90 IntPoint clampOffsetAtScale(const IntPoint& offset, float scale) const; |
92 | 91 |
93 void layout(bool allowSubtree = true); | 92 void layout(bool allowSubtree = true); |
94 bool didFirstLayout() const; | 93 bool didFirstLayout() const; |
95 void scheduleRelayout(); | 94 void scheduleRelayout(); |
96 void scheduleRelayoutOfSubtree(RenderObject*); | 95 void scheduleRelayoutOfSubtree(RenderObject*); |
97 bool layoutPending() const; | 96 bool layoutPending() const; |
98 bool isInPerformLayout() const; | 97 bool isInPerformLayout() const; |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 | 217 |
219 void updateLayoutAndStyleForPainting(); | 218 void updateLayoutAndStyleForPainting(); |
220 void updateLayoutAndStyleIfNeededRecursive(); | 219 void updateLayoutAndStyleIfNeededRecursive(); |
221 | 220 |
222 void invalidateTreeIfNeededRecursive(); | 221 void invalidateTreeIfNeededRecursive(); |
223 | 222 |
224 void incrementVisuallyNonEmptyCharacterCount(unsigned); | 223 void incrementVisuallyNonEmptyCharacterCount(unsigned); |
225 void incrementVisuallyNonEmptyPixelCount(const IntSize&); | 224 void incrementVisuallyNonEmptyPixelCount(const IntSize&); |
226 void setIsVisuallyNonEmpty() { m_isVisuallyNonEmpty = true; } | 225 void setIsVisuallyNonEmpty() { m_isVisuallyNonEmpty = true; } |
227 void enableAutoSizeMode(const IntSize& minSize, const IntSize& maxSize); | 226 void enableAutoSizeMode(const IntSize& minSize, const IntSize& maxSize); |
228 void disableAutoSizeMode() { m_autoSizeInfo.clear(); } | 227 void disableAutoSizeMode() { disposeAutoSizeInfo(); } |
229 | 228 |
230 void forceLayout(bool allowSubtree = false); | 229 void forceLayout(bool allowSubtree = false); |
231 void forceLayoutForPagination(const FloatSize& pageSize, const FloatSize& or
iginalPageSize, float maximumShrinkFactor); | 230 void forceLayoutForPagination(const FloatSize& pageSize, const FloatSize& or
iginalPageSize, float maximumShrinkFactor); |
232 | 231 |
233 bool scrollToFragment(const KURL&); | 232 bool scrollToFragment(const KURL&); |
234 bool scrollToAnchor(const String&); | 233 bool scrollToAnchor(const String&); |
235 void maintainScrollPositionAtAnchor(Node*); | 234 void maintainScrollPositionAtAnchor(Node*); |
236 void scrollElementToRect(Element*, const IntRect&); | 235 void scrollElementToRect(Element*, const IntRect&); |
237 void scrollContentsIfNeededRecursive(); | 236 void scrollContentsIfNeededRecursive(); |
238 | 237 |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 virtual void getTickmarks(Vector<IntRect>&) const override; | 324 virtual void getTickmarks(Vector<IntRect>&) const override; |
326 virtual void scrollTo(const DoublePoint&) override; | 325 virtual void scrollTo(const DoublePoint&) override; |
327 virtual IntRect scrollableAreaBoundingBox() const override; | 326 virtual IntRect scrollableAreaBoundingBox() const override; |
328 virtual bool scrollAnimatorEnabled() const override; | 327 virtual bool scrollAnimatorEnabled() const override; |
329 virtual bool usesCompositedScrolling() const override; | 328 virtual bool usesCompositedScrolling() const override; |
330 virtual GraphicsLayer* layerForScrolling() const override; | 329 virtual GraphicsLayer* layerForScrolling() const override; |
331 virtual GraphicsLayer* layerForHorizontalScrollbar() const override; | 330 virtual GraphicsLayer* layerForHorizontalScrollbar() const override; |
332 virtual GraphicsLayer* layerForVerticalScrollbar() const override; | 331 virtual GraphicsLayer* layerForVerticalScrollbar() const override; |
333 virtual GraphicsLayer* layerForScrollCorner() const override; | 332 virtual GraphicsLayer* layerForScrollCorner() const override; |
334 | 333 |
| 334 virtual void trace(Visitor*) override; |
| 335 |
335 protected: | 336 protected: |
336 virtual bool scrollContentsFastPath(const IntSize& scrollDelta) override; | 337 virtual bool scrollContentsFastPath(const IntSize& scrollDelta) override; |
337 virtual void scrollContentsSlowPath(const IntRect& updateRect) override; | 338 virtual void scrollContentsSlowPath(const IntRect& updateRect) override; |
338 | 339 |
339 virtual bool isVerticalDocument() const override; | 340 virtual bool isVerticalDocument() const override; |
340 virtual bool isFlippedDocument() const override; | 341 virtual bool isFlippedDocument() const override; |
341 | 342 |
342 // Prevents creation of scrollbars. Used to prevent drawing two sets of | 343 // Prevents creation of scrollbars. Used to prevent drawing two sets of |
343 // overlay scrollbars in the case of the pinch viewport. | 344 // overlay scrollbars in the case of the pinch viewport. |
344 virtual bool scrollbarsDisabled() const override; | 345 virtual bool scrollbarsDisabled() const override; |
345 | 346 |
346 private: | 347 private: |
347 explicit FrameView(LocalFrame*); | 348 explicit FrameView(LocalFrame*); |
348 | 349 |
| 350 void dispose(); |
349 void reset(); | 351 void reset(); |
350 void init(); | 352 void init(); |
351 | 353 |
352 virtual void frameRectsChanged() override; | 354 virtual void frameRectsChanged() override; |
353 virtual bool isFrameView() const override { return true; } | 355 virtual bool isFrameView() const override { return true; } |
354 | 356 |
355 friend class RenderWidget; | 357 friend class RenderWidget; |
356 | 358 |
357 bool contentsInCompositedLayer() const; | 359 bool contentsInCompositedLayer() const; |
358 | 360 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
410 | 412 |
411 virtual void updateScrollCorner() override; | 413 virtual void updateScrollCorner() override; |
412 | 414 |
413 FrameView* parentFrameView() const; | 415 FrameView* parentFrameView() const; |
414 | 416 |
415 AXObjectCache* axObjectCache() const; | 417 AXObjectCache* axObjectCache() const; |
416 void removeFromAXObjectCache(); | 418 void removeFromAXObjectCache(); |
417 | 419 |
418 void setLayoutSizeInternal(const IntSize&); | 420 void setLayoutSizeInternal(const IntSize&); |
419 | 421 |
| 422 void disposeAutoSizeInfo(); |
| 423 |
420 bool paintInvalidationIsAllowed() const | 424 bool paintInvalidationIsAllowed() const |
421 { | 425 { |
422 return !isInPerformLayout() || canInvalidatePaintDuringPerformLayout(); | 426 return !isInPerformLayout() || canInvalidatePaintDuringPerformLayout(); |
423 } | 427 } |
424 | 428 |
425 static double s_currentFrameTimeStamp; // used for detecting decoded resourc
e thrash in the cache | 429 static double s_currentFrameTimeStamp; // used for detecting decoded resourc
e thrash in the cache |
426 static bool s_inPaintContents; | 430 static bool s_inPaintContents; |
427 | 431 |
428 LayoutSize m_size; | 432 LayoutSize m_size; |
429 | 433 |
430 typedef WillBeHeapHashSet<RefPtrWillBeMember<RenderEmbeddedObject> > Embedde
dObjectSet; | 434 typedef WillBeHeapHashSet<RefPtrWillBeMember<RenderEmbeddedObject> > Embedde
dObjectSet; |
431 WillBePersistentHeapHashSet<RefPtrWillBeMember<RenderEmbeddedObject> > m_wid
getUpdateSet; | 435 WillBeHeapHashSet<RefPtrWillBeMember<RenderEmbeddedObject> > m_widgetUpdateS
et; |
432 | 436 |
433 // FIXME: These are just "children" of the FrameView and should be RefPtr<Wi
dget> instead. | 437 // FIXME: These are just "children" of the FrameView and should be RefPtr<Wi
dget> instead. |
434 WillBePersistentHeapHashSet<RefPtrWillBeMember<RenderWidget> > m_widgets; | 438 WillBeHeapHashSet<RefPtrWillBeMember<RenderWidget> > m_widgets; |
435 | 439 |
436 // Oilpan: the use of a persistent back reference 'emulates' the | 440 // The RefPtr cycle between LocalFrame and FrameView is broken |
437 // RefPtr-cycle that is kept between the two objects non-Oilpan. | 441 // when a LocalFrame is detached by FrameLoader::detachFromParent(). |
| 442 // It clears the LocalFrame's m_view reference via setView(nullptr). |
438 // | 443 // |
439 // That cycle is broken when a LocalFrame is detached by | 444 // For Oilpan, Member reference cycles pose no problem, but |
440 // FrameLoader::detachFromParent(), it then clears its | 445 // LocalFrame's FrameView is also cleared by setView(). This additionally |
441 // FrameView's m_frame reference by calling setView(nullptr). | 446 // triggers FrameView::dispose(), which performs the operations |
442 RefPtrWillBePersistent<LocalFrame> m_frame; | 447 // that cannot be delayed until finalization time. |
| 448 RefPtrWillBeMember<LocalFrame> m_frame; |
443 | 449 |
444 bool m_doFullPaintInvalidation; | 450 bool m_doFullPaintInvalidation; |
445 | 451 |
446 bool m_canHaveScrollbars; | 452 bool m_canHaveScrollbars; |
447 unsigned m_slowRepaintObjectCount; | 453 unsigned m_slowRepaintObjectCount; |
448 | 454 |
449 bool m_hasPendingLayout; | 455 bool m_hasPendingLayout; |
450 RenderObject* m_layoutSubtreeRoot; | 456 RenderObject* m_layoutSubtreeRoot; |
451 | 457 |
452 bool m_layoutSchedulingEnabled; | 458 bool m_layoutSchedulingEnabled; |
(...skipping 22 matching lines...) Expand all Loading... |
475 | 481 |
476 bool m_wasScrolledByUser; | 482 bool m_wasScrolledByUser; |
477 bool m_inProgrammaticScroll; | 483 bool m_inProgrammaticScroll; |
478 bool m_safeToPropagateScrollToParent; | 484 bool m_safeToPropagateScrollToParent; |
479 | 485 |
480 double m_lastPaintTime; | 486 double m_lastPaintTime; |
481 | 487 |
482 bool m_isTrackingPaintInvalidations; // Used for testing. | 488 bool m_isTrackingPaintInvalidations; // Used for testing. |
483 Vector<IntRect> m_trackedPaintInvalidationRects; | 489 Vector<IntRect> m_trackedPaintInvalidationRects; |
484 | 490 |
485 RefPtrWillBePersistent<Node> m_nodeToDraw; | 491 RefPtrWillBeMember<Node> m_nodeToDraw; |
486 PaintBehavior m_paintBehavior; | 492 PaintBehavior m_paintBehavior; |
487 bool m_isPainting; | 493 bool m_isPainting; |
488 | 494 |
489 unsigned m_visuallyNonEmptyCharacterCount; | 495 unsigned m_visuallyNonEmptyCharacterCount; |
490 unsigned m_visuallyNonEmptyPixelCount; | 496 unsigned m_visuallyNonEmptyPixelCount; |
491 bool m_isVisuallyNonEmpty; | 497 bool m_isVisuallyNonEmpty; |
492 bool m_firstVisuallyNonEmptyLayoutCallbackPending; | 498 bool m_firstVisuallyNonEmptyLayoutCallbackPending; |
493 | 499 |
494 RefPtrWillBePersistent<Node> m_maintainScrollPositionAnchor; | 500 RefPtrWillBeMember<Node> m_maintainScrollPositionAnchor; |
495 | 501 |
496 // Renderer to hold our custom scroll corner. | 502 // Renderer to hold our custom scroll corner. |
497 RawPtrWillBePersistent<RenderScrollbarPart> m_scrollCorner; | 503 RawPtrWillBeMember<RenderScrollbarPart> m_scrollCorner; |
498 | 504 |
499 OwnPtr<ScrollableAreaSet> m_scrollableAreas; | 505 OwnPtr<ScrollableAreaSet> m_scrollableAreas; |
500 OwnPtr<ResizerAreaSet> m_resizerAreas; | 506 OwnPtr<ResizerAreaSet> m_resizerAreas; |
501 OwnPtr<ViewportConstrainedObjectSet> m_viewportConstrainedObjects; | 507 OwnPtr<ViewportConstrainedObjectSet> m_viewportConstrainedObjects; |
502 OwnPtr<FrameViewAutoSizeInfo> m_autoSizeInfo; | 508 OwnPtrWillBeMember<FrameViewAutoSizeInfo> m_autoSizeInfo; |
503 | 509 |
504 float m_visibleContentScaleFactor; | 510 float m_visibleContentScaleFactor; |
505 IntSize m_inputEventsOffsetForEmulation; | 511 IntSize m_inputEventsOffsetForEmulation; |
506 float m_inputEventsScaleFactorForEmulation; | 512 float m_inputEventsScaleFactorForEmulation; |
507 | 513 |
508 IntSize m_layoutSize; | 514 IntSize m_layoutSize; |
509 bool m_layoutSizeFixedToFrameSize; | 515 bool m_layoutSizeFixedToFrameSize; |
510 | 516 |
511 Timer<FrameView> m_didScrollTimer; | 517 Timer<FrameView> m_didScrollTimer; |
512 | 518 |
513 Vector<IntRect> m_tickmarks; | 519 Vector<IntRect> m_tickmarks; |
514 | 520 |
| 521 float m_topControlsViewportAdjustment; |
515 bool m_needsUpdateWidgetPositions; | 522 bool m_needsUpdateWidgetPositions; |
516 float m_topControlsViewportAdjustment; | 523 |
| 524 #if ENABLE(OILPAN) && ENABLE(ASSERT) |
| 525 // Verified when finalizing. |
| 526 bool m_hasBeenDisposed; |
| 527 #endif |
517 }; | 528 }; |
518 | 529 |
519 inline void FrameView::incrementVisuallyNonEmptyCharacterCount(unsigned count) | 530 inline void FrameView::incrementVisuallyNonEmptyCharacterCount(unsigned count) |
520 { | 531 { |
521 if (m_isVisuallyNonEmpty) | 532 if (m_isVisuallyNonEmpty) |
522 return; | 533 return; |
523 m_visuallyNonEmptyCharacterCount += count; | 534 m_visuallyNonEmptyCharacterCount += count; |
524 // Use a threshold value to prevent very small amounts of visible content fr
om triggering didFirstVisuallyNonEmptyLayout. | 535 // Use a threshold value to prevent very small amounts of visible content fr
om triggering didFirstVisuallyNonEmptyLayout. |
525 // The first few hundred characters rarely contain the interesting content o
f the page. | 536 // The first few hundred characters rarely contain the interesting content o
f the page. |
526 static const unsigned visualCharacterThreshold = 200; | 537 static const unsigned visualCharacterThreshold = 200; |
527 if (m_visuallyNonEmptyCharacterCount > visualCharacterThreshold) | 538 if (m_visuallyNonEmptyCharacterCount > visualCharacterThreshold) |
528 setIsVisuallyNonEmpty(); | 539 setIsVisuallyNonEmpty(); |
529 } | 540 } |
530 | 541 |
531 inline void FrameView::incrementVisuallyNonEmptyPixelCount(const IntSize& size) | 542 inline void FrameView::incrementVisuallyNonEmptyPixelCount(const IntSize& size) |
532 { | 543 { |
533 if (m_isVisuallyNonEmpty) | 544 if (m_isVisuallyNonEmpty) |
534 return; | 545 return; |
535 m_visuallyNonEmptyPixelCount += size.width() * size.height(); | 546 m_visuallyNonEmptyPixelCount += size.width() * size.height(); |
536 // Use a threshold value to prevent very small amounts of visible content fr
om triggering didFirstVisuallyNonEmptyLayout | 547 // Use a threshold value to prevent very small amounts of visible content fr
om triggering didFirstVisuallyNonEmptyLayout |
537 static const unsigned visualPixelThreshold = 32 * 32; | 548 static const unsigned visualPixelThreshold = 32 * 32; |
538 if (m_visuallyNonEmptyPixelCount > visualPixelThreshold) | 549 if (m_visuallyNonEmptyPixelCount > visualPixelThreshold) |
539 setIsVisuallyNonEmpty(); | 550 setIsVisuallyNonEmpty(); |
540 } | 551 } |
541 | 552 |
542 DEFINE_TYPE_CASTS(FrameView, Widget, widget, widget->isFrameView(), widget.isFra
meView()); | 553 DEFINE_TYPE_CASTS(FrameView, Widget, widget, widget->isFrameView(), widget.isFra
meView()); |
543 | 554 |
544 class AllowPaintInvalidationScope { | 555 class AllowPaintInvalidationScope { |
| 556 STACK_ALLOCATED(); |
545 public: | 557 public: |
546 explicit AllowPaintInvalidationScope(FrameView* view) | 558 explicit AllowPaintInvalidationScope(FrameView* view) |
547 : m_view(view) | 559 : m_view(view) |
548 , m_originalValue(view ? view->canInvalidatePaintDuringPerformLayout() :
false) | 560 , m_originalValue(view ? view->canInvalidatePaintDuringPerformLayout() :
false) |
549 { | 561 { |
550 if (!m_view) | 562 if (!m_view) |
551 return; | 563 return; |
552 | 564 |
553 m_view->setCanInvalidatePaintDuringPerformLayout(true); | 565 m_view->setCanInvalidatePaintDuringPerformLayout(true); |
554 } | 566 } |
555 | 567 |
556 ~AllowPaintInvalidationScope() | 568 ~AllowPaintInvalidationScope() |
557 { | 569 { |
558 if (!m_view) | 570 if (!m_view) |
559 return; | 571 return; |
560 | 572 |
561 m_view->setCanInvalidatePaintDuringPerformLayout(m_originalValue); | 573 m_view->setCanInvalidatePaintDuringPerformLayout(m_originalValue); |
562 } | 574 } |
| 575 |
563 private: | 576 private: |
564 FrameView* m_view; | 577 RawPtrWillBeMember<FrameView> m_view; |
565 bool m_originalValue; | 578 bool m_originalValue; |
566 }; | 579 }; |
567 | 580 |
568 } // namespace blink | 581 } // namespace blink |
569 | 582 |
570 #endif // FrameView_h | 583 #endif // FrameView_h |
OLD | NEW |