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

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

Issue 1033943002: Rename LayoutStyle to papayawhip (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: ensureComputedStyle 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
« no previous file with comments | « Source/core/layout/LayoutCounter.h ('k') | Source/core/layout/LayoutDeprecatedFlexibleBox.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 12 matching lines...) Expand all
23 #include "core/layout/LayoutCounter.h" 23 #include "core/layout/LayoutCounter.h"
24 24
25 #include "core/HTMLNames.h" 25 #include "core/HTMLNames.h"
26 #include "core/dom/Element.h" 26 #include "core/dom/Element.h"
27 #include "core/dom/ElementTraversal.h" 27 #include "core/dom/ElementTraversal.h"
28 #include "core/html/HTMLOListElement.h" 28 #include "core/html/HTMLOListElement.h"
29 #include "core/layout/CounterNode.h" 29 #include "core/layout/CounterNode.h"
30 #include "core/layout/LayoutListItem.h" 30 #include "core/layout/LayoutListItem.h"
31 #include "core/layout/LayoutListMarker.h" 31 #include "core/layout/LayoutListMarker.h"
32 #include "core/layout/LayoutView.h" 32 #include "core/layout/LayoutView.h"
33 #include "core/layout/style/LayoutStyle.h" 33 #include "core/layout/style/ComputedStyle.h"
34 #include "wtf/StdLibExtras.h" 34 #include "wtf/StdLibExtras.h"
35 35
36 #ifndef NDEBUG 36 #ifndef NDEBUG
37 #include <stdio.h> 37 #include <stdio.h>
38 #endif 38 #endif
39 39
40 namespace blink { 40 namespace blink {
41 41
42 using namespace HTMLNames; 42 using namespace HTMLNames;
43 43
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 static bool planCounter(LayoutObject& object, const AtomicString& identifier, bo ol& isReset, int& value) 104 static bool planCounter(LayoutObject& object, const AtomicString& identifier, bo ol& isReset, int& value)
105 { 105 {
106 // Real text nodes don't have their own style so they can't have counters. 106 // Real text nodes don't have their own style so they can't have counters.
107 // We can't even look at their styles or we'll see extra resets and incremen ts! 107 // We can't even look at their styles or we'll see extra resets and incremen ts!
108 if (object.isText() && !object.isBR()) 108 if (object.isText() && !object.isBR())
109 return false; 109 return false;
110 Node* generatingNode = object.generatingNode(); 110 Node* generatingNode = object.generatingNode();
111 // We must have a generating node or else we cannot have a counter. 111 // We must have a generating node or else we cannot have a counter.
112 if (!generatingNode) 112 if (!generatingNode)
113 return false; 113 return false;
114 const LayoutStyle& style = object.styleRef(); 114 const ComputedStyle& style = object.styleRef();
115 115
116 switch (style.styleType()) { 116 switch (style.styleType()) {
117 case NOPSEUDO: 117 case NOPSEUDO:
118 // Sometimes nodes have more then one renderer. Only the first one gets the counter 118 // Sometimes nodes have more then one renderer. Only the first one gets the counter
119 // LayoutTests/http/tests/css/counter-crash.html 119 // LayoutTests/http/tests/css/counter-crash.html
120 if (generatingNode->layoutObject() != &object) 120 if (generatingNode->layoutObject() != &object)
121 return false; 121 return false;
122 break; 122 break;
123 case BEFORE: 123 case BEFORE:
124 case AFTER: 124 case AFTER:
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after
534 if (node) 534 if (node)
535 node = node->parentNode(); 535 node = node->parentNode();
536 else 536 else
537 node = renderer->generatingNode(); 537 node = renderer->generatingNode();
538 if (node && node->needsAttach()) 538 if (node && node->needsAttach())
539 return; // No need to update if the parent is not attached yet 539 return; // No need to update if the parent is not attached yet
540 for (LayoutObject* descendant = renderer; descendant; descendant = descendan t->nextInPreOrder(renderer)) 540 for (LayoutObject* descendant = renderer; descendant; descendant = descendan t->nextInPreOrder(renderer))
541 updateCounters(*descendant); 541 updateCounters(*descendant);
542 } 542 }
543 543
544 void LayoutCounter::rendererStyleChanged(LayoutObject& renderer, const LayoutSty le* oldStyle, const LayoutStyle& newStyle) 544 void LayoutCounter::rendererStyleChanged(LayoutObject& renderer, const ComputedS tyle* oldStyle, const ComputedStyle& newStyle)
545 { 545 {
546 Node* node = renderer.generatingNode(); 546 Node* node = renderer.generatingNode();
547 if (!node || node->needsAttach()) 547 if (!node || node->needsAttach())
548 return; // cannot have generated content or if it can have, it will be h andled during attaching 548 return; // cannot have generated content or if it can have, it will be h andled during attaching
549 const CounterDirectiveMap* oldCounterDirectives = oldStyle ? oldStyle->count erDirectives() : 0; 549 const CounterDirectiveMap* oldCounterDirectives = oldStyle ? oldStyle->count erDirectives() : 0;
550 const CounterDirectiveMap* newCounterDirectives = newStyle.counterDirectives (); 550 const CounterDirectiveMap* newCounterDirectives = newStyle.counterDirectives ();
551 if (oldCounterDirectives) { 551 if (oldCounterDirectives) {
552 if (newCounterDirectives) { 552 if (newCounterDirectives) {
553 CounterDirectiveMap::const_iterator newMapEnd = newCounterDirectives ->end(); 553 CounterDirectiveMap::const_iterator newMapEnd = newCounterDirectives ->end();
554 CounterDirectiveMap::const_iterator oldMapEnd = oldCounterDirectives ->end(); 554 CounterDirectiveMap::const_iterator oldMapEnd = oldCounterDirectives ->end();
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
603 fprintf(stderr, " "); 603 fprintf(stderr, " ");
604 fprintf(stderr, "%p N:%p P:%p PS:%p NS:%p C:%p\n", 604 fprintf(stderr, "%p N:%p P:%p PS:%p NS:%p C:%p\n",
605 current, current->node(), current->parent(), current->previousSiblin g(), 605 current, current->node(), current->parent(), current->previousSiblin g(),
606 current->nextSibling(), current->hasCounterNodeMap() ? 606 current->nextSibling(), current->hasCounterNodeMap() ?
607 counterName ? blink::counterMaps().get(current)->get(identifier) : ( blink::CounterNode*)1 : (blink::CounterNode*)0); 607 counterName ? blink::counterMaps().get(current)->get(identifier) : ( blink::CounterNode*)1 : (blink::CounterNode*)0);
608 } 608 }
609 fflush(stderr); 609 fflush(stderr);
610 } 610 }
611 611
612 #endif // NDEBUG 612 #endif // NDEBUG
OLDNEW
« no previous file with comments | « Source/core/layout/LayoutCounter.h ('k') | Source/core/layout/LayoutDeprecatedFlexibleBox.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698