Title: [222621] trunk/Source/WebCore
Revision
222621
Author
za...@apple.com
Date
2017-09-28 11:50:05 -0700 (Thu, 28 Sep 2017)

Log Message

Small cleanup in RenderMenuList::didUpdateActiveOption
https://bugs.webkit.org/show_bug.cgi?id=177610

Reviewed by Dean Jackson.

No change in functionality.

* rendering/RenderMenuList.cpp:
(WebCore::RenderMenuList::RenderMenuList):
(RenderMenuList::didUpdateActiveOption):
* rendering/RenderMenuList.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (222620 => 222621)


--- trunk/Source/WebCore/ChangeLog	2017-09-28 18:40:41 UTC (rev 222620)
+++ trunk/Source/WebCore/ChangeLog	2017-09-28 18:50:05 UTC (rev 222621)
@@ -1,3 +1,17 @@
+2017-09-28  Zalan Bujtas  <za...@apple.com>
+
+        Small cleanup in RenderMenuList::didUpdateActiveOption
+        https://bugs.webkit.org/show_bug.cgi?id=177610
+
+        Reviewed by Dean Jackson.
+
+        No change in functionality.
+
+        * rendering/RenderMenuList.cpp:
+        (WebCore::RenderMenuList::RenderMenuList):
+        (RenderMenuList::didUpdateActiveOption):
+        * rendering/RenderMenuList.h:
+
 2017-09-28  Ross Kirsling  <ross.kirsl...@sony.com>
 
         [PAL] Move HysteresisActivity into PAL

Modified: trunk/Source/WebCore/rendering/RenderMenuList.cpp (222620 => 222621)


--- trunk/Source/WebCore/rendering/RenderMenuList.cpp	2017-09-28 18:40:41 UTC (rev 222620)
+++ trunk/Source/WebCore/rendering/RenderMenuList.cpp	2017-09-28 18:50:05 UTC (rev 222621)
@@ -75,7 +75,6 @@
     , m_innerBlock(nullptr)
     , m_needsOptionsWidthUpdate(true)
     , m_optionsWidth(0)
-    , m_lastActiveIndex(-1)
 #if !PLATFORM(IOS)
     , m_popupIsVisible(false)
 #endif
@@ -422,11 +421,15 @@
 
 void RenderMenuList::didUpdateActiveOption(int optionIndex)
 {
-    if (!AXObjectCache::accessibilityEnabled() || !document().existingAXObjectCache())
+    if (!AXObjectCache::accessibilityEnabled())
         return;
 
-    if (m_lastActiveIndex == optionIndex)
+    auto* axCache = document().existingAXObjectCache();
+    if (!axCache)
         return;
+
+    if (m_lastActiveIndex && *m_lastActiveIndex == optionIndex)
+        return;
     m_lastActiveIndex = optionIndex;
 
     int listIndex = selectElement().optionToListIndex(optionIndex);
@@ -433,10 +436,8 @@
     if (listIndex < 0 || listIndex >= static_cast<int>(selectElement().listItems().size()))
         return;
 
-    if (AXObjectCache* cache = document().existingAXObjectCache()) {
-        if (AccessibilityMenuList* menuList = downcast<AccessibilityMenuList>(cache->get(this)))
-            menuList->didUpdateActiveOption(optionIndex);
-    }
+    if (AccessibilityMenuList* menuList = downcast<AccessibilityMenuList>(axCache->get(this)))
+        menuList->didUpdateActiveOption(optionIndex);
 }
 
 String RenderMenuList::itemText(unsigned listIndex) const

Modified: trunk/Source/WebCore/rendering/RenderMenuList.h (222620 => 222621)


--- trunk/Source/WebCore/rendering/RenderMenuList.h	2017-09-28 18:40:41 UTC (rev 222620)
+++ trunk/Source/WebCore/rendering/RenderMenuList.h	2017-09-28 18:50:05 UTC (rev 222621)
@@ -143,7 +143,7 @@
     bool m_needsOptionsWidthUpdate;
     int m_optionsWidth;
 
-    int m_lastActiveIndex;
+    std::optional<int> m_lastActiveIndex;
 
     std::unique_ptr<RenderStyle> m_optionStyle;
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to