| 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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. | 60 // FIXME: Oilpan: move Widget (and thereby FrameView) to the heap. |
| 61 class FrameView FINAL : public ScrollView { | 61 class FrameView FINAL : public ScrollView { |
| 62 public: | 62 public: |
| 63 friend class RenderView; | 63 friend class RenderView; |
| 64 friend class Internals; | 64 friend class Internals; |
| 65 | 65 |
| 66 static PassRefPtr<FrameView> create(LocalFrame*); | 66 static PassRefPtrWillBeRawPtr<FrameView> create(LocalFrame*); |
| 67 static PassRefPtr<FrameView> create(LocalFrame*, const IntSize& initialSize)
; | 67 static PassRefPtrWillBeRawPtr<FrameView> create(LocalFrame*, const IntSize&
initialSize); |
| 68 | 68 |
| 69 virtual ~FrameView(); | 69 virtual ~FrameView(); |
| 70 | 70 |
| 71 virtual HostWindow* hostWindow() const OVERRIDE; | 71 virtual HostWindow* hostWindow() const OVERRIDE; |
| 72 | 72 |
| 73 virtual void invalidateRect(const IntRect&) OVERRIDE; | 73 virtual void invalidateRect(const IntRect&) OVERRIDE; |
| 74 virtual void setFrameRect(const IntRect&) OVERRIDE; | 74 virtual void setFrameRect(const IntRect&) OVERRIDE; |
| 75 | 75 |
| 76 LocalFrame& frame() const | 76 LocalFrame& frame() const |
| 77 { | 77 { |
| 78 ASSERT(m_frame); | 78 ASSERT(m_frame); |
| 79 return *m_frame; | 79 return *m_frame; |
| 80 } | 80 } |
| 81 | 81 |
| 82 Page* page() const; | 82 Page* page() const; |
| 83 | 83 |
| 84 RenderView* renderView() const; | 84 RenderView* renderView() const; |
| 85 | 85 |
| 86 virtual void setCanHaveScrollbars(bool) OVERRIDE; | 86 virtual void setCanHaveScrollbars(bool) OVERRIDE; |
| 87 | 87 |
| 88 virtual PassRefPtr<Scrollbar> createScrollbar(ScrollbarOrientation) OVERRIDE
; | 88 virtual PassRefPtrWillBeRawPtr<Scrollbar> createScrollbar(ScrollbarOrientati
on) OVERRIDE; |
| 89 | 89 |
| 90 virtual void setContentsSize(const IntSize&) OVERRIDE; | 90 virtual void setContentsSize(const IntSize&) OVERRIDE; |
| 91 IntPoint clampOffsetAtScale(const IntPoint& offset, float scale) const; | 91 IntPoint clampOffsetAtScale(const IntPoint& offset, float scale) const; |
| 92 | 92 |
| 93 void layout(bool allowSubtree = true); | 93 void layout(bool allowSubtree = true); |
| 94 bool didFirstLayout() const; | 94 bool didFirstLayout() const; |
| 95 void scheduleRelayout(); | 95 void scheduleRelayout(); |
| 96 void scheduleRelayoutOfSubtree(RenderObject*); | 96 void scheduleRelayoutOfSubtree(RenderObject*); |
| 97 bool layoutPending() const; | 97 bool layoutPending() const; |
| 98 bool isInPerformLayout() const; | 98 bool isInPerformLayout() const; |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 | 218 |
| 219 void updateLayoutAndStyleForPainting(); | 219 void updateLayoutAndStyleForPainting(); |
| 220 void updateLayoutAndStyleIfNeededRecursive(); | 220 void updateLayoutAndStyleIfNeededRecursive(); |
| 221 | 221 |
| 222 void invalidateTreeIfNeededRecursive(); | 222 void invalidateTreeIfNeededRecursive(); |
| 223 | 223 |
| 224 void incrementVisuallyNonEmptyCharacterCount(unsigned); | 224 void incrementVisuallyNonEmptyCharacterCount(unsigned); |
| 225 void incrementVisuallyNonEmptyPixelCount(const IntSize&); | 225 void incrementVisuallyNonEmptyPixelCount(const IntSize&); |
| 226 void setIsVisuallyNonEmpty() { m_isVisuallyNonEmpty = true; } | 226 void setIsVisuallyNonEmpty() { m_isVisuallyNonEmpty = true; } |
| 227 void enableAutoSizeMode(const IntSize& minSize, const IntSize& maxSize); | 227 void enableAutoSizeMode(const IntSize& minSize, const IntSize& maxSize); |
| 228 void disableAutoSizeMode() { m_autoSizeInfo.clear(); } | 228 void disableAutoSizeMode() { disposeAutoSizeInfo(); } |
| 229 | 229 |
| 230 void forceLayout(bool allowSubtree = false); | 230 void forceLayout(bool allowSubtree = false); |
| 231 void forceLayoutForPagination(const FloatSize& pageSize, const FloatSize& or
iginalPageSize, float maximumShrinkFactor); | 231 void forceLayoutForPagination(const FloatSize& pageSize, const FloatSize& or
iginalPageSize, float maximumShrinkFactor); |
| 232 | 232 |
| 233 bool scrollToFragment(const KURL&); | 233 bool scrollToFragment(const KURL&); |
| 234 bool scrollToAnchor(const String&); | 234 bool scrollToAnchor(const String&); |
| 235 void maintainScrollPositionAtAnchor(Node*); | 235 void maintainScrollPositionAtAnchor(Node*); |
| 236 void scrollElementToRect(Element*, const IntRect&); | 236 void scrollElementToRect(Element*, const IntRect&); |
| 237 void scrollContentsIfNeededRecursive(); | 237 void scrollContentsIfNeededRecursive(); |
| 238 | 238 |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 virtual void getTickmarks(Vector<IntRect>&) const OVERRIDE; | 325 virtual void getTickmarks(Vector<IntRect>&) const OVERRIDE; |
| 326 virtual void scrollTo(const DoublePoint&) OVERRIDE; | 326 virtual void scrollTo(const DoublePoint&) OVERRIDE; |
| 327 virtual IntRect scrollableAreaBoundingBox() const OVERRIDE; | 327 virtual IntRect scrollableAreaBoundingBox() const OVERRIDE; |
| 328 virtual bool scrollAnimatorEnabled() const OVERRIDE; | 328 virtual bool scrollAnimatorEnabled() const OVERRIDE; |
| 329 virtual bool usesCompositedScrolling() const OVERRIDE; | 329 virtual bool usesCompositedScrolling() const OVERRIDE; |
| 330 virtual GraphicsLayer* layerForScrolling() const OVERRIDE; | 330 virtual GraphicsLayer* layerForScrolling() const OVERRIDE; |
| 331 virtual GraphicsLayer* layerForHorizontalScrollbar() const OVERRIDE; | 331 virtual GraphicsLayer* layerForHorizontalScrollbar() const OVERRIDE; |
| 332 virtual GraphicsLayer* layerForVerticalScrollbar() const OVERRIDE; | 332 virtual GraphicsLayer* layerForVerticalScrollbar() const OVERRIDE; |
| 333 virtual GraphicsLayer* layerForScrollCorner() const OVERRIDE; | 333 virtual GraphicsLayer* layerForScrollCorner() const OVERRIDE; |
| 334 | 334 |
| 335 virtual void trace(Visitor*) OVERRIDE; |
| 336 void dispose(); |
| 337 |
| 335 protected: | 338 protected: |
| 336 virtual bool scrollContentsFastPath(const IntSize& scrollDelta) OVERRIDE; | 339 virtual bool scrollContentsFastPath(const IntSize& scrollDelta) OVERRIDE; |
| 337 virtual void scrollContentsSlowPath(const IntRect& updateRect) OVERRIDE; | 340 virtual void scrollContentsSlowPath(const IntRect& updateRect) OVERRIDE; |
| 338 | 341 |
| 339 virtual bool isVerticalDocument() const OVERRIDE; | 342 virtual bool isVerticalDocument() const OVERRIDE; |
| 340 virtual bool isFlippedDocument() const OVERRIDE; | 343 virtual bool isFlippedDocument() const OVERRIDE; |
| 341 | 344 |
| 342 // Prevents creation of scrollbars. Used to prevent drawing two sets of | 345 // Prevents creation of scrollbars. Used to prevent drawing two sets of |
| 343 // overlay scrollbars in the case of the pinch viewport. | 346 // overlay scrollbars in the case of the pinch viewport. |
| 344 virtual bool scrollbarsDisabled() const OVERRIDE; | 347 virtual bool scrollbarsDisabled() const OVERRIDE; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 361 | 364 |
| 362 void updateCounters(); | 365 void updateCounters(); |
| 363 void forceLayoutParentViewIfNeeded(); | 366 void forceLayoutParentViewIfNeeded(); |
| 364 void performPreLayoutTasks(); | 367 void performPreLayoutTasks(); |
| 365 void performLayout(RenderObject* rootForThisLayout, bool inSubtreeLayout); | 368 void performLayout(RenderObject* rootForThisLayout, bool inSubtreeLayout); |
| 366 void scheduleOrPerformPostLayoutTasks(); | 369 void scheduleOrPerformPostLayoutTasks(); |
| 367 void performPostLayoutTasks(); | 370 void performPostLayoutTasks(); |
| 368 | 371 |
| 369 void invalidateTreeIfNeeded(); | 372 void invalidateTreeIfNeeded(); |
| 370 | 373 |
| 374 void setLayoutSizeFixedToFrameSizeAndInvalidate(bool); |
| 375 |
| 371 void gatherDebugLayoutRects(RenderObject* layoutRoot); | 376 void gatherDebugLayoutRects(RenderObject* layoutRoot); |
| 372 | 377 |
| 373 DocumentLifecycle& lifecycle() const; | 378 DocumentLifecycle& lifecycle() const; |
| 374 | 379 |
| 375 virtual void contentRectangleForPaintInvalidation(const IntRect&) OVERRIDE; | 380 virtual void contentRectangleForPaintInvalidation(const IntRect&) OVERRIDE; |
| 376 virtual void contentsResized() OVERRIDE; | 381 virtual void contentsResized() OVERRIDE; |
| 377 virtual void scrollbarExistenceDidChange() OVERRIDE; | 382 virtual void scrollbarExistenceDidChange() OVERRIDE; |
| 378 | 383 |
| 379 // Override ScrollView methods to do point conversion via renderers, in orde
r to | 384 // Override ScrollView methods to do point conversion via renderers, in orde
r to |
| 380 // take transforms into account. | 385 // take transforms into account. |
| (...skipping 29 matching lines...) Expand all Loading... |
| 410 | 415 |
| 411 virtual void updateScrollCorner() OVERRIDE; | 416 virtual void updateScrollCorner() OVERRIDE; |
| 412 | 417 |
| 413 FrameView* parentFrameView() const; | 418 FrameView* parentFrameView() const; |
| 414 | 419 |
| 415 AXObjectCache* axObjectCache() const; | 420 AXObjectCache* axObjectCache() const; |
| 416 void removeFromAXObjectCache(); | 421 void removeFromAXObjectCache(); |
| 417 | 422 |
| 418 void setLayoutSizeInternal(const IntSize&); | 423 void setLayoutSizeInternal(const IntSize&); |
| 419 | 424 |
| 425 void disposeAutoSizeInfo(); |
| 426 |
| 420 bool paintInvalidationIsAllowed() const | 427 bool paintInvalidationIsAllowed() const |
| 421 { | 428 { |
| 422 return !isInPerformLayout() || canInvalidatePaintDuringPerformLayout(); | 429 return !isInPerformLayout() || canInvalidatePaintDuringPerformLayout(); |
| 423 } | 430 } |
| 424 | 431 |
| 425 static double s_currentFrameTimeStamp; // used for detecting decoded resourc
e thrash in the cache | 432 static double s_currentFrameTimeStamp; // used for detecting decoded resourc
e thrash in the cache |
| 426 static bool s_inPaintContents; | 433 static bool s_inPaintContents; |
| 427 | 434 |
| 428 LayoutSize m_size; | 435 LayoutSize m_size; |
| 429 | 436 |
| 430 typedef WillBeHeapHashSet<RefPtrWillBeMember<RenderEmbeddedObject> > Embedde
dObjectSet; | 437 typedef WillBeHeapHashSet<RefPtrWillBeMember<RenderEmbeddedObject> > Embedde
dObjectSet; |
| 431 WillBePersistentHeapHashSet<RefPtrWillBeMember<RenderEmbeddedObject> > m_wid
getUpdateSet; | 438 WillBeHeapHashSet<RefPtrWillBeMember<RenderEmbeddedObject> > m_widgetUpdateS
et; |
| 432 | 439 |
| 433 // FIXME: These are just "children" of the FrameView and should be RefPtr<Wi
dget> instead. | 440 // FIXME: These are just "children" of the FrameView and should be RefPtr<Wi
dget> instead. |
| 434 WillBePersistentHeapHashSet<RefPtrWillBeMember<RenderWidget> > m_widgets; | 441 WillBeHeapHashSet<RefPtrWillBeMember<RenderWidget> > m_widgets; |
| 435 | 442 |
| 436 // Oilpan: the use of a persistent back reference 'emulates' the | 443 // The RefPtr cycle between LocalFrame and FrameView is broken |
| 437 // RefPtr-cycle that is kept between the two objects non-Oilpan. | 444 // when a LocalFrame is detached by FrameLoader::detachFromParent(), |
| 438 // | 445 // it then clears its FrameView's m_frame reference by calling |
| 439 // That cycle is broken when a LocalFrame is detached by | 446 // setView(nullptr). |
| 440 // FrameLoader::detachFromParent(), it then clears its | 447 RefPtrWillBeMember<LocalFrame> m_frame; |
| 441 // FrameView's m_frame reference by calling setView(nullptr). | |
| 442 RefPtrWillBePersistent<LocalFrame> m_frame; | |
| 443 | 448 |
| 444 bool m_doFullPaintInvalidation; | 449 bool m_doFullPaintInvalidation; |
| 445 | 450 |
| 446 bool m_canHaveScrollbars; | 451 bool m_canHaveScrollbars; |
| 447 unsigned m_slowRepaintObjectCount; | 452 unsigned m_slowRepaintObjectCount; |
| 448 | 453 |
| 449 bool m_hasPendingLayout; | 454 bool m_hasPendingLayout; |
| 450 RenderObject* m_layoutSubtreeRoot; | 455 RenderObject* m_layoutSubtreeRoot; |
| 451 | 456 |
| 452 bool m_layoutSchedulingEnabled; | 457 bool m_layoutSchedulingEnabled; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 475 | 480 |
| 476 bool m_wasScrolledByUser; | 481 bool m_wasScrolledByUser; |
| 477 bool m_inProgrammaticScroll; | 482 bool m_inProgrammaticScroll; |
| 478 bool m_safeToPropagateScrollToParent; | 483 bool m_safeToPropagateScrollToParent; |
| 479 | 484 |
| 480 double m_lastPaintTime; | 485 double m_lastPaintTime; |
| 481 | 486 |
| 482 bool m_isTrackingPaintInvalidations; // Used for testing. | 487 bool m_isTrackingPaintInvalidations; // Used for testing. |
| 483 Vector<IntRect> m_trackedPaintInvalidationRects; | 488 Vector<IntRect> m_trackedPaintInvalidationRects; |
| 484 | 489 |
| 485 RefPtrWillBePersistent<Node> m_nodeToDraw; | 490 RefPtrWillBeMember<Node> m_nodeToDraw; |
| 486 PaintBehavior m_paintBehavior; | 491 PaintBehavior m_paintBehavior; |
| 487 bool m_isPainting; | 492 bool m_isPainting; |
| 488 | 493 |
| 489 unsigned m_visuallyNonEmptyCharacterCount; | 494 unsigned m_visuallyNonEmptyCharacterCount; |
| 490 unsigned m_visuallyNonEmptyPixelCount; | 495 unsigned m_visuallyNonEmptyPixelCount; |
| 491 bool m_isVisuallyNonEmpty; | 496 bool m_isVisuallyNonEmpty; |
| 492 bool m_firstVisuallyNonEmptyLayoutCallbackPending; | 497 bool m_firstVisuallyNonEmptyLayoutCallbackPending; |
| 493 | 498 |
| 494 RefPtrWillBePersistent<Node> m_maintainScrollPositionAnchor; | 499 RefPtrWillBeMember<Node> m_maintainScrollPositionAnchor; |
| 495 | 500 |
| 496 // Renderer to hold our custom scroll corner. | 501 // Renderer to hold our custom scroll corner. |
| 497 RawPtrWillBePersistent<RenderScrollbarPart> m_scrollCorner; | 502 RawPtrWillBeMember<RenderScrollbarPart> m_scrollCorner; |
| 498 | 503 |
| 499 OwnPtr<ScrollableAreaSet> m_scrollableAreas; | 504 OwnPtr<ScrollableAreaSet> m_scrollableAreas; |
| 500 OwnPtr<ResizerAreaSet> m_resizerAreas; | 505 OwnPtr<ResizerAreaSet> m_resizerAreas; |
| 501 OwnPtr<ViewportConstrainedObjectSet> m_viewportConstrainedObjects; | 506 OwnPtr<ViewportConstrainedObjectSet> m_viewportConstrainedObjects; |
| 502 OwnPtr<FrameViewAutoSizeInfo> m_autoSizeInfo; | 507 OwnPtrWillBeMember<FrameViewAutoSizeInfo> m_autoSizeInfo; |
| 503 | 508 |
| 504 float m_visibleContentScaleFactor; | 509 float m_visibleContentScaleFactor; |
| 505 IntSize m_inputEventsOffsetForEmulation; | 510 IntSize m_inputEventsOffsetForEmulation; |
| 506 float m_inputEventsScaleFactorForEmulation; | 511 float m_inputEventsScaleFactorForEmulation; |
| 507 | 512 |
| 508 IntSize m_layoutSize; | 513 IntSize m_layoutSize; |
| 509 bool m_layoutSizeFixedToFrameSize; | 514 bool m_layoutSizeFixedToFrameSize; |
| 510 | 515 |
| 511 Timer<FrameView> m_didScrollTimer; | 516 Timer<FrameView> m_didScrollTimer; |
| 512 | 517 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 535 m_visuallyNonEmptyPixelCount += size.width() * size.height(); | 540 m_visuallyNonEmptyPixelCount += size.width() * size.height(); |
| 536 // Use a threshold value to prevent very small amounts of visible content fr
om triggering didFirstVisuallyNonEmptyLayout | 541 // Use a threshold value to prevent very small amounts of visible content fr
om triggering didFirstVisuallyNonEmptyLayout |
| 537 static const unsigned visualPixelThreshold = 32 * 32; | 542 static const unsigned visualPixelThreshold = 32 * 32; |
| 538 if (m_visuallyNonEmptyPixelCount > visualPixelThreshold) | 543 if (m_visuallyNonEmptyPixelCount > visualPixelThreshold) |
| 539 setIsVisuallyNonEmpty(); | 544 setIsVisuallyNonEmpty(); |
| 540 } | 545 } |
| 541 | 546 |
| 542 DEFINE_TYPE_CASTS(FrameView, Widget, widget, widget->isFrameView(), widget.isFra
meView()); | 547 DEFINE_TYPE_CASTS(FrameView, Widget, widget, widget->isFrameView(), widget.isFra
meView()); |
| 543 | 548 |
| 544 class AllowPaintInvalidationScope { | 549 class AllowPaintInvalidationScope { |
| 550 STACK_ALLOCATED(); |
| 545 public: | 551 public: |
| 546 explicit AllowPaintInvalidationScope(FrameView* view) | 552 explicit AllowPaintInvalidationScope(FrameView* view) |
| 547 : m_view(view) | 553 : m_view(view) |
| 548 , m_originalValue(view ? view->canInvalidatePaintDuringPerformLayout() :
false) | 554 , m_originalValue(view ? view->canInvalidatePaintDuringPerformLayout() :
false) |
| 549 { | 555 { |
| 550 if (!m_view) | 556 if (!m_view) |
| 551 return; | 557 return; |
| 552 | 558 |
| 553 m_view->setCanInvalidatePaintDuringPerformLayout(true); | 559 m_view->setCanInvalidatePaintDuringPerformLayout(true); |
| 554 } | 560 } |
| 555 | 561 |
| 556 ~AllowPaintInvalidationScope() | 562 ~AllowPaintInvalidationScope() |
| 557 { | 563 { |
| 558 if (!m_view) | 564 if (!m_view) |
| 559 return; | 565 return; |
| 560 | 566 |
| 561 m_view->setCanInvalidatePaintDuringPerformLayout(m_originalValue); | 567 m_view->setCanInvalidatePaintDuringPerformLayout(m_originalValue); |
| 562 } | 568 } |
| 569 |
| 563 private: | 570 private: |
| 564 FrameView* m_view; | 571 RawPtrWillBeMember<FrameView> m_view; |
| 565 bool m_originalValue; | 572 bool m_originalValue; |
| 566 }; | 573 }; |
| 567 | 574 |
| 568 } // namespace blink | 575 } // namespace blink |
| 569 | 576 |
| 570 #endif // FrameView_h | 577 #endif // FrameView_h |
| OLD | NEW |