Commit 619fc75d authored by dbates@webkit.org's avatar dbates@webkit.org

[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.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154820 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 242efe66
2013-08-29 Daniel Bates <dabates@apple.com>
[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 <a.renevier@samsung.com>
[cairo] canvas drawing on itself doesn't work with accelerated canvas
......@@ -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 @@ static void resolveShadowTree(ShadowRoot* shadowRoot, RenderStyle* parentElement
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 @@ void resolveTree(Element* current, Change change)
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 @@ void resolveTree(Document* document, Change change)
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());
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment