| 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 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 512 documentStyle->setZoom(frame && !document.printing() ? frame->pageZoomFactor
() : 1); | 512 documentStyle->setZoom(frame && !document.printing() ? frame->pageZoomFactor
() : 1); |
| 513 documentStyle->setLocale(document.contentLanguage()); | 513 documentStyle->setLocale(document.contentLanguage()); |
| 514 documentStyle->setZIndex(0); | 514 documentStyle->setZIndex(0); |
| 515 documentStyle->setUserModify(document.inDesignMode() ? READ_WRITE : READ_ONL
Y); | 515 documentStyle->setUserModify(document.inDesignMode() ? READ_WRITE : READ_ONL
Y); |
| 516 | 516 |
| 517 document.setupFontBuilder(documentStyle.get()); | 517 document.setupFontBuilder(documentStyle.get()); |
| 518 | 518 |
| 519 return documentStyle.release(); | 519 return documentStyle.release(); |
| 520 } | 520 } |
| 521 | 521 |
| 522 static inline void resetDirectionAndWritingModeOnDocument(Document& document) | |
| 523 { | |
| 524 document.setDirectionSetOnDocumentElement(false); | |
| 525 document.setWritingModeSetOnDocumentElement(false); | |
| 526 } | |
| 527 | |
| 528 static void addContentAttrValuesToFeatures(const Vector<AtomicString>& contentAt
trValues, RuleFeatureSet& features) | 522 static void addContentAttrValuesToFeatures(const Vector<AtomicString>& contentAt
trValues, RuleFeatureSet& features) |
| 529 { | 523 { |
| 530 for (size_t i = 0; i < contentAttrValues.size(); ++i) | 524 for (size_t i = 0; i < contentAttrValues.size(); ++i) |
| 531 features.addContentAttr(contentAttrValues[i]); | 525 features.addContentAttr(contentAttrValues[i]); |
| 532 } | 526 } |
| 533 | 527 |
| 534 void StyleResolver::adjustRenderStyle(StyleResolverState& state, Element* elemen
t) | 528 void StyleResolver::adjustRenderStyle(StyleResolverState& state, Element* elemen
t) |
| 535 { | 529 { |
| 536 StyleAdjuster adjuster(document().inQuirksMode()); | 530 StyleAdjuster adjuster(document().inQuirksMode()); |
| 537 adjuster.adjustRenderStyle(state.style(), state.parentStyle(), element, stat
e.cachedUAStyle()); | 531 adjuster.adjustRenderStyle(state.style(), state.parentStyle(), element, stat
e.cachedUAStyle()); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 562 } | 556 } |
| 563 | 557 |
| 564 document().setHasNodesWithPlaceholderStyle(); | 558 document().setHasNodesWithPlaceholderStyle(); |
| 565 return s_styleNotYetAvailable; | 559 return s_styleNotYetAvailable; |
| 566 } | 560 } |
| 567 | 561 |
| 568 didAccess(); | 562 didAccess(); |
| 569 | 563 |
| 570 StyleResolverParentScope::ensureParentStackIsPushed(); | 564 StyleResolverParentScope::ensureParentStackIsPushed(); |
| 571 | 565 |
| 572 if (element == document().documentElement()) | |
| 573 resetDirectionAndWritingModeOnDocument(document()); | |
| 574 StyleResolverState state(document(), element, defaultParent); | 566 StyleResolverState state(document(), element, defaultParent); |
| 575 | 567 |
| 576 if (sharingBehavior == AllowStyleSharing && state.parentStyle()) { | 568 if (sharingBehavior == AllowStyleSharing && state.parentStyle()) { |
| 577 SharedStyleFinder styleFinder(state.elementContext(), m_features, m_sibl
ingRuleSet.get(), m_uncommonAttributeRuleSet.get(), *this); | 569 SharedStyleFinder styleFinder(state.elementContext(), m_features, m_sibl
ingRuleSet.get(), m_uncommonAttributeRuleSet.get(), *this); |
| 578 if (RefPtr<RenderStyle> sharedStyle = styleFinder.findSharedStyle()) | 570 if (RefPtr<RenderStyle> sharedStyle = styleFinder.findSharedStyle()) |
| 579 return sharedStyle.release(); | 571 return sharedStyle.release(); |
| 580 } | 572 } |
| 581 | 573 |
| 582 ActiveAnimations* activeAnimations = element->activeAnimations(); | 574 ActiveAnimations* activeAnimations = element->activeAnimations(); |
| 583 const RenderStyle* baseRenderStyle = activeAnimations ? activeAnimations->ba
seRenderStyle() : nullptr; | 575 const RenderStyle* baseRenderStyle = activeAnimations ? activeAnimations->ba
seRenderStyle() : nullptr; |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 666 // Now return the style. | 658 // Now return the style. |
| 667 return state.takeStyle(); | 659 return state.takeStyle(); |
| 668 } | 660 } |
| 669 | 661 |
| 670 PassRefPtr<RenderStyle> StyleResolver::styleForKeyframe(Element& element, const
RenderStyle& elementStyle, RenderStyle* parentStyle, const StyleKeyframe* keyfra
me, const AtomicString& animationName) | 662 PassRefPtr<RenderStyle> StyleResolver::styleForKeyframe(Element& element, const
RenderStyle& elementStyle, RenderStyle* parentStyle, const StyleKeyframe* keyfra
me, const AtomicString& animationName) |
| 671 { | 663 { |
| 672 ASSERT(document().frame()); | 664 ASSERT(document().frame()); |
| 673 ASSERT(document().settings()); | 665 ASSERT(document().settings()); |
| 674 ASSERT(!hasPendingAuthorStyleSheets()); | 666 ASSERT(!hasPendingAuthorStyleSheets()); |
| 675 | 667 |
| 676 if (&element == document().documentElement()) | |
| 677 resetDirectionAndWritingModeOnDocument(document()); | |
| 678 StyleResolverState state(document(), &element, parentStyle); | 668 StyleResolverState state(document(), &element, parentStyle); |
| 679 | 669 |
| 680 MatchResult result; | 670 MatchResult result; |
| 681 result.addMatchedProperties(&keyframe->properties()); | 671 result.addMatchedProperties(&keyframe->properties()); |
| 682 | 672 |
| 683 ASSERT(!state.style()); | 673 ASSERT(!state.style()); |
| 684 | 674 |
| 685 // Create the style | 675 // Create the style |
| 686 state.setStyle(RenderStyle::clone(&elementStyle)); | 676 state.setStyle(RenderStyle::clone(&elementStyle)); |
| 687 | 677 |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 865 if (PseudoElement* pseudoElement = element->pseudoElement(pseudoStyleRequest
.pseudoId)) | 855 if (PseudoElement* pseudoElement = element->pseudoElement(pseudoStyleRequest
.pseudoId)) |
| 866 setAnimationUpdateIfNeeded(state, *pseudoElement); | 856 setAnimationUpdateIfNeeded(state, *pseudoElement); |
| 867 | 857 |
| 868 // Now return the style. | 858 // Now return the style. |
| 869 return state.takeStyle(); | 859 return state.takeStyle(); |
| 870 } | 860 } |
| 871 | 861 |
| 872 PassRefPtr<RenderStyle> StyleResolver::styleForPage(int pageIndex) | 862 PassRefPtr<RenderStyle> StyleResolver::styleForPage(int pageIndex) |
| 873 { | 863 { |
| 874 ASSERT(!hasPendingAuthorStyleSheets()); | 864 ASSERT(!hasPendingAuthorStyleSheets()); |
| 875 resetDirectionAndWritingModeOnDocument(document()); | |
| 876 StyleResolverState state(document(), document().documentElement()); // m_roo
tElementStyle will be set to the document style. | 865 StyleResolverState state(document(), document().documentElement()); // m_roo
tElementStyle will be set to the document style. |
| 877 | 866 |
| 878 RefPtr<RenderStyle> style = RenderStyle::create(); | 867 RefPtr<RenderStyle> style = RenderStyle::create(); |
| 879 const RenderStyle* rootElementStyle = state.rootElementStyle() ? state.rootE
lementStyle() : document().renderStyle(); | 868 const RenderStyle* rootElementStyle = state.rootElementStyle() ? state.rootE
lementStyle() : document().renderStyle(); |
| 880 ASSERT(rootElementStyle); | 869 ASSERT(rootElementStyle); |
| 881 style->inheritFrom(rootElementStyle); | 870 style->inheritFrom(rootElementStyle); |
| 882 state.setStyle(style.release()); | 871 state.setStyle(style.release()); |
| 883 | 872 |
| 884 PageRuleCollector collector(rootElementStyle, pageIndex); | 873 PageRuleCollector collector(rootElementStyle, pageIndex); |
| 885 | 874 |
| (...skipping 729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1615 visitor->trace(m_uncommonAttributeRuleSet); | 1604 visitor->trace(m_uncommonAttributeRuleSet); |
| 1616 visitor->trace(m_watchedSelectorsRules); | 1605 visitor->trace(m_watchedSelectorsRules); |
| 1617 visitor->trace(m_treeBoundaryCrossingRules); | 1606 visitor->trace(m_treeBoundaryCrossingRules); |
| 1618 visitor->trace(m_styleSharingLists); | 1607 visitor->trace(m_styleSharingLists); |
| 1619 visitor->trace(m_pendingStyleSheets); | 1608 visitor->trace(m_pendingStyleSheets); |
| 1620 visitor->trace(m_document); | 1609 visitor->trace(m_document); |
| 1621 #endif | 1610 #endif |
| 1622 } | 1611 } |
| 1623 | 1612 |
| 1624 } // namespace blink | 1613 } // namespace blink |
| OLD | NEW |