| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/css/MediaValuesCached.h" | 5 #include "core/css/MediaValuesCached.h" |
| 6 | 6 |
| 7 #include "core/css/CSSPrimitiveValue.h" | 7 #include "core/css/CSSPrimitiveValue.h" |
| 8 #include "core/dom/Document.h" | 8 #include "core/dom/Document.h" |
| 9 #include "core/frame/LocalFrame.h" | 9 #include "core/frame/LocalFrame.h" |
| 10 #include "core/layout/LayoutObject.h" | 10 #include "core/layout/LayoutObject.h" |
| 11 | 11 |
| 12 namespace blink { | 12 namespace blink { |
| 13 | 13 |
| 14 PassRefPtrWillBeRawPtr<MediaValuesCached> MediaValuesCached::create() | 14 RawPtr<MediaValuesCached> MediaValuesCached::create() |
| 15 { | 15 { |
| 16 return adoptRefWillBeNoop(new MediaValuesCached()); | 16 return (new MediaValuesCached()); |
| 17 } | 17 } |
| 18 | 18 |
| 19 PassRefPtrWillBeRawPtr<MediaValuesCached> MediaValuesCached::create(MediaValuesC
achedData& data) | 19 RawPtr<MediaValuesCached> MediaValuesCached::create(MediaValuesCachedData& data) |
| 20 { | 20 { |
| 21 return adoptRefWillBeNoop(new MediaValuesCached(data)); | 21 return (new MediaValuesCached(data)); |
| 22 } | 22 } |
| 23 | 23 |
| 24 PassRefPtrWillBeRawPtr<MediaValuesCached> MediaValuesCached::create(Document& do
cument) | 24 RawPtr<MediaValuesCached> MediaValuesCached::create(Document& document) |
| 25 { | 25 { |
| 26 return MediaValuesCached::create(frameFrom(document)); | 26 return MediaValuesCached::create(frameFrom(document)); |
| 27 } | 27 } |
| 28 | 28 |
| 29 PassRefPtrWillBeRawPtr<MediaValuesCached> MediaValuesCached::create(LocalFrame*
frame) | 29 RawPtr<MediaValuesCached> MediaValuesCached::create(LocalFrame* frame) |
| 30 { | 30 { |
| 31 // FIXME - Added an assert here so we can better understand when a frame is
present without its view(). | 31 // FIXME - Added an assert here so we can better understand when a frame is
present without its view(). |
| 32 ASSERT(!frame || frame->view()); | 32 ASSERT(!frame || frame->view()); |
| 33 if (!frame || !frame->view()) | 33 if (!frame || !frame->view()) |
| 34 return adoptRefWillBeNoop(new MediaValuesCached()); | 34 return (new MediaValuesCached()); |
| 35 ASSERT(frame->document() && frame->document()->layoutView()); | 35 ASSERT(frame->document() && frame->document()->layoutView()); |
| 36 return adoptRefWillBeNoop(new MediaValuesCached(frame)); | 36 return (new MediaValuesCached(frame)); |
| 37 } | 37 } |
| 38 | 38 |
| 39 MediaValuesCached::MediaValuesCached() | 39 MediaValuesCached::MediaValuesCached() |
| 40 { | 40 { |
| 41 } | 41 } |
| 42 | 42 |
| 43 MediaValuesCached::MediaValuesCached(LocalFrame* frame) | 43 MediaValuesCached::MediaValuesCached(LocalFrame* frame) |
| 44 { | 44 { |
| 45 ASSERT(isMainThread()); | 45 ASSERT(isMainThread()); |
| 46 ASSERT(frame); | 46 ASSERT(frame); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 64 const String mediaType = calculateMediaType(frame); | 64 const String mediaType = calculateMediaType(frame); |
| 65 if (!mediaType.isEmpty()) | 65 if (!mediaType.isEmpty()) |
| 66 m_data.mediaType = mediaType.isolatedCopy(); | 66 m_data.mediaType = mediaType.isolatedCopy(); |
| 67 } | 67 } |
| 68 | 68 |
| 69 MediaValuesCached::MediaValuesCached(const MediaValuesCachedData& data) | 69 MediaValuesCached::MediaValuesCached(const MediaValuesCachedData& data) |
| 70 : m_data(data) | 70 : m_data(data) |
| 71 { | 71 { |
| 72 } | 72 } |
| 73 | 73 |
| 74 PassRefPtrWillBeRawPtr<MediaValues> MediaValuesCached::copy() const | 74 RawPtr<MediaValues> MediaValuesCached::copy() const |
| 75 { | 75 { |
| 76 return adoptRefWillBeNoop(new MediaValuesCached(m_data)); | 76 return (new MediaValuesCached(m_data)); |
| 77 } | 77 } |
| 78 | 78 |
| 79 bool MediaValuesCached::computeLength(double value, CSSPrimitiveValue::UnitType
type, int& result) const | 79 bool MediaValuesCached::computeLength(double value, CSSPrimitiveValue::UnitType
type, int& result) const |
| 80 { | 80 { |
| 81 return MediaValues::computeLength(value, type, m_data.defaultFontSize, m_dat
a.viewportWidth, m_data.viewportHeight, result); | 81 return MediaValues::computeLength(value, type, m_data.defaultFontSize, m_dat
a.viewportWidth, m_data.viewportHeight, result); |
| 82 } | 82 } |
| 83 | 83 |
| 84 bool MediaValuesCached::computeLength(double value, CSSPrimitiveValue::UnitType
type, double& result) const | 84 bool MediaValuesCached::computeLength(double value, CSSPrimitiveValue::UnitType
type, double& result) const |
| 85 { | 85 { |
| 86 return MediaValues::computeLength(value, type, m_data.defaultFontSize, m_dat
a.viewportWidth, m_data.viewportHeight, result); | 86 return MediaValues::computeLength(value, type, m_data.defaultFontSize, m_dat
a.viewportWidth, m_data.viewportHeight, result); |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 { | 188 { |
| 189 m_data.viewportWidth = width; | 189 m_data.viewportWidth = width; |
| 190 } | 190 } |
| 191 | 191 |
| 192 void MediaValuesCached::setViewportHeight(double height) | 192 void MediaValuesCached::setViewportHeight(double height) |
| 193 { | 193 { |
| 194 m_data.viewportHeight = height; | 194 m_data.viewportHeight = height; |
| 195 } | 195 } |
| 196 | 196 |
| 197 } // namespace blink | 197 } // namespace blink |
| OLD | NEW |