Changeset 197502 in webkit
- Timestamp:
- Mar 3, 2016 2:48:10 AM (8 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r197501 r197502 1 2016-03-03 Antti Koivisto <antti@apple.com> 2 3 Slider thumb style should not depend on renderers 4 https://bugs.webkit.org/show_bug.cgi?id=154961 5 6 Reviewed by Andreas Kling. 7 8 Currently slider thumb pseudo id is computed based on host element renderer. 9 Style is the input for building a render tree and should be computable without having one. 10 11 * html/shadow/SliderThumbElement.cpp: 12 (WebCore::SliderThumbElement::hostInput): 13 (WebCore::SliderThumbElement::customStyleForRenderer): 14 15 Compute pseudo id based on the host style. 16 Return nullptr so style recalc will otherwise proceed normally. 17 18 (WebCore::SliderThumbElement::shadowPseudoId): 19 (WebCore::SliderThumbElement::cloneElementWithoutAttributesAndChildren): 20 (WebCore::SliderContainerElement::SliderContainerElement): 21 (WebCore::SliderContainerElement::create): 22 (WebCore::SliderContainerElement::createElementRenderer): 23 (WebCore::SliderContainerElement::customStyleForRenderer): 24 25 Here too. 26 27 (WebCore::SliderContainerElement::shadowPseudoId): 28 (WebCore::sliderThumbShadowPseudoId): Deleted. 29 (WebCore::mediaSliderThumbShadowPseudoId): Deleted. 30 * html/shadow/SliderThumbElement.h: 31 1 32 2016-03-03 Manuel Rego Casasnovas <rego@igalia.com> 2 33 -
trunk/Source/WebCore/html/shadow/SliderThumbElement.cpp
r194819 r197502 574 574 } 575 575 576 static const AtomicString& sliderThumbShadowPseudoId() 577 { 578 static NeverDestroyed<const AtomicString> sliderThumb("-webkit-slider-thumb", AtomicString::ConstructFromLiteral); 579 return sliderThumb; 580 } 581 582 static const AtomicString& mediaSliderThumbShadowPseudoId() 583 { 584 static NeverDestroyed<const AtomicString> mediaSliderThumb("-webkit-media-slider-thumb", AtomicString::ConstructFromLiteral); 585 return mediaSliderThumb; 586 } 587 588 const AtomicString& SliderThumbElement::shadowPseudoId() const 589 { 590 // FIXME: this code needs to go away, it is very very wrong. 591 // The value of shadowPseudoId() is needed to resolve the style of the shadow tree. In this case, 592 // that value depends on the style, which means the style needs to be computed twice to get 593 // a correct value: once to get the Input's appearance, then a second time to style the shadow tree correctly. 594 595 HTMLInputElement* input = hostInput(); 596 if (!input) 597 return sliderThumbShadowPseudoId(); 598 if (!input->renderer()) 599 return emptyAtom; 600 601 const RenderStyle& sliderStyle = input->renderer()->style(); 602 switch (sliderStyle.appearance()) { 576 RefPtr<RenderStyle> SliderThumbElement::customStyleForRenderer(RenderStyle&, RenderStyle* hostStyle) 577 { 578 // This doesn't actually compute style. This is just a hack to pick shadow pseudo id when host style is known. 579 580 static NeverDestroyed<const AtomicString> sliderThumbShadowPseudoId("-webkit-slider-thumb", AtomicString::ConstructFromLiteral); 581 static NeverDestroyed<const AtomicString> mediaSliderThumbShadowPseudoId("-webkit-media-slider-thumb", AtomicString::ConstructFromLiteral); 582 583 if (!hostStyle) 584 return nullptr; 585 586 switch (hostStyle->appearance()) { 603 587 case MediaSliderPart: 604 588 case MediaSliderThumbPart: … … 607 591 case MediaFullScreenVolumeSliderPart: 608 592 case MediaFullScreenVolumeSliderThumbPart: 609 return mediaSliderThumbShadowPseudoId(); 593 m_shadowPseudoId = mediaSliderThumbShadowPseudoId; 594 break; 610 595 default: 611 return sliderThumbShadowPseudoId(); 612 } 596 m_shadowPseudoId = sliderThumbShadowPseudoId; 597 } 598 599 return nullptr; 600 } 601 602 const AtomicString& SliderThumbElement::shadowPseudoId() const 603 { 604 return m_shadowPseudoId; 613 605 } 614 606 … … 623 615 : HTMLDivElement(HTMLNames::divTag, document) 624 616 { 617 setHasCustomStyleResolveCallbacks(); 625 618 } 626 619 … … 635 628 } 636 629 637 const AtomicString& SliderContainerElement::shadowPseudoId() const 638 { 639 // FIXME: this code needs to go away, it is very very wrong. 640 // The value of shadowPseudoId() is needed to resolve the style of the shadow tree. In this case, 641 // that value depends on the style, which means the style needs to be computed twice to get 642 // a correct value: once to get the Input's appearance, then a second time to style the shadow tree correctly. 630 RefPtr<RenderStyle> SliderContainerElement::customStyleForRenderer(RenderStyle&, RenderStyle* hostStyle) 631 { 632 // This doesn't actually compute style. This is just a hack to pick shadow pseudo id when host style is known. 643 633 644 634 static NeverDestroyed<const AtomicString> mediaSliderContainer("-webkit-media-slider-container", AtomicString::ConstructFromLiteral); 645 635 static NeverDestroyed<const AtomicString> sliderContainer("-webkit-slider-container", AtomicString::ConstructFromLiteral); 646 636 647 if (!is<HTMLInputElement>(*shadowHost())) 648 return sliderContainer; 649 650 auto& input = downcast<HTMLInputElement>(*shadowHost()); 651 if (!input.renderer()) 652 return emptyAtom; 653 654 const RenderStyle& sliderStyle = input.renderer()->style(); 655 switch (sliderStyle.appearance()) { 637 if (!hostStyle) 638 return nullptr; 639 640 switch (hostStyle->appearance()) { 656 641 case MediaSliderPart: 657 642 case MediaSliderThumbPart: … … 660 645 case MediaFullScreenVolumeSliderPart: 661 646 case MediaFullScreenVolumeSliderThumbPart: 662 return mediaSliderContainer; 647 m_shadowPseudoId = mediaSliderContainer; 648 break; 663 649 default: 664 return sliderContainer; 665 } 666 } 667 668 } 650 m_shadowPseudoId = sliderContainer; 651 } 652 653 return nullptr; 654 } 655 656 const AtomicString& SliderContainerElement::shadowPseudoId() const 657 { 658 return m_shadowPseudoId; 659 } 660 661 } -
trunk/Source/WebCore/html/shadow/SliderThumbElement.h
r189576 r197502 63 63 64 64 virtual RenderPtr<RenderElement> createElementRenderer(Ref<RenderStyle>&&, const RenderTreePosition&) override; 65 65 66 virtual Ref<Element> cloneElementWithoutAttributesAndChildren(Document&) override; 66 67 virtual bool isDisabledFormControl() const override; … … 78 79 virtual void willDetachRenderers() override; 79 80 81 virtual RefPtr<RenderStyle> customStyleForRenderer(RenderStyle&, RenderStyle*) override; 80 82 virtual const AtomicString& shadowPseudoId() const override; 81 83 … … 97 99 #endif 98 100 101 AtomicString m_shadowPseudoId; 99 102 bool m_inDragMode; 100 103 … … 133 136 SliderContainerElement(Document&); 134 137 virtual RenderPtr<RenderElement> createElementRenderer(Ref<RenderStyle>&&, const RenderTreePosition&) override; 138 virtual RefPtr<RenderStyle> customStyleForRenderer(RenderStyle&, RenderStyle*) override; 135 139 virtual const AtomicString& shadowPseudoId() const override; 140 141 AtomicString m_shadowPseudoId; 136 142 }; 137 143
Note: See TracChangeset
for help on using the changeset viewer.