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

Side by Side Diff: third_party/WebKit/Source/core/html/HTMLSelectElement.cpp

Issue 2001453002: Set ComputedStyle on Node and use that in buildOwnLayout() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@storage
Patch Set: Created 4 years, 5 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 unified diff | Download patch
OLDNEW
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 409 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 420
421 HTMLOptionsCollection* HTMLSelectElement::options() 421 HTMLOptionsCollection* HTMLSelectElement::options()
422 { 422 {
423 return ensureCachedCollection<HTMLOptionsCollection>(SelectOptions); 423 return ensureCachedCollection<HTMLOptionsCollection>(SelectOptions);
424 } 424 }
425 425
426 void HTMLSelectElement::optionElementChildrenChanged(const HTMLOptionElement& op tion) 426 void HTMLSelectElement::optionElementChildrenChanged(const HTMLOptionElement& op tion)
427 { 427 {
428 setNeedsValidityCheck(); 428 setNeedsValidityCheck();
429 429
430 if (layoutObject()) { 430 if (hasLayoutObject()) {
431 if (option.selected() && usesMenuList()) 431 if (option.selected() && usesMenuList())
432 layoutObject()->updateFromElement(); 432 layoutObject()->updateFromElement();
433 if (AXObjectCache* cache = layoutObject()->document().existingAXObjectCa che()) 433 if (AXObjectCache* cache = layoutObject()->document().existingAXObjectCa che())
434 cache->childrenChanged(this); 434 cache->childrenChanged(this);
435 } 435 }
436 } 436 }
437 437
438 void HTMLSelectElement::accessKeyAction(bool sendMouseEvents) 438 void HTMLSelectElement::accessKeyAction(bool sendMouseEvents)
439 { 439 {
440 focus(); 440 focus();
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after
826 } 826 }
827 m_shouldRecalcListItems = shouldRecalc; 827 m_shouldRecalcListItems = shouldRecalc;
828 828
829 setOptionsChangedOnLayoutObject(); 829 setOptionsChangedOnLayoutObject();
830 if (!inShadowIncludingDocument()) { 830 if (!inShadowIncludingDocument()) {
831 if (HTMLOptionsCollection* collection = cachedCollection<HTMLOptionsColl ection>(SelectOptions)) 831 if (HTMLOptionsCollection* collection = cachedCollection<HTMLOptionsColl ection>(SelectOptions))
832 collection->invalidateCache(); 832 collection->invalidateCache();
833 invalidateSelectedItems(); 833 invalidateSelectedItems();
834 } 834 }
835 835
836 if (layoutObject()) { 836 if (hasLayoutObject()) {
837 if (AXObjectCache* cache = layoutObject()->document().existingAXObjectCa che()) 837 if (AXObjectCache* cache = layoutObject()->document().existingAXObjectCa che())
838 cache->childrenChanged(this); 838 cache->childrenChanged(this);
839 } 839 }
840 } 840 }
841 841
842 void HTMLSelectElement::recalcListItems() const 842 void HTMLSelectElement::recalcListItems() const
843 { 843 {
844 TRACE_EVENT0("blink", "HTMLSelectElement::recalcListItems"); 844 TRACE_EVENT0("blink", "HTMLSelectElement::recalcListItems");
845 m_listItems.resize(0); 845 m_listItems.resize(0);
846 846
(...skipping 1065 matching lines...) Expand 10 before | Expand all | Expand 10 after
1912 } 1912 }
1913 1913
1914 String HTMLSelectElement::itemText(const Element& element) const 1914 String HTMLSelectElement::itemText(const Element& element) const
1915 { 1915 {
1916 String itemString; 1916 String itemString;
1917 if (isHTMLOptGroupElement(element)) 1917 if (isHTMLOptGroupElement(element))
1918 itemString = toHTMLOptGroupElement(element).groupLabelText(); 1918 itemString = toHTMLOptGroupElement(element).groupLabelText();
1919 else if (isHTMLOptionElement(element)) 1919 else if (isHTMLOptionElement(element))
1920 itemString = toHTMLOptionElement(element).textIndentedToRespectGroupLabe l(); 1920 itemString = toHTMLOptionElement(element).textIndentedToRespectGroupLabe l();
1921 1921
1922 if (layoutObject()) 1922 if (hasLayoutObject())
1923 applyTextTransform(layoutObject()->style(), itemString, ' '); 1923 applyTextTransform(layoutObject()->style(), itemString, ' ');
1924 return itemString; 1924 return itemString;
1925 } 1925 }
1926 1926
1927 bool HTMLSelectElement::itemIsDisplayNone(Element& element) const 1927 bool HTMLSelectElement::itemIsDisplayNone(Element& element) const
1928 { 1928 {
1929 if (isHTMLOptionElement(element)) 1929 if (isHTMLOptionElement(element))
1930 return toHTMLOptionElement(element).isDisplayNone(); 1930 return toHTMLOptionElement(element).isDisplayNone();
1931 if (const ComputedStyle* style = itemComputedStyle(element)) 1931 if (const ComputedStyle* style = itemComputedStyle(element))
1932 return style->display() == NONE; 1932 return style->display() == NONE;
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
1970 unobserveTreeMutation(); 1970 unobserveTreeMutation();
1971 if (AXObjectCache* cache = document().existingAXObjectCache()) { 1971 if (AXObjectCache* cache = document().existingAXObjectCache()) {
1972 if (layoutObject() && layoutObject()->isMenuList()) 1972 if (layoutObject() && layoutObject()->isMenuList())
1973 cache->didHideMenuListPopup(toLayoutMenuList(layoutObject())); 1973 cache->didHideMenuListPopup(toLayoutMenuList(layoutObject()));
1974 } 1974 }
1975 } 1975 }
1976 1976
1977 void HTMLSelectElement::setIndexToSelectOnCancel(int listIndex) 1977 void HTMLSelectElement::setIndexToSelectOnCancel(int listIndex)
1978 { 1978 {
1979 m_indexToSelectOnCancel = listIndex; 1979 m_indexToSelectOnCancel = listIndex;
1980 if (layoutObject()) 1980 if (hasLayoutObject())
1981 layoutObject()->updateFromElement(); 1981 layoutObject()->updateFromElement();
1982 } 1982 }
1983 1983
1984 int HTMLSelectElement::optionIndexToBeShown() const 1984 int HTMLSelectElement::optionIndexToBeShown() const
1985 { 1985 {
1986 if (m_indexToSelectOnCancel >= 0) 1986 if (m_indexToSelectOnCancel >= 0)
1987 return listToOptionIndex(m_indexToSelectOnCancel); 1987 return listToOptionIndex(m_indexToSelectOnCancel);
1988 if (suggestedIndex() >= 0) 1988 if (suggestedIndex() >= 0)
1989 return suggestedIndex(); 1989 return suggestedIndex();
1990 return selectedIndex(); 1990 return selectedIndex();
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
2136 } 2136 }
2137 2137
2138 void HTMLSelectElement::didMutateSubtree() 2138 void HTMLSelectElement::didMutateSubtree()
2139 { 2139 {
2140 DCHECK(popupIsVisible()); 2140 DCHECK(popupIsVisible());
2141 DCHECK(m_popup); 2141 DCHECK(m_popup);
2142 m_popup->updateFromElement(PopupMenu::ByDOMChange); 2142 m_popup->updateFromElement(PopupMenu::ByDOMChange);
2143 } 2143 }
2144 2144
2145 } // namespace blink 2145 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698