OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012-2013 Intel Corporation. All rights reserved. | 2 * Copyright (C) 2012-2013 Intel Corporation. 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 * | 7 * |
8 * 1. Redistributions of source code must retain the above | 8 * 1. Redistributions of source code must retain the above |
9 * copyright notice, this list of conditions and the following | 9 * copyright notice, this list of conditions and the following |
10 * disclaimer. | 10 * disclaimer. |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 if (documentStyle->hasViewportUnits()) | 292 if (documentStyle->hasViewportUnits()) |
293 m_hasViewportUnits = true; | 293 m_hasViewportUnits = true; |
294 documentStyle->setHasViewportUnits(documentStyleHasViewportUnits); | 294 documentStyle->setHasViewportUnits(documentStyleHasViewportUnits); |
295 | 295 |
296 return result; | 296 return result; |
297 } | 297 } |
298 | 298 |
299 void ViewportStyleResolver::initialViewportChanged() { | 299 void ViewportStyleResolver::initialViewportChanged() { |
300 if (m_needsUpdate == CollectRules) | 300 if (m_needsUpdate == CollectRules) |
301 return; | 301 return; |
| 302 if (m_hasViewportUnits) |
| 303 m_needsUpdate = Resolve; |
302 | 304 |
303 auto& results = m_viewportDependentMediaQueryResults; | 305 auto& results = m_viewportDependentMediaQueryResults; |
304 for (unsigned i = 0; i < results.size(); i++) { | 306 for (unsigned i = 0; i < results.size(); i++) { |
305 if (m_initialViewportMedium->eval(results[i]->expression()) != | 307 if (m_initialViewportMedium->eval(results[i]->expression()) != |
306 results[i]->result()) { | 308 results[i]->result()) { |
307 m_needsUpdate = CollectRules; | 309 m_needsUpdate = CollectRules; |
308 return; | 310 break; |
309 } | 311 } |
310 } | 312 } |
311 if (m_hasViewportUnits) | 313 if (m_needsUpdate == NoUpdate) |
312 m_needsUpdate = Resolve; | 314 return; |
| 315 m_document->scheduleLayoutTreeUpdateIfNeeded(); |
313 } | 316 } |
314 | 317 |
315 void ViewportStyleResolver::setNeedsCollectRules() { | 318 void ViewportStyleResolver::setNeedsCollectRules() { |
316 m_needsUpdate = CollectRules; | 319 m_needsUpdate = CollectRules; |
| 320 m_document->scheduleLayoutTreeUpdateIfNeeded(); |
317 } | 321 } |
318 | 322 |
319 void ViewportStyleResolver::updateViewport( | 323 void ViewportStyleResolver::updateViewport( |
320 DocumentStyleSheetCollection& collection) { | 324 DocumentStyleSheetCollection& collection) { |
321 if (m_needsUpdate == NoUpdate) | 325 if (m_needsUpdate == NoUpdate) |
322 return; | 326 return; |
323 if (m_needsUpdate == CollectRules) { | 327 if (m_needsUpdate == CollectRules) { |
324 reset(); | 328 reset(); |
325 collectViewportRulesFromUASheets(); | 329 collectViewportRulesFromUASheets(); |
326 if (RuntimeEnabledFeatures::cssViewportEnabled()) | 330 if (RuntimeEnabledFeatures::cssViewportEnabled()) |
327 collection.collectViewportRules(*this); | 331 collection.collectViewportRules(*this); |
328 } | 332 } |
329 resolve(); | 333 resolve(); |
330 m_needsUpdate = NoUpdate; | 334 m_needsUpdate = NoUpdate; |
331 } | 335 } |
332 | 336 |
333 DEFINE_TRACE(ViewportStyleResolver) { | 337 DEFINE_TRACE(ViewportStyleResolver) { |
334 visitor->trace(m_document); | 338 visitor->trace(m_document); |
335 visitor->trace(m_propertySet); | 339 visitor->trace(m_propertySet); |
336 visitor->trace(m_initialViewportMedium); | 340 visitor->trace(m_initialViewportMedium); |
337 visitor->trace(m_viewportDependentMediaQueryResults); | 341 visitor->trace(m_viewportDependentMediaQueryResults); |
338 visitor->trace(m_deviceDependentMediaQueryResults); | 342 visitor->trace(m_deviceDependentMediaQueryResults); |
339 } | 343 } |
340 | 344 |
341 } // namespace blink | 345 } // namespace blink |
OLD | NEW |