Changeset 55682 in webkit
- Timestamp:
- Mar 8, 2010 2:16:00 PM (14 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r55680 r55682 1 2010-03-08 Darin Adler <darin@apple.com> 2 3 Reviewed by Jon Honeycutt. 4 5 https://bugs.webkit.org/show_bug.cgi?id=35876 6 7 Fix minor style issues in HTMLMediaElement and classes derived from it. 8 Made many public members private and protected. 9 10 * html/HTMLMediaElement.cpp: 11 (WebCore::HTMLMediaElement::screenRect): Got rid of a stray "const" and 12 retstructured the function to use early return and get rid of a local. 13 14 * html/HTMLMediaElement.h: Made lots of members private and some 15 protected. Also use private inheritance instead of public. Removed 16 some unneeded includes. 17 18 * html/HTMLVideoElement.cpp: 19 (WebCore::HTMLVideoElement::parseMappedAttribute): Use player() instead 20 of m_player; HTMLMediaElement data members are now private, not protected. 21 (WebCore::HTMLVideoElement::supportsFullscreen): Ditto. 22 (WebCore::HTMLVideoElement::videoWidth): Ditto. 23 (WebCore::HTMLVideoElement::videoHeight): Ditto. 24 (WebCore::HTMLVideoElement::hasAvailableVideoFrame): Ditto. 25 (WebCore::HTMLVideoElement::webkitEnterFullScreen): Use isFullscreen() 26 instead of m_isFullscreen; same reason. 27 (WebCore::HTMLVideoElement::webkitExitFullScreen): Ditto. 28 (WebCore::HTMLVideoElement::webkitDisplayingFullscreen): Ditto. 29 30 * html/HTMLVideoElement.h: Removed an unneeded include. Made many 31 public functions private. Got rid of unused paint function, which was 32 replaced with paintCurrentFrameInContext a while back. 33 1 34 2010-03-08 Joanmarie Diggs <joanmarie.diggs@gmail.com> 2 35 -
trunk/WebCore/html/HTMLMediaElement.cpp
r55587 r55682 1813 1813 } 1814 1814 1815 const IntRect HTMLMediaElement::screenRect() 1816 { 1817 IntRect elementRect; 1818 if (renderer()) 1819 elementRect = renderer()->view()->frameView()->contentsToScreen(renderer()->absoluteBoundingBoxRect()); 1820 return elementRect; 1815 IntRect HTMLMediaElement::screenRect() 1816 { 1817 if (!renderer()) 1818 return IntRect(); 1819 return renderer()->view()->frameView()->contentsToScreen(renderer()->absoluteBoundingBoxRect()); 1821 1820 } 1822 1821 -
trunk/WebCore/html/HTMLMediaElement.h
r55463 r55682 31 31 #include "HTMLElement.h" 32 32 #include "MediaPlayer.h" 33 #include "Timer.h"34 35 #if ENABLE(PLUGIN_PROXY_FOR_VIDEO)36 #include "MediaPlayerProxy.h"37 #endif38 33 39 34 namespace WebCore { … … 45 40 class TimeRanges; 46 41 42 // FIXME: The inheritance from MediaPlayerClient here should be private inheritance. 43 // But it can't be until the Chromium WebMediaPlayerClientImpl class is fixed so it 44 // no longer depends on typecasting a MediaPlayerClient to an HTMLMediaElement. 45 47 46 class HTMLMediaElement : public HTMLElement, public MediaPlayerClient { 48 47 public: 49 virtual ~HTMLMediaElement();50 51 bool checkDTD(const Node* newChild);52 53 void attributeChanged(Attribute*, bool preserveDecls);54 void parseMappedAttribute(MappedAttribute *);55 56 virtual bool rendererIsNeeded(RenderStyle*);57 virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);58 virtual void insertedIntoDocument();59 virtual void removedFromDocument();60 virtual void attach();61 virtual void recalcStyle(StyleChange);62 63 48 MediaPlayer* player() const { return m_player.get(); } 64 49 … … 80 65 81 66 void scheduleLoad(); 82 83 virtual void defaultEventHandler(Event*);84 85 // Pauses playback without changing any states or generating events86 void setPausedInternal(bool);87 67 88 68 MediaPlayer::MovieLoadType movieLoadType() const; … … 152 132 void endScrubbing(); 153 133 154 constIntRect screenRect();134 IntRect screenRect(); 155 135 156 136 bool canPlay() const; … … 160 140 #if ENABLE(PLUGIN_PROXY_FOR_VIDEO) 161 141 void setNeedWidgetUpdate(bool needWidgetUpdate) { m_needWidgetUpdate = needWidgetUpdate; } 162 void deliverNotification(MediaPlayerProxyNotificationType notification);163 void setMediaPlayerProxy(WebMediaPlayerProxy* proxy);142 void deliverNotification(MediaPlayerProxyNotificationType); 143 void setMediaPlayerProxy(WebMediaPlayerProxy*); 164 144 String initialURL(); 165 145 virtual void finishParsingChildren(); … … 168 148 bool hasSingleSecurityOrigin() const { return !m_player || m_player->hasSingleSecurityOrigin(); } 169 149 150 bool isFullscreen() const { return m_isFullscreen; } 170 151 void enterFullscreen(); 171 152 void exitFullscreen(); … … 179 160 protected: 180 161 HTMLMediaElement(const QualifiedName&, Document*); 181 162 virtual ~HTMLMediaElement(); 163 164 virtual void parseMappedAttribute(MappedAttribute *); 165 virtual void attach(); 166 167 private: 168 virtual bool checkDTD(const Node* newChild); 169 virtual void attributeChanged(Attribute*, bool preserveDecls); 170 virtual bool rendererIsNeeded(RenderStyle*); 171 virtual RenderObject* createRenderer(RenderArena*, RenderStyle*); 172 virtual void insertedIntoDocument(); 173 virtual void removedFromDocument(); 174 virtual void recalcStyle(StyleChange); 175 176 virtual void defaultEventHandler(Event*); 177 182 178 float getTimeOffsetAttribute(const QualifiedName&, float valueOnError) const; 183 179 void setTimeOffsetAttribute(const QualifiedName&, float value); … … 194 190 virtual void didMoveToNewOwnerDocument(); 195 191 196 private: // MediaPlayerClient197 192 virtual Document* mediaPlayerOwningDocument(); 198 193 virtual void mediaPlayerNetworkStateChanged(MediaPlayer*); … … 211 206 #endif 212 207 213 private:214 208 void loadTimerFired(Timer<HTMLMediaElement>*); 215 209 void asyncEventTimerFired(Timer<HTMLMediaElement>*); … … 266 260 float maxTimeSeekable() const; 267 261 268 // Restrictions to change default behaviors. This is a effectively a compile time choice at the moment 269 // because there are no accessor methods. 262 // Pauses playback without changing any states or generating events 263 void setPausedInternal(bool); 264 265 // Restrictions to change default behaviors. This is effectively a compile time choice at the moment 266 // because there are no accessor functions. 270 267 enum BehaviorRestrictions { 271 268 NoRestrictions = 0, … … 274 271 }; 275 272 276 protected:277 273 Timer<HTMLMediaElement> m_loadTimer; 278 274 Timer<HTMLMediaElement> m_asyncEventTimer; … … 306 302 enum LoadState { WaitingForSource, LoadingFromSrcAttr, LoadingFromSourceElement }; 307 303 LoadState m_loadState; 308 HTMLSourceElement *m_currentSourceNode;304 HTMLSourceElement* m_currentSourceNode; 309 305 310 306 OwnPtr<MediaPlayer> m_player; -
trunk/WebCore/html/HTMLVideoElement.cpp
r54182 r55682 105 105 m_imageLoader->updateFromElementIgnoringPreviousError(); 106 106 #else 107 if ( m_player)108 m_player->setPoster(poster());107 if (player()) 108 player()->setPoster(poster()); 109 109 #endif 110 110 } … … 123 123 return false; 124 124 125 if (! m_player || !m_player->supportsFullscreen() || !m_player->hasVideo())125 if (!player() || !player()->supportsFullscreen() || !player()->hasVideo()) 126 126 return false; 127 127 … … 132 132 unsigned HTMLVideoElement::videoWidth() const 133 133 { 134 if (! m_player)134 if (!player()) 135 135 return 0; 136 return m_player->naturalSize().width();136 return player()->naturalSize().width(); 137 137 } 138 138 139 139 unsigned HTMLVideoElement::videoHeight() const 140 140 { 141 if (! m_player)141 if (!player()) 142 142 return 0; 143 return m_player->naturalSize().height();143 return player()->naturalSize().height(); 144 144 } 145 145 … … 197 197 } 198 198 199 void HTMLVideoElement::paint (GraphicsContext* context, const IntRect& destRect)199 void HTMLVideoElement::paintCurrentFrameInContext(GraphicsContext* context, const IntRect& destRect) 200 200 { 201 201 MediaPlayer* player = HTMLMediaElement::player(); 202 202 if (!player) 203 203 return; 204 205 player->setVisible(true); // Make player visible or it won't draw.206 player->paint(context, destRect);207 }208 209 void HTMLVideoElement::paintCurrentFrameInContext(GraphicsContext* context, const IntRect& destRect)210 {211 MediaPlayer* player = HTMLMediaElement::player();212 if (!player)213 return;214 204 215 205 player->setVisible(true); // Make player visible or it won't draw. … … 219 209 bool HTMLVideoElement::hasAvailableVideoFrame() const 220 210 { 221 if (! m_player)211 if (!player()) 222 212 return false; 223 213 224 return m_player->hasAvailableVideoFrame();214 return player()->hasAvailableVideoFrame(); 225 215 } 226 216 227 217 void HTMLVideoElement::webkitEnterFullScreen(bool isUserGesture, ExceptionCode& ec) 228 218 { 229 if ( m_isFullscreen)219 if (isFullscreen()) 230 220 return; 231 221 … … 242 232 void HTMLVideoElement::webkitExitFullScreen() 243 233 { 244 if ( m_isFullscreen)234 if (isFullscreen()) 245 235 exitFullscreen(); 246 236 } … … 253 243 bool HTMLVideoElement::webkitDisplayingFullscreen() 254 244 { 255 return m_isFullscreen;256 } 257 258 259 } 260 #endif 245 return isFullscreen(); 246 } 247 248 249 } 250 #endif -
trunk/WebCore/html/HTMLVideoElement.h
r54828 r55682 30 30 31 31 #include "HTMLMediaElement.h" 32 #include <wtf/OwnPtr.h>33 32 34 33 namespace WebCore { … … 39 38 public: 40 39 HTMLVideoElement(const QualifiedName&, Document*); 41 42 virtual int tagPriority() const { return 5; }43 virtual bool rendererIsNeeded(RenderStyle*);44 #if !ENABLE(PLUGIN_PROXY_FOR_VIDEO)45 virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);46 #endif47 virtual void attach();48 virtual void detach();49 virtual void parseMappedAttribute(MappedAttribute* attr);50 virtual bool isVideo() const { return true; }51 virtual bool hasVideo() const { return player() && player()->hasVideo(); }52 virtual bool supportsFullscreen() const;53 virtual bool isURLAttribute(Attribute*) const;54 virtual const QualifiedName& imageSourceAttributeName() const;55 40 56 41 unsigned width() const; … … 73 58 bool shouldDisplayPosterImage() const { return m_shouldDisplayPosterImage; } 74 59 75 void paint(GraphicsContext*, const IntRect&);76 60 // Used by canvas to gain raw pixel access 77 61 void paintCurrentFrameInContext(GraphicsContext*, const IntRect&); 78 62 79 63 private: 64 virtual int tagPriority() const { return 5; } 65 virtual bool rendererIsNeeded(RenderStyle*); 66 #if !ENABLE(PLUGIN_PROXY_FOR_VIDEO) 67 virtual RenderObject* createRenderer(RenderArena*, RenderStyle*); 68 #endif 69 virtual void attach(); 70 virtual void detach(); 71 virtual void parseMappedAttribute(MappedAttribute*); 72 virtual bool isVideo() const { return true; } 73 virtual bool hasVideo() const { return player() && player()->hasVideo(); } 74 virtual bool supportsFullscreen() const; 75 virtual bool isURLAttribute(Attribute*) const; 76 virtual const QualifiedName& imageSourceAttributeName() const; 77 80 78 virtual bool hasAvailableVideoFrame() const; 81 79 virtual void updatePosterImage();
Note: See TracChangeset
for help on using the changeset viewer.