OLD | NEW |
---|---|
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "core/html/shadow/MediaRemotingElements.h" | 5 #include "core/html/shadow/MediaRemotingElements.h" |
6 | 6 |
7 #include "core/dom/ClientRect.h" | 7 #include "core/dom/ClientRect.h" |
8 #include "core/dom/shadow/ShadowRoot.h" | 8 #include "core/dom/shadow/ShadowRoot.h" |
9 #include "core/events/MouseEvent.h" | 9 #include "core/events/MouseEvent.h" |
10 #include "core/html/HTMLVideoElement.h" | 10 #include "core/html/HTMLVideoElement.h" |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
57 MediaRemotingInterstitial& interstitial) | 57 MediaRemotingInterstitial& interstitial) |
58 : HTMLDivElement(interstitial.GetDocument()), interstitial_(interstitial) { | 58 : HTMLDivElement(interstitial.GetDocument()), interstitial_(interstitial) { |
59 listener_ = new MouseEventsListener(*this); | 59 listener_ = new MouseEventsListener(*this); |
60 SetShadowPseudoId(AtomicString("-internal-media-remoting-disable-button")); | 60 SetShadowPseudoId(AtomicString("-internal-media-remoting-disable-button")); |
61 setInnerText(interstitial.GetVideoElement().GetLocale().QueryString( | 61 setInnerText(interstitial.GetVideoElement().GetLocale().QueryString( |
62 WebLocalizedString::kMediaRemotingDisableText), | 62 WebLocalizedString::kMediaRemotingDisableText), |
63 ASSERT_NO_EXCEPTION); | 63 ASSERT_NO_EXCEPTION); |
64 } | 64 } |
65 | 65 |
66 void MediaRemotingExitButtonElement::OnShown() { | 66 void MediaRemotingExitButtonElement::OnShown() { |
67 if (const ComputedStyle* style = NonLayoutObjectComputedStyle()) { | |
68 if (style->Display() == EDisplay::kNone) | |
xjz
2017/05/25 19:02:18
Have you tested on this? I am not sure whether thi
whywhat
2017/05/25 20:26:29
The hiding of the button happens via the mediacont
xjz
2017/05/25 21:20:34
Yes, you are correct. When showing/hiding the inte
rune
2017/05/26 11:17:57
Querying the computed style requires that the comp
| |
69 return; | |
70 } | |
67 GetDocument().addEventListener(EventTypeNames::click, listener_, true); | 71 GetDocument().addEventListener(EventTypeNames::click, listener_, true); |
68 } | 72 } |
69 | 73 |
70 void MediaRemotingExitButtonElement::OnHidden() { | 74 void MediaRemotingExitButtonElement::OnHidden() { |
75 if (const ComputedStyle* style = NonLayoutObjectComputedStyle()) { | |
76 if (style->Display() == EDisplay::kNone) | |
77 return; | |
78 } | |
71 GetDocument().removeEventListener(EventTypeNames::click, listener_, true); | 79 GetDocument().removeEventListener(EventTypeNames::click, listener_, true); |
72 } | 80 } |
73 | 81 |
74 HTMLVideoElement& MediaRemotingExitButtonElement::GetVideoElement() const { | 82 HTMLVideoElement& MediaRemotingExitButtonElement::GetVideoElement() const { |
75 return interstitial_->GetVideoElement(); | 83 return interstitial_->GetVideoElement(); |
76 } | 84 } |
77 | 85 |
78 DEFINE_TRACE(MediaRemotingExitButtonElement) { | 86 DEFINE_TRACE(MediaRemotingExitButtonElement) { |
79 visitor->Trace(interstitial_); | 87 visitor->Trace(interstitial_); |
80 visitor->Trace(listener_); | 88 visitor->Trace(listener_); |
(...skipping 13 matching lines...) Expand all Loading... | |
94 | 102 |
95 // ---------------------------- | 103 // ---------------------------- |
96 | 104 |
97 MediaRemotingCastIconElement::MediaRemotingCastIconElement( | 105 MediaRemotingCastIconElement::MediaRemotingCastIconElement( |
98 MediaRemotingInterstitial& interstitial) | 106 MediaRemotingInterstitial& interstitial) |
99 : HTMLDivElement(interstitial.GetDocument()) { | 107 : HTMLDivElement(interstitial.GetDocument()) { |
100 SetShadowPseudoId(AtomicString("-internal-media-remoting-cast-icon")); | 108 SetShadowPseudoId(AtomicString("-internal-media-remoting-cast-icon")); |
101 } | 109 } |
102 | 110 |
103 } // namespace blink | 111 } // namespace blink |
OLD | NEW |