Changeset 87235 in webkit
- Timestamp:
- May 24, 2011 5:18:31 PM (13 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r87231 r87235 1 2011-05-24 Kent Tamura <tkent@chromium.org> 2 3 Reviewed by Dimitri Glazkov. 4 5 Use Element::shadowPseudoId() for text field decoration elements 6 https://bugs.webkit.org/show_bug.cgi?id=61351 7 8 No new tests. Covered by existing tests. 9 10 * css/CSSSelector.cpp: Remove support for the following static pseudo selectors: 11 - -webkit-inner-spin-button 12 - -webkit-input-speech-button 13 - -webkit-outer-spin-button 14 - -webkit-search-cancel-button 15 - -webkit-search-decoration 16 - -webkit-search-results-button 17 - -webkit-search-results-decoration 18 (WebCore::CSSSelector::pseudoId): 19 (WebCore::nameToPseudoTypeMap): 20 (WebCore::CSSSelector::extractPseudoType): 21 * css/CSSSelector.h: ditto. 22 * css/CSSStyleSelector.cpp: 23 (WebCore::CSSStyleSelector::matchRules): 24 Store shadowPseudoId() result in a local variable because 25 SearchFieldResultsButtonElement::shadowPseudoId() is a little expensive. 26 * html/shadow/TextControlInnerElements.cpp: 27 Override Element::shadowPseudoId() instead of Element::styleForRenderer(). 28 (WebCore::SearchFieldResultsButtonElement::shadowPseudoId): 29 (WebCore::SearchFieldCancelButtonElement::shadowPseudoId): 30 (WebCore::SpinButtonElement::shadowPseudoId): 31 (WebCore::InputFieldSpeechButtonElement::shadowPseudoId): 32 * html/shadow/TextControlInnerElements.h: Update declarations. 33 * rendering/RenderTextControlSingleLine.cpp: Remove createFooStyle() functions. 34 * rendering/RenderTextControlSingleLine.h: ditto. 35 * rendering/style/RenderStyleConstants.h: Remove unused pseudo IDs. 36 1 37 2011-05-24 Dimitri Glazkov <dglazkov@chromium.org> 2 38 -
trunk/Source/WebCore/css/CSSSelector.cpp
r87102 r87235 131 131 case PseudoInputPlaceholder: 132 132 return INPUT_PLACEHOLDER; 133 #if ENABLE(INPUT_SPEECH)134 case PseudoInputSpeechButton:135 return INPUT_SPEECH_BUTTON;136 #endif137 case PseudoSearchCancelButton:138 return SEARCH_CANCEL_BUTTON;139 case PseudoSearchDecoration:140 return SEARCH_DECORATION;141 case PseudoSearchResultsDecoration:142 return SEARCH_RESULTS_DECORATION;143 case PseudoSearchResultsButton:144 return SEARCH_RESULTS_BUTTON;145 133 case PseudoScrollbar: 146 134 return SCROLLBAR; … … 157 145 case PseudoResizer: 158 146 return RESIZER; 159 case PseudoInnerSpinButton:160 return INNER_SPIN_BUTTON;161 case PseudoOuterSpinButton:162 return OUTER_SPIN_BUTTON;163 147 #if ENABLE(FULLSCREEN_API) 164 148 case PseudoFullScreen: … … 251 235 DEFINE_STATIC_LOCAL(AtomicString, checked, ("checked")); 252 236 DEFINE_STATIC_LOCAL(AtomicString, fileUploadButton, ("-webkit-file-upload-button")); 253 #if ENABLE(INPUT_SPEECH)254 DEFINE_STATIC_LOCAL(AtomicString, inputSpeechButton, ("-webkit-input-speech-button"));255 #endif256 237 DEFINE_STATIC_LOCAL(AtomicString, defaultString, ("default")); 257 238 DEFINE_STATIC_LOCAL(AtomicString, disabled, ("disabled")); … … 276 257 DEFINE_STATIC_LOCAL(AtomicString, hover, ("hover")); 277 258 DEFINE_STATIC_LOCAL(AtomicString, indeterminate, ("indeterminate")); 278 DEFINE_STATIC_LOCAL(AtomicString, innerSpinButton, ("-webkit-inner-spin-button"));279 259 #if ENABLE(DATALIST) 280 260 DEFINE_STATIC_LOCAL(AtomicString, inputListButton, ("-webkit-input-list-button")); … … 289 269 DEFINE_STATIC_LOCAL(AtomicString, onlyOfType, ("only-of-type")); 290 270 DEFINE_STATIC_LOCAL(AtomicString, optional, ("optional")); 291 DEFINE_STATIC_LOCAL(AtomicString, outerSpinButton, ("-webkit-outer-spin-button"));292 271 DEFINE_STATIC_LOCAL(AtomicString, required, ("required")); 293 272 DEFINE_STATIC_LOCAL(AtomicString, resizer, ("-webkit-resizer")); … … 299 278 DEFINE_STATIC_LOCAL(AtomicString, scrollbarTrack, ("-webkit-scrollbar-track")); 300 279 DEFINE_STATIC_LOCAL(AtomicString, scrollbarTrackPiece, ("-webkit-scrollbar-track-piece")); 301 DEFINE_STATIC_LOCAL(AtomicString, searchCancelButton, ("-webkit-search-cancel-button"));302 DEFINE_STATIC_LOCAL(AtomicString, searchDecoration, ("-webkit-search-decoration"));303 DEFINE_STATIC_LOCAL(AtomicString, searchResultsDecoration, ("-webkit-search-results-decoration"));304 DEFINE_STATIC_LOCAL(AtomicString, searchResultsButton, ("-webkit-search-results-button"));305 280 DEFINE_STATIC_LOCAL(AtomicString, selection, ("selection")); 306 281 DEFINE_STATIC_LOCAL(AtomicString, target, ("target")); … … 341 316 nameToPseudoType->set(checked.impl(), CSSSelector::PseudoChecked); 342 317 nameToPseudoType->set(fileUploadButton.impl(), CSSSelector::PseudoFileUploadButton); 343 #if ENABLE(INPUT_SPEECH)344 nameToPseudoType->set(inputSpeechButton.impl(), CSSSelector::PseudoInputSpeechButton);345 #endif346 318 nameToPseudoType->set(defaultString.impl(), CSSSelector::PseudoDefault); 347 319 nameToPseudoType->set(disabled.impl(), CSSSelector::PseudoDisabled); … … 370 342 nameToPseudoType->set(hover.impl(), CSSSelector::PseudoHover); 371 343 nameToPseudoType->set(indeterminate.impl(), CSSSelector::PseudoIndeterminate); 372 nameToPseudoType->set(innerSpinButton.impl(), CSSSelector::PseudoInnerSpinButton);373 344 nameToPseudoType->set(link.impl(), CSSSelector::PseudoLink); 374 345 nameToPseudoType->set(lang.impl(), CSSSelector::PseudoLang); … … 378 349 nameToPseudoType->set(nthLastChild.impl(), CSSSelector::PseudoNthLastChild); 379 350 nameToPseudoType->set(nthLastOfType.impl(), CSSSelector::PseudoNthLastOfType); 380 nameToPseudoType->set(outerSpinButton.impl(), CSSSelector::PseudoOuterSpinButton);381 351 nameToPseudoType->set(root.impl(), CSSSelector::PseudoRoot); 382 352 nameToPseudoType->set(windowInactive.impl(), CSSSelector::PseudoWindowInactive); … … 400 370 nameToPseudoType->set(scrollbarTrackPiece.impl(), CSSSelector::PseudoScrollbarTrackPiece); 401 371 nameToPseudoType->set(cornerPresent.impl(), CSSSelector::PseudoCornerPresent); 402 nameToPseudoType->set(searchCancelButton.impl(), CSSSelector::PseudoSearchCancelButton);403 nameToPseudoType->set(searchDecoration.impl(), CSSSelector::PseudoSearchDecoration);404 nameToPseudoType->set(searchResultsDecoration.impl(), CSSSelector::PseudoSearchResultsDecoration);405 nameToPseudoType->set(searchResultsButton.impl(), CSSSelector::PseudoSearchResultsButton);406 372 nameToPseudoType->set(selection.impl(), CSSSelector::PseudoSelection); 407 373 nameToPseudoType->set(target.impl(), CSSSelector::PseudoTarget); … … 451 417 case PseudoInputListButton: 452 418 case PseudoInputPlaceholder: 453 #if ENABLE(INPUT_SPEECH)454 case PseudoInputSpeechButton:455 #endif456 case PseudoInnerSpinButton:457 case PseudoOuterSpinButton:458 419 case PseudoResizer: 459 420 case PseudoScrollbar: … … 463 424 case PseudoScrollbarTrack: 464 425 case PseudoScrollbarTrackPiece: 465 case PseudoSearchCancelButton:466 case PseudoSearchDecoration:467 case PseudoSearchResultsDecoration:468 case PseudoSearchResultsButton:469 426 case PseudoSelection: 470 427 element = true; -
trunk/Source/WebCore/css/CSSSelector.h
r87102 r87235 174 174 PseudoSelection, 175 175 PseudoFileUploadButton, 176 PseudoSearchCancelButton,177 PseudoSearchDecoration,178 PseudoSearchResultsDecoration,179 PseudoSearchResultsButton,180 176 PseudoInputListButton, 181 #if ENABLE(INPUT_SPEECH)182 PseudoInputSpeechButton,183 #endif184 PseudoInnerSpinButton,185 PseudoOuterSpinButton,186 177 PseudoLeftPage, 187 178 PseudoRightPage, -
trunk/Source/WebCore/css/CSSStyleSelector.cpp
r87121 r87235 709 709 matchRulesForList(rules->getClassRules(classNames[i].impl()), firstRuleIndex, lastRuleIndex, includeEmptyRules); 710 710 } 711 if (!m_element->shadowPseudoId().isEmpty()) { 711 const AtomicString& pseudoId = m_element->shadowPseudoId(); 712 if (!pseudoId.isEmpty()) { 712 713 ASSERT(m_styledElement); 713 matchRulesForList(rules->getPseudoRules( m_element->shadowPseudoId().impl()), firstRuleIndex, lastRuleIndex, includeEmptyRules);714 matchRulesForList(rules->getPseudoRules(pseudoId.impl()), firstRuleIndex, lastRuleIndex, includeEmptyRules); 714 715 } 715 716 matchRulesForList(rules->getTagRules(m_element->localName().impl()), firstRuleIndex, lastRuleIndex, includeEmptyRules); -
trunk/Source/WebCore/html/shadow/TextControlInnerElements.cpp
r87067 r87235 122 122 } 123 123 124 PassRefPtr<RenderStyle> SearchFieldResultsButtonElement::styleForRenderer() 125 { 126 RenderTextControlSingleLine* parentRenderer = toRenderTextControlSingleLine(shadowAncestorNode()->renderer()); 127 return parentRenderer->createResultsButtonStyle(parentRenderer->style()); 124 const AtomicString& SearchFieldResultsButtonElement::shadowPseudoId() const 125 { 126 DEFINE_STATIC_LOCAL(AtomicString, resultsId, ("-webkit-search-results-button")); 127 DEFINE_STATIC_LOCAL(AtomicString, resultsDecorationId, ("-webkit-search-results-decoration")); 128 DEFINE_STATIC_LOCAL(AtomicString, decorationId, ("-webkit-search-decoration")); 129 Node* host = shadowAncestorNode(); 130 if (!host) 131 return resultsId; 132 if (HTMLInputElement* input = host->toInputElement()) { 133 if (input->maxResults() < 0) 134 return decorationId; 135 if (input->maxResults() > 0) 136 return resultsId; 137 return resultsDecorationId; 138 } 139 return resultsId; 128 140 } 129 141 … … 160 172 } 161 173 162 PassRefPtr<RenderStyle> SearchFieldCancelButtonElement::styleForRenderer() 163 { 164 RenderTextControlSingleLine* parentRenderer = toRenderTextControlSingleLine(shadowAncestorNode()->renderer());165 return p arentRenderer->createCancelButtonStyle(parentRenderer->style());174 const AtomicString& SearchFieldCancelButtonElement::shadowPseudoId() const 175 { 176 DEFINE_STATIC_LOCAL(AtomicString, pseudoId, ("-webkit-search-cancel-button")); 177 return pseudoId; 166 178 } 167 179 … … 232 244 } 233 245 234 PassRefPtr<RenderStyle> SpinButtonElement::styleForRenderer() 235 { 236 RenderTextControlSingleLine* parentRenderer = toRenderTextControlSingleLine(shadowAncestorNode()->renderer()); 237 return m_isInner ? parentRenderer->createInnerSpinButtonStyle() : parentRenderer->createOuterSpinButtonStyle(); 246 const AtomicString& SpinButtonElement::shadowPseudoId() const 247 { 248 DEFINE_STATIC_LOCAL(AtomicString, innerPseudoId, ("-webkit-inner-spin-button")); 249 DEFINE_STATIC_LOCAL(AtomicString, outerPseudoId, ("-webkit-outer-spin-button")); 250 return m_isInner ? innerPseudoId : outerPseudoId; 238 251 } 239 252 … … 514 527 } 515 528 516 PassRefPtr<RenderStyle> InputFieldSpeechButtonElement::styleForRenderer() 517 { 518 RenderTextControlSingleLine* parentRenderer = toRenderTextControlSingleLine(shadowAncestorNode()->renderer());519 return p arentRenderer->createSpeechButtonStyle();529 const AtomicString& InputFieldSpeechButtonElement::shadowPseudoId() const 530 { 531 DEFINE_STATIC_LOCAL(AtomicString, pseudoId, ("-webkit-input-speech-button")); 532 return pseudoId; 520 533 } 521 534 -
trunk/Source/WebCore/html/shadow/TextControlInnerElements.h
r87227 r87235 70 70 private: 71 71 SearchFieldResultsButtonElement(Document*); 72 virtual PassRefPtr<RenderStyle> styleForRenderer();72 virtual const AtomicString& shadowPseudoId() const; 73 73 virtual bool isMouseFocusable() const { return false; } 74 74 }; … … 82 82 private: 83 83 SearchFieldCancelButtonElement(Document*); 84 virtual PassRefPtr<RenderStyle> styleForRenderer();84 virtual const AtomicString& shadowPseudoId() const; 85 85 virtual void detach(); 86 86 virtual bool isMouseFocusable() const { return false; } … … 104 104 SpinButtonElement(Document*, bool isInner); 105 105 106 virtual PassRefPtr<RenderStyle> styleForRenderer();106 virtual const AtomicString& shadowPseudoId() const; 107 107 virtual void detach(); 108 108 virtual bool isSpinButtonElement() const { return true; } … … 152 152 SpeechInput* speechInput(); 153 153 void setState(SpeechInputState state); 154 virtual PassRefPtr<RenderStyle> styleForRenderer();154 virtual const AtomicString& shadowPseudoId() const; 155 155 virtual bool isMouseFocusable() const { return false; } 156 156 virtual void attach(); -
trunk/Source/WebCore/rendering/RenderTextControlSingleLine.cpp
r87067 r87235 738 738 } 739 739 740 PassRefPtr<RenderStyle> RenderTextControlSingleLine::createResultsButtonStyle(const RenderStyle* startStyle) const741 {742 HTMLInputElement* input = inputElement();743 744 RefPtr<RenderStyle> resultsBlockStyle;745 if (input->maxResults() < 0)746 resultsBlockStyle = getCachedPseudoStyle(SEARCH_DECORATION);747 else if (!input->maxResults())748 resultsBlockStyle = getCachedPseudoStyle(SEARCH_RESULTS_DECORATION);749 else750 resultsBlockStyle = getCachedPseudoStyle(SEARCH_RESULTS_BUTTON);751 752 if (!resultsBlockStyle)753 resultsBlockStyle = RenderStyle::create();754 755 if (startStyle)756 resultsBlockStyle->inheritFrom(startStyle);757 758 return resultsBlockStyle.release();759 }760 761 PassRefPtr<RenderStyle> RenderTextControlSingleLine::createCancelButtonStyle(const RenderStyle* startStyle) const762 {763 RefPtr<RenderStyle> cancelBlockStyle;764 765 if (RefPtr<RenderStyle> pseudoStyle = getCachedPseudoStyle(SEARCH_CANCEL_BUTTON))766 // We may be sharing style with another search field, but we must not share the cancel button style.767 cancelBlockStyle = RenderStyle::clone(pseudoStyle.get());768 else769 cancelBlockStyle = RenderStyle::create();770 771 if (startStyle)772 cancelBlockStyle->inheritFrom(startStyle);773 774 cancelBlockStyle->setVisibility(visibilityForCancelButton());775 return cancelBlockStyle.release();776 }777 778 PassRefPtr<RenderStyle> RenderTextControlSingleLine::createInnerSpinButtonStyle() const779 {780 RefPtr<RenderStyle> buttonStyle = getCachedPseudoStyle(INNER_SPIN_BUTTON);781 if (!buttonStyle)782 buttonStyle = RenderStyle::create();783 buttonStyle->inheritFrom(style());784 return buttonStyle.release();785 }786 787 PassRefPtr<RenderStyle> RenderTextControlSingleLine::createOuterSpinButtonStyle() const788 {789 RefPtr<RenderStyle> buttonStyle = getCachedPseudoStyle(OUTER_SPIN_BUTTON);790 if (!buttonStyle)791 buttonStyle = RenderStyle::create();792 buttonStyle->inheritFrom(style());793 return buttonStyle.release();794 }795 796 #if ENABLE(INPUT_SPEECH)797 PassRefPtr<RenderStyle> RenderTextControlSingleLine::createSpeechButtonStyle() const798 {799 RefPtr<RenderStyle> buttonStyle = getCachedPseudoStyle(INPUT_SPEECH_BUTTON);800 if (!buttonStyle)801 buttonStyle = RenderStyle::create();802 buttonStyle->inheritFrom(style());803 return buttonStyle.release();804 }805 #endif806 807 740 void RenderTextControlSingleLine::updateCancelButtonVisibility() const 808 741 { -
trunk/Source/WebCore/rendering/RenderTextControlSingleLine.h
r87067 r87235 41 41 virtual PassRefPtr<RenderStyle> createInnerTextStyle(const RenderStyle* startStyle) const; 42 42 PassRefPtr<RenderStyle> createInnerBlockStyle(const RenderStyle* startStyle) const; 43 PassRefPtr<RenderStyle> createInnerSpinButtonStyle() const;44 PassRefPtr<RenderStyle> createOuterSpinButtonStyle() const;45 PassRefPtr<RenderStyle> createResultsButtonStyle(const RenderStyle* startStyle) const;46 PassRefPtr<RenderStyle> createCancelButtonStyle(const RenderStyle* startStyle) const;47 #if ENABLE(INPUT_SPEECH)48 PassRefPtr<RenderStyle> createSpeechButtonStyle() const;49 #endif50 43 51 44 bool placeholderIsVisible() const { return m_placeholderVisible; } -
trunk/Source/WebCore/rendering/style/RenderStyleConstants.h
r87121 r87235 69 69 enum PseudoId { 70 70 // The order must be NOP ID, public IDs, and then internal IDs. 71 NOPSEUDO, FIRST_LINE, FIRST_LETTER, BEFORE, AFTER, SELECTION, FIRST_LINE_INHERITED, SCROLLBAR, FILE_UPLOAD_BUTTON, INPUT_PLACEHOLDER, 72 SEARCH_CANCEL_BUTTON, SEARCH_DECORATION, SEARCH_RESULTS_DECORATION, SEARCH_RESULTS_BUTTON, 71 NOPSEUDO, FIRST_LINE, FIRST_LETTER, BEFORE, AFTER, SELECTION, FIRST_LINE_INHERITED, SCROLLBAR, 72 // Internal IDs follow: 73 FILE_UPLOAD_BUTTON, INPUT_PLACEHOLDER, 73 74 SCROLLBAR_THUMB, SCROLLBAR_BUTTON, SCROLLBAR_TRACK, SCROLLBAR_TRACK_PIECE, SCROLLBAR_CORNER, RESIZER, 74 INPUT_LIST_BUTTON, INPUT_SPEECH_BUTTON, INNER_SPIN_BUTTON, OUTER_SPIN_BUTTON, VISITED_LINK, 75 METER_BAR, METER_OPTIMUM, METER_SUBOPTIMAL, METER_EVEN_LESS_GOOD, 75 INPUT_LIST_BUTTON, VISITED_LINK, 76 76 AFTER_LAST_INTERNAL_PSEUDOID, 77 77 FULL_SCREEN, FULL_SCREEN_DOCUMENT, FULL_SCREEN_MEDIA_DOCUMENT, ANIMATING_FULL_SCREEN_TRANSITION,
Note: See TracChangeset
for help on using the changeset viewer.