Title: [154820] trunk/Source/WebCore
- Revision
- 154820
- Author
- [email protected]
- Date
- 2013-08-29 10:35:01 -0700 (Thu, 29 Aug 2013)
Log Message
[iOS] Upstream changes to WebCore/style
https://bugs.webkit.org/show_bug.cgi?id=120173
Reviewed by Darin Adler.
* style/StyleResolveTree.cpp:
(WebCore::Style::elementImplicitVisibility): Added; specific to iOS.
(WebCore::Style::CheckForVisibilityChangeOnRecalcStyle::CheckForVisibilityChangeOnRecalcStyle): Added; specific to iOS.
(WebCore::Style::CheckForVisibilityChangeOnRecalcStyle::~CheckForVisibilityChangeOnRecalcStyle): Added; specific to iOS.
(WebCore::Style::resolveTree): Modified to instantiate CheckForVisibilityChangeOnRecalcStyle when building on iOS.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (154819 => 154820)
--- trunk/Source/WebCore/ChangeLog 2013-08-29 17:23:29 UTC (rev 154819)
+++ trunk/Source/WebCore/ChangeLog 2013-08-29 17:35:01 UTC (rev 154820)
@@ -1,3 +1,16 @@
+2013-08-29 Daniel Bates <[email protected]>
+
+ [iOS] Upstream changes to WebCore/style
+ https://bugs.webkit.org/show_bug.cgi?id=120173
+
+ Reviewed by Darin Adler.
+
+ * style/StyleResolveTree.cpp:
+ (WebCore::Style::elementImplicitVisibility): Added; specific to iOS.
+ (WebCore::Style::CheckForVisibilityChangeOnRecalcStyle::CheckForVisibilityChangeOnRecalcStyle): Added; specific to iOS.
+ (WebCore::Style::CheckForVisibilityChangeOnRecalcStyle::~CheckForVisibilityChangeOnRecalcStyle): Added; specific to iOS.
+ (WebCore::Style::resolveTree): Modified to instantiate CheckForVisibilityChangeOnRecalcStyle when building on iOS.
+
2013-08-29 Arnaud Renevier <[email protected]>
[cairo] canvas drawing on itself doesn't work with accelerated canvas
Modified: trunk/Source/WebCore/style/StyleResolveTree.cpp (154819 => 154820)
--- trunk/Source/WebCore/style/StyleResolveTree.cpp 2013-08-29 17:23:29 UTC (rev 154819)
+++ trunk/Source/WebCore/style/StyleResolveTree.cpp 2013-08-29 17:35:01 UTC (rev 154820)
@@ -45,6 +45,11 @@
#include "StyleResolver.h"
#include "Text.h"
+#if PLATFORM(IOS)
+#include "CSSFontSelector.h"
+#include "WKContentObservation.h"
+#endif
+
namespace WebCore {
namespace Style {
@@ -685,6 +690,60 @@
shadowRoot->clearChildNeedsStyleRecalc();
}
+#if PLATFORM(IOS)
+static EVisibility elementImplicitVisibility(const Element* element)
+{
+ RenderObject* renderer = element->renderer();
+ if (!renderer)
+ return VISIBLE;
+
+ RenderStyle* style = renderer->style();
+ if (!style)
+ return VISIBLE;
+
+ Length width(style->width());
+ Length height(style->height());
+ if ((width.isFixed() && width.value() <= 0) || (height.isFixed() && height.value() <= 0))
+ return HIDDEN;
+
+ Length top(style->top());
+ Length left(style->left());
+ if (left.isFixed() && width.isFixed() && -left.value() >= width.value())
+ return HIDDEN;
+
+ if (top.isFixed() && height.isFixed() && -top.value() >= height.value())
+ return HIDDEN;
+ return VISIBLE;
+}
+
+class CheckForVisibilityChangeOnRecalcStyle {
+public:
+ CheckForVisibilityChangeOnRecalcStyle(Element* element, RenderStyle* currentStyle)
+ : m_element(element)
+ , m_previousDisplay(currentStyle ? currentStyle->display() : NONE)
+ , m_previousVisibility(currentStyle ? currentStyle->visibility() : HIDDEN)
+ , m_previousImplicitVisibility(WKObservingContentChanges() && WKContentChange() != WKContentVisibilityChange ? elementImplicitVisibility(element) : VISIBLE)
+ {
+ }
+ ~CheckForVisibilityChangeOnRecalcStyle()
+ {
+ if (!WKObservingContentChanges())
+ return;
+ RenderStyle* style = m_element->renderStyle();
+ if (!style)
+ return;
+ if ((m_previousDisplay == NONE && style->display() != NONE) || (m_previousVisibility == HIDDEN && style->visibility() != HIDDEN)
+ || (m_previousImplicitVisibility == HIDDEN && elementImplicitVisibility(m_element.get()) == VISIBLE))
+ WKSetObservedContentChange(WKContentVisibilityChange);
+ }
+private:
+ RefPtr<Element> m_element;
+ EDisplay m_previousDisplay;
+ EVisibility m_previousVisibility;
+ EVisibility m_previousImplicitVisibility;
+};
+#endif // PLATFORM(IOS)
+
void resolveTree(Element* current, Change change)
{
ASSERT(change != Detach);
@@ -699,6 +758,10 @@
bool hasDirectAdjacentRules = current->childrenAffectedByDirectAdjacentRules();
bool hasIndirectAdjacentRules = current->childrenAffectedByForwardPositionalRules();
+#if PLATFORM(IOS)
+ CheckForVisibilityChangeOnRecalcStyle checkForVisibilityChange(current, current->renderStyle());
+#endif
+
if (change > NoChange || current->needsStyleRecalc())
current->resetComputedStyle();
@@ -759,6 +822,16 @@
if (resolveRootStyle) {
RefPtr<RenderStyle> documentStyle = resolveForDocument(document);
+#if PLATFORM(IOS)
+ // Inserting the pictograph font at the end of the font fallback list is done by the
+ // font selector, so set a font selector if needed.
+ if (Settings* settings = document->settings()) {
+ StyleResolver* styleResolver = document->styleResolverIfExists();
+ if (settings->fontFallbackPrefersPictographs() && styleResolver)
+ documentStyle->font().update(styleResolver->fontSelector());
+ }
+#endif
+
Style::Change documentChange = determineChange(documentStyle.get(), document->renderer()->style(), document->settings());
if (documentChange != NoChange)
document->renderer()->setStyle(documentStyle.release());
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes