| 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 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 309 { | 309 { |
| 310 collector.clearMatchedRules(); | 310 collector.clearMatchedRules(); |
| 311 collector.matchedResult().ranges.lastUARule = collector.matchedResult().matc
hedProperties.size() - 1; | 311 collector.matchedResult().ranges.lastUARule = collector.matchedResult().matc
hedProperties.size() - 1; |
| 312 | 312 |
| 313 RuleRange ruleRange = collector.matchedResult().ranges.UARuleRange(); | 313 RuleRange ruleRange = collector.matchedResult().ranges.UARuleRange(); |
| 314 collector.collectMatchingRules(MatchRequest(rules), ruleRange); | 314 collector.collectMatchingRules(MatchRequest(rules), ruleRange); |
| 315 | 315 |
| 316 collector.sortAndTransferMatchedRules(); | 316 collector.sortAndTransferMatchedRules(); |
| 317 } | 317 } |
| 318 | 318 |
| 319 void StyleResolver::matchAllRules(StyleResolverState& state, ElementRuleCollecto
r& collector, bool includeSMILProperties) | 319 void StyleResolver::matchAllRules(StyleResolverState& state, ElementRuleCollecto
r& collector) |
| 320 { | 320 { |
| 321 matchUARules(collector); | 321 matchUARules(collector); |
| 322 matchAuthorRules(state.element(), collector, false); | 322 matchAuthorRules(state.element(), collector, false); |
| 323 | 323 |
| 324 if (state.element()->isStyledElement()) { | 324 if (state.element()->isStyledElement()) { |
| 325 if (state.element()->inlineStyle()) { | 325 if (state.element()->inlineStyle()) { |
| 326 // Inline style is immutable as long as there is no CSSOM wrapper. | 326 // Inline style is immutable as long as there is no CSSOM wrapper. |
| 327 bool isInlineStyleCacheable = !state.element()->inlineStyle()->isMut
able(); | 327 bool isInlineStyleCacheable = !state.element()->inlineStyle()->isMut
able(); |
| 328 collector.addElementStyleProperties(state.element()->inlineStyle(),
isInlineStyleCacheable); | 328 collector.addElementStyleProperties(state.element()->inlineStyle(),
isInlineStyleCacheable); |
| 329 } | 329 } |
| (...skipping 14 matching lines...) Expand all Loading... |
| 344 return documentStyle.release(); | 344 return documentStyle.release(); |
| 345 } | 345 } |
| 346 | 346 |
| 347 // Start loading resources referenced by this style. | 347 // Start loading resources referenced by this style. |
| 348 void StyleResolver::loadPendingResources(StyleResolverState& state) | 348 void StyleResolver::loadPendingResources(StyleResolverState& state) |
| 349 { | 349 { |
| 350 m_styleResourceLoader.loadPendingResources(state.style(), state.elementStyle
Resources()); | 350 m_styleResourceLoader.loadPendingResources(state.style(), state.elementStyle
Resources()); |
| 351 document().styleEngine()->fontSelector()->fontLoader()->loadPendingFonts(); | 351 document().styleEngine()->fontSelector()->fontLoader()->loadPendingFonts(); |
| 352 } | 352 } |
| 353 | 353 |
| 354 PassRefPtr<RenderStyle> StyleResolver::styleForElement(Element* element, RenderS
tyle* defaultParent, StyleSharingBehavior sharingBehavior, | 354 PassRefPtr<RenderStyle> StyleResolver::styleForElement(Element* element, RenderS
tyle* defaultParent) |
| 355 RuleMatchingBehavior matchingBehavior) | |
| 356 { | 355 { |
| 357 ASSERT(document().frame()); | 356 ASSERT(document().frame()); |
| 358 ASSERT(document().settings()); | 357 ASSERT(document().settings()); |
| 359 ASSERT(!hasPendingAuthorStyleSheets()); | 358 ASSERT(!hasPendingAuthorStyleSheets()); |
| 360 | 359 |
| 361 didAccess(); | 360 didAccess(); |
| 362 | 361 |
| 363 if (element == document().documentElement()) | 362 if (element == document().documentElement()) |
| 364 document().setDirectionSetOnDocumentElement(false); | 363 document().setDirectionSetOnDocumentElement(false); |
| 365 StyleResolverState state(document(), element, defaultParent); | 364 StyleResolverState state(document(), element, defaultParent); |
| 366 | 365 |
| 367 if (sharingBehavior == AllowStyleSharing && state.parentStyle()) { | 366 if (state.parentStyle()) { |
| 368 SharedStyleFinder styleFinder(state.elementContext(), *this); | 367 SharedStyleFinder styleFinder(state.elementContext(), *this); |
| 369 if (RefPtr<RenderStyle> sharedStyle = styleFinder.findSharedStyle()) | 368 if (RefPtr<RenderStyle> sharedStyle = styleFinder.findSharedStyle()) |
| 370 return sharedStyle.release(); | 369 return sharedStyle.release(); |
| 371 } | 370 } |
| 372 | 371 |
| 373 if (state.parentStyle()) { | 372 if (state.parentStyle()) { |
| 374 state.setStyle(RenderStyle::create()); | 373 state.setStyle(RenderStyle::create()); |
| 375 state.style()->inheritFrom(state.parentStyle(), isAtShadowBoundary(eleme
nt) ? RenderStyle::AtShadowBoundary : RenderStyle::NotAtShadowBoundary); | 374 state.style()->inheritFrom(state.parentStyle(), isAtShadowBoundary(eleme
nt) ? RenderStyle::AtShadowBoundary : RenderStyle::NotAtShadowBoundary); |
| 376 } else { | 375 } else { |
| 377 state.setStyle(defaultStyleForElement()); | 376 state.setStyle(defaultStyleForElement()); |
| 378 state.setParentStyle(RenderStyle::clone(state.style())); | 377 state.setParentStyle(RenderStyle::clone(state.style())); |
| 379 } | 378 } |
| 380 // contenteditable attribute (implemented by -webkit-user-modify) should | 379 // contenteditable attribute (implemented by -webkit-user-modify) should |
| 381 // be propagated from shadow host to distributed node. | 380 // be propagated from shadow host to distributed node. |
| 382 if (state.distributedToInsertionPoint()) { | 381 if (state.distributedToInsertionPoint()) { |
| 383 if (Element* parent = element->parentElement()) { | 382 if (Element* parent = element->parentElement()) { |
| 384 if (RenderStyle* styleOfShadowHost = parent->renderStyle()) | 383 if (RenderStyle* styleOfShadowHost = parent->renderStyle()) |
| 385 state.style()->setUserModify(styleOfShadowHost->userModify()); | 384 state.style()->setUserModify(styleOfShadowHost->userModify()); |
| 386 } | 385 } |
| 387 } | 386 } |
| 388 | 387 |
| 389 state.fontBuilder().initForStyleResolve(state.document(), state.style()); | 388 state.fontBuilder().initForStyleResolve(state.document(), state.style()); |
| 390 | 389 |
| 391 { | 390 { |
| 392 ElementRuleCollector collector(state.elementContext(), state.style()); | 391 ElementRuleCollector collector(state.elementContext(), state.style()); |
| 393 | 392 |
| 394 matchAllRules(state, collector, matchingBehavior != MatchAllRulesExcludi
ngSMIL); | 393 matchAllRules(state, collector); |
| 395 | 394 |
| 396 applyMatchedProperties(state, collector.matchedResult()); | 395 applyMatchedProperties(state, collector.matchedResult()); |
| 397 } | 396 } |
| 398 | 397 |
| 399 // Cache our original display. | 398 // Cache our original display. |
| 400 state.style()->setOriginalDisplay(state.style()->display()); | 399 state.style()->setOriginalDisplay(state.style()->display()); |
| 401 | 400 |
| 402 StyleAdjuster adjuster; | 401 StyleAdjuster adjuster; |
| 403 adjuster.adjustRenderStyle(state.style(), state.parentStyle(), *element); | 402 adjuster.adjustRenderStyle(state.style(), state.parentStyle(), *element); |
| 404 | 403 |
| (...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 859 bool StyleResolver::mediaQueryAffectedByViewportChange() const | 858 bool StyleResolver::mediaQueryAffectedByViewportChange() const |
| 860 { | 859 { |
| 861 for (unsigned i = 0; i < m_viewportDependentMediaQueryResults.size(); ++i) { | 860 for (unsigned i = 0; i < m_viewportDependentMediaQueryResults.size(); ++i) { |
| 862 if (m_medium->eval(m_viewportDependentMediaQueryResults[i]->expression()
) != m_viewportDependentMediaQueryResults[i]->result()) | 861 if (m_medium->eval(m_viewportDependentMediaQueryResults[i]->expression()
) != m_viewportDependentMediaQueryResults[i]->result()) |
| 863 return true; | 862 return true; |
| 864 } | 863 } |
| 865 return false; | 864 return false; |
| 866 } | 865 } |
| 867 | 866 |
| 868 } // namespace blink | 867 } // namespace blink |
| OLD | NEW |