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

Side by Side Diff: Source/core/layout/LayoutObject.cpp

Issue 778003003: List marker pseudo elements. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 8 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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. All rights reserv ed. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserv ed.
7 * Copyright (C) 2009 Google Inc. All rights reserved. 7 * Copyright (C) 2009 Google Inc. All rights reserved.
8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) 8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/)
9 * 9 *
10 * This library is free software; you can redistribute it and/or 10 * This library is free software; you can redistribute it and/or
(...skipping 1500 matching lines...) Expand 10 before | Expand all | Expand 10 after
1511 containingBlock()->showLineTreeAndMark(0, 0, 0, 0, this); 1511 containingBlock()->showLineTreeAndMark(0, 0, 0, 0, this);
1512 } 1512 }
1513 1513
1514 void LayoutObject::showLayoutObject() const 1514 void LayoutObject::showLayoutObject() const
1515 { 1515 {
1516 showLayoutObject(0); 1516 showLayoutObject(0);
1517 } 1517 }
1518 1518
1519 void LayoutObject::showLayoutObject(int printedCharacters) const 1519 void LayoutObject::showLayoutObject(int printedCharacters) const
1520 { 1520 {
1521 printedCharacters += fprintf(stderr, "%s %p", decoratedName().ascii().data() , this); 1521 IntRect size = absoluteBoundingBoxRect();
1522 printedCharacters += fprintf(stderr, "%s %p (%d,%d %dx%d)", decoratedName(). ascii().data(), this, size.x(), size.y(), size.width(), size.height());
1522 1523
1523 if (isText() && toLayoutText(this)->isTextFragment()) 1524 if (isText() && toLayoutText(this)->isTextFragment())
1524 printedCharacters += fprintf(stderr, " \"%s\" ", toLayoutText(this)->tex t().ascii().data()); 1525 printedCharacters += fprintf(stderr, " \"%s\" ", toLayoutText(this)->tex t().ascii().data());
1525 1526
1526 if (node()) { 1527 if (node()) {
1527 if (printedCharacters) 1528 if (printedCharacters)
1528 for (; printedCharacters < showTreeCharacterOffset; printedCharacter s++) 1529 for (; printedCharacters < showTreeCharacterOffset; printedCharacter s++)
1529 fputc(' ', stderr); 1530 fputc(' ', stderr);
1530 fputc('\t', stderr); 1531 fputc('\t', stderr);
1532 fputc('\t', stderr);
1531 node()->showNode(); 1533 node()->showNode();
1532 } else { 1534 } else {
1533 fputc('\n', stderr); 1535 fputc('\n', stderr);
1534 } 1536 }
1535 } 1537 }
1536 1538
1537 void LayoutObject::showLayoutTreeAndMark(const LayoutObject* markedObject1, cons t char* markedLabel1, const LayoutObject* markedObject2, const char* markedLabel 2, int depth) const 1539 void LayoutObject::showLayoutTreeAndMark(const LayoutObject* markedObject1, cons t char* markedLabel1, const LayoutObject* markedObject2, const char* markedLabel 2, int depth) const
1538 { 1540 {
1539 int printedCharacters = 0; 1541 int printedCharacters = 0;
1540 if (markedObject1 == this && markedLabel1) 1542 if (markedObject1 == this && markedLabel1)
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
1668 if (diff.needsPaintInvalidationLayer() && !hasLayer()) { 1670 if (diff.needsPaintInvalidationLayer() && !hasLayer()) {
1669 diff.clearNeedsPaintInvalidation(); 1671 diff.clearNeedsPaintInvalidation();
1670 diff.setNeedsPaintInvalidationObject(); 1672 diff.setNeedsPaintInvalidationObject();
1671 } 1673 }
1672 1674
1673 return diff; 1675 return diff;
1674 } 1676 }
1675 1677
1676 void LayoutObject::setPseudoStyle(PassRefPtr<ComputedStyle> pseudoStyle) 1678 void LayoutObject::setPseudoStyle(PassRefPtr<ComputedStyle> pseudoStyle)
1677 { 1679 {
1678 ASSERT(pseudoStyle->styleType() == BEFORE || pseudoStyle->styleType() == AFT ER || pseudoStyle->styleType() == FIRST_LETTER); 1680 ASSERT(pseudoStyle->styleType() == BEFORE || pseudoStyle->styleType() == AFT ER || pseudoStyle->styleType() == FIRST_LETTER
1681 || (RuntimeEnabledFeatures::listMarkerPseudoElementEnabled() && pseudoSt yle->styleType() == MARKER));
1679 1682
1680 // FIXME: We should consider just making all pseudo items use an inherited s tyle. 1683 // FIXME: We should consider just making all pseudo items use an inherited s tyle.
1681 1684
1682 // Images are special and must inherit the pseudoStyle so the width and heig ht of 1685 // Images are special and must inherit the pseudoStyle so the width and heig ht of
1683 // the pseudo element doesn't change the size of the image. In all other cas es we 1686 // the pseudo element doesn't change the size of the image. In all other cas es we
1684 // can just share the style. 1687 // can just share the style.
1685 // 1688 //
1686 // Quotes are also LayoutInline, so we need to create an inherited style to avoid 1689 // Quotes are also LayoutInline, so we need to create an inherited style to avoid
1687 // getting an inline with positioning or an invalid display. 1690 // getting an inline with positioning or an invalid display.
1688 // 1691 //
(...skipping 1050 matching lines...) Expand 10 before | Expand all | Expand 10 after
2739 ASSERT(document().styleEngine().usesFirstLineRules()); 2742 ASSERT(document().styleEngine().usesFirstLineRules());
2740 2743
2741 if (RefPtr<ComputedStyle> style = firstLineStyleForCachedUncachedType(Cached , isText() ? parent() : this, m_style.get())) 2744 if (RefPtr<ComputedStyle> style = firstLineStyleForCachedUncachedType(Cached , isText() ? parent() : this, m_style.get()))
2742 return style.get(); 2745 return style.get();
2743 2746
2744 return m_style.get(); 2747 return m_style.get();
2745 } 2748 }
2746 2749
2747 ComputedStyle* LayoutObject::getCachedPseudoStyle(PseudoId pseudo, const Compute dStyle* parentStyle) const 2750 ComputedStyle* LayoutObject::getCachedPseudoStyle(PseudoId pseudo, const Compute dStyle* parentStyle) const
2748 { 2751 {
2749 if (pseudo < FIRST_INTERNAL_PSEUDOID && !style()->hasPseudoStyle(pseudo)) 2752 // FIXME: adding display != LIST_ITEM seems wrong ... wrap in method?
2753 if (pseudo < FIRST_INTERNAL_PSEUDOID && !style()->hasPseudoStyle(pseudo) && style()->display() != LIST_ITEM)
esprehn 2015/04/22 07:45:46 remove list item check here. List item shouldn't b
dsinclair 2015/04/22 20:00:39 Done.
2750 return 0; 2754 return 0;
2751 2755
2752 ComputedStyle* cachedStyle = style()->getCachedPseudoStyle(pseudo); 2756 ComputedStyle* cachedStyle = style()->getCachedPseudoStyle(pseudo);
2753 if (cachedStyle) 2757 if (cachedStyle)
2754 return cachedStyle; 2758 return cachedStyle;
2755 2759
2756 RefPtr<ComputedStyle> result = getUncachedPseudoStyle(PseudoStyleRequest(pse udo), parentStyle); 2760 RefPtr<ComputedStyle> result = getUncachedPseudoStyle(PseudoStyleRequest(pse udo), parentStyle);
2757 if (result) 2761 if (result)
2758 return mutableStyleRef().addCachedPseudoStyle(result.release()); 2762 return mutableStyleRef().addCachedPseudoStyle(result.release());
2759 return 0; 2763 return 0;
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
3053 } 3057 }
3054 3058
3055 // Everything was anonymous. Give up. 3059 // Everything was anonymous. Give up.
3056 return PositionWithAffinity(); 3060 return PositionWithAffinity();
3057 } 3061 }
3058 3062
3059 PositionWithAffinity LayoutObject::createPositionWithAffinity(const Position& po sition) 3063 PositionWithAffinity LayoutObject::createPositionWithAffinity(const Position& po sition)
3060 { 3064 {
3061 if (position.isNotNull()) 3065 if (position.isNotNull())
3062 return PositionWithAffinity(position); 3066 return PositionWithAffinity(position);
3063
3064 ASSERT(!node());
esprehn 2015/04/22 07:45:46 Removing this means you caused a bug.
dsinclair 2015/04/22 20:00:39 Done.
3065 return createPositionWithAffinity(0, DOWNSTREAM); 3067 return createPositionWithAffinity(0, DOWNSTREAM);
3066 } 3068 }
3067 3069
3068 CursorDirective LayoutObject::getCursor(const LayoutPoint&, Cursor&) const 3070 CursorDirective LayoutObject::getCursor(const LayoutPoint&, Cursor&) const
3069 { 3071 {
3070 return SetCursorBasedOnStyle; 3072 return SetCursorBasedOnStyle;
3071 } 3073 }
3072 3074
3073 bool LayoutObject::canUpdateSelectionOnRootLineBoxes() const 3075 bool LayoutObject::canUpdateSelectionOnRootLineBoxes() const
3074 { 3076 {
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
3281 { 3283 {
3282 if (object1) { 3284 if (object1) {
3283 const blink::LayoutObject* root = object1; 3285 const blink::LayoutObject* root = object1;
3284 while (root->parent()) 3286 while (root->parent())
3285 root = root->parent(); 3287 root = root->parent();
3286 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); 3288 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0);
3287 } 3289 }
3288 } 3290 }
3289 3291
3290 #endif 3292 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698