Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(490)

Unified Diff: third_party/WebKit/Source/core/layout/LayoutObject.cpp

Issue 2787123007: Do the obvious thing for first-line styles.
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/core/dom/Document.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/layout/LayoutObject.cpp
diff --git a/third_party/WebKit/Source/core/layout/LayoutObject.cpp b/third_party/WebKit/Source/core/layout/LayoutObject.cpp
index 354e11b3a7aa04a8e1fa8faea0f727396b1674c7..b32332c3a4394117cbcd18b9a296c47818be4235 100644
--- a/third_party/WebKit/Source/core/layout/LayoutObject.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutObject.cpp
@@ -3027,39 +3027,10 @@ static PassRefPtr<ComputedStyle> firstLineStyleForCachedUncachedType(
StyleCacheState type,
const LayoutObject* layoutObject,
ComputedStyle* style) {
- const LayoutObject* layoutObjectForFirstLineStyle = layoutObject;
- if (layoutObject->isBeforeOrAfterContent())
- layoutObjectForFirstLineStyle = layoutObject->parent();
-
- if (layoutObjectForFirstLineStyle->behavesLikeBlockContainer()) {
- if (const LayoutBlock* firstLineBlock =
- toLayoutBlock(layoutObjectForFirstLineStyle)
- ->enclosingFirstLineStyleBlock()) {
- if (type == Cached)
- return firstLineBlock->getCachedPseudoStyle(PseudoIdFirstLine, style);
- return firstLineBlock->getUncachedPseudoStyle(
- PseudoStyleRequest(PseudoIdFirstLine), style);
- }
- } else if (!layoutObjectForFirstLineStyle->isAnonymous() &&
- layoutObjectForFirstLineStyle->isLayoutInline() &&
- !layoutObjectForFirstLineStyle->node()
- ->isFirstLetterPseudoElement()) {
- const ComputedStyle* parentStyle =
- layoutObjectForFirstLineStyle->parent()->firstLineStyle();
- if (parentStyle != layoutObjectForFirstLineStyle->parent()->style()) {
- if (type == Cached) {
- // A first-line style is in effect. Cache a first-line style for
- // ourselves.
- layoutObjectForFirstLineStyle->mutableStyleRef().setHasPseudoStyle(
- PseudoIdFirstLineInherited);
- return layoutObjectForFirstLineStyle->getCachedPseudoStyle(
- PseudoIdFirstLineInherited, parentStyle);
- }
- return layoutObjectForFirstLineStyle->getUncachedPseudoStyle(
- PseudoStyleRequest(PseudoIdFirstLineInherited), parentStyle);
- }
- }
- return nullptr;
+ return type == Cached
+ ? layoutObject->getCachedPseudoStyle(PseudoIdFirstLine, style)
+ : layoutObject->getUncachedPseudoStyle(
+ PseudoStyleRequest(PseudoIdFirstLine), style);
}
PassRefPtr<ComputedStyle> LayoutObject::uncachedFirstLineStyle() const {
@@ -3074,8 +3045,8 @@ PassRefPtr<ComputedStyle> LayoutObject::uncachedFirstLineStyle() const {
ComputedStyle* LayoutObject::cachedFirstLineStyle() const {
ASSERT(document().styleEngine().usesFirstLineRules());
- if (RefPtr<ComputedStyle> style = firstLineStyleForCachedUncachedType(
- Cached, isText() ? parent() : this, m_style.get()))
+ if (RefPtr<ComputedStyle> style =
+ firstLineStyleForCachedUncachedType(Cached, this, m_style.get()))
return style.get();
return m_style.get();
« no previous file with comments | « third_party/WebKit/Source/core/dom/Document.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698