| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). | 2 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
| 3 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 3 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 4 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 4 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
| 5 * (C) 2001 Dirk Mueller (mueller@kde.org) | 5 * (C) 2001 Dirk Mueller (mueller@kde.org) |
| 6 * Copyright (C) 2004, 2005, 2006, 2007, 2009, 2010, 2011 Apple Inc. All rights
reserved. | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2009, 2010, 2011 Apple Inc. All rights
reserved. |
| 7 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) | 7 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) |
| 8 * Copyright (C) 2010 Google Inc. All rights reserved. | 8 * Copyright (C) 2010 Google Inc. All rights reserved. |
| 9 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) | 9 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) |
| 10 * | 10 * |
| (...skipping 1804 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1815 if (const ComputedStyle* style = itemComputedStyle(element)) | 1815 if (const ComputedStyle* style = itemComputedStyle(element)) |
| 1816 return style->display() == NONE; | 1816 return style->display() == NONE; |
| 1817 return false; | 1817 return false; |
| 1818 } | 1818 } |
| 1819 | 1819 |
| 1820 const ComputedStyle* HTMLSelectElement::itemComputedStyle(Element& element) cons
t | 1820 const ComputedStyle* HTMLSelectElement::itemComputedStyle(Element& element) cons
t |
| 1821 { | 1821 { |
| 1822 return element.computedStyle() ? element.computedStyle() : element.ensureCom
putedStyle(); | 1822 return element.computedStyle() ? element.computedStyle() : element.ensureCom
putedStyle(); |
| 1823 } | 1823 } |
| 1824 | 1824 |
| 1825 IntRect HTMLSelectElement::elementRectRelativeToViewport() const | |
| 1826 { | |
| 1827 if (!layoutObject()) | |
| 1828 return IntRect(); | |
| 1829 // Initialize with this frame rectangle relative to the viewport. | |
| 1830 IntRect rect = document().view()->convertToRootFrame(document().view()->boun
dsRect()); | |
| 1831 // We don't use absoluteBoundingBoxRect() because it can return an IntRect | |
| 1832 // larger the actual size by 1px. | |
| 1833 rect.intersect(document().view()->contentsToViewport(roundedIntRect(layoutOb
ject()->absoluteBoundingBoxFloatRect()))); | |
| 1834 return rect; | |
| 1835 } | |
| 1836 | |
| 1837 LayoutUnit HTMLSelectElement::clientPaddingLeft() const | 1825 LayoutUnit HTMLSelectElement::clientPaddingLeft() const |
| 1838 { | 1826 { |
| 1839 if (layoutObject() && layoutObject()->isMenuList()) | 1827 if (layoutObject() && layoutObject()->isMenuList()) |
| 1840 return toLayoutMenuList(layoutObject())->clientPaddingLeft(); | 1828 return toLayoutMenuList(layoutObject())->clientPaddingLeft(); |
| 1841 return LayoutUnit(); | 1829 return LayoutUnit(); |
| 1842 } | 1830 } |
| 1843 | 1831 |
| 1844 LayoutUnit HTMLSelectElement::clientPaddingRight() const | 1832 LayoutUnit HTMLSelectElement::clientPaddingRight() const |
| 1845 { | 1833 { |
| 1846 if (layoutObject() && layoutObject()->isMenuList()) | 1834 if (layoutObject() && layoutObject()->isMenuList()) |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1913 } | 1901 } |
| 1914 | 1902 |
| 1915 void HTMLSelectElement::showPopup() | 1903 void HTMLSelectElement::showPopup() |
| 1916 { | 1904 { |
| 1917 if (popupIsVisible()) | 1905 if (popupIsVisible()) |
| 1918 return; | 1906 return; |
| 1919 if (document().frameHost()->chromeClient().hasOpenedPopup()) | 1907 if (document().frameHost()->chromeClient().hasOpenedPopup()) |
| 1920 return; | 1908 return; |
| 1921 if (!layoutObject() || !layoutObject()->isMenuList()) | 1909 if (!layoutObject() || !layoutObject()->isMenuList()) |
| 1922 return; | 1910 return; |
| 1923 // Disable visibility check on Android. elementRectRelativeToViewport() | 1911 if (visibleBoundsInVisualViewport().isEmpty()) |
| 1924 // doesn't work well on Android WebView. crbug.com/632561 | |
| 1925 #if !OS(ANDROID) | |
| 1926 if (elementRectRelativeToViewport().isEmpty()) | |
| 1927 return; | 1912 return; |
| 1928 #endif | |
| 1929 | 1913 |
| 1930 if (!m_popup) | 1914 if (!m_popup) |
| 1931 m_popup = document().frameHost()->chromeClient().openPopupMenu(*document
().frame(), *this); | 1915 m_popup = document().frameHost()->chromeClient().openPopupMenu(*document
().frame(), *this); |
| 1932 m_popupIsVisible = true; | 1916 m_popupIsVisible = true; |
| 1933 observeTreeMutation(); | 1917 observeTreeMutation(); |
| 1934 | 1918 |
| 1935 LayoutMenuList* menuList = toLayoutMenuList(layoutObject()); | 1919 LayoutMenuList* menuList = toLayoutMenuList(layoutObject()); |
| 1936 m_popup->show(); | 1920 m_popup->show(); |
| 1937 if (AXObjectCache* cache = document().existingAXObjectCache()) | 1921 if (AXObjectCache* cache = document().existingAXObjectCache()) |
| 1938 cache->didShowMenuListPopup(menuList); | 1922 cache->didShowMenuListPopup(menuList); |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2039 } | 2023 } |
| 2040 | 2024 |
| 2041 void HTMLSelectElement::didMutateSubtree() | 2025 void HTMLSelectElement::didMutateSubtree() |
| 2042 { | 2026 { |
| 2043 DCHECK(popupIsVisible()); | 2027 DCHECK(popupIsVisible()); |
| 2044 DCHECK(m_popup); | 2028 DCHECK(m_popup); |
| 2045 m_popup->updateFromElement(PopupMenu::ByDOMChange); | 2029 m_popup->updateFromElement(PopupMenu::ByDOMChange); |
| 2046 } | 2030 } |
| 2047 | 2031 |
| 2048 } // namespace blink | 2032 } // namespace blink |
| OLD | NEW |