Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(245)

Side by Side Diff: third_party/WebKit/Source/core/input/EventHandler.cpp

Issue 1896793002: Rename (updateLayout/updateStyle).*.() to updateStyleAndLayout.*.() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv ed. 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv ed.
3 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) 3 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org)
4 * Copyright (C) 2012 Digia Plc. and/or its subsidiary(-ies) 4 * Copyright (C) 2012 Digia Plc. and/or its subsidiary(-ies)
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 381
382 WebInputEventResult EventHandler::handleMousePressEvent(const MouseEventWithHitT estResults& event) 382 WebInputEventResult EventHandler::handleMousePressEvent(const MouseEventWithHitT estResults& event)
383 { 383 {
384 TRACE_EVENT0("blink", "EventHandler::handleMousePressEvent"); 384 TRACE_EVENT0("blink", "EventHandler::handleMousePressEvent");
385 385
386 // Reset drag state. 386 // Reset drag state.
387 dragState().m_dragSrc = nullptr; 387 dragState().m_dragSrc = nullptr;
388 388
389 cancelFakeMouseMoveEvent(); 389 cancelFakeMouseMoveEvent();
390 390
391 m_frame->document()->updateLayoutIgnorePendingStylesheets(); 391 m_frame->document()->updateStyleAndLayoutIgnorePendingStylesheets();
392 392
393 if (FrameView* frameView = m_frame->view()) { 393 if (FrameView* frameView = m_frame->view()) {
394 if (frameView->isPointInScrollbarCorner(event.event().position())) 394 if (frameView->isPointInScrollbarCorner(event.event().position()))
395 return WebInputEventResult::NotHandled; 395 return WebInputEventResult::NotHandled;
396 } 396 }
397 397
398 bool singleClick = event.event().clickCount() <= 1; 398 bool singleClick = event.event().clickCount() <= 1;
399 399
400 m_mouseDownMayStartDrag = singleClick && !isLinkSelection(event); 400 m_mouseDownMayStartDrag = singleClick && !isLinkSelection(event);
401 401
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
649 const FloatSize& velocity, Node* startNode, Node** stopNode, bool* consumed) 649 const FloatSize& velocity, Node* startNode, Node** stopNode, bool* consumed)
650 { 650 {
651 if (consumed) 651 if (consumed)
652 *consumed = false; 652 *consumed = false;
653 if (delta.isZero()) 653 if (delta.isZero())
654 return ScrollResult(); 654 return ScrollResult();
655 655
656 Node* node = startNode; 656 Node* node = startNode;
657 ASSERT(node && node->layoutObject()); 657 ASSERT(node && node->layoutObject());
658 658
659 m_frame->document()->updateLayoutIgnorePendingStylesheets(); 659 m_frame->document()->updateStyleAndLayoutIgnorePendingStylesheets();
660 660
661 ScrollResult result; 661 ScrollResult result;
662 662
663 LayoutBox* curBox = node->layoutObject()->enclosingBox(); 663 LayoutBox* curBox = node->layoutObject()->enclosingBox();
664 while (curBox) { 664 while (curBox) {
665 // If we're at the stopNode, we should try to scroll it but we shouldn't 665 // If we're at the stopNode, we should try to scroll it but we shouldn't
666 // chain past it. 666 // chain past it.
667 bool shouldStopChaining = 667 bool shouldStopChaining =
668 stopNode && *stopNode && curBox->node() == *stopNode; 668 stopNode && *stopNode && curBox->node() == *stopNode;
669 bool wasRootScroller = false; 669 bool wasRootScroller = false;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
705 705
706 if (!node) 706 if (!node)
707 node = m_mousePressNode.get(); 707 node = m_mousePressNode.get();
708 708
709 if ((!node || !node->layoutObject()) && m_frame->view() && !m_frame->view()- >layoutViewItem().isNull()) 709 if ((!node || !node->layoutObject()) && m_frame->view() && !m_frame->view()- >layoutViewItem().isNull())
710 node = m_frame->view()->layoutViewItem().node(); 710 node = m_frame->view()->layoutViewItem().node();
711 711
712 if (!node) 712 if (!node)
713 return false; 713 return false;
714 714
715 m_frame->document()->updateLayoutIgnorePendingStylesheets(); 715 m_frame->document()->updateStyleAndLayoutIgnorePendingStylesheets();
716 716
717 LayoutBox* curBox = node->layoutObject()->enclosingBox(); 717 LayoutBox* curBox = node->layoutObject()->enclosingBox();
718 while (curBox) { 718 while (curBox) {
719 ScrollDirectionPhysical physicalDirection = toPhysicalDirection( 719 ScrollDirectionPhysical physicalDirection = toPhysicalDirection(
720 direction, curBox->isHorizontalWritingMode(), curBox->style()->isFli ppedBlocksWritingMode()); 720 direction, curBox->isHorizontalWritingMode(), curBox->style()->isFli ppedBlocksWritingMode());
721 721
722 ScrollResult result = curBox->scroll(granularity, toScrollDelta(physical Direction, 1)); 722 ScrollResult result = curBox->scroll(granularity, toScrollDelta(physical Direction, 1));
723 723
724 if (result.didScroll()) { 724 if (result.didScroll()) {
725 setFrameWasScrolledByUser(); 725 setFrameWasScrolledByUser();
726 return true; 726 return true;
727 } 727 }
728 728
729 curBox = curBox->containingBlock(); 729 curBox = curBox->containingBlock();
730 } 730 }
731 731
732 return false; 732 return false;
733 } 733 }
734 734
735 void EventHandler::customizedScroll(const Node& startNode, ScrollState& scrollSt ate) 735 void EventHandler::customizedScroll(const Node& startNode, ScrollState& scrollSt ate)
736 { 736 {
737 if (scrollState.fullyConsumed()) 737 if (scrollState.fullyConsumed())
738 return; 738 return;
739 739
740 if (scrollState.deltaX() || scrollState.deltaY()) 740 if (scrollState.deltaX() || scrollState.deltaY())
741 m_frame->document()->updateLayoutIgnorePendingStylesheets(); 741 m_frame->document()->updateStyleAndLayoutIgnorePendingStylesheets();
742 742
743 if (m_currentScrollChain.empty()) 743 if (m_currentScrollChain.empty())
744 recomputeScrollChain(*m_frame, startNode, m_currentScrollChain); 744 recomputeScrollChain(*m_frame, startNode, m_currentScrollChain);
745 scrollState.setScrollChain(m_currentScrollChain); 745 scrollState.setScrollChain(m_currentScrollChain);
746 746
747 scrollState.distributeToScrollChainDescendant(); 747 scrollState.distributeToScrollChainDescendant();
748 } 748 }
749 749
750 // TODO(bokan): This should be merged with logicalScroll assuming 750 // TODO(bokan): This should be merged with logicalScroll assuming
751 // defaultSpaceEventHandler's chaining scroll can be done crossing frames. 751 // defaultSpaceEventHandler's chaining scroll can be done crossing frames.
752 bool EventHandler::bubblingScroll(ScrollDirection direction, ScrollGranularity g ranularity, Node* startingNode) 752 bool EventHandler::bubblingScroll(ScrollDirection direction, ScrollGranularity g ranularity, Node* startingNode)
753 { 753 {
754 // The layout needs to be up to date to determine if we can scroll. We may b e 754 // The layout needs to be up to date to determine if we can scroll. We may b e
755 // here because of an onLoad event, in which case the final layout hasn't be en performed yet. 755 // here because of an onLoad event, in which case the final layout hasn't be en performed yet.
756 m_frame->document()->updateLayoutIgnorePendingStylesheets(); 756 m_frame->document()->updateStyleAndLayoutIgnorePendingStylesheets();
757 // FIXME: enable scroll customization in this case. See crbug.com/410974. 757 // FIXME: enable scroll customization in this case. See crbug.com/410974.
758 if (logicalScroll(direction, granularity, startingNode)) 758 if (logicalScroll(direction, granularity, startingNode))
759 return true; 759 return true;
760 760
761 Frame* parentFrame = m_frame->tree().parent(); 761 Frame* parentFrame = m_frame->tree().parent();
762 if (!parentFrame || !parentFrame->isLocalFrame()) 762 if (!parentFrame || !parentFrame->isLocalFrame())
763 return false; 763 return false;
764 // FIXME: Broken for OOPI. 764 // FIXME: Broken for OOPI.
765 return toLocalFrame(parentFrame)->eventHandler().bubblingScroll(direction, g ranularity, m_frame->deprecatedLocalOwner()); 765 return toLocalFrame(parentFrame)->eventHandler().bubblingScroll(direction, g ranularity, m_frame->deprecatedLocalOwner());
766 } 766 }
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
834 return; 834 return;
835 835
836 FrameView* view = m_frame->view(); 836 FrameView* view = m_frame->view();
837 if (!view || !view->shouldSetCursor()) 837 if (!view || !view->shouldSetCursor())
838 return; 838 return;
839 839
840 LayoutViewItem layoutViewItem = view->layoutViewItem(); 840 LayoutViewItem layoutViewItem = view->layoutViewItem();
841 if (layoutViewItem.isNull()) 841 if (layoutViewItem.isNull())
842 return; 842 return;
843 843
844 m_frame->document()->updateLayout(); 844 m_frame->document()->updateStyleAndLayout();
845 845
846 HitTestRequest request(HitTestRequest::ReadOnly | HitTestRequest::AllowChild FrameContent); 846 HitTestRequest request(HitTestRequest::ReadOnly | HitTestRequest::AllowChild FrameContent);
847 HitTestResult result(request, view->rootFrameToContents(m_lastKnownMousePosi tion)); 847 HitTestResult result(request, view->rootFrameToContents(m_lastKnownMousePosi tion));
848 layoutViewItem.hitTest(result); 848 layoutViewItem.hitTest(result);
849 849
850 if (LocalFrame* frame = result.innerNodeFrame()) { 850 if (LocalFrame* frame = result.innerNodeFrame()) {
851 OptionalCursor optionalCursor = frame->eventHandler().selectCursor(resul t); 851 OptionalCursor optionalCursor = frame->eventHandler().selectCursor(resul t);
852 if (optionalCursor.isCursorChange()) { 852 if (optionalCursor.isCursorChange()) {
853 view->setCursor(optionalCursor.cursor()); 853 view->setCursor(optionalCursor.cursor());
854 } 854 }
(...skipping 924 matching lines...) Expand 10 before | Expand all | Expand 10 after
1779 1779
1780 WebInputEventResult EventHandler::handleMouseFocus(const MouseEventWithHitTestRe sults& targetedEvent, InputDeviceCapabilities* sourceCapabilities) 1780 WebInputEventResult EventHandler::handleMouseFocus(const MouseEventWithHitTestRe sults& targetedEvent, InputDeviceCapabilities* sourceCapabilities)
1781 { 1781 {
1782 // If clicking on a frame scrollbar, do not mess up with content focus. 1782 // If clicking on a frame scrollbar, do not mess up with content focus.
1783 if (targetedEvent.hitTestResult().scrollbar() && !m_frame->contentLayoutItem ().isNull()) { 1783 if (targetedEvent.hitTestResult().scrollbar() && !m_frame->contentLayoutItem ().isNull()) {
1784 if (targetedEvent.hitTestResult().scrollbar()->getScrollableArea() == m_ frame->contentLayoutItem().getScrollableArea()) 1784 if (targetedEvent.hitTestResult().scrollbar()->getScrollableArea() == m_ frame->contentLayoutItem().getScrollableArea())
1785 return WebInputEventResult::NotHandled; 1785 return WebInputEventResult::NotHandled;
1786 } 1786 }
1787 1787
1788 // The layout needs to be up to date to determine if an element is focusable . 1788 // The layout needs to be up to date to determine if an element is focusable .
1789 m_frame->document()->updateLayoutIgnorePendingStylesheets(); 1789 m_frame->document()->updateStyleAndLayoutIgnorePendingStylesheets();
1790 1790
1791 Element* element = nullptr; 1791 Element* element = nullptr;
1792 if (m_nodeUnderMouse) 1792 if (m_nodeUnderMouse)
1793 element = m_nodeUnderMouse->isElementNode() ? toElement(m_nodeUnderMouse ) : m_nodeUnderMouse->parentOrShadowHostElement(); 1793 element = m_nodeUnderMouse->isElementNode() ? toElement(m_nodeUnderMouse ) : m_nodeUnderMouse->parentOrShadowHostElement();
1794 for (; element; element = element->parentOrShadowHostElement()) { 1794 for (; element; element = element->parentOrShadowHostElement()) {
1795 if (element->isFocusable() && element->isFocusedElementInDocument()) 1795 if (element->isFocusable() && element->isFocusedElementInDocument())
1796 return WebInputEventResult::NotHandled; 1796 return WebInputEventResult::NotHandled;
1797 if (element->isMouseFocusable()) 1797 if (element->isMouseFocusable())
1798 break; 1798 break;
1799 } 1799 }
(...skipping 1907 matching lines...) Expand 10 before | Expand all | Expand 10 after
3707 3707
3708 FrameHost* EventHandler::frameHost() const 3708 FrameHost* EventHandler::frameHost() const
3709 { 3709 {
3710 if (!m_frame->page()) 3710 if (!m_frame->page())
3711 return nullptr; 3711 return nullptr;
3712 3712
3713 return &m_frame->page()->frameHost(); 3713 return &m_frame->page()->frameHost();
3714 } 3714 }
3715 3715
3716 } // namespace blink 3716 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698