| 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. | 5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. |
| 6 * All rights reserved. | 6 * All rights reserved. |
| 7 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> | 7 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> |
| 8 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> | 8 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> |
| 9 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. | 9 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. |
| 10 * (http://www.torchmobile.com/) | 10 * (http://www.torchmobile.com/) |
| (...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 576 document_style->SetPosition(EPosition::kAbsolute); | 576 document_style->SetPosition(EPosition::kAbsolute); |
| 577 | 577 |
| 578 // Document::InheritHtmlAndBodyElementStyles will set the final overflow | 578 // Document::InheritHtmlAndBodyElementStyles will set the final overflow |
| 579 // style values, but they should initially be auto to avoid premature | 579 // style values, but they should initially be auto to avoid premature |
| 580 // scrollbar removal in PaintLayerScrollableArea::UpdateAfterStyleChange. | 580 // scrollbar removal in PaintLayerScrollableArea::UpdateAfterStyleChange. |
| 581 document_style->SetOverflowX(EOverflow::kAuto); | 581 document_style->SetOverflowX(EOverflow::kAuto); |
| 582 document_style->SetOverflowY(EOverflow::kAuto); | 582 document_style->SetOverflowY(EOverflow::kAuto); |
| 583 | 583 |
| 584 document.SetupFontBuilder(*document_style); | 584 document.SetupFontBuilder(*document_style); |
| 585 | 585 |
| 586 return document_style.Release(); | 586 return document_style; |
| 587 } | 587 } |
| 588 | 588 |
| 589 void StyleResolver::AdjustComputedStyle(StyleResolverState& state, | 589 void StyleResolver::AdjustComputedStyle(StyleResolverState& state, |
| 590 Element* element) { | 590 Element* element) { |
| 591 DCHECK(state.LayoutParentStyle()); | 591 DCHECK(state.LayoutParentStyle()); |
| 592 DCHECK(state.ParentStyle()); | 592 DCHECK(state.ParentStyle()); |
| 593 StyleAdjuster::AdjustComputedStyle(state.MutableStyleRef(), | 593 StyleAdjuster::AdjustComputedStyle(state.MutableStyleRef(), |
| 594 *state.ParentStyle(), | 594 *state.ParentStyle(), |
| 595 *state.LayoutParentStyle(), element); | 595 *state.LayoutParentStyle(), element); |
| 596 } | 596 } |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 669 | 669 |
| 670 SelectorFilterParentScope::EnsureParentStackIsPushed(); | 670 SelectorFilterParentScope::EnsureParentStackIsPushed(); |
| 671 | 671 |
| 672 ElementResolveContext element_context(*element); | 672 ElementResolveContext element_context(*element); |
| 673 | 673 |
| 674 if (RuntimeEnabledFeatures::StyleSharingEnabled() && | 674 if (RuntimeEnabledFeatures::StyleSharingEnabled() && |
| 675 sharing_behavior == kAllowStyleSharing && | 675 sharing_behavior == kAllowStyleSharing && |
| 676 (default_parent || element_context.ParentStyle())) { | 676 (default_parent || element_context.ParentStyle())) { |
| 677 if (RefPtr<ComputedStyle> shared_style = | 677 if (RefPtr<ComputedStyle> shared_style = |
| 678 GetDocument().GetStyleEngine().FindSharedStyle(element_context)) | 678 GetDocument().GetStyleEngine().FindSharedStyle(element_context)) |
| 679 return shared_style.Release(); | 679 return shared_style; |
| 680 } | 680 } |
| 681 | 681 |
| 682 StyleResolverState state(GetDocument(), element_context, default_parent, | 682 StyleResolverState state(GetDocument(), element_context, default_parent, |
| 683 default_layout_parent); | 683 default_layout_parent); |
| 684 | 684 |
| 685 const ComputedStyle* base_computed_style = | 685 const ComputedStyle* base_computed_style = |
| 686 CalculateBaseComputedStyle(state, element); | 686 CalculateBaseComputedStyle(state, element); |
| 687 | 687 |
| 688 if (base_computed_style) { | 688 if (base_computed_style) { |
| 689 state.SetStyle(ComputedStyle::Clone(*base_computed_style)); | 689 state.SetStyle(ComputedStyle::Clone(*base_computed_style)); |
| (...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1050 // Now return the style. | 1050 // Now return the style. |
| 1051 return state.TakeStyle(); | 1051 return state.TakeStyle(); |
| 1052 } | 1052 } |
| 1053 | 1053 |
| 1054 PassRefPtr<ComputedStyle> StyleResolver::InitialStyleForElement() { | 1054 PassRefPtr<ComputedStyle> StyleResolver::InitialStyleForElement() { |
| 1055 RefPtr<ComputedStyle> style = ComputedStyle::Create(); | 1055 RefPtr<ComputedStyle> style = ComputedStyle::Create(); |
| 1056 FontBuilder font_builder(&GetDocument()); | 1056 FontBuilder font_builder(&GetDocument()); |
| 1057 font_builder.SetInitial(style->EffectiveZoom()); | 1057 font_builder.SetInitial(style->EffectiveZoom()); |
| 1058 font_builder.CreateFont(GetDocument().GetStyleEngine().FontSelector(), | 1058 font_builder.CreateFont(GetDocument().GetStyleEngine().FontSelector(), |
| 1059 *style); | 1059 *style); |
| 1060 return style.Release(); | 1060 return style; |
| 1061 } | 1061 } |
| 1062 | 1062 |
| 1063 PassRefPtr<ComputedStyle> StyleResolver::StyleForText(Text* text_node) { | 1063 PassRefPtr<ComputedStyle> StyleResolver::StyleForText(Text* text_node) { |
| 1064 DCHECK(text_node); | 1064 DCHECK(text_node); |
| 1065 | 1065 |
| 1066 Node* parent_node = LayoutTreeBuilderTraversal::Parent(*text_node); | 1066 Node* parent_node = LayoutTreeBuilderTraversal::Parent(*text_node); |
| 1067 if (!parent_node || !parent_node->GetComputedStyle()) | 1067 if (!parent_node || !parent_node->GetComputedStyle()) |
| 1068 return InitialStyleForElement(); | 1068 return InitialStyleForElement(); |
| 1069 return parent_node->MutableComputedStyle(); | 1069 return parent_node->MutableComputedStyle(); |
| 1070 } | 1070 } |
| (...skipping 953 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2024 | 2024 |
| 2025 DEFINE_TRACE(StyleResolver) { | 2025 DEFINE_TRACE(StyleResolver) { |
| 2026 visitor->Trace(matched_properties_cache_); | 2026 visitor->Trace(matched_properties_cache_); |
| 2027 visitor->Trace(selector_filter_); | 2027 visitor->Trace(selector_filter_); |
| 2028 visitor->Trace(style_sharing_lists_); | 2028 visitor->Trace(style_sharing_lists_); |
| 2029 visitor->Trace(document_); | 2029 visitor->Trace(document_); |
| 2030 visitor->Trace(tracker_); | 2030 visitor->Trace(tracker_); |
| 2031 } | 2031 } |
| 2032 | 2032 |
| 2033 } // namespace blink | 2033 } // namespace blink |
| OLD | NEW |