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

Side by Side Diff: Source/core/html/shadow/MediaControlElementTypes.cpp

Issue 406213002: If the media controls are visible they should always grab clicks (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add missing comment Created 6 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) 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
3 * Copyright (C) 2012 Google Inc. All rights reserved. 3 * Copyright (C) 2012 Google Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 HTMLElement* element = toHTMLElement(node); 64 HTMLElement* element = toHTMLElement(node);
65 if (isHTMLInputElement(*element)) 65 if (isHTMLInputElement(*element))
66 return static_cast<MediaControlInputElement*>(element)->displayType(); 66 return static_cast<MediaControlInputElement*>(element)->displayType();
67 return static_cast<MediaControlDivElement*>(element)->displayType(); 67 return static_cast<MediaControlDivElement*>(element)->displayType();
68 } 68 }
69 69
70 MediaControlElement::MediaControlElement(MediaControls& mediaControls, MediaCont rolElementType displayType, HTMLElement* element) 70 MediaControlElement::MediaControlElement(MediaControls& mediaControls, MediaCont rolElementType displayType, HTMLElement* element)
71 : m_mediaControls(mediaControls) 71 : m_mediaControls(mediaControls)
72 , m_displayType(displayType) 72 , m_displayType(displayType)
73 , m_element(element) 73 , m_element(element)
74 , m_isHidden(false)
74 { 75 {
75 } 76 }
76 77
77 HTMLMediaElement& MediaControlElement::mediaElement() const 78 HTMLMediaElement& MediaControlElement::mediaElement() const
78 { 79 {
79 return mediaControls().mediaElement(); 80 return mediaControls().mediaElement();
80 } 81 }
81 82
82 void MediaControlElement::hide() 83 void MediaControlElement::hide()
83 { 84 {
84 m_element->setInlineStyleProperty(CSSPropertyDisplay, CSSValueNone); 85 m_element->setInlineStyleProperty(CSSPropertyDisplay, CSSValueNone);
philipj_slow 2014/07/22 12:56:24 Instead of a flag, hide() and show() could be chan
86 m_isHidden = true;
85 } 87 }
86 88
87 void MediaControlElement::show() 89 void MediaControlElement::show()
88 { 90 {
89 m_element->removeInlineStyleProperty(CSSPropertyDisplay); 91 m_element->removeInlineStyleProperty(CSSPropertyDisplay);
92 m_isHidden = false;
90 } 93 }
91 94
92 void MediaControlElement::setDisplayType(MediaControlElementType displayType) 95 void MediaControlElement::setDisplayType(MediaControlElementType displayType)
93 { 96 {
94 if (displayType == m_displayType) 97 if (displayType == m_displayType)
95 return; 98 return;
96 99
97 m_displayType = displayType; 100 m_displayType = displayType;
98 if (RenderObject* object = m_element->renderer()) 101 if (RenderObject* object = m_element->renderer())
99 object->paintInvalidationForWholeRenderer(); 102 object->paintInvalidationForWholeRenderer();
(...skipping 30 matching lines...) Expand all
130 { 133 {
131 return false; 134 return false;
132 } 135 }
133 136
134 void MediaControlInputElement::trace(Visitor* visitor) 137 void MediaControlInputElement::trace(Visitor* visitor)
135 { 138 {
136 MediaControlElement::trace(visitor); 139 MediaControlElement::trace(visitor);
137 HTMLInputElement::trace(visitor); 140 HTMLInputElement::trace(visitor);
138 } 141 }
139 142
143 void* MediaControlInputElement::preDispatchEventHandler(Event* event)
144 {
145 if (event->type() == EventTypeNames::click && !isHidden()) {
philipj_slow 2014/07/22 12:56:24 Why does it actually matter if it's hidden? How ar
146 // If the media control is visible the only sensible behaviour is for th e media control to handle the click. Anything
147 // will confuse the user (however the page thinks the click should be ha ndled).
148 event->stopPropagation();
149 return 0;
150 }
151 return HTMLInputElement::preDispatchEventHandler(event);
152 }
153
140 // ---------------------------- 154 // ----------------------------
141 155
142 MediaControlTimeDisplayElement::MediaControlTimeDisplayElement(MediaControls& me diaControls, MediaControlElementType displayType) 156 MediaControlTimeDisplayElement::MediaControlTimeDisplayElement(MediaControls& me diaControls, MediaControlElementType displayType)
143 : MediaControlDivElement(mediaControls, displayType) 157 : MediaControlDivElement(mediaControls, displayType)
144 , m_currentValue(0) 158 , m_currentValue(0)
145 { 159 {
146 } 160 }
147 161
148 void MediaControlTimeDisplayElement::setCurrentValue(double time) 162 void MediaControlTimeDisplayElement::setCurrentValue(double time)
149 { 163 {
150 m_currentValue = time; 164 m_currentValue = time;
151 } 165 }
152 166
153 } // namespace blink 167 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698