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 594 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
605 static inline void resetDirectionAndWritingModeOnDocument(Document* document) | 605 static inline void resetDirectionAndWritingModeOnDocument(Document* document) |
606 { | 606 { |
607 document->setDirectionSetOnDocumentElement(false); | 607 document->setDirectionSetOnDocumentElement(false); |
608 document->setWritingModeSetOnDocumentElement(false); | 608 document->setWritingModeSetOnDocumentElement(false); |
609 } | 609 } |
610 | 610 |
611 | 611 |
612 PassRefPtr<RenderStyle> StyleResolver::styleForElement(Element* element, RenderS
tyle* defaultParent, StyleSharingBehavior sharingBehavior, | 612 PassRefPtr<RenderStyle> StyleResolver::styleForElement(Element* element, RenderS
tyle* defaultParent, StyleSharingBehavior sharingBehavior, |
613 RuleMatchingBehavior matchingBehavior, RenderRegion* regionForStyling) | 613 RuleMatchingBehavior matchingBehavior, RenderRegion* regionForStyling) |
614 { | 614 { |
615 // FIXME: We should only ever resolve style on documents which are | 615 ASSERT(document()->frame()); |
616 // in a frame. Unfortunately SVG Animation violates this: crbug.com/260966 | 616 ASSERT(documentSettings()); |
617 // ASSERT(document()->frame()); | |
618 // ASSERT(documentSettings()); | |
619 | 617 |
620 // Once an element has a renderer, we don't try to destroy it, since otherwi
se the renderer | 618 // Once an element has a renderer, we don't try to destroy it, since otherwi
se the renderer |
621 // will vanish if a style recalc happens during loading. | 619 // will vanish if a style recalc happens during loading. |
622 if (sharingBehavior == AllowStyleSharing && !element->document()->haveStyles
heetsLoaded() && !element->renderer()) { | 620 if (sharingBehavior == AllowStyleSharing && !element->document()->haveStyles
heetsLoaded() && !element->renderer()) { |
623 if (!s_styleNotYetAvailable) { | 621 if (!s_styleNotYetAvailable) { |
624 s_styleNotYetAvailable = RenderStyle::create().leakRef(); | 622 s_styleNotYetAvailable = RenderStyle::create().leakRef(); |
625 s_styleNotYetAvailable->setDisplay(NONE); | 623 s_styleNotYetAvailable->setDisplay(NONE); |
626 s_styleNotYetAvailable->font().update(m_fontSelector); | 624 s_styleNotYetAvailable->font().update(m_fontSelector); |
627 } | 625 } |
628 element->document()->setHasNodesWithPlaceholderStyle(); | 626 element->document()->setHasNodesWithPlaceholderStyle(); |
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
928 | 926 |
929 document()->didAccessStyleResolver(); | 927 document()->didAccessStyleResolver(); |
930 | 928 |
931 // Now return the style. | 929 // Now return the style. |
932 return state.takeStyle(); | 930 return state.takeStyle(); |
933 } | 931 } |
934 | 932 |
935 PassRefPtr<RenderStyle> StyleResolver::defaultStyleForElement() | 933 PassRefPtr<RenderStyle> StyleResolver::defaultStyleForElement() |
936 { | 934 { |
937 m_state.setStyle(RenderStyle::create()); | 935 m_state.setStyle(RenderStyle::create()); |
938 // FIXME: This should be removed once SVG Animations are fixed | |
939 // to not resolve style on documents outside a frame: crbug.com/260966 | |
940 if (!documentSettings()) { | |
941 m_state.style()->font().update(0); | |
942 return m_state.takeStyle(); | |
943 } | |
944 m_state.fontBuilder().initForStyleResolve(document(), m_state.style(), m_sta
te.useSVGZoomRules()); | 936 m_state.fontBuilder().initForStyleResolve(document(), m_state.style(), m_sta
te.useSVGZoomRules()); |
945 m_state.style()->setLineHeight(RenderStyle::initialLineHeight()); | 937 m_state.style()->setLineHeight(RenderStyle::initialLineHeight()); |
946 m_state.setLineHeightValue(0); | 938 m_state.setLineHeightValue(0); |
947 m_state.fontBuilder().setInitial(m_state.style()->effectiveZoom()); | 939 m_state.fontBuilder().setInitial(m_state.style()->effectiveZoom()); |
948 m_state.style()->font().update(fontSelector()); | 940 m_state.style()->font().update(fontSelector()); |
949 return m_state.takeStyle(); | 941 return m_state.takeStyle(); |
950 } | 942 } |
951 | 943 |
952 PassRefPtr<RenderStyle> StyleResolver::styleForText(Text* textNode) | 944 PassRefPtr<RenderStyle> StyleResolver::styleForText(Text* textNode) |
953 { | 945 { |
(...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1480 info.addMember(m_state, "state"); | 1472 info.addMember(m_state, "state"); |
1481 | 1473 |
1482 // FIXME: move this to a place where it would be called only once? | 1474 // FIXME: move this to a place where it would be called only once? |
1483 info.addMember(CSSDefaultStyleSheets::defaultStyle, "defaultStyle"); | 1475 info.addMember(CSSDefaultStyleSheets::defaultStyle, "defaultStyle"); |
1484 info.addMember(CSSDefaultStyleSheets::defaultQuirksStyle, "defaultQuirksStyl
e"); | 1476 info.addMember(CSSDefaultStyleSheets::defaultQuirksStyle, "defaultQuirksStyl
e"); |
1485 info.addMember(CSSDefaultStyleSheets::defaultPrintStyle, "defaultPrintStyle"
); | 1477 info.addMember(CSSDefaultStyleSheets::defaultPrintStyle, "defaultPrintStyle"
); |
1486 info.addMember(CSSDefaultStyleSheets::defaultViewSourceStyle, "defaultViewSo
urceStyle"); | 1478 info.addMember(CSSDefaultStyleSheets::defaultViewSourceStyle, "defaultViewSo
urceStyle"); |
1487 } | 1479 } |
1488 | 1480 |
1489 } // namespace WebCore | 1481 } // namespace WebCore |
OLD | NEW |