| 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" | |
| 8 #include "core/dom/shadow/ShadowRoot.h" | 7 #include "core/dom/shadow/ShadowRoot.h" |
| 9 #include "core/events/MouseEvent.h" | 8 #include "core/events/MouseEvent.h" |
| 9 #include "core/geometry/DOMRect.h" |
| 10 #include "core/html/HTMLVideoElement.h" | 10 #include "core/html/HTMLVideoElement.h" |
| 11 #include "core/input/EventHandler.h" | 11 #include "core/input/EventHandler.h" |
| 12 #include "platform/text/PlatformLocale.h" | 12 #include "platform/text/PlatformLocale.h" |
| 13 #include "public/platform/WebLocalizedString.h" | 13 #include "public/platform/WebLocalizedString.h" |
| 14 | 14 |
| 15 namespace blink { | 15 namespace blink { |
| 16 | 16 |
| 17 using namespace HTMLNames; | 17 using namespace HTMLNames; |
| 18 | 18 |
| 19 // ---------------------------- | 19 // ---------------------------- |
| (...skipping 11 matching lines...) Expand all Loading... |
| 31 void Trace(blink::Visitor* visitor) { | 31 void Trace(blink::Visitor* visitor) { |
| 32 visitor->Trace(element_); | 32 visitor->Trace(element_); |
| 33 EventListener::Trace(visitor); | 33 EventListener::Trace(visitor); |
| 34 } | 34 } |
| 35 | 35 |
| 36 private: | 36 private: |
| 37 void handleEvent(ExecutionContext* context, Event* event) override { | 37 void handleEvent(ExecutionContext* context, Event* event) override { |
| 38 DCHECK_EQ(event->type(), EventTypeNames::click); | 38 DCHECK_EQ(event->type(), EventTypeNames::click); |
| 39 | 39 |
| 40 MouseEvent* mouse_event = ToMouseEvent(event); | 40 MouseEvent* mouse_event = ToMouseEvent(event); |
| 41 ClientRect* client_rect = element_->getBoundingClientRect(); | 41 DOMRect* client_rect = element_->getBoundingClientRect(); |
| 42 const double x = mouse_event->x(); | 42 const double x = mouse_event->x(); |
| 43 const double y = mouse_event->y(); | 43 const double y = mouse_event->y(); |
| 44 if (x < client_rect->left() || x > client_rect->right() || | 44 if (x < client_rect->left() || x > client_rect->right() || |
| 45 y < client_rect->top() || y > client_rect->bottom()) | 45 y < client_rect->top() || y > client_rect->bottom()) |
| 46 return; | 46 return; |
| 47 | 47 |
| 48 element_->GetVideoElement().DisableMediaRemoting(); | 48 element_->GetVideoElement().DisableMediaRemoting(); |
| 49 event->SetDefaultHandled(); | 49 event->SetDefaultHandled(); |
| 50 event->stopPropagation(); | 50 event->stopPropagation(); |
| 51 } | 51 } |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 | 94 |
| 95 // ---------------------------- | 95 // ---------------------------- |
| 96 | 96 |
| 97 MediaRemotingCastIconElement::MediaRemotingCastIconElement( | 97 MediaRemotingCastIconElement::MediaRemotingCastIconElement( |
| 98 MediaRemotingInterstitial& interstitial) | 98 MediaRemotingInterstitial& interstitial) |
| 99 : HTMLDivElement(interstitial.GetDocument()) { | 99 : HTMLDivElement(interstitial.GetDocument()) { |
| 100 SetShadowPseudoId(AtomicString("-internal-media-remoting-cast-icon")); | 100 SetShadowPseudoId(AtomicString("-internal-media-remoting-cast-icon")); |
| 101 } | 101 } |
| 102 | 102 |
| 103 } // namespace blink | 103 } // namespace blink |
| OLD | NEW |