diff options
Diffstat (limited to 'Source/WebCore/rendering')
-rw-r--r-- | Source/WebCore/rendering/InlineTextBox.cpp | 5 | ||||
-rw-r--r-- | Source/WebCore/rendering/RenderArena.cpp | 7 | ||||
-rw-r--r-- | Source/WebCore/rendering/RenderArena.h | 4 | ||||
-rw-r--r-- | Source/WebCore/rendering/RenderBlockLineLayout.cpp | 4 | ||||
-rw-r--r-- | Source/WebCore/rendering/RenderFrame.cpp | 16 | ||||
-rw-r--r-- | Source/WebCore/rendering/RenderHTMLCanvas.cpp | 7 | ||||
-rw-r--r-- | Source/WebCore/rendering/RenderLayer.cpp | 21 | ||||
-rw-r--r-- | Source/WebCore/rendering/RenderLayer.h | 9 | ||||
-rw-r--r-- | Source/WebCore/rendering/RenderLayerCompositor.cpp | 132 | ||||
-rw-r--r-- | Source/WebCore/rendering/RenderLayerCompositor.h | 2 | ||||
-rw-r--r-- | Source/WebCore/rendering/RenderText.cpp | 76 | ||||
-rw-r--r-- | Source/WebCore/rendering/RenderText.h | 4 | ||||
-rw-r--r-- | Source/WebCore/rendering/style/RenderStyle.h | 39 | ||||
-rw-r--r-- | Source/WebCore/rendering/style/StyleRareInheritedData.cpp | 34 | ||||
-rw-r--r-- | Source/WebCore/rendering/style/StyleRareInheritedData.h | 11 |
15 files changed, 217 insertions, 154 deletions
diff --git a/Source/WebCore/rendering/InlineTextBox.cpp b/Source/WebCore/rendering/InlineTextBox.cpp index 5815b8b..d5eeeae 100644 --- a/Source/WebCore/rendering/InlineTextBox.cpp +++ b/Source/WebCore/rendering/InlineTextBox.cpp @@ -43,6 +43,7 @@ #include "Text.h" #include "break_lines.h" #include <wtf/AlwaysInline.h> +#include <wtf/text/CString.h> using namespace std; @@ -1069,8 +1070,12 @@ void InlineTextBox::paintTextMatchMarker(GraphicsContext* pt, const FloatPoint& renderer()->theme()->platformInactiveTextSearchHighlightColor(); pt->save(); updateGraphicsContext(pt, color, color, 0, style->colorSpace()); // Don't draw text at all! +#if PLATFORM(ANDROID) + pt->drawHighlightForText(font, run, FloatPoint(boxOrigin.x(), boxOrigin.y() - deltaY), selHeight, color, style->colorSpace(), sPos, ePos, marker.activeMatch); +#else pt->clip(FloatRect(boxOrigin.x(), boxOrigin.y() - deltaY, m_logicalWidth, selHeight)); pt->drawHighlightForText(font, run, FloatPoint(boxOrigin.x(), boxOrigin.y() - deltaY), selHeight, color, style->colorSpace(), sPos, ePos); +#endif pt->restore(); } } diff --git a/Source/WebCore/rendering/RenderArena.cpp b/Source/WebCore/rendering/RenderArena.cpp index 57ed978..e15101f 100644 --- a/Source/WebCore/rendering/RenderArena.cpp +++ b/Source/WebCore/rendering/RenderArena.cpp @@ -136,11 +136,4 @@ void RenderArena::free(size_t size, void* ptr) #endif } -#ifdef ANDROID_INSTRUMENT -size_t RenderArena::reportPoolSize() const -{ - return ReportPoolSize(&m_pool); -} -#endif - } // namespace WebCore diff --git a/Source/WebCore/rendering/RenderArena.h b/Source/WebCore/rendering/RenderArena.h index 5d2559a..e1ff535 100644 --- a/Source/WebCore/rendering/RenderArena.h +++ b/Source/WebCore/rendering/RenderArena.h @@ -53,10 +53,6 @@ public: void* allocate(size_t); void free(size_t, void*); -#ifdef ANDROID_INSTRUMENT - size_t reportPoolSize() const; -#endif - private: // Underlying arena pool ArenaPool m_pool; diff --git a/Source/WebCore/rendering/RenderBlockLineLayout.cpp b/Source/WebCore/rendering/RenderBlockLineLayout.cpp index df20063..a2469a0 100644 --- a/Source/WebCore/rendering/RenderBlockLineLayout.cpp +++ b/Source/WebCore/rendering/RenderBlockLineLayout.cpp @@ -895,6 +895,10 @@ void RenderBlock::layoutInlineChildren(bool relayoutChildren, int& repaintLogica m_minPreferredLogicalWidth = min(m_minPreferredLogicalWidth, maxWidth); m_maxPreferredLogicalWidth = min(m_maxPreferredLogicalWidth, maxWidth); + // if overflow isn't visible, block elements may get clipped + // due to the limited content width. disable overflow clipping. + setHasOverflowClip(false); + IntRect overflow = layoutOverflowRect(); if (overflow.width() > maxWidth) { overflow.setWidth(maxWidth); diff --git a/Source/WebCore/rendering/RenderFrame.cpp b/Source/WebCore/rendering/RenderFrame.cpp index 4b1444b..0ae6eda 100644 --- a/Source/WebCore/rendering/RenderFrame.cpp +++ b/Source/WebCore/rendering/RenderFrame.cpp @@ -64,7 +64,12 @@ void RenderFrame::layout() { FrameView* view = static_cast<FrameView*>(widget()); RenderView* root = view ? view->frame()->contentRenderer() : 0; + + // Do not expand frames which has zero width or height if (!width() || !height() || !root) { + updateWidgetPosition(); + if (view) + view->layout(); setNeedsLayout(false); return; } @@ -75,14 +80,17 @@ void RenderFrame::layout() return; } - int layoutWidth = width(); + // Update the dimensions to get the correct width and height + updateWidgetPosition(); + if (root->preferredLogicalWidthsDirty()) + root->computePreferredLogicalWidths(); + // Expand the frame by setting frame height = content height setWidth(max(view->contentsWidth() + borderAndPaddingWidth(), width())); setHeight(max(view->contentsHeight() + borderAndPaddingHeight(), height())); - // Trigger a layout of the FrameView which will schedule a relayout of this RenderFrame. - if (layoutWidth < width()) - view->layout(); + // Update one more time + updateWidgetPosition(); setNeedsLayout(false); } diff --git a/Source/WebCore/rendering/RenderHTMLCanvas.cpp b/Source/WebCore/rendering/RenderHTMLCanvas.cpp index de2a2c1..03b406b 100644 --- a/Source/WebCore/rendering/RenderHTMLCanvas.cpp +++ b/Source/WebCore/rendering/RenderHTMLCanvas.cpp @@ -47,6 +47,13 @@ RenderHTMLCanvas::RenderHTMLCanvas(HTMLCanvasElement* element) bool RenderHTMLCanvas::requiresLayer() const { +#if PLATFORM(ANDROID) + // All Canvas are drawn on their own composited layer + // This improves performances a lot (as this simplify + // the repaint/inval chain dealing with the PictureSet) + return true; +#endif + if (RenderReplaced::requiresLayer()) return true; diff --git a/Source/WebCore/rendering/RenderLayer.cpp b/Source/WebCore/rendering/RenderLayer.cpp index cdc4c05..66aab18 100644 --- a/Source/WebCore/rendering/RenderLayer.cpp +++ b/Source/WebCore/rendering/RenderLayer.cpp @@ -64,6 +64,7 @@ #include "HTMLNames.h" #if ENABLE(ANDROID_OVERFLOW_SCROLL) #include "HTMLTextAreaElement.h" +#include "GraphicsLayerAndroid.h" #endif #include "HitTestRequest.h" #include "HitTestResult.h" @@ -1389,11 +1390,27 @@ void RenderLayer::scrollTo(int x, int y) view->updateWidgetPositions(); } +#if PLATFORM(ANDROID) + GraphicsLayerAndroid* backingLayer = 0; + bool scrollableContent = false; +#endif + #if USE(ACCELERATED_COMPOSITING) if (compositor()->inCompositingMode()) { // Our stacking context is guaranteed to contain all of our descendants that may need // repositioning, so update compositing layers from there. +#if ENABLE(ANDROID_OVERFLOW_SCROLL) + if (view && backing() && backing()->graphicsLayer()) { + backingLayer = static_cast<GraphicsLayerAndroid*>(backing()->graphicsLayer()); + scrollableContent = backingLayer->contentLayer() + && backingLayer->contentLayer()->contentIsScrollable(); + } + // If we have a scrollable content, no need to do this + RenderLayer* compositingAncestor = enclosingCompositingLayer(); + if (!scrollableContent && compositingAncestor) { +#else if (RenderLayer* compositingAncestor = stackingContext()->enclosingCompositingLayer()) { +#endif if (compositor()->compositingConsultsOverlap()) compositor()->updateCompositingLayers(CompositingUpdateOnScroll, compositingAncestor); else { @@ -1422,8 +1439,10 @@ void RenderLayer::scrollTo(int x, int y) #if ENABLE(ANDROID_OVERFLOW_SCROLL) // On android, scrollable areas are put on composited layers, so we // do not need to repaint simply because we are scrolling - if (view && !hasOverflowScroll()) + if (view && !(hasOverflowScroll() || scrollableContent)) renderer()->repaintUsingContainer(repaintContainer, rectForRepaint); + if (backingLayer && (hasOverflowScroll() || scrollableContent)) + backingLayer->updateScrollOffset(); #else if (view) renderer()->repaintUsingContainer(repaintContainer, rectForRepaint); diff --git a/Source/WebCore/rendering/RenderLayer.h b/Source/WebCore/rendering/RenderLayer.h index 02ab8e9..5e421f0 100644 --- a/Source/WebCore/rendering/RenderLayer.h +++ b/Source/WebCore/rendering/RenderLayer.h @@ -498,6 +498,12 @@ public: bool hasOverflowScroll() const { return m_hasOverflowScroll; } bool hasOverflowParent() const; #endif +#if PLATFORM(ANDROID) + bool intrinsicallyComposited() const { return m_intrinsicallyComposited; } + void setIntrinsicallyComposited(bool intrinsicallyComposited) { + m_intrinsicallyComposited = intrinsicallyComposited; + } +#endif private: // The normal operator new is disallowed on all render objects. @@ -751,6 +757,9 @@ protected: bool m_shouldComposite : 1; #endif #endif +#if PLATFORM(ANDROID) + bool m_intrinsicallyComposited : 1; +#endif bool m_containsDirtyOverlayScrollbars : 1; #if ENABLE(ANDROID_OVERFLOW_SCROLL) diff --git a/Source/WebCore/rendering/RenderLayerCompositor.cpp b/Source/WebCore/rendering/RenderLayerCompositor.cpp index 33bf2f7..733a418 100644 --- a/Source/WebCore/rendering/RenderLayerCompositor.cpp +++ b/Source/WebCore/rendering/RenderLayerCompositor.cpp @@ -78,7 +78,7 @@ struct CompositingState { : m_compositingAncestor(compAncestor) , m_subtreeIsCompositing(false) #if ENABLE(COMPOSITED_FIXED_ELEMENTS) - , m_fixedSibling(false) + , m_positionedSibling(false) , m_hasFixedElement(false) #endif #if ENABLE(ANDROID_OVERFLOW_SCROLL) @@ -92,8 +92,12 @@ struct CompositingState { RenderLayer* m_compositingAncestor; bool m_subtreeIsCompositing; + // m_compositingBounds is only used in computeCompositingRequirements. It can be either the + // ancestor bounds or the bounds for the sibling layers which are above the composited layer. + // It is used to reject creating unnecesary layers. + IntRect m_compositingBounds; #if ENABLE(COMPOSITED_FIXED_ELEMENTS) - bool m_fixedSibling; + bool m_positionedSibling; bool m_hasFixedElement; #endif #if ENABLE(ANDROID_OVERFLOW_SCROLL) @@ -347,7 +351,11 @@ bool RenderLayerCompositor::updateBacking(RenderLayer* layer, CompositingChangeR { bool layerChanged = false; +#if ENABLE(ANDROID_OVERFLOW_SCROLL) + if (needsToBeComposited(layer) || layer->shouldComposite()) { +#else if (needsToBeComposited(layer)) { +#endif enableCompositingMode(); // 3D transforms turn off the testing of overlap. @@ -613,23 +621,49 @@ bool RenderLayerCompositor::overlapsCompositedLayers(OverlapMap& overlapMap, con #if ENABLE(COMPOSITED_FIXED_ELEMENTS) -// to properly support z-index with composited fixed elements, we need to turn -// layers following a fixed layer into compositing mode; but if a layer is fully -// contained into a previous layer already composited (that is not the fixed -// layer), we don't need to composite it. This saves up quite a bit on the -// number of layers we have to composite. -// -bool RenderLayerCompositor::checkForFixedLayers(Vector<RenderLayer*>* list, bool stopAtFixedLayer) +bool RenderLayerCompositor::checkForPositionedElements(Vector<RenderLayer*>* list) { int listSize = list->size(); int haveFixedLayer = -1; bool fixedSibling = false; + bool positionedSibling = false; + + // For absolute positioned elements, we need to check if they are followed + // by a composited element; if so, they also need to be composited, as the + // layer display rendering might be incorrect (absolute elements being + // removed from the flow). + for (int i = 0; i < listSize; ++i) { + RenderLayer* currentLayer = list->at(i); + if (!needsToBeComposited(currentLayer) + && !currentLayer->shouldComposite() + && currentLayer->renderer()->isPositioned()) { + positionedSibling = true; + // check if there is a composited layer later, if so we should be + // composited. + for (int j = i + 1; j < listSize; ++j) { + RenderLayer* layer = list->at(j); + if (needsToBeComposited(layer)) { + currentLayer->setShouldComposite(true); + break; + } + } + break; + } + } + + // If we find a fixed layer, let's mark all the following layers as being + // composited. The layers' surfaces will be merged if needed UI-side. for (int j = 0; j < listSize; ++j) { RenderLayer* currentLayer = list->at(j); + if (currentLayer->shouldComposite()) + continue; + if (currentLayer->isFixed() && needsToBeComposited(currentLayer)) { haveFixedLayer = j; fixedSibling = true; } + + // Bypass fixed layers with a width or height or 1 or less... IntRect currentLayerBounds = currentLayer->renderer()->localToAbsoluteQuad( FloatRect(currentLayer->localBoundingBox())).enclosingBoundingBox(); if ((currentLayerBounds.width() <= 1 @@ -638,28 +672,11 @@ bool RenderLayerCompositor::checkForFixedLayers(Vector<RenderLayer*>* list, bool haveFixedLayer = -1; fixedSibling = false; } - if (haveFixedLayer != -1 && haveFixedLayer != j) { - bool needComposite = true; - int stop = 0; - if (stopAtFixedLayer) - stop = haveFixedLayer + 1; - - for (int k = j - 1; k >= stop; --k) { - RenderLayer* aLayer = list->at(k); - if (aLayer && aLayer->renderer()) { - IntRect bounds = aLayer->renderer()->localToAbsoluteQuad( - FloatRect(aLayer->localBoundingBox())).enclosingBoundingBox(); - if (bounds.contains(currentLayerBounds) - && needsToBeComposited(aLayer) && aLayer->isStackingContext()) { - needComposite = false; - break; - } - } - } - currentLayer->setShouldComposite(needComposite); - } + + if (haveFixedLayer != -1 && haveFixedLayer != j) + currentLayer->setShouldComposite(true); } - return fixedSibling; + return positionedSibling || fixedSibling; } #endif @@ -678,7 +695,12 @@ void RenderLayerCompositor::computeCompositingRequirements(RenderLayer* layer, O layer->updateLayerPosition(); layer->updateZOrderLists(); layer->updateNormalFlowList(); - +#if PLATFORM(ANDROID) + RenderObject* renderer = layer->renderer(); + bool intCom = requiresCompositingLayer(layer); + layer->setIntrinsicallyComposited(intCom); +#endif + // Clear the flag layer->setHasCompositingDescendant(false); @@ -693,28 +715,33 @@ void RenderLayerCompositor::computeCompositingRequirements(RenderLayer* layer, O if (absBounds.isEmpty()) absBounds.setSize(IntSize(1, 1)); haveComputedBounds = true; - mustOverlapCompositedLayers = overlapsCompositedLayers(*overlapMap, absBounds); + // If the current subtree is not compositing, and the layer is fully inside the current compositing bounnds, + // there is no need to do the overlap test. This reduces the total number of the composited layers. + if (compositingState.m_subtreeIsCompositing || !compositingState.m_compositingBounds.contains(absBounds)) + mustOverlapCompositedLayers = overlapsCompositedLayers(*overlapMap, absBounds); } - -#if ENABLE(COMPOSITED_FIXED_ELEMENTS) - if (compositingState.m_fixedSibling) - layer->setMustOverlapCompositedLayers(layer->shouldComposite()); - else - layer->setMustOverlapCompositedLayers(mustOverlapCompositedLayers); -#else + layer->setMustOverlapCompositedLayers(mustOverlapCompositedLayers); -#endif - + // The children of this layer don't need to composite, unless there is // a compositing layer among them, so start by inheriting the compositing // ancestor with m_subtreeIsCompositing set to false. CompositingState childState(compositingState.m_compositingAncestor); + if (compositingState.m_subtreeIsCompositing) + childState.m_compositingBounds = absBounds; + else + childState.m_compositingBounds = compositingState.m_compositingBounds; #ifndef NDEBUG ++childState.m_depth; #endif bool willBeComposited = needsToBeComposited(layer); +#if ENABLE(COMPOSITED_FIXED_ELEMENTS) + willBeComposited |= layer->shouldComposite(); + layer->setMustOverlapCompositedLayers(layer->shouldComposite()); +#endif + #if ENABLE(ANDROID_OVERFLOW_SCROLL) // tell the parent it has scrollable descendants. if (layer->hasOverflowScroll()) @@ -729,6 +756,7 @@ void RenderLayerCompositor::computeCompositingRequirements(RenderLayer* layer, O compositingState.m_subtreeIsCompositing = true; // This layer now acts as the ancestor for kids. childState.m_compositingAncestor = layer; + childState.m_compositingBounds = absBounds; if (overlapMap) addToOverlapMap(*overlapMap, layer, absBounds, haveComputedBounds); } @@ -746,9 +774,9 @@ void RenderLayerCompositor::computeCompositingRequirements(RenderLayer* layer, O if (Vector<RenderLayer*>* negZOrderList = layer->negZOrderList()) { size_t listSize = negZOrderList->size(); #if ENABLE(COMPOSITED_FIXED_ELEMENTS) - childState.m_fixedSibling = compositingState.m_fixedSibling; - if (checkForFixedLayers(negZOrderList, false)) - childState.m_fixedSibling = true; + childState.m_positionedSibling = compositingState.m_positionedSibling; + if (checkForPositionedElements(negZOrderList)) + childState.m_positionedSibling = true; #endif for (size_t i = 0; i < listSize; ++i) { RenderLayer* curLayer = negZOrderList->at(i); @@ -783,9 +811,9 @@ void RenderLayerCompositor::computeCompositingRequirements(RenderLayer* layer, O if (Vector<RenderLayer*>* normalFlowList = layer->normalFlowList()) { size_t listSize = normalFlowList->size(); #if ENABLE(COMPOSITED_FIXED_ELEMENTS) - childState.m_fixedSibling = compositingState.m_fixedSibling; - if (checkForFixedLayers(normalFlowList, true)) - childState.m_fixedSibling = true; + childState.m_positionedSibling = compositingState.m_positionedSibling; + if (checkForPositionedElements(normalFlowList)) + childState.m_positionedSibling = true; #endif for (size_t i = 0; i < listSize; ++i) { RenderLayer* curLayer = normalFlowList->at(i); @@ -797,9 +825,9 @@ void RenderLayerCompositor::computeCompositingRequirements(RenderLayer* layer, O if (Vector<RenderLayer*>* posZOrderList = layer->posZOrderList()) { size_t listSize = posZOrderList->size(); #if ENABLE(COMPOSITED_FIXED_ELEMENTS) - childState.m_fixedSibling = compositingState.m_fixedSibling; - if (checkForFixedLayers(posZOrderList, true)) - childState.m_fixedSibling = true; + childState.m_positionedSibling = compositingState.m_positionedSibling; + if (checkForPositionedElements(posZOrderList)) + childState.m_positionedSibling = true; #endif for (size_t i = 0; i < listSize; ++i) { RenderLayer* curLayer = posZOrderList->at(i); @@ -1398,6 +1426,10 @@ bool RenderLayerCompositor::requiresCompositingForAndroidLayers(const RenderLaye if (layer->isFixed()) return true; #endif + + if (layer->renderer()->isCanvas()) + return true; + return false; } #endif diff --git a/Source/WebCore/rendering/RenderLayerCompositor.h b/Source/WebCore/rendering/RenderLayerCompositor.h index 813e265..2de1037 100644 --- a/Source/WebCore/rendering/RenderLayerCompositor.h +++ b/Source/WebCore/rendering/RenderLayerCompositor.h @@ -219,7 +219,7 @@ private: void updateCompositingLayersTimerFired(Timer<RenderLayerCompositor>*); #if ENABLE(COMPOSITED_FIXED_ELEMENTS) - bool checkForFixedLayers(Vector<RenderLayer*>* list, bool stopAtFixedLayer); + bool checkForPositionedElements(Vector<RenderLayer*>* list); #endif // Returns true if any layer's compositing changed diff --git a/Source/WebCore/rendering/RenderText.cpp b/Source/WebCore/rendering/RenderText.cpp index b35820a..6f4d3b7 100644 --- a/Source/WebCore/rendering/RenderText.cpp +++ b/Source/WebCore/rendering/RenderText.cpp @@ -37,6 +37,7 @@ #include "RenderCombineText.h" #include "RenderLayer.h" #include "RenderView.h" +#include "Settings.h" #include "Text.h" #include "TextBreakIterator.h" #include "TextResourceDecoder.h" @@ -53,6 +54,37 @@ using namespace Unicode; namespace WebCore { +class SecureTextTimer; +typedef HashMap<RenderText*, SecureTextTimer*> SecureTextTimerMap; +static SecureTextTimerMap* gSecureTextTimers = 0; + +class SecureTextTimer : public TimerBase { +public: + SecureTextTimer(RenderText* renderText) + : m_renderText(renderText) + , m_lastTypedCharacterOffset(-1) + { + } + + void restartWithNewText(unsigned lastTypedCharacterOffset) + { + m_lastTypedCharacterOffset = lastTypedCharacterOffset; + startOneShot(m_renderText->document()->settings()->passwordEchoDurationInSeconds()); + } + void invalidate() { m_lastTypedCharacterOffset = -1; } + unsigned lastTypedCharacterOffset() { return m_lastTypedCharacterOffset; } + +private: + virtual void fired() + { + ASSERT(gSecureTextTimers->contains(m_renderText)); + m_renderText->setText(m_renderText->text(), true /* forcing setting text as it may be masked later */); + } + + RenderText* m_renderText; + int m_lastTypedCharacterOffset; +}; + static void makeCapitalized(String* string, UChar previous) { if (string->isNull()) @@ -196,6 +228,9 @@ void RenderText::removeAndDestroyTextBoxes() void RenderText::destroy() { + if (SecureTextTimer* secureTextTimer = gSecureTextTimers ? gSecureTextTimers->take(this) : 0) + delete secureTextTimer; + removeAndDestroyTextBoxes(); RenderObject::destroy(); } @@ -1140,13 +1175,13 @@ void RenderText::setTextInternal(PassRefPtr<StringImpl> text) case TSNONE: break; case TSCIRCLE: - m_text.makeSecure(whiteBullet); + secureText(whiteBullet); break; case TSDISC: - m_text.makeSecure(bullet); + secureText(bullet); break; case TSSQUARE: - m_text.makeSecure(blackSquare); + secureText(blackSquare); } } @@ -1156,6 +1191,28 @@ void RenderText::setTextInternal(PassRefPtr<StringImpl> text) m_isAllASCII = m_text.containsOnlyASCII(); } +void RenderText::secureText(UChar mask) +{ + if (!m_text.length()) + return; + + int lastTypedCharacterOffsetToReveal = -1; + String revealedText; + SecureTextTimer* secureTextTimer = gSecureTextTimers ? gSecureTextTimers->get(this) : 0; + if (secureTextTimer && secureTextTimer->isActive()) { + lastTypedCharacterOffsetToReveal = secureTextTimer->lastTypedCharacterOffset(); + if (lastTypedCharacterOffsetToReveal >= 0) + revealedText.append(m_text[lastTypedCharacterOffsetToReveal]); + } + + m_text.makeSecure(mask); + if (lastTypedCharacterOffsetToReveal >= 0) { + m_text.replace(lastTypedCharacterOffsetToReveal, 1, revealedText); + // m_text may be updated later before timer fires. We invalidate the lastTypedCharacterOffset to avoid inconsistency. + secureTextTimer->invalidate(); + } +} + void RenderText::setText(PassRefPtr<StringImpl> text, bool force) { ASSERT(text); @@ -1590,4 +1647,17 @@ void RenderText::checkConsistency() const #endif +void RenderText::momentarilyRevealLastTypedCharacter(unsigned lastTypedCharacterOffset) +{ + if (!gSecureTextTimers) + gSecureTextTimers = new SecureTextTimerMap; + + SecureTextTimer* secureTextTimer = gSecureTextTimers->get(this); + if (!secureTextTimer) { + secureTextTimer = new SecureTextTimer(this); + gSecureTextTimers->add(this, secureTextTimer); + } + secureTextTimer->restartWithNewText(lastTypedCharacterOffset); +} + } // namespace WebCore diff --git a/Source/WebCore/rendering/RenderText.h b/Source/WebCore/rendering/RenderText.h index 2008dad..f89a762 100644 --- a/Source/WebCore/rendering/RenderText.h +++ b/Source/WebCore/rendering/RenderText.h @@ -117,6 +117,9 @@ public: bool containsReversedText() const { return m_containsReversedText; } + bool isSecure() const { return style()->textSecurity() != TSNONE; } + void momentarilyRevealLastTypedCharacter(unsigned lastTypedCharacterOffset); + InlineTextBox* findNextInlineTextBox(int offset, int& pos) const; bool allowTabs() const { return !style()->collapseWhiteSpace(); } @@ -158,6 +161,7 @@ private: void updateNeedsTranscoding(); inline void transformText(String&) const; + void secureText(UChar mask); float m_minWidth; // here to minimize padding in 64-bit. diff --git a/Source/WebCore/rendering/style/RenderStyle.h b/Source/WebCore/rendering/style/RenderStyle.h index fad5a7b..ea01064 100644 --- a/Source/WebCore/rendering/style/RenderStyle.h +++ b/Source/WebCore/rendering/style/RenderStyle.h @@ -786,19 +786,6 @@ public: ESpeak speak() { return static_cast<ESpeak>(rareInheritedData->speak); } -#ifdef ANDROID_CSS_RING - // called when building nav cache to determine if the ring data is unchanged - const void* ringData() const { return reinterpret_cast<const void*>(rareInheritedData.get()); } - Color ringFillColor() const { return rareInheritedData->ringFillColor; } - Length ringInnerWidth() const { return rareInheritedData->ringInnerWidth; } - Length ringOuterWidth() const { return rareInheritedData->ringOuterWidth; } - Length ringOutset() const { return rareInheritedData->ringOutset; } - Color ringPressedInnerColor() const { return rareInheritedData->ringPressedInnerColor; } - Color ringPressedOuterColor() const { return rareInheritedData->ringPressedOuterColor; } - Length ringRadius() const { return rareInheritedData->ringRadius; } - Color ringSelectedInnerColor() const { return rareInheritedData->ringSelectedInnerColor; } - Color ringSelectedOuterColor() const { return rareInheritedData->ringSelectedOuterColor; } -#endif #ifdef ANDROID_CSS_TAP_HIGHLIGHT_COLOR Color tapHighlightColor() const { return rareInheritedData->tapHighlightColor; } #endif @@ -1142,21 +1129,6 @@ public: void setTextSizeAdjust(bool b) { SET_VAR(rareInheritedData, textSizeAdjust, b); } void setTextSecurity(ETextSecurity aTextSecurity) { SET_VAR(rareInheritedData, textSecurity, aTextSecurity); } -#ifdef ANDROID_CSS_RING - void setRingFillColor(const Color& v) { SET_VAR(rareInheritedData, ringFillColor, v); } - void setRingInnerWidth(Length v) { SET_VAR(rareInheritedData, ringInnerWidth, v); } - void setRingOuterWidth(Length v) { SET_VAR(rareInheritedData, ringOuterWidth, v); } - void setRingOutset(Length v) { SET_VAR(rareInheritedData, ringOutset, v); } - void setRingPressedInnerColor(const Color& v) { - SET_VAR(rareInheritedData, ringPressedInnerColor, v); } - void setRingPressedOuterColor(const Color& v) { - SET_VAR(rareInheritedData, ringPressedOuterColor, v); } - void setRingRadius(Length v) { SET_VAR(rareInheritedData, ringRadius, v); } - void setRingSelectedInnerColor(const Color& v) { - SET_VAR(rareInheritedData, ringSelectedInnerColor, v); } - void setRingSelectedOuterColor(const Color& v) { - SET_VAR(rareInheritedData, ringSelectedOuterColor, v); } -#endif #ifdef ANDROID_CSS_TAP_HIGHLIGHT_COLOR void setTapHighlightColor(const Color& v) { SET_VAR(rareInheritedData, tapHighlightColor, v); } #endif @@ -1359,17 +1331,6 @@ public: static const Vector<StyleDashboardRegion>& noneDashboardRegions(); #endif -#ifdef ANDROID_CSS_RING - static Color initialRingFillColor() { return Color::ringFill; } - static Length initialRingInnerWidth() { return Length(16, Fixed); } // 1.0 - static Length initialRingOuterWidth() { return Length(40, Fixed); } // 2.5 - static Length initialRingOutset() { return Length(3, Fixed); } - static Color initialRingSelectedInnerColor() { return Color::ringSelectedInner; } - static Color initialRingSelectedOuterColor() { return Color::ringSelectedOuter; } - static Color initialRingPressedInnerColor() { return Color::ringPressedInner; } - static Color initialRingPressedOuterColor() { return Color::ringPressedOuter; } - static Length initialRingRadius() { return Length(1, Fixed); } -#endif #ifdef ANDROID_CSS_TAP_HIGHLIGHT_COLOR static Color initialTapHighlightColor() { return Color::tap; } #endif diff --git a/Source/WebCore/rendering/style/StyleRareInheritedData.cpp b/Source/WebCore/rendering/style/StyleRareInheritedData.cpp index 2253d1c..a7acc4a 100644 --- a/Source/WebCore/rendering/style/StyleRareInheritedData.cpp +++ b/Source/WebCore/rendering/style/StyleRareInheritedData.cpp @@ -32,17 +32,6 @@ namespace WebCore { StyleRareInheritedData::StyleRareInheritedData() : textStrokeWidth(RenderStyle::initialTextStrokeWidth()) -#ifdef ANDROID_CSS_RING - , ringFillColor(RenderStyle::initialRingFillColor()) - , ringInnerWidth(RenderStyle::initialRingInnerWidth()) - , ringOuterWidth(RenderStyle::initialRingOuterWidth()) - , ringOutset(RenderStyle::initialRingOutset()) - , ringPressedInnerColor(RenderStyle::initialRingPressedInnerColor()) - , ringPressedOuterColor(RenderStyle::initialRingPressedOuterColor()) - , ringRadius(RenderStyle::initialRingRadius()) - , ringSelectedInnerColor(RenderStyle::initialRingSelectedInnerColor()) - , ringSelectedOuterColor(RenderStyle::initialRingSelectedOuterColor()) -#endif #ifdef ANDROID_CSS_TAP_HIGHLIGHT_COLOR , tapHighlightColor(RenderStyle::initialTapHighlightColor()) #endif @@ -77,18 +66,6 @@ StyleRareInheritedData::StyleRareInheritedData(const StyleRareInheritedData& o) , textStrokeColor(o.textStrokeColor) , textStrokeWidth(o.textStrokeWidth) , textFillColor(o.textFillColor) - , textEmphasisColor(o.textEmphasisColor) -#ifdef ANDROID_CSS_RING - , ringFillColor(o.ringFillColor) - , ringInnerWidth(o.ringInnerWidth) - , ringOuterWidth(o.ringOuterWidth) - , ringOutset(o.ringOutset) - , ringPressedInnerColor(o.ringPressedInnerColor) - , ringPressedOuterColor(o.ringPressedOuterColor) - , ringRadius(o.ringRadius) - , ringSelectedInnerColor(o.ringSelectedInnerColor) - , ringSelectedOuterColor(o.ringSelectedOuterColor) -#endif #ifdef ANDROID_CSS_TAP_HIGHLIGHT_COLOR , tapHighlightColor(o.tapHighlightColor) #endif @@ -157,17 +134,6 @@ bool StyleRareInheritedData::operator==(const StyleRareInheritedData& o) const && nbspMode == o.nbspMode && khtmlLineBreak == o.khtmlLineBreak && textSizeAdjust == o.textSizeAdjust -#ifdef ANDROID_CSS_RING - && ringFillColor == o.ringFillColor - && ringInnerWidth == o.ringInnerWidth - && ringOuterWidth == o.ringOuterWidth - && ringOutset == o.ringOutset - && ringPressedInnerColor == o.ringPressedInnerColor - && ringPressedOuterColor == o.ringPressedOuterColor - && ringRadius == o.ringRadius - && ringSelectedInnerColor == o.ringSelectedInnerColor - && ringSelectedOuterColor == o.ringSelectedOuterColor -#endif #ifdef ANDROID_CSS_TAP_HIGHLIGHT_COLOR && tapHighlightColor == o.tapHighlightColor #endif diff --git a/Source/WebCore/rendering/style/StyleRareInheritedData.h b/Source/WebCore/rendering/style/StyleRareInheritedData.h index 39cfe3c..16fcc5f 100644 --- a/Source/WebCore/rendering/style/StyleRareInheritedData.h +++ b/Source/WebCore/rendering/style/StyleRareInheritedData.h @@ -58,17 +58,6 @@ public: Color textFillColor; Color textEmphasisColor; -#ifdef ANDROID_CSS_RING - Color ringFillColor; - Length ringInnerWidth; - Length ringOuterWidth; - Length ringOutset; - Color ringPressedInnerColor; - Color ringPressedOuterColor; - Length ringRadius; - Color ringSelectedInnerColor; - Color ringSelectedOuterColor; -#endif #ifdef ANDROID_CSS_TAP_HIGHLIGHT_COLOR Color tapHighlightColor; #endif |