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 716 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
727 StyleAdjuster adjuster(state.cachedUAStyle(), m_document.inQuirksMode())
; | 727 StyleAdjuster adjuster(state.cachedUAStyle(), m_document.inQuirksMode())
; |
728 adjuster.adjustRenderStyle(state.style(), state.parentStyle(), element); | 728 adjuster.adjustRenderStyle(state.style(), state.parentStyle(), element); |
729 } | 729 } |
730 | 730 |
731 // FIXME: Shouldn't this be on RenderBody::styleDidChange? | 731 // FIXME: Shouldn't this be on RenderBody::styleDidChange? |
732 if (element->hasTagName(bodyTag)) | 732 if (element->hasTagName(bodyTag)) |
733 document().textLinkColors().setTextColor(state.style()->color()); | 733 document().textLinkColors().setTextColor(state.style()->color()); |
734 | 734 |
735 setAnimationUpdateIfNeeded(state, *element); | 735 setAnimationUpdateIfNeeded(state, *element); |
736 | 736 |
| 737 if (state.style()->hasViewportUnits()) |
| 738 document().setHasViewportUnits(); |
| 739 |
737 // Now return the style. | 740 // Now return the style. |
738 return state.takeStyle(); | 741 return state.takeStyle(); |
739 } | 742 } |
740 | 743 |
741 PassRefPtr<RenderStyle> StyleResolver::styleForKeyframe(Element* e, const Render
Style& elementStyle, const StyleKeyframe* keyframe, const AtomicString& animatio
nName) | 744 PassRefPtr<RenderStyle> StyleResolver::styleForKeyframe(Element* e, const Render
Style& elementStyle, const StyleKeyframe* keyframe, const AtomicString& animatio
nName) |
742 { | 745 { |
743 ASSERT(document().frame()); | 746 ASSERT(document().frame()); |
744 ASSERT(documentSettings()); | 747 ASSERT(documentSettings()); |
745 ASSERT(!hasPendingAuthorStyleSheets()); | 748 ASSERT(!hasPendingAuthorStyleSheets()); |
746 | 749 |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
911 // FIXME: Passing 0 as the Element* introduces a lot of complexity | 914 // FIXME: Passing 0 as the Element* introduces a lot of complexity |
912 // in the adjustRenderStyle code. | 915 // in the adjustRenderStyle code. |
913 adjuster.adjustRenderStyle(state.style(), state.parentStyle(), 0); | 916 adjuster.adjustRenderStyle(state.style(), state.parentStyle(), 0); |
914 } | 917 } |
915 | 918 |
916 didAccess(); | 919 didAccess(); |
917 | 920 |
918 if (PseudoElement* pseudoElement = e->pseudoElement(pseudoStyleRequest.pseud
oId)) | 921 if (PseudoElement* pseudoElement = e->pseudoElement(pseudoStyleRequest.pseud
oId)) |
919 setAnimationUpdateIfNeeded(state, *pseudoElement); | 922 setAnimationUpdateIfNeeded(state, *pseudoElement); |
920 | 923 |
| 924 if (state.style()->hasViewportUnits()) |
| 925 document().setHasViewportUnits(); |
| 926 |
921 // Now return the style. | 927 // Now return the style. |
922 return state.takeStyle(); | 928 return state.takeStyle(); |
923 } | 929 } |
924 | 930 |
925 PassRefPtr<RenderStyle> StyleResolver::styleForPage(int pageIndex) | 931 PassRefPtr<RenderStyle> StyleResolver::styleForPage(int pageIndex) |
926 { | 932 { |
927 ASSERT(!hasPendingAuthorStyleSheets()); | 933 ASSERT(!hasPendingAuthorStyleSheets()); |
928 resetDirectionAndWritingModeOnDocument(document()); | 934 resetDirectionAndWritingModeOnDocument(document()); |
929 StyleResolverState state(document(), document().documentElement()); // m_roo
tElementStyle will be set to the document style. | 935 StyleResolverState state(document(), document().documentElement()); // m_roo
tElementStyle will be set to the document style. |
930 | 936 |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1013 if (ScopedStyleResolver* scopedResolver = m_styleTree.scopedStyleResolverFor
Document()) { | 1019 if (ScopedStyleResolver* scopedResolver = m_styleTree.scopedStyleResolverFor
Document()) { |
1014 if (scopedResolver->checkRegionStyle(regionElement)) | 1020 if (scopedResolver->checkRegionStyle(regionElement)) |
1015 return true; | 1021 return true; |
1016 } | 1022 } |
1017 return false; | 1023 return false; |
1018 } | 1024 } |
1019 | 1025 |
1020 void StyleResolver::updateFont(StyleResolverState& state) | 1026 void StyleResolver::updateFont(StyleResolverState& state) |
1021 { | 1027 { |
1022 state.fontBuilder().createFont(m_fontSelector, state.parentStyle(), state.st
yle()); | 1028 state.fontBuilder().createFont(m_fontSelector, state.parentStyle(), state.st
yle()); |
| 1029 if (state.fontBuilder().fontSizeHasViewportUnits()) |
| 1030 state.style()->setHasViewportUnits(); |
1023 } | 1031 } |
1024 | 1032 |
1025 PassRefPtr<StyleRuleList> StyleResolver::styleRulesForElement(Element* element,
unsigned rulesToInclude) | 1033 PassRefPtr<StyleRuleList> StyleResolver::styleRulesForElement(Element* element,
unsigned rulesToInclude) |
1026 { | 1034 { |
1027 ASSERT(element); | 1035 ASSERT(element); |
1028 StyleResolverState state(document(), element); | 1036 StyleResolverState state(document(), element); |
1029 ElementRuleCollector collector(state.elementContext(), m_selectorFilter, sta
te.style()); | 1037 ElementRuleCollector collector(state.elementContext(), m_selectorFilter, sta
te.style()); |
1030 collector.setMode(SelectorChecker::CollectingStyleRules); | 1038 collector.setMode(SelectorChecker::CollectingStyleRules); |
1031 collectPseudoRulesForElement(element, collector, NOPSEUDO, rulesToInclude); | 1039 collectPseudoRulesForElement(element, collector, NOPSEUDO, rulesToInclude); |
1032 return collector.matchedStyleRuleList(); | 1040 return collector.matchedStyleRuleList(); |
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1421 } | 1429 } |
1422 } | 1430 } |
1423 } | 1431 } |
1424 | 1432 |
1425 void StyleResolver::addMediaQueryResults(const MediaQueryResultList& list) | 1433 void StyleResolver::addMediaQueryResults(const MediaQueryResultList& list) |
1426 { | 1434 { |
1427 for (size_t i = 0; i < list.size(); ++i) | 1435 for (size_t i = 0; i < list.size(); ++i) |
1428 m_viewportDependentMediaQueryResults.append(list[i]); | 1436 m_viewportDependentMediaQueryResults.append(list[i]); |
1429 } | 1437 } |
1430 | 1438 |
1431 bool StyleResolver::affectedByViewportChange() const | 1439 bool StyleResolver::mediaQueryAffectedByViewportChange() const |
1432 { | 1440 { |
1433 for (unsigned i = 0; i < m_viewportDependentMediaQueryResults.size(); ++i) { | 1441 for (unsigned i = 0; i < m_viewportDependentMediaQueryResults.size(); ++i) { |
1434 if (m_medium->eval(&m_viewportDependentMediaQueryResults[i]->m_expressio
n) != m_viewportDependentMediaQueryResults[i]->m_result) | 1442 if (m_medium->eval(&m_viewportDependentMediaQueryResults[i]->m_expressio
n) != m_viewportDependentMediaQueryResults[i]->m_result) |
1435 return true; | 1443 return true; |
1436 } | 1444 } |
1437 return false; | 1445 return false; |
1438 } | 1446 } |
1439 | 1447 |
1440 } // namespace WebCore | 1448 } // namespace WebCore |
OLD | NEW |