| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 #include "WebFrameImpl.h" | 44 #include "WebFrameImpl.h" |
| 45 #include "WebHitTestResult.h" | 45 #include "WebHitTestResult.h" |
| 46 #include "WebInputEvent.h" | 46 #include "WebInputEvent.h" |
| 47 #include "WebSettings.h" | 47 #include "WebSettings.h" |
| 48 #include "WebSettingsImpl.h" | 48 #include "WebSettingsImpl.h" |
| 49 #include "WebViewClient.h" | 49 #include "WebViewClient.h" |
| 50 #include "WebViewImpl.h" | 50 #include "WebViewImpl.h" |
| 51 #include "WebWidget.h" | 51 #include "WebWidget.h" |
| 52 #include "core/dom/Document.h" | 52 #include "core/dom/Document.h" |
| 53 #include "core/dom/Element.h" | 53 #include "core/dom/Element.h" |
| 54 #include "core/dom/EventHandlerRegistry.h" |
| 54 #include "core/html/HTMLDocument.h" | 55 #include "core/html/HTMLDocument.h" |
| 55 #include "core/html/HTMLIFrameElement.h" | 56 #include "core/html/HTMLIFrameElement.h" |
| 56 #include "core/html/HTMLInputElement.h" | 57 #include "core/html/HTMLInputElement.h" |
| 57 #include "core/html/HTMLTextAreaElement.h" | 58 #include "core/html/HTMLTextAreaElement.h" |
| 58 #include "core/loader/FrameLoadRequest.h" | 59 #include "core/loader/FrameLoadRequest.h" |
| 59 #include "core/frame/FrameView.h" | 60 #include "core/frame/FrameView.h" |
| 60 #include "core/page/Chrome.h" | 61 #include "core/page/Chrome.h" |
| 61 #include "core/frame/Settings.h" | 62 #include "core/frame/Settings.h" |
| 62 #include "platform/KeyboardCodes.h" | 63 #include "platform/KeyboardCodes.h" |
| 63 #include "platform/graphics/Color.h" | 64 #include "platform/graphics/Color.h" |
| (...skipping 1466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1530 { | 1531 { |
| 1531 int value = m_hasTouchEventHandlerCount[state]; | 1532 int value = m_hasTouchEventHandlerCount[state]; |
| 1532 m_hasTouchEventHandlerCount[state] = 0; | 1533 m_hasTouchEventHandlerCount[state] = 0; |
| 1533 return value; | 1534 return value; |
| 1534 } | 1535 } |
| 1535 | 1536 |
| 1536 private: | 1537 private: |
| 1537 int m_hasTouchEventHandlerCount[2]; | 1538 int m_hasTouchEventHandlerCount[2]; |
| 1538 }; | 1539 }; |
| 1539 | 1540 |
| 1540 // This test verifies that WebWidgetClient::hasTouchEventHandlers is called acco
rdingly for various | 1541 // This test verifies that WebWidgetClient::hasTouchEventHandlers is called |
| 1541 // calls to Document::did{Add|Remove|Clear}TouchEventHandler. Verifying that tho
se calls are made | 1542 // accordingly for various calls to EventHandlerRegistry::did{Add|Remove| |
| 1542 // correctly is the job of LayoutTests/fast/events/touch/touch-handler-count.htm
l. | 1543 // RemoveAll}EventHandler(..., TouchEvent). Verifying that those calls are made |
| 1544 // correctly is the job of LayoutTests/fast/events/event-handler-count.html. |
| 1543 TEST_F(WebViewTest, HasTouchEventHandlers) | 1545 TEST_F(WebViewTest, HasTouchEventHandlers) |
| 1544 { | 1546 { |
| 1545 TouchEventHandlerWebViewClient client; | 1547 TouchEventHandlerWebViewClient client; |
| 1546 std::string url = m_baseURL + "has_touch_event_handlers.html"; | 1548 std::string url = m_baseURL + "has_touch_event_handlers.html"; |
| 1547 URLTestHelpers::registerMockedURLLoad(toKURL(url), "has_touch_event_handlers
.html"); | 1549 URLTestHelpers::registerMockedURLLoad(toKURL(url), "has_touch_event_handlers
.html"); |
| 1548 WebViewImpl* webViewImpl = m_webViewHelper.initializeAndLoad(url, true, 0, &
client); | 1550 WebViewImpl* webViewImpl = m_webViewHelper.initializeAndLoad(url, true, 0, &
client); |
| 1551 const WebCore::EventHandlerRegistry::EventHandlerClass touchEvent = WebCore:
:EventHandlerRegistry::TouchEvent; |
| 1549 | 1552 |
| 1550 // The page is initialized with at least one no-handlers call. | 1553 // The page is initialized with at least one no-handlers call. |
| 1551 // In practice we get two such calls because WebViewHelper::initializeAndLoa
d first | 1554 // In practice we get two such calls because WebViewHelper::initializeAndLoa
d first |
| 1552 // initializes and empty frame, and then loads a document into it, so there
are two | 1555 // initializes and empty frame, and then loads a document into it, so there
are two |
| 1553 // FrameLoader::commitProvisionalLoad calls. | 1556 // FrameLoader::commitProvisionalLoad calls. |
| 1554 EXPECT_GE(client.getAndResetHasTouchEventHandlerCallCount(false), 1); | 1557 EXPECT_GE(client.getAndResetHasTouchEventHandlerCallCount(false), 1); |
| 1555 EXPECT_EQ(0, client.getAndResetHasTouchEventHandlerCallCount(true)); | 1558 EXPECT_EQ(0, client.getAndResetHasTouchEventHandlerCallCount(true)); |
| 1556 | 1559 |
| 1557 // Adding the first document handler results in a has-handlers call. | 1560 // Adding the first document handler results in a has-handlers call. |
| 1558 WebCore::Document* document = webViewImpl->mainFrameImpl()->frame()->documen
t(); | 1561 WebCore::Document* document = webViewImpl->mainFrameImpl()->frame()->documen
t(); |
| 1559 document->didAddTouchEventHandler(document); | 1562 WebCore::EventHandlerRegistry* registry = WebCore::EventHandlerRegistry::fro
m(*document); |
| 1563 registry->didAddEventHandler(*document, touchEvent); |
| 1560 EXPECT_EQ(0, client.getAndResetHasTouchEventHandlerCallCount(false)); | 1564 EXPECT_EQ(0, client.getAndResetHasTouchEventHandlerCallCount(false)); |
| 1561 EXPECT_EQ(1, client.getAndResetHasTouchEventHandlerCallCount(true)); | 1565 EXPECT_EQ(1, client.getAndResetHasTouchEventHandlerCallCount(true)); |
| 1562 | 1566 |
| 1563 // Adding another handler has no effect. | 1567 // Adding another handler has no effect. |
| 1564 document->didAddTouchEventHandler(document); | 1568 registry->didAddEventHandler(*document, touchEvent); |
| 1565 EXPECT_EQ(0, client.getAndResetHasTouchEventHandlerCallCount(false)); | 1569 EXPECT_EQ(0, client.getAndResetHasTouchEventHandlerCallCount(false)); |
| 1566 EXPECT_EQ(0, client.getAndResetHasTouchEventHandlerCallCount(true)); | 1570 EXPECT_EQ(0, client.getAndResetHasTouchEventHandlerCallCount(true)); |
| 1567 | 1571 |
| 1568 // Removing the duplicate handler has no effect. | 1572 // Removing the duplicate handler has no effect. |
| 1569 document->didRemoveTouchEventHandler(document); | 1573 registry->didRemoveEventHandler(*document, touchEvent); |
| 1570 EXPECT_EQ(0, client.getAndResetHasTouchEventHandlerCallCount(false)); | 1574 EXPECT_EQ(0, client.getAndResetHasTouchEventHandlerCallCount(false)); |
| 1571 EXPECT_EQ(0, client.getAndResetHasTouchEventHandlerCallCount(true)); | 1575 EXPECT_EQ(0, client.getAndResetHasTouchEventHandlerCallCount(true)); |
| 1572 | 1576 |
| 1573 // Removing the final handler results in a no-handlers call. | 1577 // Removing the final handler results in a no-handlers call. |
| 1574 document->didRemoveTouchEventHandler(document); | 1578 registry->didRemoveEventHandler(*document, touchEvent); |
| 1575 EXPECT_EQ(1, client.getAndResetHasTouchEventHandlerCallCount(false)); | 1579 EXPECT_EQ(1, client.getAndResetHasTouchEventHandlerCallCount(false)); |
| 1576 EXPECT_EQ(0, client.getAndResetHasTouchEventHandlerCallCount(true)); | 1580 EXPECT_EQ(0, client.getAndResetHasTouchEventHandlerCallCount(true)); |
| 1577 | 1581 |
| 1578 // Adding a handler on a div results in a has-handlers call. | 1582 // Adding a handler on a div results in a has-handlers call. |
| 1579 WebCore::Element* parentDiv = document->getElementById("parentdiv"); | 1583 WebCore::Element* parentDiv = document->getElementById("parentdiv"); |
| 1580 ASSERT(parentDiv); | 1584 ASSERT(parentDiv); |
| 1581 document->didAddTouchEventHandler(parentDiv); | 1585 registry->didAddEventHandler(*parentDiv, touchEvent); |
| 1582 EXPECT_EQ(0, client.getAndResetHasTouchEventHandlerCallCount(false)); | 1586 EXPECT_EQ(0, client.getAndResetHasTouchEventHandlerCallCount(false)); |
| 1583 EXPECT_EQ(1, client.getAndResetHasTouchEventHandlerCallCount(true)); | 1587 EXPECT_EQ(1, client.getAndResetHasTouchEventHandlerCallCount(true)); |
| 1584 | 1588 |
| 1585 // Adding a duplicate handler on the div, clearing all document handlers | 1589 // Adding a duplicate handler on the div, clearing all document handlers |
| 1586 // (of which there are none) and removing the extra handler on the div | 1590 // (of which there are none) and removing the extra handler on the div |
| 1587 // all have no effect. | 1591 // all have no effect. |
| 1588 document->didAddTouchEventHandler(parentDiv); | 1592 registry->didAddEventHandler(*parentDiv, touchEvent); |
| 1589 document->didClearTouchEventHandlers(document); | 1593 registry->didRemoveAllEventHandlers(*document); |
| 1590 document->didRemoveTouchEventHandler(parentDiv); | 1594 registry->didRemoveEventHandler(*parentDiv, touchEvent); |
| 1591 EXPECT_EQ(0, client.getAndResetHasTouchEventHandlerCallCount(false)); | 1595 EXPECT_EQ(0, client.getAndResetHasTouchEventHandlerCallCount(false)); |
| 1592 EXPECT_EQ(0, client.getAndResetHasTouchEventHandlerCallCount(true)); | 1596 EXPECT_EQ(0, client.getAndResetHasTouchEventHandlerCallCount(true)); |
| 1593 | 1597 |
| 1594 // Removing the final handler on the div results in a no-handlers call. | 1598 // Removing the final handler on the div results in a no-handlers call. |
| 1595 document->didRemoveTouchEventHandler(parentDiv); | 1599 registry->didRemoveEventHandler(*parentDiv, touchEvent); |
| 1596 EXPECT_EQ(1, client.getAndResetHasTouchEventHandlerCallCount(false)); | 1600 EXPECT_EQ(1, client.getAndResetHasTouchEventHandlerCallCount(false)); |
| 1597 EXPECT_EQ(0, client.getAndResetHasTouchEventHandlerCallCount(true)); | 1601 EXPECT_EQ(0, client.getAndResetHasTouchEventHandlerCallCount(true)); |
| 1598 | 1602 |
| 1599 // Adding two handlers then clearing them in a single call results in a | 1603 // Adding two handlers then clearing them in a single call results in a |
| 1600 // has-handlers then no-handlers call. | 1604 // has-handlers then no-handlers call. |
| 1601 document->didAddTouchEventHandler(parentDiv); | 1605 registry->didAddEventHandler(*parentDiv, touchEvent); |
| 1602 EXPECT_EQ(0, client.getAndResetHasTouchEventHandlerCallCount(false)); | 1606 EXPECT_EQ(0, client.getAndResetHasTouchEventHandlerCallCount(false)); |
| 1603 EXPECT_EQ(1, client.getAndResetHasTouchEventHandlerCallCount(true)); | 1607 EXPECT_EQ(1, client.getAndResetHasTouchEventHandlerCallCount(true)); |
| 1604 document->didAddTouchEventHandler(parentDiv); | 1608 registry->didAddEventHandler(*parentDiv, touchEvent); |
| 1605 EXPECT_EQ(0, client.getAndResetHasTouchEventHandlerCallCount(false)); | 1609 EXPECT_EQ(0, client.getAndResetHasTouchEventHandlerCallCount(false)); |
| 1606 EXPECT_EQ(0, client.getAndResetHasTouchEventHandlerCallCount(true)); | 1610 EXPECT_EQ(0, client.getAndResetHasTouchEventHandlerCallCount(true)); |
| 1607 document->didClearTouchEventHandlers(parentDiv); | 1611 registry->didRemoveAllEventHandlers(*parentDiv); |
| 1608 EXPECT_EQ(1, client.getAndResetHasTouchEventHandlerCallCount(false)); | 1612 EXPECT_EQ(1, client.getAndResetHasTouchEventHandlerCallCount(false)); |
| 1609 EXPECT_EQ(0, client.getAndResetHasTouchEventHandlerCallCount(true)); | 1613 EXPECT_EQ(0, client.getAndResetHasTouchEventHandlerCallCount(true)); |
| 1614 } |
| 1615 |
| 1616 TEST_F(WebViewTest, HasTouchEventHandlersInChildDocument) |
| 1617 { |
| 1618 TouchEventHandlerWebViewClient client; |
| 1619 std::string url = m_baseURL + "has_touch_event_handlers.html"; |
| 1620 URLTestHelpers::registerMockedURLLoad(toKURL(url), "has_touch_event_handlers
.html"); |
| 1621 WebViewImpl* webViewImpl = m_webViewHelper.initializeAndLoad(url, true, 0, &
client); |
| 1622 const WebCore::EventHandlerRegistry::EventHandlerClass touchEvent = WebCore:
:EventHandlerRegistry::TouchEvent; |
| 1623 |
| 1624 // The page is initialized with at least one no-handlers call. |
| 1625 // In practice we get two such calls because WebViewHelper::initializeAndLoa
d first |
| 1626 // initializes and empty frame, and then loads a document into it, so there
are two |
| 1627 // FrameLoader::commitProvisionalLoad calls. |
| 1628 EXPECT_GE(client.getAndResetHasTouchEventHandlerCallCount(false), 1); |
| 1629 EXPECT_EQ(0, client.getAndResetHasTouchEventHandlerCallCount(true)); |
| 1610 | 1630 |
| 1611 // Adding a handler inside of a child iframe results in a has-handlers call. | 1631 // Adding a handler inside of a child iframe results in a has-handlers call. |
| 1632 WebCore::Document* document = webViewImpl->mainFrameImpl()->frame()->documen
t(); |
| 1633 WebCore::EventHandlerRegistry* registry = WebCore::EventHandlerRegistry::fro
m(*document); |
| 1612 WebCore::Element* childFrame = document->getElementById("childframe"); | 1634 WebCore::Element* childFrame = document->getElementById("childframe"); |
| 1613 ASSERT(childFrame); | 1635 ASSERT(childFrame); |
| 1614 WebCore::Document* childDocument = toHTMLIFrameElement(childFrame)->contentD
ocument(); | 1636 WebCore::Document* childDocument = toHTMLIFrameElement(childFrame)->contentD
ocument(); |
| 1637 WebCore::EventHandlerRegistry* childRegistry = WebCore::EventHandlerRegistry
::from(*childDocument); |
| 1615 WebCore::Element* childDiv = childDocument->getElementById("childdiv"); | 1638 WebCore::Element* childDiv = childDocument->getElementById("childdiv"); |
| 1616 ASSERT(childDiv); | 1639 ASSERT(childDiv); |
| 1617 childDocument->didAddTouchEventHandler(childDiv); | 1640 childRegistry->didAddEventHandler(*childDiv, touchEvent); |
| 1618 EXPECT_EQ(0, client.getAndResetHasTouchEventHandlerCallCount(false)); | 1641 EXPECT_EQ(0, client.getAndResetHasTouchEventHandlerCallCount(false)); |
| 1619 EXPECT_EQ(1, client.getAndResetHasTouchEventHandlerCallCount(true)); | 1642 EXPECT_EQ(1, client.getAndResetHasTouchEventHandlerCallCount(true)); |
| 1620 | 1643 |
| 1621 // Adding and clearing handlers in the parent doc or elsewhere in the child
doc | 1644 // Adding and clearing handlers in the parent doc or elsewhere in the child
doc |
| 1622 // has no impact. | 1645 // has no impact. |
| 1623 document->didAddTouchEventHandler(document); | 1646 registry->didAddEventHandler(*document, touchEvent); |
| 1624 document->didAddTouchEventHandler(childFrame); | 1647 registry->didAddEventHandler(*childFrame, touchEvent); |
| 1625 childDocument->didAddTouchEventHandler(childDocument); | 1648 childRegistry->didAddEventHandler(*childDocument, touchEvent); |
| 1626 document->didClearTouchEventHandlers(document); | 1649 registry->didRemoveAllEventHandlers(*document); |
| 1627 document->didClearTouchEventHandlers(childFrame); | 1650 registry->didRemoveAllEventHandlers(*childFrame); |
| 1628 childDocument->didClearTouchEventHandlers(childDocument); | 1651 childRegistry->didRemoveAllEventHandlers(*childDocument); |
| 1629 EXPECT_EQ(0, client.getAndResetHasTouchEventHandlerCallCount(false)); | 1652 EXPECT_EQ(0, client.getAndResetHasTouchEventHandlerCallCount(false)); |
| 1630 EXPECT_EQ(0, client.getAndResetHasTouchEventHandlerCallCount(true)); | 1653 EXPECT_EQ(0, client.getAndResetHasTouchEventHandlerCallCount(true)); |
| 1631 | 1654 |
| 1632 // Removing the final handler inside the child frame results in a no-handler
s call. | 1655 // Removing the final handler inside the child frame results in a no-handler
s call. |
| 1633 childDocument->didRemoveTouchEventHandler(childDiv); | 1656 childRegistry->didRemoveAllEventHandlers(*childDiv); |
| 1634 EXPECT_EQ(1, client.getAndResetHasTouchEventHandlerCallCount(false)); | 1657 EXPECT_EQ(1, client.getAndResetHasTouchEventHandlerCallCount(false)); |
| 1635 EXPECT_EQ(0, client.getAndResetHasTouchEventHandlerCallCount(true)); | 1658 EXPECT_EQ(0, client.getAndResetHasTouchEventHandlerCallCount(true)); |
| 1636 | 1659 |
| 1637 // Adding a handler inside the child frame results in a has-handlers call. | 1660 // Adding a handler inside the child frame results in a has-handlers call. |
| 1638 childDocument->didAddTouchEventHandler(childDocument); | 1661 childRegistry->didAddEventHandler(*childDocument, touchEvent); |
| 1639 EXPECT_EQ(0, client.getAndResetHasTouchEventHandlerCallCount(false)); | 1662 EXPECT_EQ(0, client.getAndResetHasTouchEventHandlerCallCount(false)); |
| 1640 EXPECT_EQ(1, client.getAndResetHasTouchEventHandlerCallCount(true)); | 1663 EXPECT_EQ(1, client.getAndResetHasTouchEventHandlerCallCount(true)); |
| 1641 | 1664 |
| 1642 // Adding a handler in the parent document and removing the one in the frame | 1665 // Adding a handler in the parent document and removing the one in the frame |
| 1643 // has no effect. | 1666 // has no effect. |
| 1644 document->didAddTouchEventHandler(childFrame); | 1667 registry->didAddEventHandler(*childFrame, touchEvent); |
| 1645 childDocument->didRemoveTouchEventHandler(childDocument); | 1668 childRegistry->didRemoveEventHandler(*childDocument, touchEvent); |
| 1646 childDocument->didClearTouchEventHandlers(childDocument); | 1669 childRegistry->didRemoveAllEventHandlers(*childDocument); |
| 1647 document->didClearTouchEventHandlers(document); | 1670 registry->didRemoveAllEventHandlers(*document); |
| 1648 EXPECT_EQ(0, client.getAndResetHasTouchEventHandlerCallCount(false)); | 1671 EXPECT_EQ(0, client.getAndResetHasTouchEventHandlerCallCount(false)); |
| 1649 EXPECT_EQ(0, client.getAndResetHasTouchEventHandlerCallCount(true)); | 1672 EXPECT_EQ(0, client.getAndResetHasTouchEventHandlerCallCount(true)); |
| 1650 | 1673 |
| 1651 // Now removing the handler in the parent document results in a no-handlers
call. | 1674 // Now removing the handler in the parent document results in a no-handlers
call. |
| 1652 document->didRemoveTouchEventHandler(childFrame); | 1675 registry->didRemoveEventHandler(*childFrame, touchEvent); |
| 1653 EXPECT_EQ(1, client.getAndResetHasTouchEventHandlerCallCount(false)); | 1676 EXPECT_EQ(1, client.getAndResetHasTouchEventHandlerCallCount(false)); |
| 1654 EXPECT_EQ(0, client.getAndResetHasTouchEventHandlerCallCount(true)); | 1677 EXPECT_EQ(0, client.getAndResetHasTouchEventHandlerCallCount(true)); |
| 1655 } | 1678 } |
| 1679 |
| 1680 // This test verifies that WebWidgetClient::hasTouchEventHandlers is called |
| 1681 // accordingly for various calls to EventHandlerRegistry::did{Add|Remove| |
| 1682 // RemoveAll}ExternalEventHandler(TouchEvent). |
| 1683 TEST_F(WebViewTest, HasExternalTouchEventHandlers) |
| 1684 { |
| 1685 TouchEventHandlerWebViewClient client; |
| 1686 WebViewImpl* webViewImpl = m_webViewHelper.initializeAndLoad("about:blank",
true, 0, &client); |
| 1687 const AtomicString& touchstart = WebCore::EventTypeNames::touchstart; |
| 1688 |
| 1689 // See comment in WebViewTest::HasTouchHandlers. |
| 1690 EXPECT_GE(client.getAndResetHasTouchEventHandlerCallCount(false), 1); |
| 1691 EXPECT_EQ(0, client.getAndResetHasTouchEventHandlerCallCount(true)); |
| 1692 |
| 1693 // Adding the first document handler results in a has-handlers call. |
| 1694 WebCore::Document* document = webViewImpl->mainFrameImpl()->frame()->documen
t(); |
| 1695 WebCore::EventHandlerRegistry* registry = WebCore::EventHandlerRegistry::fro
m(*document); |
| 1696 registry->didAddExternalEventHandler(touchstart); |
| 1697 EXPECT_EQ(0, client.getAndResetHasTouchEventHandlerCallCount(false)); |
| 1698 EXPECT_EQ(1, client.getAndResetHasTouchEventHandlerCallCount(true)); |
| 1699 |
| 1700 // Adding another handler has no effect. |
| 1701 registry->didAddExternalEventHandler(touchstart); |
| 1702 EXPECT_EQ(0, client.getAndResetHasTouchEventHandlerCallCount(false)); |
| 1703 EXPECT_EQ(0, client.getAndResetHasTouchEventHandlerCallCount(true)); |
| 1704 |
| 1705 // Removing the duplicate handler has no effect. |
| 1706 registry->didRemoveExternalEventHandler(touchstart); |
| 1707 EXPECT_EQ(0, client.getAndResetHasTouchEventHandlerCallCount(false)); |
| 1708 EXPECT_EQ(0, client.getAndResetHasTouchEventHandlerCallCount(true)); |
| 1709 |
| 1710 // Removing the final handler results in a no-handlers call. |
| 1711 registry->didRemoveExternalEventHandler(touchstart); |
| 1712 EXPECT_EQ(1, client.getAndResetHasTouchEventHandlerCallCount(false)); |
| 1713 EXPECT_EQ(0, client.getAndResetHasTouchEventHandlerCallCount(true)); |
| 1714 } |
| 1656 | 1715 |
| 1657 static WebRect ExpectedRootBounds(WebCore::Document* document, float scaleFactor
) | 1716 static WebRect ExpectedRootBounds(WebCore::Document* document, float scaleFactor
) |
| 1658 { | 1717 { |
| 1659 WebCore::Element* element = document->getElementById("root"); | 1718 WebCore::Element* element = document->getElementById("root"); |
| 1660 if (!element) | 1719 if (!element) |
| 1661 element = document->getElementById("target"); | 1720 element = document->getElementById("target"); |
| 1662 if (element->hasTagName(WebCore::HTMLNames::iframeTag)) | 1721 if (element->hasTagName(WebCore::HTMLNames::iframeTag)) |
| 1663 return ExpectedRootBounds(toHTMLIFrameElement(element)->contentDocument(
), scaleFactor); | 1722 return ExpectedRootBounds(toHTMLIFrameElement(element)->contentDocument(
), scaleFactor); |
| 1664 | 1723 |
| 1665 WebCore::IntRect boundingBox = element->pixelSnappedBoundingBox(); | 1724 WebCore::IntRect boundingBox = element->pixelSnappedBoundingBox(); |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1840 client.reset(); | 1899 client.reset(); |
| 1841 EXPECT_FALSE(client.textIsUpdated()); | 1900 EXPECT_FALSE(client.textIsUpdated()); |
| 1842 document->setFocusedElement(nullptr); | 1901 document->setFocusedElement(nullptr); |
| 1843 webViewImpl->setFocus(false); | 1902 webViewImpl->setFocus(false); |
| 1844 EXPECT_NE(document->focusedElement(), static_cast<WebCore::Element*>(textAre
aElement)); | 1903 EXPECT_NE(document->focusedElement(), static_cast<WebCore::Element*>(textAre
aElement)); |
| 1845 inputElement->setValue("testB3"); | 1904 inputElement->setValue("testB3"); |
| 1846 EXPECT_FALSE(client.textIsUpdated()); | 1905 EXPECT_FALSE(client.textIsUpdated()); |
| 1847 } | 1906 } |
| 1848 | 1907 |
| 1849 } // namespace | 1908 } // namespace |
| OLD | NEW |