WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Proposed patch
bug-80678.diff (text/plain), 3.93 KB, created by
Andreas Kling
on 2012-03-09 13:59:29 PST
(
hide
)
Description:
Proposed patch
Filename:
MIME Type:
Creator:
Andreas Kling
Created:
2012-03-09 13:59:29 PST
Size:
3.93 KB
patch
obsolete
>diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 1334924..607962f 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,27 @@ >+2012-03-09 Andreas Kling <awesomekling@apple.com> >+ >+ Restore Attr::style() functionality. >+ <http://webkit.org/b/80678> >+ <rdar://problem/10933904> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ The neutering of Attr::style() in r106740 broke some internal clients of the Obj-C API, >+ so this was definitely premature. >+ >+ Since we no longer have a per-Attribute style object, synthesize one in style() and >+ hang it off of the Attr. This grows Attr by one pointer, but it's a low-volume object >+ so it shouldn't matter much. >+ >+ We recreate the StylePropertySet object on every call to style(), to avoid complicating >+ things with custom invalidation code. >+ >+ * dom/Attr.cpp: >+ (WebCore::Attr::style): >+ * dom/Attr.h: >+ * dom/StyledElement.h: >+ (WebCore::StyledElement::collectStyleForAttribute): >+ > 2012-03-08 Erik Arvidsson <arv@chromium.org> > > [V8] Fix object scope for inline event attribute handlers >diff --git a/Source/WebCore/dom/Attr.cpp b/Source/WebCore/dom/Attr.cpp >index 75f7b8f..088fc2f 100644 >--- a/Source/WebCore/dom/Attr.cpp >+++ b/Source/WebCore/dom/Attr.cpp >@@ -23,10 +23,10 @@ > #include "config.h" > #include "Attr.h" > >-#include "Element.h" > #include "ExceptionCode.h" > #include "HTMLNames.h" > #include "ScopedEventQueue.h" >+#include "StyledElement.h" > #include "Text.h" > #include "XMLNSNames.h" > #include <wtf/text/AtomicString.h> >@@ -196,4 +196,14 @@ bool Attr::isId() const > return qualifiedName().matches(document()->idAttributeName()); > } > >+CSSStyleDeclaration* Attr::style() >+{ >+ // This function only exists to support the Obj-C bindings. >+ if (!m_element->isStyledElement()) >+ return 0; >+ m_style = StylePropertySet::create(); >+ static_cast<StyledElement*>(m_element)->collectStyleForAttribute(m_attribute.get(), m_style.get()); >+ return m_style->ensureCSSStyleDeclaration(); >+} >+ > } >diff --git a/Source/WebCore/dom/Attr.h b/Source/WebCore/dom/Attr.h >index 286cfaf..7e1d293 100644 >--- a/Source/WebCore/dom/Attr.h >+++ b/Source/WebCore/dom/Attr.h >@@ -31,6 +31,7 @@ > namespace WebCore { > > class CSSStyleDeclaration; >+class StylePropertySet; > > // Attr can have Text and EntityReference children > // therefore it has to be a fullblown Node. The plan >@@ -58,9 +59,7 @@ public: > > bool isId() const; > >- // A deprecated extension to get presentational information for attributes. >- // We have to keep it around because it's exposed in the Obj-C DOM API. >- CSSStyleDeclaration* style() { return 0; } >+ CSSStyleDeclaration* style(); > > void setSpecified(bool specified) { m_specified = specified; } > >@@ -93,6 +92,7 @@ private: > > Element* m_element; > RefPtr<Attribute> m_attribute; >+ RefPtr<StylePropertySet> m_style; > unsigned m_ignoreChildrenChanged : 31; > bool m_specified : 1; > }; >diff --git a/Source/WebCore/dom/StyledElement.h b/Source/WebCore/dom/StyledElement.h >index 7f9b280..fd937f4 100644 >--- a/Source/WebCore/dom/StyledElement.h >+++ b/Source/WebCore/dom/StyledElement.h >@@ -54,6 +54,8 @@ public: > > const SpaceSplitString& classNames() const; > >+ virtual void collectStyleForAttribute(Attribute*, StylePropertySet*) { } >+ > protected: > StyledElement(const QualifiedName& name, Document* document, ConstructionType type) > : Element(name, document, type) >@@ -65,7 +67,6 @@ protected: > virtual void copyNonAttributeProperties(const Element*); > > virtual bool isPresentationAttribute(const QualifiedName&) const { return false; } >- virtual void collectStyleForAttribute(Attribute*, StylePropertySet*) { } > > void addPropertyToAttributeStyle(StylePropertySet*, int propertyID, int identifier); > void addPropertyToAttributeStyle(StylePropertySet*, int propertyID, double value, CSSPrimitiveValue::UnitTypes);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 80678
: 131101