Changeset 114170 in webkit
- Timestamp:
- Apr 13, 2012 2:32:53 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 48 added
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r114167 r114170 1 2012-04-11 Antonio Gomes <agomes@rim.com> 2 3 Be more restrictive when adding ScrollableArea's to FrameView's ScrollableArea's map 4 https://bugs.webkit.org/show_bug.cgi?id=79611 5 6 Reviewed by James Robinson. 7 8 Added scrollable area set count tests to many situations observed 9 in real world sites. 10 11 * fast/scrolling/resources/generic-scrollable-content.html: Added. 12 * fast/scrolling/resources/hidden-generic-scrollable-content.html: Added. 13 * fast/scrolling/resources/scrollable-area.js: Added. 14 (runTest): 15 (end): 16 * fast/scrolling/resources/scrollable-style.css: Added. 17 (.inner): 18 (.offscreen): 19 * fast/scrolling/scrollable-area-frame-expected.txt: Added. 20 * fast/scrolling/scrollable-area-frame-inherited-visibility-hidden-expected.txt: Added. 21 * fast/scrolling/scrollable-area-frame-inherited-visibility-hidden.html: Added. 22 * fast/scrolling/scrollable-area-frame-overflow-hidden-expected.txt: Added. 23 * fast/scrolling/scrollable-area-frame-overflow-hidden.html: Added. 24 * fast/scrolling/scrollable-area-frame-overried-inherited-visibility-hidden-expected.txt: Added. 25 * fast/scrolling/scrollable-area-frame-overried-inherited-visibility-hidden.html: Added. 26 * fast/scrolling/scrollable-area-frame-scrolling-no-expected.txt: Added. 27 * fast/scrolling/scrollable-area-frame-scrolling-no-overried-inherited-visibility-hidden-expected.txt: Added. 28 * fast/scrolling/scrollable-area-frame-scrolling-no-overried-inherited-visibility-hidden.html: Added. 29 * fast/scrolling/scrollable-area-frame-scrolling-no-visibility-hidden-child-expected.txt: Added. 30 * fast/scrolling/scrollable-area-frame-scrolling-no-visibility-hidden-child.html: Added. 31 * fast/scrolling/scrollable-area-frame-scrolling-no.html: Added. 32 * fast/scrolling/scrollable-area-frame-scrolling-yes-display-none-expected.txt: Added. 33 * fast/scrolling/scrollable-area-frame-scrolling-yes-display-none.html: Added. 34 * fast/scrolling/scrollable-area-frame-scrolling-yes-expected.txt: Added. 35 * fast/scrolling/scrollable-area-frame-scrolling-yes.html: Added. 36 * fast/scrolling/scrollable-area-frame-visibility-hidden-child-expected.txt: Added. 37 * fast/scrolling/scrollable-area-frame-visibility-hidden-child.html: Added. 38 * fast/scrolling/scrollable-area-frame-zero-size-and-border-expected.txt: Added. 39 * fast/scrolling/scrollable-area-frame-zero-size-and-border.html: Added. 40 * fast/scrolling/scrollable-area-frame.html: Added. 41 * fast/scrolling/scrollable-area-overflow-auto-display-none-expected.txt: Added. 42 * fast/scrolling/scrollable-area-overflow-auto-display-none-in-parent-expected.txt: Added. 43 * fast/scrolling/scrollable-area-overflow-auto-display-none-in-parent.html: Added. 44 * fast/scrolling/scrollable-area-overflow-auto-display-none.html: Added. 45 * fast/scrolling/scrollable-area-overflow-auto-expected.txt: Added. 46 * fast/scrolling/scrollable-area-overflow-auto-visibility-hidden-expected.txt: Added. 47 * fast/scrolling/scrollable-area-overflow-auto-visibility-hidden-in-parent-expected.txt: Added. 48 * fast/scrolling/scrollable-area-overflow-auto-visibility-hidden-in-parent.html: Added. 49 * fast/scrolling/scrollable-area-overflow-auto-visibility-hidden.html: Added. 50 * fast/scrolling/scrollable-area-overflow-auto-visibility-override-expected.txt: Added. 51 * fast/scrolling/scrollable-area-overflow-auto-visibility-override.html: Added. 52 * fast/scrolling/scrollable-area-overflow-auto-visibility-visible-expected.txt: Added. 53 * fast/scrolling/scrollable-area-overflow-auto-visibility-visible.html: Added. 54 * fast/scrolling/scrollable-area-overflow-auto.html: Added. 55 * fast/scrolling/scrollable-area-overflow-not-set-expected.txt: Added. 56 * fast/scrolling/scrollable-area-overflow-not-set.html: Added. 57 * fast/scrolling/scrollable-area-overflow-visible-expected.txt: Added. 58 * fast/scrolling/scrollable-area-overflow-visible.html: Added. 59 1 60 2012-04-13 Vincent Scheib <scheib@chromium.org> 2 61 -
trunk/Source/WebCore/ChangeLog
r114168 r114170 1 2012-04-11 Antonio Gomes <agomes@rim.com> 2 3 Be more restrictive when adding ScrollableArea's to FrameView's ScrollableArea's map 4 https://bugs.webkit.org/show_bug.cgi?id=79611 5 6 Reviewed by James Robinson. 7 8 Source/WebCore: 9 10 As of today, any FrameView attached to the Widget-tree or any 11 RenderLayer whose corresponding RenderBox's style has a 'overflow' 12 property set to 'auto' is cached in its containing scrollable areas set. 13 We could be more restrictive about what we in fact want to 14 cache as scrollable areas, by checking if the element as an overflow 15 (i.e. more content than its viewport). 16 17 * page/FrameView.cpp: 18 (WebCore::FrameView::setFrameRect): 19 20 Whenever the viewport changes, check if we have an scrollable/overflowed 21 content, and update the cache accordingly. 22 23 (WebCore::FrameView::setContentsSize): 24 25 Whenever the contents size changes, check if we have a scrollable/overflowed 26 content, and update the cache accordingly. 27 28 (WebCore::FrameView::calculateScrollbarModesForLayout): 29 30 Introduces a way to query for the scrollbars by only 31 taking into account the "rules" set by the web author. 32 For that, a new enum was added called SrollbarModesCalculationStrategy, 33 which allows callers to discard for example client-side scrollbar policies 34 in order to verify if a given frameview is scrollable or not. 35 36 (WebCore::FrameView::updateScrollableAreaSet): 37 38 Take into account various factors before considering a FrameView as 39 scrollable. If in the end it is, it gets added to its parent FrameView 40 scrollable areas map, otherwise removed. 41 42 (WebCore): 43 (WebCore::FrameView::addScrollableArea): 44 45 Became unneeded, thus removed. 46 47 (WebCore::FrameView::removeScrollableArea): 48 49 Whenever a FrameView is removed from the Widget-tree, 50 remove it from the cache. 51 52 * page/FrameView.h: 53 (FrameView): 54 * rendering/RenderLayer.cpp: 55 (WebCore::RenderLayer::updateScrollbarsAfterLayout): 56 57 Update scrollable area set after layout. 58 59 (WebCore::RenderLayer::updateScrollbarsAfterStyleChange): 60 61 Update scrollable area set after style changes. 62 63 (WebCore::RenderLayer::styleChanged): 64 65 Removed the scrollable areas logic detection from it. 66 67 (WebCore::RenderLayer::updateScrollableAreaSet): 68 69 Updates the containing FrameView scrollable areas cache 70 only when needed (i.e. an overflow exists). 71 72 (WebCore): 73 * rendering/RenderLayer.h: 74 (RenderLayer): 75 * testing/Internals.cpp: 76 (WebCore::Internals::numberOfScrollableAreas): 77 (WebCore): 78 * testing/Internals.h: 79 (Internals): 80 * testing/Internals.idl: 81 82 Tests: fast/scrolling/scrollable-area-frame-inherited-visibility-hidden.html 83 fast/scrolling/scrollable-area-frame-overflow-hidden.html 84 fast/scrolling/scrollable-area-frame-overried-inherited-visibility-hidden.html 85 fast/scrolling/scrollable-area-frame-scrolling-no-overried-inherited-visibility-hidden.html 86 fast/scrolling/scrollable-area-frame-scrolling-no-visibility-hidden-child.html 87 fast/scrolling/scrollable-area-frame-scrolling-no.html 88 fast/scrolling/scrollable-area-frame-scrolling-yes-display-none.html 89 fast/scrolling/scrollable-area-frame-scrolling-yes.html 90 fast/scrolling/scrollable-area-frame-visibility-hidden-child.html 91 fast/scrolling/scrollable-area-frame-zero-size-and-border.html 92 fast/scrolling/scrollable-area-frame.html 93 fast/scrolling/scrollable-area-overflow-auto-display-none-in-parent.html 94 fast/scrolling/scrollable-area-overflow-auto-display-none.html 95 fast/scrolling/scrollable-area-overflow-auto-visibility-hidden-in-parent.html 96 fast/scrolling/scrollable-area-overflow-auto-visibility-hidden.html 97 fast/scrolling/scrollable-area-overflow-auto-visibility-override.html 98 fast/scrolling/scrollable-area-overflow-auto-visibility-visible.html 99 fast/scrolling/scrollable-area-overflow-auto.html 100 fast/scrolling/scrollable-area-overflow-not-set.html 101 fast/scrolling/scrollable-area-overflow-visible.html 102 1 103 2012-04-13 Antti Koivisto <antti@apple.com> 2 104 -
trunk/Source/WebCore/page/FrameView.cpp
r114109 r114170 406 406 ScrollView::setFrameRect(newRect); 407 407 408 updateScrollableAreaSet(); 409 408 410 #if USE(ACCELERATED_COMPOSITING) 409 411 if (RenderView* root = rootRenderer(this)) { … … 508 510 if (!page) 509 511 return; 512 513 updateScrollableAreaSet(); 510 514 511 515 page->chrome()->contentsSizeChanged(frame(), size); //notify only … … 596 600 } 597 601 598 void FrameView::calculateScrollbarModesForLayout(ScrollbarMode& hMode, ScrollbarMode& vMode )602 void FrameView::calculateScrollbarModesForLayout(ScrollbarMode& hMode, ScrollbarMode& vMode, ScrollbarModesCalculationStrategy strategy) 599 603 { 600 604 m_viewportRenderer = 0; … … 607 611 } 608 612 609 if (m_canHaveScrollbars ) {613 if (m_canHaveScrollbars || strategy == RulesFromWebContentOnly) { 610 614 hMode = ScrollbarAuto; 611 615 vMode = ScrollbarAuto; … … 2625 2629 } 2626 2630 2631 void FrameView::updateScrollableAreaSet() 2632 { 2633 // That ensures that only inner frames are cached. 2634 if (!parentFrameView()) 2635 return; 2636 2637 // Check for: 2638 // 1) display:none or visibility:hidden set to self or inherited. 2639 // 2) overflow{-x,-y}: hidden; 2640 // 3) scrolling: no; 2641 2642 // Covers #1. 2643 HTMLFrameOwnerElement* owner = m_frame->ownerElement(); 2644 if (!owner || !owner->renderer() || !owner->renderer()->visibleToHitTesting()) { 2645 parentFrameView()->removeScrollableArea(this); 2646 return; 2647 } 2648 2649 IntSize contentSize = contentsSize(); 2650 IntSize visibleContentSize = visibleContentRect().size(); 2651 if ((contentSize.height() <= visibleContentSize.height() && contentSize.width() <= visibleContentSize.width())) { 2652 parentFrameView()->removeScrollableArea(this); 2653 return; 2654 } 2655 2656 // Cover #2 and #3. 2657 ScrollbarMode horizontalMode; 2658 ScrollbarMode verticalMode; 2659 calculateScrollbarModesForLayout(horizontalMode, verticalMode, RulesFromWebContentOnly); 2660 if (horizontalMode == ScrollbarAlwaysOff && verticalMode == ScrollbarAlwaysOff) { 2661 parentFrameView()->removeScrollableArea(this); 2662 return; 2663 } 2664 2665 parentFrameView()->addScrollableArea(this); 2666 } 2667 2627 2668 bool FrameView::shouldSuspendScrollAnimations() const 2628 2669 { … … 3452 3493 } 3453 3494 3454 void FrameView::addChild(PassRefPtr<Widget> widget)3455 {3456 if (widget->isFrameView())3457 addScrollableArea(static_cast<FrameView*>(widget.get()));3458 3459 ScrollView::addChild(widget);3460 }3461 3462 3495 void FrameView::removeChild(Widget* widget) 3463 3496 { -
trunk/Source/WebCore/page/FrameView.h
r113287 r114170 292 292 bool isFrameViewScrollCorner(RenderScrollbarPart* scrollCorner) const { return m_scrollCorner == scrollCorner; } 293 293 294 void calculateScrollbarModesForLayout(ScrollbarMode& hMode, ScrollbarMode& vMode); 294 enum ScrollbarModesCalculationStrategy { RulesFromWebContentOnly, AnyRule }; 295 void calculateScrollbarModesForLayout(ScrollbarMode& hMode, ScrollbarMode& vMode, ScrollbarModesCalculationStrategy = AnyRule); 295 296 296 297 // Normal delay … … 328 329 const ScrollableAreaSet* scrollableAreas() const { return m_scrollableAreas.get(); } 329 330 330 virtual void addChild(PassRefPtr<Widget>) OVERRIDE;331 331 virtual void removeChild(Widget*) OVERRIDE; 332 332 … … 389 389 virtual ScrollableArea* enclosingScrollableArea() const; 390 390 virtual IntRect scrollableAreaBoundingBox() const OVERRIDE; 391 392 void updateScrollableAreaSet(); 391 393 392 394 #if USE(ACCELERATED_COMPOSITING) -
trunk/Source/WebCore/rendering/RenderLayer.cpp
r113883 r114170 2201 2201 if (!renderer()->isBox()) 2202 2202 return false; 2203 2203 2204 2204 return toRenderBox(renderer())->scrollsOverflow(); 2205 2205 } … … 2403 2403 RenderBox* box = renderBox(); 2404 2404 ASSERT(box); 2405 2405 2406 2406 m_scrollDimensionsDirty = false; 2407 2407 … … 2490 2490 m_vBar->setProportion(clientHeight, m_scrollSize.height()); 2491 2491 } 2492 2493 updateScrollableAreaSet((hasHorizontalOverflow || hasVerticalOverflow) && scrollsOverflow()); 2492 2494 } 2493 2495 … … 4655 4657 m_vBar->setEnabled(true); 4656 4658 } 4659 4660 if (!m_scrollDimensionsDirty) 4661 updateScrollableAreaSet((hasHorizontalOverflow() || hasVerticalOverflow()) && scrollsOverflow()); 4657 4662 } 4658 4663 … … 4686 4691 createReflection(); 4687 4692 updateReflectionStyle(); 4688 }4689 4690 if (Frame* frame = renderer()->frame()) {4691 if (FrameView* frameView = frame->view()) {4692 if (scrollsOverflow())4693 frameView->addScrollableArea(this);4694 else4695 frameView->removeScrollableArea(this);4696 }4697 4693 } 4698 4694 … … 4733 4729 } 4734 4730 #endif 4731 } 4732 4733 void RenderLayer::updateScrollableAreaSet(bool hasOverflow) 4734 { 4735 Frame* frame = renderer()->frame(); 4736 if (!frame) 4737 return; 4738 4739 FrameView* frameView = frame->view(); 4740 if (!frameView) 4741 return; 4742 4743 bool isVisibleToHitTest = renderer()->visibleToHitTesting(); 4744 if (HTMLFrameOwnerElement* owner = frame->ownerElement()) 4745 isVisibleToHitTest &= owner->renderer() && owner->renderer()->visibleToHitTesting(); 4746 4747 if (hasOverflow && isVisibleToHitTest) 4748 frameView->addScrollableArea(this); 4749 else 4750 frameView->removeScrollableArea(this); 4735 4751 } 4736 4752 -
trunk/Source/WebCore/rendering/RenderLayer.h
r113335 r114170 703 703 IntSize scrollbarOffset(const Scrollbar*) const; 704 704 705 void updateScrollableAreaSet(bool hasOverflow); 706 705 707 void childVisibilityChanged(bool newVisibility); 706 708 void dirtyVisibleDescendantStatus(); -
trunk/Source/WebCore/testing/Internals.cpp
r114081 r114170 955 955 } 956 956 957 } 957 unsigned Internals::numberOfScrollableAreas(Document* document, ExceptionCode&) 958 { 959 unsigned count = 0; 960 Frame* frame = document->frame(); 961 if (frame->view()->scrollableAreas()) 962 count += frame->view()->scrollableAreas()->size(); 963 964 for (Frame* child = frame->tree()->firstChild(); child; child = child->tree()->nextSibling()) { 965 if (child->view() && child->view()->scrollableAreas()) 966 count += child->view()->scrollableAreas()->size(); 967 } 968 969 return count; 970 } 971 972 } -
trunk/Source/WebCore/testing/Internals.h
r114081 r114170 151 151 bool hasGrammarMarker(Document*, int from, int length, ExceptionCode&); 152 152 153 unsigned numberOfScrollableAreas(Document*, ExceptionCode&); 154 153 155 static const char* internalsId; 154 156 -
trunk/Source/WebCore/testing/Internals.idl
r114081 r114170 126 126 boolean hasGrammarMarker(in Document document, in long from, in long length) raises (DOMException); 127 127 128 unsigned long numberOfScrollableAreas(in Document document) raises (DOMException); 129 128 130 readonly attribute InternalSettings settings; 129 131
Note: See TracChangeset
for help on using the changeset viewer.