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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 #include "core/dom/NodeRenderStyle.h" | 73 #include "core/dom/NodeRenderStyle.h" |
74 #include "core/dom/StyleEngine.h" | 74 #include "core/dom/StyleEngine.h" |
75 #include "core/dom/Text.h" | 75 #include "core/dom/Text.h" |
76 #include "core/dom/shadow/ElementShadow.h" | 76 #include "core/dom/shadow/ElementShadow.h" |
77 #include "core/dom/shadow/ShadowRoot.h" | 77 #include "core/dom/shadow/ShadowRoot.h" |
78 #include "core/frame/FrameView.h" | 78 #include "core/frame/FrameView.h" |
79 #include "core/frame/LocalFrame.h" | 79 #include "core/frame/LocalFrame.h" |
80 #include "core/html/HTMLIFrameElement.h" | 80 #include "core/html/HTMLIFrameElement.h" |
81 #include "core/inspector/InspectorInstrumentation.h" | 81 #include "core/inspector/InspectorInstrumentation.h" |
82 #include "core/rendering/RenderView.h" | 82 #include "core/rendering/RenderView.h" |
| 83 #include "core/rendering/style/CachedUAStyle.h" |
83 #include "core/rendering/style/KeyframeList.h" | 84 #include "core/rendering/style/KeyframeList.h" |
| 85 #include "core/rendering/style/UAStyleChange.h" |
84 #include "core/svg/SVGDocumentExtensions.h" | 86 #include "core/svg/SVGDocumentExtensions.h" |
85 #include "core/svg/SVGElement.h" | 87 #include "core/svg/SVGElement.h" |
86 #include "platform/RuntimeEnabledFeatures.h" | 88 #include "platform/RuntimeEnabledFeatures.h" |
87 #include "wtf/StdLibExtras.h" | 89 #include "wtf/StdLibExtras.h" |
88 | 90 |
89 namespace { | 91 namespace { |
90 | 92 |
91 using namespace blink; | 93 using namespace blink; |
92 | 94 |
93 void setAnimationUpdateIfNeeded(StyleResolverState& state, Element& element) | 95 void setAnimationUpdateIfNeeded(StyleResolverState& state, Element& element) |
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
519 // so that the common case doesn't need to create a new RenderStyle in | 521 // so that the common case doesn't need to create a new RenderStyle in |
520 // Document::inheritHtmlAndBodyElementStyles. | 522 // Document::inheritHtmlAndBodyElementStyles. |
521 documentStyle->setDisplay(BLOCK); | 523 documentStyle->setDisplay(BLOCK); |
522 documentStyle->setScrollBlocksOn(WebScrollBlocksOnStartTouch | WebScrollBloc
ksOnWheelEvent); | 524 documentStyle->setScrollBlocksOn(WebScrollBlocksOnStartTouch | WebScrollBloc
ksOnWheelEvent); |
523 | 525 |
524 document.setupFontBuilder(documentStyle.get()); | 526 document.setupFontBuilder(documentStyle.get()); |
525 | 527 |
526 return documentStyle.release(); | 528 return documentStyle.release(); |
527 } | 529 } |
528 | 530 |
| 531 static UAStyleChange uaStyleChange(StyleResolverState& state) |
| 532 { |
| 533 const CachedUAStyle* cachedUAStyle = state.cachedUAStyle(); |
| 534 |
| 535 if (!cachedUAStyle) |
| 536 return UAStyleChange(false); |
| 537 |
| 538 UAStyleChange uaStyle(true); |
| 539 |
| 540 // Exclude background-repeat from comparison by resetting it. |
| 541 FillLayer backgroundCopy = cachedUAStyle->backgroundLayers; |
| 542 FillLayer backgroundLayersCopy = state.style()->backgroundLayers(); |
| 543 backgroundCopy.setRepeatX(NoRepeatFill); |
| 544 backgroundCopy.setRepeatY(NoRepeatFill); |
| 545 backgroundLayersCopy.setRepeatX(NoRepeatFill); |
| 546 backgroundLayersCopy.setRepeatY(NoRepeatFill); |
| 547 |
| 548 uaStyle.backgroundChanged = backgroundLayersCopy != backgroundCopy |
| 549 || state.style()->visitedDependentColor(CSSPropertyBackgroundColor) != c
achedUAStyle->backgroundColor; |
| 550 uaStyle.borderChanged = state.style()->border() != cachedUAStyle->border; |
| 551 |
| 552 return uaStyle; |
| 553 } |
| 554 |
529 void StyleResolver::adjustRenderStyle(StyleResolverState& state, Element* elemen
t) | 555 void StyleResolver::adjustRenderStyle(StyleResolverState& state, Element* elemen
t) |
530 { | 556 { |
531 StyleAdjuster adjuster(document().inQuirksMode()); | 557 StyleAdjuster adjuster(document().inQuirksMode()); |
532 adjuster.adjustRenderStyle(state.style(), state.parentStyle(), element, stat
e.cachedUAStyle()); | 558 adjuster.adjustRenderStyle(state.style(), state.parentStyle(), element, uaSt
yleChange(state)); |
533 } | 559 } |
534 | 560 |
535 // Start loading resources referenced by this style. | 561 // Start loading resources referenced by this style. |
536 void StyleResolver::loadPendingResources(StyleResolverState& state) | 562 void StyleResolver::loadPendingResources(StyleResolverState& state) |
537 { | 563 { |
538 m_styleResourceLoader.loadPendingResources(state.style(), state.elementStyle
Resources()); | 564 m_styleResourceLoader.loadPendingResources(state.style(), state.elementStyle
Resources()); |
539 document().styleEngine()->fontSelector()->fontLoader()->loadPendingFonts(); | 565 document().styleEngine()->fontSelector()->fontLoader()->loadPendingFonts(); |
540 } | 566 } |
541 | 567 |
542 PassRefPtr<RenderStyle> StyleResolver::styleForElement(Element* element, RenderS
tyle* defaultParent, StyleSharingBehavior sharingBehavior, | 568 PassRefPtr<RenderStyle> StyleResolver::styleForElement(Element* element, RenderS
tyle* defaultParent, StyleSharingBehavior sharingBehavior, |
(...skipping 984 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1527 visitor->trace(m_uncommonAttributeRuleSet); | 1553 visitor->trace(m_uncommonAttributeRuleSet); |
1528 visitor->trace(m_watchedSelectorsRules); | 1554 visitor->trace(m_watchedSelectorsRules); |
1529 visitor->trace(m_treeBoundaryCrossingRules); | 1555 visitor->trace(m_treeBoundaryCrossingRules); |
1530 visitor->trace(m_styleSharingLists); | 1556 visitor->trace(m_styleSharingLists); |
1531 visitor->trace(m_pendingStyleSheets); | 1557 visitor->trace(m_pendingStyleSheets); |
1532 visitor->trace(m_document); | 1558 visitor->trace(m_document); |
1533 #endif | 1559 #endif |
1534 } | 1560 } |
1535 | 1561 |
1536 } // namespace blink | 1562 } // namespace blink |
OLD | NEW |