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

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 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 380
381 WebInputEventResult EventHandler::handleMousePressEvent(const MouseEventWithHitT estResults& event) 381 WebInputEventResult EventHandler::handleMousePressEvent(const MouseEventWithHitT estResults& event)
382 { 382 {
383 TRACE_EVENT0("blink", "EventHandler::handleMousePressEvent"); 383 TRACE_EVENT0("blink", "EventHandler::handleMousePressEvent");
384 384
385 // Reset drag state. 385 // Reset drag state.
386 dragState().m_dragSrc = nullptr; 386 dragState().m_dragSrc = nullptr;
387 387
388 cancelFakeMouseMoveEvent(); 388 cancelFakeMouseMoveEvent();
389 389
390 m_frame->document()->updateLayoutIgnorePendingStylesheets(); 390 m_frame->document()->updateStyleAndLayoutIgnorePendingStylesheets();
391 391
392 if (FrameView* frameView = m_frame->view()) { 392 if (FrameView* frameView = m_frame->view()) {
393 if (frameView->isPointInScrollbarCorner(event.event().position())) 393 if (frameView->isPointInScrollbarCorner(event.event().position()))
394 return WebInputEventResult::NotHandled; 394 return WebInputEventResult::NotHandled;
395 } 395 }
396 396
397 bool singleClick = event.event().clickCount() <= 1; 397 bool singleClick = event.event().clickCount() <= 1;
398 398
399 m_mouseDownMayStartDrag = singleClick && !isLinkSelection(event); 399 m_mouseDownMayStartDrag = singleClick && !isLinkSelection(event);
400 400
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
648 const FloatSize& velocity, Node* startNode, Node** stopNode, bool* consumed) 648 const FloatSize& velocity, Node* startNode, Node** stopNode, bool* consumed)
649 { 649 {
650 if (consumed) 650 if (consumed)
651 *consumed = false; 651 *consumed = false;
652 if (delta.isZero()) 652 if (delta.isZero())
653 return ScrollResult(); 653 return ScrollResult();
654 654
655 Node* node = startNode; 655 Node* node = startNode;
656 ASSERT(node && node->layoutObject()); 656 ASSERT(node && node->layoutObject());
657 657
658 m_frame->document()->updateLayoutIgnorePendingStylesheets(); 658 m_frame->document()->updateStyleAndLayoutIgnorePendingStylesheets();
659 659
660 ScrollResult result; 660 ScrollResult result;
661 661
662 LayoutBox* curBox = node->layoutObject()->enclosingBox(); 662 LayoutBox* curBox = node->layoutObject()->enclosingBox();
663 while (curBox) { 663 while (curBox) {
664 // If we're at the stopNode, we should try to scroll it but we shouldn't 664 // If we're at the stopNode, we should try to scroll it but we shouldn't
665 // chain past it. 665 // chain past it.
666 bool shouldStopChaining = 666 bool shouldStopChaining =
667 stopNode && *stopNode && curBox->node() == *stopNode; 667 stopNode && *stopNode && curBox->node() == *stopNode;
668 bool wasRootScroller = false; 668 bool wasRootScroller = false;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
704 704
705 if (!node) 705 if (!node)
706 node = m_mousePressNode.get(); 706 node = m_mousePressNode.get();
707 707
708 if ((!node || !node->layoutObject()) && m_frame->view() && m_frame->view()-> layoutView()) 708 if ((!node || !node->layoutObject()) && m_frame->view() && m_frame->view()-> layoutView())
709 node = m_frame->view()->layoutView()->node(); 709 node = m_frame->view()->layoutView()->node();
710 710
711 if (!node) 711 if (!node)
712 return false; 712 return false;
713 713
714 m_frame->document()->updateLayoutIgnorePendingStylesheets(); 714 m_frame->document()->updateStyleAndLayoutIgnorePendingStylesheets();
715 715
716 LayoutBox* curBox = node->layoutObject()->enclosingBox(); 716 LayoutBox* curBox = node->layoutObject()->enclosingBox();
717 while (curBox) { 717 while (curBox) {
718 ScrollDirectionPhysical physicalDirection = toPhysicalDirection( 718 ScrollDirectionPhysical physicalDirection = toPhysicalDirection(
719 direction, curBox->isHorizontalWritingMode(), curBox->style()->isFli ppedBlocksWritingMode()); 719 direction, curBox->isHorizontalWritingMode(), curBox->style()->isFli ppedBlocksWritingMode());
720 720
721 ScrollResult result = curBox->scroll(granularity, toScrollDelta(physical Direction, 1)); 721 ScrollResult result = curBox->scroll(granularity, toScrollDelta(physical Direction, 1));
722 722
723 if (result.didScroll()) { 723 if (result.didScroll()) {
724 setFrameWasScrolledByUser(); 724 setFrameWasScrolledByUser();
725 return true; 725 return true;
726 } 726 }
727 727
728 curBox = curBox->containingBlock(); 728 curBox = curBox->containingBlock();
729 } 729 }
730 730
731 return false; 731 return false;
732 } 732 }
733 733
734 void EventHandler::customizedScroll(const Node& startNode, ScrollState& scrollSt ate) 734 void EventHandler::customizedScroll(const Node& startNode, ScrollState& scrollSt ate)
735 { 735 {
736 if (scrollState.fullyConsumed()) 736 if (scrollState.fullyConsumed())
737 return; 737 return;
738 738
739 if (scrollState.deltaX() || scrollState.deltaY()) 739 if (scrollState.deltaX() || scrollState.deltaY())
740 m_frame->document()->updateLayoutIgnorePendingStylesheets(); 740 m_frame->document()->updateStyleAndLayoutIgnorePendingStylesheets();
741 741
742 if (m_currentScrollChain.empty()) 742 if (m_currentScrollChain.empty())
743 recomputeScrollChain(*m_frame, startNode, m_currentScrollChain); 743 recomputeScrollChain(*m_frame, startNode, m_currentScrollChain);
744 scrollState.setScrollChain(m_currentScrollChain); 744 scrollState.setScrollChain(m_currentScrollChain);
745 745
746 scrollState.distributeToScrollChainDescendant(); 746 scrollState.distributeToScrollChainDescendant();
747 } 747 }
748 748
749 // TODO(bokan): This should be merged with logicalScroll assuming 749 // TODO(bokan): This should be merged with logicalScroll assuming
750 // defaultSpaceEventHandler's chaining scroll can be done crossing frames. 750 // defaultSpaceEventHandler's chaining scroll can be done crossing frames.
751 bool EventHandler::bubblingScroll(ScrollDirection direction, ScrollGranularity g ranularity, Node* startingNode) 751 bool EventHandler::bubblingScroll(ScrollDirection direction, ScrollGranularity g ranularity, Node* startingNode)
752 { 752 {
753 // The layout needs to be up to date to determine if we can scroll. We may b e 753 // The layout needs to be up to date to determine if we can scroll. We may b e
754 // here because of an onLoad event, in which case the final layout hasn't be en performed yet. 754 // here because of an onLoad event, in which case the final layout hasn't be en performed yet.
755 m_frame->document()->updateLayoutIgnorePendingStylesheets(); 755 m_frame->document()->updateStyleAndLayoutIgnorePendingStylesheets();
756 // FIXME: enable scroll customization in this case. See crbug.com/410974. 756 // FIXME: enable scroll customization in this case. See crbug.com/410974.
757 if (logicalScroll(direction, granularity, startingNode)) 757 if (logicalScroll(direction, granularity, startingNode))
758 return true; 758 return true;
759 759
760 Frame* parentFrame = m_frame->tree().parent(); 760 Frame* parentFrame = m_frame->tree().parent();
761 if (!parentFrame || !parentFrame->isLocalFrame()) 761 if (!parentFrame || !parentFrame->isLocalFrame())
762 return false; 762 return false;
763 // FIXME: Broken for OOPI. 763 // FIXME: Broken for OOPI.
764 return toLocalFrame(parentFrame)->eventHandler().bubblingScroll(direction, g ranularity, m_frame->deprecatedLocalOwner()); 764 return toLocalFrame(parentFrame)->eventHandler().bubblingScroll(direction, g ranularity, m_frame->deprecatedLocalOwner());
765 } 765 }
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
833 return; 833 return;
834 834
835 FrameView* view = m_frame->view(); 835 FrameView* view = m_frame->view();
836 if (!view || !view->shouldSetCursor()) 836 if (!view || !view->shouldSetCursor())
837 return; 837 return;
838 838
839 LayoutView* layoutView = view->layoutView(); 839 LayoutView* layoutView = view->layoutView();
840 if (!layoutView) 840 if (!layoutView)
841 return; 841 return;
842 842
843 m_frame->document()->updateLayout(); 843 m_frame->document()->updateStyleAndLayout();
844 844
845 HitTestRequest request(HitTestRequest::ReadOnly | HitTestRequest::AllowChild FrameContent); 845 HitTestRequest request(HitTestRequest::ReadOnly | HitTestRequest::AllowChild FrameContent);
846 HitTestResult result(request, view->rootFrameToContents(m_lastKnownMousePosi tion)); 846 HitTestResult result(request, view->rootFrameToContents(m_lastKnownMousePosi tion));
847 layoutView->hitTest(result); 847 layoutView->hitTest(result);
848 848
849 if (LocalFrame* frame = result.innerNodeFrame()) { 849 if (LocalFrame* frame = result.innerNodeFrame()) {
850 OptionalCursor optionalCursor = frame->eventHandler().selectCursor(resul t); 850 OptionalCursor optionalCursor = frame->eventHandler().selectCursor(resul t);
851 if (optionalCursor.isCursorChange()) { 851 if (optionalCursor.isCursorChange()) {
852 view->setCursor(optionalCursor.cursor()); 852 view->setCursor(optionalCursor.cursor());
853 } 853 }
(...skipping 924 matching lines...) Expand 10 before | Expand all | Expand 10 after
1778 1778
1779 WebInputEventResult EventHandler::handleMouseFocus(const MouseEventWithHitTestRe sults& targetedEvent, InputDeviceCapabilities* sourceCapabilities) 1779 WebInputEventResult EventHandler::handleMouseFocus(const MouseEventWithHitTestRe sults& targetedEvent, InputDeviceCapabilities* sourceCapabilities)
1780 { 1780 {
1781 // If clicking on a frame scrollbar, do not mess up with content focus. 1781 // If clicking on a frame scrollbar, do not mess up with content focus.
1782 if (targetedEvent.hitTestResult().scrollbar() && !m_frame->contentLayoutItem ().isNull()) { 1782 if (targetedEvent.hitTestResult().scrollbar() && !m_frame->contentLayoutItem ().isNull()) {
1783 if (targetedEvent.hitTestResult().scrollbar()->getScrollableArea() == m_ frame->contentLayoutItem().getScrollableArea()) 1783 if (targetedEvent.hitTestResult().scrollbar()->getScrollableArea() == m_ frame->contentLayoutItem().getScrollableArea())
1784 return WebInputEventResult::NotHandled; 1784 return WebInputEventResult::NotHandled;
1785 } 1785 }
1786 1786
1787 // The layout needs to be up to date to determine if an element is focusable . 1787 // The layout needs to be up to date to determine if an element is focusable .
1788 m_frame->document()->updateLayoutIgnorePendingStylesheets(); 1788 m_frame->document()->updateStyleAndLayoutIgnorePendingStylesheets();
1789 1789
1790 Element* element = nullptr; 1790 Element* element = nullptr;
1791 if (m_nodeUnderMouse) 1791 if (m_nodeUnderMouse)
1792 element = m_nodeUnderMouse->isElementNode() ? toElement(m_nodeUnderMouse ) : m_nodeUnderMouse->parentOrShadowHostElement(); 1792 element = m_nodeUnderMouse->isElementNode() ? toElement(m_nodeUnderMouse ) : m_nodeUnderMouse->parentOrShadowHostElement();
1793 for (; element; element = element->parentOrShadowHostElement()) { 1793 for (; element; element = element->parentOrShadowHostElement()) {
1794 if (element->isFocusable() && element->isFocusedElementInDocument()) 1794 if (element->isFocusable() && element->isFocusedElementInDocument())
1795 return WebInputEventResult::NotHandled; 1795 return WebInputEventResult::NotHandled;
1796 if (element->isMouseFocusable()) 1796 if (element->isMouseFocusable())
1797 break; 1797 break;
1798 } 1798 }
(...skipping 1909 matching lines...) Expand 10 before | Expand all | Expand 10 after
3708 3708
3709 FrameHost* EventHandler::frameHost() 3709 FrameHost* EventHandler::frameHost()
3710 { 3710 {
3711 if (!m_frame->page()) 3711 if (!m_frame->page())
3712 return nullptr; 3712 return nullptr;
3713 3713
3714 return &m_frame->page()->frameHost(); 3714 return &m_frame->page()->frameHost();
3715 } 3715 }
3716 3716
3717 } // namespace blink 3717 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698