Chromium Code Reviews| 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 "config.h" | 5 #include "config.h" |
| 6 #include "core/css/MediaValues.h" | 6 #include "core/css/MediaValues.h" |
| 7 | 7 |
| 8 #include "core/dom/Document.h" | 8 #include "core/dom/Document.h" |
| 9 #include "core/dom/Element.h" | 9 #include "core/dom/Element.h" |
| 10 #include "core/frame/FrameHost.h" | 10 #include "core/frame/FrameHost.h" |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 186 mediaValues->m_printMediaType = calculatePrintMediaType(frame), | 186 mediaValues->m_printMediaType = calculatePrintMediaType(frame), |
| 187 mediaValues->m_strictMode = calculateStrictMode(frame); | 187 mediaValues->m_strictMode = calculateStrictMode(frame); |
| 188 | 188 |
| 189 mediaValues->m_style.clear(); | 189 mediaValues->m_style.clear(); |
| 190 mediaValues->m_frame = 0; | 190 mediaValues->m_frame = 0; |
| 191 } | 191 } |
| 192 | 192 |
| 193 return mediaValues; | 193 return mediaValues; |
| 194 } | 194 } |
| 195 | 195 |
| 196 PassRefPtr<MediaValues> MediaValues::create(Document* document, MediaValuesMode mode) | 196 PassRefPtr<MediaValues> MediaValues::create(const Document& document, MediaValue sMode mode) |
| 197 { | 197 { |
| 198 ASSERT(document); | 198 const Document* executingDocument = document.import() ? document.import()->m aster() : &document; |
|
eseidel
2014/04/08 06:02:14
const pointers to ref-counted objects rarely make
| |
| 199 Document* executingDocument = document->import() ? document->import()->maste r() : document; | |
| 200 ASSERT(executingDocument->frame()); | 199 ASSERT(executingDocument->frame()); |
| 201 ASSERT(executingDocument->renderer()); | 200 ASSERT(executingDocument->renderer()); |
| 202 ASSERT(executingDocument->renderer()->style()); | 201 ASSERT(executingDocument->renderer()->style()); |
| 203 LocalFrame* frame = executingDocument->frame(); | 202 LocalFrame* frame = executingDocument->frame(); |
| 204 RenderStyle* style = executingDocument->renderer()->style(); | 203 RenderStyle* style = executingDocument->renderer()->style(); |
| 205 | 204 |
| 206 return MediaValues::create(frame, style, mode); | 205 return MediaValues::create(frame, style, mode); |
| 207 } | 206 } |
| 208 | 207 |
| 209 PassRefPtr<MediaValues> MediaValues::copy() const | 208 PassRefPtr<MediaValues> MediaValues::copy() const |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 332 } | 331 } |
| 333 | 332 |
| 334 Document* MediaValues::document() const | 333 Document* MediaValues::document() const |
| 335 { | 334 { |
| 336 if (!m_frame) | 335 if (!m_frame) |
| 337 return 0; | 336 return 0; |
| 338 return m_frame->document(); | 337 return m_frame->document(); |
| 339 } | 338 } |
| 340 | 339 |
| 341 } // namespace | 340 } // namespace |
| OLD | NEW |