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

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 1047 matching lines...) Expand 10 before | Expand all | Expand 10 after
2736 ASSERT(document().styleEngine().usesFirstLineRules()); 2739 ASSERT(document().styleEngine().usesFirstLineRules());
2737 2740
2738 if (RefPtr<ComputedStyle> style = firstLineStyleForCachedUncachedType(Cached , isText() ? parent() : this, m_style.get())) 2741 if (RefPtr<ComputedStyle> style = firstLineStyleForCachedUncachedType(Cached , isText() ? parent() : this, m_style.get()))
2739 return style.get(); 2742 return style.get();
2740 2743
2741 return m_style.get(); 2744 return m_style.get();
2742 } 2745 }
2743 2746
2744 ComputedStyle* LayoutObject::getCachedPseudoStyle(PseudoId pseudo, const Compute dStyle* parentStyle) const 2747 ComputedStyle* LayoutObject::getCachedPseudoStyle(PseudoId pseudo, const Compute dStyle* parentStyle) const
2745 { 2748 {
2746 if (pseudo < FIRST_INTERNAL_PSEUDOID && !style()->hasPseudoStyle(pseudo)) 2749 // FIXME: adding display != LIST_ITEM seems wrong ... wrap in method?
2750 if (pseudo < FIRST_INTERNAL_PSEUDOID && !style()->hasPseudoStyle(pseudo) && style()->display() != LIST_ITEM)
2747 return 0; 2751 return 0;
2748 2752
2749 ComputedStyle* cachedStyle = style()->getCachedPseudoStyle(pseudo); 2753 ComputedStyle* cachedStyle = style()->getCachedPseudoStyle(pseudo);
2750 if (cachedStyle) 2754 if (cachedStyle)
2751 return cachedStyle; 2755 return cachedStyle;
2752 2756
2753 RefPtr<ComputedStyle> result = getUncachedPseudoStyle(PseudoStyleRequest(pse udo), parentStyle); 2757 RefPtr<ComputedStyle> result = getUncachedPseudoStyle(PseudoStyleRequest(pse udo), parentStyle);
2754 if (result) 2758 if (result)
2755 return mutableStyleRef().addCachedPseudoStyle(result.release()); 2759 return mutableStyleRef().addCachedPseudoStyle(result.release());
2756 return 0; 2760 return 0;
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
3050 } 3054 }
3051 3055
3052 // Everything was anonymous. Give up. 3056 // Everything was anonymous. Give up.
3053 return PositionWithAffinity(); 3057 return PositionWithAffinity();
3054 } 3058 }
3055 3059
3056 PositionWithAffinity LayoutObject::createPositionWithAffinity(const Position& po sition) 3060 PositionWithAffinity LayoutObject::createPositionWithAffinity(const Position& po sition)
3057 { 3061 {
3058 if (position.isNotNull()) 3062 if (position.isNotNull())
3059 return PositionWithAffinity(position); 3063 return PositionWithAffinity(position);
3060
3061 ASSERT(!node());
3062 return createPositionWithAffinity(0, DOWNSTREAM); 3064 return createPositionWithAffinity(0, DOWNSTREAM);
3063 } 3065 }
3064 3066
3065 CursorDirective LayoutObject::getCursor(const LayoutPoint&, Cursor&) const 3067 CursorDirective LayoutObject::getCursor(const LayoutPoint&, Cursor&) const
3066 { 3068 {
3067 return SetCursorBasedOnStyle; 3069 return SetCursorBasedOnStyle;
3068 } 3070 }
3069 3071
3070 bool LayoutObject::canUpdateSelectionOnRootLineBoxes() const 3072 bool LayoutObject::canUpdateSelectionOnRootLineBoxes() const
3071 { 3073 {
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
3261 { 3263 {
3262 if (object1) { 3264 if (object1) {
3263 const blink::LayoutObject* root = object1; 3265 const blink::LayoutObject* root = object1;
3264 while (root->parent()) 3266 while (root->parent())
3265 root = root->parent(); 3267 root = root->parent();
3266 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); 3268 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0);
3267 } 3269 }
3268 } 3270 }
3269 3271
3270 #endif 3272 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698