| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com) | 3 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com) |
| 4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com) | 4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com) |
| 5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc.
All rights reserved. | 5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc.
All rights reserved. |
| 6 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> | 6 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> |
| 7 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> | 7 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> |
| 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) | 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) |
| 9 * Copyright (c) 2011, Code Aurora Forum. All rights reserved. | 9 * Copyright (c) 2011, Code Aurora Forum. All rights reserved. |
| 10 * Copyright (C) Research In Motion Limited 2011. All rights reserved. | 10 * Copyright (C) Research In Motion Limited 2011. All rights reserved. |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 // If any changes to CSS Animations were detected, stash the update away for
application after the | 81 // If any changes to CSS Animations were detected, stash the update away for
application after the |
| 82 // render object is updated if we're in the appropriate scope. | 82 // render object is updated if we're in the appropriate scope. |
| 83 if (state.animationUpdate()) | 83 if (state.animationUpdate()) |
| 84 element.ensureActiveAnimations().cssAnimations().setPendingUpdate(state.
takeAnimationUpdate()); | 84 element.ensureActiveAnimations().cssAnimations().setPendingUpdate(state.
takeAnimationUpdate()); |
| 85 } | 85 } |
| 86 | 86 |
| 87 } // namespace | 87 } // namespace |
| 88 | 88 |
| 89 namespace blink { | 89 namespace blink { |
| 90 | 90 |
| 91 RenderStyle* StyleResolver::s_styleNotYetAvailable; | |
| 92 | |
| 93 static void addFontFaceRule(Document* document, CSSFontSelector* cssFontSelector
, const StyleRuleFontFace* fontFaceRule) | 91 static void addFontFaceRule(Document* document, CSSFontSelector* cssFontSelector
, const StyleRuleFontFace* fontFaceRule) |
| 94 { | 92 { |
| 95 RefPtr<FontFace> fontFace = FontFace::create(document, fontFaceRule); | 93 RefPtr<FontFace> fontFace = FontFace::create(document, fontFaceRule); |
| 96 if (fontFace) | 94 if (fontFace) |
| 97 cssFontSelector->fontFaceCache()->add(cssFontSelector, fontFaceRule, fon
tFace); | 95 cssFontSelector->fontFaceCache()->add(cssFontSelector, fontFaceRule, fon
tFace); |
| 98 } | 96 } |
| 99 | 97 |
| 100 static RuleSet& defaultStyles() | 98 static RuleSet& defaultStyles() |
| 101 { | 99 { |
| 102 DEFINE_STATIC_LOCAL(RefPtr<StyleSheetContents>, styleSheet, ()); | 100 DEFINE_STATIC_LOCAL(RefPtr<StyleSheetContents>, styleSheet, ()); |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 } | 388 } |
| 391 | 389 |
| 392 PassRefPtr<RenderStyle> StyleResolver::styleForElement(Element* element, RenderS
tyle* defaultParent, StyleSharingBehavior sharingBehavior, | 390 PassRefPtr<RenderStyle> StyleResolver::styleForElement(Element* element, RenderS
tyle* defaultParent, StyleSharingBehavior sharingBehavior, |
| 393 RuleMatchingBehavior matchingBehavior) | 391 RuleMatchingBehavior matchingBehavior) |
| 394 { | 392 { |
| 395 ASSERT(document().frame()); | 393 ASSERT(document().frame()); |
| 396 ASSERT(document().settings()); | 394 ASSERT(document().settings()); |
| 397 ASSERT(!hasPendingAuthorStyleSheets()); | 395 ASSERT(!hasPendingAuthorStyleSheets()); |
| 398 ASSERT(!m_needCollectFeatures); | 396 ASSERT(!m_needCollectFeatures); |
| 399 | 397 |
| 400 // Once an element has a renderer, we don't try to destroy it, since otherwi
se the renderer | |
| 401 // will vanish if a style recalc happens during loading. | |
| 402 if (sharingBehavior == AllowStyleSharing && !document().isRenderingReady() &
& !element->renderer()) { | |
| 403 if (!s_styleNotYetAvailable) { | |
| 404 s_styleNotYetAvailable = RenderStyle::create().leakRef(); | |
| 405 s_styleNotYetAvailable->setDisplay(NONE); | |
| 406 s_styleNotYetAvailable->font().update(document().styleEngine()->font
Selector()); | |
| 407 } | |
| 408 | |
| 409 document().setHasNodesWithPlaceholderStyle(); | |
| 410 return s_styleNotYetAvailable; | |
| 411 } | |
| 412 | |
| 413 didAccess(); | 398 didAccess(); |
| 414 | 399 |
| 415 if (element == document().documentElement()) | 400 if (element == document().documentElement()) |
| 416 document().setDirectionSetOnDocumentElement(false); | 401 document().setDirectionSetOnDocumentElement(false); |
| 417 StyleResolverState state(document(), element, defaultParent); | 402 StyleResolverState state(document(), element, defaultParent); |
| 418 | 403 |
| 419 if (sharingBehavior == AllowStyleSharing && state.parentStyle()) { | 404 if (sharingBehavior == AllowStyleSharing && state.parentStyle()) { |
| 420 SharedStyleFinder styleFinder(state.elementContext(), m_features, *this)
; | 405 SharedStyleFinder styleFinder(state.elementContext(), m_features, *this)
; |
| 421 if (RefPtr<RenderStyle> sharedStyle = styleFinder.findSharedStyle()) | 406 if (RefPtr<RenderStyle> sharedStyle = styleFinder.findSharedStyle()) |
| 422 return sharedStyle.release(); | 407 return sharedStyle.release(); |
| (...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 911 bool StyleResolver::mediaQueryAffectedByViewportChange() const | 896 bool StyleResolver::mediaQueryAffectedByViewportChange() const |
| 912 { | 897 { |
| 913 for (unsigned i = 0; i < m_viewportDependentMediaQueryResults.size(); ++i) { | 898 for (unsigned i = 0; i < m_viewportDependentMediaQueryResults.size(); ++i) { |
| 914 if (m_medium->eval(m_viewportDependentMediaQueryResults[i]->expression()
) != m_viewportDependentMediaQueryResults[i]->result()) | 899 if (m_medium->eval(m_viewportDependentMediaQueryResults[i]->expression()
) != m_viewportDependentMediaQueryResults[i]->result()) |
| 915 return true; | 900 return true; |
| 916 } | 901 } |
| 917 return false; | 902 return false; |
| 918 } | 903 } |
| 919 | 904 |
| 920 } // namespace blink | 905 } // namespace blink |
| OLD | NEW |