[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.17-1283-gcf603cf
eric at webkit.org
eric at webkit.org
Tue Jan 5 23:57:42 UTC 2010
The following commit has been merged in the webkit-1.1 branch:
commit 3c708b8339b0bfe631e9ac5a76c9f06e305e07bd
Author: eric at webkit.org <eric at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Mon Dec 21 20:11:47 2009 +0000
2009-12-21 Carol Szabo <carol.szabo at nokia.com>
Reviewed by Darin Adler.
Inconsistent use of counterName and identifier in CSS counter code and loss of information about the counter type.
https://bugs.webkit.org/show_bug.cgi?id=31814
No new tests because there are no functional changes in this patch.
* rendering/CounterNode.cpp:
(WebCore::CounterNode::CounterNode):
(WebCore::CounterNode::computeCountInParent):
(WebCore::showTreeAndMark):
* rendering/RenderCounter.cpp:
(WebCore::planCounter):
(WebCore::findPlaceForCounter):
(WebCore::makeCounterNode):
(WebCore::RenderCounter::originalText):
Changed to use identifier instead of counterName and actsAsReset or hasResetType, as appropriate instead of isReset.
* rendering/CounterNode.h:
(WebCore::CounterNode::actsAsReset):
(WebCore::CounterNode::hasResetType):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@52450 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 0875543..b9b5b79 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,26 @@
+2009-12-21 Carol Szabo <carol.szabo at nokia.com>
+
+ Reviewed by Darin Adler.
+
+ Inconsistent use of counterName and identifier in CSS counter code and loss of information about the counter type.
+ https://bugs.webkit.org/show_bug.cgi?id=31814
+
+ No new tests because there are no functional changes in this patch.
+
+ * rendering/CounterNode.cpp:
+ (WebCore::CounterNode::CounterNode):
+ (WebCore::CounterNode::computeCountInParent):
+ (WebCore::showTreeAndMark):
+ * rendering/RenderCounter.cpp:
+ (WebCore::planCounter):
+ (WebCore::findPlaceForCounter):
+ (WebCore::makeCounterNode):
+ (WebCore::RenderCounter::originalText):
+ Changed to use identifier instead of counterName and actsAsReset or hasResetType, as appropriate instead of isReset.
+ * rendering/CounterNode.h:
+ (WebCore::CounterNode::actsAsReset):
+ (WebCore::CounterNode::hasResetType):
+
2009-12-21 Dirk Schulze <krit at webkit.org>
Reviewed by Darin Adler and Nikolas Zimmermann.
diff --git a/WebCore/rendering/CounterNode.cpp b/WebCore/rendering/CounterNode.cpp
index 95a3748..d4d2b3d 100644
--- a/WebCore/rendering/CounterNode.cpp
+++ b/WebCore/rendering/CounterNode.cpp
@@ -34,8 +34,8 @@
namespace WebCore {
-CounterNode::CounterNode(RenderObject* o, bool isReset, int value)
- : m_isReset(isReset)
+CounterNode::CounterNode(RenderObject* o, bool hasResetType, int value)
+ : m_hasResetType(hasResetType)
, m_value(value)
, m_countInParent(0)
, m_renderer(o)
@@ -100,14 +100,13 @@ CounterNode* CounterNode::previousInPreOrder() const
int CounterNode::computeCountInParent() const
{
- int increment = m_isReset ? 0 : m_value;
+ int increment = actsAsReset() ? 0 : m_value;
if (m_previousSibling)
return m_previousSibling->m_countInParent + increment;
ASSERT(m_parent->m_firstChild == this);
return m_parent->m_value + increment;
}
-
void CounterNode::resetRenderer(const AtomicString& identifier) const
{
if (!m_renderer || m_renderer->documentBeingDestroyed())
@@ -216,7 +215,7 @@ static void showTreeAndMark(const CounterNode* node)
for (const CounterNode* parent = current; parent && parent != root; parent = parent->parent())
fwrite(" ", 1, 2, stderr);
fprintf(stderr, "%p %s: %d %d P:%p PS:%p NS:%p R:%p\n",
- current, current->isReset() ? "reset____" : "increment", current->value(),
+ current, current->actsAsReset() ? "reset____" : "increment", current->value(),
current->countInParent(), current->parent(), current->previousSibling(),
current->nextSibling(), current->renderer());
}
diff --git a/WebCore/rendering/CounterNode.h b/WebCore/rendering/CounterNode.h
index 8081dc6..15f2eb8 100644
--- a/WebCore/rendering/CounterNode.h
+++ b/WebCore/rendering/CounterNode.h
@@ -42,7 +42,8 @@ class CounterNode : public Noncopyable {
public:
CounterNode(RenderObject*, bool isReset, int value);
- bool isReset() const { return m_isReset; }
+ bool actsAsReset() const { return m_hasResetType || !m_parent; }
+ bool hasResetType() const { return m_hasResetType; }
int value() const { return m_value; }
int countInParent() const { return m_countInParent; }
RenderObject* renderer() const { return m_renderer; }
@@ -58,15 +59,24 @@ public:
CounterNode* nextInPreOrderAfterChildren(const CounterNode* stayWithin = 0) const;
void insertAfter(CounterNode* newChild, CounterNode* beforeChild, const AtomicString& identifier);
+
+ // identifier must match the identifier of this counter.
void removeChild(CounterNode*, const AtomicString& identifier);
private:
int computeCountInParent() const;
void recount(const AtomicString& identifier);
+
+ // Invalidates the text in the renderer of this counter, if any.
+ // identifier must match the identifier of this counter.
void resetRenderer(const AtomicString& identifier) const;
+
+ // Invalidates the text in the renderer of this counter, if any,
+ // and in the renderers of all descendants of this counter, if any.
+ // identifier must match the identifier of this counter.
void resetRenderers(const AtomicString& identifier) const;
- bool m_isReset;
+ bool m_hasResetType;
int m_value;
int m_countInParent;
RenderObject* m_renderer;
diff --git a/WebCore/rendering/RenderCounter.cpp b/WebCore/rendering/RenderCounter.cpp
index b0aefc5..f88ab29 100644
--- a/WebCore/rendering/RenderCounter.cpp
+++ b/WebCore/rendering/RenderCounter.cpp
@@ -38,7 +38,7 @@ using namespace HTMLNames;
typedef HashMap<RefPtr<AtomicStringImpl>, CounterNode*> CounterMap;
typedef HashMap<const RenderObject*, CounterMap*> CounterMaps;
-static CounterNode* makeCounterNode(RenderObject*, const AtomicString& counterName, bool alwaysCreateCounter);
+static CounterNode* makeCounterNode(RenderObject*, const AtomicString& identifier, bool alwaysCreateCounter);
static CounterMaps& counterMaps()
{
@@ -53,7 +53,7 @@ static inline RenderObject* previousSiblingOrParent(RenderObject* object)
return object->parent();
}
-static bool planCounter(RenderObject* object, const AtomicString& counterName, bool& isReset, int& value)
+static bool planCounter(RenderObject* object, const AtomicString& identifier, bool& isReset, int& value)
{
ASSERT(object);
@@ -66,7 +66,7 @@ static bool planCounter(RenderObject* object, const AtomicString& counterName, b
ASSERT(style);
if (const CounterDirectiveMap* directivesMap = style->counterDirectives()) {
- CounterDirectives directives = directivesMap->get(counterName.impl());
+ CounterDirectives directives = directivesMap->get(identifier.impl());
if (directives.m_reset) {
value = directives.m_resetValue;
if (directives.m_increment)
@@ -81,7 +81,7 @@ static bool planCounter(RenderObject* object, const AtomicString& counterName, b
}
}
- if (counterName == "list-item") {
+ if (identifier == "list-item") {
if (object->isListItem()) {
if (toRenderListItem(object)->hasExplicitValue()) {
value = toRenderListItem(object)->explicitValue();
@@ -142,7 +142,7 @@ static bool findPlaceForCounter(RenderObject* counterOwner, const AtomicString&
if (currentCounter) {
// We have a suitable counter on the EndSearchRenderer.
if (previousSibling) { // But we already found another counter that we come after.
- if (currentCounter->isReset()) {
+ if (currentCounter->actsAsReset()) {
// We found a reset counter that is on a renderer that is a sibling of ours or a parent.
if (isReset && currentRenderer->parent() == counterOwner->parent()) {
// We are also a reset counter and the previous reset was on a sibling renderer
@@ -171,7 +171,7 @@ static bool findPlaceForCounter(RenderObject* counterOwner, const AtomicString&
// In this case we follow pretty much the same logic as above but no ASSERTs about
// previousSibling, and when we are a sibling of the end counter we must set previousSibling
// to currentCounter.
- if (currentCounter->isReset()) {
+ if (currentCounter->actsAsReset()) {
if (isReset && currentRenderer->parent() == counterOwner->parent()) {
parent = currentCounter->parent();
previousSibling = currentCounter;
@@ -201,7 +201,7 @@ static bool findPlaceForCounter(RenderObject* counterOwner, const AtomicString&
if (previousSibling) {
// Since we had a suitable previous counter before, we should only consider this one as our
// previousSibling if it is a reset counter and hence the current previousSibling is its child.
- if (currentCounter->isReset()) {
+ if (currentCounter->actsAsReset()) {
previousSibling = currentCounter;
// We are no longer interested in previous siblings of the currentRenderer or their children
// as counters they may have attached cannot be the previous sibling of the counter we are placing.
@@ -226,31 +226,25 @@ static bool findPlaceForCounter(RenderObject* counterOwner, const AtomicString&
return false;
}
-static CounterNode* makeCounterNode(RenderObject* object, const AtomicString& counterName, bool alwaysCreateCounter)
+static CounterNode* makeCounterNode(RenderObject* object, const AtomicString& identifier, bool alwaysCreateCounter)
{
ASSERT(object);
if (object->m_hasCounterNodeMap)
if (CounterMap* nodeMap = counterMaps().get(object))
- if (CounterNode* node = nodeMap->get(counterName.impl()))
+ if (CounterNode* node = nodeMap->get(identifier.impl()))
return node;
bool isReset = false;
int value = 0;
- if (!planCounter(object, counterName, isReset, value) && !alwaysCreateCounter)
+ if (!planCounter(object, identifier, isReset, value) && !alwaysCreateCounter)
return 0;
CounterNode* newParent = 0;
CounterNode* newPreviousSibling = 0;
- CounterNode* newNode;
- if (findPlaceForCounter(object, counterName, isReset, newParent, newPreviousSibling)) {
- newNode = new CounterNode(object, isReset, value);
- newParent->insertAfter(newNode, newPreviousSibling, counterName);
- } else {
- // Make a reset node for counters that aren't inside an existing reset node.
- newNode = new CounterNode(object, true, value);
- }
-
+ CounterNode* newNode = new CounterNode(object, isReset, value);
+ if (findPlaceForCounter(object, identifier, isReset, newParent, newPreviousSibling))
+ newParent->insertAfter(newNode, newPreviousSibling, identifier);
CounterMap* nodeMap;
if (object->m_hasCounterNodeMap)
nodeMap = counterMaps().get(object);
@@ -259,8 +253,7 @@ static CounterNode* makeCounterNode(RenderObject* object, const AtomicString& co
counterMaps().set(object, nodeMap);
object->m_hasCounterNodeMap = true;
}
- nodeMap->set(counterName.impl(), newNode);
-
+ nodeMap->set(identifier.impl(), newNode);
return newNode;
}
@@ -290,12 +283,12 @@ PassRefPtr<StringImpl> RenderCounter::originalText() const
m_counterNode = makeCounterNode(parent(), m_counter.identifier(), true);
CounterNode* child = m_counterNode;
- int value = child->isReset() ? child->value() : child->countInParent();
+ int value = child->actsAsReset() ? child->value() : child->countInParent();
String text = listMarkerText(m_counter.listStyle(), value);
if (!m_counter.separator().isNull()) {
- if (!child->isReset())
+ if (!child->actsAsReset())
child = child->parent();
while (CounterNode* parent = child->parent()) {
text = listMarkerText(m_counter.listStyle(), child->countInParent())
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list