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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutCounter.cpp

Issue 1765933003: style: Rename the PseudoId enum values to CamelCase and prefix them. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: enum-clash-PseudoId: none Created 4 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 unified diff | Download patch
OLDNEW
1 /** 1 /**
2 * Copyright (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com) 2 * Copyright (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com)
3 * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. 3 * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 // We can't even look at their styles or we'll see extra resets and incremen ts! 129 // We can't even look at their styles or we'll see extra resets and incremen ts!
130 if (object.isText() && !object.isBR()) 130 if (object.isText() && !object.isBR())
131 return false; 131 return false;
132 Node* generatingNode = object.generatingNode(); 132 Node* generatingNode = object.generatingNode();
133 // We must have a generating node or else we cannot have a counter. 133 // We must have a generating node or else we cannot have a counter.
134 if (!generatingNode) 134 if (!generatingNode)
135 return false; 135 return false;
136 const ComputedStyle& style = object.styleRef(); 136 const ComputedStyle& style = object.styleRef();
137 137
138 switch (style.styleType()) { 138 switch (style.styleType()) {
139 case NOPSEUDO: 139 case PseudoIdNone:
140 // Sometimes nodes have more then one layoutObject. Only the first one g ets the counter 140 // Sometimes nodes have more then one layoutObject. Only the first one g ets the counter
141 // LayoutTests/http/tests/css/counter-crash.html 141 // LayoutTests/http/tests/css/counter-crash.html
142 if (generatingNode->layoutObject() != &object) 142 if (generatingNode->layoutObject() != &object)
143 return false; 143 return false;
144 break; 144 break;
145 case BEFORE: 145 case PseudoIdBefore:
146 case AFTER: 146 case PseudoIdAfter:
147 break; 147 break;
148 default: 148 default:
149 return false; // Counters are forbidden from all other pseudo elements. 149 return false; // Counters are forbidden from all other pseudo elements.
150 } 150 }
151 151
152 const CounterDirectives directives = style.getCounterDirectives(identifier); 152 const CounterDirectives directives = style.getCounterDirectives(identifier);
153 if (directives.isDefined()) { 153 if (directives.isDefined()) {
154 value = directives.combinedValue(); 154 value = directives.combinedValue();
155 isReset = directives.isReset(); 155 isReset = directives.isReset();
156 return true; 156 return true;
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 PassRefPtr<StringImpl> LayoutCounter::originalText() const 394 PassRefPtr<StringImpl> LayoutCounter::originalText() const
395 { 395 {
396 if (!m_counterNode) { 396 if (!m_counterNode) {
397 LayoutObject* beforeAfterContainer = parent(); 397 LayoutObject* beforeAfterContainer = parent();
398 while (true) { 398 while (true) {
399 if (!beforeAfterContainer) 399 if (!beforeAfterContainer)
400 return nullptr; 400 return nullptr;
401 if (!beforeAfterContainer->isAnonymous() && !beforeAfterContainer->i sPseudoElement()) 401 if (!beforeAfterContainer->isAnonymous() && !beforeAfterContainer->i sPseudoElement())
402 return nullptr; // LayoutCounters are restricted to before and a fter pseudo elements 402 return nullptr; // LayoutCounters are restricted to before and a fter pseudo elements
403 PseudoId containerStyle = beforeAfterContainer->style()->styleType() ; 403 PseudoId containerStyle = beforeAfterContainer->style()->styleType() ;
404 if ((containerStyle == BEFORE) || (containerStyle == AFTER)) 404 if ((containerStyle == PseudoIdBefore) || (containerStyle == PseudoI dAfter))
405 break; 405 break;
406 beforeAfterContainer = beforeAfterContainer->parent(); 406 beforeAfterContainer = beforeAfterContainer->parent();
407 } 407 }
408 makeCounterNodeIfNeeded(*beforeAfterContainer, m_counter.identifier(), t rue)->addLayoutObject(const_cast<LayoutCounter*>(this)); 408 makeCounterNodeIfNeeded(*beforeAfterContainer, m_counter.identifier(), t rue)->addLayoutObject(const_cast<LayoutCounter*>(this));
409 ASSERT(m_counterNode); 409 ASSERT(m_counterNode);
410 } 410 }
411 CounterNode* child = m_counterNode; 411 CounterNode* child = m_counterNode;
412 int value = child->actsAsReset() ? child->value() : child->countInParent(); 412 int value = child->actsAsReset() ? child->value() : child->countInParent();
413 413
414 String text = ListMarkerText::text(m_counter.listStyle(), value); 414 String text = ListMarkerText::text(m_counter.listStyle(), value);
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
625 fprintf(stderr, " "); 625 fprintf(stderr, " ");
626 fprintf(stderr, "%p N:%p P:%p PS:%p NS:%p C:%p\n", 626 fprintf(stderr, "%p N:%p P:%p PS:%p NS:%p C:%p\n",
627 current, current->node(), current->parent(), current->previousSiblin g(), 627 current, current->node(), current->parent(), current->previousSiblin g(),
628 current->nextSibling(), current->hasCounterNodeMap() ? 628 current->nextSibling(), current->hasCounterNodeMap() ?
629 counterName ? blink::counterMaps().get(current)->get(identifier) : ( blink::CounterNode*)1 : (blink::CounterNode*)0); 629 counterName ? blink::counterMaps().get(current)->get(identifier) : ( blink::CounterNode*)1 : (blink::CounterNode*)0);
630 } 630 }
631 fflush(stderr); 631 fflush(stderr);
632 } 632 }
633 633
634 #endif // NDEBUG 634 #endif // NDEBUG
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutBlock.cpp ('k') | third_party/WebKit/Source/core/layout/LayoutObject.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698