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

Unified Diff: third_party/WebKit/Source/web/ExternalPopupMenu.cpp

Issue 1970653003: ExternalPopupMenu should recreate its popup only if a SELECT subtree is updated (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add an enum argument to updateFromElement 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/web/ExternalPopupMenu.h ('k') | third_party/WebKit/Source/web/PopupMenuImpl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/web/ExternalPopupMenu.cpp
diff --git a/third_party/WebKit/Source/web/ExternalPopupMenu.cpp b/third_party/WebKit/Source/web/ExternalPopupMenu.cpp
index 32b217e9cf6e0236efb2c97f96220a4d275b86ac..337f4a9b07e614b06bad820cff6e17f7fca8ec1a 100644
--- a/third_party/WebKit/Source/web/ExternalPopupMenu.cpp
+++ b/third_party/WebKit/Source/web/ExternalPopupMenu.cpp
@@ -95,10 +95,7 @@ bool ExternalPopupMenu::showInternal()
FloatQuad quad(toLayoutBox(layoutObject)->localToAbsoluteQuad(FloatQuad(toLayoutBox(layoutObject)->borderBoundingBox())));
IntRect rect(quad.enclosingBoundingBox());
IntRect rectInViewport = m_localFrame->view()->soonToBeRemovedContentsToUnscaledViewport(rect);
- // TODO(tkent): If the anchor rectangle is not visible, we should not
- // show a popup.
m_webExternalPopupMenu->show(rectInViewport);
- m_shownDOMTreeVersion = m_ownerElement->document().domTreeVersion();
return true;
} else {
// The client might refuse to create a popup (when there is already one pending to be shown for example).
@@ -142,17 +139,23 @@ void ExternalPopupMenu::hide()
m_webExternalPopupMenu = 0;
}
-void ExternalPopupMenu::updateFromElement()
+void ExternalPopupMenu::updateFromElement(UpdateReason reason)
{
- if (m_needsUpdate)
- return;
- // TOOD(tkent): Even if DOMTreeVersion is not changed, we should update the
- // popup location/content in some cases. e.g. Updating ComputedStyle of the
- // SELECT element affects popup position and OPTION style.
- if (m_shownDOMTreeVersion == m_ownerElement->document().domTreeVersion())
- return;
- m_needsUpdate = true;
- m_ownerElement->document().postTask(BLINK_FROM_HERE, createSameThreadTask(&ExternalPopupMenu::update, this));
+ switch (reason) {
+ case BySelectionChange:
+ case ByDOMChange:
+ if (m_needsUpdate)
+ return;
+ m_needsUpdate = true;
+ m_ownerElement->document().postTask(BLINK_FROM_HERE, createSameThreadTask(&ExternalPopupMenu::update, this));
+ break;
+
+ case ByStyleChange:
+ // TOOD(tkent): We should update the popup location/content in some
+ // cases. e.g. Updating ComputedStyle of the SELECT element affects
+ // popup position and OPTION style.
+ break;
+ }
}
void ExternalPopupMenu::update()
« no previous file with comments | « third_party/WebKit/Source/web/ExternalPopupMenu.h ('k') | third_party/WebKit/Source/web/PopupMenuImpl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698