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 552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
563 document_style->GetFontDescription(); | 563 document_style->GetFontDescription(); |
564 document_font_description.SetLocale( | 564 document_font_description.SetLocale( |
565 LayoutLocale::Get(document.ContentLanguage())); | 565 LayoutLocale::Get(document.ContentLanguage())); |
566 document_style->SetFontDescription(document_font_description); | 566 document_style->SetFontDescription(document_font_description); |
567 document_style->SetZIndex(0); | 567 document_style->SetZIndex(0); |
568 document_style->SetIsStackingContext(true); | 568 document_style->SetIsStackingContext(true); |
569 document_style->SetUserModify(document.InDesignMode() ? READ_WRITE | 569 document_style->SetUserModify(document.InDesignMode() ? READ_WRITE |
570 : READ_ONLY); | 570 : READ_ONLY); |
571 // These are designed to match the user-agent stylesheet values for the | 571 // These are designed to match the user-agent stylesheet values for the |
572 // document element so that the common case doesn't need to create a new | 572 // document element so that the common case doesn't need to create a new |
573 // ComputedStyle in Document::inheritHtmlAndBodyElementStyles. | 573 // ComputedStyle in Document::InheritHtmlAndBodyElementStyles. |
574 document_style->SetDisplay(EDisplay::kBlock); | 574 document_style->SetDisplay(EDisplay::kBlock); |
575 document_style->SetPosition(EPosition::kAbsolute); | 575 document_style->SetPosition(EPosition::kAbsolute); |
576 | 576 |
577 // Document::inheritHtmlAndBodyElementStyles will set the final overflow | 577 // Document::InheritHtmlAndBodyElementStyles will set the final overflow |
578 // style values, but they should initially be auto to avoid premature | 578 // style values, but they should initially be auto to avoid premature |
579 // scrollbar removal in PaintLayerScrollableArea::updateAfterStyleChange. | 579 // scrollbar removal in PaintLayerScrollableArea::UpdateAfterStyleChange. |
580 document_style->SetOverflowX(EOverflow::kAuto); | 580 document_style->SetOverflowX(EOverflow::kAuto); |
581 document_style->SetOverflowY(EOverflow::kAuto); | 581 document_style->SetOverflowY(EOverflow::kAuto); |
582 | 582 |
583 document.SetupFontBuilder(*document_style); | 583 document.SetupFontBuilder(*document_style); |
584 | 584 |
585 return document_style.Release(); | 585 return document_style.Release(); |
586 } | 586 } |
587 | 587 |
588 void StyleResolver::AdjustComputedStyle(StyleResolverState& state, | 588 void StyleResolver::AdjustComputedStyle(StyleResolverState& state, |
589 Element* element) { | 589 Element* element) { |
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1002 | 1002 |
1003 if (PseudoElement* pseudo_element = | 1003 if (PseudoElement* pseudo_element = |
1004 element->GetPseudoElement(pseudo_style_request.pseudo_id)) | 1004 element->GetPseudoElement(pseudo_style_request.pseudo_id)) |
1005 SetAnimationUpdateIfNeeded(state, *pseudo_element); | 1005 SetAnimationUpdateIfNeeded(state, *pseudo_element); |
1006 | 1006 |
1007 // Now return the style. | 1007 // Now return the style. |
1008 return state.TakeStyle(); | 1008 return state.TakeStyle(); |
1009 } | 1009 } |
1010 | 1010 |
1011 PassRefPtr<ComputedStyle> StyleResolver::StyleForPage(int page_index) { | 1011 PassRefPtr<ComputedStyle> StyleResolver::StyleForPage(int page_index) { |
1012 // m_rootElementStyle will be set to the document style. | 1012 // root_element_style_ will be set to the document style. |
1013 StyleResolverState state(GetDocument(), GetDocument().documentElement()); | 1013 StyleResolverState state(GetDocument(), GetDocument().documentElement()); |
1014 | 1014 |
1015 RefPtr<ComputedStyle> style = ComputedStyle::Create(); | 1015 RefPtr<ComputedStyle> style = ComputedStyle::Create(); |
1016 const ComputedStyle* root_element_style = | 1016 const ComputedStyle* root_element_style = |
1017 state.RootElementStyle() ? state.RootElementStyle() | 1017 state.RootElementStyle() ? state.RootElementStyle() |
1018 : GetDocument().GetComputedStyle(); | 1018 : GetDocument().GetComputedStyle(); |
1019 DCHECK(root_element_style); | 1019 DCHECK(root_element_style); |
1020 style->InheritFrom(*root_element_style); | 1020 style->InheritFrom(*root_element_style); |
1021 state.SetStyle(std::move(style)); | 1021 state.SetStyle(std::move(style)); |
1022 | 1022 |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1217 resolver->SetHasUnresolvedKeyframesRule(); | 1217 resolver->SetHasUnresolvedKeyframesRule(); |
1218 return nullptr; | 1218 return nullptr; |
1219 } | 1219 } |
1220 | 1220 |
1221 template <CSSPropertyPriority priority> | 1221 template <CSSPropertyPriority priority> |
1222 void StyleResolver::ApplyAnimatedProperties( | 1222 void StyleResolver::ApplyAnimatedProperties( |
1223 StyleResolverState& state, | 1223 StyleResolverState& state, |
1224 const ActiveInterpolationsMap& active_interpolations_map) { | 1224 const ActiveInterpolationsMap& active_interpolations_map) { |
1225 // TODO(alancutter): Don't apply presentation attribute animations here, | 1225 // TODO(alancutter): Don't apply presentation attribute animations here, |
1226 // they should instead apply in | 1226 // they should instead apply in |
1227 // SVGElement::collectStyleForPresentationAttribute(). | 1227 // SVGElement::CollectStyleForPresentationAttribute(). |
1228 for (const auto& entry : active_interpolations_map) { | 1228 for (const auto& entry : active_interpolations_map) { |
1229 CSSPropertyID property = entry.key.IsCSSProperty() | 1229 CSSPropertyID property = entry.key.IsCSSProperty() |
1230 ? entry.key.CssProperty() | 1230 ? entry.key.CssProperty() |
1231 : entry.key.PresentationAttribute(); | 1231 : entry.key.PresentationAttribute(); |
1232 if (!CSSPropertyPriorityData<priority>::PropertyHasPriority(property)) | 1232 if (!CSSPropertyPriorityData<priority>::PropertyHasPriority(property)) |
1233 continue; | 1233 continue; |
1234 const Interpolation& interpolation = *entry.value.front(); | 1234 const Interpolation& interpolation = *entry.value.front(); |
1235 if (interpolation.IsInvalidatableInterpolation()) { | 1235 if (interpolation.IsInvalidatableInterpolation()) { |
1236 CSSInterpolationTypesMap map(state.GetDocument().GetPropertyRegistry()); | 1236 CSSInterpolationTypesMap map(state.GetDocument().GetPropertyRegistry()); |
1237 InterpolationEnvironment environment(map, state); | 1237 InterpolationEnvironment environment(map, state); |
(...skipping 779 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2017 | 2017 |
2018 DEFINE_TRACE(StyleResolver) { | 2018 DEFINE_TRACE(StyleResolver) { |
2019 visitor->Trace(matched_properties_cache_); | 2019 visitor->Trace(matched_properties_cache_); |
2020 visitor->Trace(selector_filter_); | 2020 visitor->Trace(selector_filter_); |
2021 visitor->Trace(style_sharing_lists_); | 2021 visitor->Trace(style_sharing_lists_); |
2022 visitor->Trace(document_); | 2022 visitor->Trace(document_); |
2023 visitor->Trace(tracker_); | 2023 visitor->Trace(tracker_); |
2024 } | 2024 } |
2025 | 2025 |
2026 } // namespace blink | 2026 } // namespace blink |
OLD | NEW |