Changeset 243735 in webkit
- Timestamp:
- Apr 1, 2019, 8:16:48 PM (7 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
-
ChangeLog (modified) (1 diff)
-
page/Frame.cpp (modified) (2 diffs)
-
page/Frame.h (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r243734 r243735 1 2019-04-01 Simon Fraser <simon.fraser@apple.com> 2 3 Remove some unused iOS scrolling-related code in Frame 4 https://bugs.webkit.org/show_bug.cgi?id=196473 5 6 Reviewed by Zalan Bujtas. 7 8 This code has no callers. 9 10 * page/Frame.cpp: 11 (WebCore::Frame::Frame): 12 (WebCore::Frame::scrollOverflowLayer): Deleted. 13 (WebCore::Frame::overflowAutoScrollTimerFired): Deleted. 14 (WebCore::Frame::startOverflowAutoScroll): Deleted. 15 (WebCore::Frame::checkOverflowScroll): Deleted. 16 * page/Frame.h: 17 1 18 2019-04-01 Chris Dumez <cdumez@apple.com> 2 19 -
trunk/Source/WebCore/page/Frame.cpp
r243324 r243735 153 153 , m_selection(makeUniqueRef<FrameSelection>(this)) 154 154 , m_animationController(makeUniqueRef<CSSAnimationController>(*this)) 155 #if PLATFORM(IOS_FAMILY)156 , m_overflowAutoScrollTimer(*this, &Frame::overflowAutoScrollTimerFired)157 , m_selectionChangeCallbacksDisabled(false)158 #endif159 155 , m_pageZoomFactor(parentPageZoomFactor(this)) 160 156 , m_textZoomFactor(parentTextZoomFactor(this)) 161 , m_activeDOMObjectsAndAnimationsSuspendedCount(0)162 157 , m_eventHandler(makeUniqueRef<EventHandler>(*this)) 163 158 { … … 501 496 502 497 #if PLATFORM(IOS_FAMILY) 503 void Frame::scrollOverflowLayer(RenderLayer* layer, const IntRect& visibleRect, const IntRect& exposeRect)504 {505 if (!layer)506 return;507 508 RenderBox* box = layer->renderBox();509 if (!box)510 return;511 512 if (visibleRect.intersects(exposeRect))513 return;514 515 // FIXME: Why isn't this just calling RenderLayer::scrollRectToVisible()?516 ScrollOffset scrollOffset = layer->scrollOffset();517 int exposeLeft = exposeRect.x();518 int exposeRight = exposeLeft + exposeRect.width();519 int clientWidth = roundToInt(box->clientWidth());520 if (exposeLeft <= 0)521 scrollOffset.setX(std::max(0, scrollOffset.x() + exposeLeft - clientWidth / 2));522 else if (exposeRight >= clientWidth)523 scrollOffset.setX(std::min(box->scrollWidth() - clientWidth, scrollOffset.x() + clientWidth / 2));524 525 int exposeTop = exposeRect.y();526 int exposeBottom = exposeTop + exposeRect.height();527 int clientHeight = roundToInt(box->clientHeight());528 if (exposeTop <= 0)529 scrollOffset.setY(std::max(0, scrollOffset.y() + exposeTop - clientHeight / 2));530 else if (exposeBottom >= clientHeight)531 scrollOffset.setY(std::min(box->scrollHeight() - clientHeight, scrollOffset.y() + clientHeight / 2));532 533 layer->scrollToOffset(scrollOffset, ScrollClamping::Unclamped);534 selection().setCaretRectNeedsUpdate();535 selection().updateAppearance();536 }537 538 void Frame::overflowAutoScrollTimerFired()539 {540 if (!eventHandler().mousePressed() || checkOverflowScroll(PerformOverflowScroll) == OverflowScrollNone) {541 if (m_overflowAutoScrollTimer.isActive())542 m_overflowAutoScrollTimer.stop();543 }544 }545 546 void Frame::startOverflowAutoScroll(const IntPoint& mousePosition)547 {548 m_overflowAutoScrollPos = mousePosition;549 550 if (m_overflowAutoScrollTimer.isActive())551 return;552 553 if (checkOverflowScroll(DoNotPerformOverflowScroll) == OverflowScrollNone)554 return;555 556 m_overflowAutoScrollTimer.startRepeating(scrollFrequency);557 m_overflowAutoScrollDelta = 3;558 }559 560 int Frame::checkOverflowScroll(OverflowScrollAction action)561 {562 Position extent = selection().selection().extent();563 if (extent.isNull())564 return OverflowScrollNone;565 566 RenderObject* renderer = extent.deprecatedNode()->renderer();567 if (!renderer)568 return OverflowScrollNone;569 570 FrameView* view = this->view();571 if (!view)572 return OverflowScrollNone;573 574 RenderBlock* containingBlock = renderer->containingBlock();575 if (!containingBlock || !containingBlock->hasOverflowClip())576 return OverflowScrollNone;577 RenderLayer* layer = containingBlock->layer();578 ASSERT(layer);579 580 IntRect visibleRect = IntRect(view->scrollX(), view->scrollY(), view->visibleWidth(), view->visibleHeight());581 IntPoint position = m_overflowAutoScrollPos;582 if (visibleRect.contains(position.x(), position.y()))583 return OverflowScrollNone;584 585 int scrollType = 0;586 int deltaX = 0;587 int deltaY = 0;588 IntPoint selectionPosition;589 590 // This constant will make the selection draw a little bit beyond the edge of the visible area.591 // This prevents a visual glitch, in that you can fail to select a portion of a character that592 // is being rendered right at the edge of the visible rectangle.593 // FIXME: This probably needs improvement, and may need to take the font size into account.594 static const int scrollBoundsAdjustment = 3;595 596 // FIXME: Make a small buffer at the end of a visible rectangle so that autoscrolling works597 // even if the visible extends to the limits of the screen.598 if (position.x() < visibleRect.x()) {599 scrollType |= OverflowScrollLeft;600 if (action == PerformOverflowScroll) {601 deltaX -= static_cast<int>(m_overflowAutoScrollDelta);602 selectionPosition.setX(view->scrollX() - scrollBoundsAdjustment);603 }604 } else if (position.x() > visibleRect.maxX()) {605 scrollType |= OverflowScrollRight;606 if (action == PerformOverflowScroll) {607 deltaX += static_cast<int>(m_overflowAutoScrollDelta);608 selectionPosition.setX(view->scrollX() + view->visibleWidth() + scrollBoundsAdjustment);609 }610 }611 612 if (position.y() < visibleRect.y()) {613 scrollType |= OverflowScrollUp;614 if (action == PerformOverflowScroll) {615 deltaY -= static_cast<int>(m_overflowAutoScrollDelta);616 selectionPosition.setY(view->scrollY() - scrollBoundsAdjustment);617 }618 } else if (position.y() > visibleRect.maxY()) {619 scrollType |= OverflowScrollDown;620 if (action == PerformOverflowScroll) {621 deltaY += static_cast<int>(m_overflowAutoScrollDelta);622 selectionPosition.setY(view->scrollY() + view->visibleHeight() + scrollBoundsAdjustment);623 }624 }625 626 Ref<Frame> protectedThis(*this);627 628 if (action == PerformOverflowScroll && (deltaX || deltaY)) {629 layer->scrollToOffset(layer->scrollOffset() + IntSize(deltaX, deltaY), ScrollClamping::Unclamped);630 631 // Handle making selection.632 VisiblePosition visiblePosition(renderer->positionForPoint(selectionPosition, nullptr));633 if (visiblePosition.isNotNull()) {634 VisibleSelection visibleSelection = selection().selection();635 visibleSelection.setExtent(visiblePosition);636 if (selection().granularity() != CharacterGranularity)637 visibleSelection.expandUsingGranularity(selection().granularity());638 if (selection().shouldChangeSelection(visibleSelection))639 selection().setSelection(visibleSelection);640 }641 642 m_overflowAutoScrollDelta *= 1.02f; // Accelerate the scroll643 }644 return scrollType;645 }646 498 647 499 void Frame::setSelectionChangeCallbacksDisabled(bool selectionChangeCallbacksDisabled) -
trunk/Source/WebCore/page/Frame.h
r243674 r243735 259 259 260 260 #if PLATFORM(IOS_FAMILY) 261 // Scroll the selection in an overflow layer.262 void scrollOverflowLayer(RenderLayer*, const IntRect& visibleRect, const IntRect& exposeRect);263 264 261 WEBCORE_EXPORT int preferredHeight() const; 265 262 WEBCORE_EXPORT void updateLayout() const; … … 334 331 Node* qualifyingNodeAtViewportLocation(const FloatPoint& viewportLocation, FloatPoint& adjustedViewportLocation, const NodeQualifier&, bool shouldApproximate); 335 332 336 void overflowAutoScrollTimerFired();337 void startOverflowAutoScroll(const IntPoint&);338 int checkOverflowScroll(OverflowScrollAction);339 340 333 void setTimersPausedInternal(bool); 341 334 342 Timer m_overflowAutoScrollTimer;343 float m_overflowAutoScrollDelta;344 IntPoint m_overflowAutoScrollPos;345 335 ViewportArguments m_viewportArguments; 346 bool m_selectionChangeCallbacksDisabled ;336 bool m_selectionChangeCallbacksDisabled { false }; 347 337 VisibleSelection m_rangedSelectionBase; 348 338 VisibleSelection m_rangedSelectionInitialExtent; … … 352 342 float m_textZoomFactor; 353 343 354 int m_activeDOMObjectsAndAnimationsSuspendedCount ;344 int m_activeDOMObjectsAndAnimationsSuspendedCount { 0 }; 355 345 bool m_documentIsBeingReplaced { false }; 356 346 unsigned m_navigationDisableCount { 0 };
Note:
See TracChangeset
for help on using the changeset viewer.