OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 * (C) 2000 Dirk Mueller (mueller@kde.org) | 4 * (C) 2000 Dirk Mueller (mueller@kde.org) |
5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com) | 5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com) |
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. |
7 * All rights reserved. | 7 * All rights reserved. |
8 * Copyright (C) 2009 Google Inc. All rights reserved. | 8 * Copyright (C) 2009 Google Inc. All rights reserved. |
9 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. | 9 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. |
10 * (http://www.torchmobile.com/) | 10 * (http://www.torchmobile.com/) |
(...skipping 17 matching lines...) Expand all Loading... | |
28 | 28 |
29 #include "core/layout/LayoutObject.h" | 29 #include "core/layout/LayoutObject.h" |
30 | 30 |
31 #include <algorithm> | 31 #include <algorithm> |
32 #include <memory> | 32 #include <memory> |
33 | 33 |
34 #include "core/animation/ElementAnimations.h" | 34 #include "core/animation/ElementAnimations.h" |
35 #include "core/css/resolver/StyleResolver.h" | 35 #include "core/css/resolver/StyleResolver.h" |
36 #include "core/dom/AXObjectCache.h" | 36 #include "core/dom/AXObjectCache.h" |
37 #include "core/dom/ElementTraversal.h" | 37 #include "core/dom/ElementTraversal.h" |
38 #include "core/dom/PseudoElement.h" | |
38 #include "core/dom/StyleChangeReason.h" | 39 #include "core/dom/StyleChangeReason.h" |
39 #include "core/dom/StyleEngine.h" | 40 #include "core/dom/StyleEngine.h" |
40 #include "core/dom/shadow/ShadowRoot.h" | 41 #include "core/dom/shadow/ShadowRoot.h" |
41 #include "core/editing/EditingUtilities.h" | 42 #include "core/editing/EditingUtilities.h" |
42 #include "core/editing/FrameSelection.h" | 43 #include "core/editing/FrameSelection.h" |
43 #include "core/editing/TextAffinity.h" | 44 #include "core/editing/TextAffinity.h" |
44 #include "core/frame/DeprecatedScheduleStyleRecalcDuringLayout.h" | 45 #include "core/frame/DeprecatedScheduleStyleRecalcDuringLayout.h" |
45 #include "core/frame/EventHandlerRegistry.h" | 46 #include "core/frame/EventHandlerRegistry.h" |
46 #include "core/frame/FrameView.h" | 47 #include "core/frame/FrameView.h" |
47 #include "core/frame/LocalFrame.h" | 48 #include "core/frame/LocalFrame.h" |
(...skipping 1525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1573 if (isImage() || isQuote()) { | 1574 if (isImage() || isQuote()) { |
1574 RefPtr<ComputedStyle> style = ComputedStyle::create(); | 1575 RefPtr<ComputedStyle> style = ComputedStyle::create(); |
1575 style->inheritFrom(*pseudoStyle); | 1576 style->inheritFrom(*pseudoStyle); |
1576 setStyle(std::move(style)); | 1577 setStyle(std::move(style)); |
1577 return; | 1578 return; |
1578 } | 1579 } |
1579 | 1580 |
1580 setStyle(std::move(pseudoStyle)); | 1581 setStyle(std::move(pseudoStyle)); |
1581 } | 1582 } |
1582 | 1583 |
1584 bool LayoutObject::isPseudoElementGeneratedContentFor( | |
1585 const PseudoElement& pseudo) const { | |
1586 return isAnonymous() && m_node.get() == &pseudo; | |
1587 } | |
1588 | |
1583 void LayoutObject::firstLineStyleDidChange(const ComputedStyle& oldStyle, | 1589 void LayoutObject::firstLineStyleDidChange(const ComputedStyle& oldStyle, |
1584 const ComputedStyle& newStyle) { | 1590 const ComputedStyle& newStyle) { |
1585 StyleDifference diff = oldStyle.visualInvalidationDiff(newStyle); | 1591 StyleDifference diff = oldStyle.visualInvalidationDiff(newStyle); |
1586 | 1592 |
1587 if (diff.needsFullPaintInvalidation() || | 1593 if (diff.needsFullPaintInvalidation() || |
1588 diff.textDecorationOrColorChanged()) { | 1594 diff.textDecorationOrColorChanged()) { |
1589 // We need to invalidate all inline boxes in the first line, because they | 1595 // We need to invalidate all inline boxes in the first line, because they |
1590 // need to be repainted with the new style, e.g. background, font style, | 1596 // need to be repainted with the new style, e.g. background, font style, |
1591 // etc. | 1597 // etc. |
1592 LayoutBlockFlow* firstLineContainer = nullptr; | 1598 LayoutBlockFlow* firstLineContainer = nullptr; |
(...skipping 1471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3064 | 3070 |
3065 if (RefPtr<ComputedStyle> style = firstLineStyleForCachedUncachedType( | 3071 if (RefPtr<ComputedStyle> style = firstLineStyleForCachedUncachedType( |
3066 Cached, isText() ? parent() : this, m_style.get())) | 3072 Cached, isText() ? parent() : this, m_style.get())) |
3067 return style.get(); | 3073 return style.get(); |
3068 | 3074 |
3069 return m_style.get(); | 3075 return m_style.get(); |
3070 } | 3076 } |
3071 | 3077 |
3072 ComputedStyle* LayoutObject::getCachedPseudoStyle( | 3078 ComputedStyle* LayoutObject::getCachedPseudoStyle( |
3073 PseudoId pseudo, | 3079 PseudoId pseudo, |
3074 const ComputedStyle* parentStyle) const { | 3080 const ComputedStyle* parentStyle) const { |
rune
2017/03/13 10:29:50
So, longer term, we'd remove this method as well,
emilio
2017/03/13 13:28:31
Yes, I think that'd be saner.
| |
3081 DCHECK_NE(pseudo, PseudoIdBefore); | |
3082 DCHECK_NE(pseudo, PseudoIdAfter); | |
3083 | |
3075 if (pseudo < FirstInternalPseudoId && !style()->hasPseudoStyle(pseudo)) | 3084 if (pseudo < FirstInternalPseudoId && !style()->hasPseudoStyle(pseudo)) |
3076 return nullptr; | 3085 return nullptr; |
3077 | 3086 |
3078 ComputedStyle* cachedStyle = style()->getCachedPseudoStyle(pseudo); | 3087 ComputedStyle* cachedStyle = style()->getCachedPseudoStyle(pseudo); |
3079 if (cachedStyle) | 3088 if (cachedStyle) |
3080 return cachedStyle; | 3089 return cachedStyle; |
3081 | 3090 |
3082 RefPtr<ComputedStyle> result = | 3091 RefPtr<ComputedStyle> result = |
3083 getUncachedPseudoStyle(PseudoStyleRequest(pseudo), parentStyle); | 3092 getUncachedPseudoStyle(PseudoStyleRequest(pseudo), parentStyle); |
3084 if (result) | 3093 if (result) |
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3599 const blink::LayoutObject* root = object1; | 3608 const blink::LayoutObject* root = object1; |
3600 while (root->parent()) | 3609 while (root->parent()) |
3601 root = root->parent(); | 3610 root = root->parent(); |
3602 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); | 3611 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); |
3603 } else { | 3612 } else { |
3604 WTFLogAlways("%s", "Cannot showLayoutTree. Root is (nil)"); | 3613 WTFLogAlways("%s", "Cannot showLayoutTree. Root is (nil)"); |
3605 } | 3614 } |
3606 } | 3615 } |
3607 | 3616 |
3608 #endif | 3617 #endif |
OLD | NEW |