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

Side by Side Diff: Source/core/html/track/vtt/VTTCue.cpp

Issue 263213002: Add use counters for VTTCue use/rendering and its attributes (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/frame/UseCounter.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2013, Opera Software ASA. All rights reserved. 2 * Copyright (c) 2013, Opera Software ASA. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 20 matching lines...) Expand all
31 #include "core/html/track/vtt/VTTCue.h" 31 #include "core/html/track/vtt/VTTCue.h"
32 32
33 #include "CSSPropertyNames.h" 33 #include "CSSPropertyNames.h"
34 #include "CSSValueKeywords.h" 34 #include "CSSValueKeywords.h"
35 #include "RuntimeEnabledFeatures.h" 35 #include "RuntimeEnabledFeatures.h"
36 #include "bindings/v8/ExceptionMessages.h" 36 #include "bindings/v8/ExceptionMessages.h"
37 #include "bindings/v8/ExceptionStatePlaceholder.h" 37 #include "bindings/v8/ExceptionStatePlaceholder.h"
38 #include "core/dom/DocumentFragment.h" 38 #include "core/dom/DocumentFragment.h"
39 #include "core/dom/NodeTraversal.h" 39 #include "core/dom/NodeTraversal.h"
40 #include "core/events/Event.h" 40 #include "core/events/Event.h"
41 #include "core/frame/UseCounter.h"
41 #include "core/html/HTMLDivElement.h" 42 #include "core/html/HTMLDivElement.h"
42 #include "core/html/track/TextTrack.h" 43 #include "core/html/track/TextTrack.h"
43 #include "core/html/track/TextTrackCueList.h" 44 #include "core/html/track/TextTrackCueList.h"
44 #include "core/html/track/vtt/VTTElement.h" 45 #include "core/html/track/vtt/VTTElement.h"
45 #include "core/html/track/vtt/VTTParser.h" 46 #include "core/html/track/vtt/VTTParser.h"
46 #include "core/html/track/vtt/VTTRegionList.h" 47 #include "core/html/track/vtt/VTTRegionList.h"
47 #include "core/html/track/vtt/VTTScanner.h" 48 #include "core/html/track/vtt/VTTScanner.h"
48 #include "core/rendering/RenderVTTCue.h" 49 #include "core/rendering/RenderVTTCue.h"
49 #include "platform/text/BidiResolver.h" 50 #include "platform/text/BidiResolver.h"
50 #include "platform/text/TextRunIterator.h" 51 #include "platform/text/TextRunIterator.h"
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 , m_cueAlignment(Middle) 211 , m_cueAlignment(Middle)
211 , m_vttNodeTree(nullptr) 212 , m_vttNodeTree(nullptr)
212 , m_cueBackgroundBox(HTMLDivElement::create(document)) 213 , m_cueBackgroundBox(HTMLDivElement::create(document))
213 , m_displayDirection(CSSValueLtr) 214 , m_displayDirection(CSSValueLtr)
214 , m_displaySize(undefinedSize) 215 , m_displaySize(undefinedSize)
215 , m_snapToLines(true) 216 , m_snapToLines(true)
216 , m_displayTreeShouldChange(true) 217 , m_displayTreeShouldChange(true)
217 , m_notifyRegion(true) 218 , m_notifyRegion(true)
218 { 219 {
219 ScriptWrappable::init(this); 220 ScriptWrappable::init(this);
221 UseCounter::count(document, UseCounter::VTTCue);
220 } 222 }
221 223
222 VTTCue::~VTTCue() 224 VTTCue::~VTTCue()
223 { 225 {
224 // FIXME: This is scary, we should make the life cycle smarter so the destru ctor 226 // FIXME: This is scary, we should make the life cycle smarter so the destru ctor
225 // doesn't need to do DOM mutations. 227 // doesn't need to do DOM mutations.
226 if (m_displayTree) 228 if (m_displayTree)
227 m_displayTree->remove(ASSERT_NO_EXCEPTION); 229 m_displayTree->remove(ASSERT_NO_EXCEPTION);
228 } 230 }
229 231
(...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after
753 if (region) 755 if (region)
754 region->willRemoveVTTCueBox(m_displayTree.get()); 756 region->willRemoveVTTCueBox(m_displayTree.get());
755 } 757 }
756 758
757 if (m_displayTree) 759 if (m_displayTree)
758 m_displayTree->remove(ASSERT_NO_EXCEPTION); 760 m_displayTree->remove(ASSERT_NO_EXCEPTION);
759 } 761 }
760 762
761 void VTTCue::updateDisplay(const IntSize& videoSize, HTMLDivElement& container) 763 void VTTCue::updateDisplay(const IntSize& videoSize, HTMLDivElement& container)
762 { 764 {
765 UseCounter::count(document(), UseCounter::VTTCueRender);
766
767 if (m_writingDirection != Horizontal)
768 UseCounter::count(document(), UseCounter::VTTCueRenderVertical);
769
770 if (!m_snapToLines)
771 UseCounter::count(document(), UseCounter::VTTCueRenderSnapToLinesFalse);
772
773 if (m_linePosition != undefinedPosition)
774 UseCounter::count(document(), UseCounter::VTTCueRenderLineNotAuto);
775
776 if (m_textPosition != 50)
777 UseCounter::count(document(), UseCounter::VTTCueRenderPositionNot50);
778
779 if (m_cueSize != 100)
780 UseCounter::count(document(), UseCounter::VTTCueRenderSizeNot100);
781
782 if (m_cueAlignment != Middle)
783 UseCounter::count(document(), UseCounter::VTTCueRenderAlignNotMiddle);
784
763 RefPtr<VTTCueBox> displayBox = getDisplayTree(videoSize); 785 RefPtr<VTTCueBox> displayBox = getDisplayTree(videoSize);
764 VTTRegion* region = 0; 786 VTTRegion* region = 0;
765 if (track()->regions()) 787 if (track()->regions())
766 region = track()->regions()->getRegionById(regionId()); 788 region = track()->regions()->getRegionById(regionId());
767 789
768 if (!region) { 790 if (!region) {
769 // If cue has an empty text track cue region identifier or there is no 791 // If cue has an empty text track cue region identifier or there is no
770 // WebVTT region whose region identifier is identical to cue's text 792 // WebVTT region whose region identifier is identical to cue's text
771 // track cue region identifier, run the following substeps: 793 // track cue region identifier, run the following substeps:
772 if (displayBox->hasChildren() && !container.contains(displayBox.get())) { 794 if (displayBox->hasChildren() && !container.contains(displayBox.get())) {
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
1060 ASSERT(m_cueBackgroundBox); 1082 ASSERT(m_cueBackgroundBox);
1061 return m_cueBackgroundBox->document(); 1083 return m_cueBackgroundBox->document();
1062 } 1084 }
1063 1085
1064 void VTTCue::trace(Visitor* visitor) 1086 void VTTCue::trace(Visitor* visitor)
1065 { 1087 {
1066 TextTrackCue::trace(visitor); 1088 TextTrackCue::trace(visitor);
1067 } 1089 }
1068 1090
1069 } // namespace WebCore 1091 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/frame/UseCounter.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698