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

Unified Diff: Source/core/html/HTMLOptionElement.cpp

Issue 415343003: Option Groups with display: none should not show the children option elements (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 4 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
Index: Source/core/html/HTMLOptionElement.cpp
diff --git a/Source/core/html/HTMLOptionElement.cpp b/Source/core/html/HTMLOptionElement.cpp
index a02a889367e73b3afbc50809de3ccd44a1c21b21..bddd0e0e142b8fccb468a1663682a1701874c1d8 100644
--- a/Source/core/html/HTMLOptionElement.cpp
+++ b/Source/core/html/HTMLOptionElement.cpp
@@ -397,4 +397,18 @@ bool HTMLOptionElement::spatialNavigationFocused() const
return select->spatialNavigationFocusedOption() == this;
}
+bool HTMLOptionElement::isDisplayNone()
+{
+ RenderStyle* style = renderStyle() ? renderStyle() : computedStyle();
+ if (style && style->display() != NONE) {
+ HTMLElement* parent = Traversal<HTMLElement>::firstAncestor(*this);
keishi 2014/08/06 03:00:20 I don't think we need to traverse. Options that ar
spartha 2014/08/06 06:23:02 The spec says "In HTML 4, all OPTGROUP elements mu
spartha 2014/08/06 08:13:31 Avoided calling the Traversal On 2014/08/06 03:00:
+ ASSERT(parent);
+ if (isHTMLOptGroupElement(*parent)) {
+ RenderStyle* parentStyle = parent->renderStyle() ? parent->renderStyle() : parent->computedStyle();
+ return !parentStyle || parentStyle->display() == NONE;
+ }
+ }
+ return !style || style->display() == NONE;
+}
+
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698